Add face remove box
parent
3b741fdf0d
commit
218c0f5aeb
|
@ -0,0 +1,91 @@
|
||||||
|
<template>
|
||||||
|
<NcModal
|
||||||
|
size="small"
|
||||||
|
@close="close"
|
||||||
|
:outTransition="true">
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
<div class="head">
|
||||||
|
<span>{{ t('memories', 'Remove person') }}</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<span>{{ t('memories', 'Are you sure you want to remove {name}', { name }) }}</span>
|
||||||
|
|
||||||
|
<div class="buttons">
|
||||||
|
<NcButton @click="save" class="button" type="error">
|
||||||
|
{{ t('memories', 'Delete') }}
|
||||||
|
</NcButton>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</NcModal>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
import { Component, Mixins, Watch } from 'vue-property-decorator';
|
||||||
|
import { NcButton, NcModal, NcTextField } from '@nextcloud/vue';
|
||||||
|
import { showError } from '@nextcloud/dialogs'
|
||||||
|
import GlobalMixin from '../mixins/GlobalMixin';
|
||||||
|
import client from '../services/DavClient';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
components: {
|
||||||
|
NcButton,
|
||||||
|
NcModal,
|
||||||
|
NcTextField,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
export default class FaceDeleteModal extends Mixins(GlobalMixin) {
|
||||||
|
private user: string = "";
|
||||||
|
private name: string = "";
|
||||||
|
|
||||||
|
@Watch('$route')
|
||||||
|
async routeChange(from: any, to: any) {
|
||||||
|
this.refreshParams();
|
||||||
|
}
|
||||||
|
|
||||||
|
mounted() {
|
||||||
|
this.refreshParams();
|
||||||
|
}
|
||||||
|
|
||||||
|
public refreshParams() {
|
||||||
|
this.user = this.$route.params.user || '';
|
||||||
|
this.name = this.$route.params.name || '';
|
||||||
|
}
|
||||||
|
|
||||||
|
public async save() {
|
||||||
|
try {
|
||||||
|
await client.deleteFile(`/recognize/${this.user}/faces/${this.name}`)
|
||||||
|
this.$router.push({ name: 'people' });
|
||||||
|
this.close();
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
showError(this.t('photos', 'Failed to delete {name}.', {
|
||||||
|
name: this.name,
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public close() {
|
||||||
|
this.$emit('close');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.container {
|
||||||
|
margin: 20px;
|
||||||
|
|
||||||
|
.head {
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.buttons {
|
||||||
|
margin-top: 10px;
|
||||||
|
text-align: right;
|
||||||
|
|
||||||
|
button {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -2,9 +2,7 @@
|
||||||
<NcModal
|
<NcModal
|
||||||
size="small"
|
size="small"
|
||||||
@close="close"
|
@close="close"
|
||||||
:outTransition="true"
|
:outTransition="true">
|
||||||
:hasNext="false"
|
|
||||||
:hasPrevious="false">
|
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="head">
|
<div class="head">
|
||||||
|
@ -20,7 +18,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="buttons">
|
<div class="buttons">
|
||||||
<NcButton @click="save" class="button" type="error">
|
<NcButton @click="save" class="button" type="primary">
|
||||||
{{ t('memories', 'Update') }}
|
{{ t('memories', 'Update') }}
|
||||||
</NcButton>
|
</NcButton>
|
||||||
</div>
|
</div>
|
||||||
|
@ -42,7 +40,7 @@ import client from '../services/DavClient';
|
||||||
NcTextField,
|
NcTextField,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
export default class EditDate extends Mixins(GlobalMixin) {
|
export default class FaceEditModal extends Mixins(GlobalMixin) {
|
||||||
private user: string = "";
|
private user: string = "";
|
||||||
private name: string = "";
|
private name: string = "";
|
||||||
private oldName: string = "";
|
private oldName: string = "";
|
||||||
|
|
|
@ -10,15 +10,20 @@
|
||||||
<div class="name">{{ name }}</div>
|
<div class="name">{{ name }}</div>
|
||||||
|
|
||||||
<div class="right-actions">
|
<div class="right-actions">
|
||||||
<NcActions>
|
<NcActions :inline="1">
|
||||||
<NcActionButton :aria-label="t('memories', 'Rename person')" @click="showEditModal=true">
|
<NcActionButton :aria-label="t('memories', 'Rename person')" @click="showEditModal=true">
|
||||||
{{ t('memories', 'Rename person') }}
|
{{ t('memories', 'Rename person') }}
|
||||||
<template #icon> <EditIcon :size="20" /> </template>
|
<template #icon> <EditIcon :size="20" /> </template>
|
||||||
</NcActionButton>
|
</NcActionButton>
|
||||||
|
<NcActionButton :aria-label="t('memories', 'Remove person')" @click="showDeleteModal=true">
|
||||||
|
{{ t('memories', 'Remove person') }}
|
||||||
|
<template #icon> <DeleteIcon :size="20" /> </template>
|
||||||
|
</NcActionButton>
|
||||||
</NcActions>
|
</NcActions>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<FaceEditModal v-if="showEditModal" @close="showEditModal=false" />
|
<FaceEditModal v-if="showEditModal" @close="showEditModal=false" />
|
||||||
|
<FaceDeleteModal v-if="showDeleteModal" @close="showDeleteModal=false" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -28,21 +33,26 @@ import GlobalMixin from '../mixins/GlobalMixin';
|
||||||
|
|
||||||
import { NcActions, NcActionButton } from '@nextcloud/vue';
|
import { NcActions, NcActionButton } from '@nextcloud/vue';
|
||||||
import FaceEditModal from './FaceEditModal.vue';
|
import FaceEditModal from './FaceEditModal.vue';
|
||||||
|
import FaceDeleteModal from './FaceDeleteModal.vue';
|
||||||
import BackIcon from 'vue-material-design-icons/ArrowLeft.vue';
|
import BackIcon from 'vue-material-design-icons/ArrowLeft.vue';
|
||||||
import EditIcon from 'vue-material-design-icons/Pencil.vue';
|
import EditIcon from 'vue-material-design-icons/Pencil.vue';
|
||||||
|
import DeleteIcon from 'vue-material-design-icons/Close.vue';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
components: {
|
components: {
|
||||||
NcActions,
|
NcActions,
|
||||||
NcActionButton,
|
NcActionButton,
|
||||||
FaceEditModal,
|
FaceEditModal,
|
||||||
|
FaceDeleteModal,
|
||||||
BackIcon,
|
BackIcon,
|
||||||
EditIcon,
|
EditIcon,
|
||||||
|
DeleteIcon,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
export default class FaceTopMatter extends Mixins(GlobalMixin) {
|
export default class FaceTopMatter extends Mixins(GlobalMixin) {
|
||||||
private name: string = '';
|
private name: string = '';
|
||||||
private showEditModal: boolean = false;
|
private showEditModal: boolean = false;
|
||||||
|
private showDeleteModal: boolean = false;
|
||||||
|
|
||||||
@Watch('$route')
|
@Watch('$route')
|
||||||
async routeChange(from: any, to: any) {
|
async routeChange(from: any, to: any) {
|
||||||
|
|
Loading…
Reference in New Issue