Skip to content

Commit 8efb3c8

Browse files
committed
Fix kriskbx#5
1 parent 9c81beb commit 8efb3c8

File tree

12 files changed

+36922
-125
lines changed

12 files changed

+36922
-125
lines changed

.gitlab-ci.yml

Lines changed: 0 additions & 47 deletions
This file was deleted.

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@
125125
"electron-compile": "^6.4.2",
126126
"electron-log": "^2.2.14",
127127
"electron-squirrel-startup": "^1.0.0",
128-
"gitlab-time-tracker": "^1.7.21",
128+
"gitlab-time-tracker": "^1.7.25",
129129
"moment": "^2.20.1",
130130
"raven": "^2.6.2",
131131
"write-yaml": "^1.0.0"
@@ -147,10 +147,11 @@
147147
"roboto": "^0.8.2",
148148
"stylus": "^0.54.5",
149149
"stylus-loader": "^3.0.1",
150+
"url-parse": "^1.4.3",
150151
"vue": "^2.5.13",
152+
"vue-datetime-2": "^0.6.1",
151153
"vue-js-toggle-button": "^1.2.2",
152154
"vue-resource": "^1.3.5",
153-
"vue-select": "^2.4.0",
154-
"vuejs-datetimepicker": "^1.1.3"
155+
"vue-select": "^2.4.0"
155156
}
156157
}

readme.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ How to install and use gtt taskbar? You can find the documentation [here](https:
2020

2121
## support further development
2222

23-
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)!
23+
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)!
2424

2525
## license
2626

