Fix sorting of steps in the outputted file

pull/217/head
Patrick Robertson 2025-03-04 11:51:26 +00:00
rodzic 07ee773a54
commit f54d6519a8
4 zmienionych plików z 10 dodań i 24 usunięć

1
.gitignore vendored
Wyświetl plik

@ -34,3 +34,4 @@ docs/_build/
docs/source/autoapi/
docs/source/modules/autogen/
scripts/settings_page.html
.vite

Wyświetl plik

@ -1,19 +1,3 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="initial-scale=1, width=device-width" />
<!-- Fonts to support Material Design -->
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap"
/>
<title>Auto Archiver Settings</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>

Wyświetl plik

@ -282,10 +282,7 @@ export default function App() {
let existingSteps = finalYamlFile.getIn(['steps', stepType]) as YAMLSeq;
stepsConfig[stepType].forEach(([name, enabled]: [string, boolean]) => {
let index = existingSteps.items.findIndex((item) => {
return item.value === name
});
let commentIndex = existingSteps.items.findIndex((item) => {
return item.comment?.indexOf(name) || item.commentBefore?.indexOf()
return (item.value || item) === name
});
let stepItem = finalYamlFile.getIn(['steps', stepType], true) as YAMLSeq;
@ -300,6 +297,11 @@ export default function App() {
finalYamlFile.setIn(['steps', stepType], stepItem);
}
});
// sort the items
existingSteps.items.sort((a: Scalar | string, b: Scalar | string) => {
return (stepsConfig[stepType].findIndex((val: [string, boolean]) => {return val[0] === (a.value || a)}) -
stepsConfig[stepType].findIndex((val: [string, boolean]) => {return val[0] === (b.value || b)}))
});
existingSteps.flow = existingSteps.items.length ? false : true;
});
@ -313,8 +315,6 @@ export default function App() {
Object.keys(configValues[module_name]).forEach((config_name: string) => {
let existingConfigYAML = existingConfig.get(config_name, true) as Scalar;
if (existingConfigYAML) {
console.log(existingConfigYAML.comment);
console.log(existingConfigYAML.commentBefore);
existingConfigYAML.value = configValues[module_name][config_name];
existingConfig.set(config_name, existingConfigYAML);
} else {

Wyświetl plik

@ -146,7 +146,8 @@ function ConfigField({ config_value, module, configValues }: { config_value: any
(
config_args.choices !== undefined ?
<Select size="small" id={`${module}.${config_value}`}
defaultValue={value}
defaultValue={config_args.default}
value={value}
onChange={(e) => {
setConfigValue(config_value, e.target.value);
}}