mirror of
https://github.com/Elvanos/fantasia-archive.git
synced 2024-09-28 23:31:36 +12:00
0.1.5a - Merge projects functionality + a few bugfixes
This commit is contained in:
parent
b209785573
commit
2b8dd75d94
16 changed files with 309 additions and 51 deletions
|
@ -5,7 +5,7 @@ import { Component, Vue } from "vue-property-decorator"
|
|||
import { namespace } from "vuex-class"
|
||||
import { I_Blueprint } from "src/interfaces/I_Blueprint"
|
||||
import { I_NewObjectTrigger } from "src/interfaces/I_NewObjectTrigger"
|
||||
import { uid, colors } from "quasar"
|
||||
import { uid, colors, extend } from "quasar"
|
||||
import { I_FieldRelationship } from "src/interfaces/I_FieldRelationship"
|
||||
import { I_KeyPressObject } from "src/interfaces/I_KeypressObject"
|
||||
import PouchDB from "pouchdb"
|
||||
|
@ -265,6 +265,16 @@ export default class BaseClass extends Vue {
|
|||
* @param existingObject An already existing object passed in
|
||||
*/
|
||||
openExistingDocumentRouteWithEdit (existingObject:I_OpenedDocument | I_FieldRelationship) {
|
||||
const currentDoc = this.findRequestedOrActiveDocument()
|
||||
|
||||
if (currentDoc && existingObject._id === currentDoc._id && !currentDoc.editMode) {
|
||||
const dataCopy: I_OpenedDocument = extend(true, {}, currentDoc)
|
||||
dataCopy.editMode = true
|
||||
const dataPass = { doc: dataCopy, treeAction: false }
|
||||
this.SSET_updateOpenedDocument(dataPass)
|
||||
return
|
||||
}
|
||||
|
||||
this.$router.push({
|
||||
path: existingObject.url,
|
||||
query: { editMode: "editMode" }
|
||||
|
|
|
@ -35,6 +35,12 @@
|
|||
@trigger-dialog-close="importProjectDialogClose"
|
||||
/>
|
||||
|
||||
<!-- Merge project dialog -->
|
||||
<mergeProjectCheckDialog
|
||||
:dialog-trigger="mergeProjectDialogTrigger"
|
||||
@trigger-dialog-close="mergeProjectDialogClose"
|
||||
/>
|
||||
|
||||
<!-- New project dialog -->
|
||||
<newProjectCheckDialog
|
||||
:dialog-trigger="newProjectDialogTrigger"
|
||||
|
@ -197,6 +203,21 @@
|
|||
</q-item-section>
|
||||
</q-item>
|
||||
|
||||
<q-item
|
||||
v-close-popup
|
||||
clickable
|
||||
active
|
||||
active-class="bg-gunmetal-light text-cultured"
|
||||
class="noHigh"
|
||||
@click="mergeProjectAssignUID"
|
||||
:disable="!projectExists"
|
||||
>
|
||||
<q-item-section>Merge another project into the current one</q-item-section>
|
||||
<q-item-section avatar>
|
||||
<q-icon name="mdi-folder-plus-outline" />
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
|
||||
<q-separator dark />
|
||||
|
||||
<q-item
|
||||
|
@ -384,6 +405,7 @@ import BaseClass from "src/BaseClass"
|
|||
import projectCloseCheckDialog from "src/components/dialogs/ProjectCloseCheck.vue"
|
||||
import keybindCheatsheetDialog from "src/components/dialogs/KeybindCheatsheet.vue"
|
||||
import importProjectCheckDialog from "src/components/dialogs/ImportProjectCheck.vue"
|
||||
import mergeProjectCheckDialog from "src/components/dialogs/MergeProjectCheck.vue"
|
||||
import newProjectCheckDialog from "src/components/dialogs/NewProjectCheck.vue"
|
||||
import aboutAppDialog from "src/components/dialogs/AboutApp.vue"
|
||||
import changeLogDialog from "src/components/dialogs/ChangeLog.vue"
|
||||
|
@ -405,6 +427,7 @@ import appLogo from "src/assets/appLogo.png"
|
|||
projectCloseCheckDialog,
|
||||
keybindCheatsheetDialog,
|
||||
importProjectCheckDialog,
|
||||
mergeProjectCheckDialog,
|
||||
newProjectCheckDialog,
|
||||
aboutAppDialog,
|
||||
changeLogDialog,
|
||||
|
@ -544,6 +567,19 @@ export default class AppControl extends BaseClass {
|
|||
this.importProjectDialogTrigger = this.generateUID()
|
||||
}
|
||||
|
||||
/****************************************************************/
|
||||
// Merge project dialog
|
||||
/****************************************************************/
|
||||
|
||||
mergeProjectDialogTrigger: string | false = false
|
||||
mergeProjectDialogClose () {
|
||||
this.mergeProjectDialogTrigger = false
|
||||
}
|
||||
|
||||
mergeProjectAssignUID () {
|
||||
this.mergeProjectDialogTrigger = this.generateUID()
|
||||
}
|
||||
|
||||
/****************************************************************/
|
||||
// New project dialog
|
||||
/****************************************************************/
|
||||
|
|
120
src/components/dialogs/MergeProjectCheck.vue
Normal file
120
src/components/dialogs/MergeProjectCheck.vue
Normal file
|
@ -0,0 +1,120 @@
|
|||
<template>
|
||||
<q-dialog
|
||||
v-model="dialogModel"
|
||||
@hide="triggerDialogClose"
|
||||
>
|
||||
<q-card dark class="documentCloseDialog">
|
||||
<q-card-section class="row justify-center">
|
||||
<h6 class="text-center q-my-sm">Merge another project into the current one</h6>
|
||||
</q-card-section>
|
||||
|
||||
<q-card-section class="row justify-center q-mx-xl">
|
||||
<div>
|
||||
Please note that merging another project will cause <span class="text-bold text-secondary">IRREVERSIBLE CHANGES</span> to currently opened project.
|
||||
<br>
|
||||
If you haven't done so already, please export your current project first to prevent <span class="text-bold text-secondary">POSSIBLE COMPLICATIONS</span> concerning your current project data!
|
||||
</div>
|
||||
</q-card-section>
|
||||
|
||||
<q-card-actions align="around" class="q-mx-xl q-mt-lg q-mb-md">
|
||||
<q-btn
|
||||
flat
|
||||
label="Cancel"
|
||||
color="accent"
|
||||
v-close-popup />
|
||||
<q-btn
|
||||
flat
|
||||
label="Export project"
|
||||
color="primary"
|
||||
@click="commenceExport"
|
||||
/>
|
||||
<q-btn
|
||||
flat
|
||||
label="Merge project"
|
||||
color="primary"
|
||||
v-close-popup
|
||||
@click="mergeProject()" />
|
||||
</q-card-actions>
|
||||
</q-card>
|
||||
</q-dialog>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
|
||||
import { Component, Watch } from "vue-property-decorator"
|
||||
|
||||
import DialogBase from "src/components/dialogs/_DialogBase"
|
||||
import { retrieveCurrentProjectName, exportProject, mergeExistingProject } from "src/scripts/projectManagement/projectManagent"
|
||||
import { Loading, QSpinnerGears } from "quasar"
|
||||
|
||||
@Component({
|
||||
components: { }
|
||||
})
|
||||
export default class MergeProjectCheckDialog extends DialogBase {
|
||||
/**
|
||||
* React to dialog opening request
|
||||
*/
|
||||
@Watch("dialogTrigger")
|
||||
async checkForOpenedProject (val: string|false) {
|
||||
if (val) {
|
||||
const projectName = await retrieveCurrentProjectName()
|
||||
|
||||
if (projectName) {
|
||||
this.openDialog()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Open the the dialog if project is present on the window
|
||||
*/
|
||||
openDialog () {
|
||||
if (this.SGET_getDialogsState) {
|
||||
return
|
||||
}
|
||||
this.SSET_setDialogState(true)
|
||||
this.dialogModel = true
|
||||
}
|
||||
|
||||
/**
|
||||
* MErge a new project
|
||||
*/
|
||||
mergeProject () {
|
||||
const setup = {
|
||||
message: "<h4>Merging selected project...</h4>",
|
||||
spinnerColor: "primary",
|
||||
messageColor: "cultured",
|
||||
spinnerSize: 120,
|
||||
backgroundColor: "dark",
|
||||
// @ts-ignore
|
||||
spinner: QSpinnerGears
|
||||
}
|
||||
|
||||
mergeExistingProject(this.$router, Loading, setup, this.$q, this)
|
||||
}
|
||||
|
||||
/**
|
||||
* Export the current project
|
||||
*/
|
||||
async commenceExport () {
|
||||
const projectName = await retrieveCurrentProjectName()
|
||||
const setup = {
|
||||
message: "<h4>Exporting current project...</h4>",
|
||||
spinnerColor: "primary",
|
||||
messageColor: "cultured",
|
||||
spinnerSize: 120,
|
||||
backgroundColor: "dark",
|
||||
// @ts-ignore
|
||||
spinner: QSpinnerGears
|
||||
}
|
||||
exportProject(projectName, Loading, setup, this.$q)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
.documentCloseDialog {
|
||||
min-width: 600px;
|
||||
}
|
||||
</style>
|
|
@ -179,7 +179,7 @@
|
|||
round
|
||||
dense
|
||||
flat
|
||||
class="z-max relationshipChipNewTab"
|
||||
class="z-15 relationshipChipNewTab"
|
||||
style="color: #000 !important;"
|
||||
size="sm"
|
||||
icon="mdi-open-in-new"
|
||||
|
@ -613,7 +613,7 @@ export default class Field_MultiRelationship extends FieldBase {
|
|||
})
|
||||
|
||||
if (needsRefresh) {
|
||||
this.signalInput(true)
|
||||
this.signalInput(true).catch(e => console.log(e))
|
||||
}
|
||||
|
||||
await CurrentObjectDB.close()
|
||||
|
@ -656,9 +656,12 @@ export default class Field_MultiRelationship extends FieldBase {
|
|||
* Signals the input change to the document body parent component
|
||||
*/
|
||||
@Emit()
|
||||
signalInput (skipSave?: boolean) {
|
||||
async signalInput (skipSave?: boolean) {
|
||||
await this.$nextTick()
|
||||
|
||||
this.checkNotes()
|
||||
this.inputNotes = this.inputNotes.filter(single => this.localInput.find(e => single.pairedId === e._id))
|
||||
|
||||
return {
|
||||
value: this.localInput,
|
||||
addedValues: this.inputNotes,
|
||||
|
@ -722,7 +725,6 @@ export default class Field_MultiRelationship extends FieldBase {
|
|||
/****************************************************************/
|
||||
|
||||
copyName (currentDoc: I_OpenedDocument) {
|
||||
console.log(currentDoc)
|
||||
copyDocumentName(currentDoc)
|
||||
}
|
||||
|
||||
|
|
|
@ -176,7 +176,7 @@
|
|||
round
|
||||
dense
|
||||
flat
|
||||
class="z-max relationshipChipNewTab"
|
||||
class="z-15 relationshipChipNewTab"
|
||||
style="color: #000 !important;"
|
||||
size="sm"
|
||||
icon="mdi-open-in-new"
|
||||
|
|
|
@ -3,6 +3,26 @@
|
|||
|
||||
---
|
||||
|
||||
## 0.1.6
|
||||
|
||||
### Known issues
|
||||
|
||||
- When creating a brand new project, Fantasia Archive sometimes doesn't load the default categories in the left hierarchical tree. A temporary workaround before the issue is fixed is restarting the program - the project stays intact, can be normally edited and no data loss occurs.
|
||||
- Some users report that dialog (popups) don't function the very first time you start FA. This is solved by restarting the application. The bug doesn't seem to appear again once FA has been started at least once before.
|
||||
- Overusing Tags currently causes app crashes on some PCs. If you suffer from this issue, reduce the number of tags in your project below 10.
|
||||
|
||||
### Bugfixes & Optimizations
|
||||
|
||||
- Fixed a bug of edit mode "Open in new window" buttons being on higher level than the document control bar and rendering over it
|
||||
- Fixed non-working edit button inthe hierarchical tree on already opened documents
|
||||
|
||||
### New features
|
||||
|
||||
### QoL adjustments
|
||||
|
||||
- Multiple small field name changes to unify meanings across app
|
||||
- Unified ordering of connected groups in all document types
|
||||
|
||||
## 0.1.5
|
||||
|
||||
### Known issues
|
||||
|
|
|
@ -1388,7 +1388,7 @@ export const charactersBlueprint: I_Blueprint = {
|
|||
},
|
||||
{
|
||||
id: "pairedConnectedItems",
|
||||
name: "Connected to Legendary items/artifacts",
|
||||
name: "Connected to Items",
|
||||
type: "manyToManyRelationship",
|
||||
icon: "mdi-sword-cross",
|
||||
sizing: 6,
|
||||
|
|
|
@ -379,7 +379,7 @@ export const guildsBlueprint: I_Blueprint = {
|
|||
id: "pairedEnemyOtherGroups",
|
||||
name: "Enemy Organizations/Other groups",
|
||||
type: "manyToManyRelationship",
|
||||
icon: "mdi-bank-outline",
|
||||
icon: "mdi-account-group",
|
||||
sizing: 4,
|
||||
relationshipSettings: {
|
||||
connectedObjectType: "guilds",
|
||||
|
@ -516,7 +516,7 @@ export const guildsBlueprint: I_Blueprint = {
|
|||
},
|
||||
{
|
||||
id: "pairedConnectedItems",
|
||||
name: "Connected to legendary Items",
|
||||
name: "Connected to Items",
|
||||
type: "manyToManyRelationship",
|
||||
icon: "mdi-sword-cross",
|
||||
sizing: 4,
|
||||
|
|
|
@ -450,7 +450,7 @@ export const locationsBlueprint: I_Blueprint = {
|
|||
},
|
||||
{
|
||||
id: "pairedConnectedItems",
|
||||
name: "Connected to legendary Items",
|
||||
name: "Connected to Items",
|
||||
type: "manyToManyRelationship",
|
||||
icon: "mdi-sword-cross",
|
||||
sizing: 4,
|
||||
|
|
|
@ -397,6 +397,39 @@ export const magicBlueprint: I_Blueprint = {
|
|||
connectedField: "pairedEnemyMagicalGroups"
|
||||
}
|
||||
},
|
||||
{
|
||||
id: "pairedConnectedOtherGroups",
|
||||
name: "Connected Organizations/Other groups",
|
||||
type: "manyToManyRelationship",
|
||||
icon: "mdi-account-group",
|
||||
sizing: 4,
|
||||
relationshipSettings: {
|
||||
connectedObjectType: "guilds",
|
||||
connectedField: "pairedConnectedMagicalGroups"
|
||||
}
|
||||
},
|
||||
{
|
||||
id: "pairedAllyOtherGroups",
|
||||
name: "Allied Organizations/Other groups",
|
||||
type: "manyToManyRelationship",
|
||||
icon: "mdi-account-group",
|
||||
sizing: 4,
|
||||
relationshipSettings: {
|
||||
connectedObjectType: "guilds",
|
||||
connectedField: "pairedAllyMagicalGroups"
|
||||
}
|
||||
},
|
||||
{
|
||||
id: "pairedEnemyOtherGroups",
|
||||
name: "Enemy Organizations/Other groups",
|
||||
type: "manyToManyRelationship",
|
||||
icon: "mdi-account-group",
|
||||
sizing: 4,
|
||||
relationshipSettings: {
|
||||
connectedObjectType: "guilds",
|
||||
connectedField: "pairedEnemyMagicalGroups"
|
||||
}
|
||||
},
|
||||
{
|
||||
id: "pairedConnectedReligiousGroups",
|
||||
name: "Connected Teachings/Religious groups",
|
||||
|
@ -463,39 +496,6 @@ export const magicBlueprint: I_Blueprint = {
|
|||
connectedField: "pairedEnemyMagicalGroups"
|
||||
}
|
||||
},
|
||||
{
|
||||
id: "pairedConnectedOtherGroups",
|
||||
name: "Connected Organizations/Other groups",
|
||||
type: "manyToManyRelationship",
|
||||
icon: "mdi-account-group",
|
||||
sizing: 4,
|
||||
relationshipSettings: {
|
||||
connectedObjectType: "guilds",
|
||||
connectedField: "pairedConnectedMagicalGroups"
|
||||
}
|
||||
},
|
||||
{
|
||||
id: "pairedAllyOtherGroups",
|
||||
name: "Allied Organizations/Other groups",
|
||||
type: "manyToManyRelationship",
|
||||
icon: "mdi-account-group",
|
||||
sizing: 4,
|
||||
relationshipSettings: {
|
||||
connectedObjectType: "guilds",
|
||||
connectedField: "pairedAllyMagicalGroups"
|
||||
}
|
||||
},
|
||||
{
|
||||
id: "pairedEnemyOtherGroups",
|
||||
name: "Enemy Organizations/Other groups",
|
||||
type: "manyToManyRelationship",
|
||||
icon: "mdi-account-group",
|
||||
sizing: 4,
|
||||
relationshipSettings: {
|
||||
connectedObjectType: "guilds",
|
||||
connectedField: "pairedEnemyMagicalGroups"
|
||||
}
|
||||
},
|
||||
{
|
||||
id: "pairedConnectedTechGroups",
|
||||
name: "Connected Sciences/Technological groups",
|
||||
|
@ -559,7 +559,7 @@ export const magicBlueprint: I_Blueprint = {
|
|||
},
|
||||
{
|
||||
id: "pairedConnectedItems",
|
||||
name: "Connected to legendary Items",
|
||||
name: "Connected to Items",
|
||||
type: "manyToManyRelationship",
|
||||
icon: "mdi-sword-cross",
|
||||
sizing: 4,
|
||||
|
|
|
@ -525,7 +525,7 @@ export const politicalGroupsBlueprint: I_Blueprint = {
|
|||
},
|
||||
{
|
||||
id: "pairedConnectedItems",
|
||||
name: "Connected to legendary Items",
|
||||
name: "Connected to Items",
|
||||
type: "manyToManyRelationship",
|
||||
icon: "mdi-sword-cross",
|
||||
sizing: 4,
|
||||
|
|
|
@ -509,7 +509,7 @@ export const racesBlueprint: I_Blueprint = {
|
|||
},
|
||||
{
|
||||
id: "pairedConnectedItems",
|
||||
name: "Connected to legendary Items",
|
||||
name: "Connected to Items",
|
||||
type: "manyToManyRelationship",
|
||||
icon: "mdi-sword-cross",
|
||||
sizing: 4,
|
||||
|
|
|
@ -516,7 +516,7 @@ export const religionsBlueprint: I_Blueprint = {
|
|||
},
|
||||
{
|
||||
id: "pairedConnectedItems",
|
||||
name: "Connected to legendary Items",
|
||||
name: "Connected to Items",
|
||||
type: "manyToManyRelationship",
|
||||
icon: "mdi-sword-cross",
|
||||
sizing: 4,
|
||||
|
|
|
@ -348,7 +348,6 @@ export const techBlueprint: I_Blueprint = {
|
|||
connectedField: "pairedEnemyTechGroup"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
id: "pairedConnectedPolGroups",
|
||||
name: "Connected Ideologies/Political groups",
|
||||
|
@ -382,7 +381,6 @@ export const techBlueprint: I_Blueprint = {
|
|||
connectedField: "pairedEnemyTechGroups"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
id: "pairedConnectedOtherGroups",
|
||||
name: "Connected Organizations/Other groups",
|
||||
|
@ -416,7 +414,6 @@ export const techBlueprint: I_Blueprint = {
|
|||
connectedField: "pairedEnemyTechGroups"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
id: "pairedConnectedReligiousGroups",
|
||||
name: "Connected Teachings/Religious groups",
|
||||
|
@ -546,7 +543,7 @@ export const techBlueprint: I_Blueprint = {
|
|||
},
|
||||
{
|
||||
id: "pairedConnectedItems",
|
||||
name: "Connected to legendary Items",
|
||||
name: "Connected to Items",
|
||||
type: "manyToManyRelationship",
|
||||
icon: "mdi-sword-cross",
|
||||
sizing: 4,
|
||||
|
|
|
@ -202,6 +202,78 @@ export const importExistingProject = (vueRouter: any, Loading: any, loadingSetup
|
|||
/* eslint-enable */
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens a dialog to let user pick whatever project they wish to open and lets them select a directory
|
||||
* @param vueRouter The vue router object
|
||||
*/
|
||||
export const mergeExistingProject = (vueRouter: any, Loading: any, loadingSetup: any, quasar: any, vueInstance: any) => {
|
||||
/*eslint-disable */
|
||||
remote.dialog.showOpenDialog({
|
||||
properties: ["openDirectory"]
|
||||
}).then(async (result) => {
|
||||
const folderPath = result.filePaths[0]
|
||||
|
||||
if (!folderPath) {
|
||||
return
|
||||
}
|
||||
|
||||
Loading.show(loadingSetup)
|
||||
|
||||
// @ts-ignore
|
||||
PouchDB.plugin({
|
||||
loadIt: load.load
|
||||
})
|
||||
|
||||
let allFiles = fs.readdirSync(folderPath)
|
||||
allFiles = allFiles.filter(file => file !== 'project-data.txt')
|
||||
|
||||
for (const file of allFiles) {
|
||||
const currentDBName = path.parse(file).name
|
||||
const CurrentDB = new PouchDB(currentDBName)
|
||||
|
||||
const fileContents = fs.readFileSync(`${folderPath}/${file}`, { encoding: "utf8" })
|
||||
// @ts-ignore
|
||||
await CurrentDB.loadIt(fileContents)
|
||||
await CurrentDB.close()
|
||||
|
||||
}
|
||||
|
||||
/*eslint-disable */
|
||||
// @ts-ignore
|
||||
vueRouter.push({ path: "/" }).catch((e: {name: string}) => {
|
||||
const errorName : string = e.name
|
||||
if (errorName === "NavigationDuplicated") {
|
||||
return
|
||||
}
|
||||
console.log(e)
|
||||
})
|
||||
/* eslint-enable */
|
||||
|
||||
await new Promise(resolve => setTimeout(resolve, 1000))
|
||||
|
||||
/*eslint-disable */
|
||||
// @ts-ignore
|
||||
vueRouter.push({ path: "/project" }).catch((e: {name: string}) => {
|
||||
const errorName : string = e.name
|
||||
if (errorName === "NavigationDuplicated") {
|
||||
return
|
||||
}
|
||||
console.log(e)
|
||||
})
|
||||
|
||||
quasar.notify({
|
||||
type: 'positive',
|
||||
message: `Project succesfully imported`
|
||||
})
|
||||
|
||||
vueInstance.SSET_resetDocuments()
|
||||
/* eslint-enable */
|
||||
}).catch(err => {
|
||||
console.log(err)
|
||||
})
|
||||
/* eslint-enable */
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves current project name
|
||||
*/
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
- Add "Open all search matches" button in the Quick-search that opens a new page with a list of items
|
||||
- Allow showing of document types under tags
|
||||
- Add description tabs
|
||||
- Add category for materials/resources OR adapt Items category
|
||||
- Add category for diseases/curses/etc
|
||||
- Add button to pull the left tree in and out
|
||||
- Add support for individual document order hiding inside the hierarchical tree for each document
|
||||
|
|
Loading…
Reference in a new issue