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

View File

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

View File

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