From 36750f48f7f08a3764726f52064d7cd2ab1740ce Mon Sep 17 00:00:00 2001 From: Eero Vilpponen Date: Wed, 2 Sep 2020 08:12:33 +0300 Subject: [PATCH 01/19] Experimental generation feature Note: hard-cored thyme and git for now --- tracklater/main.py | 8 +++- tracklater/static/daytimeline.vue.js | 71 ++++++++++++++++++++++++++++ tracklater/timemodules/gitmodule.py | 1 + tracklater/timemodules/thyme.py | 8 +++- 4 files changed, 85 insertions(+), 3 deletions(-) diff --git a/tracklater/main.py b/tracklater/main.py index 72e022c..74a8e3b 100755 --- a/tracklater/main.py +++ b/tracklater/main.py @@ -26,7 +26,6 @@ def store_parser_to_database(parser, module_name, start_date, end_date): for issue in parser.issues: issue.module = module_name db.session.merge(issue) - Project.query.delete() for project in parser.projects: project.module = module_name db.session.merge(project) @@ -68,10 +67,15 @@ def __init__(self, start_date, end_date, modules=None) -> None: self.modules[module_name] = parser def parse(self) -> None: + parsers = [] + group_to_project = {project.group: project.pid for project in Project.query.all()} for module_name, parser in self.modules.items(): set_parser_caching_data(parser, module_name) - parser.parse() logger.warning("Parsing %s", module_name) + parser.parse() + parsers.append((module_name, parser)) + for entry in parser.entries: + entry.project = group_to_project.get(entry.group, None) store_parser_to_database(self.modules[module_name], module_name, start_date=self.start_date, end_date=self.end_date) logger.warning("Task done %s", module_name) diff --git a/tracklater/static/daytimeline.vue.js b/tracklater/static/daytimeline.vue.js index 02d78e9..6b8ad3b 100644 --- a/tracklater/static/daytimeline.vue.js +++ b/tracklater/static/daytimeline.vue.js @@ -1,5 +1,7 @@ var daytimeline = Vue.component("daytimeline", { template: ` +
+ Generate +
`, props: ["entries"], data() { @@ -123,6 +126,74 @@ var daytimeline = Vue.component("daytimeline", { } } return true; + }, + generateEntries() { + const cutoffSeconds = 300; + let lastEnd = null; + let newEntries = []; + let currentEntry = null; + this.entries.slice().sort((a, b) => { + if (new Date(a.start_time) > new Date(b.start_time)) { + return 1; + } + if (new Date(a.start_time) < new Date(b.start_time)) { + return -1; + } + return 0; + }).map(i => { + console.log(i.project) + const startTime = new Date(i.start_time) + const endTime = new Date(i.end_time) + if (i.module == "thyme") { + if (lastEnd == null) { + currentEntry = { + start_time: startTime.addHours(-0.1) + } + lastEnd = endTime; + return; + } + + if ((startTime.getTime() - lastEnd.getTime()) > (cutoffSeconds * 1000)) { + // Too long time between time entries + if (currentEntry != null) { + currentEntry.end_time = lastEnd.addHours(0.1); + newEntries.push(currentEntry); + currentEntry = null; + lastEnd = null; + return; + } + } else { + if (currentEntry == null) { + currentEntry = { + start_time: startTime.addHours(-0.1) + } + } + lastEnd = endTime; + } + } else if (i.module == "gitmodule") { + if (currentEntry != null && lastEnd != null) { + if (currentEntry.project != undefined && currentEntry.project != i.project) { + // project changed + currentEntry.end_time = lastEnd; + newEntries.push(currentEntry); + currentEntry = { + project: i.project, + start: new Date(i.start_time), + }; + lastEnd = null; + return; + } else { + currentEntry.project = i.project; + } + } + } + }) + console.log(newEntries) + newEntries.map(e => { + e.title = "Generated entry" + e.module = "toggl" + this.$emit('addEntry', e) + }) } }, watch: { diff --git a/tracklater/timemodules/gitmodule.py b/tracklater/timemodules/gitmodule.py index ca6cadc..64ec2dd 100644 --- a/tracklater/timemodules/gitmodule.py +++ b/tracklater/timemodules/gitmodule.py @@ -49,6 +49,7 @@ def get_entries(self) -> List[Entry]: log.append(Entry( text="{} - {}".format(repo_path.split('/')[-1], message), start_time=time, + group=group, )) return log diff --git a/tracklater/timemodules/thyme.py b/tracklater/timemodules/thyme.py index 5d05444..f780281 100644 --- a/tracklater/timemodules/thyme.py +++ b/tracklater/timemodules/thyme.py @@ -99,6 +99,8 @@ def _update_category(session, category, seconds): elif category == 'leisure': session.extra_data['category']['leisure'] += seconds * 2 + if not entries: + return [] prev_entry = entries[0] sessions = [_init_session(prev_entry)] @@ -140,7 +142,11 @@ def read_files(self, start_date, end_date) -> List[dict]: if not os.path.exists(filename): continue with open(filename) as f: - data = json.load(f) + try: + data = json.load(f) + except Exception as e: + logger.exception(e) + continue entries = data.get('Snapshots') for entry in entries: snapshot_entries.append(entry) From 98297dc87231ec5bc3ef6266831ee81b13ab8e97 Mon Sep 17 00:00:00 2001 From: Eero Vilpponen Date: Fri, 18 Dec 2020 21:55:12 +0200 Subject: [PATCH 02/19] Generate time snippet from thyme --- tracklater/static/daytimeline.vue.js | 86 +++++++++++++++++++++++++++- tracklater/views.py | 2 +- 2 files changed, 84 insertions(+), 4 deletions(-) diff --git a/tracklater/static/daytimeline.vue.js b/tracklater/static/daytimeline.vue.js index 6b8ad3b..24d8d7b 100644 --- a/tracklater/static/daytimeline.vue.js +++ b/tracklater/static/daytimeline.vue.js @@ -1,7 +1,6 @@ var daytimeline = Vue.component("daytimeline", { template: `
- Generate ["thyme", "toggl"].includes(i.module)).sort((a, b) => { + if (new Date(a.start_time) > new Date(b.start_time)) { + return 1; + } + if (new Date(a.start_time) < new Date(b.start_time)) { + return -1; + } + return 0; + }).map(i => { + i.start_time = new Date(i.start_time) + i.end_time = new Date(i.end_time) + return i + }) + console.log('sorted: ', sorted); + console.log('middle_time: ', middle_time); + if (sorted.length == 0) { + return ret; + } + // Special case: first thyme entry is after middle_time. Not good + if (sorted[0].start_time > middle_time) { + return ret; + } + // Special case: last thyme entry is before middle_time. Not good + if (sorted[sorted.length - 1].end_time < middle_time) { + return ret; + } + // Find the middle thyme entry + let middleIndex; + for (let i in sorted) { + if (sorted[i].end_time > middle_time) { + middleIndex = i; + break; + } + } + // Middle item is too far + if (sorted[middleIndex].start_time.getTime() - middle_time.getTime() > cutoffSeconds * 1000) { + return ret; + } + console.log('middleIndex: ', middleIndex); + if (!middleIndex) { + return ret; + } + // Go back + let prevTime = sorted[middleIndex].start_time + for (let i=middleIndex; i>=0; i--) { + if (prevTime.getTime() - sorted[i].end_time.getTime() > cutoffSeconds * 1000) { + ret.start_time = prevTime.addHours(-0.2); + break; + } + if (sorted[i].module == "toggl") { + // We reached another toggl entry! Return its end_time here for no overlap + ret.start_time = sorted[i].end_time + break; + } + prevTime = sorted[i].start_time + } + // Go forward + prevTime = sorted[middleIndex].end_time + for (let i=middleIndex; i cutoffSeconds * 1000) { + ret.end_time = prevTime.addHours(0.2); + break; + } + if (sorted[i].module == "toggl") { + // We reached another toggl entry! Return its start_time here for no overlap + ret.end_time = sorted[i].start_time + break; + } + prevTime = sorted[i].end_time + } + return ret; + }, generateEntries() { const cutoffSeconds = 300; let lastEnd = null; diff --git a/tracklater/views.py b/tracklater/views.py index 2e2466d..4b45a61 100644 --- a/tracklater/views.py +++ b/tracklater/views.py @@ -59,7 +59,7 @@ def fetchdata() -> Any: if 'from' in request.values: from_date = parseTimestamp(request.values['from']) else: - from_date = now - timedelta(days=31) + from_date = now - timedelta(days=41) if 'to' in request.values: to_date = parseTimestamp(request.values['to']) else: From c1b86b204efbf633ac1bfac68dd8b7cae8cab68f Mon Sep 17 00:00:00 2001 From: Eero Vilpponen Date: Sat, 20 Feb 2021 07:27:59 +0200 Subject: [PATCH 03/19] Fix git commit parsing missing commits --- tracklater/timemodules/gitmodule.py | 31 +++++++++++++---------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/tracklater/timemodules/gitmodule.py b/tracklater/timemodules/gitmodule.py index 64ec2dd..6bfbd3a 100644 --- a/tracklater/timemodules/gitmodule.py +++ b/tracklater/timemodules/gitmodule.py @@ -5,7 +5,7 @@ import json from datetime import datetime -from tracklater.utils import FixedOffset, obj_from_dict +from tracklater.utils import obj_from_dict from tracklater import settings from tracklater.timemodules.interfaces import EntryMixin, AbstractParser, AbstractProvider from tracklater.models import Entry @@ -21,11 +21,9 @@ def get_setting(key, default=None, group='global'): FIXTURE_DIR = os.path.dirname(os.path.realpath(__file__)) + "/fixture" -def timestamp_to_datetime(timestamp: List): +def git_time_to_datetime(_datetime): # Git has timezone-aware unix timestamps, convert that to a UTC datetime - return datetime.fromtimestamp( - timestamp[0], tz=FixedOffset(timestamp[1], '') - ).astimezone(pytz.utc).replace(tzinfo=None) + return _datetime.astimezone(pytz.utc).replace(tzinfo=None) class Parser(EntryMixin, AbstractParser): @@ -36,18 +34,16 @@ def get_entries(self) -> List[Entry]: provider = Provider() for group, data in settings.GIT.items(): for repo_path in data.get('REPOS', []): - for log_entry in provider.get_log_entries(repo_path): - if log_entry.actor.email not in settings.GIT['global']['EMAILS']: + for log_entry in provider.get_log_entries(repo_path, start_date=start_date): + if log_entry.author.email not in settings.GIT['global']['EMAILS']: + logger.info(log_entry.author.email) continue - if not log_entry.message.startswith('commit'): - continue - message = ''.join(log_entry.message.split(':')[1:]) - time = timestamp_to_datetime(log_entry.time) + time = git_time_to_datetime(log_entry.authored_datetime) if time < start_date or time > end_date: continue log.append(Entry( - text="{} - {}".format(repo_path.split('/')[-1], message), + text="{} - {}".format(repo_path.split('/')[-1], log_entry.message), start_time=time, group=group, )) @@ -55,16 +51,17 @@ def get_entries(self) -> List[Entry]: class Provider(AbstractProvider): - def get_log_entries(self, repo_path): + def get_log_entries(self, repo_path, start_date=None): repo = git.Repo(repo_path) - for branch in repo.branches: + iterator = repo.iter_commits() + for commit in iterator: try: - entries = branch.log() + if start_date and git_time_to_datetime(commit.authored_datetime) < start_date: + break except Exception as e: logger.warning(e) continue - for log_entry in entries: - yield log_entry + yield commit def test_get_log_entries(self, repo_path): with open(FIXTURE_DIR + '/git_test_data.json', 'r') as f: From 33c6e53393eda07c63a9019742045db9a1383850 Mon Sep 17 00:00:00 2001 From: Eero Vilpponen Date: Sat, 20 Feb 2021 12:47:49 +0200 Subject: [PATCH 04/19] Detect issue from git --- tracklater/models.py | 3 +- tracklater/static/daytimeline.vue.js | 62 +++++++++++++++++++++++++++- tracklater/static/index.html | 31 ++++++++++++++ tracklater/views.py | 4 +- 4 files changed, 95 insertions(+), 5 deletions(-) diff --git a/tracklater/models.py b/tracklater/models.py index 26d22b1..fbf5aee 100644 --- a/tracklater/models.py +++ b/tracklater/models.py @@ -94,5 +94,6 @@ def to_dict(self): "title": self.title, "text": self.text, "extra_data": self.extra_data, - "duration": self.duration + "duration": self.duration, + "group": self.group } diff --git a/tracklater/static/daytimeline.vue.js b/tracklater/static/daytimeline.vue.js index 24d8d7b..72dcb52 100644 --- a/tracklater/static/daytimeline.vue.js +++ b/tracklater/static/daytimeline.vue.js @@ -62,6 +62,11 @@ var daytimeline = Vue.component("daytimeline", { module: item.group, project: '' } + let detectedIssue = this.detectIssue(timeSnippet); + if (detectedIssue) { + entry.title = detectedIssue.message; + entry.project = detectedIssue.project; + } this.$emit('addEntry', entry) } }, @@ -79,13 +84,19 @@ var daytimeline = Vue.component("daytimeline", { remove: this.modules[entry.module].capabilities.includes('deleteentry') }, } + let colorObj = this.modules[entry.module].color; + console.log("colorObj", JSON.stringify(colorObj)) + color = colorObj[entry.group] || colorObj.global; if (entry.end_time != undefined) { row.end = new Date(entry.end_time); - if (this.modules[entry.module].color != null) { - row.style = `background-color: ${this.modules[entry.module].color}` + if (color != null) { + row.style = `background-color: ${color}` } } else { row.type = 'point' + if (color != null) { + row.className += ` point-color-${color}` + } } return row }); @@ -207,6 +218,53 @@ var daytimeline = Vue.component("daytimeline", { } return ret; }, + detectIssue(timeSnippet) { + console.log(timeSnippet) + const entries = this.entries.slice() + .filter(i => ["gitmodule"] + .includes(i.module)) + .filter(i => (new Date(i.start_time) < timeSnippet.end_time && new Date(i.start_time) > timeSnippet.start_time)) + .sort((a, b) => { + if (new Date(a.start_time) > new Date(b.start_time)) { + return 1; + } + if (new Date(a.start_time) < new Date(b.start_time)) { + return -1; + } + return 0; + }) + .reverse() + if (entries.length == 0) { + return null + } + let ret = { + group: entries[0].group + } + let issueFound = false; + entries.forEach(entry => { + if (issueFound) { + return; + } + // Try to parse issue + let issueMatch = entry.text.match(/^\w* - ([^ ]+)(.*)/) + if (issueMatch) { + let issueSlug = issueMatch[1] + let issue = this.$store.getters.findIssueByKey(issueSlug); + console.log(issue) + if (issue) { + ret.group = issue.group; + ret.message = issue.key + " " + issue.title; + issueFound = true; + } else { + ret.message = issueMatch[1] + issueMatch[2]; + ret.group = entry.group; + } + } + }); + ret.project = this.$store.getters.getProjectId(ret.group); + console.log(ret) + return ret + }, generateEntries() { const cutoffSeconds = 300; let lastEnd = null; diff --git a/tracklater/static/index.html b/tracklater/static/index.html index 0def36a..aa78967 100644 --- a/tracklater/static/index.html +++ b/tracklater/static/index.html @@ -29,6 +29,15 @@ .vis-timeline { width: 100%; } + .point-color-red * { + border-color: red; + } + .point-color-blue * { + border-color: blue; + } + .point-color-green * { + border-color: green; + } @@ -99,6 +108,17 @@ }, }, getters: { + getProjectId: (state) => (group) => { + for (let module_name in state.modules) { + const projects = state.modules[module_name].projects || []; + for (let _project of projects) { + if (_project.group == group) { + return _project.id; + } + } + } + return null; + }, findIssue: (state) => (title) => { for (let module_name in state.modules) { const _issues = state.modules[module_name].issues || []; @@ -110,6 +130,17 @@ } return null; }, + findIssueByKey: (state) => (key) => { + for (let module_name in state.modules) { + const _issues = state.modules[module_name].issues || []; + for (let i=0; i<_issues.length; i++) { + if (_issues[i].key === key) { + return _issues[i]; + } + } + } + return null; + }, } }) Vue.use(VueObserveVisibility) diff --git a/tracklater/views.py b/tracklater/views.py index 4b45a61..d85eb66 100644 --- a/tracklater/views.py +++ b/tracklater/views.py @@ -43,7 +43,7 @@ def listmodules() -> Any: parser = Parser(None, None) for module_name in settings.ENABLED_MODULES: data[module_name] = { - 'color': settings.UI_SETTINGS.get(module_name, {}).get('global', None), + 'color': settings.UI_SETTINGS.get(module_name, {}), 'capabilities': parser.modules[module_name].capabilities, } return json.dumps(data, default=json_serial) @@ -92,7 +92,7 @@ def fetchdata() -> Any: Issue.module == key )] data[key]['capabilities'] = parser.modules[key].capabilities - data[key]['color'] = settings.UI_SETTINGS.get(key, {}).get('global', None), + data[key]['color'] = settings.UI_SETTINGS.get(key, {}) return json.dumps(data, default=json_serial) return None From 2ce2099dd8d94f62f65383a6fb9f0d5b4a815a25 Mon Sep 17 00:00:00 2001 From: Eero Vilpponen Date: Wed, 10 Mar 2021 11:45:04 +0200 Subject: [PATCH 05/19] Remove generateEntries function. --- tracklater/static/daytimeline.vue.js | 68 ---------------------------- 1 file changed, 68 deletions(-) diff --git a/tracklater/static/daytimeline.vue.js b/tracklater/static/daytimeline.vue.js index 72dcb52..7198483 100644 --- a/tracklater/static/daytimeline.vue.js +++ b/tracklater/static/daytimeline.vue.js @@ -265,74 +265,6 @@ var daytimeline = Vue.component("daytimeline", { console.log(ret) return ret }, - generateEntries() { - const cutoffSeconds = 300; - let lastEnd = null; - let newEntries = []; - let currentEntry = null; - this.entries.slice().sort((a, b) => { - if (new Date(a.start_time) > new Date(b.start_time)) { - return 1; - } - if (new Date(a.start_time) < new Date(b.start_time)) { - return -1; - } - return 0; - }).map(i => { - console.log(i.project) - const startTime = new Date(i.start_time) - const endTime = new Date(i.end_time) - if (i.module == "thyme") { - if (lastEnd == null) { - currentEntry = { - start_time: startTime.addHours(-0.1) - } - lastEnd = endTime; - return; - } - - if ((startTime.getTime() - lastEnd.getTime()) > (cutoffSeconds * 1000)) { - // Too long time between time entries - if (currentEntry != null) { - currentEntry.end_time = lastEnd.addHours(0.1); - newEntries.push(currentEntry); - currentEntry = null; - lastEnd = null; - return; - } - } else { - if (currentEntry == null) { - currentEntry = { - start_time: startTime.addHours(-0.1) - } - } - lastEnd = endTime; - } - } else if (i.module == "gitmodule") { - if (currentEntry != null && lastEnd != null) { - if (currentEntry.project != undefined && currentEntry.project != i.project) { - // project changed - currentEntry.end_time = lastEnd; - newEntries.push(currentEntry); - currentEntry = { - project: i.project, - start: new Date(i.start_time), - }; - lastEnd = null; - return; - } else { - currentEntry.project = i.project; - } - } - } - }) - console.log(newEntries) - newEntries.map(e => { - e.title = "Generated entry" - e.module = "toggl" - this.$emit('addEntry', e) - }) - } }, watch: { entries(entries, oldEntries) { From ade6976a12d779f4097b3b603d1d9036696be7a8 Mon Sep 17 00:00:00 2001 From: Eero Vilpponen Date: Wed, 10 Mar 2021 12:36:30 +0200 Subject: [PATCH 06/19] Fix overlap --- tracklater/static/daytimeline.vue.js | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/tracklater/static/daytimeline.vue.js b/tracklater/static/daytimeline.vue.js index 7198483..4c969e1 100644 --- a/tracklater/static/daytimeline.vue.js +++ b/tracklater/static/daytimeline.vue.js @@ -140,8 +140,8 @@ var daytimeline = Vue.component("daytimeline", { }, generateTimeSnippet(middle_time) { // Go backwards and forwards unit "not much" is happening, and return the - // start and end time. If nothing is happening, return a hour. - const cutoffSeconds = 300; + // start and end time. If nothing is happening, return an hour. + const cutoffSeconds = 400; let ret = { start_time: middle_time.addHours(-0.5), end_time: middle_time.addHours(0.5), @@ -159,6 +159,22 @@ var daytimeline = Vue.component("daytimeline", { i.end_time = new Date(i.end_time) return i }) + // Update ret to fix overlapping issues + for (el of sorted) { + if (!el.module == "toggl") { + continue; + } + // If any toggl entry starts or ends between ret times, change ret. + if (el.start_time < ret.end_time && el.start_time > ret.start_time) { + ret.end_time = el.start_time; + } + if (el.end_time < ret.end_time && el.end_time > ret.start_time) { + ret.start_time = el.end_time; + } + } + if (ret.start_time >= ret.end_time) { + return + } console.log('sorted: ', sorted); console.log('middle_time: ', middle_time); if (sorted.length == 0) { From f264ea29ad52b33b9f761cdb8e72c9a7e9e89d41 Mon Sep 17 00:00:00 2001 From: Eero Vilpponen Date: Wed, 10 Mar 2021 13:00:11 +0200 Subject: [PATCH 07/19] Faster UX in create/delete --- tracklater/static/home.vue.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/tracklater/static/home.vue.js b/tracklater/static/home.vue.js index 0a8e203..b3dc846 100644 --- a/tracklater/static/home.vue.js +++ b/tracklater/static/home.vue.js @@ -82,6 +82,16 @@ var home = Vue.component("home", { }, updateEntry(entry) { this.$store.commit('setLoading', {module_name: 'updateentry', loading: true}); + updated_entries = this.$store.state.modules[entry.module].entries.filter((_entry) => _entry.id !== entry.id); + updated_entries.push({ + id: entry.id || "placeholderid", + start_time: this.parseTime(entry.start_time), + end_time: this.parseTime(entry.end_time), + title: entry.title || "Placeholder", + module: entry.module, + date_group: this.parseTime(entry.start_time).toISOString().split('T')[0], + }) + this.$store.commit('setEntries', {module_name: entry.module, entries: updated_entries}); axios.post("updateentry", { 'module': entry.module, 'entry_id': entry.id, @@ -94,7 +104,7 @@ var home = Vue.component("home", { 'text': entry.text, }).then(response => { console.log(response) - updated_entries = this.$store.state.modules[entry.module].entries.filter((_entry) => _entry.id !== entry.id); + updated_entries = this.$store.state.modules[entry.module].entries.filter((_entry) => _entry.id !== entry.id && _entry.id !== "placeholderid"); updated_entries.push(response.data) this.$store.commit('setSelectedEntry', response.data) this.$store.commit('setInput', {title: response.data.title, issue: null}) @@ -104,6 +114,11 @@ var home = Vue.component("home", { }, deleteEntry(entry) { this.$store.commit('setLoading', {module_name: 'deleteentry', loading: true}); + updated_entries = this.$store.state.modules[entry.module].entries.filter((_entry) => _entry.id !== entry.id); + this.$store.commit('setEntries', {module_name: entry.module, entries: updated_entries}); + if (entry.id == "placeholderid") { + return; + } axios.post('deleteentry', { 'module': entry.module, 'entry_id': entry.id From ac51e7f4d1410caa79250b33ad59becb844c3ae5 Mon Sep 17 00:00:00 2001 From: Eero Vilpponen Date: Wed, 10 Mar 2021 13:03:57 +0200 Subject: [PATCH 08/19] Fix errors --- tracklater/static/daytimeline.vue.js | 4 ---- tracklater/static/home.vue.js | 1 - tracklater/static/timeline.vue.js | 5 +++-- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/tracklater/static/daytimeline.vue.js b/tracklater/static/daytimeline.vue.js index 4c969e1..d0f74f6 100644 --- a/tracklater/static/daytimeline.vue.js +++ b/tracklater/static/daytimeline.vue.js @@ -85,7 +85,6 @@ var daytimeline = Vue.component("daytimeline", { }, } let colorObj = this.modules[entry.module].color; - console.log("colorObj", JSON.stringify(colorObj)) color = colorObj[entry.group] || colorObj.global; if (entry.end_time != undefined) { row.end = new Date(entry.end_time); @@ -235,7 +234,6 @@ var daytimeline = Vue.component("daytimeline", { return ret; }, detectIssue(timeSnippet) { - console.log(timeSnippet) const entries = this.entries.slice() .filter(i => ["gitmodule"] .includes(i.module)) @@ -266,7 +264,6 @@ var daytimeline = Vue.component("daytimeline", { if (issueMatch) { let issueSlug = issueMatch[1] let issue = this.$store.getters.findIssueByKey(issueSlug); - console.log(issue) if (issue) { ret.group = issue.group; ret.message = issue.key + " " + issue.title; @@ -278,7 +275,6 @@ var daytimeline = Vue.component("daytimeline", { } }); ret.project = this.$store.getters.getProjectId(ret.group); - console.log(ret) return ret }, }, diff --git a/tracklater/static/home.vue.js b/tracklater/static/home.vue.js index b3dc846..749e0fc 100644 --- a/tracklater/static/home.vue.js +++ b/tracklater/static/home.vue.js @@ -59,7 +59,6 @@ var home = Vue.component("home", { } catch (e) { console.log(e) } - console.log(ret) return ret; } }, diff --git a/tracklater/static/timeline.vue.js b/tracklater/static/timeline.vue.js index 2f61be2..007ad97 100644 --- a/tracklater/static/timeline.vue.js +++ b/tracklater/static/timeline.vue.js @@ -36,6 +36,9 @@ var vuetimeline = Vue.component("vuetimeline", { items(newItems) { this.parsedItems.clear(); this.parsedItems.add(newItems); + if (!this.timeline) { + return; + } this.timeline.setSelection(this.selection); }, groups(newGroups) { @@ -53,8 +56,6 @@ var vuetimeline = Vue.component("vuetimeline", { }, methods: { visibilityChanged(isVisible, entry) { - console.log(isVisible) - console.log(entry) if (isVisible) { this.loadTimeline(); } else { From aa2f0d0301cc7955e548907b3afa1d763870eac2 Mon Sep 17 00:00:00 2001 From: Eero Vilpponen Date: Wed, 10 Mar 2021 13:41:31 +0200 Subject: [PATCH 09/19] Update libs --- tracklater/static/daytimeline.vue.js | 1 + tracklater/static/index.html | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tracklater/static/daytimeline.vue.js b/tracklater/static/daytimeline.vue.js index d0f74f6..1dd2caf 100644 --- a/tracklater/static/daytimeline.vue.js +++ b/tracklater/static/daytimeline.vue.js @@ -325,6 +325,7 @@ var daytimeline = Vue.component("daytimeline", { end: day_end, editable: true, zoomable: (screen.width < 960), + showCurrentTime: false, horizontalScroll: false, moveable: true, margin: { diff --git a/tracklater/static/index.html b/tracklater/static/index.html index aa78967..dc189c5 100644 --- a/tracklater/static/index.html +++ b/tracklater/static/index.html @@ -47,11 +47,11 @@ - + - + From d357831e94a928edcc215a936e6f68a3e19ffd4d Mon Sep 17 00:00:00 2001 From: Eero Vilpponen Date: Wed, 10 Mar 2021 17:46:38 +0200 Subject: [PATCH 10/19] Week view --- tracklater/static/home.vue.js | 30 ++++++++- tracklater/static/index.html | 23 +++++-- tracklater/static/timeline.vue.js | 21 +----- tracklater/static/toolbar.vue.js | 107 +++++++++++++++++++----------- tracklater/views.py | 2 + 5 files changed, 117 insertions(+), 66 deletions(-) diff --git a/tracklater/static/home.vue.js b/tracklater/static/home.vue.js index 749e0fc..f7ce3ec 100644 --- a/tracklater/static/home.vue.js +++ b/tracklater/static/home.vue.js @@ -14,6 +14,7 @@ var home = Vue.component("home", { >
{ + axios.get("fetchdata", {params: { + parse: parse, + keys: [module_name], + from: this.$store.getters.getFrom, + to: this.$store.getters.getTo, + }}).then(response => { console.log(response) this.$store.commit('updateModules', response.data); this.$store.commit('setLoading', {module_name, loading: false}); @@ -137,13 +146,28 @@ var home = Vue.component("home", { } } }, + watch: { + "$store.state.currentWeek"() { + if (!this.$refs.daytimelines) { + return; + } + for (el of this.$refs.daytimelines) { + el.$refs.timeline.unloadTimeline(); + } + this.fetchModule("all", 0) + } + }, mounted() { axios.get("listmodules").then(response => { console.log(response) this.$store.commit('updateModules', response.data); }) this.$store.commit('setLoading', {module_name: 'fetchdata', loading: true}); - axios.get("fetchdata", {params: {parse: "0"}}).then(response => { + axios.get("fetchdata", {params: { + parse: "0", + from: this.$store.getters.getFrom, + to: this.$store.getters.getTo, + }}).then(response => { console.log("fetchdata (parse: 0)", response) this.$store.commit('updateModules', response.data); this.$store.commit('setLoading', {module_name: 'fetchdata', loading: false}); diff --git a/tracklater/static/index.html b/tracklater/static/index.html index dc189c5..b7bb5b3 100644 --- a/tracklater/static/index.html +++ b/tracklater/static/index.html @@ -6,7 +6,7 @@ VUE SPA - +