Skip to content
This repository has been archived by the owner on Feb 7, 2024. It is now read-only.

Commit

Permalink
closes #116; set RU=undefined after retrieving resources
Browse files Browse the repository at this point in the history
Signed-off-by: JeffinSiby <[email protected]>
  • Loading branch information
JeffinSiby committed Nov 3, 2021
1 parent 7932017 commit 32c0fa8
Show file tree
Hide file tree
Showing 14 changed files with 68 additions and 60 deletions.
9 changes: 5 additions & 4 deletions src/commands/closeLocalFileCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ export function getCloseLocalFileCommand(tree: CICSTree, treeview: TreeView<any>
});
try {
const currentNode = allSelectedNodes[parseInt(index)];
if (currentNode.parentRegion.parentSession.session.ISession.rejectUnauthorized === false) {
https.globalAgent.options.rejectUnauthorized = false;
}

https.globalAgent.options.rejectUnauthorized = currentNode.parentRegion.parentSession.session.ISession.rejectUnauthorized;

await closeLocalFile(
currentNode.parentRegion.parentSession.session,
{
Expand All @@ -62,11 +62,12 @@ export function getCloseLocalFileCommand(tree: CICSTree, treeview: TreeView<any>
},
busyDecision!
);
https.globalAgent.options.rejectUnauthorized = true;
https.globalAgent.options.rejectUnauthorized = undefined;
if (!parentRegions.includes(currentNode.parentRegion)) {
parentRegions.push(currentNode.parentRegion);
}
} catch (err) {
https.globalAgent.options.rejectUnauthorized = undefined;
// @ts-ignore
const mMessageArr = err.mMessage.split(" ").join("").split("\n");
let resp;
Expand Down
9 changes: 5 additions & 4 deletions src/commands/disableLocalFileCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ export function getDisableLocalFileCommand(tree: CICSTree, treeview: TreeView<an
});
try {
const currentNode = allSelectedNodes[parseInt(index)];
if (currentNode.parentRegion.parentSession.session.ISession.rejectUnauthorized === false) {
https.globalAgent.options.rejectUnauthorized = false;
}

https.globalAgent.options.rejectUnauthorized = currentNode.parentRegion.parentSession.session.ISession.rejectUnauthorized;

await disableLocalFile(
currentNode.parentRegion.parentSession.session,
{
Expand All @@ -62,11 +62,12 @@ export function getDisableLocalFileCommand(tree: CICSTree, treeview: TreeView<an
},
busyDecision!
);
https.globalAgent.options.rejectUnauthorized = true;
https.globalAgent.options.rejectUnauthorized = undefined;
if (!parentRegions.includes(currentNode.parentRegion)) {
parentRegions.push(currentNode.parentRegion);
}
} catch (err) {
https.globalAgent.options.rejectUnauthorized = undefined;
// @ts-ignore
window.showErrorMessage(err);
}
Expand Down
8 changes: 4 additions & 4 deletions src/commands/disableProgramCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,8 @@ export function getDisableProgramCommand(tree: CICSTree, treeview: TreeView<any>
try {
const currentNode = allSelectedNodes[parseInt(index)];

if (currentNode.parentRegion.parentSession.session.ISession.rejectUnauthorized === false) {
https.globalAgent.options.rejectUnauthorized = false;
}
https.globalAgent.options.rejectUnauthorized = currentNode.parentRegion.parentSession.session.ISession.rejectUnauthorized;

await disableProgram(
currentNode.parentRegion.parentSession.session,
{
Expand All @@ -57,11 +56,12 @@ export function getDisableProgramCommand(tree: CICSTree, treeview: TreeView<any>
cicsPlex: currentNode.parentRegion.parentPlex ? currentNode.parentRegion.parentPlex.plexName : undefined,
}
);
https.globalAgent.options.rejectUnauthorized = true;
https.globalAgent.options.rejectUnauthorized = undefined;
if (!parentRegions.includes(currentNode.parentRegion)) {
parentRegions.push(currentNode.parentRegion);
}
} catch (err) {
https.globalAgent.options.rejectUnauthorized = undefined;
// @ts-ignore
window.showErrorMessage(err);
}
Expand Down
9 changes: 5 additions & 4 deletions src/commands/disableTransactionCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ export function getDisableTransactionCommand(tree: CICSTree, treeview: TreeView<
});
try {
const currentNode = allSelectedNodes[parseInt(index)];
if (currentNode.parentRegion.parentSession.session.ISession.rejectUnauthorized === false) {
https.globalAgent.options.rejectUnauthorized = false;
}

https.globalAgent.options.rejectUnauthorized = currentNode.parentRegion.parentSession.session.ISession.rejectUnauthorized;

await disableTransaction(
currentNode.parentRegion.parentSession.session,
{
Expand All @@ -56,11 +56,12 @@ export function getDisableTransactionCommand(tree: CICSTree, treeview: TreeView<
cicsPlex: currentNode.parentRegion.parentPlex ? currentNode.parentRegion.parentPlex.plexName : undefined,
}
);
https.globalAgent.options.rejectUnauthorized = true;
https.globalAgent.options.rejectUnauthorized = undefined;
if (!parentRegions.includes(currentNode.parentRegion)) {
parentRegions.push(currentNode.parentRegion);
}
} catch (err) {
https.globalAgent.options.rejectUnauthorized = undefined;
// @ts-ignore
const mMessageArr = err.mMessage.split(" ").join("").split("\n");
let resp;
Expand Down
9 changes: 5 additions & 4 deletions src/commands/enableLocalFileCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ export function getEnableLocalFileCommand(tree: CICSTree, treeview: TreeView<any
});
try {
const currentNode = allSelectedNodes[parseInt(index)];
if (currentNode.parentRegion.parentSession.session.ISession.rejectUnauthorized === false) {
https.globalAgent.options.rejectUnauthorized = false;
}

https.globalAgent.options.rejectUnauthorized = currentNode.parentRegion.parentSession.session.ISession.rejectUnauthorized;

await enableLocalFile(
currentNode.parentRegion.parentSession.session,
{
Expand All @@ -56,11 +56,12 @@ export function getEnableLocalFileCommand(tree: CICSTree, treeview: TreeView<any
cicsPlex: currentNode.parentRegion.parentPlex ? currentNode.parentRegion.parentPlex.plexName : undefined,
}
);
https.globalAgent.options.rejectUnauthorized = true;
https.globalAgent.options.rejectUnauthorized = undefined;
if (!parentRegions.includes(currentNode.parentRegion)) {
parentRegions.push(currentNode.parentRegion);
}
} catch (err) {
https.globalAgent.options.rejectUnauthorized = undefined;
// @ts-ignore
window.showErrorMessage(err);
}
Expand Down
9 changes: 5 additions & 4 deletions src/commands/enableProgramCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ export function getEnableProgramCommand(tree: CICSTree, treeview: TreeView<any>)
});
try {
const currentNode = allSelectedNodes[parseInt(index)];
if (currentNode.parentRegion.parentSession.session.ISession.rejectUnauthorized === false) {
https.globalAgent.options.rejectUnauthorized = false;
}

https.globalAgent.options.rejectUnauthorized = currentNode.parentRegion.parentSession.session.ISession.rejectUnauthorized;

await enableProgram(
currentNode.parentRegion.parentSession.session,
{
Expand All @@ -56,11 +56,12 @@ export function getEnableProgramCommand(tree: CICSTree, treeview: TreeView<any>)
cicsPlex: currentNode.parentRegion.parentPlex ? currentNode.parentRegion.parentPlex.plexName : undefined,
}
);
https.globalAgent.options.rejectUnauthorized = true;
https.globalAgent.options.rejectUnauthorized = undefined;
if (!parentRegions.includes(currentNode.parentRegion)) {
parentRegions.push(currentNode.parentRegion);
}
} catch (err) {
https.globalAgent.options.rejectUnauthorized = undefined;
// @ts-ignore
window.showErrorMessage(err);
}
Expand Down
9 changes: 5 additions & 4 deletions src/commands/enableTransactionCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ export function getEnableTransactionCommand(tree: CICSTree, treeview: TreeView<a
});
try {
const currentNode = allSelectedNodes[parseInt(index)];
if (currentNode.parentRegion.parentSession.session.ISession.rejectUnauthorized === false) {
https.globalAgent.options.rejectUnauthorized = false;
}

https.globalAgent.options.rejectUnauthorized = currentNode.parentRegion.parentSession.session.ISession.rejectUnauthorized;

await enableTransaction(
currentNode.parentRegion.parentSession.session,
{
Expand All @@ -56,11 +56,12 @@ export function getEnableTransactionCommand(tree: CICSTree, treeview: TreeView<a
cicsPlex: currentNode.parentRegion.parentPlex ? currentNode.parentRegion.parentPlex.plexName : undefined,
}
);
https.globalAgent.options.rejectUnauthorized = true;
https.globalAgent.options.rejectUnauthorized = undefined;
if (!parentRegions.includes(currentNode.parentRegion)) {
parentRegions.push(currentNode.parentRegion);
}
} catch (err) {
https.globalAgent.options.rejectUnauthorized = undefined;
// @ts-ignore
window.showErrorMessage(err);
}
Expand Down
8 changes: 4 additions & 4 deletions src/commands/newCopyCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,8 @@ export function getNewCopyCommand(tree: CICSTree, treeview: TreeView<any>) {
try {
const currentNode = allSelectedNodes[parseInt(index)];

if (currentNode.parentRegion.parentSession.session.ISession.rejectUnauthorized === false) {
https.globalAgent.options.rejectUnauthorized = false;
}
https.globalAgent.options.rejectUnauthorized = currentNode.parentRegion.parentSession.session.ISession.rejectUnauthorized;

await programNewcopy(
currentNode.parentRegion.parentSession.session,
{
Expand All @@ -52,11 +51,12 @@ export function getNewCopyCommand(tree: CICSTree, treeview: TreeView<any>) {
cicsPlex: currentNode.parentRegion.parentPlex ? currentNode.parentRegion.parentPlex.plexName : undefined,
}
);
https.globalAgent.options.rejectUnauthorized = true;
https.globalAgent.options.rejectUnauthorized = undefined;
if (!parentRegions.includes(currentNode.parentRegion)) {
parentRegions.push(currentNode.parentRegion);
}
} catch (err) {
https.globalAgent.options.rejectUnauthorized = undefined;
// @ts-ignore
const mMessageArr = err.mMessage.split(" ").join("").split("\n");
let resp;
Expand Down
9 changes: 5 additions & 4 deletions src/commands/openLocalFileCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ export function getOpenLocalFileCommand(tree: CICSTree, treeview: TreeView<any>)
});
try {
const currentNode = allSelectedNodes[parseInt(index)];
if (currentNode.parentRegion.parentSession.session.ISession.rejectUnauthorized === false) {
https.globalAgent.options.rejectUnauthorized = false;
}

https.globalAgent.options.rejectUnauthorized = currentNode.parentRegion.parentSession.session.ISession.rejectUnauthorized;

await openLocalFile(
currentNode.parentRegion.parentSession.session,
{
Expand All @@ -56,11 +56,12 @@ export function getOpenLocalFileCommand(tree: CICSTree, treeview: TreeView<any>)
cicsPlex: currentNode.parentRegion.parentPlex ? currentNode.parentRegion.parentPlex.plexName : undefined,
}
);
https.globalAgent.options.rejectUnauthorized = true;
https.globalAgent.options.rejectUnauthorized = undefined;
if (!parentRegions.includes(currentNode.parentRegion)) {
parentRegions.push(currentNode.parentRegion);
}
} catch (err) {
https.globalAgent.options.rejectUnauthorized = undefined;
// @ts-ignore
const mMessageArr = err.mMessage.split(" ").join("").split("\n");
let resp;
Expand Down
9 changes: 5 additions & 4 deletions src/commands/phaseInCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ export function getPhaseInCommand(tree: CICSTree, treeview: TreeView<any>) {
});
try {
const currentNode = allSelectedNodes[parseInt(index)];
if (currentNode.parentRegion.parentSession.session.ISession.rejectUnauthorized === false) {
https.globalAgent.options.rejectUnauthorized = false;
}

https.globalAgent.options.rejectUnauthorized = currentNode.parentRegion.parentSession.session.ISession.rejectUnauthorized;

await performPhaseIn(
currentNode.parentRegion.parentSession.session,
{
Expand All @@ -52,12 +52,13 @@ export function getPhaseInCommand(tree: CICSTree, treeview: TreeView<any>) {
cicsPlex: currentNode.parentRegion.parentPlex ? currentNode.parentRegion.parentPlex.plexName : undefined,
}
);
https.globalAgent.options.rejectUnauthorized = true;
https.globalAgent.options.rejectUnauthorized = undefined;

if(!parentRegions.includes(currentNode.parentRegion)){
parentRegions.push(currentNode.parentRegion);
}
} catch(err){
https.globalAgent.options.rejectUnauthorized = undefined;
// @ts-ignore
const mMessageArr = err.mMessage.split(" ").join("").split("\n");
let resp;
Expand Down
10 changes: 5 additions & 5 deletions src/trees/CICSLocalFileTree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,23 +75,23 @@ export class CICSLocalFileTree extends TreeItem {
}
this.children = [];
try {
if (this.parentRegion.parentSession.session.ISession.rejectUnauthorized === false) {
https.globalAgent.options.rejectUnauthorized = false;
}

https.globalAgent.options.rejectUnauthorized = this.parentRegion.parentSession.session.ISession.rejectUnauthorized;

const localFileResponse = await getResource(this.parentRegion.parentSession.session, {
name: "CICSLocalFile",
regionName: this.parentRegion.getRegionName(),
cicsPlex: this.parentRegion.parentPlex ? this.parentRegion.parentPlex!.getPlexName() : undefined,
criteria: criteria
});
https.globalAgent.options.rejectUnauthorized = true;
https.globalAgent.options.rejectUnauthorized = undefined;
for (const localFile of Array.isArray(localFileResponse.response.records.cicslocalfile) ? localFileResponse.response.records.cicslocalfile : [localFileResponse.response.records.cicslocalfile]) {
const newLocalFileItem = new CICSLocalFileTreeItem(localFile, this.parentRegion);
//@ts-ignore
this.addLocalFile(newLocalFileItem);
}
} catch (error) {
https.globalAgent.options.rejectUnauthorized = true;
https.globalAgent.options.rejectUnauthorized = undefined;
// @ts-ignore
if (error!.mMessage!.includes('exceeded a resource limit')) {
window.showErrorMessage(`Resource Limit Exceeded - Set a local file filter to narrow search`);
Expand Down
10 changes: 5 additions & 5 deletions src/trees/CICSProgramTree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,23 +74,23 @@ export class CICSProgramTree extends TreeItem {
}
this.children = [];
try {
if (this.parentRegion.parentSession.session.ISession.rejectUnauthorized === false) {
https.globalAgent.options.rejectUnauthorized = false;
}

https.globalAgent.options.rejectUnauthorized = this.parentRegion.parentSession.session.ISession.rejectUnauthorized;

const programResponse = await getResource(this.parentRegion.parentSession.session, {
name: "CICSProgram",
regionName: this.parentRegion.getRegionName(),
cicsPlex: this.parentRegion.parentPlex ? this.parentRegion.parentPlex!.getPlexName() : undefined,
criteria: criteria
});
https.globalAgent.options.rejectUnauthorized = true;
https.globalAgent.options.rejectUnauthorized = undefined;
for (const program of Array.isArray(programResponse.response.records.cicsprogram) ? programResponse.response.records.cicsprogram : [programResponse.response.records.cicsprogram]) {
const newProgramItem = new CICSProgramTreeItem(program, this.parentRegion);
//@ts-ignore
this.addProgram(newProgramItem);
}
} catch (error) {
https.globalAgent.options.rejectUnauthorized = true;
https.globalAgent.options.rejectUnauthorized = undefined;
// @ts-ignore
if (error!.mMessage!.includes('exceeded a resource limit')) {
window.showErrorMessage(`Resource Limit Exceeded - Set a program filter to narrow search`);
Expand Down
10 changes: 5 additions & 5 deletions src/trees/CICSTransactionTree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,23 +75,23 @@ export class CICSTransactionTree extends TreeItem {
}
this.children = [];
try {
if(this.parentRegion.parentSession.session.ISession.rejectUnauthorized === false) {
https.globalAgent.options.rejectUnauthorized = false;
}

https.globalAgent.options.rejectUnauthorized = this.parentRegion.parentSession.session.ISession.rejectUnauthorized;

const transactionResponse = await getResource(this.parentRegion.parentSession.session, {
name: "CICSLocalTransaction",
regionName: this.parentRegion.getRegionName(),
cicsPlex: this.parentRegion.parentPlex ? this.parentRegion.parentPlex!.getPlexName() : undefined,
criteria: criteria
});
https.globalAgent.options.rejectUnauthorized = true;
https.globalAgent.options.rejectUnauthorized = undefined;
for (const transaction of Array.isArray(transactionResponse.response.records.cicslocaltransaction) ? transactionResponse.response.records.cicslocaltransaction : [transactionResponse.response.records.cicslocaltransaction]) {
const newTransactionItem = new CICSTransactionTreeItem(transaction, this.parentRegion);
//@ts-ignore
this.addTransaction(newTransactionItem);
}
} catch (error) {
https.globalAgent.options.rejectUnauthorized = true;
https.globalAgent.options.rejectUnauthorized = undefined;
// @ts-ignore
if (error!.mMessage!.includes('exceeded a resource limit')) {
window.showErrorMessage(`Resource Limit Exceeded - Set a transaction filter to narrow search`);
Expand Down
Loading

0 comments on commit 32c0fa8

Please sign in to comment.