From dbd820133bc1a0795c1a41ccb9e79542ad776ab7 Mon Sep 17 00:00:00 2001 From: VoigtS Date: Wed, 30 Oct 2024 16:45:40 +0100 Subject: [PATCH 1/3] Add minimum is critical feature to the UI --- .../widgets/app/components/castellum/configuration/edit.jsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/shared_filesystem_storage/app/javascript/widgets/app/components/castellum/configuration/edit.jsx b/plugins/shared_filesystem_storage/app/javascript/widgets/app/components/castellum/configuration/edit.jsx index 97e4fc88da..cc478d04e2 100644 --- a/plugins/shared_filesystem_storage/app/javascript/widgets/app/components/castellum/configuration/edit.jsx +++ b/plugins/shared_filesystem_storage/app/javascript/widgets/app/components/castellum/configuration/edit.jsx @@ -234,6 +234,7 @@ export default class CastellumConfigurationEditModal extends React.Component { size_minimum: (cfg.size_constraints || {}).minimum || "", size_maximum: (cfg.size_constraints || {}).maximum || "", free_minimum: (cfg.size_constraints || {}).minimum_free || "", + minimum_free_is_critical: (cfg.size_constraints || {}).minimum_free != "" ? "true" : "false", } } @@ -290,8 +291,9 @@ export default class CastellumConfigurationEditModal extends React.Component { if (values.free_minimum != "") { config.size_constraints = config.size_constraints || {} config.size_constraints.minimum_free = parseInt(values.free_minimum, 10) + config.size_constraints.minimum_free_is_critical = true } - + this.props .configureAutoscaling(this.props.projectID, config) .then(this.close) From 7bfcc4f99891222fdd46b89dc5f4e93904ebbdec Mon Sep 17 00:00:00 2001 From: VoigtS Date: Wed, 30 Oct 2024 17:28:23 +0100 Subject: [PATCH 2/3] Add checkbox to define critical usage level --- .../castellum/configuration/edit.jsx | 91 ++++++------------- 1 file changed, 28 insertions(+), 63 deletions(-) diff --git a/plugins/shared_filesystem_storage/app/javascript/widgets/app/components/castellum/configuration/edit.jsx b/plugins/shared_filesystem_storage/app/javascript/widgets/app/components/castellum/configuration/edit.jsx index cc478d04e2..87188ec004 100644 --- a/plugins/shared_filesystem_storage/app/javascript/widgets/app/components/castellum/configuration/edit.jsx +++ b/plugins/shared_filesystem_storage/app/javascript/widgets/app/components/castellum/configuration/edit.jsx @@ -9,13 +9,8 @@ const FormBody = ({ close, errors }) => { const values = useContext(Form.Context).formValues let validationError = "" - if ( - values.low_enabled == "false" && - values.high_enabled == "false" && - values.critical_enabled == "false" - ) { - validationError = - "To use autoscaling, at least one threshold must be enabled." + if (values.low_enabled == "false" && values.high_enabled == "false" && values.critical_enabled == "false") { + validationError = "To use autoscaling, at least one threshold must be enabled." } return ( @@ -23,11 +18,7 @@ const FormBody = ({ close, errors }) => { - + @@ -39,12 +30,7 @@ const FormBody = ({ close, errors }) => { labelWidth={5} labelClass="control-label secondary-label" > - + { labelWidth={5} labelClass="control-label secondary-label" > - + - + @@ -77,12 +53,7 @@ const FormBody = ({ close, errors }) => { labelWidth={5} labelClass="control-label secondary-label" > - + { labelWidth={5} labelClass="control-label secondary-label" > - + - + @@ -124,11 +85,7 @@ const FormBody = ({ close, errors }) => { /> - + @@ -162,8 +119,7 @@ const FormBody = ({ close, errors }) => { />

- As an exception, multiple steps can be taken at once to resolve a - critical usage level. + As an exception, multiple steps can be taken at once to resolve a critical usage level.

@@ -190,6 +146,17 @@ const FormBody = ({ close, errors }) => { labelClass="control-label secondary-label" > +
+ +
@@ -234,7 +201,6 @@ export default class CastellumConfigurationEditModal extends React.Component { size_minimum: (cfg.size_constraints || {}).minimum || "", size_maximum: (cfg.size_constraints || {}).maximum || "", free_minimum: (cfg.size_constraints || {}).minimum_free || "", - minimum_free_is_critical: (cfg.size_constraints || {}).minimum_free != "" ? "true" : "false", } } @@ -248,9 +214,7 @@ export default class CastellumConfigurationEditModal extends React.Component { validate(values) { return ( - (values.low_enabled == "true" || - values.high_enabled == "true" || - values.critical_enabled == "true") && + (values.low_enabled == "true" || values.high_enabled == "true" || values.critical_enabled == "true") && (values.size_step_single == "true" || values.size_step_percent != "") ) } @@ -291,9 +255,12 @@ export default class CastellumConfigurationEditModal extends React.Component { if (values.free_minimum != "") { config.size_constraints = config.size_constraints || {} config.size_constraints.minimum_free = parseInt(values.free_minimum, 10) + } + if (values.free_minimum != "" && values.minimum_free_is_critical) { + config.size_constraints = config.size_constraints || {} config.size_constraints.minimum_free_is_critical = true } - + this.props .configureAutoscaling(this.props.projectID, config) .then(this.close) @@ -319,9 +286,7 @@ export default class CastellumConfigurationEditModal extends React.Component { className="shared_filesystem_storage" > - - Configure Autoscaling - + Configure Autoscaling
Date: Mon, 4 Nov 2024 17:00:19 +0100 Subject: [PATCH 3/3] Rephrase checkbox label --- .../widgets/app/components/castellum/configuration/edit.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/shared_filesystem_storage/app/javascript/widgets/app/components/castellum/configuration/edit.jsx b/plugins/shared_filesystem_storage/app/javascript/widgets/app/components/castellum/configuration/edit.jsx index 87188ec004..050ce8949c 100644 --- a/plugins/shared_filesystem_storage/app/javascript/widgets/app/components/castellum/configuration/edit.jsx +++ b/plugins/shared_filesystem_storage/app/javascript/widgets/app/components/castellum/configuration/edit.jsx @@ -154,7 +154,7 @@ const FormBody = ({ close, errors }) => { name="minimum_free_is_critical" disabled={values.free_minimum == ""} /> - Treat crossings of this constraint as a critical usage level + When crossing this threshold, resize without delay