From d93b773755cb82add34490cf1b79d99de0c80897 Mon Sep 17 00:00:00 2001 From: Weiyi Feng Date: Mon, 6 Jun 2022 16:59:30 +0800 Subject: [PATCH] config_tools: delete the old board file when the new board file is imported successfully. delete the old board file when the new board file is imported successfully. Tracked-On: #6691 Signed-off-by: Weiyi Feng --- .../configurator/src/pages/Config/Board.vue | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/misc/config_tools/configurator/packages/configurator/src/pages/Config/Board.vue b/misc/config_tools/configurator/packages/configurator/src/pages/Config/Board.vue index 5c9396000..1859eeb96 100644 --- a/misc/config_tools/configurator/packages/configurator/src/pages/Config/Board.vue +++ b/misc/config_tools/configurator/packages/configurator/src/pages/Config/Board.vue @@ -132,24 +132,22 @@ export default { let filepath = '' if (useNewFile) { filepath = this.newFilePath - if (filepath !== this.currentSelectedBoard) { - configurator.removeFile(this.currentSelectedBoard) - .catch((err) => alert(`${err}`)) - } } else { filepath = this.currentSelectedBoard } if (filepath.length > 0) { configurator.loadBoard(filepath) - .then(({scenarioJSONSchema, boardInfo}) => { + .then(async ({scenarioJSONSchema, boardInfo}) => { this.$emit('boardUpdate', boardInfo, scenarioJSONSchema); let boardFileNewPath = this.WorkingFolder + boardInfo.name; - // Todo: use rust command writeBoard to fix bugs. + if (useNewFile && filepath !== this.currentSelectedBoard) { + await configurator.removeFile(this.currentSelectedBoard) + } configurator.writeFile(boardFileNewPath, boardInfo.content) .then(() => configurator.addHistory('Board', boardFileNewPath)) .then(() => this.getBoardHistory()) - .then(()=>{ - if(!!window.boardUpdate){ + .then(() => { + if (!!window.boardUpdate) { window.boardUpdate(boardInfo) } })