From 9c81beb73c314610cbedf3cbacfbd512f61039ab Mon Sep 17 00:00:00 2001 From: kriskbx Date: Tue, 4 Sep 2018 12:29:53 +0200 Subject: [PATCH 01/17] Fix #24 --- .compilerc | 2 +- package.json | 13 ++++++++++++- src/index.js | 2 +- src/{about.html => test.html} | 2 +- 4 files changed, 15 insertions(+), 4 deletions(-) rename src/{about.html => test.html} (99%) diff --git a/.compilerc b/.compilerc index 903e0e9..2bd01cc 100644 --- a/.compilerc +++ b/.compilerc @@ -16,7 +16,7 @@ "plugins": [ "transform-async-to-generator" ], - "sourceMaps": "inline" + "sourceMaps": "none" } }, "production": { diff --git a/package.json b/package.json index 8d2f896..e6fcdc9 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,18 @@ ".idea", "resources", "out", - ".tresorit" + ".tresorit", + "appveyor.yml", + "build.sh", + "Dockerfile", + "documentation.md", + "Icon", + "LICENSE", + "mix-manifest.json", + "readme.md", + "webpack.mix.js", + "yarn.lock", + "yarn-error.log" ], "packageManager": "yarn", "icon": "./resources/images/icon/icon.png" diff --git a/src/index.js b/src/index.js index 405d465..de076a2 100644 --- a/src/index.js +++ b/src/index.js @@ -121,7 +121,7 @@ gtt.openAboutWindow = () => { aboutWindow.setMenu(null); - aboutWindow.loadURL('file://' + __dirname + '/about.html'); + aboutWindow.loadURL('file://' + __dirname + '/test.html'); if (debug) aboutWindow.openDevTools(); aboutWindow.on('closed', function () { diff --git a/src/about.html b/src/test.html similarity index 99% rename from src/about.html rename to src/test.html index c010b5c..8e60ba5 100644 --- a/src/about.html +++ b/src/test.html @@ -74,4 +74,4 @@
Uses the following Open Source Software:
- \ No newline at end of file + From 8efb3c812a9a16111f70f6812545955a7e8faf87 Mon Sep 17 00:00:00 2001 From: kriskbx Date: Wed, 5 Sep 2018 20:36:40 +0200 Subject: [PATCH 02/17] Fix #5 --- .gitlab-ci.yml | 47 - package.json | 7 +- readme.md | 4 +- resources/assets/js/app.js | 92 +- resources/assets/js/components/track.vue | 5 +- resources/assets/stylus/app.styl | 97 +- src/build/app.css | 1048 +- src/build/app.js | 35598 ++++++++++++++++++++- src/index.js | 22 +- src/log.html | 90 +- src/render.js | 8 +- yarn.lock | 29 +- 12 files changed, 36922 insertions(+), 125 deletions(-) delete mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index 655832c..0000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,47 +0,0 @@ -variables: - GITLAB_CONTAINER_IMAGE: registry.gitlab.com/kriskbx/gitlab-time-tracker-taskbar:latest - -stages: - - build - -build:linux: - image: $GITLAB_CONTAINER_IMAGE - stage: build - dependencies: - - dependencies - artifacts: - paths: - - out/make - script: - - yarn install - - yarn run make - -build:win: - stage: build - dependencies: - - dependencies - artifacts: - paths: - - out/make - script: - - yarn install - - yarn run make - tags: - - windows - - electron-forge - - node - -build:osx: - stage: build - dependencies: - - dependencies - artifacts: - paths: - - out/make - script: - - yarn install - - yarn run make - tags: - - osx - - electron-forge - - node diff --git a/package.json b/package.json index e6fcdc9..86415a0 100644 --- a/package.json +++ b/package.json @@ -125,7 +125,7 @@ "electron-compile": "^6.4.2", "electron-log": "^2.2.14", "electron-squirrel-startup": "^1.0.0", - "gitlab-time-tracker": "^1.7.21", + "gitlab-time-tracker": "^1.7.25", "moment": "^2.20.1", "raven": "^2.6.2", "write-yaml": "^1.0.0" @@ -147,10 +147,11 @@ "roboto": "^0.8.2", "stylus": "^0.54.5", "stylus-loader": "^3.0.1", + "url-parse": "^1.4.3", "vue": "^2.5.13", + "vue-datetime-2": "^0.6.1", "vue-js-toggle-button": "^1.2.2", "vue-resource": "^1.3.5", - "vue-select": "^2.4.0", - "vuejs-datetimepicker": "^1.1.3" + "vue-select": "^2.4.0" } } diff --git a/readme.md b/readme.md index c7a0db4..c0a10df 100644 --- a/readme.md +++ b/readme.md @@ -20,8 +20,8 @@ How to install and use gtt taskbar? You can find the documentation [here](https: ## support further development -Please support the development of this free software by [donating or sharing](https://github.com/kriskbx/gitlab-time-tracker-taskbar/blob/master/documentation.md#support-further-development)! +Please support the development of this free software by [donating or sharing](https://github.com/kriskbx/gitlab-time-tracker-taskbar/blob/master/documentation.md#support-further-development)! ## license -gtt is open-source software licensed under the [GPL V2 license](https://github.com/kriskbx/gitlab-time-tracker-taskbar/blob/master/LICENSE). +gtt taskbar is open-source software licensed under the [GPL V2 license](https://github.com/kriskbx/gitlab-time-tracker-taskbar/blob/master/LICENSE). diff --git a/resources/assets/js/app.js b/resources/assets/js/app.js index 611d7d5..a206191 100644 --- a/resources/assets/js/app.js +++ b/resources/assets/js/app.js @@ -4,9 +4,10 @@ const Frame = require('gitlab-time-tracker/src/models/baseFrame'); window.Vue = require('vue'); window.Vue.use(require('vue-resource')); const moment = require('moment'); +const URL = require('url-parse'); const _ = require('underscore'); import ToggleButton from 'vue-js-toggle-button'; -import datetime from 'vuejs-datetimepicker'; +import {Datetime} from 'vue-datetime-2'; window.Vue.use(ToggleButton); @@ -19,40 +20,60 @@ const app = new Vue({ components: { 'content-track': require('./components/track.vue'), 'panel-footer': require('./components/footer.vue'), - 'datetime': datetime + 'datetime': Datetime }, watch: { 'resourceType': function () { this.saveState(); }, - 'resource': function () { - this.saveState(); + 'resource': { + deep: true, + handler: function () { + this.saveState(); + } }, - 'mergeRequests': function () { - this.saveState(); + 'mergeRequests': { + deep: true, + handler: function () { + this.saveState(); + } }, - 'issues': function () { - this.saveState(); + 'issues': { + deep: true, + handler: function () { + this.saveState(); + } }, - 'projects': function () { - this.saveState(); + 'projects': { + deep: true, + handler: function () { + this.saveState(); + } }, - 'project': function () { - this.loadResource(); - this.saveState(); + 'project': { + deep: true, + handler: function () { + this.loadResource(); + this.saveState(); + } }, 'config': { deep: true, handler: function () { - if(this.loadingConfig) return; + if (this.loadingConfig) return; this.writeConfig(this.config) } } }, computed: { + gitlab() { + let url = new URL(this.config.get('url'), true); + return url.protocol + (url.slashes ? '//' : '') + url.host; + }, days() { + let tmp = this.config; return this.log && this.log.frames ? Object.keys(this.log.frames).sort().reverse() : []; }, frames() { @@ -66,6 +87,7 @@ const app = new Vue({ this.setConfig(ipc.sync('gtt-config', 'get')); this.version = ipc.sync('gtt-version', 'get'); this.platform = ipc.sync('gtt-platform', 'get'); + this.editing = false; // set ipc listeners ipc.on('gtt-last-sync', (event, lastSync) => this.lastSync = lastSync); @@ -73,8 +95,8 @@ const app = new Vue({ ipc.on('gtt-log', (event, data) => { this.loadingLog = false; let i; - for(i in data.frames) { - if(!data.frames.hasOwnProperty(i)) continue; + for (i in data.frames) { + if (!data.frames.hasOwnProperty(i)) continue; data.frames[i] = _.map(data.frames[i], frame => Frame.copy(frame)); } this.log = data; @@ -107,6 +129,8 @@ const app = new Vue({ ipc.on('gtt-stop', () => this.sync()); + this.ready = true; + if (this.$refs.log) this.loadLog(); if (!this.$refs.main) return; @@ -125,7 +149,7 @@ const app = new Vue({ methods: { synced(modified) { - if(!this.lastSync) return; + if (!this.lastSync) return false; return moment(modified).diff(this.lastSync) < 0; }, human(input) { @@ -204,10 +228,44 @@ const app = new Vue({ saveState() { let state = Object.assign({}, window.state.data); delete state.config; + delete state.editing; + delete state.entry; + delete state.currentEntry; ipc.send('cache-set', {key: 'state', data: state}); }, writeConfig(config) { ipc.send('gtt-config-write', config); + }, + timeFormat() { + return this.config ? this.config.get('dateFormat').replace(this.dayFormat(), "") : "HH:mm"; + }, + dayFormat() { + return this.config ? this.config.get('dateFormat').replace(/([k|h|H|m|s|S][:]?)/gm, "") : 'YYYY-MM-DD'; + }, + getTitleById(id, project) { + if (!this.issues[project]) return false; + + let filtered = this.issues[project].filter(issue => issue.iid == id); + if (!filtered[0]) return false; + + return filtered[0].title; + }, + edit(frame) { + this.editing = true; + this.currentEntry = frame; + this.entry = Frame.copy(frame); + }, + save() { + for (let key in this.entry) { + if (!this.entry.hasOwnProperty(key)) continue; + this.currentEntry[key] = this.entry[key]; + } + this.currentEntry.modified = moment().toISOString(); + ipc.send('gtt-edit', {frame: this.currentEntry}); + this.editing = false; + }, + dump(data) { + console.log(data); } } }); diff --git a/resources/assets/js/components/track.vue b/resources/assets/js/components/track.vue index b0ca524..c3c26fc 100644 --- a/resources/assets/js/components/track.vue +++ b/resources/assets/js/components/track.vue @@ -37,7 +37,7 @@ :options="resourceOptions"> -
+