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

Major Refactor #180

Merged
merged 139 commits into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
139 commits
Select commit Hold shift + click to select a range
dc4e101
Updating editor no longer crashes Zen. Updating components now update…
timgerstel Jun 10, 2024
7610db6
More robust conditional
timgerstel Jun 11, 2024
8f01cc6
Update stage status when uploading yaml
timgerstel Jun 11, 2024
e0de281
Ideally this would be its own separate component but overhead with th…
timgerstel Jun 11, 2024
46de0b7
Disallow non numeric input
timgerstel Jun 11, 2024
2383b00
Merge branch 'v2.x/staging' into bugfix/externalDomainsAndYaml
timgerstel Jun 11, 2024
e5b5ce3
Add error notification for failed yaml upload. Set state false if fail
timgerstel Jun 11, 2024
ed32d1e
Remove console log
timgerstel Jun 11, 2024
f49f088
Bulk commit because i need to check staging for something
timgerstel Jun 12, 2024
82f5dd5
No longer set schema and config on EVERY single stage. Schema, config…
timgerstel Jun 12, 2024
1558d04
Better AJV implementation
timgerstel Jun 12, 2024
0660889
use useState
timgerstel Jun 12, 2024
f05d9d7
useState
timgerstel Jun 12, 2024
989cbe3
Update verbage
timgerstel Jun 12, 2024
3427101
Update initialization status properly when all substages are complete
timgerstel Jun 13, 2024
91f3e9b
Reset stage status when uploading yaml
timgerstel Jun 13, 2024
0dd8f70
Fix crash on first run of Zen, fix installation args not setting pero…
timgerstel Jun 13, 2024
e88acf3
Original fallback schema is needed because of AJVs inability to resol…
timgerstel Jun 13, 2024
85a3672
Fix schema errors
timgerstel Jun 13, 2024
08f2b40
Fix init apf auth weird scrolling
timgerstel Jun 13, 2024
6d5eeee
Fix launch config status resetting
timgerstel Jun 13, 2024
107c0e5
Fix edge case of zowe.job not being set??? shouldnt be possible
timgerstel Jun 13, 2024
4a4c3e5
Fix installation type not being saved
timgerstel Jun 13, 2024
d4aa580
remove console logs
timgerstel Jun 13, 2024
461530f
Use correct installation args
timgerstel Jun 13, 2024
4d2afc5
Add button to retrieve example-zowe.yaml and schemas when using SMPE …
timgerstel Jun 13, 2024
cb79379
Always use installation args
timgerstel Jun 13, 2024
a5a0e24
Rewrite all of pattern properties so port input doesnt jump to end lol
timgerstel Jun 13, 2024
a989023
Fix next button:
timgerstel Jun 13, 2024
eeec11a
Dont extract files to installationDir/runtime, just extact to install…
timgerstel Jun 13, 2024
9b599a0
fix wrong dir for unpax
timgerstel Jun 13, 2024
772d922
fix unpax relative path again lol
timgerstel Jun 13, 2024
1ce019b
add missing bin part of dir
timgerstel Jun 13, 2024
c284b1d
Dont change schema id
timgerstel Jun 13, 2024
fb287ea
Remove unused var
timgerstel Jun 13, 2024
9f8917e
set additional properties true because schema seems to need updating
timgerstel Jun 13, 2024
78f4cef
Fix externaldomains non existent
timgerstel Jun 13, 2024
48b0dcd
Fix scrolling on apf auth
timgerstel Jun 13, 2024
e35e98b
Fix vsam page not updating yaml
timgerstel Jun 13, 2024
b4ce1e1
Retrieve example-yaml and schemas when skipping unpax if runtime file…
timgerstel Jun 14, 2024
5553ebb
Fix typo
timgerstel Jun 14, 2024
b44f47b
Implement sergei's file downloading method for fetching example-zowe.…
timgerstel Jun 14, 2024
ab09e8a
Each stage will only compile its own part of the schema with ajv. Fix…
timgerstel Jun 14, 2024
1249eb4
Reduce duplication of example-yaml + schema fetch
timgerstel Jun 14, 2024
a9b839c
userUploadedPaxPath not persisting for some reason???
timgerstel Jun 14, 2024
1dfab9d
Remove unused imports, wrap more global component vars in useState, f…
timgerstel Jun 14, 2024
f851550
Fetch example-zowe.yaml and schemas when skipping upload as well
timgerstel Jun 14, 2024
0096a9c
Fix name undefined during unpax
timgerstel Jun 14, 2024
ddc35f2
Remove unused args from init functions. Remove getConfig call from ip…
timgerstel Jun 14, 2024
fc9c91c
Deep merge of current config and example-zowe.yaml, big thank you to …
timgerstel Jun 14, 2024
353b049
Fix typo
timgerstel Jun 14, 2024
61e03cd
Remveo consoe log
timgerstel Jun 14, 2024
bceeef0
Add spacing to pattern match titles
timgerstel Jun 14, 2024
bdf96ff
Merge remote-tracking branch 'origin/v2.x/staging' into fullRewrite
timgerstel Jun 14, 2024
7073bbb
Fix typos
timgerstel Jun 14, 2024
13c52f6
Add error to log message
timgerstel Jun 14, 2024
955ea29
Fix setting of installationArgs
timgerstel Jun 14, 2024
58fbdf7
Update networking status to false on change
timgerstel Jun 14, 2024
c877ecd
Fix scrolling on apf auth stage
timgerstel Jun 14, 2024
48718a7
Scrolling fixes
timgerstel Jun 14, 2024
6cb9b25
Remove unused imports
timgerstel Jun 14, 2024
d9e0c44
Remove unused imports
timgerstel Jun 14, 2024
77ab59e
Fix ui error when typing invalid dir on planning
timgerstel Jun 14, 2024
85aeaa6
Merge remote-tracking branch 'origin/v2.x/staging' into fullRewrite
timgerstel Jun 14, 2024
e641fee
Return false on error
timgerstel Jun 14, 2024
b392b3e
Set state false when validating locations:
timgerstel Jun 14, 2024
d318a82
Fix makeDir infinite loop with invalid dir
timgerstel Jun 14, 2024
3d89036
Add error message for failure
timgerstel Jun 14, 2024
901e592
Use correct installation args
timgerstel Jun 14, 2024
b27ec70
Remove installationArgs from editor
timgerstel Jun 17, 2024
05d0133
Fix verify certs not updating in yaml
timgerstel Jun 17, 2024
1447dac
Add error popup to certificates stage
timgerstel Jun 17, 2024
0c22f63
Format output
timgerstel Jun 17, 2024
ed6b5bf
Fix typo, this might not even make the outputl ook good anyway
timgerstel Jun 17, 2024
e87fb3a
Fetch updated yaml after init certificate
timgerstel Jun 17, 2024
7649fc6
Set updated yaml from --update-config flag if it exists
timgerstel Jun 17, 2024
0adc288
Deep merge object
timgerstel Jun 17, 2024
b7a3b2b
Fix runtime error
timgerstel Jun 17, 2024
4f91714
Update import
timgerstel Jun 17, 2024
8e780c2
Move updatedYaml logic to correct location
timgerstel Jun 17, 2024
02b6a19
Update init status on app start
timgerstel Jun 17, 2024
37a90af
Unset because New Installtion is supposed to reset the state anyway s…
timgerstel Jun 17, 2024
a95dfbd
Proper merging
timgerstel Jun 17, 2024
78e1777
Remove yaml downloading
timgerstel Jun 17, 2024
7869a06
Fix yaml download logic
timgerstel Jun 17, 2024
6c2c9ce
Move parsing into try catch
timgerstel Jun 17, 2024
09834eb
Do not store password
timgerstel Jun 17, 2024
fa8886f
Reset state on new install
timgerstel Jun 17, 2024
2b5ab07
Remove comment but i still believe this setter to be redundant
timgerstel Jun 17, 2024
f72226f
Merge remote-tracking branch 'origin/v2.x/staging' into fullRewrite
timgerstel Jun 18, 2024
543762a
Better error handling for init certificate failure
timgerstel Jun 18, 2024
f2f0ecb
Better error handling for init mvs
timgerstel Jun 18, 2024
3b104f5
certificate -> mvs
timgerstel Jun 18, 2024
9180578
Add error handling for init apfauth, remove redundant console.warn
timgerstel Jun 18, 2024
fff1709
Better error handling for security
timgerstel Jun 18, 2024
61c6200
Reset stc stage on new installation
timgerstel Jun 18, 2024
738b6f0
Better error handling for init stc
timgerstel Jun 18, 2024
d79c021
Better error handling for init vsam
timgerstel Jun 18, 2024
9318d4b
Merge branch 'v2.x/staging' into fullRewrite
timgerstel Jun 20, 2024
e03f261
Update tag script for yaml
timgerstel Jun 20, 2024
ca17edd
use filePath
timgerstel Jun 20, 2024
cdebefe
Does it need a tag first??
timgerstel Jun 20, 2024
d5a0704
Fix status resetting when going back from a successful install
timgerstel Jun 20, 2024
ad31f8e
Fix apf auth status not resetting on re init
timgerstel Jun 20, 2024
7ff580f
Move status reset logic
timgerstel Jun 20, 2024
d0ffc07
Why dont any of these onClicks work
timgerstel Jun 20, 2024
ed4776f
Fix tagging script
timgerstel Jun 20, 2024
f270746
Better conditional for showing error
timgerstel Jun 20, 2024
b9e7548
Properly update certificate section after init certificate
timgerstel Jun 20, 2024
60ef912
Update local yaml as well
timgerstel Jun 20, 2024
046af97
Yaml still wasnt updating properly in zen:
timgerstel Jun 20, 2024
8ac5bb6
Flip order of base/extension?
timgerstel Jun 20, 2024
281b48f
Fix yaml setting issue
timgerstel Jun 21, 2024
542cf80
Deep merge caused issue w array to yaml conversion
timgerstel Jun 21, 2024
0b2ba8c
Set local yaml to wrong section but doesnt even need to be set
timgerstel Jun 21, 2024
fb2486c
Revert create recursive dirs + add edgecase
DivergentEuropeans Jun 24, 2024
338585e
Added a stop recursion flag for bad permissions edgecase
DivergentEuropeans Jun 24, 2024
4394cad
Merge pull request #194 from zowe/fix-recursive-dirs
timgerstel Jun 24, 2024
79f5420
Only create runtime dir
timgerstel Jun 25, 2024
725cc3f
Fix typo
timgerstel Jun 25, 2024
3f56a11
Fix yaml being out of sync on cert stage
timgerstel Jun 25, 2024
4e02307
Reset certificates status on input change
timgerstel Jun 25, 2024
b08f8df
Remove status checks for workspace, log, extension dir as zen will no…
timgerstel Jun 25, 2024
c0b0893
New installation now resets state properly
timgerstel Jun 25, 2024
bbfe3b6
Dont load last state if isResume
timgerstel Jun 25, 2024
de7835e
Increase editor width and height
timgerstel Jun 25, 2024
968458f
Merge branch 'v2.x/staging' into fullRewrite
timgerstel Jun 26, 2024
4f8f067
Reset values on new install
timgerstel Jun 26, 2024
b098fdd
Fix error for undefined object
timgerstel Jun 26, 2024
9ec8658
Reset counter properly + don't forget the current char
DivergentEuropeans Jun 26, 2024
f20c239
Remove comments
DivergentEuropeans Jun 26, 2024
4564ee3
Merge pull request #198 from zowe/bugfix/script-parsing
timgerstel Jun 26, 2024
e70a664
Another small edgecase
DivergentEuropeans Jun 26, 2024
0ea3670
Merge pull request #199 from zowe/bugfix/script-parsing
timgerstel Jun 26, 2024
82a4149
Fix undefined port
timgerstel Jun 26, 2024
65519fd
Add worpWrap
timgerstel Jun 26, 2024
2091fee
Fix job output, mostly
timgerstel Jun 26, 2024
8dc51a5
Dont store password
timgerstel Jun 26, 2024
02878ec
Only wordwrap non yaml output
timgerstel Jun 27, 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
4 changes: 4 additions & 0 deletions src/actions/InstallActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ export class InstallActions {
return this.strategy.uploadLatestYaml(connectionArgs, installationArgs);
}

