60 lines
1.5 KiB
Vue
60 lines
1.5 KiB
Vue
<template>
|
|
<create-edit
|
|
:title="$t('list.duplicate.title')"
|
|
primary-icon="paste"
|
|
:primary-label="$t('list.duplicate.label')"
|
|
:primary-disabled="selectedNamespace === undefined"
|
|
@primary="duplicateList(listId, selectedNamespace?.id)"
|
|
:loading="isDuplicatingList"
|
|
>
|
|
<p>{{ $t('list.duplicate.text') }}</p>
|
|
|
|
<Multiselect
|
|
:placeholder="$t('namespace.search')"
|
|
@search="findNamespaces"
|
|
:search-results="namespaces"
|
|
@select="(namespace) => selectNamespace(namespace as INamespace)"
|
|
label="title"
|
|
:search-delay="10"
|
|
/>
|
|
</create-edit>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import {ref, toRefs} from 'vue'
|
|
import {useI18n} from 'vue-i18n'
|
|
|
|
import CreateEdit from '@/components/misc/create-edit.vue'
|
|
import Multiselect from '@/components/input/multiselect.vue'
|
|
|
|
import type {INamespace} from '@/modelTypes/INamespace'
|
|
import type {IList} from '@/modelTypes/IList'
|
|
|
|
import {useTitle} from '@/composables/useTitle'
|
|
import {useNamespaceSearch} from '@/composables/useNamespaceSearch'
|
|
import {useListStore} from '@/stores/lists'
|
|
|
|
const props = defineProps<{
|
|
listId: IList['id']
|
|
}>()
|
|
const {listId} = toRefs(props)
|
|
|
|
const {t} = useI18n({useScope: 'global'})
|
|
useTitle(() => t('list.duplicate.title'))
|
|
|
|
const {
|
|
namespaces,
|
|
findNamespaces,
|
|
} = useNamespaceSearch()
|
|
|
|
const selectedNamespace = ref<INamespace>()
|
|
function selectNamespace(namespace: INamespace) {
|
|
selectedNamespace.value = namespace
|
|
}
|
|
|
|
const {
|
|
duplicateList,
|
|
isDuplicatingList,
|
|
} = useListStore()
|
|
</script>
|