Skip to content

Commit

Permalink
Refactored and moved icon methods to iconUtils file
Browse files Browse the repository at this point in the history
Signed-off-by: Rushabh Sojitra <[email protected]>
  • Loading branch information
almightyrush committed Jan 16, 2025
1 parent 86b8336 commit 166518f
Show file tree
Hide file tree
Showing 39 changed files with 92 additions and 80 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import CustomError from "../../__utils__/CustomError";
jest.mock("@zowe/cics-for-zowe-sdk");
const zoweSdk = require("@zowe/cics-for-zowe-sdk");

jest.mock("../../../src/utils/profileUtils", () => {
jest.mock("../../../src/utils/iconUtils", () => {
return { getIconOpen: getIconOpenMock };
});
jest.mock("../../../src/trees/treeItems/CICSProgramTreeItem");
Expand Down
4 changes: 2 additions & 2 deletions packages/vsce/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { CICSSessionTree } from "./trees/CICSSessionTree";
import { CICSTree } from "./trees/CICSTree";
import { plexExpansionHandler, regionContainerExpansionHandler, sessionExpansionHandler } from "./utils/expansionHandler";
import { ProfileManagement } from "./utils/profileManagement";
import { getIconOpen, getIconPathInResources } from "./utils/profileUtils";
import { getIconOpen, getIconPathInResources } from "./utils/iconUtils";
import { getZoweExplorerVersion } from "./utils/workspaceUtils";

import { Logger } from "@zowe/imperative";
Expand Down Expand Up @@ -180,4 +180,4 @@ export async function activate(context: ExtensionContext) {
});

context.subscriptions.concat(getCommands(treeDataProv, treeview));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { CICSRegionTree } from "../CICSRegionTree";
import { CICSTree } from "../CICSTree";
import { CICSLibraryTreeItem } from "../treeItems/CICSLibraryTreeItem";
import { TextTreeItem } from "../treeItems/utils/TextTreeItem";
import { getIconOpen } from "../../utils/profileUtils";
import { getIconOpen } from "../../utils/iconUtils";
import { ViewMore } from "../treeItems/utils/ViewMore";

export class CICSCombinedLibraryTree extends TreeItem {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { CICSRegionTree } from "../CICSRegionTree";
import { CICSTree } from "../CICSTree";
import { CICSLocalFileTreeItem } from "../treeItems/CICSLocalFileTreeItem";
import { TextTreeItem } from "../treeItems/utils/TextTreeItem";
import { getIconOpen } from "../../utils/profileUtils";
import { getIconOpen } from "../../utils/iconUtils";
import { ViewMore } from "../treeItems/utils/ViewMore";

export class CICSCombinedLocalFileTree extends TreeItem {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { CICSRegionsContainer } from "../CICSRegionsContainer";
import { CICSRegionTree } from "../CICSRegionTree";
import { CICSTree } from "../CICSTree";
import { TextTreeItem } from "../treeItems/utils/TextTreeItem";
import { getIconOpen } from "../../utils/profileUtils";
import { getIconOpen } from "../../utils/iconUtils";
import { ViewMore } from "../treeItems/utils/ViewMore";
import { CICSPipelineTreeItem } from "../treeItems/web/treeItems/CICSPipelineTreeItem";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { CICSRegionTree } from "../CICSRegionTree";
import { CICSTree } from "../CICSTree";
import { CICSProgramTreeItem } from "../treeItems/CICSProgramTreeItem";
import { TextTreeItem } from "../treeItems/utils/TextTreeItem";
import { getIconOpen, getIconPathInResources } from "../../utils/profileUtils";
import { getIconOpen, getIconPathInResources } from "../../utils/iconUtils";
import { imperative } from "@zowe/zowe-explorer-api";
import { ViewMore } from "../treeItems/utils/ViewMore";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { CICSRegionsContainer } from "../CICSRegionsContainer";
import { CICSRegionTree } from "../CICSRegionTree";
import { CICSTree } from "../CICSTree";
import { TextTreeItem } from "../treeItems/utils/TextTreeItem";
import { getIconOpen } from "../../utils/profileUtils";
import { getIconOpen } from "../../utils/iconUtils";
import { ViewMore } from "../treeItems/utils/ViewMore";
import { CICSTCPIPServiceTreeItem } from "../treeItems/web/treeItems/CICSTCPIPServiceTreeItem";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { CICSRegionTree } from "../CICSRegionTree";
import { CICSTree } from "../CICSTree";
import { ViewMore } from "../treeItems/utils/ViewMore";
import { TextTreeItem } from "../treeItems/utils/TextTreeItem";
import { getIconOpen } from "../../utils/profileUtils";
import { getIconOpen } from "../../utils/iconUtils";
import { CICSTaskTreeItem } from "../treeItems/CICSTaskTreeItem";

export class CICSCombinedTaskTree extends TreeItem {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { CICSRegionTree } from "../CICSRegionTree";
import { CICSTree } from "../CICSTree";
import { CICSTransactionTreeItem } from "../treeItems/CICSTransactionTreeItem";
import { TextTreeItem } from "../treeItems/utils/TextTreeItem";
import { getIconOpen } from "../../utils/profileUtils";
import { getIconOpen } from "../../utils/iconUtils";
import { ViewMore } from "../treeItems/utils/ViewMore";

export class CICSCombinedTransactionsTree extends TreeItem {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { CICSRegionsContainer } from "../CICSRegionsContainer";
import { CICSRegionTree } from "../CICSRegionTree";
import { CICSTree } from "../CICSTree";
import { TextTreeItem } from "../treeItems/utils/TextTreeItem";
import { getIconOpen } from "../../utils/profileUtils";
import { getIconOpen } from "../../utils/iconUtils";
import { ViewMore } from "../treeItems/utils/ViewMore";
import { CICSURIMapTreeItem } from "../treeItems/web/treeItems/CICSURIMapTreeItem";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { CICSRegionsContainer } from "../CICSRegionsContainer";
import { CICSRegionTree } from "../CICSRegionTree";
import { CICSTree } from "../CICSTree";
import { TextTreeItem } from "../treeItems/utils/TextTreeItem";
import { getIconOpen } from "../../utils/profileUtils";
import { getIconOpen } from "../../utils/iconUtils";
import { ViewMore } from "../treeItems/utils/ViewMore";
import { CICSWebServiceTreeItem } from "../treeItems/web/treeItems/CICSWebServiceTreeItem";

Expand Down
2 changes: 1 addition & 1 deletion packages/vsce/src/trees/CICSLibraryTree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import { TreeItemCollapsibleState, TreeItem, window } from "vscode";
import { CICSRegionTree } from "./CICSRegionTree";
import { getResource } from "@zowe/cics-for-zowe-sdk";
import { getIconOpen } from "../utils/profileUtils";
import { getIconOpen } from "../utils/iconUtils";
import { CICSLibraryTreeItem } from "./treeItems/CICSLibraryTreeItem";
import { toEscapedCriteriaString } from "../utils/filterUtils";
import { toArray } from "../utils/commandUtils";
Expand Down
2 changes: 1 addition & 1 deletion packages/vsce/src/trees/CICSLocalFileTree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { CICSLocalFileTreeItem } from "./treeItems/CICSLocalFileTreeItem";
import { getResource } from "@zowe/cics-for-zowe-sdk";
import { CICSRegionTree } from "./CICSRegionTree";
import { toEscapedCriteriaString } from "../utils/filterUtils";
import { getIconOpen } from "../utils/profileUtils";
import { getIconOpen } from "../utils/iconUtils";
import { toArray } from "../utils/commandUtils";

export class CICSLocalFileTree extends TreeItem {
Expand Down
2 changes: 1 addition & 1 deletion packages/vsce/src/trees/CICSPlexTree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { CICSCombinedProgramTree } from "./CICSCombinedTrees/CICSCombinedProgram
import { CICSCombinedTransactionsTree } from "./CICSCombinedTrees/CICSCombinedTransactionTree";
import { CICSCombinedLocalFileTree } from "./CICSCombinedTrees/CICSCombinedLocalFileTree";
import { CICSRegionsContainer } from "./CICSRegionsContainer";
import { getIconPathInResources } from "../utils/profileUtils";
import { getIconPathInResources } from "../utils/iconUtils";
import { CICSCombinedTaskTree } from "./CICSCombinedTrees/CICSCombinedTaskTree";
import { CICSCombinedLibraryTree } from "./CICSCombinedTrees/CICSCombinedLibraryTree";
import { CICSCombinedTCPIPServiceTree } from "./CICSCombinedTrees/CICSCombinedTCPIPServiceTree";
Expand Down
2 changes: 1 addition & 1 deletion packages/vsce/src/trees/CICSProgramTree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { CICSProgramTreeItem } from "./treeItems/CICSProgramTreeItem";
import { CICSRegionTree } from "./CICSRegionTree";
import { getResource } from "@zowe/cics-for-zowe-sdk";
import { getDefaultProgramFilter, toEscapedCriteriaString } from "../utils/filterUtils";
import { getIconOpen } from "../utils/profileUtils";
import { getIconOpen } from "../utils/iconUtils";
import { toArray } from "../utils/commandUtils";

export class CICSProgramTree extends TreeItem {
Expand Down
2 changes: 1 addition & 1 deletion packages/vsce/src/trees/CICSRegionTree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { CICSTransactionTree } from "./CICSTransactionTree";
import { CICSLocalFileTree } from "./CICSLocalFileTree";
import { CICSSessionTree } from "./CICSSessionTree";
import { CICSPlexTree } from "./CICSPlexTree";
import { getIconPathInResources } from "../utils/profileUtils";
import { getIconPathInResources } from "../utils/iconUtils";
import { CICSTaskTree } from "./CICSTaskTree";
import { CICSLibraryTree } from "./CICSLibraryTree";
import { CICSWebTree } from "./CICSWebTree";
Expand Down
2 changes: 1 addition & 1 deletion packages/vsce/src/trees/CICSRegionsContainer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { ProfileManagement } from "../utils/profileManagement";
import { CICSPlexTree } from "./CICSPlexTree";
import { CICSRegionTree } from "./CICSRegionTree";
import { CICSTree } from "./CICSTree";
import { getIconOpen } from "../utils/profileUtils";
import { getIconOpen } from "../utils/iconUtils";
import { toArray } from "../utils/commandUtils";

export class CICSRegionsContainer extends TreeItem {
Expand Down
2 changes: 1 addition & 1 deletion packages/vsce/src/trees/CICSSessionTree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { TreeItemCollapsibleState, TreeItem } from "vscode";
import { CICSRegionTree } from "./CICSRegionTree";
import { CICSPlexTree } from "./CICSPlexTree";
import { imperative } from "@zowe/zowe-explorer-api";
import { getIconPathInResources } from "../utils/profileUtils";
import { getIconPathInResources } from "../utils/iconUtils";

export class CICSSessionTree extends TreeItem {
children: (CICSPlexTree | CICSRegionTree)[];
Expand Down
2 changes: 1 addition & 1 deletion packages/vsce/src/trees/CICSTaskTree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { TreeItemCollapsibleState, TreeItem, window, workspace } from "vscode";
import { CICSRegionTree } from "./CICSRegionTree";
import { getResource } from "@zowe/cics-for-zowe-sdk";
import { toEscapedCriteriaString } from "../utils/filterUtils";
import { getIconOpen } from "../utils/profileUtils";
import { getIconOpen } from "../utils/iconUtils";
import { CICSTaskTreeItem } from "./treeItems/CICSTaskTreeItem";
import { toArray } from "../utils/commandUtils";

Expand Down
2 changes: 1 addition & 1 deletion packages/vsce/src/trees/CICSTransactionTree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { CICSTransactionTreeItem } from "./treeItems/CICSTransactionTreeItem";
import { CICSRegionTree } from "./CICSRegionTree";
import { getResource } from "@zowe/cics-for-zowe-sdk";
import { getDefaultTransactionFilter, toEscapedCriteriaString } from "../utils/filterUtils";
import { getIconOpen } from "../utils/profileUtils";
import { getIconOpen } from "../utils/iconUtils";
import { toArray } from "../utils/commandUtils";

export class CICSTransactionTree extends TreeItem {
Expand Down
3 changes: 2 additions & 1 deletion packages/vsce/src/trees/CICSTree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ import {
import constants from "../utils/constants";
import { PersistentStorage } from "../utils/PersistentStorage";
import { InfoLoaded, ProfileManagement } from "../utils/profileManagement";
import { getIconPathInResources, missingSessionParameters, promptCredentials } from "../utils/profileUtils";
import { missingSessionParameters, promptCredentials } from "../utils/profileUtils";
import { getIconPathInResources } from "../utils/iconUtils";
import { openConfigFile } from "../utils/workspaceUtils";
import { CICSPlexTree } from "./CICSPlexTree";
import { CICSRegionTree } from "./CICSRegionTree";
Expand Down
2 changes: 1 addition & 1 deletion packages/vsce/src/trees/CICSWebTree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/

import { TreeItemCollapsibleState, TreeItem } from "vscode";
import { getIconOpen } from "../utils/profileUtils";
import { getIconOpen } from "../utils/iconUtils";
import { CICSRegionTree } from "./CICSRegionTree";
import { CICSURIMapTree } from "./treeItems/web/CICSURIMapTree";
import { CICSTCPIPServiceTree } from "./treeItems/web/CICSTCPIPServiceTree";
Expand Down
2 changes: 1 addition & 1 deletion packages/vsce/src/trees/treeItems/CICSLibraryDatasets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import { TreeItemCollapsibleState, TreeItem, window } from "vscode";
import { CICSRegionTree } from "../CICSRegionTree";
import { getIconPathInResources } from "../../utils/profileUtils";
import { getIconPathInResources } from "../../utils/iconUtils";
import { getResource } from "@zowe/cics-for-zowe-sdk";
import { CICSProgramTreeItem } from "./CICSProgramTreeItem";
import { toEscapedCriteriaString } from "../../utils/filterUtils";
Expand Down
2 changes: 1 addition & 1 deletion packages/vsce/src/trees/treeItems/CICSLibraryTreeItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { CICSRegionTree } from "../CICSRegionTree";
import { getResource } from "@zowe/cics-for-zowe-sdk";
import { CICSLibraryDatasets } from "./CICSLibraryDatasets";
import { toEscapedCriteriaString } from "../../utils/filterUtils";
import { getIconOpen } from "../../utils/profileUtils";
import { getIconOpen } from "../../utils/iconUtils";
import { toArray } from "../../utils/commandUtils";

export class CICSLibraryTreeItem extends TreeItem {
Expand Down
2 changes: 1 addition & 1 deletion packages/vsce/src/trees/treeItems/CICSLocalFileTreeItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import { TreeItemCollapsibleState, TreeItem } from "vscode";
import { CICSRegionTree } from "../CICSRegionTree";
import { getIconByStatus } from "../../utils/profileUtils";
import { getIconByStatus } from "../../utils/iconUtils";

export class CICSLocalFileTreeItem extends TreeItem {
localFile: any;
Expand Down
2 changes: 1 addition & 1 deletion packages/vsce/src/trees/treeItems/CICSProgramTreeItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import { TreeItemCollapsibleState, TreeItem } from "vscode";
import { CICSRegionTree } from "../CICSRegionTree";
import { getIconByStatus } from "../../utils/profileUtils";
import { getIconByStatus } from "../../utils/iconUtils";

export class CICSProgramTreeItem extends TreeItem {
program: any;
Expand Down
2 changes: 1 addition & 1 deletion packages/vsce/src/trees/treeItems/CICSTaskTreeItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import { TreeItemCollapsibleState, TreeItem } from "vscode";
import { CICSRegionTree } from "../CICSRegionTree";
import { getIconByStatus } from "../../utils/profileUtils";
import { getIconByStatus } from "../../utils/iconUtils";

export class CICSTaskTreeItem extends TreeItem {
task: any;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import { TreeItemCollapsibleState, TreeItem } from "vscode";
import { CICSRegionTree } from "../CICSRegionTree";
import { getIconByStatus } from "../../utils/profileUtils";
import { getIconByStatus } from "../../utils/iconUtils";

export class CICSTransactionTreeItem extends TreeItem {
transaction: any;
Expand Down
2 changes: 1 addition & 1 deletion packages/vsce/src/trees/treeItems/web/CICSPipelineTree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { CICSPipelineTreeItem } from "./treeItems/CICSPipelineTreeItem";
import { CICSRegionTree } from "../../CICSRegionTree";
import { getResource } from "@zowe/cics-for-zowe-sdk";
import { toEscapedCriteriaString } from "../../../utils/filterUtils";
import { getIconOpen } from "../../../utils/profileUtils";
import { getIconOpen } from "../../../utils/iconUtils";
import { toArray } from "../../../utils/commandUtils";

export class CICSPipelineTree extends TreeItem {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { CICSTCPIPServiceTreeItem } from "./treeItems/CICSTCPIPServiceTreeItem";
import { CICSRegionTree } from "../../CICSRegionTree";
import { getResource } from "@zowe/cics-for-zowe-sdk";
import { toEscapedCriteriaString } from "../../../utils/filterUtils";
import { getIconOpen } from "../../../utils/profileUtils";
import { getIconOpen } from "../../../utils/iconUtils";
import { toArray } from "../../../utils/commandUtils";

export class CICSTCPIPServiceTree extends TreeItem {
Expand Down
2 changes: 1 addition & 1 deletion packages/vsce/src/trees/treeItems/web/CICSURIMapTree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { CICSURIMapTreeItem } from "./treeItems/CICSURIMapTreeItem";
import { CICSRegionTree } from "../../CICSRegionTree";
import { getResource } from "@zowe/cics-for-zowe-sdk";
import { toEscapedCriteriaString } from "../../../utils/filterUtils";
import { getIconOpen } from "../../../utils/profileUtils";
import { getIconOpen } from "../../../utils/iconUtils";
import { toArray } from "../../../utils/commandUtils";

export class CICSURIMapTree extends TreeItem {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { CICSWebServiceTreeItem } from "./treeItems/CICSWebServiceTreeItem";
import { CICSRegionTree } from "../../CICSRegionTree";
import { getResource } from "@zowe/cics-for-zowe-sdk";
import { toEscapedCriteriaString } from "../../../utils/filterUtils";
import { getIconOpen } from "../../../utils/profileUtils";
import { getIconOpen } from "../../../utils/iconUtils";
import { toArray } from "../../../utils/commandUtils";

export class CICSWebServiceTree extends TreeItem {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import { TreeItemCollapsibleState, TreeItem } from "vscode";
import { CICSRegionTree } from "../../../CICSRegionTree";
import { getIconPathInResources } from "../../../../utils/profileUtils";
import { getIconPathInResources } from "../../../../utils/iconUtils";

export class CICSPipelineTreeItem extends TreeItem {
pipeline: any;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import { TreeItemCollapsibleState, TreeItem } from "vscode";
import { CICSRegionTree } from "../../../CICSRegionTree";
import { getIconPathInResources } from "../../../../utils/profileUtils";
import { getIconPathInResources } from "../../../../utils/iconUtils";

export class CICSTCPIPServiceTreeItem extends TreeItem {
tcpips: any;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import { TreeItemCollapsibleState, TreeItem } from "vscode";
import { CICSRegionTree } from "../../../CICSRegionTree";
import { getIconPathInResources } from "../../../../utils/profileUtils";
import { getIconPathInResources } from "../../../../utils/iconUtils";

export class CICSURIMapTreeItem extends TreeItem {
urimap: any;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import { TreeItemCollapsibleState, TreeItem } from "vscode";
import { CICSRegionTree } from "../../../CICSRegionTree";
import { getIconPathInResources } from "../../../../utils/profileUtils";
import { getIconPathInResources } from "../../../../utils/iconUtils";

export class CICSWebServiceTreeItem extends TreeItem {
webservice: any;
Expand Down
2 changes: 1 addition & 1 deletion packages/vsce/src/utils/expansionHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { CICSRegionsContainer } from "../trees/CICSRegionsContainer";
import { CICSSessionTree } from "../trees/CICSSessionTree";
import { CICSTree } from "../trees/CICSTree";
import { ProfileManagement } from "./profileManagement";
import { getIconOpen } from "./profileUtils";
import { getIconOpen } from "./iconUtils";

export async function sessionExpansionHandler(session: CICSSessionTree, tree: CICSTree) {
const profile = await ProfileManagement.getProfilesCache().getLoadedProfConfig(session.label?.toString()!);
Expand Down
52 changes: 52 additions & 0 deletions packages/vsce/src/utils/iconUtils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/**
* This program and the accompanying materials are made available under the terms of the
* Eclipse Public License v2.0 which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-v20.html
*
* SPDX-License-Identifier: EPL-2.0
*
* Copyright Contributors to the Zowe Project.
*
*/

import { join } from "path";

export function getIconPathInResources(iconFileNameLight: string, iconFileNameDark: string): { light: string; dark: string } {
return {
// We bundle the extension into a single `dist/extension.js`
// `__dirname/../resources/imgs === `/path/to/dist/../resources/imgs`
light: join(__dirname, "..", "resources", "imgs", iconFileNameLight),
dark: join(__dirname, "..", "resources", "imgs", iconFileNameDark),
};
}

export function getIconOpen(open: boolean = true) {
return getIconPathInResources(`folder-${open ? "open" : "closed"}-dark.svg`, `folder-${open ? "open" : "closed"}-light.svg`);
}

export function getIconByStatus(resourceType: string, resourceTreeItem: any) {
switch (resourceType) {
case "PROGRAM":
return resourceTreeItem.status === "DISABLED"
? getIconPathInResources("program-disabled-dark.svg", "program-disabled-light.svg")
: getIconPathInResources("program-dark.svg", "program-light.svg");
case "TRANSACTION":
return resourceTreeItem.status === "DISABLED"
? getIconPathInResources("local-transaction-disabled-dark.svg", "local-transaction-disabled-light.svg")
: getIconPathInResources("local-transaction-dark.svg", "local-transaction-light.svg");
case "LOCAL_FILE":
return resourceTreeItem.openstatus === "CLOSED" && resourceTreeItem.enablestatus === "DISABLED"
? getIconPathInResources("local-file-disabled-closed-dark.svg", "local-file-disabled-closed-light.svg")
: resourceTreeItem.openstatus === "CLOSED"
? getIconPathInResources("local-file-closed-dark.svg", "local-file-closed-light.svg")
: resourceTreeItem.enablestatus === "DISABLED"
? getIconPathInResources("local-file-disabled-dark.svg", "local-file-disabled-light.svg")
: getIconPathInResources("local-file-dark.svg", "local-file-light.svg");
case "TASK":
return resourceTreeItem.runstatus === "RUNNING"
? getIconPathInResources("task-running-dark.svg", "task-running-light.svg")
: resourceTreeItem.runstatus === "SUSPENDED"
? getIconPathInResources("task-suspended-dark.svg", "task-suspended-light.svg")
: getIconPathInResources("task-dispatched-dark.svg", "task-dispatched-light.svg");
}
}
Loading

0 comments on commit 166518f

Please sign in to comment.