Skip to content

Commit 24da175

Browse files
authored
Multi Timeline Configs (#332)
* initial upgrade to multi timelineconfigs * fix button display and default display of timeline button * allow for empty timeline configs, change logic for selecting/editing timeline configs * increment client version * update editing timeline name
1 parent f7dea43 commit 24da175

10 files changed

Lines changed: 720 additions & 189 deletions

File tree

client/dive-common/components/ControlsContainer.vue

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@ import {
1111
Timeline,
1212
TimelineKey,
1313
} from 'vue-media-annotator/components';
14-
import { UISettingsKey } from 'vue-media-annotator/ConfigurationManager';
14+
import { TimelineDisplay, UISettingsKey } from 'vue-media-annotator/ConfigurationManager';
1515
import TimelineCharts from 'vue-media-annotator/components/controls/TimelineCharts.vue';
1616
import TimelineButtons from 'vue-media-annotator/components/controls/TimelineButtons.vue';
1717
import {
1818
useAttributesFilters, useConfiguration,
19+
useTimelineFilters,
1920
} from '../../src/provides';
2021
2122
export default defineComponent({
@@ -53,10 +54,32 @@ export default defineComponent({
5354
const currentView = ref('Detections');
5455
const ticks = ref([0.25, 0.5, 0.75, 1.0, 2.0, 4.0, 8.0]);
5556
const configMan = useConfiguration();
57+
const attributesFilter = useAttributesFilters();
58+
const { enabledTimelines: enabledFilterTimelines } = useTimelineFilters();
5659
const getUISetting = (key: UISettingsKey) => (configMan.getUISetting(key));
5760
if (getUISetting('UIDetections') === false && getUISetting('UIEvents')) {
5861
currentView.value = 'Events';
5962
}
63+
if (getUISetting('UIDetections') === false && getUISetting('UIEvents') === false) {
64+
// Current view should be the first item in the list
65+
const timelines: { name: string; type: TimelineDisplay['type'] }[] = [];
66+
Object.entries(attributesFilter.timelineEnabled.value).forEach(([key, enabled]) => {
67+
if (enabled) {
68+
timelines.push({ name: key, type: 'graph' });
69+
}
70+
});
71+
Object.entries(attributesFilter.swimlaneEnabled.value).forEach(([key, enabled]) => {
72+
if (enabled) {
73+
timelines.push({ name: key, type: 'swimlane' });
74+
}
75+
});
76+
enabledFilterTimelines.value.forEach((item) => {
77+
timelines.push({ name: item.name, type: 'filter' });
78+
});
79+
if (timelines.length > 0) {
80+
currentView.value = timelines[0].name;
81+
}
82+
}
6083
const enabledKey = ref(false);
6184
const dismissedButtons: Ref<string[]> = ref([]); // buttons that have been dismissed from the timelineConfig;
6285
const dismissedHeights: Ref<{name: string; height: number}[]> = ref([]);
@@ -65,8 +88,9 @@ export default defineComponent({
6588
} = useAttributesFilters();
6689
6790
const timelineHeight = computed(() => {
68-
if (configMan.configuration.value?.timelineConfigs?.maxHeight) {
69-
let max = configMan.configuration.value?.timelineConfigs?.maxHeight;
91+
const activeConfig = configMan.getActiveTimelineConfig();
92+
if (activeConfig?.maxHeight) {
93+
let max = activeConfig.maxHeight;
7094
dismissedHeights.value.forEach((item) => {
7195
max -= item.height;
7296
});

client/dive-common/components/EditorMenu.vue

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,10 @@ export default defineComponent({
9696
},
9797
};
9898
99+
const editBlackColorScale = ref(false);
100+
const editWhiteColorScale = ref(false);
101+
const editTransparentcolor = ref(false);
102+
99103
const editButtons = computed((): ButtonData[] => {
100104
const buttons: ButtonData[] = [{
101105
id: 'rectangle',
@@ -380,6 +384,9 @@ export default defineComponent({
380384
loadingFrame,
381385
buttonOptions,
382386
menuOptions,
387+
editWhiteColorScale,
388+
editBlackColorScale,
389+
editTransparentcolor,
383390
};
384391
},
385392
});

client/dive-common/components/configurationEditors/TimelineConfiguration.vue

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ export default defineComponent({
1515
type: Object as PropType<TimelineConfiguration>,
1616
required: true,
1717
},
18+
configName: {
19+
type: String,
20+
default: '',
21+
},
1822
},
1923
setup(props, { emit }) {
2024
const baseHeight = ref(props.timelineConfig.maxHeight || 300);
@@ -115,6 +119,16 @@ export default defineComponent({
115119
<v-card>
116120
<h2>Custom Timeline List</h2>
117121
<v-card-text>
122+
<v-row dense>
123+
<v-text-field
124+
:value="configName"
125+
label="Configuration Name"
126+
outlined
127+
dense
128+
class="mr-2"
129+
@input="$emit('update-config-name', $event)"
130+
/>
131+
</v-row>
118132
<v-row dense>
119133
<v-select
120134
v-model="addTimeline"

0 commit comments

Comments
 (0)