Skip to content

Commit

Permalink
fix: multiple fixes to event editing
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikBjare committed Aug 31, 2022
1 parent f4a0741 commit 5099a68
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/components/EventEditor.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template lang="pug">
b-modal(id="edit-modal", ref="eventEditModal", title="Edit event", centered, hide-footer)
b-modal(v-if="event && event.id", :id="'edit-modal-' + event.id", ref="eventEditModal", title="Edit event", centered, hide-footer)
div(v-if="!editedEvent")
| Loading event...

Expand Down
11 changes: 7 additions & 4 deletions src/stores/buckets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export const useBucketsStore = defineStore('buckets', {

return {
window: windowAvail,
browser: window && this.bucketsBrowser(hostname).length > 0,
browser: windowAvail && this.bucketsBrowser(hostname).length > 0,
editor: this.bucketsEditor(hostname).length > 0,
android: androidAvail,
category: windowAvail || androidAvail,
Expand Down Expand Up @@ -94,9 +94,12 @@ export const useBucketsStore = defineStore('buckets', {
const type = 'web.tab.current';
return (host: string) => {
const buckets = select_buckets(this.buckets, { host, type });
return buckets.length == 0
? select_buckets(this.buckets, { host: 'unknown', type })
: buckets;
if (buckets.length > 0) {
return buckets;
} else {
console.log('fallback: ', select_buckets(this.buckets, { host: 'unknown', type }));
return select_buckets(this.buckets, { host: 'unknown', type });
}
};
},

Expand Down
14 changes: 10 additions & 4 deletions src/views/Bucket.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ export default {
return {
bucketsStore: useBucketsStore(),
bucket_with_events: { events: [] },
events: [],
eventcount: '?',
daterange: null,
Expand All @@ -52,7 +51,14 @@ export default {
},
computed: {
bucket() {
return this.bucketsStore.getBucket(this.id) || {};
return this.bucketsStore.getBucket(this.id) || { id: this.id };
},
bucket_with_events() {
console.log(this.bucket);
return {
...this.bucket,
events: this.events,
};
},
},
watch: {
Expand All @@ -66,12 +72,12 @@ export default {
},
methods: {
getEvents: async function (bucket_id) {
this.bucket_with_events = await this.bucketsStore.getBucketWithEvents({
const bucket = await this.bucketsStore.getBucketWithEvents({
id: bucket_id,
start: this.daterange[0].format(),
end: this.daterange[1].format(),
});
this.events = this.bucket_with_events.events;
this.events = bucket.events;
},
getEventCount: async function (bucket_id) {
this.eventcount = (await getClient().countEvents(bucket_id)).data;
Expand Down
2 changes: 1 addition & 1 deletion src/views/Stopwatch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ div
| Using bucket: {{bucket_id}}

b-alert(show)
| This is an early experiment, an important missing feature is the ability to set start/end times manually.
| This is an early experiment. Data entered here is not shown in the Activity view, yet.

b-input-group(size="lg")
b-input(v-model="label" placeholder="What are you working on?")
Expand Down
4 changes: 3 additions & 1 deletion src/visualizations/EventList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,9 @@ export default {
methods: {
editEvent: function (event) {
this.editableEvent = event;
this.$bvModal.show('edit-modal');
this.$nextTick(() => {
this.$bvModal.show('edit-modal-' + event.id);
});
},
expandList: function () {
this.isListExpanded = !this.isListExpanded;
Expand Down
2 changes: 1 addition & 1 deletion src/visualizations/VisTimeline.vue
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ export default {
},
methods: {
openEditor: function () {
this.$bvModal.show('edit-modal');
this.$bvModal.show('edit-modal-' + this.editingEvent.id);
},
onSelect: async function (properties) {
if (properties.items.length == 0) {
Expand Down

2 comments on commit 5099a68

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here are screenshots of this commit:

Screenshots using aw-server v0.12.0b2 (click to expand)

Screenshots using aw-server-rust v0.12.0b2 (click to expand)

CML watermark

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here are screenshots of this commit:

Screenshots using aw-server v0.12.0b2 (click to expand)

Screenshots using aw-server-rust v0.12.0b2 (click to expand)

CML watermark

Please sign in to comment.