diff --git a/src/fireedge/src/client/components/Cards/ProvisionCard.js b/src/fireedge/src/client/components/Cards/ProvisionCard.js
index 09afd12fab..856874de50 100644
--- a/src/fireedge/src/client/components/Cards/ProvisionCard.js
+++ b/src/fireedge/src/client/components/Cards/ProvisionCard.js
@@ -41,6 +41,7 @@ const ProvisionCard = memo(
isProvider,
actions,
deleteAction,
+ configureAction,
}) => {
const {
ID,
@@ -69,6 +70,7 @@ const ProvisionCard = memo(
{actions?.map((action) => (
))}
+ {configureAction && }
{deleteAction && }
>
)
@@ -127,6 +129,7 @@ ProvisionCard.propTypes = {
isProvider: PropTypes.bool,
image: PropTypes.string,
deleteAction: PropTypes.object,
+ configureAction: PropTypes.object,
actions: PropTypes.arrayOf(
PropTypes.shape({
handleClick: PropTypes.func.isRequired,
@@ -143,6 +146,7 @@ ProvisionCard.defaultProps = {
isSelected: undefined,
image: undefined,
deleteAction: undefined,
+ confifureAction: undefined,
value: {},
}
diff --git a/src/fireedge/src/client/components/Forms/Provision/ConfigureForm/index.js b/src/fireedge/src/client/components/Forms/Provision/ConfigureForm/index.js
new file mode 100644
index 0000000000..45cf0c1b77
--- /dev/null
+++ b/src/fireedge/src/client/components/Forms/Provision/ConfigureForm/index.js
@@ -0,0 +1,24 @@
+/* ------------------------------------------------------------------------- *
+ * Copyright 2002-2022, OpenNebula Project, OpenNebula Systems *
+ * *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may *
+ * not use this file except in compliance with the License. You may obtain *
+ * a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, software *
+ * distributed under the License is distributed on an "AS IS" BASIS, *
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
+ * See the License for the specific language governing permissions and *
+ * limitations under the License. *
+ * ------------------------------------------------------------------------- */
+import { createForm } from 'client/utils'
+import {
+ SCHEMA,
+ FIELDS,
+} from 'client/components/Forms/Provision/ConfigureForm/schema'
+
+const ConfigureForm = createForm(SCHEMA, FIELDS)
+
+export default ConfigureForm
diff --git a/src/fireedge/src/client/components/Forms/Provision/ConfigureForm/schema.js b/src/fireedge/src/client/components/Forms/Provision/ConfigureForm/schema.js
new file mode 100644
index 0000000000..7ae8631704
--- /dev/null
+++ b/src/fireedge/src/client/components/Forms/Provision/ConfigureForm/schema.js
@@ -0,0 +1,32 @@
+/* ------------------------------------------------------------------------- *
+ * Copyright 2002-2022, OpenNebula Project, OpenNebula Systems *
+ * *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may *
+ * not use this file except in compliance with the License. You may obtain *
+ * a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, software *
+ * distributed under the License is distributed on an "AS IS" BASIS, *
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
+ * See the License for the specific language governing permissions and *
+ * limitations under the License. *
+ * ------------------------------------------------------------------------- */
+import { object, boolean } from 'yup'
+import { T, INPUT_TYPES } from 'client/constants'
+import { getValidationFromFields } from 'client/utils'
+
+const FORCE = {
+ name: 'force',
+ label: T.Force,
+ type: INPUT_TYPES.SWITCH,
+ tooltip: T.ForceConcept,
+ validation: boolean()
+ .notRequired()
+ .default(() => false),
+}
+
+export const FIELDS = [FORCE]
+
+export const SCHEMA = object(getValidationFromFields(FIELDS))
diff --git a/src/fireedge/src/client/components/Forms/Provision/index.js b/src/fireedge/src/client/components/Forms/Provision/index.js
index 3ff64c8f28..e254c4a31f 100644
--- a/src/fireedge/src/client/components/Forms/Provision/index.js
+++ b/src/fireedge/src/client/components/Forms/Provision/index.js
@@ -31,4 +31,11 @@ const CreateForm = (configProps) =>
const DeleteForm = (configProps) =>
AsyncLoadForm({ formPath: 'Provision/DeleteForm' }, configProps)
-export { CreateForm, DeleteForm }
+/**
+ * @param {ConfigurationProps} configProps - Configuration
+ * @returns {ReactElement|CreateFormCallback} Asynchronous loaded form
+ */
+const ConfigureForm = (configProps) =>
+ AsyncLoadForm({ formPath: 'Provision/ConfigureForm' }, configProps)
+
+export { CreateForm, DeleteForm, ConfigureForm }
diff --git a/src/fireedge/src/client/constants/translates.js b/src/fireedge/src/client/constants/translates.js
index 083f752b4f..06485b55c8 100644
--- a/src/fireedge/src/client/constants/translates.js
+++ b/src/fireedge/src/client/constants/translates.js
@@ -281,6 +281,7 @@ module.exports = {
CleanupConcept: 'Delete all vms and images first, then delete the resources',
Force: 'Force',
ForceConcept: 'Force configure to execute',
+ ConfigureProvision: 'Configure provision %s',
/* sections */
Dashboard: 'Dashboard',
diff --git a/src/fireedge/src/client/containers/Provisions/index.js b/src/fireedge/src/client/containers/Provisions/index.js
index 5bfee62174..90556274a9 100644
--- a/src/fireedge/src/client/containers/Provisions/index.js
+++ b/src/fireedge/src/client/containers/Provisions/index.js
@@ -28,7 +28,7 @@ import {
import { useSearch, useDialog } from 'client/hooks'
import { useGeneralApi } from 'client/features/General'
-import { DeleteForm } from 'client/components/Forms/Provision'
+import { DeleteForm, ConfigureForm } from 'client/components/Forms/Provision'
import { ListHeader, ListCards } from 'client/components/List'
import AlertError from 'client/components/Alerts/Error'
import { ProvisionCard } from 'client/components/Cards'
@@ -104,16 +104,33 @@ function Provisions() {
CardComponent={ProvisionCard}
cardsProps={({ value: { ID, NAME } }) => ({
handleClick: () => handleClickfn(ID, NAME),
- actions: [
- {
- handleClick: async () => {
- await configureProvision({ id: ID })
- enqueueInfo(`Configuring provision - ID: ${ID}`)
- },
+ configureAction: {
+ buttonProps: {
+ 'data-cy': 'provision-configure',
icon: ,
- cy: 'provision-configure',
},
- ],
+ options: [
+ {
+ dialogProps: {
+ title: (
+
+ ),
+ },
+ form: ConfigureForm,
+ onSubmit: async (formData) => {
+ try {
+ await configureProvision({ id: ID, ...formData })
+ enqueueInfo(`Configuring provision - ID: ${ID}`)
+ } finally {
+ hide()
+ }
+ },
+ },
+ ],
+ },
deleteAction: {
buttonProps: {
'data-cy': 'provision-delete',
diff --git a/src/fireedge/src/client/features/OneApi/provision.js b/src/fireedge/src/client/features/OneApi/provision.js
index 97be922b09..8895387e4b 100644
--- a/src/fireedge/src/client/features/OneApi/provision.js
+++ b/src/fireedge/src/client/features/OneApi/provision.js
@@ -173,6 +173,7 @@ const provisionApi = oneApi.injectEndpoints({
*
* @param {object} params - Request parameters
* @param {string} params.id - Provision id
+ * @param {boolean} params.force - Force configure to execute
* @returns {object} Object of document updated
* @throws Fails when response isn't code 200
*/
diff --git a/src/fireedge/src/server/routes/api/oneprovision/provision/routes.js b/src/fireedge/src/server/routes/api/oneprovision/provision/routes.js
index 8da6e1b99d..dc0c13803c 100644
--- a/src/fireedge/src/server/routes/api/oneprovision/provision/routes.js
+++ b/src/fireedge/src/server/routes/api/oneprovision/provision/routes.js
@@ -127,6 +127,9 @@ module.exports = {
id: {
from: resource,
},
+ force: {
+ from: postBody,
+ },
},
},
[PROVISION_GET_RESOURCE]: {