Add namespace archive

This commit is contained in:
kolaente 2021-01-28 23:57:18 +01:00
parent e525105f02
commit 3bd9673a4a
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
4 changed files with 63 additions and 1 deletions

View File

@ -21,6 +21,11 @@
class="dropdown-item">
Create a new list
</router-link>
<router-link
:to="{ name: 'namespace.settings.archive', params: { id: namespace.id } }"
class="dropdown-item">
Archive this namespace
</router-link>
<router-link
:to="{ name: 'namespace.settings.delete', params: { id: namespace.id } }"
class="dropdown-item">

View File

@ -41,6 +41,7 @@ import FilterSettingDelete from '@/views/filters/settings/delete'
// Namespace Settings
import NamespaceSettingEdit from '@/views/namespaces/settings/edit'
import NamespaceSettingShare from '@/views/namespaces/settings/share'
import NamespaceSettingArchive from '@/views/namespaces/settings/archive'
import NamespaceSettingDelete from '@/views/namespaces/settings/delete'
// Saved Filters
import CreateSavedFilter from '@/views/filters/CreateSavedFilter'
@ -192,6 +193,11 @@ export default new Router({
name: 'namespace.settings.share',
component: NamespaceSettingShare,
},
{
path: '/namespaces/:id/settings/archive',
name: 'namespace.settings.archive',
component: NamespaceSettingArchive,
},
{
path: '/namespaces/:id/settings/delete',
name: 'namespace.settings.delete',

View File

@ -17,7 +17,7 @@
import ListService from '@/services/list'
export default {
name: 'delete',
name: 'list-settings-archive',
data() {
return {
listService: ListService,

View File

@ -0,0 +1,51 @@
<template>
<modal
@close="$router.back()"
@submit="archiveNamespace()"
>
<span slot="header">{{ namespace.isArchived ? 'Un-' : '' }}Archive this namespace</span>
<p slot="text" v-if="namespace.isArchived">
You will be able to create new lists or edit it.
</p>
<p slot="text" v-else>
You won't be able to edit this namespace or create new list until you un-archive it.<br/>
This will also archive all lists in this namespace.
</p>
</modal>
</template>
<script>
import NamespaceService from '@/services/namespace'
export default {
name: 'namespace-settings-archive',
data() {
return {
namespaceService: NamespaceService,
namespace: null,
}
},
created() {
this.namespaceService = new NamespaceService()
this.namespace = this.$store.getters['namespaces/getNamespaceById'](this.$route.params.id)
},
methods: {
archiveNamespace() {
this.namespace.isArchived = !this.namespace.isArchived
this.namespaceService.update(this.namespace)
.then(r => {
this.$store.commit('namespaces/setNamespaceById', r)
this.success({message: 'The namespace was successfully archived.'}, this)
})
.catch(e => {
this.error(e, this)
})
.finally(() => {
this.$router.back()
})
},
},
}
</script>