Skip to content

Commit 42e7597

Browse files
authored
Time Annotations and Custom UI integration (#204)
* adds time annotations * custom ui and button integration * linting/updating * update lock * adding action buttons * action buttons * url history preserve * formatting * remove logging * text-alignment * enable either keyboard shortcut or buttons * update AttributeShortcut type specification for optional key
1 parent 593a766 commit 42e7597

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+1580
-484
lines changed

client/dive-common/components/ActionEditors/ActionShortcuts.vue

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,15 @@ import {
1313
import ActionEditor from './ActionEditor.vue';
1414
import GetShortcut from './GetShortcut.vue';
1515
import TrackFilter from './TrackFilter.vue';
16+
import ButtonShortcutEditor from '../CustomUI/ButtonShortcutEditor.vue';
1617
1718
export default defineComponent({
1819
name: 'ActionShortcuts',
1920
components: {
2021
TrackFilter,
2122
GetShortcut,
2223
ActionEditor,
24+
ButtonShortcutEditor,
2325
},
2426
props: {
2527
disabled: {
@@ -349,6 +351,12 @@ export default defineComponent({
349351
/>
350352
</div>
351353
</div>
354+
<div v-if="editingShortcut">
355+
<button-shortcut-editor
356+
v-model="editingShortcut.button"
357+
:attribute="false"
358+
/>
359+
</div>
352360
<v-row
353361
v-if="editingShortcut !== null"
354362
dense

client/dive-common/components/Attributes/AttributeEditor.vue

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ export default defineComponent({
3434
const { prompt } = usePrompt();
3535
const trackStyleManager = useTrackStyleManager();
3636
const name: Ref<string> = ref(props.selectedAttribute.name);
37+
const description: Ref<string> = ref(props.selectedAttribute.description || '');
3738
const belongs: Ref<Attribute['belongs']> = ref(props.selectedAttribute.belongs);
3839
const datatype: Ref<Attribute['datatype']> = ref(props.selectedAttribute.datatype);
3940
const attributeColors:
@@ -66,11 +67,13 @@ export default defineComponent({
6667
},
6768
6869
});
70+
const lockedValues = ref(!!props.selectedAttribute.lockedValues);
6971
const attributeRendering = ref(!!props.selectedAttribute.render);
7072
const renderingVals = ref(props.selectedAttribute.render);
7173
7274
function setDefaultValue() {
7375
name.value = '';
76+
description.value = '';
7477
belongs.value = 'track';
7578
datatype.value = 'number';
7679
values = [];
@@ -90,6 +93,7 @@ export default defineComponent({
9093
9194
const data: Attribute = {
9295
name: name.value,
96+
description: description.value || undefined,
9397
belongs: belongs.value,
9498
datatype: datatype.value,
9599
values: datatype.value === 'text' && values ? values : [],
@@ -100,6 +104,7 @@ export default defineComponent({
100104
shortcuts: shortcuts.value,
101105
user: user.value ? true : undefined,
102106
render: renderingVals.value,
107+
lockedValues: lockedValues.value,
103108
};
104109
if (valueOrder) {
105110
data.valueOrder = valueOrder;
@@ -222,6 +227,7 @@ export default defineComponent({
222227
};
223228
return {
224229
name,
230+
description,
225231
belongs,
226232
color,
227233
colorEditor,
@@ -235,6 +241,7 @@ export default defineComponent({
235241
renderingVals,
236242
currentTab,
237243
attributeColors,
244+
lockedValues,
238245
//computed
239246
textValues,
240247
shortcuts,
@@ -293,6 +300,10 @@ export default defineComponent({
293300
|| 'No spaces', v => v !== 'userAttributes' || 'Reserved Name']"
294301
required
295302
/>
303+
<v-text-field
304+
v-model="description"
305+
label="Description"
306+
/>
296307
<v-select
297308
:value="datatype"
298309
:items="[
@@ -320,14 +331,24 @@ export default defineComponent({
320331
/>
321332
</v-radio-group>
322333
</div>
323-
<div>
334+
<v-row dense>
324335
<v-checkbox
325336
v-model="user"
326337
label="User Attribute"
327338
hint="Attribute data is saved per user instead of globally."
328339
persistent-hint
340+
class="py-2 mx-2"
329341
/>
330-
</div>
342+
<v-spacer />
343+
<v-checkbox
344+
v-if="textValues.length && datatype === 'text'"
345+
v-model="lockedValues"
346+
label="Lock Values"
347+
hint="Lock Values to only predefined Values"
348+
persistent-hint
349+
class="py-2 mx-2"
350+
/>
351+
</v-row>
331352
<div v-if="datatype === 'number' && editor && editor.type === 'slider'">
332353
<v-row class="pt-2">
333354
<v-text-field

client/dive-common/components/Attributes/AttributeInput.vue

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ export default defineComponent({
3838
type: Object as PropType<null | NumericAttributeEditorOptions | StringAttributeEditorOptions>,
3939
default: null,
4040
},
41+
lockedValue: {
42+
type: Boolean,
43+
default: false,
44+
},
4145
},
4246
setup(props, { emit }) {
4347
const tempVal = ref(props.value as null | boolean | number | string);
@@ -133,9 +137,8 @@ export default defineComponent({
133137
{{ type }}
134138
</option>
135139
</datalist>
136-
137140
<input
138-
v-if="datatype === 'text'"
141+
v-if="datatype === 'text' && !lockedValue"
139142
ref="inputBoxRef"
140143
v-model="tempVal"
141144
type="text"
@@ -146,6 +149,13 @@ export default defineComponent({
146149
@focus="onFocus"
147150
@keydown="onInputKeyEvent"
148151
>
152+
<v-select
153+
v-else-if="datatype === 'text' && lockedValue"
154+
v-model="tempVal"
155+
:items="values"
156+
class="input-box"
157+
dense
158+
/>
149159
<input
150160
v-else-if="datatype === 'number' && (!typeSettings || typeSettings.type === 'combo')"
151161
ref="inputBoxRef"

client/dive-common/components/Attributes/AttributeShortcutToggle.vue

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ export default defineComponent({
114114
dataType: 'number' | 'text' | 'boolean';
115115
description: string; belongs: 'track' | 'detection'; name: string;
116116
list?: string[];
117+
lockedValues?: boolean;
117118
}[] = [];
118119
attributes.value.forEach((attribute) => {
119120
if (attribute.shortcuts && attribute.shortcuts.length > 0) {
@@ -133,6 +134,7 @@ export default defineComponent({
133134
dataType: attribute.datatype,
134135
name: attribute.name,
135136
list: attribute.values,
137+
lockedValues: !!attribute.lockedValues,
136138
});
137139
});
138140
}
@@ -169,7 +171,7 @@ export default defineComponent({
169171
const index = actionShortcuts.value.findIndex((item) => item.shortcut === shortcut);
170172
if (index !== -1) {
171173
actionShortcuts.value[index].actions.forEach((action) => {
172-
systemHandler.processAction(action, true, { frame: frameRef.value });
174+
systemHandler.processAction(action, true, { frame: frameRef.value }, store.state.User.user?.login);
173175
});
174176
}
175177
};
@@ -183,7 +185,7 @@ export default defineComponent({
183185
});
184186
if (index !== -1) {
185187
diveActionShortcuts.value[index].actions.forEach((action) => {
186-
systemHandler.processAction(action, true, { frame: frameRef.value });
188+
systemHandler.processAction(action, true, { frame: frameRef.value }, store.state.User.user?.login);
187189
});
188190
}
189191
};
@@ -251,6 +253,7 @@ export default defineComponent({
251253
confirm: true,
252254
valueType: shortcut.dataType,
253255
valueList: shortcut.list,
256+
lockedValueList: !!shortcut.lockedValues,
254257
});
255258
if (val !== null) {
256259
updateAttribute({

0 commit comments

Comments
 (0)