Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions client/src/components/RecordingList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,15 @@ import { EditingRecording } from './UploadRecording.vue';
export default defineComponent({
setup() {

const { sharedList, recordingList, currentUser, configuration } = useState();
const {
sharedList,
recordingList,
currentUser,
configuration,
showSubmittedRecordings,
myRecordingsDisplay,
sharedRecordingsDisplay,
} = useState();
const editingRecording: Ref<EditingRecording | null> = ref(null);

const fetchRecordings = async () => {
Expand Down Expand Up @@ -47,18 +55,27 @@ export default defineComponent({
openPanel,
userSubmittedAnnotation,
configuration,
myRecordingsDisplay,
sharedRecordingsDisplay,
showSubmittedRecordings,
};
},
});
</script>

<template>
<v-expansion-panels v-model="openPanel">
<v-checkbox
v-if="configuration.mark_annotations_completed_enabled"
v-model="showSubmittedRecordings"
label="Show submitted recordings"
hide-details
/>
<v-expansion-panel>
<v-expansion-panel-title>My Recordings</v-expansion-panel-title>
<v-expansion-panel-text>
<div
v-for="item in recordingList"
v-for="item in myRecordingsDisplay"
:key="`public_${item.id}`"
>
<v-card class="pa-2 my-2">
Expand Down
69 changes: 68 additions & 1 deletion client/src/use/useState.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ref, Ref, watch } from "vue";
import { computed, ref, Ref, watch } from "vue";
import { useRouter } from 'vue-router';
import { cloneDeep } from "lodash";
import * as d3 from "d3";
Expand Down Expand Up @@ -155,6 +155,66 @@ export default function useState() {
return router.currentRoute.value.fullPath.includes('nabat');
}

const showSubmittedRecordings = ref(false);

const submittedMyRecordings = computed(() => {
const submittedByMe = recordingList.value.filter((recording: Recording) => {
const myAnnotations = recording.fileAnnotations.filter((annotation: FileAnnotation) => (
annotation.owner === currentUser.value && annotation.submitted
));
return myAnnotations.length > 0;
});
return submittedByMe;
});

const submittedSharedRecordings = computed(() => {
const submittedByMe = sharedList.value.filter((recording: Recording) => {
const myAnnotations = recording.fileAnnotations.filter((annotation: FileAnnotation) => (
annotation.owner === currentUser.value && annotation.submitted
));
return myAnnotations.length > 0;
});
return submittedByMe;
});

const unsubmittedMyRecordings = computed(() => {
const unsubmitted = recordingList.value.filter((recording: Recording) => {
const myAnnotations = recording.fileAnnotations.filter((annotation: FileAnnotation) => (
annotation.owner === currentUser.value && annotation.submitted
));
return myAnnotations.length === 0;
});
return unsubmitted;
});

const unsubmittedSharedRecordings = computed(() => {
const unsubmitted = sharedList.value.filter((recording: Recording) => {
const myAnnotations = recording.fileAnnotations.filter((annotation: FileAnnotation) => (
annotation.owner === currentUser.value && annotation.submitted
));
return myAnnotations.length === 0;
});
return unsubmitted;
});

// Use state to determine which recordings should be shown to the user
const myRecordingsDisplay = computed(() => {
if (!configuration.value.mark_annotations_completed_enabled) {
return recordingList.value;
} else {
return showSubmittedRecordings.value ? recordingList.value : unsubmittedMyRecordings.value;
}
});

const sharedRecordingsDisplay = computed(() => {
if (!configuration.value.mark_annotations_completed_enabled) {
return sharedList.value;
} else {
return showSubmittedRecordings.value ? sharedList.value : unsubmittedSharedRecordings.value;
}
});



return {
annotationState,
Expand Down Expand Up @@ -198,5 +258,12 @@ export default function useState() {
scaledHeight,
fixedAxes,
toggleFixedAxes,
showSubmittedRecordings,
submittedMyRecordings,
submittedSharedRecordings,
unsubmittedMyRecordings,
unsubmittedSharedRecordings,
myRecordingsDisplay,
sharedRecordingsDisplay,
};
}
122 changes: 89 additions & 33 deletions client/src/views/Recordings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ import RecordingAnnotationSummary from '@components/RecordingAnnotationSummary.v
import { FilterFunction, InternalItem } from 'vuetify';

export default defineComponent({
components: {
UploadRecording,
MapLocation,
BatchUploadRecording,
RecordingInfoDisplay,
RecordingAnnotationSummary,
},
components: {
UploadRecording,
MapLocation,
BatchUploadRecording,
RecordingInfoDisplay,
RecordingAnnotationSummary,
},
setup() {
const itemsPerPage = ref(-1);
const {
Expand All @@ -38,6 +38,11 @@ export default defineComponent({
currentUser,
configuration,
loadCurrentUser,
showSubmittedRecordings,
submittedMyRecordings,
submittedSharedRecordings,
myRecordingsDisplay,
sharedRecordingsDisplay,
} = useState();
const editingRecording: Ref<EditingRecording | null> = ref(null);
let intervalRef: number | null = null;
Expand Down Expand Up @@ -231,6 +236,14 @@ export default defineComponent({
}
}

const recordingListStyles = computed(() => {
const sectionHeight = configuration.value.mark_annotations_completed_enabled ? '35vh' : '40vh';
return {
'height': sectionHeight,
'max-height': sectionHeight,
};
});

onMounted(async () => {
await loadCurrentUser();
await fetchRecordingTags();
Expand Down Expand Up @@ -308,6 +321,12 @@ export default defineComponent({
dataLoading,
submittedForCurrentUser,
configuration,
submittedMyRecordings,
submittedSharedRecordings,
recordingListStyles,
showSubmittedRecordings,
myRecordingsDisplay,
sharedRecordingsDisplay,
};
},
});
Expand All @@ -321,26 +340,35 @@ export default defineComponent({
My Recordings
</div>
<v-spacer />
<v-menu>
<template #activator="{ props }">
<v-btn
color="primary"
v-bind="props"
>
Upload <v-icon>mdi-chevron-down</v-icon>
</v-btn>
</template>
<v-list>
<v-list-item @click="uploadDialog=true">
<v-list-item-title>Upload Recording</v-list-item-title>
</v-list-item>
<v-list-item @click="batchUploadDialog=true">
<v-list-item-title>
Batch Upload
</v-list-item-title>
</v-list-item>
</v-list>
</v-menu>
<div class="d-flex justify-center align-center">
<v-checkbox
v-if="configuration.mark_annotations_completed_enabled"
v-model="showSubmittedRecordings"
class="mr-4"
label="Show submitted recordings"
hide-details
/>
<v-menu>
<template #activator="{ props }">
<v-btn
color="primary"
v-bind="props"
>
Upload <v-icon>mdi-chevron-down</v-icon>
</v-btn>
</template>
<v-list>
<v-list-item @click="uploadDialog=true">
<v-list-item-title>Upload Recording</v-list-item-title>
</v-list-item>
<v-list-item @click="batchUploadDialog=true">
<v-list-item-title>
Batch Upload
</v-list-item-title>
</v-list-item>
</v-list>
</v-menu>
</div>
</v-row>
</v-card-title>
<v-card-text>
Expand Down Expand Up @@ -372,13 +400,14 @@ export default defineComponent({
<v-data-table
v-model:items-per-page="itemsPerPage"
:headers="headers"
:items="recordingList"
:items="myRecordingsDisplay"
:custom-filter="tagFilter"
filter-keys="['tag']"
:search="filterTags.length ? 'seach-active' : ''"
density="compact"
:loading="dataLoading"
class="elevation-1 my-recordings"
:style="recordingListStyles"
>
<template #top>
<div max-height="100px">
Expand Down Expand Up @@ -524,6 +553,21 @@ export default defineComponent({
</template>
<template #bottom />
</v-data-table>
<div
v-if="recordingList.length && configuration.mark_annotations_completed_enabled"
class="d-flex justify-center align-center"
>
<v-progress-linear
height="10"
color="success"
:model-value="submittedMyRecordings.length"
min="0"
:max="recordingList.length"
/>
<span class="ml-4 text-h6">
({{ submittedMyRecordings.length }}/{{ recordingList.length }})
</span>
</div>
</v-card-text>
<v-dialog
v-model="uploadDialog"
Expand Down Expand Up @@ -557,13 +601,14 @@ export default defineComponent({
<v-data-table
v-model:items-per-page="itemsPerPage"
:headers="sharedHeaders"
:items="sharedList"
:items="sharedRecordingsDisplay"
:custom-filter="sharedTagFilter"
filter-keys="['tag']"
:search="sharedFilterTags.length ? 'seach-active' : ''"
:loading="dataLoading"
density="compact"
class="elevation-1 shared-recordings"
:style="recordingListStyles"
>
<template #top>
<div max-height="100px">
Expand Down Expand Up @@ -683,19 +728,30 @@ export default defineComponent({
</template>
<template #bottom />
</v-data-table>
<div
v-if="sharedList.length && configuration.mark_annotations_completed_enabled"
class="d-flex justify-center align-center"
>
<v-progress-linear
height="10"
color="success"
:model-value="submittedSharedRecordings.length"
min="0"
:max="sharedList.length"
/>
<span class="ml-4 text-h6">
({{ submittedSharedRecordings.length }}/{{ sharedList.length }})
</span>
</div>
</v-card-text>
</v-card>
</template>

<style scoped>
.my-recordings {
height: 40vh;
max-height: 40vh;
overflow-y:scroll;
}
.shared-recordings {
height: 40vh;
max-height: 40vh;
overflow-y:scroll;
}
</style>