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

Regression Fix + Refine Status Updates + Resolve Edge Cases + Code Cleanup #193

Merged
merged 75 commits into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from 74 commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
8e22060
Updating the stepper
sakshibobade21 Jun 18, 2024
79cff23
Passthrough
sakshibobade21 Jun 18, 2024
4481676
Merge remote-tracking branch 'origin' into regression/vsam-status
sakshibobade21 Jun 20, 2024
7354763
Merge branch 'v2.x/staging' into regression/vsam-status
timgerstel Jun 21, 2024
f86dfc4
regression fix
sakshibobade21 Jun 24, 2024
9a47a73
Merge branch 'regression/vsam-status' of https://github.com/zowe/zen …
sakshibobade21 Jun 24, 2024
4f7ca4b
Updating the stepper icon logic
sakshibobade21 Jun 25, 2024
f756077
Removing the space
sakshibobade21 Jun 25, 2024
46d5142
Updating the interface name
sakshibobade21 Jun 25, 2024
214427a
indendations
sakshibobade21 Jun 25, 2024
2161a8b
Updating the stepper
sakshibobade21 Jun 26, 2024
5ab1fb4
Updating the dataset instllation
sakshibobade21 Jun 26, 2024
0fb7d12
Removing the eventlisterner
sakshibobade21 Jun 26, 2024
539b606
Handling edge cases for instllation
sakshibobade21 Jun 26, 2024
25f111d
code cleanup
sakshibobade21 Jun 26, 2024
4937dcb
Updating the substep skip array
sakshibobade21 Jun 26, 2024
5da1eff
Removing error prop
sakshibobade21 Jun 26, 2024
58702ea
Removing error attr
sakshibobade21 Jun 27, 2024
8573f1d
Adding some coditions
sakshibobade21 Jun 27, 2024
47dbe7f
Updating the consitions
sakshibobade21 Jun 27, 2024
2fe4b8a
Merge remote-tracking branch 'origin' into regression/vsam-status
sakshibobade21 Jun 27, 2024
10dff9f
Bugfix
sakshibobade21 Jun 27, 2024
15a3fa4
Updating progress in edge cases
sakshibobade21 Jun 27, 2024
32a7632
Fixing the status of the networking and the launch config stage
sakshibobade21 Jun 27, 2024
5d89775
merging conflicts
sakshibobade21 Jun 28, 2024
c10f623
updating unpax stage
sakshibobade21 Jul 2, 2024
5761825
merging
sakshibobade21 Jul 2, 2024
32c820d
Code cleanup
sakshibobade21 Jul 3, 2024
f9c9543
Optimizing installation
sakshibobade21 Jul 3, 2024
d0da7f6
Optimizing the apf auth
sakshibobade21 Jul 3, 2024
09ea010
optimizing the certs
sakshibobade21 Jul 3, 2024
52db7dd
Updating the vsam stage
sakshibobade21 Jul 3, 2024
100cd29
optimizing the security stage
sakshibobade21 Jul 3, 2024
0dcfd07
updating stcs
sakshibobade21 Jul 3, 2024
7f6ad0d
Updating the progress slice
sakshibobade21 Jul 3, 2024
7df8753
Updating the launch config and the network state
sakshibobade21 Jul 3, 2024
e87c70a
Updating the progress slice
sakshibobade21 Jul 3, 2024
770dfbc
Updating the launch config
sakshibobade21 Jul 3, 2024
da1f59c
Complete code cleanup for the unpax stage
sakshibobade21 Jul 3, 2024
7ec4f9a
minor cleanuo
sakshibobade21 Jul 3, 2024
6659c79
code fix
sakshibobade21 Jul 3, 2024
1475c72
Code cleanup
sakshibobade21 Jul 3, 2024
f91ccbc
More cleanup
sakshibobade21 Jul 3, 2024
41e3fad
Updating the substages logic
sakshibobade21 Jul 3, 2024
b9987fd
code cleanup for review instllation
sakshibobade21 Jul 3, 2024
db4f4a9
updating networking stage
sakshibobade21 Jul 3, 2024
95f7d69
Code renaming
sakshibobade21 Jul 3, 2024
ad16570
Updating the security code
sakshibobade21 Jul 4, 2024
4407652
Updating the stcs stage
sakshibobade21 Jul 4, 2024
e4edd33
Updating the certificates stage
sakshibobade21 Jul 4, 2024
55c544d
Updating the vsam stage
sakshibobade21 Jul 4, 2024
25dd906
Updating the initapfauth stage
sakshibobade21 Jul 4, 2024
5bf59d7
Updating the stepper to update the skip button anabling logic
sakshibobade21 Jul 4, 2024
e3101cb
Updating the unpax stage
sakshibobade21 Jul 4, 2024
9435c7e
More updates to stcs stage
sakshibobade21 Jul 4, 2024
eb12bb2
Some more updates to stcs stage
sakshibobade21 Jul 4, 2024
4c7ada5
Updating the installation stage
sakshibobade21 Jul 4, 2024
153d67f
unpax stage bugfix
sakshibobade21 Jul 4, 2024
bb6bff4
More changes to the stepper
sakshibobade21 Jul 4, 2024
4c22f0a
More changes to all substages
sakshibobade21 Jul 4, 2024
52992d7
Updates to the unpax stage
sakshibobade21 Jul 4, 2024
0d85a04
Updating the stepper
sakshibobade21 Jul 4, 2024
7e572b9
Updating the edge cases
sakshibobade21 Jul 5, 2024
5f4cf0a
Restoring the status
sakshibobade21 Jul 6, 2024
8428b1b
Updating the init apf auth stage
sakshibobade21 Jul 6, 2024
074f8ca
Updating the init mvs stage
sakshibobade21 Jul 6, 2024
4279728
Updating all the substages
sakshibobade21 Jul 6, 2024
3cce19c
Updating the pax stage
sakshibobade21 Jul 6, 2024
14ce741
Updating the review installation stage
sakshibobade21 Jul 8, 2024
5ce79db
Updating the unpax
sakshibobade21 Jul 8, 2024
44f38f2
Merging with the dry ru code
sakshibobade21 Jul 8, 2024
3b65a96
Updating the indtallation type stage
sakshibobade21 Jul 9, 2024
41ba368
Merging with staging
sakshibobade21 Jul 9, 2024
58032d6
Merge remote-tracking branch 'origin' into regression/vsam-status
sakshibobade21 Jul 15, 2024
9f80f94
Merging with staging
sakshibobade21 Aug 8, 2024
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
33 changes: 9 additions & 24 deletions src/renderer/components/common/Stepper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ import eventDispatcher from '../../../services/eventDispatcher';
import Warning from '@mui/icons-material/Warning';
import CheckCircle from '@mui/icons-material/CheckCircle';
import { TYPE_YAML, TYPE_OUTPUT, TYPE_JCL, INIT_STAGE_LABEL, REVIEW_INSTALL_STAGE_LABEL, UNPAX_STAGE_LABEL } from '../common/Utils';
import { getProgress, getCompleteProgress, mapAndSetSkipStatus, mapAndGetSkipStatus } from '../stages/progress/StageProgressStatus';

