Wizard: send template name in image request
This commit is contained in:
parent
00438ce2dc
commit
854ff93594
3 changed files with 23 additions and 2 deletions
|
|
@ -20,6 +20,7 @@ import {
|
||||||
selectDistribution,
|
selectDistribution,
|
||||||
selectTemplate,
|
selectTemplate,
|
||||||
changeTemplate,
|
changeTemplate,
|
||||||
|
changeTemplateName,
|
||||||
} from '../../../../../store/wizardSlice';
|
} from '../../../../../store/wizardSlice';
|
||||||
import { releaseToVersion } from '../../../../../Utilities/releaseToVersion';
|
import { releaseToVersion } from '../../../../../Utilities/releaseToVersion';
|
||||||
import { Error } from '../../Repositories/components/Error';
|
import { Error } from '../../Repositories/components/Error';
|
||||||
|
|
@ -53,10 +54,16 @@ const Templates = () => {
|
||||||
{ refetchOnMountOrArgChange: 60 }
|
{ refetchOnMountOrArgChange: 60 }
|
||||||
);
|
);
|
||||||
|
|
||||||
const handleRowSelect = (templateUuid: string | undefined): void => {
|
const handleRowSelect = (
|
||||||
|
templateUuid: string | undefined,
|
||||||
|
templateName: string | undefined
|
||||||
|
): void => {
|
||||||
if (templateUuid) {
|
if (templateUuid) {
|
||||||
dispatch(changeTemplate(templateUuid));
|
dispatch(changeTemplate(templateUuid));
|
||||||
}
|
}
|
||||||
|
if (templateName) {
|
||||||
|
dispatch(changeTemplateName(templateName));
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handlePerPageSelect = (
|
const handlePerPageSelect = (
|
||||||
|
|
@ -123,7 +130,7 @@ const Templates = () => {
|
||||||
variant: 'radio',
|
variant: 'radio',
|
||||||
isSelected: uuid === templateUuid,
|
isSelected: uuid === templateUuid,
|
||||||
rowIndex: rowIndex,
|
rowIndex: rowIndex,
|
||||||
onSelect: () => handleRowSelect(uuid),
|
onSelect: () => handleRowSelect(uuid, name),
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<Td dataLabel={'Name'}>{name}</Td>
|
<Td dataLabel={'Name'}>{name}</Td>
|
||||||
|
|
|
||||||
|
|
@ -87,6 +87,7 @@ import {
|
||||||
selectMetadata,
|
selectMetadata,
|
||||||
selectFirewall,
|
selectFirewall,
|
||||||
selectTemplate,
|
selectTemplate,
|
||||||
|
selectTemplateName,
|
||||||
selectSatelliteCaCertificate,
|
selectSatelliteCaCertificate,
|
||||||
selectSatelliteRegistrationCommand,
|
selectSatelliteRegistrationCommand,
|
||||||
selectModules,
|
selectModules,
|
||||||
|
|
@ -307,6 +308,7 @@ function commonRequestToState(
|
||||||
useLatest: !snapshot_date && !request.image_requests[0]?.content_template,
|
useLatest: !snapshot_date && !request.image_requests[0]?.content_template,
|
||||||
snapshotDate: snapshot_date,
|
snapshotDate: snapshot_date,
|
||||||
template: request.image_requests[0]?.content_template || '',
|
template: request.image_requests[0]?.content_template || '',
|
||||||
|
templateName: request.image_requests[0]?.content_template_name || '',
|
||||||
},
|
},
|
||||||
repositories: {
|
repositories: {
|
||||||
customRepositories: request.customizations?.custom_repositories || [],
|
customRepositories: request.customizations?.custom_repositories || [],
|
||||||
|
|
@ -457,6 +459,7 @@ const getImageRequests = (state: RootState): ImageRequest[] => {
|
||||||
const snapshotDate = selectSnapshotDate(state);
|
const snapshotDate = selectSnapshotDate(state);
|
||||||
const useLatest = selectUseLatest(state);
|
const useLatest = selectUseLatest(state);
|
||||||
const template = selectTemplate(state);
|
const template = selectTemplate(state);
|
||||||
|
const templateName = selectTemplateName(state);
|
||||||
return imageTypes.map((type) => ({
|
return imageTypes.map((type) => ({
|
||||||
architecture: selectArchitecture(state),
|
architecture: selectArchitecture(state),
|
||||||
image_type: type,
|
image_type: type,
|
||||||
|
|
@ -466,6 +469,7 @@ const getImageRequests = (state: RootState): ImageRequest[] => {
|
||||||
},
|
},
|
||||||
snapshot_date: !useLatest && !template ? snapshotDate : undefined,
|
snapshot_date: !useLatest && !template ? snapshotDate : undefined,
|
||||||
content_template: template || undefined,
|
content_template: template || undefined,
|
||||||
|
content_template_name: templateName || undefined,
|
||||||
}));
|
}));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -130,6 +130,7 @@ export type wizardState = {
|
||||||
useLatest: boolean;
|
useLatest: boolean;
|
||||||
snapshotDate: string;
|
snapshotDate: string;
|
||||||
template: string;
|
template: string;
|
||||||
|
templateName: string;
|
||||||
};
|
};
|
||||||
users: UserWithAdditionalInfo[];
|
users: UserWithAdditionalInfo[];
|
||||||
firstBoot: {
|
firstBoot: {
|
||||||
|
|
@ -226,6 +227,7 @@ export const initialState: wizardState = {
|
||||||
useLatest: true,
|
useLatest: true,
|
||||||
snapshotDate: '',
|
snapshotDate: '',
|
||||||
template: '',
|
template: '',
|
||||||
|
templateName: '',
|
||||||
},
|
},
|
||||||
repositories: {
|
repositories: {
|
||||||
customRepositories: [],
|
customRepositories: [],
|
||||||
|
|
@ -398,6 +400,10 @@ export const selectTemplate = (state: RootState) => {
|
||||||
return state.wizard.snapshotting.template;
|
return state.wizard.snapshotting.template;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const selectTemplateName = (state: RootState) => {
|
||||||
|
return state.wizard.snapshotting.templateName;
|
||||||
|
};
|
||||||
|
|
||||||
export const selectCustomRepositories = (state: RootState) => {
|
export const selectCustomRepositories = (state: RootState) => {
|
||||||
return state.wizard.repositories.customRepositories;
|
return state.wizard.repositories.customRepositories;
|
||||||
};
|
};
|
||||||
|
|
@ -751,6 +757,9 @@ export const wizardSlice = createSlice({
|
||||||
changeTemplate: (state, action: PayloadAction<string>) => {
|
changeTemplate: (state, action: PayloadAction<string>) => {
|
||||||
state.snapshotting.template = action.payload;
|
state.snapshotting.template = action.payload;
|
||||||
},
|
},
|
||||||
|
changeTemplateName: (state, action: PayloadAction<string>) => {
|
||||||
|
state.snapshotting.templateName = action.payload;
|
||||||
|
},
|
||||||
importCustomRepositories: (
|
importCustomRepositories: (
|
||||||
state,
|
state,
|
||||||
action: PayloadAction<CustomRepository[]>
|
action: PayloadAction<CustomRepository[]>
|
||||||
|
|
@ -1156,6 +1165,7 @@ export const {
|
||||||
changeUseLatest,
|
changeUseLatest,
|
||||||
changeSnapshotDate,
|
changeSnapshotDate,
|
||||||
changeTemplate,
|
changeTemplate,
|
||||||
|
changeTemplateName,
|
||||||
changeCustomRepositories,
|
changeCustomRepositories,
|
||||||
importCustomRepositories,
|
importCustomRepositories,
|
||||||
changePayloadRepositories,
|
changePayloadRepositories,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue