From 38e16bf9cc52a7e20194699ae719a64b01910853 Mon Sep 17 00:00:00 2001 From: Elvanos Date: Sun, 13 Jun 2021 01:24:28 +0200 Subject: [PATCH] 0.1.8 - added simple project settings (renaming) --- src/BaseClass.ts | 2 +- src/components/appHeader/AppControl.vue | 56 +++++++++-- src/components/dialogs/ProjectSettings.vue | 97 +++++++++++++++++++ src/pages/ProjectScreen.vue | 17 +++- .../projectManagement/projectManagent.ts | 28 +++++- 5 files changed, 185 insertions(+), 15 deletions(-) create mode 100644 src/components/dialogs/ProjectSettings.vue diff --git a/src/BaseClass.ts b/src/BaseClass.ts index f6c3df0..3f103ed 100644 --- a/src/BaseClass.ts +++ b/src/BaseClass.ts @@ -74,7 +74,7 @@ export default class BaseClass extends Vue { @FloatingWindows.Getter("getAdvSearchWindowVisible") SGET_getAdvSearchWindowVisible!: string @FloatingWindows.Mutation("setAdvSearchWindowVisible") SSET_setAdvSearchWindowVisible!: () => void - @FloatingWindows.Getter("getNoteCorkboardhWindowVisible") SGET_getNoteCorkboardhWindowVisible!: string + @FloatingWindows.Getter("getNoteCorkboardWindowVisible") SGET_getNoteCorkboardWindowVisible!: string @FloatingWindows.Mutation("setNoteCorkboardWindowVisible") SSET_setNoteCorkboardWindowVisible!: () => void @FloatingWindows.Getter("getDocumentPreviewVisible") SGET_getDocumentPreviewVisible!: string diff --git a/src/components/appHeader/AppControl.vue b/src/components/appHeader/AppControl.vue index 79b74be..3348e6a 100644 --- a/src/components/appHeader/AppControl.vue +++ b/src/components/appHeader/AppControl.vue @@ -98,8 +98,14 @@ + + + - + + + + Project settings + + + + Advanced project tools @@ -342,7 +363,7 @@ Mass delete documents @@ -553,6 +574,7 @@ import tipsTricksTriviaDialog from "src/components/dialogs/TipsTricksTrivia.vue" import licenseDialog from "src/components/dialogs/License.vue" import exportProjectDialog from "src/components/dialogs/ExportProject.vue" import massDeleteDocumentsCheckDialog from "src/components/dialogs/MassDeleteDocumentsCheck.vue" +import projectSettingsdDialog from "src/components/dialogs/ProjectSettings.vue" import { Loading, QSpinnerGears } from "quasar" import { saveProject } from "src/scripts/projectManagement/projectManagent" @@ -577,7 +599,8 @@ import appLogo from "src/assets/appLogo.png" licenseDialog, repairProjectDialog, exportProjectDialog, - massDeleteDocumentsCheckDialog + massDeleteDocumentsCheckDialog, + projectSettingsdDialog } }) export default class AppControl extends BaseClass { @@ -893,13 +916,26 @@ export default class AppControl extends BaseClass { // Mass delete documents dialog /****************************************************************/ - massDocumentDelteDialogTrigger: string | false = false - massDocumentDelteDialogClose () { - this.massDocumentDelteDialogTrigger = false + massDocumentDeleteDialogTrigger: string | false = false + massDocumentDeleteDialogClose () { + this.massDocumentDeleteDialogTrigger = false } - massDocumentDelteDialogAssignUID () { - this.massDocumentDelteDialogTrigger = this.generateUID() + massDocumentDeleteDialogAssignUID () { + this.massDocumentDeleteDialogTrigger = this.generateUID() + } + + /****************************************************************/ + // Project settings dialog + /****************************************************************/ + + projectSettingsDialogTrigger: string | false = false + projectSettingsDialogClose () { + this.projectSettingsDialogTrigger = false + } + + projectSettingsDialogAssignUID () { + this.projectSettingsDialogTrigger = this.generateUID() } } diff --git a/src/components/dialogs/ProjectSettings.vue b/src/components/dialogs/ProjectSettings.vue new file mode 100644 index 0000000..249c46a --- /dev/null +++ b/src/components/dialogs/ProjectSettings.vue @@ -0,0 +1,97 @@ + + + + + diff --git a/src/pages/ProjectScreen.vue b/src/pages/ProjectScreen.vue index 2d77ef5..6115222 100644 --- a/src/pages/ProjectScreen.vue +++ b/src/pages/ProjectScreen.vue @@ -51,10 +51,14 @@
-
+
-
+
@@ -785,6 +789,11 @@ body.body--dark { overflow-y: hidden; max-width: calc(100% - 110px); width: 990px; + + &.-fullsize { + width: 100%; + max-width: 100%; + } } .documentGraphWrapper { @@ -792,6 +801,10 @@ body.body--dark { max-height: 525px; overflow: hidden; width: 990px; + + &.-fullsize { + width: 100%; + } } .lastOpenedList { diff --git a/src/scripts/projectManagement/projectManagent.ts b/src/scripts/projectManagement/projectManagent.ts index 977a15c..68f0e7c 100644 --- a/src/scripts/projectManagement/projectManagent.ts +++ b/src/scripts/projectManagement/projectManagent.ts @@ -22,7 +22,10 @@ export const createNewProject = async (projectName: string, vueRouter: any, quas } window.FA_dbs["project-data"] = new PouchDB("project-data") - const newProject = { _id: projectName } + const newProject = { + _id: "projectSetup", + projectName: projectName + } // eslint-disable-next-line @typescript-eslint/no-unsafe-call window.FA_dbs["project-data"].put(newProject) @@ -314,7 +317,28 @@ export const retrieveCurrentProjectName = async () => { const projectData = await window.FA_dbs["project-data"].allDocs({ include_docs: true }) // eslint-disable-next-line @typescript-eslint/no-unsafe-return - return (projectData?.rows[0]?.id) || "" + + const projectName: string = (projectData?.rows[0]?.doc?.projectName) || projectData?.rows[0]?.doc?._id + + return (projectName) || "" +} + +/** + * Change current project name + */ +export const changeCurrentProjectSettings = async (input: {projectName: string}) => { + if (!window.FA_dbs) { + // @ts-ignore + window.FA_dbs = {} + } + window.FA_dbs["project-data"] = new PouchDB("project-data") + // eslint-disable-next-line @typescript-eslint/no-unsafe-call + const projectData = await window.FA_dbs["project-data"].allDocs({ include_docs: true }) + + projectData.rows[0].doc.projectName = input.projectName + + // eslint-disable-next-line @typescript-eslint/no-unsafe-call + await window.FA_dbs["project-data"].put(projectData.rows[0].doc) } /**