kopia lustrzana https://github.com/bellingcat/auto-archiver
Fix sorting of steps in the outputted file
rodzic
07ee773a54
commit
f54d6519a8
|
@ -34,3 +34,4 @@ docs/_build/
|
||||||
docs/source/autoapi/
|
docs/source/autoapi/
|
||||||
docs/source/modules/autogen/
|
docs/source/modules/autogen/
|
||||||
scripts/settings_page.html
|
scripts/settings_page.html
|
||||||
|
.vite
|
||||||
|
|
|
@ -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>
|
<div id="root"></div>
|
||||||
<script type="module" src="/src/main.tsx"></script>
|
<script type="module" src="/src/main.tsx"></script>
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
|
|
|
@ -282,10 +282,7 @@ export default function App() {
|
||||||
let existingSteps = finalYamlFile.getIn(['steps', stepType]) as YAMLSeq;
|
let existingSteps = finalYamlFile.getIn(['steps', stepType]) as YAMLSeq;
|
||||||
stepsConfig[stepType].forEach(([name, enabled]: [string, boolean]) => {
|
stepsConfig[stepType].forEach(([name, enabled]: [string, boolean]) => {
|
||||||
let index = existingSteps.items.findIndex((item) => {
|
let index = existingSteps.items.findIndex((item) => {
|
||||||
return item.value === name
|
return (item.value || item) === name
|
||||||
});
|
|
||||||
let commentIndex = existingSteps.items.findIndex((item) => {
|
|
||||||
return item.comment?.indexOf(name) || item.commentBefore?.indexOf()
|
|
||||||
});
|
});
|
||||||
let stepItem = finalYamlFile.getIn(['steps', stepType], true) as YAMLSeq;
|
let stepItem = finalYamlFile.getIn(['steps', stepType], true) as YAMLSeq;
|
||||||
|
|
||||||
|
@ -300,6 +297,11 @@ export default function App() {
|
||||||
finalYamlFile.setIn(['steps', stepType], stepItem);
|
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;
|
existingSteps.flow = existingSteps.items.length ? false : true;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -313,8 +315,6 @@ export default function App() {
|
||||||
Object.keys(configValues[module_name]).forEach((config_name: string) => {
|
Object.keys(configValues[module_name]).forEach((config_name: string) => {
|
||||||
let existingConfigYAML = existingConfig.get(config_name, true) as Scalar;
|
let existingConfigYAML = existingConfig.get(config_name, true) as Scalar;
|
||||||
if (existingConfigYAML) {
|
if (existingConfigYAML) {
|
||||||
console.log(existingConfigYAML.comment);
|
|
||||||
console.log(existingConfigYAML.commentBefore);
|
|
||||||
existingConfigYAML.value = configValues[module_name][config_name];
|
existingConfigYAML.value = configValues[module_name][config_name];
|
||||||
existingConfig.set(config_name, existingConfigYAML);
|
existingConfig.set(config_name, existingConfigYAML);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -146,7 +146,8 @@ function ConfigField({ config_value, module, configValues }: { config_value: any
|
||||||
(
|
(
|
||||||
config_args.choices !== undefined ?
|
config_args.choices !== undefined ?
|
||||||
<Select size="small" id={`${module}.${config_value}`}
|
<Select size="small" id={`${module}.${config_value}`}
|
||||||
defaultValue={value}
|
defaultValue={config_args.default}
|
||||||
|
value={value}
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
setConfigValue(config_value, e.target.value);
|
setConfigValue(config_value, e.target.value);
|
||||||
}}
|
}}
|
||||||
|
|
Ładowanie…
Reference in New Issue