From 0f23611853c4193332881fb7c0c5b9aa805a54e1 Mon Sep 17 00:00:00 2001 From: undefined Date: Thu, 16 Jul 2020 16:52:51 +0800 Subject: [PATCH] fix setting load --- hydro/entry/common.ts | 4 +++- .../scratchpad/ScratchpadRecordsRowContainer.js | 2 +- ui/components/scratchpad/reducers/pretest.js | 1 - ui/components/scratchpad/reducers/records.js | 12 +++++++++++- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/hydro/entry/common.ts b/hydro/entry/common.ts index f946d566e..ebca95532 100644 --- a/hydro/entry/common.ts +++ b/hydro/entry/common.ts @@ -87,6 +87,8 @@ export async function setting(pending: string[], fail: string[], modelSetting: t }; for (const i of pending) { let p = path.resolve(i, 'setting.yaml'); + const t = i.split(path.sep); + const name = t[t.length - 1]; if (!fs.existsSync(p)) p = path.resolve(i, 'settings.yaml'); if (fs.existsSync(p) && !fail.includes(i)) { try { @@ -94,7 +96,7 @@ export async function setting(pending: string[], fail: string[], modelSetting: t for (const key in cfg) { map[cfg[key].category || 'system']( modelSetting.Setting( - i, `${i}.${key}`, cfg[key].range, cfg[key].default, + name, `${name}.${key}`, cfg[key].range, cfg[key].default, cfg[key].type || 'text', cfg[key].name || key, cfg[key].desc || '', ), ); diff --git a/ui/components/scratchpad/ScratchpadRecordsRowContainer.js b/ui/components/scratchpad/ScratchpadRecordsRowContainer.js index b3d39de72..929b3fe0a 100644 --- a/ui/components/scratchpad/ScratchpadRecordsRowContainer.js +++ b/ui/components/scratchpad/ScratchpadRecordsRowContainer.js @@ -78,7 +78,7 @@ export default class ScratchpadRecordsRowContainer extends React.PureComponent { {shouldShowDetail(data) ? `${Math.ceil(data.memory / 1000)} MB` : '-'} - {shouldShowDetail(data) ? `${(data.time_ms / 1000).toFixed(1)}s` : '-'} + {shouldShowDetail(data) ? `${(data.time / 1000).toFixed(1)}s` : '-'}