smpeGetExampleYamlAndSchemas(connectionArgs: IIpcConnectionArgs, installArgs: InstallationArgs): Promise<IResponse> {
return this.strategy.smpeGetExampleYamlAndSchemas(connectionArgs, installArgs);
}

initStcs(connectionArgs: IIpcConnectionArgs,
installationArgs: InstallationArgs, zoweConfig: object): Promise<IResponse> {
return this.strategy.initStcs(connectionArgs, installationArgs, zoweConfig);
Expand Down
199 changes: 138 additions & 61 deletions src/actions/InstallationHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { ProgressStore } from "../storage/ProgressStore";
import * as fs from 'fs';
import { ConfigurationStore } from '../storage/ConfigurationStore';
import { InstallationArgs } from '../types/stateInterfaces';
import { FALLBACK_SCHEMA } from '../renderer/components/common/Constants';

function removeRuntimeFromPath(path: string)
{
Expand Down Expand Up @@ -50,12 +51,143 @@ class Installation {
if(!uploadYaml.status){
return {status: false, details: `Error uploading yaml configuration: ${uploadYaml.details}`};
}
return {status: true, details: "upload yaml success"};
return {status: true, details: "Successfully uploaded yaml config"};
} catch (error) {
return {status: false, details: error.message};
}
}

parseExampleYamlFromPax = function(catPath: string, yaml: any){
const jobOutputSplit = JSON.stringify(yaml).split(`cat ${catPath}\\r\\n`)
if(jobOutputSplit[1]){
const trimmedYamlSchema = jobOutputSplit[1].split(`+ echo 'Script finished.'`)[0].split(`Script finished.`);
// console.log("\n\n *** trimmedYamlSchema[0]: ", trimmedYamlSchema[0].replaceAll(`\\r\\n`, `\r\n`).replaceAll(`\\"`, `"`));
return trimmedYamlSchema[0].replaceAll(`\\r\\n`, `\r\n`).replaceAll(`\\"`, `"`);
}
return "";
}

parseSchemaFromPax = function(inputString: string, catPath: string){
const jobOutputSplit = inputString.split(`cat ${catPath}\\r\\n`)
if(jobOutputSplit[1]){
const trimmedYamlSchema = jobOutputSplit[1].split(`Script finished.`)[0].split(`Script finished.`);
// console.log("trimmed schema:", trimmedYamlSchema[0].replaceAll(`\\r\\n`, `\r\n`).replaceAll(`\\"`, `"`).replaceAll(`\\\\"`, `\\"`))
return trimmedYamlSchema[0].replaceAll(`\\r\\n`, `\r\n`).replaceAll(`\\"`, `"`).replaceAll(`\\\\"`, `\\"`);
}
return "";
}

mergeYamlAndInstallationArgs = function(yamlObj: any, installationArgs: InstallationArgs){
if (installationArgs.installationDir) {
yamlObj.zowe.runtimeDirectory = installationArgs.installationDir;
}
if (installationArgs.workspaceDir) {
yamlObj.zowe.workspaceDirectory = installationArgs.workspaceDir;
}
if (installationArgs.logDir) {
yamlObj.zowe.logDirectory = installationArgs.logDir;
}
if (installationArgs.extensionDir) {
yamlObj.zowe.extensionDirectory = installationArgs.extensionDir;
}
if (installationArgs.rbacProfile) {
yamlObj.zowe.rbacProfileIdentifier = installationArgs.rbacProfile;
}
if (installationArgs.jobName) {
yamlObj.zowe.job.name = installationArgs.jobName;
}
if (installationArgs.jobPrefix) {
yamlObj.zowe.job.prefix = installationArgs.jobPrefix;
}
if (installationArgs.cookieId) {
yamlObj.zowe.cookieIdentifier = installationArgs.cookieId;
}
if (installationArgs.javaHome) {
yamlObj.java.home = installationArgs.javaHome;
}
if (installationArgs.nodeHome) {
yamlObj.node.home = installationArgs.nodeHome;
}
if (installationArgs.zosmfHost) {
yamlObj.zOSMF.host = installationArgs.zosmfHost;
}
if (installationArgs.zosmfPort) {
yamlObj.zOSMF.port = installationArgs.zosmfPort;
}
if (installationArgs.zosmfApplId) {
yamlObj.zOSMF.applId = installationArgs.zosmfApplId;
}
}

public async smpeGetExampleYamlAndSchemas (
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is different about smpe installation schemas to have this code separately?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very good point, i changed it to reuse this function in the downloadUnpax function to reduce duplication

connectionArgs: IIpcConnectionArgs,
installationArgs: InstallationArgs,
): Promise<IResponse> {
try{
const currentConfig: any = ConfigurationStore.getConfig();
let yamlObj
const zoweRuntimePath = installationArgs.installationDir;
let readPaxYamlAndSchema = await this.readExampleYamlAndSchema(connectionArgs, zoweRuntimePath);
let parsedSchema = false, parsedYaml = false;
if(readPaxYamlAndSchema.details.yaml){
const yamlFromPax = this.parseExampleYamlFromPax(`${zoweRuntimePath}/example-zowe.yaml`, readPaxYamlAndSchema.details.yaml);
if(yamlFromPax){
try {
yamlObj = parse(yamlFromPax);
if (currentConfig) {
// console.log("currentConfig: ", JSON.stringify(currentConfig));
yamlObj = Object.assign({}, currentConfig, yamlObj);
}
this.mergeYamlAndInstallationArgs(yamlObj, installationArgs);
// console.log('Setting merged yaml:', JSON.stringify(yamlObj));
ConfigurationStore.setConfig(yamlObj);
ProgressStore.set('downloadUnpax.getExampleYaml', true);
parsedYaml = true;
} catch(e) {
console.log('error parsing example-zowe.yaml:', e);
ProgressStore.set('downloadUnpax.getExampleYaml', false);
return {status: false, details: {message: e.message}}
}
} else {
console.log("no yaml found from pax");
ProgressStore.set('downloadUnpax.getExampleYaml', false);
return {status: false, details: {message: "no yaml found from pax"}}
}

//No reason not to always set schema to latest if user is re-running installation
if(readPaxYamlAndSchema.details.yamlSchema && readPaxYamlAndSchema.details.serverCommon){
try {
let yamlSchema = JSON.parse(this.parseSchemaFromPax(JSON.stringify(readPaxYamlAndSchema.details.yamlSchema), `${zoweRuntimePath}/schemas/zowe-yaml-schema.json`));
const serverCommon = JSON.parse(this.parseSchemaFromPax(JSON.stringify(readPaxYamlAndSchema.details.serverCommon), `${zoweRuntimePath}/schemas/server-common.json`));
if(yamlSchema && serverCommon){
yamlSchema.additionalProperties = true;
yamlSchema.properties.zowe.properties.setup.properties.dataset.properties.parmlibMembers.properties.zis = serverCommon.$defs.datasetMember;
yamlSchema.properties.zowe.properties.setup.properties.certificate.properties.pkcs12.properties.directory = serverCommon.$defs.path;
if(yamlSchema.$defs?.networkSettings?.properties?.server?.properties?.listenAddresses?.items){
delete yamlSchema.$defs?.networkSettings?.properties?.server?.properties?.listenAddresses?.items?.ref;
yamlSchema.$defs.networkSettings.properties.server.properties.listenAddresses.items = serverCommon.$defs.ipv4
}
// console.log('Setting schema from runtime dir:', JSON.stringify(yamlSchema));
ConfigurationStore.setSchema(yamlSchema);
parsedSchema = true;
ProgressStore.set('downloadUnpax.getSchemas', true);
}
} catch (e) {
console.log('error setting schema from pax:', e);
ProgressStore.set('downloadUnpax.getSchemas', false);
ConfigurationStore.setSchema(FALLBACK_SCHEMA);
return {status: false, details: {message: e.message}}
}
}
return {status: parsedSchema && parsedYaml, details: {message: "Successfully retrieved example-zowe.yaml and schemas", mergedYaml: yamlObj}}
}
} catch (e) {
ConfigurationStore.setSchema(FALLBACK_SCHEMA);
return {status: false, details: e.message};
}

}

public async downloadUnpax (
connectionArgs: IIpcConnectionArgs,
installationArgs: InstallationArgs,
Expand Down Expand Up @@ -140,64 +272,17 @@ class Installation {
let readPaxYamlAndSchema = await this.readExampleYamlAndSchema(connectionArgs, zoweRuntimePath);
let parsedSchema = false, parsedYaml = false;
if(readPaxYamlAndSchema.details.yaml){
const parseExampleYamlFromPax = function(catPath: string){
const jobOutputSplit = JSON.stringify(readPaxYamlAndSchema.details.yaml).split(`cat ${catPath}\\r\\n`)
if(jobOutputSplit[1]){
const trimmedYamlSchema = jobOutputSplit[1].split(`+ echo 'Script finished.'`)[0].split(`Script finished.`);
// console.log("\n\n *** trimmedYamlSchema[0]: ", trimmedYamlSchema[0].replaceAll(`\\r\\n`, `\r\n`).replaceAll(`\\"`, `"`));
return trimmedYamlSchema[0].replaceAll(`\\r\\n`, `\r\n`).replaceAll(`\\"`, `"`);
}
return "";
}
const yamlFromPax = parseExampleYamlFromPax(`${zoweRuntimePath}/example-zowe.yaml`);
const yamlFromPax = this.parseExampleYamlFromPax(`${zoweRuntimePath}/example-zowe.yaml`, readPaxYamlAndSchema.details.yaml);
if(yamlFromPax){
try {
yamlObj = parse(yamlFromPax);
if (currentConfig) {
// console.log("current config:", JSON.stringify(currentConfig));
// console.log("yamlObj: ", JSON.stringify(yamlObj));
yamlObj = {...currentConfig, ...yamlObj}
yamlObj = yamlObj = Object.assign({}, yamlObj, currentConfig);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a typo

// console.log("merged yamlObj: ", JSON.stringify(yamlObj));
}
if (yamlObj.zowe.runtimeDirectory === undefined && installationArgs.installationDir) {
yamlObj.zowe.runtimeDirectory = installationArgs.installationDir;
}
if (yamlObj.zowe.workspaceDirectory === undefined && installationArgs.workspaceDir) {
yamlObj.zowe.workspaceDirectory = installationArgs.workspaceDir;
}
if (yamlObj.zowe.logDirectory === undefined && installationArgs.logDir) {
yamlObj.zowe.logDirectory = installationArgs.logDir;
}
if (yamlObj.zowe.extensionDirectory === undefined && installationArgs.extensionDir) {
yamlObj.zowe.extensionDirectory = installationArgs.extensionDir;
}
if (yamlObj.zowe.rbacProfileIdentifier === undefined && installationArgs.rbacProfile) {
yamlObj.zowe.rbacProfileIdentifier = installationArgs.rbacProfile;
}
if (yamlObj.zowe.job.name === undefined && installationArgs.jobName) {
yamlObj.zowe.job.name = installationArgs.jobName;
}
if (yamlObj.zowe.job.prefix === undefined && installationArgs.jobPrefix) {
yamlObj.zowe.job.prefix = installationArgs.jobPrefix;
}
if (yamlObj.zowe.cookieIdentifier === undefined && installationArgs.cookieId) {
yamlObj.zowe.cookieIdentifier = installationArgs.cookieId;
}
if (yamlObj.java.home === undefined && installationArgs.javaHome) {
yamlObj.java.home = installationArgs.javaHome;
}
if (yamlObj.node.home === undefined && installationArgs.nodeHome) {
yamlObj.node.home = installationArgs.nodeHome;
}
if (yamlObj.zOSMF.host === undefined && installationArgs.zosmfHost) {
yamlObj.zOSMF.host = installationArgs.zosmfHost;
}
if (yamlObj.zOSMF.port === undefined && installationArgs.zosmfPort) {
yamlObj.zOSMF.port = installationArgs.zosmfPort;
}
if (yamlObj.zOSMF.applId === undefined && installationArgs.zosmfApplId) {
yamlObj.zOSMF.applId = installationArgs.zosmfApplId;
}
this.mergeYamlAndInstallationArgs(yamlObj, installationArgs);
Copy link
Collaborator

@skurnevich skurnevich Jun 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason why we do this merge with installationArgs values one by one, if it should have been done a line above with yamlObj = Object.assign({}, yamlObj, currentConfig);
Is there a case when currentConfig will not exist?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At one point, during the very first run of Zen current config did not exist. I haven't confirmed this behavior in a while but in my head i dont think it should ever not exist currently.

if (zoweConfig) {
yamlObj = {...yamlObj, ...zoweConfig};
}
Expand All @@ -215,17 +300,9 @@ class Installation {

//No reason not to always set schema to latest if user is re-running installation
if(readPaxYamlAndSchema.details.yamlSchema && readPaxYamlAndSchema.details.serverCommon){
const parseSchemaFromPax = function(inputString: string, catPath: string){
const jobOutputSplit = inputString.split(`cat ${catPath}\\r\\n`)
if(jobOutputSplit[1]){
const trimmedYamlSchema = jobOutputSplit[1].split(`Script finished.`)[0].split(`Script finished.`);
return trimmedYamlSchema[0].replaceAll(`\\r\\n`, `\r\n`).replaceAll(`\\"`, `"`).replaceAll(`\\\\"`, `\\"`);
}
return "";
}
try {
let yamlSchema = JSON.parse(parseSchemaFromPax(JSON.stringify(readPaxYamlAndSchema.details.yamlSchema), `${zoweRuntimePath}/schemas/zowe-yaml-schema.json`));
const serverCommon = JSON.parse(parseSchemaFromPax(JSON.stringify(readPaxYamlAndSchema.details.serverCommon), `${zoweRuntimePath}/schemas/server-common.json`));
let yamlSchema = JSON.parse(this.parseSchemaFromPax(JSON.stringify(readPaxYamlAndSchema.details.yamlSchema), `${zoweRuntimePath}/schemas/zowe-yaml-schema.json`));
const serverCommon = JSON.parse(this.parseSchemaFromPax(JSON.stringify(readPaxYamlAndSchema.details.serverCommon), `${zoweRuntimePath}/schemas/server-common.json`));
// console.log('yaml schema:', parseSchemas(JSON.stringify(readPaxYamlAndSchema.details.yamlSchema), `${zoweRuntimePath}/schemas/zowe-yaml-schema.json`));
// console.log('server common', parseSchemas(JSON.stringify(readPaxYamlAndSchema.details.serverCommon), `${zoweRuntimePath}/schemas/server-common.json`));
if(yamlSchema && serverCommon){
Expand Down
6 changes: 5 additions & 1 deletion src/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ const createWindow = (): void => {
return res;
});


ipcMain.handle('get-schema', async (event, schema: any) => {
const res: any = await ConfigurationStore.getSchema();
return {status: true, details: res};
Expand Down Expand Up @@ -205,6 +204,11 @@ const createWindow = (): void => {
return res;
});

ipcMain.handle('get-yaml-schema', async (event, connectionArgs, installationArgs) => {
const res = await installActions.smpeGetExampleYamlAndSchemas(connectionArgs, installationArgs);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this be called "getExampleYamlAndSchemas"

I only see this used in 2 places, 1 in Stepper which is conditional to not SMPE and 2 in
Unpax step which is also not SMPE

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure

return res;
});

ipcMain.handle('init-certificates', async (event, connectionArgs, installationArgs, zoweConfig) => {
const res = await installActions.runInitCertificates(connectionArgs, installationArgs, zoweConfig);
return res;
Expand Down
45 changes: 42 additions & 3 deletions src/renderer/components/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import flatten, { unflatten } from 'flat';
import { IResponse, IIpcConnectionArgs } from '../../types/interfaces';
import { setConnectionArgs, setResumeProgress, selectInitJobStatement } from './stages/connection/connectionSlice';
import { setJobStatement } from './stages/PlanningSlice';
import { setZoweCLIVersion } from './configuration-wizard/wizardSlice';
import { selectSchema, selectYaml, setSchema, setYaml, setZoweCLIVersion } from './configuration-wizard/wizardSlice';
import { useAppDispatch, useAppSelector } from '../hooks';
import { Tooltip } from '@mui/material';
import installationImg from '../assets/installation.png'
Expand All @@ -28,8 +28,9 @@ import HorizontalLinearStepper from './common/Stepper';
import Wizard from './configuration-wizard/Wizard'
import Connection from './stages/connection/Connection';
import { ActiveState } from '../../types/stateInterfaces';
import { getPreviousInstallation } from './stages/progress/StageProgressStatus';
import { DEF_NO_OUTPUT } from './common/Constants';
import { getInstallationArguments, getPreviousInstallation } from './stages/progress/StageProgressStatus';
import { DEF_NO_OUTPUT, FALLBACK_SCHEMA, FALLBACK_YAML } from './common/Constants';
import { selectInstallationArgs, setInstallationArgs } from './stages/installation/installationSlice';

// REVIEW: Get rid of routing

Expand Down Expand Up @@ -90,6 +91,8 @@ const Home = () => {
const connectionStatus = useAppSelector(selectConnectionStatus);
const [showWizard, setShowWizard] = useState(false);
const [showLoginDialog, setShowLogin] = useState(false);
const [yaml] = useState(useAppSelector(selectYaml));
const [schema, setLocalSchema] = useState(useAppSelector(selectSchema));

const { activeStepIndex, isSubStep, activeSubStepIndex, lastActiveDate } = getPreviousInstallation();

Expand All @@ -109,6 +112,42 @@ const Home = () => {
eventDispatcher.on('saveAndCloseEvent', () => setShowWizard(false));



//Home is the first screen the user will always see 100% of the time. Therefore, we will call the loading of the configs, schemas, and installation args here and set them to the redux memory states
DivergentEuropeans marked this conversation as resolved.
Show resolved Hide resolved

//YAML LOADING - necessary for editor state as well as form values
if(!yaml == undefined || (typeof yaml === "object" && Object.keys(yaml).length === 0)){
window.electron.ipcRenderer.getConfig().then((res: IResponse) => {
if (res.status) {
dispatch(setYaml(res.details));
} else {
dispatch(setYaml(FALLBACK_YAML));
}
})
}

//SCHEMA LOADING - necessary for JsonForms
if(schema == undefined || (typeof schema === "object" && Object.keys(yaml).length === 0)){
window.electron.ipcRenderer.getSchema().then((res: IResponse) => {
if (res.status && res.details !== undefined) {
dispatch(setSchema(res.details));
} else {
dispatch(setSchema(FALLBACK_SCHEMA));
}
})
}

//Load installation args
window.electron.ipcRenderer.getConfigByKey("installationArgs").then((res: IResponse) => {
if(res != undefined){
dispatch(setInstallationArgs(res));
} else {
dispatch(setInstallationArgs({...getInstallationArguments()}));
}
})



window.electron.ipcRenderer.checkZoweCLI().then((res: IResponse) => {
if (res.status) {
dispatch(setZoweCLIVersion(res.details));
Expand Down
Loading
Loading