diff --git a/RELEASE_NOTES.MD b/RELEASE_NOTES.MD index cc5e779f..f483cf8b 100644 --- a/RELEASE_NOTES.MD +++ b/RELEASE_NOTES.MD @@ -1,5 +1,11 @@ # Client develop +# Client 18/04/2024 1.5.13 + +Features: + +- Printer Create/Update: add URL and apiKey validation with feedback. When wanted force save can be used in case of failures. + # Client 18/04/2024 1.5.12 Fixes: diff --git a/package.json b/package.json index e8c73c1d..1e73d978 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@fdm-monster/client", - "version": "1.5.12", + "version": "1.5.13", "author": "David Zwart", "license": "AGPL-3.0-or-later", "repository": { diff --git a/src/backend/printers.service.ts b/src/backend/printers.service.ts index 59cd17d2..0e8fbea7 100644 --- a/src/backend/printers.service.ts +++ b/src/backend/printers.service.ts @@ -85,8 +85,8 @@ export class PrintersService extends BaseService { return await this.postApi(path, axes); } - static async createPrinter(printer: CreatePrinter) { - const path = ServerApi.printerRoute; + static async createPrinter(printer: CreatePrinter, forceSave: boolean) { + const path = `${ServerApi.printerRoute}?forceSave=${forceSave}`; return (await this.postApi(path, printer)) as PrinterDto; } @@ -103,10 +103,10 @@ export class PrintersService extends BaseService { return await this.deleteApi(path); } - static async updatePrinter(printerId: IdType, printer: CreatePrinter) { + static async updatePrinter(printerId: IdType, printer: CreatePrinter, forceSave: boolean) { const path = ServerApi.getPrinterRoute(printerId); - - return (await this.patchApi(path, printer)) as PrinterDto; + const fullPath = `${path}?forceSave=${forceSave}`; + return (await this.patchApi(fullPath, printer)) as PrinterDto; } static async updatePrinterMaintenance(printerId: IdType, disabledReason: string | null = null) { diff --git a/src/components/Generic/Dialogs/AddOrUpdatePrinterDialog.vue b/src/components/Generic/Dialogs/AddOrUpdatePrinterDialog.vue index 37e2bf7c..b198e92e 100644 --- a/src/components/Generic/Dialogs/AddOrUpdatePrinterDialog.vue +++ b/src/components/Generic/Dialogs/AddOrUpdatePrinterDialog.vue @@ -4,7 +4,7 @@ :max-width="showChecksPanel ? '900px' : '700px'" @escape="closeDialog()" > - + @@ -20,7 +20,7 @@ - + - + - + - + - - + - - + Hide checks + + {{ printerValidationError }} + + + + Validating printer + + * indicates required field @@ -107,12 +115,12 @@ - + - diff --git a/src/components/Settings/SoftwareUpgradeSettings.vue b/src/components/Settings/SoftwareUpgradeSettings.vue index 41f390b1..43379706 100644 --- a/src/components/Settings/SoftwareUpgradeSettings.vue +++ b/src/components/Settings/SoftwareUpgradeSettings.vue @@ -81,8 +81,7 @@ :disabled="isDisabledRelease(release)" :label="calculateLabelDisabledReason(release)" :value="release.tag_name" - > - + />
diff --git a/src/shared/http-client.ts b/src/shared/http-client.ts index bd27c4a5..f4ff5e88 100644 --- a/src/shared/http-client.ts +++ b/src/shared/http-client.ts @@ -62,6 +62,11 @@ export async function getHttpClient(withAuth: boolean = true, autoHandle401: boo }); } + // Special code + if (response.status === HttpStatusCode.FailedDependency) { + return Promise.reject(error); + } + if (![HttpStatusCode.Unauthorized, HttpStatusCode.Forbidden].includes(response.status)) { // Timeout issues etc? console.error("Error in axios response interceptor which is not 401 or 403", error); diff --git a/src/store/printer.store.ts b/src/store/printer.store.ts index 23bf61aa..a4e7a45c 100644 --- a/src/store/printer.store.ts +++ b/src/store/printer.store.ts @@ -59,8 +59,8 @@ export const usePrinterStore = defineStore("Printers", { }, }, actions: { - async createPrinter(newPrinter: CreatePrinter) { - const data = await PrintersService.createPrinter(newPrinter); + async createPrinter(newPrinter: CreatePrinter, forceSave: boolean) { + const data = await PrintersService.createPrinter(newPrinter, forceSave); this.printers.push(data); this.printers.sort((a: PrinterDto, b: PrinterDto) => a.name?.toLowerCase()?.localeCompare(b?.name?.toLowerCase()) ? 1 : -1 @@ -90,14 +90,17 @@ export const usePrinterStore = defineStore("Printers", { setMaintenanceDialogPrinter(printer?: PrinterDto) { this.maintenanceDialogPrinter = printer; }, - async updatePrinter({ - printerId, - updatedPrinter, - }: { - printerId: IdType; - updatedPrinter: CreatePrinter; - }) { - const data = await PrintersService.updatePrinter(printerId, updatedPrinter); + async updatePrinter( + { + printerId, + updatedPrinter, + }: { + printerId: IdType; + updatedPrinter: CreatePrinter; + }, + forceSave: boolean + ) { + const data = await PrintersService.updatePrinter(printerId, updatedPrinter, forceSave); this._replacePrinter({ printerId, printer: data }); return data; },