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/.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/.travis.yml b/.travis.yml index 3595bf5..c685db0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -40,4 +40,4 @@ before_script: - yarn run production script: - - if [[ $TRAVIS_OS_NAME == 'osx' ]]; then yarn run publish; else docker run --rm -it -e "GITHUB_TOKEN=$GITHUB_TOKEN" -v $(pwd):/code kriskbx/gtt-taskbar-builder ./build.sh; fi + - if [[ $TRAVIS_OS_NAME == 'osx' ]]; then yarn run publish; else yarn run publish-docker; fi diff --git a/package.json b/package.json index 8d2f896..2a76ea3 100644 --- a/package.json +++ b/package.json @@ -11,13 +11,14 @@ "author": "Kris Siepert", "private": true, "license": "GPL-2.0", - "version": "0.3.5", + "version": "0.3.10", "main": "src/index.js", "scripts": { "start": "electron-forge start", "package": "electron-forge package", "make": "electron-forge make", "publish": "electron-forge publish", + "publish-docker": "docker run --rm -it -e \"GITHUB_TOKEN=$GITHUB_TOKEN\" -v $(pwd):/code kriskbx/gtt-taskbar-builder ./build.sh", "lint": "eslint src", "dev": "NODE_ENV=development webpack --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", "watch": "NODE_ENV=development webpack --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", @@ -46,7 +47,6 @@ "zip" ], "linux": [ - "snap", "deb", "rpm" ] @@ -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" @@ -112,9 +123,9 @@ "chokidar": "^2.0.0", "electron": "2.0.8", "electron-compile": "^6.4.2", - "electron-log": "^2.2.14", + "electron-log": "^3.0.0-beta4", "electron-squirrel-startup": "^1.0.0", - "gitlab-time-tracker": "^1.7.21", + "gitlab-time-tracker": "^1.7.37", "moment": "^2.20.1", "raven": "^2.6.2", "write-yaml": "^1.0.0" @@ -136,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"> -
+