diff --git a/README.md b/README.md index 690ede5..2d91e2d 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ npm run publish - [x] Add Redmine Integration - [x] Add deep Redmine Integration - [x] Archive old data -- [ ] Add Jira Integration +- [x] Add Jira Integration - [ ] Add deep Jira Integration - [ ] Build for multiple platforms (Linux/Win) - [ ] Add tests diff --git a/package-lock.json b/package-lock.json index 049c959..43335bc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "titime", - "version": "1.2.5", + "version": "1.3.6", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -565,6 +565,15 @@ "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.6.0.tgz", "integrity": "sha1-g+9cqGCysy5KDe7e6MdxudtXRx4=" }, + "axios": { + "version": "0.17.1", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.17.1.tgz", + "integrity": "sha1-LY4+XQvb1zJ/kbyBT1xXZg+Bgk0=", + "requires": { + "follow-redirects": "1.4.1", + "is-buffer": "1.1.6" + } + }, "axobject-query": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-0.1.0.tgz", @@ -5098,6 +5107,24 @@ "imul": "1.0.1" } }, + "follow-redirects": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.4.1.tgz", + "integrity": "sha512-uxYePVPogtya1ktGnAAXOacnbIuRMB4dkvqeNz2qTtTQsuzSfbDolV+wMMKxAmCx0bLgAKLbBOkjItMbbkR1vg==", + "requires": { + "debug": "3.1.0" + }, + "dependencies": { + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "requires": { + "ms": "2.0.0" + } + } + } + }, "foreach": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/foreach/-/foreach-2.0.5.tgz", @@ -5909,8 +5936,7 @@ "is-buffer": { "version": "1.1.6", "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", - "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", - "dev": true + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==" }, "is-builtin-module": { "version": "1.0.0", diff --git a/package.json b/package.json index 41e01f6..28ae846 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "titime", "productName": "TiTime - Keeping the time for you", - "version": "1.3.6", + "version": "1.4.1", "description": "Tool for Instant Time Tracking", "main": "src/index.js", "scripts": { diff --git a/src/index.js b/src/index.js index a94e70d..c2e00b5 100644 --- a/src/index.js +++ b/src/index.js @@ -55,11 +55,12 @@ if (Env.isDebug()) { const createProviderSyncCommand = (providerName, createProvider) => async (...args) => { const provider = createProvider(...args); - if (!cron.exists('jira')) { + if (!cron.exists(providerName)) { cron.add( - 'jira', + providerName, registry.config().get('remoteSyncCron'), - () => provider.synchronize().then(() => provider.report(registry.config().get('minLogTime'))), + () => provider.synchronize() + .then(() => provider.report(registry.config().get('minLogTime'))), true, ); } @@ -79,7 +80,7 @@ registry } }) .register('synchronizeRedmine', createProviderSyncCommand( - 'jira', + 'redmine', (host, apiKey) => new RedmineProvider(db, { host, apiKey }), )) .register('synchronizeJira', createProviderSyncCommand( diff --git a/src/remote/redmine.js b/src/remote/redmine.js index 2696253..5b13ad3 100644 --- a/src/remote/redmine.js +++ b/src/remote/redmine.js @@ -179,7 +179,7 @@ export default class RedmineProvider extends AbstractProvider { timeSegmentValid(lastReportTime, segment) { // eslint-disable-line class-methods-use-this if (!lastReportTime) { return true; - } else if (moment.unix(segment.start).isSameOrAfter(moment.unix(lastReportTime))) { + } else if (moment.unix(segment.end).isSameOrAfter(moment.unix(lastReportTime))) { return true; } diff --git a/src/remote/rest/client/rest-client.js b/src/remote/rest/client/rest-client.js index 50bc871..1f8cdeb 100644 --- a/src/remote/rest/client/rest-client.js +++ b/src/remote/rest/client/rest-client.js @@ -1,3 +1,5 @@ +'use strict'; + import axios from 'axios'; import invariant from '../../../invariant'; import AnonProvider from '../auth/anon-provider'; diff --git a/src/view/component/app.vue b/src/view/component/app.vue index 7124eb1..491dfbb 100644 --- a/src/view/component/app.vue +++ b/src/view/component/app.vue @@ -1,20 +1,22 @@