Skip to content

Commit

Permalink
Merge branch 'v2.x/staging' of https://github.com/zowe/zen into revie…
Browse files Browse the repository at this point in the history
…wPage/tests
  • Loading branch information
sagaryadavs committed Jun 4, 2024
2 parents 2c82762 + e1b7a09 commit f11b018
Show file tree
Hide file tree
Showing 23 changed files with 2,188 additions and 167 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ Node version 18.12 or higher is required.

### Developing

Note: `npm run start` may succeed without errors, but `npm run make` will not. It is always advised to run `npm run make` after writing new code, or using the build automation to view errors

Run `npm install` to install dependencies

Run `npm run start` to run the application locally
Expand Down
8 changes: 7 additions & 1 deletion src/actions/InstallActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* Copyright Contributors to the Zowe Project.
*/

import { InstallationArgs } from '../types/stateInterfaces';
import { IIpcConnectionArgs, IResponse } from '../types/interfaces';
import { FTPInstallation, CLIInstallation } from './InstallationHandler';

Expand Down Expand Up @@ -42,7 +43,7 @@ export class InstallActions {

runInstallation (
connectionArgs: IIpcConnectionArgs,
installationArgs: {installationDir: string, installationType: string, userUploadedPaxPath: string},
installationArgs: InstallationArgs,
version: string, zoweConfig: any, skipDownload: boolean): Promise<IResponse> {
return this.strategy.runInstallation(connectionArgs, installationArgs, version, zoweConfig, skipDownload);
}
Expand All @@ -52,6 +53,11 @@ export class InstallActions {
return this.strategy.initSecurity(connectionArgs, installationArgs, zoweConfig);
}

initVsam(connectionArgs: IIpcConnectionArgs,
installationArgs: {installationDir: string, installationType: string}, zoweConfig: object): Promise<IResponse> {
return this.strategy.initVsam(connectionArgs, installationArgs, zoweConfig);
}

apfAuth(connectionArgs: IIpcConnectionArgs,
installationArgs: {installationDir: string, installationType: string}, zoweConfig: object): Promise<IResponse> {
return this.strategy.apfAuth(connectionArgs, installationArgs, zoweConfig);
Expand Down
201 changes: 177 additions & 24 deletions src/actions/InstallationHandler.ts

Large diffs are not rendered by default.

24 changes: 21 additions & 3 deletions src/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ const createWindow = (): void => {
});

ipcMain.handle('get-config', async (event) => {
const res: any = await PlanningActions.getConfig();
return res;
const res: any = await ConfigurationStore.getConfig();
return {status: true, details: res};
});

ipcMain.handle('set-schema', async (event, schema: any) => {
Expand All @@ -102,6 +102,12 @@ const createWindow = (): void => {
});


ipcMain.handle('get-schema', async (event, schema: any) => {
const res: any = await ConfigurationStore.getSchema();
return {status: true, details: res};
});


ipcMain.handle('get-config-by-key', async (_event, key: string) => {
const res = await ConfigurationStore.getConfigByKey(key);
return res;
Expand All @@ -112,6 +118,11 @@ const createWindow = (): void => {
return res;
});

ipcMain.handle('set-config-by-key-no-validate', async (_event, key: string, value) => {
const res = await ConfigurationStore.setConfigByKeyNoValidate(key, value);
return res;
});

ipcMain.handle('get-zowe-version', async () => {
const res = await PlanningActions.getZoweVersion();
return res;
Expand Down Expand Up @@ -184,13 +195,20 @@ const createWindow = (): void => {
return res;
});

ipcMain.handle('init-vsam', async (event, connectionArgs, installationArgs, zoweConfig) => {
const res = await installActions.initVsam(connectionArgs, installationArgs, zoweConfig);
return res;
});

ipcMain.handle('get-init-security-progress', async () => {
const res = ProgressStore.getAll()['initSecurity'];
return res;
});


ipcMain.handle('get-init-vsam-progress', async () => {
const res = ProgressStore.getAll()['initVsam'];
return res;
});

const menuBuilder = new MenuBuilder(mainWindow);
menuBuilder.buildMenu();
Expand Down
19 changes: 15 additions & 4 deletions src/renderer/components/common/Stepper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@ export default function HorizontalLinearStepper({stages, initialization}:{stages
completeProgress.reviewStatus
];

const subStageProgressStatus = [
const [subStageProgressStatus, setProgressStatus] = useState([
completeProgress.datasetInstallationStatus,
completeProgress.networkingStatus,
completeProgress.apfAuthStatus,
completeProgress.securityStatus,
completeProgress.certificateStatus,
completeProgress.launchConfigStatus
]
])

const TYPE_YAML = "yaml";
const TYPE_JCL = "jcl";
Expand All @@ -76,9 +76,18 @@ export default function HorizontalLinearStepper({stages, initialization}:{stages
const [editorContent, setEditorContent] = useState('');

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 @@ -169,7 +178,9 @@ export default function HorizontalLinearStepper({stages, initialization}:{stages

setActiveStep(newActiveStep);
const newSubStep = isSubStep ? subStepIndex : 0;
setActiveSubStep(newSubStep);
if((subStepIndex > 0 && subStageProgressStatus[0] === true) || subStepIndex === 0){ //only allow substages after installation to be navigated to if init mvs has been completed
setActiveSubStep(newSubStep);
}
}

const getStepIcon = (error: any, stageId: number, isSubStep?: boolean, subStepId?: number) => {
Expand Down Expand Up @@ -309,7 +320,7 @@ export default function HorizontalLinearStepper({stages, initialization}:{stages
}
{stages[activeStep] && stages[activeStep].isSkippable &&
<Button
disabled={isNextStepEnabled}
disabled={stages[activeStep] && stages[activeStep].subStages ? !stages[activeStep].subStages[activeSubStep].isSkippable : !stages[activeStep].isSkippable}
variant="contained"
sx={{ textTransform: 'none', mr: 1 }}
onClick={() => handleSkip()}
Expand Down
11 changes: 8 additions & 3 deletions src/renderer/components/configuration-wizard/Wizard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,24 @@ import { selectLoading } from './wizardSlice';
import { useAppSelector } from '../../hooks';
import InitApfAuth from '../stages/InitApfAuth';
import Networking from '../stages/Networking';
import Vsam from '../stages/Vsam';
import LaunchConfig from '../stages/LaunchConfig';
import { getProgress } from '../stages/progress/StageProgressStatus';

const mvsDatasetInitProgress = getProgress('datasetInstallationStatus');

export const stages = [
{id: 0, label: 'Connection', component: <Connection/>, hasJCL: false, isSkippable: false, isSkipped: false, hasOutput: false, steps: 1, nextButton: 'Continue', statusKey: 'connectionStatus'},
{id: 1, label: 'Planning', component: <Planning/>, hasJCL: false, isSkippable: false, isSkipped: false, hasOutput: true, steps: 3, nextButton: 'Continue to Installation Options', statusKey: 'planningStatus'},
{id: 2, label: 'Installation Type', component: <InstallationType/>, hasJCL: false, isSkippable: false, isSkipped: false, hasOutput: false, steps: 1, nextButton: 'Continue to Components Installation', statusKey: 'installationTypeStatus'},
{id: 3, label: 'Initialization', component: <Initialization/>, hasJCL: true, isSkippable: true, isSkipped: false, hasYaml: true, hasOutput: true, steps: 1, subStages: [
{id: 0, label: 'Installation', component: <Installation/>, hasJCL: true, isSkippable: true, isSkipped: false, hasYaml: true, hasOutput: true, steps: 1, nextButton: 'Continue to Network Setup', statusKey: 'datasetInstallationStatus'},
{id: 0, label: 'Installation', component: <Installation/>, hasJCL: true, isSkippable: mvsDatasetInitProgress ?? false, isSkipped: false, hasYaml: true, hasOutput: true, steps: 1, nextButton: 'Continue to Network Setup', statusKey: 'datasetInstallationStatus'},
{id: 1, label: 'Networking', component: <Networking/>, hasJCL: true, isSkippable: true, isSkipped: false, hasYaml: true, hasOutput: true, steps: 1, nextButton: 'Continue to APF Auth Setup', statusKey: 'networkingStatus'},
{id: 2, label: 'APF Auth', component: <InitApfAuth/>, hasJCL: true, isSkippable: true, isSkipped: false, hasYaml: true, hasOutput: true, steps: 1, nextButton: 'Continue to Security Setup', statusKey: 'apfAuthStatus'},
{id: 3, label: 'Security', component: <Security/>, hasJCL: true, isSkippable: true, isSkipped: false, hasYaml: true, hasOutput: true, steps: 1, nextButton: 'Continue to Certificates Setup', statusKey: 'securityStatus'},
{id: 4, label: 'Certificates', component: <Certificates/>, hasJCL: true, isSkippable: true, isSkipped: false, hasYaml: true, hasOutput: true, steps: 1, nextButton: 'Continue to Launch Setup', statusKey: 'certificateStatus'},
{id: 5, label: 'Launch Config', component: <LaunchConfig/>, hasJCL: true, isSkippable: true, isSkipped: false, hasYaml: true, hasOutput: true, steps: 1, nextButton: 'Continue to Instance Setup', statusKey: 'launchConfigStatus'},
{id: 4, label: 'Certificates', component: <Certificates/>, hasJCL: true, isSkippable: true, isSkipped: false, hasYaml: true, hasOutput: true, steps: 1, nextButton: 'Continue to Vsam Setup', statusKey: 'certificateStatus'},
{id: 5, label: 'Vsam', component: <Vsam/>, hasJCL: true, isSkippable: true, isSkipped: false, hasYaml: true, hasOutput: true, steps: 1, nextButton: 'Continue to Launch Setup', statusKey: 'vsamStatus'},
{id: 6, label: 'Launch Config', component: <LaunchConfig/>, hasJCL: true, isSkippable: true, isSkipped: false, hasYaml: true, hasOutput: true, steps: 1, nextButton: 'Continue to Instance Setup', statusKey: 'launchConfigStatus'},
], nextButton: 'Review', statusKey: 'initializationStatus'},
{id: 4, label: 'Review Installation', component: <ReviewInstallation/>, hasJCL: false, isSkippable: false, hasOutput: false, steps: 1, nextButton: 'Finish Installation', statusKey: 'reviewStatus'},
{id: 5, label: 'Finish Installation', component: <FinishInstallation/>, hasJCL: false, isSkippable: false, isSkipped: false, hasOutput: false, steps: 1, statusKey: 'finishStatus'},
Expand Down
4 changes: 4 additions & 0 deletions src/renderer/components/configuration-wizard/wizardSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

import { createSlice, PayloadAction } from '@reduxjs/toolkit';
import { RootState } from '../../store';
import { IResponse } from '../../../types/interfaces';

interface WizardState {
loading: boolean;
Expand Down Expand Up @@ -39,6 +40,9 @@ export const wizardSlice = createSlice({
},
setYaml: (state, action: PayloadAction<any>) => {
state.yaml = action.payload;
window.electron.ipcRenderer.setConfig(action.payload).then((res: IResponse) => {
// Response
});
},
setSchema: (state, action: PayloadAction<any>) => {
state.schema = action.payload;
Expand Down
35 changes: 29 additions & 6 deletions src/renderer/components/stages/Certificates.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { useState, useEffect } from "react";
import { Box, Button, FormControl } from '@mui/material';
import { useAppSelector, useAppDispatch } from '../../hooks';
import { setSecurityStatus, setInitializationStatus, selectCertificateStatus, setCertificateStatus, selectInitializationStatus } from './progress/progressSlice';
import { selectYaml, selectSchema, setNextStepEnabled, setYaml } from '../configuration-wizard/wizardSlice';
import { selectYaml, selectSchema, setNextStepEnabled, setYaml, setSchema } from '../configuration-wizard/wizardSlice';
import ContainerCard from '../common/ContainerCard';
import JsonForm from '../common/JsonForms';
import EditorDialog from "../common/EditorDialog";
Expand All @@ -28,6 +28,7 @@ import { setActiveStep } from "./progress/activeStepSlice";
import { getStageDetails, getSubStageDetails } from "../../../utils/StageDetails";
import { setProgress, getProgress, setCertificateInitState, getCertificateInitState, mapAndSetSkipStatus, getInstallationArguments } from "./progress/StageProgressStatus";
import { CertInitSubStepsState } from "../../../types/stateInterfaces";
import { FALLBACK_YAML, FALLBACK_SCHEMA } from "../../..//utils/yamlSchemaDefaults";

const Certificates = () => {

Expand All @@ -41,7 +42,7 @@ const Certificates = () => {
const SUB_STAGE_ID = SUB_STAGES ? getSubStageDetails(STAGE_ID, subStageLabel).id : 0;

const dispatch = useAppDispatch();
const schema = useAppSelector(selectSchema);
const [schema, setLocalSchema] = useState(useAppSelector(selectSchema));
const [yaml, setLYaml] = useState(useAppSelector(selectYaml));
const connectionArgs = useAppSelector(selectConnectionArgs);
const installationArgs = getInstallationArguments();
Expand Down Expand Up @@ -88,6 +89,29 @@ const Certificates = () => {

useEffect(() => {

if(!yaml){
window.electron.ipcRenderer.getConfig().then((res: IResponse) => {
if (res.status) {
dispatch(setYaml(res.details));
setLYaml(res.details);
} else {
dispatch(setYaml(FALLBACK_YAML));
setLYaml(FALLBACK_YAML);
}
})
}

if(!schema){
window.electron.ipcRenderer.getSchema().then((res: IResponse) => {
if (res.status) {
dispatch(setSchema(res.details));
} else {
dispatch(setSchema(FALLBACK_SCHEMA));
setLocalSchema(FALLBACK_SCHEMA)
}
})
}

if(getProgress('certificateStatus')) {
const nextPosition = document.getElementById('start-certificate-progress');
nextPosition.scrollIntoView({ behavior: 'smooth', block: 'start' });
Expand Down Expand Up @@ -125,7 +149,6 @@ const Certificates = () => {
}

if(showProgress) {
console.log('security: if progress');
const nextPosition = document.getElementById('start-certificate-progress');
nextPosition?.scrollIntoView({ behavior: 'smooth', block: 'start' });
}
Expand Down Expand Up @@ -187,7 +210,7 @@ const Certificates = () => {
setInitClicked(true);
updateProgress(false);
event.preventDefault();
window.electron.ipcRenderer.initCertsButtonOnClick(connectionArgs, installationArgs, (await window.electron.ipcRenderer.getConfig()).details.config ?? yaml).then((res: IResponse) => {
window.electron.ipcRenderer.initCertsButtonOnClick(connectionArgs, installationArgs, (await window.electron.ipcRenderer.getConfig()).details ?? yaml).then((res: IResponse) => {
updateProgress(res.status);
clearInterval(timer);
}).catch(() => {
Expand Down Expand Up @@ -263,7 +286,7 @@ const Certificates = () => {
</Box>
<ContainerCard title="Certificates" description="Configure Zowe Certificates.">
{editorVisible && <EditorDialog contentType={contentType} isEditorVisible={editorVisible} toggleEditorVisibility={toggleEditorVisibility} onChange={handleFormChange}/> }
<Box sx={{ width: '60vw' }} onBlur={async () => dispatch(setYaml((await window.electron.ipcRenderer.getConfig()).details.config ?? yaml))}>
<Box sx={{ width: '60vw' }} onBlur={async () => dispatch(setYaml((await window.electron.ipcRenderer.getConfig()).details ?? yaml))}>
{!isFormValid && <div style={{color: 'red', fontSize: 'small', marginBottom: '20px'}}>{formError}</div>}
<JsonForm schema={setupSchema} onChange={handleFormChange} formData={setupYaml}/>
<JsonForm schema={verifyCertsSchema} onChange={handleVerifyCertsChange} formData={verifyCertsYaml}/>
Expand All @@ -281,7 +304,7 @@ const Certificates = () => {
</React.Fragment>
}
</Box>
<Box sx={{ height: showProgress ? '30vh' : 'auto', minHeight: showProgress ? '30vh' : '10vh' }} id="certificate-progress"></Box>
<Box sx={{ height: showProgress ? '40vh' : 'auto', minHeight: showProgress ? '40vh' : '10vh' }} id="certificate-progress"></Box>
</ContainerCard>
</div>
);
Expand Down
32 changes: 28 additions & 4 deletions src/renderer/components/stages/InitApfAuth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import React, {useEffect, useState} from "react";
import { Box, Button, FormControl, TextField, Typography } from '@mui/material';
import { useAppSelector, useAppDispatch } from '../../hooks';
import { selectYaml, selectSchema, setNextStepEnabled, setLoading } from '../configuration-wizard/wizardSlice';
import { selectYaml, selectSchema, setNextStepEnabled, setLoading, setYaml, setSchema } from '../configuration-wizard/wizardSlice';
import { selectConnectionArgs } from './connection/connectionSlice';
import { setApfAuthStatus, setInitializationStatus, selectApfAuthStatus, selectInitializationStatus } from './progress/progressSlice';
import { IResponse } from '../../../types/interfaces';
Expand All @@ -26,6 +26,7 @@ import { setActiveStep, selectActiveStepIndex, selectActiveSubStepIndex, selectI
import { getStageDetails, getSubStageDetails } from "../../../utils/StageDetails";
import { setProgress, getProgress, setApfAuthState, getApfAuthState, mapAndSetSkipStatus, getInstallationArguments } from "./progress/StageProgressStatus";
import { InitSubStepsState } from "../../../types/stateInterfaces";
import { FALLBACK_SCHEMA, FALLBACK_YAML } from "../../../utils/yamlSchemaDefaults";

const InitApfAuth = () => {

Expand All @@ -45,8 +46,8 @@ const InitApfAuth = () => {
const activeSubStepIndex = useAppSelector(selectActiveSubStepIndex);

const dispatch = useAppDispatch();
const schema = useAppSelector(selectSchema);
const yaml = useAppSelector(selectYaml);
const [schema, setLocalSchema] = useState(useAppSelector(selectSchema));
const [yaml, setLYaml] = useState(useAppSelector(selectYaml));
const connectionArgs = useAppSelector(selectConnectionArgs);
const setupSchema = schema?.properties?.zowe?.properties?.setup?.properties?.dataset;
const [setupYaml, setSetupYaml] = useState(yaml?.zowe?.setup?.dataset);
Expand Down Expand Up @@ -82,6 +83,29 @@ const InitApfAuth = () => {
const isInitializationSkipped = !useAppSelector(selectInitializationStatus);

useEffect(() => {
if(!yaml){
window.electron.ipcRenderer.getConfig().then((res: IResponse) => {
if (res.status) {
dispatch(setYaml(res.details));
setLYaml(res.details);
} else {
dispatch(setYaml(FALLBACK_YAML));
setLYaml(FALLBACK_YAML);
}
})
}

if(!schema){
window.electron.ipcRenderer.getSchema().then((res: IResponse) => {
if (res.status) {
dispatch(setSchema(res.details));
} else {
dispatch(setSchema(FALLBACK_SCHEMA));
setLocalSchema(FALLBACK_SCHEMA);
}
})
}

let nextPosition;
if(getProgress('apfAuthStatus')) {
nextPosition = document.getElementById('start-apf-progress');
Expand Down Expand Up @@ -292,7 +316,7 @@ const InitApfAuth = () => {
</React.Fragment>
}
</Box>
<Box sx={{ height: showProgress ? '55vh' : 'auto', minHeight: '30vh' }} id="apf-progress"></Box>
<Box sx={{ height: showProgress ? '60vh' : 'auto', minHeight: '60vh' }} id="apf-progress"></Box>
</ContainerCard>
</div>

Expand Down
14 changes: 14 additions & 0 deletions src/renderer/components/stages/LaunchConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import { getStageDetails, getSubStageDetails } from "../../../utils/StageDetails
import { stages } from "../configuration-wizard/Wizard";
import { selectInitializationStatus } from "./progress/progressSlice";
import { setActiveStep } from "./progress/activeStepSlice";
import { FALLBACK_YAML } from "../../../utils/yamlSchemaDefaults";
import { IResponse } from "../../..//types/interfaces";

const LaunchConfig = () => {

Expand Down Expand Up @@ -453,6 +455,18 @@ const LaunchConfig = () => {
const isInitializationSkipped = !useAppSelector(selectInitializationStatus);

useEffect(() => {

if(!yaml){
window.electron.ipcRenderer.getConfig().then((res: IResponse) => {
if (res.status) {
dispatch(setYaml(res.details));
setLYaml(res.details);
} else {
dispatch(setYaml(FALLBACK_YAML));
setLYaml(FALLBACK_YAML);
}
})
}
const nextPosition = document.getElementById('container-box-id');
nextPosition.scrollIntoView({behavior: 'smooth'});

Expand Down
Loading

0 comments on commit f11b018

Please sign in to comment.