Skip to content

Commit

Permalink
handle system group response
Browse files Browse the repository at this point in the history
Co-authored-by: Dave Nice <[email protected]>
Signed-off-by: Andrew <[email protected]>
  • Loading branch information
AndrewTwydell and davenice committed Jan 9, 2025
1 parent 0ef0905 commit b6f5401
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions packages/vsce/src/utils/profileManagement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*
*/

import { getCache, getResource, ICMCIApiResponse } from "@zowe/cics-for-zowe-sdk";
import { getCache, getResource } from "@zowe/cics-for-zowe-sdk";
import { Session } from "@zowe/imperative";
import { imperative, Types, ZoweVsCodeExtension } from "@zowe/zowe-explorer-api";
import { window } from "vscode";
Expand Down Expand Up @@ -71,14 +71,17 @@ export class ProfileManagement {

public static async regionIsGroup(session: Session, profile: imperative.IProfile): Promise<boolean> {

let checkIfSystemGroup: ICMCIApiResponse;
let isGroup = false;
try {
checkIfSystemGroup = await getResource(session, {
const checkIfSystemGroup = await getResource(session, {
name: "CICSRegionGroup",
cicsPlex: profile.cicsPlex,
regionName: profile.regionName,
criteria: `GROUP=${profile.regionName}`,
});
if (checkIfSystemGroup && checkIfSystemGroup.response.resultsummary.recordcount !== "0") {
isGroup = true;
}
} catch (error) {
if (error instanceof imperative.ImperativeError) {
if (!error.mDetails.msg.toUpperCase().includes("NODATA")) {
Expand All @@ -87,7 +90,7 @@ export class ProfileManagement {
}
}

return checkIfSystemGroup?.response.resultsummary.recordcount !== "0";
return isGroup;
}

public static async isPlex(session: Session): Promise<string | null> {
Expand Down

0 comments on commit b6f5401

Please sign in to comment.