27-
gtt is open-source software licensed under the [GPL V2 license](https://github.com/kriskbx/gitlab-time-tracker-taskbar/blob/master/LICENSE).
27+
gtt taskbar is open-source software licensed under the [GPL V2 license](https://github.com/kriskbx/gitlab-time-tracker-taskbar/blob/master/LICENSE).

resources/assets/js/app.js

Lines changed: 75 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ const Frame = require('gitlab-time-tracker/src/models/baseFrame');
44
window.Vue = require('vue');
55
window.Vue.use(require('vue-resource'));
66
const moment = require('moment');
7+
const URL = require('url-parse');
78
const _ = require('underscore');
89
import ToggleButton from 'vue-js-toggle-button';
9-
import datetime from 'vuejs-datetimepicker';
10+
import {Datetime} from 'vue-datetime-2';
1011

1112
window.Vue.use(ToggleButton);
1213

@@ -19,40 +20,60 @@ const app = new Vue({
1920
components: {
2021
'content-track': require('./components/track.vue'),
2122
'panel-footer': require('./components/footer.vue'),
22-
'datetime': datetime
23+
'datetime': Datetime
2324
},
2425

2526
watch: {
2627
'resourceType': function () {
2728
this.saveState();
2829
},
29-
'resource': function () {
30-
this.saveState();
30+
'resource': {
31+
deep: true,
32+
handler: function () {
33+
this.saveState();
34+
}
3135
},
32-
'mergeRequests': function () {
33-
this.saveState();
36+
'mergeRequests': {
37+
deep: true,
38+
handler: function () {
39+
this.saveState();
40+
}
3441
},
35-
'issues': function () {
36-
this.saveState();
42+
'issues': {
43+
deep: true,
44+
handler: function () {
45+
this.saveState();
46+
}
3747
},
38-
'projects': function () {
39-
this.saveState();
48+
'projects': {
49+
deep: true,
50+
handler: function () {
51+
this.saveState();
52+
}
4053
},
41-
'project': function () {
42-
this.loadResource();
43-
this.saveState();
54+
'project': {
55+
deep: true,
56+
handler: function () {
57+
this.loadResource();
58+
this.saveState();
59+
}
4460
},
4561
'config': {
4662
deep: true,
4763
handler: function () {
48-
if(this.loadingConfig) return;
64+
if (this.loadingConfig) return;
4965
this.writeConfig(this.config)
5066
}
5167
}
5268
},
5369

5470
computed: {
71+
gitlab() {
72+
let url = new URL(this.config.get('url'), true);
73+
return url.protocol + (url.slashes ? '//' : '') + url.host;
74+
},
5575
days() {
76+
let tmp = this.config;
5677
return this.log && this.log.frames ? Object.keys(this.log.frames).sort().reverse() : [];
5778
},
5879
frames() {
@@ -66,15 +87,16 @@ const app = new Vue({
6687
this.setConfig(ipc.sync('gtt-config', 'get'));
6788
this.version = ipc.sync('gtt-version', 'get');
6889
this.platform = ipc.sync('gtt-platform', 'get');
90+
this.editing = false;
6991

7092
// set ipc listeners
7193
ipc.on('gtt-last-sync', (event, lastSync) => this.lastSync = lastSync);
7294
ipc.on('gtt-config', (event, config) => this.setConfig(config));
7395
ipc.on('gtt-log', (event, data) => {
7496
this.loadingLog = false;
7597
let i;
76-
for(i in data.frames) {
77-
if(!data.frames.hasOwnProperty(i)) continue;
98+
for (i in data.frames) {
99+
if (!data.frames.hasOwnProperty(i)) continue;
78100
data.frames[i] = _.map(data.frames[i], frame => Frame.copy(frame));
79101
}
80102
this.log = data;
@@ -107,6 +129,8 @@ const app = new Vue({
107129

108130
ipc.on('gtt-stop', () => this.sync());
109131

132+
this.ready = true;
133+
110134
if (this.$refs.log) this.loadLog();
111135
if (!this.$refs.main) return;
112136

@@ -125,7 +149,7 @@ const app = new Vue({
125149

126150
methods: {
127151
synced(modified) {
128-
if(!this.lastSync) return;
152+
if (!this.lastSync) return false;
129153
return moment(modified).diff(this.lastSync) < 0;
130154
},
131155
human(input) {
@@ -204,10 +228,44 @@ const app = new Vue({
204228
saveState() {
205229
let state = Object.assign({}, window.state.data);
206230
delete state.config;
231+
delete state.editing;
232+
delete state.entry;
233+
delete state.currentEntry;
207234
ipc.send('cache-set', {key: 'state', data: state});
208235
},
209236
writeConfig(config) {
210237
ipc.send('gtt-config-write', config);
238+
},
239+
timeFormat() {
240+
return this.config ? this.config.get('dateFormat').replace(this.dayFormat(), "") : "HH:mm";
241+
},
242+
dayFormat() {
243+
return this.config ? this.config.get('dateFormat').replace(/([k|h|H|m|s|S][:]?)/gm, "") : 'YYYY-MM-DD';
244+
},
245+
getTitleById(id, project) {
246+
if (!this.issues[project]) return false;
247+
248+
let filtered = this.issues[project].filter(issue => issue.iid == id);
249+
if (!filtered[0]) return false;
250+
251+
return filtered[0].title;
252+
},
253+
edit(frame) {
254+
this.editing = true;
255+
this.currentEntry = frame;
256+
this.entry = Frame.copy(frame);
257+
},
258+
save() {
259+
for (let key in this.entry) {
260+
if (!this.entry.hasOwnProperty(key)) continue;
261+
this.currentEntry[key] = this.entry[key];
262+
}
263+
this.currentEntry.modified = moment().toISOString();
264+
ipc.send('gtt-edit', {frame: this.currentEntry});
265+
this.editing = false;
266+
},
267+
dump(data) {
268+
console.log(data);
211269
}
212270
}
213271
});

resources/assets/js/components/track.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
:options="resourceOptions"></v-select>
3838
</div>
3939

40-
<div class="step track-buttons">
40+
<div class="step track-buttons" v-if="buttons">
4141
<button class="button start"
4242
@click="start"
4343
:class="{
@@ -106,6 +106,9 @@
106106
},
107107
running: {
108108
default: false
109+
},
110+
buttons: {
111+
default: true
109112
}
110113
},
111114

resources/assets/stylus/app.styl

Lines changed: 83 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -282,9 +282,6 @@ body, html
282282

283283
.log
284284

285-
.timeframe
286-
color: $color-blue
287-
288285
.sync
289286
font-size: 1.6rem
290287
.red
@@ -293,33 +290,105 @@ body, html
293290
color: green
294291

295292
& > .day
296-
overflow: hidden
297-
box-shadow: 0 .05rem .3rem rgba(0, 0, 0, 0.4)
298-
border-radius: .6rem
299293
margin-bottom: 2rem
294+
300295
& > .headline
301-
background: $color-light-gray
302296
color: $color-gray
303-
font-weight: bold
304297
padding: 1rem
298+
font-size: 2rem
305299
& > small
306300
font-weight: normal
307301
display: inline-block
308-
float: right
309-
margin-top: .3rem
302+
margin-top: .9rem
303+
margin-left: 1.2rem
304+
font-size: 1.3rem
310305
& > .list
311306
& > .entry
307+
letter-spacing: .05rem
312308
display: flex
313309
flex-direction: row
314310
width: 100%
315-
border-bottom: 1px solid $color-light-gray
316-
padding: .6rem 1rem
311+
border-top: 1px solid rgba(0, 0, 0, 0.1)
312+
padding: 1.4rem 1rem
317313
& > .cell
318314
flex: 1
315+
316+
&.timeframe
317+
max-width: 13rem
318+
color: $color-gray
319+
font-size: 1.2rem
320+
display: inline-block
321+
margin-top: .3rem
322+
&.sync
323+
max-width: 10rem
324+
&.time
325+
font-weight: 400
326+
max-width: 10rem
327+
&.name
328+
flex: auto
329+
font-weight: 400
330+
331+
.actions
332+
font-size: 1.2rem
333+
display: none
334+
float: right
335+
margin: -.9rem 0
336+
padding-right: 1rem
337+
padding-top: .2rem
338+
& > a
339+
display: block
340+
319341
&:hover
320342
background: lighten($color-light-gray, 40%)
321-
&:last-child
322-
border-bottom: 0
343+
344+
.actions
345+
display: inline-block
323346

324347
button.clear
325348
display: none
349+
350+
.modal-bg
351+
position: fixed
352+
left: 0
353+
right: 0
354+
top: 0
355+
bottom: 0
356+
z-index: 10
357+
358+
.modal
359+
width: 45rem
360+
height: auto
361+
top: -.5rem
362+
position: fixed
363+
z-index: 20
364+
left: 50%
365+
margin-left: -22.5rem
366+
background: $color-white
367+
border-radius: .5rem
368+
box-shadow: 0 .1rem .3rem rgba(0, 0, 0, 0.3)
369+
padding: 2.5rem 3rem 2rem 3rem
370+
371+
.track-buttons
372+
margin-top: 3rem
373+
374+
.form
375+
.times
376+
.vdatetime-slot__not-available, .vdatetime-slot__available
377+
display: none
378+
position: relative
379+
z-index: 20
380+
font-weight: 400
381+
margin-bottom: 1rem
382+
display: flex
383+
text-align: center
384+
align-items: center
385+
& > *
386+
flex: 1
387+
.datetime
388+
display: inline-block
389+
min-width: 12rem
390+
input
391+
margin: 0
392+
.content .track
393+
padding: 0
394+
position: static

src/build/app.css

Lines changed: 1047 additions & 1 deletion
Large diffs are not rendered by default.

src/build/app.js

Lines changed: 35597 additions & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)