mirror of
https://github.com/Elvanos/fantasia-archive.git
synced 2024-09-30 00:56:59 +13:00
0.1.7-RC-5: more options & optimizations for the exports
This commit is contained in:
parent
caac8cbf80
commit
9f7fddcdb8
6 changed files with 139 additions and 34 deletions
|
@ -42,6 +42,7 @@
|
||||||
<exportProjectDialog
|
<exportProjectDialog
|
||||||
:dialog-trigger="exportProjectDialogTrigger"
|
:dialog-trigger="exportProjectDialogTrigger"
|
||||||
:prepicked-ids="[prepickedID]"
|
:prepicked-ids="[prepickedID]"
|
||||||
|
:prepicked-no-folder-mode="true"
|
||||||
@trigger-dialog-close="exportProjectDialogClose"
|
@trigger-dialog-close="exportProjectDialogClose"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
<exportProjectDialog
|
<exportProjectDialog
|
||||||
:dialog-trigger="exportProjectDialogTrigger"
|
:dialog-trigger="exportProjectDialogTrigger"
|
||||||
:prepicked-ids="[prepickedID]"
|
:prepicked-ids="[prepickedID]"
|
||||||
|
:prepicked-no-folder-mode="true"
|
||||||
@trigger-dialog-close="exportProjectDialogClose"
|
@trigger-dialog-close="exportProjectDialogClose"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|
|
@ -61,6 +61,73 @@
|
||||||
|
|
||||||
<q-list class="exportSettings">
|
<q-list class="exportSettings">
|
||||||
|
|
||||||
|
<q-item>
|
||||||
|
<q-item-section side>
|
||||||
|
<q-icon name="mdi-help-circle" size="18px">
|
||||||
|
<q-tooltip :delay="500">
|
||||||
|
Determines if the export should output a corresponding
|
||||||
|
<br>
|
||||||
|
folder structure to how FA structures the document types.
|
||||||
|
<br>
|
||||||
|
If this is ticked on, only the file/s will be exported
|
||||||
|
<br>
|
||||||
|
with no folders included.
|
||||||
|
</q-tooltip>
|
||||||
|
</q-icon>
|
||||||
|
</q-item-section>
|
||||||
|
<q-item-section>
|
||||||
|
<q-checkbox
|
||||||
|
dark
|
||||||
|
:class="{'highlight': noFolderMode}"
|
||||||
|
color="primary"
|
||||||
|
v-model="noFolderMode"
|
||||||
|
label="No-folder export?"
|
||||||
|
/>
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
|
||||||
|
<q-item>
|
||||||
|
<q-item-section side>
|
||||||
|
<q-icon name="mdi-help-circle" size="18px">
|
||||||
|
<q-tooltip :delay="500">
|
||||||
|
Automatically exports all documents in your project.
|
||||||
|
</q-tooltip>
|
||||||
|
</q-icon>
|
||||||
|
</q-item-section>
|
||||||
|
<q-item-section>
|
||||||
|
<q-checkbox
|
||||||
|
:class="{'warning': noFolderMode && exportWholeProject}"
|
||||||
|
dark color="primary"
|
||||||
|
v-model="exportWholeProject"
|
||||||
|
label="Export whole project?"
|
||||||
|
/>
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
|
||||||
|
<q-item v-if="exportWholeProject">
|
||||||
|
<q-item-section side>
|
||||||
|
<q-icon name="mdi-help-circle" size="18px">
|
||||||
|
<q-tooltip :delay="500">
|
||||||
|
Some projects can have overlapping names for multiple documents.
|
||||||
|
<br>
|
||||||
|
Normally, this would results in the contents of the documents overwriting each other.
|
||||||
|
<br>
|
||||||
|
If this is turned on, documents will also receive their unique IDs
|
||||||
|
<br>
|
||||||
|
attached to their file names - preventing any overwriting.
|
||||||
|
</q-tooltip>
|
||||||
|
</q-icon>
|
||||||
|
</q-item-section>
|
||||||
|
<q-item-section>
|
||||||
|
<q-checkbox
|
||||||
|
:class="{'warning': !useSafetyMode}"
|
||||||
|
dark color="primary"
|
||||||
|
v-model="useSafetyMode"
|
||||||
|
label="Use safety export mode?"
|
||||||
|
/>
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
|
||||||
<q-item v-if="selectedExportFormat === 'Adobe Reader - PDF'">
|
<q-item v-if="selectedExportFormat === 'Adobe Reader - PDF'">
|
||||||
<q-item-section side>
|
<q-item-section side>
|
||||||
<q-icon name="mdi-help-circle" size="18px">
|
<q-icon name="mdi-help-circle" size="18px">
|
||||||
|
@ -80,23 +147,6 @@
|
||||||
</q-item-section>
|
</q-item-section>
|
||||||
</q-item>
|
</q-item>
|
||||||
|
|
||||||
<q-item>
|
|
||||||
<q-item-section side>
|
|
||||||
<q-icon name="mdi-help-circle" size="18px">
|
|
||||||
<q-tooltip :delay="500">
|
|
||||||
Automatically exports all documents in your project.
|
|
||||||
</q-tooltip>
|
|
||||||
</q-icon>
|
|
||||||
</q-item-section>
|
|
||||||
<q-item-section>
|
|
||||||
<q-checkbox
|
|
||||||
dark color="primary"
|
|
||||||
v-model="exportWholeProject"
|
|
||||||
label="Export whole project?"
|
|
||||||
/>
|
|
||||||
</q-item-section>
|
|
||||||
</q-item>
|
|
||||||
|
|
||||||
<q-item>
|
<q-item>
|
||||||
<q-item-section side>
|
<q-item-section side>
|
||||||
<q-icon name="mdi-help-circle" size="18px">
|
<q-icon name="mdi-help-circle" size="18px">
|
||||||
|
@ -217,15 +267,28 @@
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
style="height: 100%; line-height: 2;"
|
style="height: 100%; line-height: 2;"
|
||||||
class="column justify-center items-center"
|
class="column justify-center items-center text-center"
|
||||||
v-if="exportWholeProject"
|
v-if="exportWholeProject"
|
||||||
>
|
>
|
||||||
Please note that:
|
|
||||||
<span class="text-bold text-secondary">
|
<span class="text-bold text-secondary" v-if="noFolderMode && exportWholeProject">
|
||||||
The more documents, the slower export.
|
<br>
|
||||||
|
ALL of your documents will dumped RIGHT where you export. NO folder will be generated!
|
||||||
|
<br>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<span class="text-bold text-secondary" v-if="!useSafetyMode && exportWholeProject">
|
||||||
|
<br>
|
||||||
|
Please condider turning the safety export mode ON before exporting to avoid data loss!
|
||||||
|
<br>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<span>
|
||||||
|
<br>
|
||||||
|
FA currently needs to generate individual files for <span class="text-bold text-primary">{{SGET_allDocuments.docs.length}} </span> documents.
|
||||||
</span>
|
</span>
|
||||||
<span>
|
<span>
|
||||||
FA currently needs to generate individual files for <span class="text-bold text-primary">{{SGET_allDocuments.docs.length}} </span> documents.
|
Estimated export time: <span class="text-bold text-primary">{{(SGET_allDocuments.docs.length / 25 + 2).toFixed(1)}} - {{(SGET_allDocuments.docs.length / 15 + 2).toFixed(1)}} </span> seconds.
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<q-select
|
<q-select
|
||||||
|
@ -339,15 +402,15 @@
|
||||||
</q-card-section>
|
</q-card-section>
|
||||||
|
|
||||||
<q-card-actions align="right" class="q-mb-lg q-mr-xl">
|
<q-card-actions align="right" class="q-mb-lg q-mr-xl">
|
||||||
<q-btn flat label="Cancel" color="accent" v-close-popup class="q-mr-lg" />
|
<q-btn flat label="Cancel" color="accent" v-close-popup class="q-mr-lg" />
|
||||||
<q-btn
|
<q-btn
|
||||||
:flat="!exportWholeProject && exportDocumentsModel.length === 0"
|
:flat="!exportWholeProject && exportDocumentsModel.length === 0"
|
||||||
:outline="exportWholeProject || exportDocumentsModel.length > 0"
|
:outline="exportWholeProject || exportDocumentsModel.length > 0"
|
||||||
label="Export"
|
label="Export"
|
||||||
color="primary"
|
color="primary"
|
||||||
:disable="!exportWholeProject && exportDocumentsModel.length === 0"
|
:disable="!exportWholeProject && exportDocumentsModel.length === 0"
|
||||||
@click="exportDocuments"
|
@click="exportDocuments"
|
||||||
/>
|
/>
|
||||||
</q-card-actions>
|
</q-card-actions>
|
||||||
</q-card>
|
</q-card>
|
||||||
|
|
||||||
|
@ -434,6 +497,8 @@ export default class ExportProject extends DialogBase {
|
||||||
return this.prepickedIds.includes(doc._id)
|
return this.prepickedIds.includes(doc._id)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.noFolderMode = this.prepickedNoFolderMode
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -449,6 +514,7 @@ export default class ExportProject extends DialogBase {
|
||||||
this.useFallbackFont = false
|
this.useFallbackFont = false
|
||||||
this.exportDocumentsModel = []
|
this.exportDocumentsModel = []
|
||||||
this.exportOngoing = false
|
this.exportOngoing = false
|
||||||
|
this.useSafetyMode = true
|
||||||
this.exportList = []
|
this.exportList = []
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -458,6 +524,8 @@ export default class ExportProject extends DialogBase {
|
||||||
}
|
}
|
||||||
})) readonly prepickedIds!: string[]
|
})) readonly prepickedIds!: string[]
|
||||||
|
|
||||||
|
@Prop(({ default: false })) readonly prepickedNoFolderMode!: boolean
|
||||||
|
|
||||||
exportFormats = [
|
exportFormats = [
|
||||||
"Adobe Reader - PDF",
|
"Adobe Reader - PDF",
|
||||||
"Markdown - MD"
|
"Markdown - MD"
|
||||||
|
@ -483,6 +551,10 @@ export default class ExportProject extends DialogBase {
|
||||||
|
|
||||||
useFallbackFont = false
|
useFallbackFont = false
|
||||||
|
|
||||||
|
useSafetyMode = true
|
||||||
|
|
||||||
|
noFolderMode = false
|
||||||
|
|
||||||
setDocumentPreviewClose () {
|
setDocumentPreviewClose () {
|
||||||
this.documentPreviewClose = uid()
|
this.documentPreviewClose = uid()
|
||||||
}
|
}
|
||||||
|
@ -622,7 +694,7 @@ export default class ExportProject extends DialogBase {
|
||||||
|
|
||||||
const projectName: string = await retrieveCurrentProjectName()
|
const projectName: string = await retrieveCurrentProjectName()
|
||||||
|
|
||||||
const exportPath = `${folderPath}/${projectName} - Export`
|
const exportPath = this.noFolderMode ? folderPath : `${folderPath}/${projectName} - Export`
|
||||||
|
|
||||||
if (!fs.existsSync(exportPath)) {
|
if (!fs.existsSync(exportPath)) {
|
||||||
fs.mkdirSync(exportPath)
|
fs.mkdirSync(exportPath)
|
||||||
|
@ -711,6 +783,7 @@ export default class ExportProject extends DialogBase {
|
||||||
|
|
||||||
const exportObject = {
|
const exportObject = {
|
||||||
name: input.extraFields.find(e => e.id === "name")?.value,
|
name: input.extraFields.find(e => e.id === "name")?.value,
|
||||||
|
id: input._id,
|
||||||
documentType: matchingBlueprint.nameSingular,
|
documentType: matchingBlueprint.nameSingular,
|
||||||
documentDirectory: matchingBlueprint.namePlural,
|
documentDirectory: matchingBlueprint.namePlural,
|
||||||
isCategory: input.extraFields.find(e => e.id === "categorySwitch")?.value,
|
isCategory: input.extraFields.find(e => e.id === "categorySwitch")?.value,
|
||||||
|
@ -945,7 +1018,7 @@ export default class ExportProject extends DialogBase {
|
||||||
exportFileDirectory = exportFileDirectory.replace(char, "-")
|
exportFileDirectory = exportFileDirectory.replace(char, "-")
|
||||||
exportFileDirectory = exportFileDirectory.replace(char, "-")
|
exportFileDirectory = exportFileDirectory.replace(char, "-")
|
||||||
})
|
})
|
||||||
const documentDirectory = `${exportPath}/${exportFileDirectory}`
|
const documentDirectory = (this.noFolderMode) ? exportPath : `${exportPath}/${exportFileDirectory}`
|
||||||
|
|
||||||
// Create directory
|
// Create directory
|
||||||
if (!fs.existsSync(documentDirectory)) {
|
if (!fs.existsSync(documentDirectory)) {
|
||||||
|
@ -953,7 +1026,9 @@ export default class ExportProject extends DialogBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fix invalid characters in document file name
|
// Fix invalid characters in document file name
|
||||||
let exportFileName = input.name
|
let exportFileName = (this.useSafetyMode && this.exportWholeProject)
|
||||||
|
? `${input.name} (${input.id})`
|
||||||
|
: input.name
|
||||||
reservedCharacterList.forEach(char => {
|
reservedCharacterList.forEach(char => {
|
||||||
exportFileName = exportFileName.replace(char, "-")
|
exportFileName = exportFileName.replace(char, "-")
|
||||||
exportFileName = exportFileName.replace(char, "-")
|
exportFileName = exportFileName.replace(char, "-")
|
||||||
|
|
|
@ -373,6 +373,32 @@ a {
|
||||||
border-color: #d4d0c9 !important;
|
border-color: #d4d0c9 !important;
|
||||||
background: transparent !important;
|
background: transparent !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.q-checkbox__svg,
|
||||||
|
.q-checkbox__svg path,
|
||||||
|
.q-checkbox__bg {
|
||||||
|
transition: 0.3s all ease-in;
|
||||||
|
}
|
||||||
|
|
||||||
|
.q-checkbox.highlight {
|
||||||
|
.q-checkbox__svg,
|
||||||
|
.q-checkbox__svg path,
|
||||||
|
.q-checkbox__bg,
|
||||||
|
.q-checkbox__inner::before {
|
||||||
|
border-color: $primary !important;
|
||||||
|
color: $primary !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.q-checkbox.warning {
|
||||||
|
.q-checkbox__svg,
|
||||||
|
.q-checkbox__svg path,
|
||||||
|
.q-checkbox__bg,
|
||||||
|
.q-checkbox__inner::before {
|
||||||
|
border-color: $secondary !important;
|
||||||
|
color: $secondary !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.tagSelect,
|
.tagSelect,
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
export interface I_ExportObject{
|
export interface I_ExportObject{
|
||||||
|
id: string
|
||||||
name: string
|
name: string
|
||||||
documentType: string
|
documentType: string
|
||||||
documentDirectory: string
|
documentDirectory: string
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
<exportProjectDialog
|
<exportProjectDialog
|
||||||
:dialog-trigger="exportProjectDialogTrigger"
|
:dialog-trigger="exportProjectDialogTrigger"
|
||||||
:prepicked-ids="[currentData._id]"
|
:prepicked-ids="[currentData._id]"
|
||||||
|
:prepicked-no-folder-mode="true"
|
||||||
@trigger-dialog-close="exportProjectDialogClose"
|
@trigger-dialog-close="exportProjectDialogClose"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue