Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion gulpfile.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ gulp.task('watch', ['build'], () => {
$.runSequence('icons', $.livereload.reload);
});
gulp.watch(['./src/scripts/**/*']).on('change', () => {
$.runSequence('lint.js');
$.runSequence('js', $.livereload.reload);
});
gulp.watch(['./src/styles/**/*']).on('change', () => {
Expand Down Expand Up @@ -153,6 +154,16 @@ gulp.task('js', () => {
return buildJS(target);
});

gulp.task('lint.js', () => { // generate a zip
return gulp.src(['./src/scripts/background/*.js', './src/scripts/components/**/*.js', './src/scripts/config/*.js', './src/scripts/utils/*.js']).pipe($.eslint())
// $.eslint.format() outputs the lint results to the console.
// Alternatively use $.eslint.formatEach() (see Docs).
.pipe($.eslint.format())
// To have the process exit with an error code (1) on
// lint error, return the stream and pipe to failAfterError last.
// .pipe($.eslint.failAfterError());
});

gulp.task('styles', () => {
return gulp.src([`src/styles/index.${target}.scss`])
.pipe($.plumber())
Expand Down Expand Up @@ -213,6 +224,7 @@ gulp.task('dist', (cb) => { // generate a zip
$.runSequence('build', 'zip', cb);
});


gulp.task('zip', () => {
return pipe(`./build/${target}/**/*`, $.zip(`${target}.zip`), './dist');
});
Expand Down Expand Up @@ -258,7 +270,7 @@ function buildJS(target) {
let tasks = files.map(file => {
return browserify({
entries: 'src/scripts/' + file.source,
debug: true
debug: !production
})
.transform('babelify', {
presets: [
Expand Down
6 changes: 3 additions & 3 deletions src/scripts/background/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const data = (() => {
});
}

//clean all tickets an user acount data;
// //clean all tickets an user acount data;
function cleanAll() {
console.log('>-------- The app is cleaned');
setStorage({
Expand Down Expand Up @@ -181,7 +181,7 @@ const data = (() => {
filtertTickets: filtertTickets,
filtertTicketsAmout: filtertTickets.length,
allTicketsFromThisWebsite: amountTicketsOnWebsite,
allTicketsFromThisWebsiteAmount: amountTicketsOnWebsite.length,
allTicketsFromThisWebsiteAmount: amountTicketsOnWebsite.length
});

}).catch(function (err) {
Expand Down Expand Up @@ -216,7 +216,7 @@ const data = (() => {
account: {
userName: accountUserName,
passWord: accountPassword,
token: accountToken,
token: accountToken
},
tool: {
project: toolProjectId,
Expand Down
34 changes: 32 additions & 2 deletions src/scripts/background/findUserData.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,40 @@ var data = (() => {
browserVersion: browserConfig.version,
osversion: browserConfig.osversion,
user_agent: window.navigator.appVersion,
os: (browserConfig.mac) ? 'mac' : false || (browserConfig.windows) ? 'windows' : false || (browserConfig.windowsphone) ? 'windowsphone' : false || (browserConfig.linux) ? 'linux' : false || (browserConfig.chromeos) ? 'chromeos' : false || (browserConfig.android) ? 'android' : false || (browserConfig.ios) ? 'ios' : false || (browserConfig.blackberry) ? 'blackberry' : false || (browserConfig.firefoxos) ? 'firefoxos' : false || (browserConfig.webos) ? 'webos' : false || (browserConfig.bada) ? 'bada' : false || (browserConfig.tizen) ? 'tizen' : false || (browserConfig.sailfish) ? 'sailfish' : false
os: getOs()
};
};

function getOs() {
if (browserConfig.mac) {
return 'mac';
} else if (browserConfig.windows) {
return 'windows';
} else if (browserConfig.windowsphone) {
return 'windowsphone';
} else if (browserConfig.linux) {
return 'linux';
} else if (browserConfig.chromeos) {
return 'chromeos';
} else if (browserConfig.android) {
return 'android';
} else if (browserConfig.ios) {
return 'ios';
} else if (browserConfig.blackberry) {
return 'blackberry';
} else if (browserConfig.firefoxos) {
return 'firefoxos';
} else if (browserConfig.webos) {
return 'webos';
} else if (browserConfig.bada) {
return 'bada';
} else if (browserConfig.tizen) {
return 'tizen';
} else if (browserConfig.sailfish) {
return 'sailfish';
}
return false;
}

/**
* Get specific user data
Expand All @@ -35,7 +65,7 @@ var data = (() => {
shortlink: shortlink,
hostname: hostname,
time: new Date(),
screenresolution: screenresolution,
screenresolution: screenresolution
// history: getHistory()
};

Expand Down
11 changes: 8 additions & 3 deletions src/scripts/background/mantisApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,12 @@ let mantisApi = (() => {
message: 'Your credentials are wrong'
});
} else {
resolve(res);
//if there is only one project in mantis the api returns a object instead of a array
if (res.item) {
resolve([res.item]);
} else {
resolve(res);
}
}
}

Expand Down Expand Up @@ -136,10 +141,10 @@ let mantisApi = (() => {
os_build: newTicketObject.data.browserData.osversion,
priority: {
id: (newTicketObject.isImportant === true) ? IMPORTANT_WEIGHT : NOMAL_WEIGHT,
name: (newTicketObject.isImportant === true) ? 'height' : 'normal',
name: (newTicketObject.isImportant === true) ? 'height' : 'normal'
},
steps_to_reproduce: JSON.stringify(newTicketObject.data),
category: 'General', //This one is requert by mantis.
category: 'General' //This one is requert by mantis.
// attachments: newTicketObject.assets
};

Expand Down
2 changes: 1 addition & 1 deletion src/scripts/components/button.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

/* Setup ==================================================================== */
import React, {Component} from 'react';
import React, {Component} from 'react'; // eslint-disable-line no-unused-vars

/* Component ==================================================================== */
class Button extends Component {
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/components/commentbox/fileItem.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

/* Setup ==================================================================== */
import React, {Component} from 'react';
import React, {Component} from 'react'; // eslint-disable-line no-unused-vars

import helpers, {translate} from '../../utils/helpers';

Expand Down
33 changes: 20 additions & 13 deletions src/scripts/components/commentbox/index.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
'use strict';

/* Setup ==================================================================== */
/*eslint-disable no-unused-vars*/
import React, {Component} from 'react';
import Anime from 'react-anime';

import message from '../../utils/message.js';

//import components
import Button from '../button'
import Button from '../button';
import TextareaAutosize from '../textareaAutosize';
import FileItem from './fileItem';
import Loader from '../loader';
Expand All @@ -17,6 +18,7 @@ import helpers, {translate} from '../../utils/helpers';
import generalConfig from '../../config/general';
// import data from '../../utils/data''Turn Layernotes On'
import routerHelper from '../router/routerHelper';
/*eslint-enable no-unused-vars*/

/* Component ==================================================================== */
class CommentBox extends Component {
Expand Down Expand Up @@ -60,15 +62,9 @@ class CommentBox extends Component {
super(props);
this.state = {
isError: false, //it the error should be shown
errorText: '', // the error text
scale: [1] //Do not scale by default
errorText: '' // the error text
};
}
componentWillUnmount() {
this.setState({
scale: [1, 0.3]
});
}

/**
* Adds for normal inputs
Expand Down Expand Up @@ -233,8 +229,19 @@ class CommentBox extends Component {
//set the posiotn of the comment box
_setPosition = () => {
const MAX_POSITON_BOTTOM = 250;
const HEIGHT = {
CONTENTMODE: 231,
ELSE: 192,
EDDITMODE: 480
};
const SPACEING = 100;
const PADDING = 15;
//-------------------------------------------------------------------------------standard height with edit bar: standard height without eddit bar ------------------------------------------- the margin;
const commentBoxHeight = (document.querySelector('.ln-commentbox') === null) ? ((this.props.inEditMode) ? 231 : 192) : document.querySelector('.ln-commentbox').getBoundingClientRect().height + 15;
const commentBoxHeight = (document.querySelector('.ln-commentbox') === null)
? ((this.props.inEditMode)
? HEIGHT.CONTENTMODE
: HEIGHT.ELSE)
: document.querySelector('.ln-commentbox').getBoundingClientRect().height + PADDING;

//this comment box is used 2 times in the app. When creating and edditigng isseu;
let position = {
Expand All @@ -249,8 +256,8 @@ class CommentBox extends Component {
position.style.left = this.props.ticket.position.x;

//when the position of the box is on the right side posion the box on the right;
if (this.props.ticket.position.x > (generalConfig.maxX(0) / 2) - 100) {
position.style.left = this.props.ticket.position.x - 480 + this.props.ticket.position.width;
if (this.props.ticket.position.x > (generalConfig.maxX(0) / 2) - SPACEING) {
position.style.left = this.props.ticket.position.x - HEIGHT.EDDITMODE + this.props.ticket.position.width;
position.class = 'ln-commentbox-right';
}
position.style.top = this.props.ticket.position.height + this.props.ticket.position.y; //only add the top prop to the style when creating;
Expand All @@ -260,7 +267,7 @@ class CommentBox extends Component {
}

if (this.props.ticket.position.y > helpers.pageHeight() - this.props.ticket.position.height - MAX_POSITON_BOTTOM) {
position.style.transform = - (commentBoxHeight + this.props.ticket.position.height);
position.style.transform = -(commentBoxHeight + this.props.ticket.position.height);

position.class = position.class + ' ln-commentbox-top';
}
Expand Down Expand Up @@ -346,7 +353,7 @@ class CommentBox extends Component {

render = () => {
return (
<Anime left={this._setPosition().style.left} top={this._setPosition().style.top} scale={this.state.scale} translateY={this._setPosition().style.transform}>
<Anime left={this._setPosition().style.left} top={this._setPosition().style.top} translateY={this._setPosition().style.transform}>
<form className={`ln-commentbox ${this._setPosition().class}`} onSubmit={this._prepareSumbit} method="POST">
{this._renderOverLay()}

Expand Down
2 changes: 1 addition & 1 deletion src/scripts/components/inputText/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/* Setup ==================================================================== */

//imports
import React, {Component} from 'react';
import React, {Component} from 'react'; // eslint-disable-line no-unused-vars

import validate from '../../utils/validate';
import {translate} from '../../utils/helpers';
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/components/loader/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/* Setup ==================================================================== */

//imports
import React, {Component} from 'react';
import React, {Component} from 'react'; // eslint-disable-line no-unused-vars

/* Component ==================================================================== */
class Loader extends Component {
Expand Down
5 changes: 3 additions & 2 deletions src/scripts/components/rootElement/index.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
'use strict';

/* Setup ==================================================================== */
import React, {Component} from 'react';

import React, {Component} from 'react'; // eslint-disable-line no-unused-vars

//import helpers
import helpers from '../../utils/helpers';

// Components
import Router from '../router';
import Router from '../router'; // eslint-disable-line no-unused-vars

/* Component ==================================================================== */
class Root extends Component {
Expand Down
4 changes: 3 additions & 1 deletion src/scripts/components/router/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict';

/* Setup ==================================================================== */
/*eslint-disable no-unused-vars*/
import React, {Component} from 'react';
import Tour from '../../components/userTour';

Expand All @@ -9,8 +10,9 @@ import ext from '../../utils/ext';
// Components
import ToolBar from '../toolbar';
import Selector from '../selector';
import Setup from '../setup'
import Setup from '../setup';
import TicketsOnPage from '../ticketsOnPage';
/*eslint-disable no-unused-vars*/

//data
import tourSteps from '../../config/tourSteps';
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/components/selector/SelectorBackground.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

/* Setup ==================================================================== */
import React, {Component} from 'react';
import React, {Component} from 'react'; // eslint-disable-line no-unused-vars

/* Component ==================================================================== */
class SelectorBackground extends Component {
Expand Down
14 changes: 7 additions & 7 deletions src/scripts/components/selector/index.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
'use strict';

/* Setup ==================================================================== */
import React, {Component} from 'react';
import React, {Component} from 'react'; // eslint-disable-line no-unused-vars

//tools
import generalConfig from '../../config/general';

//helpers
import {setMinMaxWidth} from '../../utils/helpers';
import SelectorHelper from './selectorHelper';
import routerHelper from '../router/routerHelper'
import SelectorHelper from './selectorHelper'; // eslint-disable-line no-unused-vars
import routerHelper from '../router/routerHelper';

//components
import SelectorBackground from './SelectorBackground'
import CommentBox from './../commentbox';
import SelectorBackground from './SelectorBackground'; // eslint-disable-line no-unused-vars
import CommentBox from './../commentbox'; // eslint-disable-line no-unused-vars
import helpers, {translate} from '../../utils/helpers';
import message from '../../utils/message';

Expand Down Expand Up @@ -99,7 +99,7 @@ class Selector extends Component {
this.setState({
isDrawing: true, //set drawing state
startX: this.state.x, //x position
startY: this.state.y, //y position
startY: this.state.y //y position
});
this._onMouseMove(e);
}
Expand Down Expand Up @@ -127,7 +127,7 @@ class Selector extends Component {
content: image.data,
show: false,
file_type: 'image/jpeg',
id: helpers.generateUUID(), //a random genreated id
id: helpers.generateUUID() //a random genreated id
};
oldState.push(newScreenshot);
let newStateTicket = helpers.setNewState(_this.state.ticket, 'assets', oldState);
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/components/selector/selectorHelper.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

/* Setup ==================================================================== */
import React, {Component} from 'react';
import React, {Component} from 'react'; // eslint-disable-line no-unused-vars
import generalConfig from '../../config/general';

//helpers
Expand Down
Loading