import { getProgress, getCompleteProgress, updateSubStepSkipStatus, updateStepSkipStatus } from '../stages/progress/StageProgressStatus';
import '../../styles/Stepper.css';
import { StepIcon } from '@mui/material';
import { getStageDetails } from '../../../services/StageDetails';
Expand Down Expand Up @@ -57,7 +56,7 @@ export default function HorizontalLinearStepper({stages, initialization}:{stages
completeProgress.reviewStatus
];

const [subStageProgressStatus, setProgressStatus] = useState([
const [subStageProgressStatus, setSubStageProgressStatus] = useState([
completeProgress.datasetInstallationStatus,
completeProgress.networkingStatus,
completeProgress.apfAuthStatus,
Expand All @@ -67,8 +66,6 @@ export default function HorizontalLinearStepper({stages, initialization}:{stages
completeProgress.launchConfigStatus
])



const [activeStep, setActiveStep] = initialization ? useState(0) : useState(useAppSelector(selectActiveStepIndex));
const [activeSubStep, setActiveSubStep] = initialization ? useState(0) : useState(useAppSelector(selectActiveSubStepIndex));
const [nextText, setNextText] = useState("Continue");
Expand All @@ -80,18 +77,9 @@ export default function HorizontalLinearStepper({stages, initialization}:{stages
const dispatch = useAppDispatch();

useEffect(() => {
const mvsCompleteListener = (completed: boolean) => {
setProgressStatus([true, completeProgress.networkingStatus,
completeProgress.apfAuthStatus,
completeProgress.securityStatus,
completeProgress.certificateStatus,
completeProgress.launchConfigStatus])
};
eventDispatcher.on('updateActiveStep', updateActiveStepListener);
eventDispatcher.on('initMvsComplete', mvsCompleteListener);
return () => {
eventDispatcher.off('updateActiveStep', updateActiveStepListener);
eventDispatcher.off('initMvsComplete', mvsCompleteListener);
};
}, []);

Expand Down Expand Up @@ -129,9 +117,10 @@ export default function HorizontalLinearStepper({stages, initialization}:{stages

const handleSkip = async () => {
stages[activeStep].isSkipped = true;
updateStepSkipStatus(activeStep, true);
if(stages[activeStep].subStages){
stages[activeStep].subStages[activeSubStep].isSkipped = true;
mapAndSetSkipStatus(activeSubStep, true);
updateSubStepSkipStatus(activeSubStep, true);
}
if(stages[activeStep].label === UNPAX_STAGE_LABEL && installationArgs.installationType != "smpe"){
alertEmitter.emit('showAlert', 'Retrieving example-zowe.yaml and latest schemas from Zowe runtime files...', 'info');
Expand Down Expand Up @@ -200,13 +189,13 @@ export default function HorizontalLinearStepper({stages, initialization}:{stages
}
}

const getStepIcon = (error: any, stageId: number, isSubStep?: boolean, subStepId?: number) => {
const getStepIcon = (stageId: number, isSubStep?: boolean, subStepId?: number) => {

if (!error || (isSubStep && getProgress(stages[stageId].subStages[subStepId].statusKey)) || (!isSubStep && getProgress(stages[stageId].statusKey))) {
if ((isSubStep && getProgress(stages[stageId].subStages[subStepId].statusKey)) || (!isSubStep && ((stageId == 0 && connectionStatus) || (getProgress(stages[stageId].statusKey))))) {
return <StepIcon icon={<CheckCircle sx={{ color: 'green', fontSize: '1.2rem' }} />} />;
}

if ((isSubStep && mapAndGetSkipStatus(subStepId)) || (error && activeStep>stageId && !isSubStep) || (error && isSubStep && stages[stageId].subStages[subStepId].isSkipped)) {
if ((isSubStep && stages[stageId].subStages[subStepId].isSkipped) || (!isSubStep && stages[stageId].isSkipped)) {
return <StepIcon icon={<Warning sx={{ color: 'orange', fontSize: '1.2rem' }} />} />;
}

Expand Down Expand Up @@ -295,9 +284,7 @@ export default function HorizontalLinearStepper({stages, initialization}:{stages
borderTopLeftRadius: '7px',
boxShadow: 'rgb(0 0 0 / 15%) 0px 6px 4px -1px inset'} : {}}>
<StepLabel {...labelProps}
error={labelProps.error}
// icon={labelProps.error ? <Warning sx={{ color: 'orange', fontSize: '1.2rem' }} /> : <CheckCircle sx={{ color: 'green', fontSize: '1.2rem' }} />}>
icon={getStepIcon(labelProps.error, stage.id)}>
icon={getStepIcon(stage.id)}>
<span className="navigator" onClick={() => handleStepperClick(stage.id, !!stage.subStage)}>{stage.label}</span>
</StepLabel>
</div>
Expand All @@ -314,9 +301,7 @@ export default function HorizontalLinearStepper({stages, initialization}:{stages
return (
<Step key={stage.id} {...stepProps}>
<StepLabel {...labelProps}
error={labelProps.error}
// icon={labelProps.error ? <Warning sx={{ color: 'orange', fontSize: '1.2rem' }} /> : <CheckCircle sx={{ color: 'green', fontSize: '1.2rem' }} />}>
icon={getStepIcon(labelProps.error, activeStep, true, index)}>
icon={getStepIcon(activeStep, true, index)}>
<span className="navigator" onClick={() => handleStepperClick(activeStep, true, stage.id )}>{stage.label}</span>
</StepLabel>
</Step>
Expand Down
57 changes: 36 additions & 21 deletions src/renderer/components/stages/Certificates.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Copyright Contributors to the Zowe Project.
*/

import { useState, useEffect } from "react";
import { useState, useEffect, useRef } from "react";
import { Box, Button, FormControl, FormHelperText, MenuItem, Select } from '@mui/material';
import { useAppSelector, useAppDispatch } from '../../hooks';
import { setInitializationStatus, setCertificateStatus } from './progress/progressSlice';
Expand All @@ -24,7 +24,7 @@ import { createTheme } from '@mui/material/styles';
import { stages } from "../configuration-wizard/Wizard";
import { setActiveStep } from "./progress/activeStepSlice";
import { getStageDetails, getSubStageDetails } from "../../../services/StageDetails";
import { getProgress, setCertificateInitState, getCertificateInitState, mapAndSetSkipStatus, getInstallationArguments, isInitComplete } from "./progress/StageProgressStatus";
import { getProgress, setCertificateInitState, getCertificateInitState, updateSubStepSkipStatus, getInstallationArguments, isInitializationStageComplete } from "./progress/StageProgressStatus";
import { CertInitSubStepsState } from "../../../types/stateInterfaces";
import { TYPE_YAML, TYPE_OUTPUT, INIT_STAGE_LABEL, CERTIFICATES_STAGE_LABEL, ajv, deepMerge } from "../common/Utils";

Expand Down Expand Up @@ -54,26 +54,37 @@ const Certificates = () => {
const [stateUpdated, setStateUpdated] = useState(false);
const [initClicked, setInitClicked] = useState(false);
const [reinit, setReinit] = useState(false);
const [stageStatus, setStageStatus] = useState(stages[STAGE_ID].subStages[SUB_STAGE_ID].isSkipped);
const stageStatusRef = useRef(stageStatus);

let timer: any;

const [validate] = useState(() => ajv.getSchema("https://zowe.org/schemas/v2/server-base") || ajv.compile(setupSchema))

useEffect(() => {
dispatch(setInitializationStatus(isInitComplete()));
if(getProgress('certificateStatus')) {
stageStatusRef.current = stageStatus;
}, [stageStatus]);

useEffect(() => {
const stepProgress = getProgress('certificateStatus');

dispatch(setInitializationStatus(isInitializationStageComplete()));
setShowProgress(initClicked || stepProgress);

if(stepProgress) {
const nextPosition = document.getElementById('start-certificate-progress');
nextPosition.scrollIntoView({ behavior: 'smooth', block: 'start' });
} else {
const nextPosition = document.getElementById('container-box-id');
nextPosition.scrollIntoView({behavior: 'smooth'});
}

setShowProgress(initClicked || getProgress('certificateStatus'));
updateProgress(getProgress('certificateStatus'));
dispatch(setNextStepEnabled(stepProgress));

setIsFormInit(true);

return () => {
updateSubStepSkipStatus(SUB_STAGE_ID, stageStatusRef.current);
dispatch(setActiveStep({ activeStepIndex: STAGE_ID, isSubStep: SUB_STAGES, activeSubStepIndex: SUB_STAGE_ID }));
}
}, []);
Expand All @@ -84,6 +95,8 @@ const Certificates = () => {
if(initClicked) {
let nextPosition = document.getElementById('start-certificate-progress');
nextPosition?.scrollIntoView({ behavior: 'smooth', block: 'start' });
dispatchActions(false);
setStateUpdated(!stateUpdated);
}

}, [initClicked]);
Expand All @@ -92,7 +105,10 @@ const Certificates = () => {
if(!getProgress('certificateStatus') && initClicked) {
timer = setInterval(() => {
window.electron.ipcRenderer.getCertificateProgress().then((res: any) => {
setCertificateInitializationProgress(res)
setCertificateInitializationProgress(res);
if(res.success){
clearInterval(timer);
}
})
}, 3000);
}
Expand All @@ -110,8 +126,7 @@ const Certificates = () => {
useEffect(() => {
const allAttributesTrue = Object.values(certificateInitProgress).every(value => value === true);
if(allAttributesTrue) {
dispatch(setNextStepEnabled(true));
dispatch(setCertificateStatus(true));
dispatchActions(true);
setShowProgress(initClicked || getProgress('certificateStatus'));
}
}, [certificateInitProgress]);
Expand All @@ -121,21 +136,18 @@ const Certificates = () => {
setCertificateInitState(certificateInitState);
const allAttributesTrue = Object.values(certificateInitState).every(value => value === true);
if(allAttributesTrue) {
dispatch(setNextStepEnabled(true));
dispatch(setCertificateStatus(true));
dispatchActions(true);
}
}

const setStageSkipStatus = (status: boolean) => {
stages[STAGE_ID].subStages[SUB_STAGE_ID].isSkipped = status;
stages[STAGE_ID].isSkipped = status;
mapAndSetSkipStatus(SUB_STAGE_ID, status);
stages[STAGE_ID].isSkipped = !isInitializationStageComplete();
setStageStatus(status);
}

const updateProgress = (status: boolean) => {
setStateUpdated(!stateUpdated);
setStageSkipStatus(!status);

if(!status) {
for (let key in certificateInitProgress) {
certificateInitProgress[key as keyof(CertInitSubStepsState)] = false;
Expand All @@ -144,10 +156,15 @@ const Certificates = () => {
}
const allAttributesTrue = Object.values(certificateInitProgress).every(value => value === true);
status = allAttributesTrue ? true : false;
dispatch(setNextStepEnabled(status));
dispatch(setInitializationStatus(isInitComplete()));
dispatch(setCertificateStatus(status));
setCertificateInitializationProgress(getCertificateInitState());
dispatchActions(status);
}

const dispatchActions = (status: boolean) => {
dispatch(setCertificateStatus(status));
dispatch(setInitializationStatus(isInitializationStageComplete()));
dispatch(setNextStepEnabled(status));
skurnevich marked this conversation as resolved.
Show resolved Hide resolved
setStageSkipStatus(!status);
}

const reinitialize = (event: any) => {
Expand Down Expand Up @@ -209,8 +226,6 @@ const Certificates = () => {
setIsFormInit(false);

if (newData) {
dispatch(setCertificateStatus(false));

if(validate) {
validate(newData);
if(validate.errors) {
Expand Down Expand Up @@ -260,7 +275,7 @@ const Certificates = () => {
id="demo-simple-select"
value={verifyCerts}
onChange={(e) => {
dispatch(setCertificateStatus(false));
dispatchActions(false);
const newConfig = {...yaml, zowe: {...yaml?.zowe, verifyCertificates: e.target.value, setup: {...yaml.zowe.setup}}};
window.electron.ipcRenderer.setConfig(newConfig);
setLocalYaml(newConfig)
Expand Down
Loading
Loading