diff --git a/.readthedocs.yaml b/.readthedocs.yaml
index 434f805..39504d8 100644
--- a/.readthedocs.yaml
+++ b/.readthedocs.yaml
@@ -9,6 +9,7 @@ build:
os: ubuntu-22.04
tools:
python: "3.10"
+ node: "22"
jobs:
post_install:
- pip install poetry
@@ -17,6 +18,9 @@ build:
# See https://github.com/readthedocs/readthedocs.org/pull/11152/
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH poetry install --with docs
+ # install node dependencies and build the settings
+ - cd scripts/settings && npm install && npm run build && cp dist/index.html ../../docs/source/installation/settings_base.html && cd ../..
+
sphinx:
configuration: docs/source/conf.py
diff --git a/docs/source/installation/config_editor.md b/docs/source/installation/config_editor.md
new file mode 100644
index 0000000..a23ebce
--- /dev/null
+++ b/docs/source/installation/config_editor.md
@@ -0,0 +1,5 @@
+# Configuration Editor
+
+```{raw} html
+:file: settings.html
+```
\ No newline at end of file
diff --git a/docs/source/installation/settings.html b/docs/source/installation/settings.html
new file mode 100644
index 0000000..973a1e0
--- /dev/null
+++ b/docs/source/installation/settings.html
@@ -0,0 +1,372 @@
+
+
+
+
+
+
+
+
+
+ Auto Archiver Settings
+
+
+
+
+
+
diff --git a/docs/source/installation/setup.md b/docs/source/installation/setup.md
index 8d1a6f5..e5c96a6 100644
--- a/docs/source/installation/setup.md
+++ b/docs/source/installation/setup.md
@@ -6,6 +6,7 @@
installation.md
configurations.md
+config_editor.md
authentication.md
requirements.md
config_cheatsheet.md
diff --git a/scripts/generate_settings_schema.py b/scripts/generate_settings_schema.py
index e04e404..92853cd 100644
--- a/scripts/generate_settings_schema.py
+++ b/scripts/generate_settings_schema.py
@@ -23,7 +23,7 @@ for module in available_modules:
all_modules_ordered_by_type = sorted(available_modules, key=lambda x: (MODULE_TYPES.index(x.type[0]), not x.requires_setup))
-output_schame = {
+output_schema = {
'modules': dict((module.name,
{
'name': module.name,
@@ -40,4 +40,4 @@ output_schame = {
current_file_dir = os.path.dirname(os.path.abspath(__file__))
output_file = os.path.join(current_file_dir, 'settings/src/schema.json')
with open(output_file, 'w') as file:
- json.dump(output_schame, file, indent=4, cls=SchemaEncoder)
\ No newline at end of file
+ json.dump(output_schema, file, indent=4, cls=SchemaEncoder)
\ No newline at end of file
diff --git a/scripts/settings/index.html b/scripts/settings/index.html
index d2e8d75..b0cfa48 100644
--- a/scripts/settings/index.html
+++ b/scripts/settings/index.html
@@ -2,7 +2,6 @@
-
diff --git a/scripts/settings/public/vite.svg b/scripts/settings/public/vite.svg
deleted file mode 100644
index e7b8dfb..0000000
--- a/scripts/settings/public/vite.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/scripts/settings/src/App.tsx b/scripts/settings/src/App.tsx
index 1c3f0e3..26d306b 100644
--- a/scripts/settings/src/App.tsx
+++ b/scripts/settings/src/App.tsx
@@ -27,7 +27,7 @@ import type { DragStartEvent, DragEndEvent, UniqueIdentifier } from "@dnd-kit/co
import { Module } from './types';
import { modules, steps, module_types } from './schema.json';
-import {
+import {
Stack,
Button,
} from '@mui/material';
@@ -50,7 +50,7 @@ function FileDrop({ setYamlFile }: { setYamlFile: React.Dispatch
-
>
);
}
@@ -91,13 +91,13 @@ function ModuleTypes({ stepType, setEnabledModules, enabledModules, configValues
useEffect(() => {
setItems(enabledModules[stepType].map(([name, enabled]: [string, boolean]) => name));
}
- , [enabledModules]);
+ , [enabledModules]);
const toggleModule = (event: any) => {
// make sure that 'feeder' and 'formatter' types only have one value
let name = event.target.id;
let checked = event.target.checked;
- if (stepType === 'feeder' || stepType === 'formatter') {
+ if (stepType === 'feeders' || stepType === 'formatters') {
// check how many modules of this type are enabled
const checkedModules = enabledModules[stepType].filter(([m, enabled]: [string, boolean]) => {
return (m !== name && enabled) || (checked && m === name)
@@ -110,11 +110,11 @@ function ModuleTypes({ stepType, setEnabledModules, enabledModules, configValues
} else {
setShowError(false);
}
- let newEnabledModules = Object.fromEntries(Object.keys(enabledModules).map((type : string) => {
+ let newEnabledModules = Object.fromEntries(Object.keys(enabledModules).map((type: string) => {
return [type, enabledModules[type].map(([m, enabled]: [string, boolean]) => {
return (m === name) ? [m, checked] : [m, enabled];
})];
- }
+ }
));
setEnabledModules(newEnabledModules);
}
@@ -135,61 +135,62 @@ function ModuleTypes({ stepType, setEnabledModules, enabledModules, configValues
const { active, over } = event;
if (active.id !== over?.id) {
- const oldIndex = items.indexOf(active.id as string);
- const newIndex = items.indexOf(over?.id as string);
+ const oldIndex = items.indexOf(active.id as string);
+ const newIndex = items.indexOf(over?.id as string);
- let newArray = arrayMove(items, oldIndex, newIndex);
- // set it also on steps
- let newEnabledModules = { ...enabledModules };
- newEnabledModules[stepType] = enabledModules[stepType].sort((a, b) => {
- return newArray.indexOf(a[0]) - newArray.indexOf(b[0]);
- })
- setEnabledModules(newEnabledModules);
+ let newArray = arrayMove(items, oldIndex, newIndex);
+ // set it also on steps
+ let newEnabledModules = { ...enabledModules };
+ newEnabledModules[stepType] = enabledModules[stepType].sort((a, b) => {
+ return newArray.indexOf(a[0]) - newArray.indexOf(b[0]);
+ })
+ setEnabledModules(newEnabledModules);
}
};
return (
<>
-
-
- {stepType}
-
-
- Select the {stepType} you wish to enable. You can drag and drop them to reorder them.
-
+
+
+ {stepType}
+
+
+ Select the {stepType} you wish to enable. You can drag and move to reorder.
+ Learn more about {stepType} here.
+
- {showError ? Only one {stepType} can be enabled at a time. : null}
+ {showError ? Only one {stepType.slice(0,-1)} can be enabled at a time. : null}
-
-
- {items.map((name: string) => {
- let m: Module = modules[name];
- return (
-
- );
- })}
-
- {activeId ? (
-
+ sensors={sensors}
+ collisionDetection={closestCenter}
+ onDragEnd={handleDragEnd}
+ onDragStart={handleDragStart}
+ >
+
+
+ {items.map((name: string) => {
+ let m: Module = modules[name];
+ return (
+
+ );
+ })}
+
+ {activeId ? (
+
- ) : null}
-
-
-
+ ) : null}
+
+
+
- >
+ >
);
}
@@ -209,41 +210,41 @@ export default function App() {
}, {})
);
- const saveSettings = function(copy: boolean = false) {
+ const saveSettings = function (copy: boolean = false) {
// edit the yamlFile
// generate the steps config
let stepsConfig = enabledModules;
- // create a yaml file from
- const finalYaml = {
- 'steps': Object.keys(steps).reduce((acc, stepType: string) => {
- acc[stepType] = stepsConfig[stepType].filter(([name, enabled]: [string, boolean]) => enabled).map(([name, enabled]: [string, boolean]) => name);
- return acc;
- }, {})
- };
+ // create a yaml file from
+ const finalYaml = {
+ 'steps': Object.keys(steps).reduce((acc, stepType: string) => {
+ acc[stepType] = stepsConfig[stepType].filter(([name, enabled]: [string, boolean]) => enabled).map(([name, enabled]: [string, boolean]) => name);
+ return acc;
+ }, {})
+ };
- Object.keys(configValues).map((module: string) => {
- let module_values = configValues[module];
- if (module_values) {
- finalYaml[module] = module_values;
- }
- });
- let newFile = new Document(finalYaml);
- if (copy) {
- navigator.clipboard.writeText(String(newFile)).then(() => {
- alert("Settings copied to clipboard.");
- });
- } else {
- // offer the file for download
- const blob = new Blob([String(newFile)], { type: 'application/x-yaml' });
- const url = URL.createObjectURL(blob);
- const a = document.createElement('a');
- a.href = url;
- a.download = 'orchestration.yaml';
- a.click();
+ Object.keys(configValues).map((module: string) => {
+ let module_values = configValues[module];
+ if (module_values) {
+ finalYaml[module] = module_values;
}
+ });
+ let newFile = new Document(finalYaml);
+ if (copy) {
+ navigator.clipboard.writeText(String(newFile)).then(() => {
+ alert("Settings copied to clipboard.");
+ });
+ } else {
+ // offer the file for download
+ const blob = new Blob([String(newFile)], { type: 'application/x-yaml' });
+ const url = URL.createObjectURL(blob);
+ const a = document.createElement('a');
+ a.href = url;
+ a.download = 'orchestration.yaml';
+ a.click();
}
+ }
useEffect(() => {
// load the configs, and set the default values if they exist
@@ -262,7 +263,7 @@ export default function App() {
}
});
})
- setConfigValues(newConfigValues);
+ setConfigValues(newConfigValues);
}, []);
useEffect(() => {
@@ -274,25 +275,25 @@ export default function App() {
// make a deep copy of settings
let stepSettings = settings['steps'];
let newEnabledModules = Object.fromEntries(Object.keys(steps).map((type: string) => {
- return [type, steps[type].map((name: string) => {
- return [name, stepSettings[type].indexOf(name) !== -1];
- }).sort((a, b) => {
- let aIndex = stepSettings[type].indexOf(a[0]);
- let bIndex = stepSettings[type].indexOf(b[0]);
- if (aIndex === -1 && bIndex === -1) {
- return a - b;
- }
- if (bIndex === -1) {
- return -1;
- }
- if (aIndex === -1) {
- return 1;
- }
- return aIndex - bIndex;
- })];
+ return [type, steps[type].map((name: string) => {
+ return [name, stepSettings[type].indexOf(name) !== -1];
}).sort((a, b) => {
- return module_types.indexOf(a[0]) - module_types.indexOf(b[0]);
- }));
+ let aIndex = stepSettings[type].indexOf(a[0]);
+ let bIndex = stepSettings[type].indexOf(b[0]);
+ if (aIndex === -1 && bIndex === -1) {
+ return a - b;
+ }
+ if (bIndex === -1) {
+ return -1;
+ }
+ if (aIndex === -1) {
+ return 1;
+ }
+ return aIndex - bIndex;
+ })];
+ }).sort((a, b) => {
+ return module_types.indexOf(a[0]) - module_types.indexOf(b[0]);
+ }));
setEnabledModules(newEnabledModules);
}, [yamlFile]);
@@ -301,44 +302,41 @@ export default function App() {
return (
-
- Auto Archiver Settings
-
-
- 1. Select your orchestration.yaml
settings file.
-
-
+
+ 1. Select your orchestration.yaml settings file.
+
+
-
- 2. Choose the Modules you wish to enable/disable
-
+
+ 2. Choose the Modules you wish to enable/disable
+
{Object.keys(steps).map((stepType: string) => {
return (
-
+
);
})}
-
- 3. Configure your Enabled Modules
-
-
- Next to each module you've enabled, you can click 'Configure' to set the module's settings.
-
+
+ 3. Configure your Enabled Modules
+
+
+ Next to each module you've enabled, you can click 'Configure' to set the module's settings.
+
4. Save your settings
-
-
+
+
-
+
);
diff --git a/scripts/settings/src/ProTip.tsx b/scripts/settings/src/ProTip.tsx
deleted file mode 100644
index 217b5bf..0000000
--- a/scripts/settings/src/ProTip.tsx
+++ /dev/null
@@ -1,23 +0,0 @@
-import * as React from 'react';
-import Link from '@mui/material/Link';
-import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon';
-import Typography from '@mui/material/Typography';
-
-function LightBulbIcon(props: SvgIconProps) {
- return (
-
-
-
- );
-}
-
-export default function ProTip() {
- return (
-
-
- {'Pro tip: See more '}
- templates
- {' in the Material UI documentation.'}
-
- );
-}
diff --git a/scripts/settings/src/StepCard.tsx b/scripts/settings/src/StepCard.tsx
index f326a50..fe69359 100644
--- a/scripts/settings/src/StepCard.tsx
+++ b/scripts/settings/src/StepCard.tsx
@@ -4,7 +4,7 @@ import ReactMarkdown from 'react-markdown';
import { CSS } from "@dnd-kit/utilities";
-import {
+import {
Card,
CardActions,
CardHeader,
@@ -23,17 +23,22 @@ import {
TextField,
Stack,
Typography,
- } from '@mui/material';
+} from '@mui/material';
import Grid from '@mui/material/Grid2';
import DragIndicatorIcon from '@mui/icons-material/DragIndicator';
-import { Module } from "./types";
+import HelpIconOutlined from '@mui/icons-material/HelpOutline';
+import { Module, Config } from "./types";
-Object.defineProperty(String.prototype, 'capitalize', {
- value: function() {
+
+// adds 'capitalize' method to String prototype
+declare global {
+ interface String {
+ capitalize(): string;
+ }
+}
+String.prototype.capitalize = function (this: string) {
return this.charAt(0).toUpperCase() + this.slice(1);
- },
- enumerable: false
-});
+};
const StepCard = ({
type,
@@ -46,7 +51,7 @@ const StepCard = ({
module: Module,
toggleModule: any,
enabledModules: any,
- configValues: any
+ configValues: any
}) => {
const {
attributes,
@@ -55,147 +60,157 @@ const StepCard = ({
transform,
transition,
isDragging
- } = useSortable({ id: module.name });
+ } = useSortable({ id: module.name });
- const style = {
+ const style = {
transform: CSS.Transform.toString(transform),
transition,
zIndex: isDragging ? "100" : "auto",
opacity: isDragging ? 0.3 : 1
- };
-
+ };
+
let name = module.name;
const [helpOpen, setHelpOpen] = useState(false);
const [configOpen, setConfigOpen] = useState(false);
const enabled = enabledModules[type].find((m: any) => m[0] === name)[1];
-
- return (
-
-
- }
- label={module.display_name} />
- }
- action ={
-
-
-
- }
- />
-
-
- {enabled && module.configs && name != 'cli_feeder' ? (
-
- ) : null}
-
-
-
- {module.configs && name != 'cli_feeder' && }
-
+ return (
+
+
+ }
+ label={module.display_name} />
+ }
+ />
+
+
+
+ setHelpOpen(true)}>
+
+
+ {enabled && module.configs && name != 'cli_feeder' ? (
+
+ ) : null}
+
+
+
+
+
+
+
+
+ {module.configs && name != 'cli_feeder' && }
+
)
- }
-
-
-function ConfigPanel({ module, open, setOpen, configValues }: { module: any, open: boolean, setOpen: any, configValues: any }) {
+}
+function ConfigField({ config_value, module, configValues }: { config_value: any, module: Module, configValues: any }) {
function setConfigValue(config: any, value: any) {
- configValues[module.name][config] = value;
+ configValues[module.name][config] = value;
}
+ const config_args: Config = module.configs[config_value];
+ const config_name: string = config_value.replace(/_/g, " ");
+ const config_display_name = config_name.capitalize();
+ const value = configValues[module.name][config_value] || config_args.default;
return (
- <>
-
- >
+
+
+
+ >
);
- }
+}
export default StepCard;
\ No newline at end of file
diff --git a/scripts/settings/src/types.d.ts b/scripts/settings/src/types.d.ts
index 64cba2f..fdf80fc 100644
--- a/scripts/settings/src/types.d.ts
+++ b/scripts/settings/src/types.d.ts
@@ -3,6 +3,9 @@ export interface Config {
description: string;
type: string?;
default: any;
+ help: string;
+ choices: string[];
+ required: boolean;
}
interface Manifest {
@@ -15,4 +18,4 @@ export interface Module {
configs: { [key: string]: Config };
manifest: Manifest;
display_name: string;
-}
\ No newline at end of file
+}
diff --git a/scripts/settings/src/vite-env.d.ts b/scripts/settings/src/vite-env.d.ts
deleted file mode 100644
index 11f02fe..0000000
--- a/scripts/settings/src/vite-env.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-///