refactor: edit metadata to app

pull/465/head
Varun Patil 2023-03-09 19:31:25 -08:00
parent f136d511da
commit 53ebf7d18f
3 changed files with 10 additions and 21 deletions

View File

@ -46,6 +46,7 @@
<Settings :open.sync="settingsOpen" />
<Sidebar />
<EditMetadata />
</NcContent>
</template>
@ -67,6 +68,7 @@ import Settings from "./components/Settings.vue";
import FirstStart from "./components/FirstStart.vue";
import Metadata from "./components/Metadata.vue";
import Sidebar from "./components/Sidebar.vue";
import EditMetadata from "./components/modal/EditMetadataModal.vue";
import ImageMultiple from "vue-material-design-icons/ImageMultiple.vue";
import FolderIcon from "vue-material-design-icons/Folder.vue";
@ -93,6 +95,7 @@ export default defineComponent({
Settings,
FirstStart,
Sidebar,
EditMetadata,
ImageMultiple,
FolderIcon,

View File

@ -36,7 +36,6 @@
</div>
<!-- Selection Modals -->
<EditMetadata ref="editMetadata" @refresh="refresh" />
<FaceMoveModal
ref="faceMoveModal"
@moved="deletePhotos"
@ -70,7 +69,6 @@ import { getCurrentUser } from "@nextcloud/auth";
import * as dav from "../services/DavRequests";
import * as utils from "../services/Utils";
import EditMetadata from "./modal/EditMetadataModal.vue";
import FaceMoveModal from "./modal/FaceMoveModal.vue";
import AddToAlbumModal from "./modal/AddToAlbumModal.vue";
import MoveToFolderModal from "./modal/MoveToFolderModal.vue";
@ -95,7 +93,6 @@ export default defineComponent({
components: {
NcActions,
NcActionButton,
EditMetadata,
FaceMoveModal,
AddToAlbumModal,
MoveToFolderModal,
@ -205,15 +202,6 @@ export default defineComponent({
if: () => this.$route.name === "recognize",
},
];
// Ugly: globally exposed functions
globalThis.editMetadata = (photos: IPhoto[], sections?: number[]) => {
const sel = new Map<number, IPhoto>();
for (const photo of photos) {
sel.set(photo.fileid, photo);
}
this.editMetadataSelection(sel, sections);
};
},
watch: {
@ -748,10 +736,7 @@ export default defineComponent({
* Open the edit date dialog
*/
async editMetadataSelection(selection: Selection, sections?: number[]) {
(<any>this.$refs.editMetadata).open(
Array.from(selection.values()),
sections
);
globalThis.editMetadata(Array.from(selection.values()), sections);
},
/**

View File

@ -100,11 +100,11 @@ export default defineComponent({
state: 0,
}),
methods: {
emitRefresh(val: boolean) {
this.$emit("refresh", val);
mounted() {
globalThis.editMetadata = this.open;
},
methods: {
async open(photos: IPhoto[], sections: number[] = [1, 2, 3, 4]) {
const state = (this.state = Math.random());
this.show = true;
@ -234,7 +234,8 @@ export default defineComponent({
this.processing = false;
this.close();
this.emitRefresh(true);
// Trigger a soft refresh
emit("files:file:created", { fileid: 0 });
},
filterValid(photos: IPhoto[]) {