Compare commits

...

9 Commits

Author SHA1 Message Date
wh1te909
298d039028 remove ace 2023-10-29 19:33:04 +00:00
sadnub
021a066074 watch for language changes and update the snippet editor 2023-10-29 15:16:54 -04:00
sadnub
7dc2f5a658 watch for language changes and update the editor 2023-10-29 15:05:51 -04:00
sadnub
57bd8bafac exported templates now are readable with spaces 2023-10-29 10:55:07 -04:00
sadnub
7d5216aba9 prevent linux shebang banner opening and closing on script load 2023-10-29 10:31:51 -04:00
sadnub
076ab0c465 fix script body not loading in editor. Fix slow unload times for monaco editor 2023-10-29 10:24:16 -04:00
wh1te909
be37e89e16 update reqs 2023-10-29 09:08:02 +00:00
wh1te909
0bdc841084 change wording 2023-10-29 08:57:53 +00:00
wh1te909
96086d0b5d fix wording 2023-10-28 22:06:52 +00:00
7 changed files with 340 additions and 5293 deletions

5556
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{
"name": "web",
"version": "0.101.32",
"version": "0.101.33",
"private": true,
"productName": "Tactical RMM",
"scripts": {
@@ -11,13 +11,12 @@
},
"dependencies": {
"@quasar/extras": "1.16.7",
"apexcharts": "3.41.1",
"axios": "1.5.1",
"apexcharts": "3.44.0",
"axios": "1.6.0",
"dotenv": "16.3.1",
"qrcode.vue": "3.4.1",
"quasar": "2.13.0",
"vue": "3.3.7",
"vue3-ace-editor": "2.2.3",
"vue3-apexcharts": "1.4.4",
"vuedraggable": "4.1.0",
"vue-router": "4.2.5",
@@ -31,7 +30,7 @@
"@quasar/cli": "2.3.0",
"@intlify/unplugin-vue-i18n": "1.4.0",
"@quasar/app-vite": "1.6.2",
"@types/node": "20.8.8",
"@types/node": "20.8.9",
"@typescript-eslint/eslint-plugin": "6.9.0",
"@typescript-eslint/parser": "6.9.0",
"autoprefixer": "10.4.16",

View File

@@ -150,7 +150,7 @@
</q-menu>
</q-btn>
<!-- integrations -->
<q-btn size="md" dense no-caps flat label="Integrations">
<q-btn size="md" dense no-caps flat label="Reporting">
<q-menu auto-close>
<q-list
v-if="

View File

@@ -4,9 +4,9 @@
persistent
@keydown.esc.stop="onDialogHide"
:maximized="maximized"
@keydown.esc="unloadEditor"
@hide="unloadEditor"
@hide="onDialogHide"
@show="loadEditor"
@before-hide="unloadEditor"
>
<q-card
class="q-dialog-plugin"
@@ -52,7 +52,7 @@
</q-btn>
</q-bar>
<q-banner
v-if="missingShebang"
v-if="script.script_body && missingShebang"
dense
inline-actions
class="text-black bg-warning"
@@ -170,8 +170,7 @@
>Setting this value on the script model will always override any
'Run As User' checkboxes in the UI and force this script to
always be run in the context of the logged in user. If no user
is logged in, the script will not run and an error will be
returned.
is logged in, the script will run as SYSTEM.
</q-tooltip>
</q-checkbox>
<q-input
@@ -235,7 +234,7 @@
<script setup lang="ts">
// composable imports
import { ref, reactive, computed, onMounted } from "vue";
import { ref, reactive, watch, computed, onMounted } from "vue";
import { useStore } from "vuex";
import { useQuasar, useDialogPluginComponent } from "quasar";
import { saveScript, editScript, downloadScript } from "@/api/scripts";
@@ -266,7 +265,7 @@ const props = withDefaults(
{
clone: false,
readonly: false,
}
},
);
// emits
@@ -330,12 +329,6 @@ const lang = computed(() => {
else return "";
});
// get code if editing or cloning script
if (props.script)
downloadScript(script.id, { with_snippets: props.readonly }).then((r) => {
script.script_body = r.code;
});
async function submit() {
loading.value = true;
let result = "";
@@ -376,7 +369,7 @@ function loadEditor() {
var model = monaco.editor.createModel(
script.script_body,
lang.value,
modelUri
modelUri,
);
const theme = $q.dark.isActive ? "vs-dark" : "vs-light";
@@ -392,6 +385,18 @@ function loadEditor() {
editor.onDidChangeModelContent(() => {
script.script_body = editor.getValue();
});
// get code if editing or cloning script
if (props.script)
downloadScript(script.id, { with_snippets: props.readonly }).then((r) => {
script.script_body = r.code;
editor.setValue(r.code);
});
// watch for changes in language
watch(lang, () => {
monaco.editor.setModelLanguage(model, lang.value);
});
}
function unloadEditor() {

View File

@@ -2,10 +2,11 @@
<q-dialog
ref="dialogRef"
persistent
@keydown.esc="unloadEditor"
@keydown.esc.stop="onDialogHide"
:maximized="maximized"
@hide="unloadEditor"
@hide="onDialogHide"
@show="loadEditor"
@before-hide="unloadEditor"
>
<q-card
class="q-dialog-plugin"
@@ -101,7 +102,7 @@
<script setup lang="ts">
// composable imports
import { ref, reactive, computed } from "vue";
import { ref, watch, reactive, computed } from "vue";
import { useStore } from "vuex";
import { useQuasar } from "quasar";
import { generateScript } from "@/api/core";
@@ -177,7 +178,7 @@ const snippetEditor = ref<HTMLElement | null>(null);
let editor: monaco.editor.IStandaloneCodeEditor;
function loadEditor() {
var modelUri = monaco.Uri.parse("model://new"); // a made up unique URI for our model
var modelUri = monaco.Uri.parse("model://snippet"); // a made up unique URI for our model
var model = monaco.editor.createModel(snippet.code, lang.value, modelUri);
const theme = $q.dark.isActive ? "vs-dark" : "vs-light";
@@ -192,6 +193,11 @@ function loadEditor() {
editor.onDidChangeModelContent(() => {
snippet.code = editor.getValue();
});
// watch for changes in language
watch(lang, () => {
monaco.editor.setModelLanguage(model, lang.value);
});
}
function unloadEditor() {

View File

@@ -302,7 +302,10 @@ export function useReportTemplates(): useReportingTemplates {
axios
.post(`${baseUrl}/templates/${id}/export/`)
.then(({ data }) => {
exportFile(`${data.template.name}-export.json`, JSON.stringify(data));
exportFile(
`${data.template.name}-export.json`,
JSON.stringify(data, null, 2),
);
})
.catch(() => (isError.value = true))
.finally(() => (isLoading.value = false));

View File

@@ -13,7 +13,11 @@
>
<q-spinner size="40px" color="primary" />
</div>
<div v-else class="q-pa-sm q-gutter-sm scroll" style="height: 85vh; overflow: initial;">
<div
v-else
class="q-pa-sm q-gutter-sm scroll"
style="height: 85vh; overflow: initial"
>
<q-list dense class="rounded-borders">
<q-item
clickable
@@ -163,7 +167,7 @@
runURLAction(
props.node.id,
action.id,
props.node.children ? 'client' : 'site'
props.node.children ? 'client' : 'site',
)
"
>
@@ -196,9 +200,9 @@
"
>
<q-item-section side>
<q-icon name="integration_instructions" />
<q-icon name="analytics" />
</q-item-section>
<q-item-section>Integrations</q-item-section>
<q-item-section>Reporting</q-item-section>
<q-item-section side>
<q-icon name="keyboard_arrow_right" />
</q-item-section>
@@ -816,7 +820,7 @@ export default {
this.$axios.get("/core/urlaction/").then((r) => {
if (r.data.length === 0) {
this.notifyWarning(
"No URL Actions configured. Go to Settings > Global Settings > URL Actions"
"No URL Actions configured. Go to Settings > Global Settings > URL Actions",
);
return;
}