-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Recording List in Spectrogram Annotator (#48)
* initial annotation-recording list * removing uneeded code from recording list * add in next button as well as global shared ref for recordings
- Loading branch information
1 parent
46493c7
commit 7a6fb01
Showing
6 changed files
with
290 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,171 @@ | ||
<script lang="ts"> | ||
import { defineComponent, ref, Ref, onMounted, computed } from 'vue'; | ||
import { getRecordings } from '../api/api'; | ||
import useState from '../use/useState'; | ||
import { EditingRecording } from './UploadRecording.vue'; | ||
export default defineComponent({ | ||
components: { | ||
}, | ||
setup() { | ||
const { sharedList, recordingList } = useState(); | ||
const editingRecording: Ref<EditingRecording | null> = ref(null); | ||
const fetchRecordings = async () => { | ||
const recordings = await getRecordings(); | ||
recordingList.value = recordings.data; | ||
const shared = await getRecordings(true); | ||
sharedList.value = shared.data; | ||
}; | ||
onMounted(() => fetchRecordings()); | ||
const openPanel = ref(1); | ||
const filtered = ref(true); | ||
const modifiedList = computed(() => { | ||
if (filtered.value) { | ||
return sharedList.value.filter((item) => !item.userMadeAnnotations); | ||
} | ||
return sharedList.value; | ||
}); | ||
return { | ||
recordingList, | ||
sharedList, | ||
modifiedList, | ||
filtered, | ||
editingRecording, | ||
openPanel, | ||
}; | ||
}, | ||
}); | ||
</script> | ||
|
||
<template> | ||
<v-expansion-panels v-model="openPanel"> | ||
<v-expansion-panel> | ||
<v-expansion-panel-title>My Recordings</v-expansion-panel-title> | ||
<v-expansion-panel-text> | ||
<div> | ||
<v-row | ||
dense | ||
class="text-center" | ||
> | ||
<v-col class="text-left"> | ||
<b>Name</b> | ||
</v-col> | ||
<v-col><b>Public</b></v-col> | ||
<v-col><b>Annotations</b></v-col> | ||
</v-row> | ||
</div> | ||
<div | ||
v-for="item in recordingList" | ||
:key="`public_${item.id}`" | ||
> | ||
<v-row | ||
dense | ||
class="text-center" | ||
> | ||
<v-col class="text-left"> | ||
<router-link | ||
:to="`/recording/${item.id.toString()}/spectrogram`" | ||
> | ||
{{ item.name }} | ||
</router-link> | ||
</v-col> | ||
<v-col> | ||
<v-icon | ||
v-if="item.public" | ||
color="success" | ||
> | ||
mdi-check | ||
</v-icon> | ||
<v-icon | ||
v-else | ||
color="error" | ||
> | ||
mdi-close | ||
</v-icon> | ||
</v-col> | ||
<v-col> | ||
<div> | ||
{{ item.userAnnotations }} | ||
</div> | ||
</v-col> | ||
</v-row> | ||
</div> | ||
</v-expansion-panel-text> | ||
</v-expansion-panel> | ||
<v-expansion-panel> | ||
<v-expansion-panel-title>Public</v-expansion-panel-title> | ||
<v-expansion-panel-text class="ma-0 pa-0"> | ||
<v-switch | ||
v-model="filtered" | ||
label="Filter Annotated" | ||
dense | ||
/> | ||
<div> | ||
<v-row | ||
dense | ||
class="text-center" | ||
> | ||
<v-col class="text-left"> | ||
<b>Name</b> | ||
</v-col> | ||
<v-col><b>Owner</b></v-col> | ||
<v-col><b>Annotated</b></v-col> | ||
</v-row> | ||
</div> | ||
<div | ||
v-for="item in modifiedList" | ||
:key="`public_${item.id}`" | ||
> | ||
<v-row | ||
dense | ||
class="text-center" | ||
> | ||
<v-col class="text-left"> | ||
<router-link | ||
:to="`/recording/${item.id.toString()}/spectrogram`" | ||
> | ||
{{ item.name }} | ||
</router-link> | ||
</v-col> | ||
<v-col> | ||
<div style="font-size:0.75em"> | ||
{{ item.owner_username }} | ||
</div> | ||
</v-col> | ||
<v-col> | ||
<div> | ||
<v-icon | ||
v-if="item.userMadeAnnotations" | ||
color="success" | ||
> | ||
mdi-check | ||
</v-icon> | ||
<v-icon | ||
v-else | ||
color="error" | ||
> | ||
mdi-close | ||
</v-icon> | ||
</div> | ||
</v-col> | ||
</v-row> | ||
</div> | ||
</v-expansion-panel-text> | ||
</v-expansion-panel> | ||
</v-expansion-panels> | ||
</template> | ||
|
||
<style scoped> | ||
.v-expansion-panel-text>>> .v-expansion-panel-text__wrap { | ||
padding: 0 !important; | ||
} | ||
.v-expansion-panel-text__wrapper { | ||
padding: 0 !important; | ||
} | ||
</style> |
Oops, something went wrong.