Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HMS-2590 fix: align wizard page 2 and 3 #5

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api
212 changes: 106 additions & 106 deletions src/Api/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<RequestArgs> => {
// 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,
Expand Down Expand Up @@ -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<DomainResponse>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.updateDomainUser(uuid, updateDomainUserRequest, xRhInsightsRequestId, options);
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
},
};
};

Expand Down Expand Up @@ -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<DomainResponse> {
return localVarFp.updateDomainUser(uuid, updateDomainUserRequest, xRhInsightsRequestId, options).then((request) => request(axios, basePath));
},
};
};

Expand Down Expand Up @@ -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));
}
}

/**
Expand Down Expand Up @@ -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<RequestArgs> => {
// 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,
Expand Down Expand Up @@ -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<DomainResponse>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.updateDomainUser(uuid, updateDomainUserRequest, xRhInsightsRequestId, options);
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
},
};
};

Expand Down Expand Up @@ -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<DomainResponse> {
return localVarFp.updateDomainUser(uuid, updateDomainUserRequest, xRhInsightsRequestId, options).then((request) => request(axios, basePath));
},
};
};

Expand Down Expand Up @@ -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));
}
}
54 changes: 48 additions & 6 deletions src/AppContext.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,62 @@
import { createContext } from 'react';
import { Domain } from './Api';
import { VerifyState } from './Routes/WizardPage/Components/VerifyRegistry/VerifyRegistry';

/**
* It represents the application context so common events and properties
* are shared for many components, making their values accessible.
* @public
*/
export interface IAppContext {
/** Represent the current list of domains to be displayed in the listDomains view. */
domains: Domain[];
/** Callback to set the value of `domains`. */
setDomains: (domains: Domain[]) => void;
// wizardDomain?: Domain;
// setWizardDomain: (domain?: Domain) => void;
/** Encapsulates the context related with the wizard. */
wizard: {
/** Retrieve the current token, required to register a domain. */
getToken: () => string;
/** Set the value of the token. */
setToken: (value: string) => void;
/** Retrieve the value of the registered status which is updated once
* the user has registered the domain by using ipa-hcc tool. */
getRegisteredStatus: () => VerifyState;
/** Setter for the registered status. */
setRegisteredStatus: (value: VerifyState) => void;
/** Get the ephemeral domain state that manage the wizard. */
getDomain: () => Domain;
/** Set the ephemeral domain information. */
setDomain: (value: Domain) => void;
};
}

/**
* Represent the application context.
* @public
*/
export const AppContext = createContext<IAppContext>({
domains: [],
setDomains: (domains: Domain[]) => {
throw new Error('Function "setDomains" not implemented: domains=' + domains);
},
// wizardDomain: undefined,
// setWizardDomain: (domain?: Domain) => {
// throw new Error('Function "setWizardDomain" not implemented: domain=' + domain);
// },
wizard: {
getToken: (): string => {
return '';
},
setToken: (value: string) => {
throw new Error('Function "setToken" not implemented: value=' + value);
},
getRegisteredStatus: (): VerifyState => {
return 'initial';
},
setRegisteredStatus: (value: VerifyState) => {
throw new Error('Function "setRegisteredStatus" not implemented: value=' + value);
},
getDomain: (): Domain => {
return {} as Domain;
},
setDomain: (value: Domain) => {
throw new Error('Function "setDomain" not implemented: value=' + value);
},
},
});
41 changes: 39 additions & 2 deletions src/AppEntry.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState } from 'react';
import React, { useContext, useState } from 'react';
import { BrowserRouter as Router } from 'react-router-dom';
import { Provider } from 'react-redux';
import { init } from './store';
Expand All @@ -7,16 +7,53 @@ import { getBaseName } from '@redhat-cloud-services/frontend-components-utilitie
import logger from 'redux-logger';
import { AppContext } from './AppContext';
import { Domain } from './Api';
import { VerifyState } from './Routes/WizardPage/Components/VerifyRegistry/VerifyRegistry';

const AppEntry = () => {
const appContext = useContext(AppContext);
const [domains, setDomains] = useState<Domain[]>([]);
const [wizardToken, setWizardToken] = useState<string>('');
const [wizardDomain, setWizardDomain] = useState<Domain>({} as Domain);
const [wizardRegisterStatus, setWizardRegisterStatus] = useState<VerifyState>('initial');
const cbSetDomains = (domains: Domain[]) => {
appContext.domains = domains;
setDomains(domains);
};
const cbGetWizardToken = (): string => {
return wizardToken;
};
const cbSetWizardToken = (value: string) => {
setWizardToken(value);
};
const cbGetWizardDomain = (): Domain => {
return wizardDomain;
};
const cbSetWizardDomain = (value: Domain) => {
setWizardDomain(value);
};
const cbGetRegisterStatus = (): VerifyState => {
return wizardRegisterStatus;
};
const cbSetRegisterStatus = (value: VerifyState) => {
setWizardRegisterStatus(value);
};
return (
<Provider store={init(...(process.env.NODE_ENV !== 'production' ? [logger] : [])).getStore()}>
<Router basename={getBaseName(window.location.pathname)}>
<AppContext.Provider value={{ domains: domains, setDomains: cbSetDomains }}>
<AppContext.Provider
value={{
domains: domains,
setDomains: cbSetDomains,
wizard: {
getToken: cbGetWizardToken,
setToken: cbSetWizardToken,
getRegisteredStatus: cbGetRegisterStatus,
setRegisteredStatus: cbSetRegisterStatus,
getDomain: cbGetWizardDomain,
setDomain: cbSetWizardDomain,
},
}}
>
<App />
</AppContext.Provider>
</Router>
Expand Down
Loading