From 612c73e631fc50ba85518e6f9d026379c7a5bb26 Mon Sep 17 00:00:00 2001 From: Weiyi Feng Date: Sun, 5 Jun 2022 23:06:19 +0800 Subject: [PATCH] config_tools: reformat Board.vue reformat Board.vue Tracked-On: #6691 Signed-off-by: Weiyi Feng --- .../configurator/src/pages/Config/Board.vue | 78 +++++++++---------- 1 file changed, 39 insertions(+), 39 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 517343ec3..bf7a492b4 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 @@ -63,7 +63,7 @@ import NewBoard from "./NewBoard.vue"; export default { name: "Board", - components: { NewBoard }, + components: {NewBoard}, props: { WorkingFolder: { type: String @@ -89,19 +89,19 @@ export default { mounted() { //get init board if it exist, add to history this.getExistBoardPath() - .then((filePath) => { - if (filePath.length > 0) { - console.log("add exist board to history!") - configurator.addHistory('Board', filePath) - .then(() => { - this.getBoardHistory() - .then(() => { - this.importBoard() - }) - }) - } - }) - this.getBoardHistory() + .then((filePath) => { + if (filePath.length > 0) { + console.log("add exist board to history!") + configurator.addHistory('Board', filePath) + .then(() => { + this.getBoardHistory() + .then(() => { + this.importBoard() + }) + }) + } + }) + this.getBoardHistory() // Todo: auto load board }, @@ -114,16 +114,16 @@ export default { importBoardButton() { if (this.imported) { this.openBoardFileSelectDialog() - .then((filePath) => { - if (filePath.length > 0) { - if (this.currentSelectedBoard.length > 0) { - if (filePath != this.currentSelectedBoard) { + .then((filePath) => { + if (filePath.length > 0) { + if (this.currentSelectedBoard.length > 0) { + if (filePath !== this.currentSelectedBoard) { this.showBoardOverwrite = true; + } } - } - } - this.newFilePath = filePath - }) + } + this.newFilePath = filePath + }) } else { this.importBoard() } @@ -132,9 +132,9 @@ export default { let filepath = '' if (useNewFile) { filepath = this.newFilePath - if (filepath != this.currentSelectedBoard) { + if (filepath !== this.currentSelectedBoard) { configurator.removeFile(this.currentSelectedBoard) - .catch((err) => alert(`${err}`)) + .catch((err) => alert(`${err}`)) } } else { filepath = this.currentSelectedBoard @@ -149,25 +149,25 @@ export default { .then(() => configurator.addHistory('Board', boardFileNewPath)) .then(() => this.getBoardHistory()) }) - .catch((err)=> { + .catch((err) => { alert(`Loading ${filepath} failed: ${err}`) console.log(err) }) } }, getExistBoardPath() { - // only return filename when using exist configuration. - return configurator.readDir(this.WorkingFolder, false) - .then((res) => { - let boardPath = '' - res.map((filepath) => { - if (filepath.path.search('\\.board\\.xml') != -1) { - boardPath = filepath.path - } - }) - // only return the last vaild boardPath - return boardPath - }) + // only return filename when using exist configuration. + return configurator.readDir(this.WorkingFolder, false) + .then((res) => { + let boardPath = '' + res.map((filepath) => { + if (filepath.path.search('\\.board\\.xml') !== -1) { + boardPath = filepath.path + } + }) + // only return the last vaild boardPath + return boardPath + }) }, openBoardFileSelectDialog() { return configurator.openDialog({ @@ -179,8 +179,8 @@ export default { }, browseForFile() { this.openBoardFileSelectDialog() - .then((filePath) => configurator.addHistory('Board', filePath)) - .then(() => this.getBoardHistory()) + .then((filePath) => configurator.addHistory('Board', filePath)) + .then(() => this.getBoardHistory()) }, getBoardHistory() { return configurator.getHistory("Board")