-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add debug mode for preview. import/export templates. More fixes and f…
…ormatting
- Loading branch information
Showing
6 changed files
with
327 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<!-- | ||
Copyright (c) 2023-present Amidaware Inc. | ||
This file is subject to the EE License Agreement. | ||
For details, see: https://license.tacticalrmm.com/ee | ||
--> | ||
|
||
<template> | ||
<q-dialog ref="dialogRef" @hide="onDialogHide"> | ||
<q-card> | ||
<q-bar> | ||
Import Report Template | ||
<q-space /> | ||
<q-btn v-close-popup dense flat icon="close"> | ||
<q-tooltip class="bg-white text-primary">Close</q-tooltip> | ||
</q-btn> | ||
</q-bar> | ||
<q-card-section> | ||
<q-file | ||
v-model="file" | ||
dense | ||
filled | ||
label="Import File" | ||
style="width: 250px" | ||
/> | ||
</q-card-section> | ||
|
||
<q-card-actions> | ||
<q-space /> | ||
<q-btn v-close-popup dense flat label="Cancel" /> | ||
<q-btn | ||
:loading="isLoading" | ||
dense | ||
flat | ||
label="Import" | ||
color="primary" | ||
@click="submit" | ||
/> | ||
</q-card-actions> | ||
</q-card> | ||
</q-dialog> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { ref } from "vue"; | ||
import { until } from "@vueuse/shared"; | ||
import { useDialogPluginComponent } from "quasar"; | ||
import { useSharedReportTemplates } from "../api/reporting"; | ||
import { notifyError } from "@/utils/notify"; | ||
|
||
// emits | ||
defineEmits([...useDialogPluginComponent.emits]); | ||
|
||
const { isLoading, isError, importReport } = useSharedReportTemplates; | ||
|
||
const { dialogRef, onDialogHide, onDialogOK } = useDialogPluginComponent(); | ||
|
||
const file = ref<File | null>(null); | ||
|
||
async function submit() { | ||
if (file.value) { | ||
importReport(await file.value.text()); | ||
|
||
// stops the dialog from closing when there is an error | ||
await until(isLoading).not.toBeTruthy(); | ||
if (isError.value) return; | ||
|
||
onDialogOK(); | ||
} else { | ||
notifyError("File is required"); | ||
} | ||
} | ||
</script> |
Oops, something went wrong.