From abd8204d6bd4147f3f70df980432474bef5eb424 Mon Sep 17 00:00:00 2001
From: Alejandro Visiedo
Date: Sun, 1 Oct 2023 17:47:14 +0200
Subject: [PATCH] HMS-2590 fix: align wizard page 2 and 3
Align the appearance for the pages 2 and 3, and add the VerifyRegistry
component to the page 2.
Signed-off-by: Alejandro Visiedo
---
src/Api/api.ts | 212 +++++++++---------
src/Routes/DefaultPage/DefaultPage.tsx | 9 +-
.../PageServiceDetails/PageServiceDetails.tsx | 109 ++++++---
.../PageServiceRegistration.tsx | 127 +++++++----
src/Routes/WizardPage/WizardPage.tsx | 71 +++++-
5 files changed, 340 insertions(+), 188 deletions(-)
diff --git a/src/Api/api.ts b/src/Api/api.ts
index e7f1441..fd04316 100644
--- a/src/Api/api.ts
+++ b/src/Api/api.ts
@@ -970,56 +970,6 @@ export const ActionsApiAxiosParamCreator = function (configuration?: Configurati
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
localVarRequestOptions.data = serializeDataIfNeeded(updateDomainAgentRequest, localVarRequestOptions, configuration);
- return {
- url: toPathString(localVarUrlObj),
- options: localVarRequestOptions,
- };
- },
- /**
- * Update the rhel-idm domain information.
- * @summary Update domain information by user.
- * @param {string} uuid The uuid that identify the domain.
- * @param {UpdateDomainUserRequest} updateDomainUserRequest Information for an IPA domain so it is updated from the ipa-hcc agent.
- * @param {string} [xRhInsightsRequestId] Request id for distributed tracing.
- * @param {*} [options] Override http request option.
- * @throws {RequiredError}
- */
- updateDomainUser: async (
- uuid: string,
- updateDomainUserRequest: UpdateDomainUserRequest,
- xRhInsightsRequestId?: string,
- options: AxiosRequestConfig = {}
- ): Promise => {
- // verify required parameter 'uuid' is not null or undefined
- assertParamExists('updateDomainUser', 'uuid', uuid);
- // verify required parameter 'updateDomainUserRequest' is not null or undefined
- assertParamExists('updateDomainUser', 'updateDomainUserRequest', updateDomainUserRequest);
- const localVarPath = `/domains/{uuid}`.replace(`{${'uuid'}}`, encodeURIComponent(String(uuid)));
- // use dummy base URL string because the URL constructor only accepts absolute URLs.
- const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
- let baseOptions;
- if (configuration) {
- baseOptions = configuration.baseOptions;
- }
-
- const localVarRequestOptions = { method: 'PATCH', ...baseOptions, ...options };
- const localVarHeaderParameter = {} as any;
- const localVarQueryParameter = {} as any;
-
- // authentication x-rh-identity required
- await setApiKeyToObject(localVarHeaderParameter, 'X-Rh-Identity', configuration);
-
- if (xRhInsightsRequestId != null) {
- localVarHeaderParameter['X-Rh-Insights-Request-Id'] = String(xRhInsightsRequestId);
- }
-
- localVarHeaderParameter['Content-Type'] = 'application/json';
-
- setSearchParams(localVarUrlObj, localVarQueryParameter);
- let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
- localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
- localVarRequestOptions.data = serializeDataIfNeeded(updateDomainUserRequest, localVarRequestOptions, configuration);
-
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
@@ -1081,24 +1031,6 @@ export const ActionsApiFp = function (configuration?: Configuration) {
);
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
},
- /**
- * Update the rhel-idm domain information.
- * @summary Update domain information by user.
- * @param {string} uuid The uuid that identify the domain.
- * @param {UpdateDomainUserRequest} updateDomainUserRequest Information for an IPA domain so it is updated from the ipa-hcc agent.
- * @param {string} [xRhInsightsRequestId] Request id for distributed tracing.
- * @param {*} [options] Override http request option.
- * @throws {RequiredError}
- */
- async updateDomainUser(
- uuid: string,
- updateDomainUserRequest: UpdateDomainUserRequest,
- xRhInsightsRequestId?: string,
- options?: AxiosRequestConfig
- ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> {
- const localVarAxiosArgs = await localVarAxiosParamCreator.updateDomainUser(uuid, updateDomainUserRequest, xRhInsightsRequestId, options);
- return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
- },
};
};
@@ -1149,23 +1081,6 @@ export const ActionsApiFactory = function (configuration?: Configuration, basePa
.updateDomainAgent(uuid, xRhIdmVersion, updateDomainAgentRequest, xRhInsightsRequestId, options)
.then((request) => request(axios, basePath));
},
- /**
- * Update the rhel-idm domain information.
- * @summary Update domain information by user.
- * @param {string} uuid The uuid that identify the domain.
- * @param {UpdateDomainUserRequest} updateDomainUserRequest Information for an IPA domain so it is updated from the ipa-hcc agent.
- * @param {string} [xRhInsightsRequestId] Request id for distributed tracing.
- * @param {*} [options] Override http request option.
- * @throws {RequiredError}
- */
- updateDomainUser(
- uuid: string,
- updateDomainUserRequest: UpdateDomainUserRequest,
- xRhInsightsRequestId?: string,
- options?: any
- ): AxiosPromise {
- return localVarFp.updateDomainUser(uuid, updateDomainUserRequest, xRhInsightsRequestId, options).then((request) => request(axios, basePath));
- },
};
};
@@ -1215,27 +1130,6 @@ export class ActionsApi extends BaseAPI {
.updateDomainAgent(uuid, xRhIdmVersion, updateDomainAgentRequest, xRhInsightsRequestId, options)
.then((request) => request(this.axios, this.basePath));
}
-
- /**
- * Update the rhel-idm domain information.
- * @summary Update domain information by user.
- * @param {string} uuid The uuid that identify the domain.
- * @param {UpdateDomainUserRequest} updateDomainUserRequest Information for an IPA domain so it is updated from the ipa-hcc agent.
- * @param {string} [xRhInsightsRequestId] Request id for distributed tracing.
- * @param {*} [options] Override http request option.
- * @throws {RequiredError}
- * @memberof ActionsApi
- */
- public updateDomainUser(
- uuid: string,
- updateDomainUserRequest: UpdateDomainUserRequest,
- xRhInsightsRequestId?: string,
- options?: AxiosRequestConfig
- ) {
- return ActionsApiFp(this.configuration)
- .updateDomainUser(uuid, updateDomainUserRequest, xRhInsightsRequestId, options)
- .then((request) => request(this.axios, this.basePath));
- }
}
/**
@@ -1510,6 +1404,56 @@ export const ResourcesApiAxiosParamCreator = function (configuration?: Configura
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
localVarRequestOptions.data = serializeDataIfNeeded(registerDomainRequest, localVarRequestOptions, configuration);
+ return {
+ url: toPathString(localVarUrlObj),
+ options: localVarRequestOptions,
+ };
+ },
+ /**
+ * Update the rhel-idm domain information.
+ * @summary Update domain information by user.
+ * @param {string} uuid The uuid that identify the domain.
+ * @param {UpdateDomainUserRequest} updateDomainUserRequest Information for an IPA domain so it is updated from the ipa-hcc agent.
+ * @param {string} [xRhInsightsRequestId] Request id for distributed tracing.
+ * @param {*} [options] Override http request option.
+ * @throws {RequiredError}
+ */
+ updateDomainUser: async (
+ uuid: string,
+ updateDomainUserRequest: UpdateDomainUserRequest,
+ xRhInsightsRequestId?: string,
+ options: AxiosRequestConfig = {}
+ ): Promise => {
+ // verify required parameter 'uuid' is not null or undefined
+ assertParamExists('updateDomainUser', 'uuid', uuid);
+ // verify required parameter 'updateDomainUserRequest' is not null or undefined
+ assertParamExists('updateDomainUser', 'updateDomainUserRequest', updateDomainUserRequest);
+ const localVarPath = `/domains/{uuid}`.replace(`{${'uuid'}}`, encodeURIComponent(String(uuid)));
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
+ let baseOptions;
+ if (configuration) {
+ baseOptions = configuration.baseOptions;
+ }
+
+ const localVarRequestOptions = { method: 'PATCH', ...baseOptions, ...options };
+ const localVarHeaderParameter = {} as any;
+ const localVarQueryParameter = {} as any;
+
+ // authentication x-rh-identity required
+ await setApiKeyToObject(localVarHeaderParameter, 'X-Rh-Identity', configuration);
+
+ if (xRhInsightsRequestId != null) {
+ localVarHeaderParameter['X-Rh-Insights-Request-Id'] = String(xRhInsightsRequestId);
+ }
+
+ localVarHeaderParameter['Content-Type'] = 'application/json';
+
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
+ localVarRequestOptions.data = serializeDataIfNeeded(updateDomainUserRequest, localVarRequestOptions, configuration);
+
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
@@ -1631,6 +1575,24 @@ export const ResourcesApiFp = function (configuration?: Configuration) {
);
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
},
+ /**
+ * Update the rhel-idm domain information.
+ * @summary Update domain information by user.
+ * @param {string} uuid The uuid that identify the domain.
+ * @param {UpdateDomainUserRequest} updateDomainUserRequest Information for an IPA domain so it is updated from the ipa-hcc agent.
+ * @param {string} [xRhInsightsRequestId] Request id for distributed tracing.
+ * @param {*} [options] Override http request option.
+ * @throws {RequiredError}
+ */
+ async updateDomainUser(
+ uuid: string,
+ updateDomainUserRequest: UpdateDomainUserRequest,
+ xRhInsightsRequestId?: string,
+ options?: AxiosRequestConfig
+ ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> {
+ const localVarAxiosArgs = await localVarAxiosParamCreator.updateDomainUser(uuid, updateDomainUserRequest, xRhInsightsRequestId, options);
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
+ },
};
};
@@ -1717,6 +1679,23 @@ export const ResourcesApiFactory = function (configuration?: Configuration, base
.registerDomain(xRhIdmRegistrationToken, xRhIdmVersion, registerDomainRequest, xRhInsightsRequestId, options)
.then((request) => request(axios, basePath));
},
+ /**
+ * Update the rhel-idm domain information.
+ * @summary Update domain information by user.
+ * @param {string} uuid The uuid that identify the domain.
+ * @param {UpdateDomainUserRequest} updateDomainUserRequest Information for an IPA domain so it is updated from the ipa-hcc agent.
+ * @param {string} [xRhInsightsRequestId] Request id for distributed tracing.
+ * @param {*} [options] Override http request option.
+ * @throws {RequiredError}
+ */
+ updateDomainUser(
+ uuid: string,
+ updateDomainUserRequest: UpdateDomainUserRequest,
+ xRhInsightsRequestId?: string,
+ options?: any
+ ): AxiosPromise {
+ return localVarFp.updateDomainUser(uuid, updateDomainUserRequest, xRhInsightsRequestId, options).then((request) => request(axios, basePath));
+ },
};
};
@@ -1824,4 +1803,25 @@ export class ResourcesApi extends BaseAPI {
.registerDomain(xRhIdmRegistrationToken, xRhIdmVersion, registerDomainRequest, xRhInsightsRequestId, options)
.then((request) => request(this.axios, this.basePath));
}
+
+ /**
+ * Update the rhel-idm domain information.
+ * @summary Update domain information by user.
+ * @param {string} uuid The uuid that identify the domain.
+ * @param {UpdateDomainUserRequest} updateDomainUserRequest Information for an IPA domain so it is updated from the ipa-hcc agent.
+ * @param {string} [xRhInsightsRequestId] Request id for distributed tracing.
+ * @param {*} [options] Override http request option.
+ * @throws {RequiredError}
+ * @memberof ResourcesApi
+ */
+ public updateDomainUser(
+ uuid: string,
+ updateDomainUserRequest: UpdateDomainUserRequest,
+ xRhInsightsRequestId?: string,
+ options?: AxiosRequestConfig
+ ) {
+ return ResourcesApiFp(this.configuration)
+ .updateDomainUser(uuid, updateDomainUserRequest, xRhInsightsRequestId, options)
+ .then((request) => request(this.axios, this.basePath));
+ }
}
diff --git a/src/Routes/DefaultPage/DefaultPage.tsx b/src/Routes/DefaultPage/DefaultPage.tsx
index 8a4b27a..3ba5006 100644
--- a/src/Routes/DefaultPage/DefaultPage.tsx
+++ b/src/Routes/DefaultPage/DefaultPage.tsx
@@ -27,7 +27,7 @@ import './DefaultPage.scss';
import Section from '@redhat-cloud-services/frontend-components/Section';
import { Domain, ResourcesApiFactory } from '../../Api/api';
import { DomainList } from '../../Components/DomainList/DomainList';
-import { AppContext } from '../../AppContext';
+import { AppContext, IAppContext } from '../../AppContext';
// const SampleComponent = lazy(() => import('../../Components/SampleComponent/sample-component'));
@@ -54,8 +54,12 @@ const EmptyContent = () => {
// FIXME Update this link in the future
const linkLearnMoreAbout = 'https://access.redhat.com/articles/1586893';
const navigate = useNavigate();
+ const appContext = useContext(AppContext);
const handleOpenWizard = () => {
+ appContext.wizard.setDomain({ domain_id: '', title: '', description: '' } as Domain);
+ appContext.wizard.setToken('');
+ appContext.wizard.setRegisteredStatus('initial');
navigate('/domains/wizard', { replace: true });
};
@@ -149,6 +153,9 @@ const ListContent = () => {
}, [page, perPage, offset]);
const handleOpenWizard = () => {
+ appContext.wizard.setDomain({ domain_id: '', title: '', description: '' } as Domain);
+ appContext.wizard.setRegisteredStatus('initial');
+ appContext.wizard.setToken('');
navigate('/domains/wizard', { replace: true });
};
diff --git a/src/Routes/WizardPage/Components/PageServiceDetails/PageServiceDetails.tsx b/src/Routes/WizardPage/Components/PageServiceDetails/PageServiceDetails.tsx
index 3b9e8cf..23a39da 100644
--- a/src/Routes/WizardPage/Components/PageServiceDetails/PageServiceDetails.tsx
+++ b/src/Routes/WizardPage/Components/PageServiceDetails/PageServiceDetails.tsx
@@ -1,18 +1,68 @@
import React, { useState } from 'react';
-import { Form, FormGroup, TextArea, Title, Tooltip } from '@patternfly/react-core';
+import { Form, FormGroup, Icon, TextArea, Title, Tooltip } from '@patternfly/react-core';
import { TextInput } from '@patternfly/react-core';
-import { Domain } from '../../../../Api/api';
-import OutlinedQuestionCircleIcon from '@patternfly/react-icons/dist/esm/icons/question-circle-icon';
+import OutlinedQuestionCircleIcon from '@patternfly/react-icons/dist/esm/icons/outlined-question-circle-icon';
import './PageServiceDetails.scss';
import { Switch } from '@patternfly/react-core';
-const PageServiceDetails: React.FC<{ data: Domain }> = (props) => {
- const [data, setData] = useState(props.data);
- const [isAutoEnrollmentEnabled, setIsAutoEnrollmentEnabled] = React.useState(true);
+/**
+ * Represent the properties accepted by the PageServiceDetails
+ * component.
+ * @see {@link PageServiceDetails}
+ */
+interface PageServiceDetailsProps {
+ /** The title that represent the domain. */
+ title?: string;
+ /** The long description for the domain. */
+ description?: string;
+ /** Flag to enable / disable the auto enrollment feature. */
+ autoEnrollmentEnabled?: boolean;
+
+ /** Event fired when the title change. */
+ onChangeTitle?: (value: string) => void;
+ /** Event fired when the description change. */
+ onChangeDescription?: (value: string) => void;
+ /** Event fired when the switch for auto-enrollment change. */
+ onChangeAutoEnrollment?: (value: boolean) => void;
+}
+
+/**
+ * It provides fields to the user to customize the values such as
+ * the title, description and if the domain will be avialable for
+ * auto-enrollment.
+ * @param props the properties received from the parent component.
+ * @returns return the view for the Service Details wizard page.
+ * @public
+ * @see {@link PageServiceDetailsProps} about the properties.
+ * @see {@link WizardPage} to know about the parent component.
+ */
+const PageServiceDetails = (props: PageServiceDetailsProps) => {
+ const [title, setTitle] = useState(props.title ? props.title : '');
+ const [description, setDescription] = useState(props.description ? props.description : '');
+ const [isAutoEnrollmentEnabled, setIsAutoEnrollmentEnabled] = React.useState(
+ props.autoEnrollmentEnabled ? props.autoEnrollmentEnabled : false
+ );
const onChangeAutoEnrollment = (checked: boolean) => {
setIsAutoEnrollmentEnabled(checked);
+ if (props.onChangeAutoEnrollment) {
+ props.onChangeAutoEnrollment(checked);
+ }
+ };
+
+ const onChangeTitle = (value: string, event: React.FormEvent) => {
+ setTitle(value);
+ if (props.onChangeTitle) {
+ props.onChangeTitle(value);
+ }
+ };
+
+ const onChangeDescription = (value: string, event: React.ChangeEvent) => {
+ setDescription(value);
+ if (props.onChangeDescription) {
+ props.onChangeDescription(value);
+ }
};
const autoEnrollmentTooltipContent = isAutoEnrollmentEnabled
@@ -20,15 +70,11 @@ const PageServiceDetails: React.FC<{ data: Domain }> = (props) => {
: 'Disabling the option leaves the service registration intact, but does not make it available for the "Domain join on launch" feature within Image Builder. It can be enabled later in the "Register Directory and Domain Service" view.';
return (
-
-
-
+ >
);
};
diff --git a/src/Routes/WizardPage/Components/PageServiceRegistration/PageServiceRegistration.tsx b/src/Routes/WizardPage/Components/PageServiceRegistration/PageServiceRegistration.tsx
index 34e640a..231580d 100644
--- a/src/Routes/WizardPage/Components/PageServiceRegistration/PageServiceRegistration.tsx
+++ b/src/Routes/WizardPage/Components/PageServiceRegistration/PageServiceRegistration.tsx
@@ -1,59 +1,96 @@
-import React from 'react';
-// import { useDispatch } from 'react-redux';
-import { ExternalLinkAltIcon } from '@patternfly/react-icons/dist/esm/icons/external-link-alt-icon';
-import { Alert, Button, ClipboardCopy, Form, FormGroup, TextContent } from '@patternfly/react-core';
+import React, { useState } from 'react';
+import { Alert, Button, ClipboardCopy, Flex, FlexItem, Form, TextContent, Title } from '@patternfly/react-core';
import './PageServiceRegistration.scss';
-import { Domain } from '../../../../Api/api';
+import VerifyRegistry, { VerifyState } from '../VerifyRegistry/VerifyRegistry';
+import { Domain } from '../../../../Api';
+/**
+ * Represents the properties accepted by the @{link PageServiceRegistration} component.
+ * @see @{link VerifyState} about the different states.
+ */
interface PageServiceRegistrationProp {
- data?: Domain;
- token?: string;
+ /** The uuid for the requested token. */
+ uuid: string;
+ /** The token requested for the operation. */
+ token: string;
+ /** Event fired when the registration state changes. */
+ onVerify?: (value: VerifyState, data?: Domain) => void;
}
-const PageServiceRegistration: React.FC = (props) => {
- // FIXME Delete this
- const demoToken = 'F4ZWgmhUxcw.d2iqKLHa8281CM_1aknGLsBRFpwfoy3YkrTbLBIuEkM';
- const ipa_hcc_register_cmd = 'ipa-hcc register ' + demoToken;
+/**
+ * Represent the page that provide the registration command and check
+ * when the registration happened from the user.
+ * @param props provide the uuid and token for the registration process.
+ * @returns the view for the page updated according the registration
+ * information.
+ * @see {@link PageServiceRegistrationProp} about the accepted properties.
+ * @see {@link WizardPage} about the parent component.
+ * @public
+ */
+const PageServiceRegistration = (props: PageServiceRegistrationProp) => {
+ // FIXME Update the URL with the location for docs
+ // const installServerPackagesLink = 'https://freeipa.org/page/Quick_Start_Guide';
+ const [state, setState] = useState('initial');
+
+ // FIXME Clean-up when sure it is not needed
+ // const openInNewWindow = (url: string) => {
+ // window.open(url, '_blank');
+ // };
+
+ // FIXME Clean-up when sure it is not needed
+ // const onInstallServerPackagesClick = () => {
+ // openInNewWindow(installServerPackagesLink);
+ // };
+
+ const ipa_hcc_register_cmd = 'ipa-hcc register ' + props.token;
const alertTitle = 'Register your directory and domain service';
+
// FIXME Update the URL with the location for docs
- const linkLearnMoreAbout = 'https://access.redhat.com/articles/1586893';
+ const linkLearnMoreAbout = 'https://www.google.es/search?q=freeipa+registering+a+domain+service';
+
+ const onChangeVerifyRegistry = (newState: VerifyState, domain?: Domain) => {
+ setState(newState);
+ if (props.onVerify) {
+ props.onVerify(newState, domain);
+ }
+ };
+
+ console.log('PageServiceRegistration: uuid=' + props.uuid + '; token=' + props.token);
return (
-
-
- Completing this step registers your directory and domain service, and cannot be undone from the wizard.{' '}
- {/* FIXME Q What is the better way to fix the top padding between the link and the text? */}
-
- } iconPosition="right" href={linkLearnMoreAbout}>
- Learn more about the directory and domain services.
-
-
-
-
- {/* TODO Add here the new VerifyRegistration component */}
-
+
+
+
+
+
+ >
);
};
diff --git a/src/Routes/WizardPage/WizardPage.tsx b/src/Routes/WizardPage/WizardPage.tsx
index 7699ed1..781f3f8 100644
--- a/src/Routes/WizardPage/WizardPage.tsx
+++ b/src/Routes/WizardPage/WizardPage.tsx
@@ -15,6 +15,7 @@ import './WizardPage.scss';
import { useNavigate } from 'react-router-dom';
import { Domain, ResourcesApiFactory } from '../../Api/api';
import { AppContext } from '../../AppContext';
+import { VerifyState } from './Components/VerifyRegistry/VerifyRegistry';
// Lazy load for the wizard pages
const PagePreparation = React.lazy(() => import('./Components/PagePreparation/PagePreparation'));
@@ -95,11 +96,25 @@ const WizardPage = () => {
const [, orderIndex] = id.split('-');
id = parseInt(orderIndex);
}
+ if (id === 2) {
+ // FIXME Clean-up when the token is created into the page 1
+ // try {
+ // const response = await resources_api.createDomainToken({ domain_type: 'rhel-idm' }, undefined, undefined);
+ // const newData = response.data;
+ // appContext.wizard.setToken(newData.domain_token);
+ // appContext.wizard.setUUID(newData.domain_id);
+ // } catch (error) {
+ // // TODO Add error hanlder
+ // console.log('error noNextPage: ' + error);
+ // appContext.wizard.setToken('');
+ // appContext.wizard.setUUID('');
+ // }
+ }
};
const initCanJumpPage1 = true;
const initCanJumpPage2 = initCanJumpPage1 && domain.domain_id != '' && appContext.wizard.getToken() != '';
- const initCanJumpPage3 = initCanJumpPage2;
+ const initCanJumpPage3 = initCanJumpPage2 && appContext.wizard.getRegisteredStatus() === 'completed';
const initCanJumpPage4 = initCanJumpPage3 && domain.title !== undefined && domain.title.length > 0;
const [canJumpPage1] = useState(initCanJumpPage1);
@@ -116,6 +131,35 @@ const WizardPage = () => {
}
};
+ const onVerify = (value: VerifyState, data?: Domain) => {
+ appContext.wizard.setRegisteredStatus(value);
+ if (value === 'completed') {
+ if (data) {
+ appContext.wizard.setDomain(data);
+ }
+ setCanJumpPage3(true);
+ } else {
+ setCanJumpPage3(false);
+ }
+ };
+
+ const onChangeTitle = (value: string) => {
+ appContext.wizard.setDomain({ ...domain, title: value });
+ if (value.length > 0) {
+ setCanJumpPage4(true);
+ } else {
+ setCanJumpPage4(false);
+ }
+ };
+
+ const onChangeDescription = (value: string) => {
+ appContext.wizard.setDomain({ ...domain, description: value });
+ };
+
+ const onChangeAutoEnrollment = (value: boolean) => {
+ appContext.wizard.setDomain({ ...domain, auto_enrollment_enabled: value });
+ };
+
/** Configure the wizard pages. */
const steps = [
{
@@ -128,16 +172,23 @@ const WizardPage = () => {
{
id: 2,
name: 'Service registration',
- // FIXME Pass here the 'registering.domain' field from the context
- // FIXME Pass here the 'registering.token' field from the context
- component: ,
+ component: ,
canJumpTo: canJumpPage2,
},
{
id: 3,
name: 'Service details',
// FIXME Pass here the 'registering.domain' field from the context
- component: ,
+ component: (
+
+ ),
canJumpTo: canJumpPage3,
},
{
@@ -172,7 +223,15 @@ const WizardPage = () => {
-
+
>