diff --git a/webui/src/components/Appliance/Appliances.vue b/webui/src/components/Appliance/Appliances.vue index 6ca6792..720b55c 100644 --- a/webui/src/components/Appliance/Appliances.vue +++ b/webui/src/components/Appliance/Appliances.vue @@ -45,18 +45,33 @@ {{ appliance.id }} - - mdi-close - Click here to delete this memory appliance - + + + + + + + + + + {{ item.text }} + + + @@ -592,6 +607,150 @@ + + + + + Rename Appliance + + + + + + + + + + + + + + + + + + + Cancel + + + Rename + + + + + + + + + Rename an appliance succeeded! + + New Appliance Id: + {{ renamedApplianceId }} + + + + + Done + + + + + + + + + Rename an appliance failed! + + {{ renameApplianceError }} + + + + + Done + + + + + + + + + + + + {{ renameApplianceProgressText }} + + + + + + + applianceStore.appliances); + if (appliances.value.length > 0) { + applianceStore.selectAppliance(newApplianceId); + } + + this.dialogRenameApplianceWait = false; + this.dialogRenameApplianceSuccess = true; + } else { + this.dialogRenameApplianceWait = false; + this.dialogRenameApplianceFailure = true; + } + + // Reset the credentials + this.renameApplianceCredentials = { + customId: "", + }; + }, + /* Open the add blade popup */ addNewBladeWindowButton() { this.dialogNewBlade = true; diff --git a/webui/src/components/Stores/ApplianceStore.ts b/webui/src/components/Stores/ApplianceStore.ts index 530647e..661f777 100644 --- a/webui/src/components/Stores/ApplianceStore.ts +++ b/webui/src/components/Stores/ApplianceStore.ts @@ -13,10 +13,41 @@ export const useApplianceStore = defineStore('appliance', { selectedApplianceId: null as unknown as string, addApplianceError: null as unknown, deleteApplianceError: null as unknown, + renameApplianceError: null as unknown, applianceIds: [] as { id: string, bladeIds: string[] }[], }), actions: { + async renameAppliance(applianceId: string, newApplianceId: string) { + this.renameApplianceError = ""; + try { + const defaultApi = new DefaultApi(undefined, API_BASE_PATH); + const response = await defaultApi.appliancesUpdateById(applianceId, newApplianceId); + + // Update the appliances array + if (response) { + this.appliances = this.appliances.filter( + (appliance) => appliance.id !== applianceId + ); + this.appliances.push(response.data); + } + + return response.data + } catch (error) { + if (axios.isAxiosError(error)) { + this.renameApplianceError = error.message; + + if (error.response) { + this.renameApplianceError = error.response?.data.status.message + " (" + error.response?.request.status + ")"; + } + } + else { + this.renameApplianceError = error; + } + console.error("Error:", error); + } + }, + async fetchAppliances() { this.appliances = []; this.applianceIds = []; @@ -66,6 +97,7 @@ export const useApplianceStore = defineStore('appliance', { const defaultApi = new DefaultApi(undefined, API_BASE_PATH); const response = await defaultApi.appliancesPost(newAppliance); const addedAppliance = response.data; + console.log("added appliance", addedAppliance) // Add the new appliance to the appliances array this.appliances.push(addedAppliance); return addedAppliance;
+ New Appliance Id: + {{ renamedApplianceId }} +
+ {{ renameApplianceError }} +