Skip to content

Commit 703c40c

Browse files
authored
sidebar collapse functionality (#255)
* sidebar collapse functionality * linting
1 parent 37468cf commit 703c40c

3 files changed

Lines changed: 33 additions & 4 deletions

File tree

client/dive-common/components/Viewer.vue

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ export default defineComponent({
151151
const controlsRef = ref();
152152
const controlsHeight = ref(0);
153153
const controlsCollapsed = ref(false);
154+
const sideBarCollapsed = ref(false);
154155
155156
const progressValue = computed(() => {
156157
if (progress.total > 0 && (progress.progress !== progress.total)) {
@@ -890,7 +891,7 @@ export default defineComponent({
890891
if (previous) observer.unobserve(previous.$el);
891892
if (controlsRef.value) observer.observe(controlsRef.value.$el);
892893
});
893-
watch(controlsCollapsed, async () => {
894+
watch([controlsCollapsed, sideBarCollapsed], async () => {
894895
await nextTick();
895896
handleResize();
896897
});
@@ -1006,6 +1007,7 @@ export default defineComponent({
10061007
controlsRef,
10071008
controlsHeight,
10081009
controlsCollapsed,
1010+
sideBarCollapsed,
10091011
colorBy,
10101012
clientSettings,
10111013
datasetName,
@@ -1111,6 +1113,20 @@ export default defineComponent({
11111113
</span>
11121114
<v-spacer />
11131115
<template #extension>
1116+
<v-tooltip
1117+
v-if="getUISetting('UISideBar')"
1118+
bottom
1119+
>
1120+
<template #activator="{ on }">
1121+
<v-icon
1122+
v-on="on"
1123+
@click="sideBarCollapsed = !sideBarCollapsed"
1124+
>
1125+
{{ sideBarCollapsed ? 'mdi-chevron-right-box' : 'mdi-chevron-left-box' }}
1126+
</v-icon>
1127+
</template>
1128+
<span>Collapse Side Panel</span>
1129+
</v-tooltip>
11141130
<EditorMenu
11151131
v-if="getUISetting('UIToolBar')"
11161132
v-bind="{
@@ -1222,7 +1238,7 @@ export default defineComponent({
12221238
style="min-width: 700px;"
12231239
>
12241240
<sidebar
1225-
v-if="getUISetting('UISideBar')"
1241+
v-if="getUISetting('UISideBar') && !sideBarCollapsed"
12261242
:enable-slot="context.state.active !== 'TypeThreshold'"
12271243
@import-types="trackFilters.importTypes($event)"
12281244
@track-seek="aggregateController.seek($event)"
@@ -1296,7 +1312,6 @@ export default defineComponent({
12961312
</div>
12971313
<ControlsContainer
12981314
ref="controlsRef"
1299-
class="shrink"
13001315
:collapsed.sync="controlsCollapsed"
13011316
v-bind="{
13021317
lineChartData, eventChartData, groupChartData, datasetType,

client/src/components/controls/Timeline.vue

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export default {
3232
clientWidth: 0,
3333
clientHeight: 0,
3434
margin: 20,
35+
resizeObserver: null,
3536
};
3637
},
3738
computed: {
@@ -97,14 +98,27 @@ export default {
9798
},
9899
beforeDestroy() {
99100
window.removeEventListener('resize', this.resizeHandler);
101+
if (this.resizeObserver && this.$refs.workarea) {
102+
this.resizeObserver.unobserve(this.$refs.workarea);
103+
this.resizeObserver.disconnect();
104+
}
100105
},
101106
mounted() {
102107
this.initialize();
103108
},
104109
methods: {
105110
initialize() {
111+
if (!this.$refs.workarea) {
112+
return;
113+
}
106114
const width = this.$refs.workarea?.clientWidth || 0;
107115
const height = this.$refs.workarea?.clientHeight || 0;
116+
if (this.$refs.workarea) {
117+
this.resizeObserver = new ResizeObserver(() => {
118+
this.resizeHandler();
119+
});
120+
this.resizeObserver.observe(this.$refs.workarea);
121+
}
108122
// clientWidth and clientHeight are properties used to resize child elements
109123
this.clientWidth = width - this.margin;
110124
// Timeline height needs to offset so it doesn't overlap the frame number

server/dive_server/crud_annotation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -717,7 +717,7 @@ def delete_masks(
717717
}
718718
)
719719
if not mask_folder:
720-
raise RestException("Mask folder not found in dataset.", code=404)
720+
return # mask folder doesn't exist so this can be skipped
721721

722722
if not track_frame_pairs:
723723
raise RestException("No track/frame pairs provided for deletion.", code=400)

0 commit comments

Comments
 (0)