Skip to content

Commit

Permalink
Merge pull request #121 from zowe/fix-code-issues
Browse files Browse the repository at this point in the history
Fix forward null issues (v2)
  • Loading branch information
zFernand0 authored May 4, 2024
2 parents d3c5d82 + bf773ea commit f5c29c6
Show file tree
Hide file tree
Showing 12 changed files with 1,153 additions and 1,838 deletions.
2,954 changes: 1,128 additions & 1,826 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions packages/vsce/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

All notable changes to the "cics-extension-for-zowe" extension will be documented in this file.

## Recent Changes

- BugFix: Fixed several identified problems with possible null values in the tree and web views. [#121](https://github.com/zowe/cics-for-zowe-client/issues/121)

## `2.3.5`

- BugFix: Fixed icons not displaying.[#112](https://github.com/zowe/cics-for-zowe-client/issues/112)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ export class CICSCombinedLibraryTree extends TreeItem {
public addLibrariesUtil(newChildren: (CICSLibraryTreeItem | ViewMore)[], allLibraries: any, count: number | undefined) {
for (const library of allLibraries) {
const regionsContainer = this.parentPlex.children.filter((child) => child instanceof CICSRegionsContainer)?.[0];
if (regionsContainer == null) { continue; }
const parentRegion = regionsContainer
.getChildren()!
.filter((child) => child instanceof CICSRegionTree && child.getRegionName() === library.eyu_cicsname)?.[0] as CICSRegionTree;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ export class CICSCombinedLocalFileTree extends TreeItem {
public addLocalFilesUtil(newChildren: (CICSLocalFileTreeItem | ViewMore)[], allLocalFiles: any, count: number | undefined) {
for (const localfile of allLocalFiles) {
const regionsContainer = this.parentPlex.children.filter((child) => child instanceof CICSRegionsContainer)?.[0];
if (regionsContainer == null) { continue; }
const parentRegion = regionsContainer
.getChildren()!
.filter((child) => child instanceof CICSRegionTree && child.getRegionName() === localfile.eyu_cicsname)?.[0] as CICSRegionTree;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ export class CICSCombinedPipelineTree extends TreeItem {
public addPipelinesUtil(newChildren: (CICSPipelineTreeItem | ViewMore)[], allPipelines: any, count: number | undefined) {
for (const pipeline of allPipelines) {
const regionsContainer = this.parentPlex.children.filter((child) => child instanceof CICSRegionsContainer)?.[0];
if (regionsContainer == null) { continue; }
const parentRegion = regionsContainer
.getChildren()!
.filter((child) => child instanceof CICSRegionTree && child.getRegionName() === pipeline.eyu_cicsname)?.[0] as CICSRegionTree;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ export class CICSCombinedProgramTree extends TreeItem {
for (const program of allPrograms) {
// Regions container must exist if all programs tree exists
const regionsContainer = this.parentPlex.children.filter((child) => child instanceof CICSRegionsContainer)?.[0];
if (regionsContainer == null) { continue; }
const parentRegion = regionsContainer
.getChildren()!
.filter((child) => child instanceof CICSRegionTree && child.getRegionName() === program.eyu_cicsname)?.[0] as CICSRegionTree;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ export class CICSCombinedTCPIPServiceTree extends TreeItem {
for (const tcpips of allTCPIPS) {
// Regions container must exist if all TCPIP Services tree exists
const regionsContainer = this.parentPlex.children.filter((child) => child instanceof CICSRegionsContainer)?.[0];
if (regionsContainer == null) { continue; }
const parentRegion = regionsContainer
.getChildren()!
.filter((child) => child instanceof CICSRegionTree && child.getRegionName() === tcpips.eyu_cicsname)?.[0] as CICSRegionTree;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ export class CICSCombinedTaskTree extends TreeItem {
public addTasksUtil(newChildren: (CICSTaskTreeItem | ViewMore)[], allTasks: any, count: number | undefined) {
for (const task of allTasks) {
const regionsContainer = this.parentPlex.children.filter((child) => child instanceof CICSRegionsContainer)?.[0];
if (regionsContainer == null) { continue; }
const parentRegion = regionsContainer
.getChildren()!
.filter((child) => child instanceof CICSRegionTree && child.getRegionName() === task.eyu_cicsname)?.[0] as CICSRegionTree;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ export class CICSCombinedTransactionsTree extends TreeItem {
public addLocalTransactionsUtil(newChildren: (CICSTransactionTreeItem | ViewMore)[], allLocalTransactions: any, count: number | undefined) {
for (const transaction of allLocalTransactions) {
const regionsContainer = this.parentPlex.children.filter((child) => child instanceof CICSRegionsContainer)?.[0];
if (regionsContainer == null) { continue; }
const parentRegion = regionsContainer
.getChildren()!
.filter((child) => child instanceof CICSRegionTree && child.getRegionName() === transaction.eyu_cicsname)?.[0] as CICSRegionTree;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ export class CICSCombinedURIMapTree extends TreeItem {
for (const urimaps of allURIMaps) {
// Regions container must exist if all URI Maps tree exists
const regionsContainer = this.parentPlex.children.filter((child) => child instanceof CICSRegionsContainer)?.[0];
if (regionsContainer == null) { continue; }
const parentRegion = regionsContainer
.getChildren()!
.filter((child) => child instanceof CICSRegionTree && child.getRegionName() === urimaps.eyu_cicsname)?.[0] as CICSRegionTree;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ export class CICSCombinedWebServiceTree extends TreeItem {
for (const webservice of allWebServices) {
// Regions container must exist if all web services tree exists
const regionsContainer = this.parentPlex.children.filter((child) => child instanceof CICSRegionsContainer)?.[0];
if (regionsContainer == null) { continue; }
const parentRegion = regionsContainer
.getChildren()!
.filter((child) => child instanceof CICSRegionTree && child.getRegionName() === webservice.eyu_cicsname)?.[0] as CICSRegionTree;
Expand Down
24 changes: 12 additions & 12 deletions packages/vsce/src/utils/webviewHTML.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,10 @@ export const addProfileHtml = (message?: imperative.IUpdateProfile): string => {
<label for="protocol-select" class="bx--label">Protocol</label>
<div class="bx--select-input__wrapper">
<select id="protocol-select" class="bx--select-input" onload="renderRU()" onchange="renderRU()">
<option class="bx--select-option" value="http" ${message?.profile.protocol === "http" ? `selected="selected"` : ""}>
<option class="bx--select-option" value="http" ${message?.profile?.protocol === "http" ? `selected="selected"` : ""}>
HTTP
</option>
<option class="bx--select-option" value="https" ${message?.profile.protocol === "https" ? `selected="selected"` : ""}>
<option class="bx--select-option" value="https" ${message?.profile?.protocol === "https" ? `selected="selected"` : ""}>
HTTPS
</option>
</select>
Expand Down Expand Up @@ -163,7 +163,7 @@ export const addProfileHtml = (message?: imperative.IUpdateProfile): string => {
class="bx--text-input"
placeholder="example.cics.host.com"
oninput="handleHostInputName()"
${message?.profile.host ? `value =${message.profile.host}` : undefined}
${message?.profile?.host ? `value =${message.profile.host}` : undefined}
/>
</div>
</div>
Expand All @@ -176,7 +176,7 @@ export const addProfileHtml = (message?: imperative.IUpdateProfile): string => {
type="text"
class="bx--text-input"
placeholder="12345"
${message?.profile.port ? `value =${message.profile.port}` : undefined}
${message?.profile?.port ? `value =${message.profile.port}` : undefined}
/>
</div>
</div>
Expand All @@ -193,7 +193,7 @@ export const addProfileHtml = (message?: imperative.IUpdateProfile): string => {
<div class="bx--radio-button-group ">
<div class="bx--radio-button-wrapper">
<input id="radio-button-true" class="bx--radio-button" type="radio" value="true" name="radio-button" tabindex="0" ${
message?.profile.rejectUnauthorized ? `checked="checked"` : ""
message?.profile?.rejectUnauthorized ? `checked="checked"` : ""
}>
<label for="radio-button-true" class="bx--radio-button__label">
<span class="bx--radio-button__appearance" style="background-color:white"></span>
Expand All @@ -203,7 +203,7 @@ export const addProfileHtml = (message?: imperative.IUpdateProfile): string => {
<div class="bx--radio-button-wrapper">
<input id="radio-button-false" class="bx--radio-button" type="radio" value="false" name="radio-button" tabindex="0" ${
!message?.profile.rejectUnauthorized ? `checked="checked""` : ""
!message?.profile?.rejectUnauthorized ? `checked="checked""` : ""
}>
<label for="radio-button-false" class="bx--radio-button__label">
<span class="bx--radio-button__appearance" style="background-color:white"></span>
Expand Down Expand Up @@ -244,7 +244,7 @@ export const addProfileHtml = (message?: imperative.IUpdateProfile): string => {
type="text"
class="bx--text-input"
placeholder=""
${message?.profile.user ? `value =${message.profile.user}` : undefined}
${message?.profile?.user ? `value =${message.profile.user}` : undefined}
/>
</div>
</div>
Expand All @@ -257,7 +257,7 @@ export const addProfileHtml = (message?: imperative.IUpdateProfile): string => {
type="password"
class="bx--text-input"
placeholder=""
${message?.profile.password ? `value =${message.profile.password}` : undefined}
${message?.profile?.password ? `value =${message.profile.password}` : undefined}
/>
</div>
</div>
Expand All @@ -276,7 +276,7 @@ export const addProfileHtml = (message?: imperative.IUpdateProfile): string => {
type="text"
class="bx--text-input"
placeholder=""
${message?.profile.regionName ? `value =${message.profile.regionName}` : undefined}
${message?.profile?.regionName ? `value =${message.profile.regionName}` : undefined}
/>
</div>
</div>
Expand All @@ -289,7 +289,7 @@ export const addProfileHtml = (message?: imperative.IUpdateProfile): string => {
type="text"
class="bx--text-input"
placeholder=""
${message?.profile.cicsPlex ? `value =${message.profile.cicsPlex}` : undefined}
${message?.profile?.cicsPlex ? `value =${message.profile.cicsPlex}` : undefined}
/>
</div>
</div>
Expand Down Expand Up @@ -340,9 +340,9 @@ export const addProfileHtml = (message?: imperative.IUpdateProfile): string => {
}
function onLoadRenderRU() {
if (${message?.profile.protocol === "https"}) {
if (${message?.profile?.protocol === "https"}) {
setContentsEnabled("ru-selection-container");
} else if (${message?.profile.protocol === "http"}) {
} else if (${message?.profile?.protocol === "http"}) {
setContentsDisabled("ru-selection-container");
}
}
Expand Down

0 comments on commit f5c29c6

Please sign in to comment.