diff --git a/src/ee/reporting/api/reporting.ts b/src/ee/reporting/api/reporting.ts index e72dd3f9..42350fb6 100644 --- a/src/ee/reporting/api/reporting.ts +++ b/src/ee/reporting/api/reporting.ts @@ -28,7 +28,11 @@ export interface useReportingTemplates { isError: Ref; getReportTemplates: (dependsOn?: string[]) => void; addReportTemplate: (payload: ReportTemplate) => void; - editReportTemplate: (id: number, payload: ReportTemplate) => void; + editReportTemplate: ( + id: number, + payload: ReportTemplate, + options?: { dontNotify?: boolean } + ) => void; deleteReportTemplate: (id: number) => void; renderedPreview: Ref; runReportPreview: (payload: RunReportPreviewRequest) => void; @@ -97,7 +101,11 @@ export function useReportTemplates(): useReportingTemplates { .finally(() => (isLoading.value = false)); } - function editReportTemplate(id: number, payload: ReportTemplate) { + function editReportTemplate( + id: number, + payload: ReportTemplate, + options?: { dontNotify?: boolean } + ) { isLoading.value = true; isError.value = false; axios @@ -107,7 +115,8 @@ export function useReportTemplates(): useReportingTemplates { (template) => template.id === id ); reportTemplates.value[index] = data; - notifySuccess("The report template was edited successfully"); + options?.dontNotify || + notifySuccess("The report template was edited successfully"); }) .catch(() => (isError.value = true)) .finally(() => (isLoading.value = false)); @@ -290,6 +299,7 @@ export function useReportingHTMLTemplates(): useReportingHTMLTemplates { (template) => template.id === id ); reportHTMLTemplates.value[index] = data; + notifySuccess("HTML Template was edited successfully"); }) .catch(() => (isError.value = true)) diff --git a/src/ee/reporting/components/EditorToolbar.vue b/src/ee/reporting/components/EditorToolbar.vue index 177f5113..486fa9db 100644 --- a/src/ee/reporting/components/EditorToolbar.vue +++ b/src/ee/reporting/components/EditorToolbar.vue @@ -526,7 +526,10 @@ function insert(text: string, moveToNewLine = false) { }); } - model.pushEditOperations(selections, operations, null); + model.pushEditOperations(selections, operations, (operations) => { + console.log(operations); + return selections; + }); } // inserts a prefix before selected text @@ -557,8 +560,8 @@ function insertPrefix(prefix: string, prefixCount = 1) { let text = model?.getLineContent(i).trimStart(); // prefix and prefix character amount match so should toggle off prefix in editor - const re_toggle = new RegExp(`^${prefix}{${prefixCount}}\\s`); - const re_replace = new RegExp(`^${prefix}+\\s`); + const re_toggle = new RegExp(`^\\${prefix}{${prefixCount}}\\s`); + const re_replace = new RegExp(`^\\${prefix}+\\s`); if (text.match(re_toggle)) { // remove prefix since it is present already (toggled off) @@ -580,11 +583,10 @@ function insertPrefix(prefix: string, prefixCount = 1) { }); } - model.pushEditOperations( - selections, - operations, - (/* operations */) => newSelections - ); + model.pushEditOperations(selections, operations, (operations) => { + console.log(operations); + return newSelections; + }); } // wraps selected text beginning with a prefix and ending with a suffix @@ -618,6 +620,7 @@ function insertWrap(prefix: string, suffix: string, includeWholeLine = false) { } model.pushEditOperations(selections, operations, (operations) => { + console.log(operations); return operations.map((operation) => monaco.Selection.fromRange(operation.range, monaco.SelectionDirection.LTR) ); diff --git a/src/ee/reporting/components/ReportDataQueryForm.vue b/src/ee/reporting/components/ReportDataQueryForm.vue index fb7502ed..1ed7d0f7 100644 --- a/src/ee/reporting/components/ReportDataQueryForm.vue +++ b/src/ee/reporting/components/ReportDataQueryForm.vue @@ -5,7 +5,7 @@ For details, see: https://license.tacticalrmm.com/ee -->