From 57d4ecbb6a29a19e6608c297429f675cba5442d2 Mon Sep 17 00:00:00 2001 From: Chinmay Das Date: Mon, 23 Dec 2024 16:51:32 +0530 Subject: [PATCH] UI Functional corrections on CICS Explorer Signed-off-by: Chinmay Das --- packages/vsce/package.json | 1768 ++++++++--------- .../vsce/src/commands/deleteSessionCommand.ts | 46 - .../vsce/src/commands/manageSessionCommand.ts | 19 + .../vsce/src/commands/removeSessionCommand.ts | 55 - .../vsce/src/commands/updateSessionCommand.ts | 59 - packages/vsce/src/extension.ts | 974 +++++---- packages/vsce/src/trees/CICSTree.ts | 1259 +++++++----- 7 files changed, 2109 insertions(+), 2071 deletions(-) delete mode 100644 packages/vsce/src/commands/deleteSessionCommand.ts create mode 100644 packages/vsce/src/commands/manageSessionCommand.ts delete mode 100644 packages/vsce/src/commands/removeSessionCommand.ts delete mode 100644 packages/vsce/src/commands/updateSessionCommand.ts diff --git a/packages/vsce/package.json b/packages/vsce/package.json index 94a082c0..be02f50f 100644 --- a/packages/vsce/package.json +++ b/packages/vsce/package.json @@ -1,901 +1,881 @@ { - "name": "cics-extension-for-zowe", - "displayName": "IBM CICS for Zowe Explorer", - "description": "Adds IBM CICS support to Zowe Explorer.", - "publisher": "Zowe", - "author": "Zowe", - "repository": { - "type": "git", - "url": "https://github.com/zowe/cics-for-zowe-client.git" - }, - "version": "3.2.0", - "engines": { - "vscode": "^1.79.0" - }, - "categories": [ - "Other" - ], - "activationEvents": [ - "onCommand:cics-extension-for-zowe.addSession", - "onView:cics-view" - ], - "extensionDependencies": [ - "Zowe.vscode-extension-for-zowe" - ], - "main": "./dist/extension.js", - "icon": "resources/zowe-cics-color.png", - "keywords": [ - "Zowe", - "explorer", - "mainframe", - "dataset", - "z/OS", - "COBOL", - "CICS", - "CMCI" - ], - "contributes": { - "viewsWelcome": [], - "views": { - "zowe": [ - { - "id": "cics-view", - "name": "cics" - } - ] + "name": "cics-extension-for-zowe", + "displayName": "IBM CICS for Zowe Explorer", + "description": "Adds IBM CICS support to Zowe Explorer.", + "publisher": "Zowe", + "author": "Zowe", + "repository": { + "type": "git", + "url": "https://github.com/zowe/cics-for-zowe-client.git" }, - "commands": [ - { - "command": "cics-extension-for-zowe.addSession", - "title": "Create a CICS Profile", - "category": "IBM CICS for Zowe Explorer", - "icon": { - "light": "resources/imgs/plus-dark.svg", - "dark": "resources/imgs/plus-light.svg" - } - }, - { - "command": "cics-extension-for-zowe.refreshTree", - "title": "Refresh", - "category": "IBM CICS for Zowe Explorer", - "icon": { - "light": "resources/imgs/refresh-dark.svg", - "dark": "resources/imgs/refresh-light.svg" - } - }, - { - "command": "cics-extension-for-zowe.newCopyProgram", - "title": "New Copy", - "category": "IBM CICS for Zowe Explorer", - "icon": { - "light": "resources/imgs/newcopy-dark.svg", - "dark": "resources/imgs/newcopy-light.svg" - } - }, - { - "command": "cics-extension-for-zowe.filterPrograms", - "title": "Filter Programs", - "category": "IBM CICS for Zowe Explorer", - "icon": { - "light": "resources/imgs/filter-dark.svg", - "dark": "resources/imgs/filter-light.svg" - } - }, - { - "command": "cics-extension-for-zowe.filterDatasetPrograms", - "title": "Filter Programs", - "category": "IBM CICS for Zowe Explorer", - "icon": { - "light": "resources/imgs/filter-dark.svg", - "dark": "resources/imgs/filter-light.svg" - } - }, - { - "command": "cics-extension-for-zowe.filterLibraries", - "title": "Filter Libraries", - "category": "IBM CICS for Zowe Explorer", - "icon": { - "light": "resources/imgs/filter-dark.svg", - "dark": "resources/imgs/filter-light.svg" - } - }, - { - "command": "cics-extension-for-zowe.filterDatasets", - "title": "Filter Datasets", - "category": "IBM CICS for Zowe Explorer", - "icon": { - "light": "resources/imgs/filter-dark.svg", - "dark": "resources/imgs/filter-light.svg" - } - }, - { - "command": "cics-extension-for-zowe.filterTCPIPServices", - "title": "Filter TCPIP Services", - "category": "IBM CICS for Zowe Explorer", - "icon": { - "light": "resources/imgs/filter-dark.svg", - "dark": "resources/imgs/filter-light.svg" - } - }, - { - "command": "cics-extension-for-zowe.filterURIMaps", - "title": "Filter URI Maps", - "category": "IBM CICS for Zowe Explorer", - "icon": { - "light": "resources/imgs/filter-dark.svg", - "dark": "resources/imgs/filter-light.svg" - } - }, - { - "command": "cics-extension-for-zowe.filterPipelines", - "title": "Filter Pipelines", - "category": "IBM CICS for Zowe Explorer", - "icon": { - "light": "resources/imgs/filter-dark.svg", - "dark": "resources/imgs/filter-light.svg" - } - }, - { - "command": "cics-extension-for-zowe.filterWebServices", - "title": "Filter Web Services", - "category": "IBM CICS for Zowe Explorer", - "icon": { - "light": "resources/imgs/filter-dark.svg", - "dark": "resources/imgs/filter-light.svg" - } - }, - { - "command": "cics-extension-for-zowe.filterTransactions", - "title": "Filter Transactions", - "category": "IBM CICS for Zowe Explorer", - "icon": { - "light": "resources/imgs/filter-dark.svg", - "dark": "resources/imgs/filter-light.svg" - } - }, - { - "command": "cics-extension-for-zowe.filterTasks", - "title": "Filter Tasks by Transaction ID", - "category": "IBM CICS for Zowe Explorer", - "icon": { - "light": "resources/imgs/filter-dark.svg", - "dark": "resources/imgs/filter-light.svg" - } - }, - { - "command": "cics-extension-for-zowe.filterLocalFiles", - "title": "Filter Local Files", - "category": "IBM CICS for Zowe Explorer", - "icon": { - "light": "resources/imgs/filter-dark.svg", - "dark": "resources/imgs/filter-light.svg" - } - }, - { - "command": "cics-extension-for-zowe.filterPlexResources", - "title": "Filter Plex Resources in Regions tree", - "category": "IBM CICS for Zowe Explorer", - "icon": { - "light": "resources/imgs/filter-dark.svg", - "dark": "resources/imgs/filter-light.svg" - } - }, - { - "command": "cics-extension-for-zowe.filterAllPrograms", - "title": "Filter All Programs", - "category": "IBM CICS for Zowe Explorer", - "icon": { - "light": "resources/imgs/filter-dark.svg", - "dark": "resources/imgs/filter-light.svg" - } - }, - { - "command": "cics-extension-for-zowe.filterAllLibraries", - "title": "Filter All Libraries", - "category": "IBM CICS for Zowe Explorer", - "icon": { - "light": "resources/imgs/filter-dark.svg", - "dark": "resources/imgs/filter-light.svg" - } - }, - { - "command": "cics-extension-for-zowe.filterAllPipelines", - "title": "Filter All Pipelines", - "category": "IBM CICS for Zowe Explorer", - "icon": { - "light": "resources/imgs/filter-dark.svg", - "dark": "resources/imgs/filter-light.svg" - } - }, - { - "command": "cics-extension-for-zowe.filterAllWebServices", - "title": "Filter All Web Services", - "category": "IBM CICS for Zowe Explorer", - "icon": { - "light": "resources/imgs/filter-dark.svg", - "dark": "resources/imgs/filter-light.svg" - } - }, - { - "command": "cics-extension-for-zowe.filterAllTCPIPServices", - "title": "Filter All TCPIP Services", - "category": "IBM CICS for Zowe Explorer", - "icon": { - "light": "resources/imgs/filter-dark.svg", - "dark": "resources/imgs/filter-light.svg" - } - }, - { - "command": "cics-extension-for-zowe.filterAllURIMaps", - "title": "Filter All URI Maps", - "category": "IBM CICS for Zowe Explorer", - "icon": { - "light": "resources/imgs/filter-dark.svg", - "dark": "resources/imgs/filter-light.svg" - } - }, - { - "command": "cics-extension-for-zowe.filterAllTransactions", - "title": "Filter All Transactions", - "category": "IBM CICS for Zowe Explorer", - "icon": { - "light": "resources/imgs/filter-dark.svg", - "dark": "resources/imgs/filter-light.svg" - } - }, - { - "command": "cics-extension-for-zowe.filterAllLocalFiles", - "title": "Filter All Local Files", - "category": "IBM CICS for Zowe Explorer", - "icon": { - "light": "resources/imgs/filter-dark.svg", - "dark": "resources/imgs/filter-light.svg" - } - }, - { - "command": "cics-extension-for-zowe.filterAllTasks", - "title": "Filter All Tasks by Transaction ID", - "category": "IBM CICS for Zowe Explorer", - "icon": { - "light": "resources/imgs/filter-dark.svg", - "dark": "resources/imgs/filter-light.svg" - } - }, - { - "command": "cics-extension-for-zowe.clearFilter", - "title": "Clear Resource Filter", - "category": "IBM CICS for Zowe Explorer", - "icon": { - "light": "resources/imgs/clear-filter-dark.svg", - "dark": "resources/imgs/clear-filter-light.svg" - } - }, - { - "command": "cics-extension-for-zowe.clearPlexFilter", - "title": "Clear Plex Filter", - "category": "IBM CICS for Zowe Explorer", - "icon": { - "light": "resources/imgs/clear-filter-dark.svg", - "dark": "resources/imgs/clear-filter-light.svg" - } - }, - { - "command": "cics-extension-for-zowe.showProgramAttributes", - "title": "Show Attributes", - "category": "IBM CICS for Zowe Explorer" - }, - { - "command": "cics-extension-for-zowe.showLibraryAttributes", - "title": "Show Attributes", - "category": "IBM CICS for Zowe Explorer" - }, - { - "command": "cics-extension-for-zowe.showLibraryDatasetsAttributes", - "title": "Show Attributes", - "category": "IBM CICS for Zowe Explorer" - }, - { - "command": "cics-extension-for-zowe.showTCPIPServiceAttributes", - "title": "Show Attributes", - "category": "IBM CICS for Zowe Explorer" - }, - { - "command": "cics-extension-for-zowe.showURIMapAttributes", - "title": "Show Attributes", - "category": "IBM CICS for Zowe Explorer" - }, - { - "command": "cics-extension-for-zowe.showTransactionAttributes", - "title": "Show Attributes", - "category": "IBM CICS for Zowe Explorer" - }, - { - "command": "cics-extension-for-zowe.showLocalFileAttributes", - "title": "Show Attributes", - "category": "IBM CICS for Zowe Explorer" - }, - { - "command": "cics-extension-for-zowe.showTaskAttributes", - "title": "Show Attributes", - "category": "IBM CICS for Zowe Explorer" - }, - { - "command": "cics-extension-for-zowe.showPipelineAttributes", - "title": "Show Attributes", - "category": "IBM CICS for Zowe Explorer" - }, - { - "command": "cics-extension-for-zowe.showWebServiceAttributes", - "title": "Show Attributes", - "category": "IBM CICS for Zowe Explorer" - }, - { - "command": "cics-extension-for-zowe.showRegionAttributes", - "title": "Show Attributes", - "category": "IBM CICS for Zowe Explorer" - }, - { - "command": "cics-extension-for-zowe.showRegionParameters", - "title": "Show SIT Parameters", - "category": "IBM CICS for Zowe Explorer" - }, - { - "command": "cics-extension-for-zowe.enableProgram", - "title": "Enable Program", - "category": "IBM CICS for Zowe Explorer" - }, - { - "command": "cics-extension-for-zowe.disableProgram", - "title": "Disable Program", - "category": "IBM CICS for Zowe Explorer" - }, - { - "command": "cics-extension-for-zowe.enableTransaction", - "title": "Enable Transaction", - "category": "IBM CICS for Zowe Explorer" - }, - { - "command": "cics-extension-for-zowe.disableTransaction", - "title": "Disable Transaction", - "category": "IBM CICS for Zowe Explorer" - }, - { - "command": "cics-extension-for-zowe.enableLocalFile", - "title": "Enable Local File", - "category": "IBM CICS for Zowe Explorer" - }, - { - "command": "cics-extension-for-zowe.disableLocalFile", - "title": "Disable Local File", - "category": "IBM CICS for Zowe Explorer" - }, - { - "command": "cics-extension-for-zowe.disableLibrary", - "title": "Disable Library", - "category": "IBM CICS for Zowe Explorer" - }, - { - "command": "cics-extension-for-zowe.closeLocalFile", - "title": "Close Local File", - "category": "IBM CICS for Zowe Explorer" - }, - { - "command": "cics-extension-for-zowe.openLocalFile", - "title": "Open Local File", - "category": "IBM CICS for Zowe Explorer" - }, - { - "command": "cics-extension-for-zowe.phaseInCommand", - "title": "Phase In", - "category": "IBM CICS for Zowe Explorer", - "icon": { - "light": "resources/imgs/phasein-dark.svg", - "dark": "resources/imgs/phasein-light.svg" - } - }, - { - "command": "cics-extension-for-zowe.removeSession", - "title": "Hide Profile", - "category": "IBM CICS for Zowe Explorer" - }, - { - "command": "cics-extension-for-zowe.updateSession", - "title": "Update Profile", - "category": "IBM CICS for Zowe Explorer" - }, - { - "command": "cics-extension-for-zowe.deleteSession", - "title": "Delete Profile", - "category": "IBM CICS for Zowe Explorer" - }, - { - "command": "cics-extension-for-zowe.inquireTransaction", - "title": "Inquire Transaction", - "category": "IBM CICS for Zowe Explorer" - }, - { - "command": "cics-extension-for-zowe.inquireProgram", - "title": "Inquire Program", - "category": "IBM CICS for Zowe Explorer" - }, - { - "command": "cics-extension-for-zowe.purgeTask", - "title": "Purge Task", - "category": "IBM CICS for Zowe Explorer" - } + "version": "3.2.0", + "engines": { + "vscode": "^1.79.0" + }, + "categories": [ + "Other" ], - "menus": { - "view/title": [ - { - "command": "cics-extension-for-zowe.refreshTree", - "when": "view == cics-view", - "group": "navigation" - }, - { - "command": "cics-extension-for-zowe.addSession", - "when": "view == cics-view", - "group": "navigation" - } - ], - "view/item/context": [ - { - "when": "view == cics-view && viewItem =~ /^cicsprogram.*/", - "command": "cics-extension-for-zowe.newCopyProgram", - "group": "inline" - }, - { - "when": "view == cics-view && viewItem =~ /^cicsprogram.*/", - "command": "cics-extension-for-zowe.newCopyProgram", - "group": "" - }, - { - "when": "view == cics-view && viewItem =~ /^cicsprogram.*/", - "command": "cics-extension-for-zowe.phaseInCommand", - "group": "inline" - }, - { - "when": "view == cics-view && viewItem =~ /^cicsprogram.*/", - "command": "cics-extension-for-zowe.phaseInCommand", - "group": "" - }, - { - "when": "view == cics-view && viewItem =~ /^cicsregion\\./", - "command": "cics-extension-for-zowe.showRegionAttributes", - "group": "" - }, - { - "when": "view == cics-view && viewItem =~ /^cicsregion\\./", - "command": "cics-extension-for-zowe.showRegionParameters", - "group": "" - }, - { - "when": "view == cics-view && viewItem =~ /^cicstreeprogram.*/", - "command": "cics-extension-for-zowe.filterPrograms", - "group": "inline" - }, - { - "when": "view == cics-view && viewItem =~ /^cicsdatasets.*/", - "command": "cics-extension-for-zowe.filterDatasetPrograms", - "group": "inline" - }, - { - "when": "view == cics-view && viewItem =~ /^cicstreelibrary.*/", - "command": "cics-extension-for-zowe.filterLibraries", - "group": "inline" - }, - { - "when": "view == cics-view && viewItem =~ /^cicstreetcpips.*/", - "command": "cics-extension-for-zowe.filterTCPIPServices", - "group": "inline" - }, - { - "when": "view == cics-view && viewItem =~ /^cicstreeurimaps.*/", - "command": "cics-extension-for-zowe.filterURIMaps", - "group": "inline" - }, - { - "when": "view == cics-view && viewItem =~ /^cicstreepipeline.*/", - "command": "cics-extension-for-zowe.filterPipelines", - "group": "inline" - }, - { - "when": "view == cics-view && viewItem =~ /^cicstreewebservice.*/", - "command": "cics-extension-for-zowe.filterWebServices", - "group": "inline" - }, - { - "when": "view == cics-view && viewItem =~ /^cicslibrary.*/", - "command": "cics-extension-for-zowe.filterDatasets", - "group": "inline" - }, - { - "when": "view == cics-view && viewItem =~ /^cicstreeprogram.filtered.*/", - "command": "cics-extension-for-zowe.clearFilter", - "group": "inline" - }, - { - "when": "view == cics-view && viewItem =~ /^cicstreetransaction.filtered.*/", - "command": "cics-extension-for-zowe.clearFilter", - "group": "inline" - }, - { - "when": "view == cics-view && viewItem =~ /^cicstreelocalfile.filtered.*/", - "command": "cics-extension-for-zowe.clearFilter", - "group": "inline" - }, - { - "when": "view == cics-view && viewItem =~ /^cicstreetask.filtered.*/", - "command": "cics-extension-for-zowe.clearFilter", - "group": "inline" - }, - { - "when": "view == cics-view && viewItem =~ /^cicstreelibrary.filtered.*/", - "command": "cics-extension-for-zowe.clearFilter", - "group": "inline" - }, - { - "when": "view == cics-view && viewItem =~ /^cicslibrary.filtered.*/", - "command": "cics-extension-for-zowe.clearFilter", - "group": "inline" - }, - { - "when": "view == cics-view && viewItem =~ /^cicsdatasets.filtered.*/", - "command": "cics-extension-for-zowe.clearFilter", - "group": "inline" - }, - { - "when": "view == cics-view && viewItem =~ /^cicstreetcpips.filtered.*/", - "command": "cics-extension-for-zowe.clearFilter", - "group": "inline" - }, - { - "when": "view == cics-view && viewItem =~ /^cicstreeurimaps.filtered.*/", - "command": "cics-extension-for-zowe.clearFilter", - "group": "inline" - }, - { - "when": "view == cics-view && viewItem =~ /^cicstreepipeline.filtered.*/", - "command": "cics-extension-for-zowe.clearFilter", - "group": "inline" - }, - { - "when": "view == cics-view && viewItem =~ /^cicstreewebservice.filtered.*/", - "command": "cics-extension-for-zowe.clearFilter", - "group": "inline" - }, - { - "when": "view == cics-view && viewItem =~ /^cicstreetransaction.*/", - "command": "cics-extension-for-zowe.filterTransactions", - "group": "inline" - }, - { - "when": "view == cics-view && viewItem =~ /^cicstreetask.*/", - "command": "cics-extension-for-zowe.filterTasks", - "group": "inline" - }, - { - "when": "view == cics-view && viewItem =~ /^cicstreelocalfile.*/", - "command": "cics-extension-for-zowe.filterLocalFiles", - "group": "inline" - }, - { - "when": "view == cics-view && viewItem =~ /^cicsregionscontainer.*/", - "command": "cics-extension-for-zowe.filterPlexResources", - "group": "inline" - }, - { - "when": "view == cics-view && viewItem =~ /^cicscombinedprogramtree.*/", - "command": "cics-extension-for-zowe.filterAllPrograms", - "group": "inline" - }, - { - "when": "view == cics-view && viewItem =~ /^cicscombinedlibrarytree.*/", - "command": "cics-extension-for-zowe.filterAllLibraries", - "group": "inline" - }, - { - "when": "view == cics-view && viewItem =~ /^cicscombinedpipelinetree.*/", - "command": "cics-extension-for-zowe.filterAllPipelines", - "group": "inline" - }, - { - "when": "view == cics-view && viewItem =~ /^cicscombinedwebservicetree.*/", - "command": "cics-extension-for-zowe.filterAllWebServices", - "group": "inline" - }, - { - "when": "view == cics-view && viewItem =~ /^cicscombinedtcpipstree.*/", - "command": "cics-extension-for-zowe.filterAllTCPIPServices", - "group": "inline" - }, - { - "when": "view == cics-view && viewItem =~ /^cicscombinedurimapstree.*/", - "command": "cics-extension-for-zowe.filterAllURIMaps", - "group": "inline" - }, - { - "when": "view == cics-view && viewItem =~ /^cicscombinedtransactiontree.*/", - "command": "cics-extension-for-zowe.filterAllTransactions", - "group": "inline" - }, - { - "when": "view == cics-view && viewItem =~ /^cicscombinedlocalfiletree.*/", - "command": "cics-extension-for-zowe.filterAllLocalFiles", - "group": "inline" - }, - { - "when": "view == cics-view && viewItem =~ /^cicscombinedtasktree.*/", - "command": "cics-extension-for-zowe.filterAllTasks", - "group": "inline" - }, - { - "when": "view == cics-view && viewItem =~ /^cicsregionscontainer.*/", - "command": "cics-extension-for-zowe.clearPlexFilter", - "group": "inline" - }, - { - "when": "view == cics-view && viewItem =~ /^cicsprogram.*/", - "command": "cics-extension-for-zowe.showProgramAttributes", - "group": "" - }, - { - "when": "view == cics-view && viewItem =~ /^cicslibrary.*/", - "command": "cics-extension-for-zowe.showLibraryAttributes", - "group": "" - }, - { - "when": "view == cics-view && viewItem =~ /^cicsdatasets.*/", - "command": "cics-extension-for-zowe.showLibraryDatasetsAttributes", - "group": "" - }, - { - "when": "view == cics-view && viewItem =~ /^cicstcpips.*/", - "command": "cics-extension-for-zowe.showTCPIPServiceAttributes", - "group": "" - }, - { - "when": "view == cics-view && viewItem =~ /^cicsurimaps.*/", - "command": "cics-extension-for-zowe.showURIMapAttributes", - "group": "" - }, - { - "when": "view == cics-view && viewItem =~ /^cicstransaction.*/", - "command": "cics-extension-for-zowe.showTransactionAttributes", - "group": "000_zowecics_main@0" - }, - { - "when": "view == cics-view && viewItem =~ /^cicslocalfile.*/", - "command": "cics-extension-for-zowe.showLocalFileAttributes", - "group": "" - }, - { - "when": "view == cics-view && viewItem =~ /^cicstask.*/", - "command": "cics-extension-for-zowe.showTaskAttributes", - "group": "000_zowecics_main@0" - }, - { - "when": "view == cics-view && viewItem =~ /^cicspipeline.*/", - "command": "cics-extension-for-zowe.showPipelineAttributes", - "group": "000_zowecics_main@0" - }, - { - "when": "view == cics-view && viewItem =~ /^cicswebservice.*/", - "command": "cics-extension-for-zowe.showWebServiceAttributes", - "group": "000_zowecics_main@0" - }, - { - "when": "view == cics-view && viewItem =~ /^cicsprogram.disabled.*/", - "command": "cics-extension-for-zowe.enableProgram", - "group": "" - }, - { - "when": "view == cics-view && viewItem =~ /^cicsprogram.enabled.*/", - "command": "cics-extension-for-zowe.disableProgram", - "group": "" - }, - { - "when": "view == cics-view && viewItem =~ /^cicstransaction.disabled.*/", - "command": "cics-extension-for-zowe.enableTransaction", - "group": "000_zowecics_main@1" - }, - { - "when": "view == cics-view && viewItem =~ /^cicstransaction.enabled.*/", - "command": "cics-extension-for-zowe.disableTransaction", - "group": "000_zowecics_main@1" - }, - { - "when": "view == cics-view && viewItem =~ /^cicslocalfile.disabled.*/", - "command": "cics-extension-for-zowe.enableLocalFile", - "group": "" - }, - { - "when": "view == cics-view && viewItem =~ /^cicslocalfile.unenabled.*/", - "command": "cics-extension-for-zowe.enableLocalFile", - "group": "" - }, - { - "when": "view == cics-view && viewItem =~ /^cicslocalfile.enabled.*/", - "command": "cics-extension-for-zowe.disableLocalFile", - "group": "" - }, - { - "when": "view == cics-view && viewItem =~ /(?=^cicslocalfile)(?=.*open)/", - "command": "cics-extension-for-zowe.closeLocalFile", - "group": "" - }, - { - "when": "view == cics-view && viewItem =~ /(?=^cicslocalfile)(?=.*closed)/", - "command": "cics-extension-for-zowe.openLocalFile", - "group": "" - }, - { - "when": "view == cics-view && viewItem =~ /^cicssession.*/", - "command": "cics-extension-for-zowe.removeSession", - "title": "Remove Session" - }, - { - "when": "view == cics-view && viewItem =~ /^cicssession.*/", - "command": "cics-extension-for-zowe.updateSession", - "title": "Update Session" - }, - { - "when": "view == cics-view && viewItem =~ /^cicssession.*/", - "command": "cics-extension-for-zowe.deleteSession", - "title": "Delete Session" - }, - { - "when": "view == cics-view && viewItem =~ /^cicstask.*/", - "command": "cics-extension-for-zowe.inquireTransaction", - "group": "001_zowecics_inquire@0" - }, - { - "when": "view == cics-view && viewItem =~ /^cicstransaction.*/", - "command": "cics-extension-for-zowe.inquireProgram", - "group": "001_zowecics_inquire@0" - }, - { - "when": "view == cics-view && viewItem =~ /^cicstask.*/", - "command": "cics-extension-for-zowe.purgeTask", - "group": "000_zowecics_main@1" + "activationEvents": [ + "onCommand:cics-extension-for-zowe.addSession", + "onView:cics-view" + ], + "extensionDependencies": [ + "Zowe.vscode-extension-for-zowe" + ], + "main": "./dist/extension.js", + "icon": "resources/zowe-cics-color.png", + "keywords": [ + "Zowe", + "explorer", + "mainframe", + "dataset", + "z/OS", + "COBOL", + "CICS", + "CMCI" + ], + "contributes": { + "viewsWelcome": [], + "views": { + "zowe": [ + { + "id": "cics-view", + "name": "cics" + } + ] + }, + "commands": [ + { + "command": "cics-extension-for-zowe.addSession", + "title": "Create a CICS Profile", + "category": "IBM CICS for Zowe Explorer", + "icon": { + "light": "resources/imgs/plus-dark.svg", + "dark": "resources/imgs/plus-light.svg" + } + }, + { + "command": "cics-extension-for-zowe.refreshTree", + "title": "Refresh", + "category": "IBM CICS for Zowe Explorer", + "icon": { + "light": "resources/imgs/refresh-dark.svg", + "dark": "resources/imgs/refresh-light.svg" + } + }, + { + "command": "cics-extension-for-zowe.newCopyProgram", + "title": "New Copy", + "category": "IBM CICS for Zowe Explorer", + "icon": { + "light": "resources/imgs/newcopy-dark.svg", + "dark": "resources/imgs/newcopy-light.svg" + } + }, + { + "command": "cics-extension-for-zowe.filterPrograms", + "title": "Filter Programs", + "category": "IBM CICS for Zowe Explorer", + "icon": { + "light": "resources/imgs/filter-dark.svg", + "dark": "resources/imgs/filter-light.svg" + } + }, + { + "command": "cics-extension-for-zowe.filterDatasetPrograms", + "title": "Filter Programs", + "category": "IBM CICS for Zowe Explorer", + "icon": { + "light": "resources/imgs/filter-dark.svg", + "dark": "resources/imgs/filter-light.svg" + } + }, + { + "command": "cics-extension-for-zowe.filterLibraries", + "title": "Filter Libraries", + "category": "IBM CICS for Zowe Explorer", + "icon": { + "light": "resources/imgs/filter-dark.svg", + "dark": "resources/imgs/filter-light.svg" + } + }, + { + "command": "cics-extension-for-zowe.filterDatasets", + "title": "Filter Datasets", + "category": "IBM CICS for Zowe Explorer", + "icon": { + "light": "resources/imgs/filter-dark.svg", + "dark": "resources/imgs/filter-light.svg" + } + }, + { + "command": "cics-extension-for-zowe.filterTCPIPServices", + "title": "Filter TCPIP Services", + "category": "IBM CICS for Zowe Explorer", + "icon": { + "light": "resources/imgs/filter-dark.svg", + "dark": "resources/imgs/filter-light.svg" + } + }, + { + "command": "cics-extension-for-zowe.filterURIMaps", + "title": "Filter URI Maps", + "category": "IBM CICS for Zowe Explorer", + "icon": { + "light": "resources/imgs/filter-dark.svg", + "dark": "resources/imgs/filter-light.svg" + } + }, + { + "command": "cics-extension-for-zowe.filterPipelines", + "title": "Filter Pipelines", + "category": "IBM CICS for Zowe Explorer", + "icon": { + "light": "resources/imgs/filter-dark.svg", + "dark": "resources/imgs/filter-light.svg" + } + }, + { + "command": "cics-extension-for-zowe.filterWebServices", + "title": "Filter Web Services", + "category": "IBM CICS for Zowe Explorer", + "icon": { + "light": "resources/imgs/filter-dark.svg", + "dark": "resources/imgs/filter-light.svg" + } + }, + { + "command": "cics-extension-for-zowe.filterTransactions", + "title": "Filter Transactions", + "category": "IBM CICS for Zowe Explorer", + "icon": { + "light": "resources/imgs/filter-dark.svg", + "dark": "resources/imgs/filter-light.svg" + } + }, + { + "command": "cics-extension-for-zowe.filterTasks", + "title": "Filter Tasks by Transaction ID", + "category": "IBM CICS for Zowe Explorer", + "icon": { + "light": "resources/imgs/filter-dark.svg", + "dark": "resources/imgs/filter-light.svg" + } + }, + { + "command": "cics-extension-for-zowe.filterLocalFiles", + "title": "Filter Local Files", + "category": "IBM CICS for Zowe Explorer", + "icon": { + "light": "resources/imgs/filter-dark.svg", + "dark": "resources/imgs/filter-light.svg" + } + }, + { + "command": "cics-extension-for-zowe.filterPlexResources", + "title": "Filter Plex Resources in Regions tree", + "category": "IBM CICS for Zowe Explorer", + "icon": { + "light": "resources/imgs/filter-dark.svg", + "dark": "resources/imgs/filter-light.svg" + } + }, + { + "command": "cics-extension-for-zowe.filterAllPrograms", + "title": "Filter All Programs", + "category": "IBM CICS for Zowe Explorer", + "icon": { + "light": "resources/imgs/filter-dark.svg", + "dark": "resources/imgs/filter-light.svg" + } + }, + { + "command": "cics-extension-for-zowe.filterAllLibraries", + "title": "Filter All Libraries", + "category": "IBM CICS for Zowe Explorer", + "icon": { + "light": "resources/imgs/filter-dark.svg", + "dark": "resources/imgs/filter-light.svg" + } + }, + { + "command": "cics-extension-for-zowe.filterAllPipelines", + "title": "Filter All Pipelines", + "category": "IBM CICS for Zowe Explorer", + "icon": { + "light": "resources/imgs/filter-dark.svg", + "dark": "resources/imgs/filter-light.svg" + } + }, + { + "command": "cics-extension-for-zowe.filterAllWebServices", + "title": "Filter All Web Services", + "category": "IBM CICS for Zowe Explorer", + "icon": { + "light": "resources/imgs/filter-dark.svg", + "dark": "resources/imgs/filter-light.svg" + } + }, + { + "command": "cics-extension-for-zowe.filterAllTCPIPServices", + "title": "Filter All TCPIP Services", + "category": "IBM CICS for Zowe Explorer", + "icon": { + "light": "resources/imgs/filter-dark.svg", + "dark": "resources/imgs/filter-light.svg" + } + }, + { + "command": "cics-extension-for-zowe.filterAllURIMaps", + "title": "Filter All URI Maps", + "category": "IBM CICS for Zowe Explorer", + "icon": { + "light": "resources/imgs/filter-dark.svg", + "dark": "resources/imgs/filter-light.svg" + } + }, + { + "command": "cics-extension-for-zowe.filterAllTransactions", + "title": "Filter All Transactions", + "category": "IBM CICS for Zowe Explorer", + "icon": { + "light": "resources/imgs/filter-dark.svg", + "dark": "resources/imgs/filter-light.svg" + } + }, + { + "command": "cics-extension-for-zowe.filterAllLocalFiles", + "title": "Filter All Local Files", + "category": "IBM CICS for Zowe Explorer", + "icon": { + "light": "resources/imgs/filter-dark.svg", + "dark": "resources/imgs/filter-light.svg" + } + }, + { + "command": "cics-extension-for-zowe.filterAllTasks", + "title": "Filter All Tasks by Transaction ID", + "category": "IBM CICS for Zowe Explorer", + "icon": { + "light": "resources/imgs/filter-dark.svg", + "dark": "resources/imgs/filter-light.svg" + } + }, + { + "command": "cics-extension-for-zowe.clearFilter", + "title": "Clear Resource Filter", + "category": "IBM CICS for Zowe Explorer", + "icon": { + "light": "resources/imgs/clear-filter-dark.svg", + "dark": "resources/imgs/clear-filter-light.svg" + } + }, + { + "command": "cics-extension-for-zowe.clearPlexFilter", + "title": "Clear Plex Filter", + "category": "IBM CICS for Zowe Explorer", + "icon": { + "light": "resources/imgs/clear-filter-dark.svg", + "dark": "resources/imgs/clear-filter-light.svg" + } + }, + { + "command": "cics-extension-for-zowe.showProgramAttributes", + "title": "Show Attributes", + "category": "IBM CICS for Zowe Explorer" + }, + { + "command": "cics-extension-for-zowe.showLibraryAttributes", + "title": "Show Attributes", + "category": "IBM CICS for Zowe Explorer" + }, + { + "command": "cics-extension-for-zowe.showLibraryDatasetsAttributes", + "title": "Show Attributes", + "category": "IBM CICS for Zowe Explorer" + }, + { + "command": "cics-extension-for-zowe.showTCPIPServiceAttributes", + "title": "Show Attributes", + "category": "IBM CICS for Zowe Explorer" + }, + { + "command": "cics-extension-for-zowe.showURIMapAttributes", + "title": "Show Attributes", + "category": "IBM CICS for Zowe Explorer" + }, + { + "command": "cics-extension-for-zowe.showTransactionAttributes", + "title": "Show Attributes", + "category": "IBM CICS for Zowe Explorer" + }, + { + "command": "cics-extension-for-zowe.showLocalFileAttributes", + "title": "Show Attributes", + "category": "IBM CICS for Zowe Explorer" + }, + { + "command": "cics-extension-for-zowe.showTaskAttributes", + "title": "Show Attributes", + "category": "IBM CICS for Zowe Explorer" + }, + { + "command": "cics-extension-for-zowe.showPipelineAttributes", + "title": "Show Attributes", + "category": "IBM CICS for Zowe Explorer" + }, + { + "command": "cics-extension-for-zowe.showWebServiceAttributes", + "title": "Show Attributes", + "category": "IBM CICS for Zowe Explorer" + }, + { + "command": "cics-extension-for-zowe.showRegionAttributes", + "title": "Show Attributes", + "category": "IBM CICS for Zowe Explorer" + }, + { + "command": "cics-extension-for-zowe.showRegionParameters", + "title": "Show SIT Parameters", + "category": "IBM CICS for Zowe Explorer" + }, + { + "command": "cics-extension-for-zowe.enableProgram", + "title": "Enable Program", + "category": "IBM CICS for Zowe Explorer" + }, + { + "command": "cics-extension-for-zowe.disableProgram", + "title": "Disable Program", + "category": "IBM CICS for Zowe Explorer" + }, + { + "command": "cics-extension-for-zowe.enableTransaction", + "title": "Enable Transaction", + "category": "IBM CICS for Zowe Explorer" + }, + { + "command": "cics-extension-for-zowe.disableTransaction", + "title": "Disable Transaction", + "category": "IBM CICS for Zowe Explorer" + }, + { + "command": "cics-extension-for-zowe.enableLocalFile", + "title": "Enable Local File", + "category": "IBM CICS for Zowe Explorer" + }, + { + "command": "cics-extension-for-zowe.disableLocalFile", + "title": "Disable Local File", + "category": "IBM CICS for Zowe Explorer" + }, + { + "command": "cics-extension-for-zowe.disableLibrary", + "title": "Disable Library", + "category": "IBM CICS for Zowe Explorer" + }, + { + "command": "cics-extension-for-zowe.closeLocalFile", + "title": "Close Local File", + "category": "IBM CICS for Zowe Explorer" + }, + { + "command": "cics-extension-for-zowe.openLocalFile", + "title": "Open Local File", + "category": "IBM CICS for Zowe Explorer" + }, + { + "command": "cics-extension-for-zowe.phaseInCommand", + "title": "Phase In", + "category": "IBM CICS for Zowe Explorer", + "icon": { + "light": "resources/imgs/phasein-dark.svg", + "dark": "resources/imgs/phasein-light.svg" + } + }, + { + "command": "cics-extension-for-zowe.manageSession", + "title": "Manage Profile", + "category": "IBM CICS for Zowe Explorer" + }, + { + "command": "cics-extension-for-zowe.inquireTransaction", + "title": "Inquire Transaction", + "category": "IBM CICS for Zowe Explorer" + }, + { + "command": "cics-extension-for-zowe.inquireProgram", + "title": "Inquire Program", + "category": "IBM CICS for Zowe Explorer" + }, + { + "command": "cics-extension-for-zowe.purgeTask", + "title": "Purge Task", + "category": "IBM CICS for Zowe Explorer" + } + ], + "menus": { + "view/title": [ + { + "command": "cics-extension-for-zowe.refreshTree", + "when": "view == cics-view", + "group": "navigation" + }, + { + "command": "cics-extension-for-zowe.addSession", + "when": "view == cics-view", + "group": "navigation" + } + ], + "view/item/context": [ + { + "when": "view == cics-view && viewItem =~ /^cicsprogram.*/", + "command": "cics-extension-for-zowe.newCopyProgram", + "group": "inline" + }, + { + "when": "view == cics-view && viewItem =~ /^cicsprogram.*/", + "command": "cics-extension-for-zowe.newCopyProgram", + "group": "" + }, + { + "when": "view == cics-view && viewItem =~ /^cicsprogram.*/", + "command": "cics-extension-for-zowe.phaseInCommand", + "group": "inline" + }, + { + "when": "view == cics-view && viewItem =~ /^cicsprogram.*/", + "command": "cics-extension-for-zowe.phaseInCommand", + "group": "" + }, + { + "when": "view == cics-view && viewItem =~ /^cicsregion\\./", + "command": "cics-extension-for-zowe.showRegionAttributes", + "group": "" + }, + { + "when": "view == cics-view && viewItem =~ /^cicsregion\\./", + "command": "cics-extension-for-zowe.showRegionParameters", + "group": "" + }, + { + "when": "view == cics-view && viewItem =~ /^cicstreeprogram.*/", + "command": "cics-extension-for-zowe.filterPrograms", + "group": "inline" + }, + { + "when": "view == cics-view && viewItem =~ /^cicsdatasets.*/", + "command": "cics-extension-for-zowe.filterDatasetPrograms", + "group": "inline" + }, + { + "when": "view == cics-view && viewItem =~ /^cicstreelibrary.*/", + "command": "cics-extension-for-zowe.filterLibraries", + "group": "inline" + }, + { + "when": "view == cics-view && viewItem =~ /^cicstreetcpips.*/", + "command": "cics-extension-for-zowe.filterTCPIPServices", + "group": "inline" + }, + { + "when": "view == cics-view && viewItem =~ /^cicstreeurimaps.*/", + "command": "cics-extension-for-zowe.filterURIMaps", + "group": "inline" + }, + { + "when": "view == cics-view && viewItem =~ /^cicstreepipeline.*/", + "command": "cics-extension-for-zowe.filterPipelines", + "group": "inline" + }, + { + "when": "view == cics-view && viewItem =~ /^cicstreewebservice.*/", + "command": "cics-extension-for-zowe.filterWebServices", + "group": "inline" + }, + { + "when": "view == cics-view && viewItem =~ /^cicslibrary.*/", + "command": "cics-extension-for-zowe.filterDatasets", + "group": "inline" + }, + { + "when": "view == cics-view && viewItem =~ /^cicstreeprogram.filtered.*/", + "command": "cics-extension-for-zowe.clearFilter", + "group": "inline" + }, + { + "when": "view == cics-view && viewItem =~ /^cicstreetransaction.filtered.*/", + "command": "cics-extension-for-zowe.clearFilter", + "group": "inline" + }, + { + "when": "view == cics-view && viewItem =~ /^cicstreelocalfile.filtered.*/", + "command": "cics-extension-for-zowe.clearFilter", + "group": "inline" + }, + { + "when": "view == cics-view && viewItem =~ /^cicstreetask.filtered.*/", + "command": "cics-extension-for-zowe.clearFilter", + "group": "inline" + }, + { + "when": "view == cics-view && viewItem =~ /^cicstreelibrary.filtered.*/", + "command": "cics-extension-for-zowe.clearFilter", + "group": "inline" + }, + { + "when": "view == cics-view && viewItem =~ /^cicslibrary.filtered.*/", + "command": "cics-extension-for-zowe.clearFilter", + "group": "inline" + }, + { + "when": "view == cics-view && viewItem =~ /^cicsdatasets.filtered.*/", + "command": "cics-extension-for-zowe.clearFilter", + "group": "inline" + }, + { + "when": "view == cics-view && viewItem =~ /^cicstreetcpips.filtered.*/", + "command": "cics-extension-for-zowe.clearFilter", + "group": "inline" + }, + { + "when": "view == cics-view && viewItem =~ /^cicstreeurimaps.filtered.*/", + "command": "cics-extension-for-zowe.clearFilter", + "group": "inline" + }, + { + "when": "view == cics-view && viewItem =~ /^cicstreepipeline.filtered.*/", + "command": "cics-extension-for-zowe.clearFilter", + "group": "inline" + }, + { + "when": "view == cics-view && viewItem =~ /^cicstreewebservice.filtered.*/", + "command": "cics-extension-for-zowe.clearFilter", + "group": "inline" + }, + { + "when": "view == cics-view && viewItem =~ /^cicstreetransaction.*/", + "command": "cics-extension-for-zowe.filterTransactions", + "group": "inline" + }, + { + "when": "view == cics-view && viewItem =~ /^cicstreetask.*/", + "command": "cics-extension-for-zowe.filterTasks", + "group": "inline" + }, + { + "when": "view == cics-view && viewItem =~ /^cicstreelocalfile.*/", + "command": "cics-extension-for-zowe.filterLocalFiles", + "group": "inline" + }, + { + "when": "view == cics-view && viewItem =~ /^cicsregionscontainer.*/", + "command": "cics-extension-for-zowe.filterPlexResources", + "group": "inline" + }, + { + "when": "view == cics-view && viewItem =~ /^cicscombinedprogramtree.*/", + "command": "cics-extension-for-zowe.filterAllPrograms", + "group": "inline" + }, + { + "when": "view == cics-view && viewItem =~ /^cicscombinedlibrarytree.*/", + "command": "cics-extension-for-zowe.filterAllLibraries", + "group": "inline" + }, + { + "when": "view == cics-view && viewItem =~ /^cicscombinedpipelinetree.*/", + "command": "cics-extension-for-zowe.filterAllPipelines", + "group": "inline" + }, + { + "when": "view == cics-view && viewItem =~ /^cicscombinedwebservicetree.*/", + "command": "cics-extension-for-zowe.filterAllWebServices", + "group": "inline" + }, + { + "when": "view == cics-view && viewItem =~ /^cicscombinedtcpipstree.*/", + "command": "cics-extension-for-zowe.filterAllTCPIPServices", + "group": "inline" + }, + { + "when": "view == cics-view && viewItem =~ /^cicscombinedurimapstree.*/", + "command": "cics-extension-for-zowe.filterAllURIMaps", + "group": "inline" + }, + { + "when": "view == cics-view && viewItem =~ /^cicscombinedtransactiontree.*/", + "command": "cics-extension-for-zowe.filterAllTransactions", + "group": "inline" + }, + { + "when": "view == cics-view && viewItem =~ /^cicscombinedlocalfiletree.*/", + "command": "cics-extension-for-zowe.filterAllLocalFiles", + "group": "inline" + }, + { + "when": "view == cics-view && viewItem =~ /^cicscombinedtasktree.*/", + "command": "cics-extension-for-zowe.filterAllTasks", + "group": "inline" + }, + { + "when": "view == cics-view && viewItem =~ /^cicsregionscontainer.*/", + "command": "cics-extension-for-zowe.clearPlexFilter", + "group": "inline" + }, + { + "when": "view == cics-view && viewItem =~ /^cicsprogram.*/", + "command": "cics-extension-for-zowe.showProgramAttributes", + "group": "" + }, + { + "when": "view == cics-view && viewItem =~ /^cicslibrary.*/", + "command": "cics-extension-for-zowe.showLibraryAttributes", + "group": "" + }, + { + "when": "view == cics-view && viewItem =~ /^cicsdatasets.*/", + "command": "cics-extension-for-zowe.showLibraryDatasetsAttributes", + "group": "" + }, + { + "when": "view == cics-view && viewItem =~ /^cicstcpips.*/", + "command": "cics-extension-for-zowe.showTCPIPServiceAttributes", + "group": "" + }, + { + "when": "view == cics-view && viewItem =~ /^cicsurimaps.*/", + "command": "cics-extension-for-zowe.showURIMapAttributes", + "group": "" + }, + { + "when": "view == cics-view && viewItem =~ /^cicstransaction.*/", + "command": "cics-extension-for-zowe.showTransactionAttributes", + "group": "000_zowecics_main@0" + }, + { + "when": "view == cics-view && viewItem =~ /^cicslocalfile.*/", + "command": "cics-extension-for-zowe.showLocalFileAttributes", + "group": "" + }, + { + "when": "view == cics-view && viewItem =~ /^cicstask.*/", + "command": "cics-extension-for-zowe.showTaskAttributes", + "group": "000_zowecics_main@0" + }, + { + "when": "view == cics-view && viewItem =~ /^cicspipeline.*/", + "command": "cics-extension-for-zowe.showPipelineAttributes", + "group": "000_zowecics_main@0" + }, + { + "when": "view == cics-view && viewItem =~ /^cicswebservice.*/", + "command": "cics-extension-for-zowe.showWebServiceAttributes", + "group": "000_zowecics_main@0" + }, + { + "when": "view == cics-view && viewItem =~ /^cicsprogram.disabled.*/", + "command": "cics-extension-for-zowe.enableProgram", + "group": "" + }, + { + "when": "view == cics-view && viewItem =~ /^cicsprogram.enabled.*/", + "command": "cics-extension-for-zowe.disableProgram", + "group": "" + }, + { + "when": "view == cics-view && viewItem =~ /^cicstransaction.disabled.*/", + "command": "cics-extension-for-zowe.enableTransaction", + "group": "000_zowecics_main@1" + }, + { + "when": "view == cics-view && viewItem =~ /^cicstransaction.enabled.*/", + "command": "cics-extension-for-zowe.disableTransaction", + "group": "000_zowecics_main@1" + }, + { + "when": "view == cics-view && viewItem =~ /^cicslocalfile.disabled.*/", + "command": "cics-extension-for-zowe.enableLocalFile", + "group": "" + }, + { + "when": "view == cics-view && viewItem =~ /^cicslocalfile.unenabled.*/", + "command": "cics-extension-for-zowe.enableLocalFile", + "group": "" + }, + { + "when": "view == cics-view && viewItem =~ /^cicslocalfile.enabled.*/", + "command": "cics-extension-for-zowe.disableLocalFile", + "group": "" + }, + { + "when": "view == cics-view && viewItem =~ /(?=^cicslocalfile)(?=.*open)/", + "command": "cics-extension-for-zowe.closeLocalFile", + "group": "" + }, + { + "when": "view == cics-view && viewItem =~ /(?=^cicslocalfile)(?=.*closed)/", + "command": "cics-extension-for-zowe.openLocalFile", + "group": "" + }, + { + "when": "view == cics-view && viewItem =~ /^cicssession.*/", + "command": "cics-extension-for-zowe.manageSession", + "title": "Manage Session" + }, + { + "when": "view == cics-view && viewItem =~ /^cicstask.*/", + "command": "cics-extension-for-zowe.inquireTransaction", + "group": "001_zowecics_inquire@0" + }, + { + "when": "view == cics-view && viewItem =~ /^cicstransaction.*/", + "command": "cics-extension-for-zowe.inquireProgram", + "group": "001_zowecics_inquire@0" + }, + { + "when": "view == cics-view && viewItem =~ /^cicstask.*/", + "command": "cics-extension-for-zowe.purgeTask", + "group": "000_zowecics_main@1" + } + ] + }, + "configuration": { + "type": "object", + "title": "IBM CICS for Zowe Explorer", + "properties": { + "zowe.cics.persistent": { + "default": { + "persistence": true, + "programSearchHistory": [], + "transactionSearchHistory": [], + "localFileSearchHistory": [], + "loadedCICSProfile": [] + }, + "description": "Zowe CICS Extension History", + "scope": "window" + }, + "zowe.cics.program.filter": { + "type": "string", + "default": "NOT (PROGRAM=CEE* OR PROGRAM=DFH* OR PROGRAM=CJ* OR PROGRAM=EYU* OR PROGRAM=CSQ* OR PROGRAM=CEL* OR PROGRAM=IGZ*)", + "description": "Default filter criteria for Programs", + "scope": "window" + }, + "zowe.cics.transaction.filter": { + "type": "string", + "default": "NOT (program=DFH* OR program=EYU*)", + "description": "Default filter criteria for Transactions", + "scope": "window" + }, + "zowe.cics.localFile.filter": { + "type": "string", + "default": "file=*", + "description": "Default filter criteria for Local Files", + "scope": "window" + }, + "zowe.cics.tasks.filter": { + "type": "string", + "default": "(TRANID=*)", + "description": "Default filter criteria for Tasks", + "scope": "window" + }, + "zowe.cics.library.filter": { + "type": "string", + "default": "(NAME=*)", + "description": "Default filter criteria for Library", + "scope": "window" + }, + "zowe.cics.allPrograms.recordCountIncrement": { + "type": "number", + "default": 500, + "description": "Record count increment criteria for 'All Programs'", + "scope": "window", + "minimum": 1 + }, + "zowe.cics.allTransactions.recordCountIncrement": { + "type": "number", + "default": 500, + "description": "Record count increment criteria for 'All Transactions'", + "scope": "window", + "minimum": 1 + }, + "zowe.cics.allLocalFiles.recordCountIncrement": { + "type": "number", + "default": 500, + "description": "Record count increment criteria for 'All Local Files'", + "scope": "window", + "minimum": 1 + }, + "zowe.cics.allTasks.recordCountIncrement": { + "type": "number", + "default": 500, + "description": "Record count increment criteria for 'All Tasks'", + "scope": "window", + "minimum": 1 + }, + "zowe.cics.allLibraries.recordCountIncrement": { + "type": "number", + "default": 500, + "description": "Record count increment criteria for 'All Libraries'", + "scope": "window", + "minimum": 1 + }, + "zowe.cics.allTCPIPS.recordCountIncrement": { + "type": "number", + "default": 500, + "description": "Record count increment criteria for 'All TCPIP Services'", + "scope": "window", + "minimum": 1 + }, + "zowe.cics.allURIMaps.recordCountIncrement": { + "type": "number", + "default": 500, + "description": "Record count increment criteria for 'All URI Maps'", + "scope": "window", + "minimum": 1 + }, + "zowe.cics.allPipelines.recordCountIncrement": { + "type": "number", + "default": 500, + "description": "Record count increment criteria for 'All Pipelines'", + "scope": "window", + "minimum": 1 + }, + "zowe.cics.allWebServices.recordCountIncrement": { + "type": "number", + "default": 500, + "description": "Record count increment criteria for 'All Web Services'", + "scope": "window", + "minimum": 1 + } + } } - ] }, - "configuration": { - "type": "object", - "title": "IBM CICS for Zowe Explorer", - "properties": { - "zowe.cics.persistent": { - "default": { - "persistence": true, - "programSearchHistory": [], - "transactionSearchHistory": [], - "localFileSearchHistory": [], - "loadedCICSProfile": [] - }, - "description": "Zowe CICS Extension History", - "scope": "window" - }, - "zowe.cics.program.filter": { - "type": "string", - "default": "NOT (PROGRAM=CEE* OR PROGRAM=DFH* OR PROGRAM=CJ* OR PROGRAM=EYU* OR PROGRAM=CSQ* OR PROGRAM=CEL* OR PROGRAM=IGZ*)", - "description": "Default filter criteria for Programs", - "scope": "window" - }, - "zowe.cics.transaction.filter": { - "type": "string", - "default": "NOT (program=DFH* OR program=EYU*)", - "description": "Default filter criteria for Transactions", - "scope": "window" - }, - "zowe.cics.localFile.filter": { - "type": "string", - "default": "file=*", - "description": "Default filter criteria for Local Files", - "scope": "window" - }, - "zowe.cics.tasks.filter": { - "type": "string", - "default": "(TRANID=*)", - "description": "Default filter criteria for Tasks", - "scope": "window" - }, - "zowe.cics.library.filter": { - "type": "string", - "default": "(NAME=*)", - "description": "Default filter criteria for Library", - "scope": "window" - }, - "zowe.cics.allPrograms.recordCountIncrement": { - "type": "number", - "default": 500, - "description": "Record count increment criteria for 'All Programs'", - "scope": "window", - "minimum": 1 - }, - "zowe.cics.allTransactions.recordCountIncrement": { - "type": "number", - "default": 500, - "description": "Record count increment criteria for 'All Transactions'", - "scope": "window", - "minimum": 1 - }, - "zowe.cics.allLocalFiles.recordCountIncrement": { - "type": "number", - "default": 500, - "description": "Record count increment criteria for 'All Local Files'", - "scope": "window", - "minimum": 1 - }, - "zowe.cics.allTasks.recordCountIncrement": { - "type": "number", - "default": 500, - "description": "Record count increment criteria for 'All Tasks'", - "scope": "window", - "minimum": 1 - }, - "zowe.cics.allLibraries.recordCountIncrement": { - "type": "number", - "default": 500, - "description": "Record count increment criteria for 'All Libraries'", - "scope": "window", - "minimum": 1 - }, - "zowe.cics.allTCPIPS.recordCountIncrement": { - "type": "number", - "default": 500, - "description": "Record count increment criteria for 'All TCPIP Services'", - "scope": "window", - "minimum": 1 - }, - "zowe.cics.allURIMaps.recordCountIncrement": { - "type": "number", - "default": 500, - "description": "Record count increment criteria for 'All URI Maps'", - "scope": "window", - "minimum": 1 - }, - "zowe.cics.allPipelines.recordCountIncrement": { - "type": "number", - "default": 500, - "description": "Record count increment criteria for 'All Pipelines'", - "scope": "window", - "minimum": 1 - }, - "zowe.cics.allWebServices.recordCountIncrement": { - "type": "number", - "default": 500, - "description": "Record count increment criteria for 'All Web Services'", - "scope": "window", - "minimum": 1 - } - } + "scripts": { + "vscode:prepublish": "npm run getPrebuilds && npm run tsupDep -- add && tsup && npm run tsupDep", + "build": "tsup && npm run checkTestsCompile && npm run madge", + "checkTestsCompile": "echo \"Checking that test source compiles...\" && tsc --project __tests__/test-tsconfig.json --noEmit ", + "madge": "echo 'Nothing to check'", + "lint": "eslint src --ext ts", + "prebuild": "npm run clean && echo Using TypeScript && tsc --version && echo Using TSUP && tsup --version", + "clean": "rimraf lib && rimraf dist", + "watch": "tsup --watch", + "test:system": "echo 'Please run the system tests via VSCode UI' && exit 0", + "test:unit": "jest --config unit.jest_config.ts --no-coverage", + "test": "npm run test:unit", + "tsupDep": "node ./scripts/tsup-deps.js", + "getPrebuilds": "node ./scripts/getSecretsPrebuilds.js", + "package": "vsce package --dependencies --allow-star-activation && node ../../scripts/mv-pack.js cics-extension-for-zowe vsix" + }, + "devDependencies": { + "@types/vscode": "~1.53.0", + "@vscode/vsce": "^2.32.0" + }, + "dependencies": { + "@zowe/cics-for-zowe-sdk": "6.2.0", + "@zowe/core-for-zowe-sdk": "^8.0.0", + "@zowe/zowe-explorer-api": "^3.0.3", + "axios": "^1.6.7", + "xml-js": "~1.6.11" } - }, - "scripts": { - "vscode:prepublish": "npm run getPrebuilds && npm run tsupDep -- add && tsup && npm run tsupDep", - "build": "tsup && npm run checkTestsCompile && npm run madge", - "checkTestsCompile": "echo \"Checking that test source compiles...\" && tsc --project __tests__/test-tsconfig.json --noEmit ", - "madge": "echo 'Nothing to check'", - "lint": "eslint src --ext ts", - "prebuild": "npm run clean && echo Using TypeScript && tsc --version && echo Using TSUP && tsup --version", - "clean": "rimraf lib && rimraf dist", - "watch": "tsup --watch", - "test:system": "echo 'Please run the system tests via VSCode UI' && exit 0", - "test:unit": "jest --config unit.jest_config.ts --no-coverage", - "test": "npm run test:unit", - "tsupDep": "node ./scripts/tsup-deps.js", - "getPrebuilds": "node ./scripts/getSecretsPrebuilds.js", - "package": "vsce package --dependencies --allow-star-activation && node ../../scripts/mv-pack.js cics-extension-for-zowe vsix" - }, - "devDependencies": { - "@types/vscode": "~1.53.0", - "@vscode/vsce": "^2.32.0" - }, - "dependencies": { - "@zowe/cics-for-zowe-sdk": "6.2.0", - "@zowe/core-for-zowe-sdk": "^8.0.0", - "@zowe/zowe-explorer-api": "^3.0.3", - "axios": "^1.6.7", - "xml-js": "~1.6.11" - } } diff --git a/packages/vsce/src/commands/deleteSessionCommand.ts b/packages/vsce/src/commands/deleteSessionCommand.ts deleted file mode 100644 index 30234912..00000000 --- a/packages/vsce/src/commands/deleteSessionCommand.ts +++ /dev/null @@ -1,46 +0,0 @@ -/** - * 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 { commands, TreeView, window } from "vscode"; -import { CICSSessionTree } from "../trees/CICSSessionTree"; -import { CICSTree } from "../trees/CICSTree"; -import { findSelectedNodes } from "../utils/commandUtils"; -import { ProfileManagement } from "../utils/profileManagement"; -import { openConfigFile } from "../utils/workspaceUtils"; - -export function getDeleteSessionCommand(tree: CICSTree, treeview: TreeView) { - return commands.registerCommand("cics-extension-for-zowe.deleteSession", async (node) => { - const allSelectedNodes = findSelectedNodes(treeview, CICSSessionTree, node); - if (!allSelectedNodes || !allSelectedNodes.length) { - window.showErrorMessage("No profile selected to delete"); - return; - } - try { - const configInstance = await ProfileManagement.getConfigInstance(); - if (configInstance.getTeamConfig().exists) { - const currentProfile = await ProfileManagement.getProfilesCache().getProfileFromConfig(allSelectedNodes[allSelectedNodes.length - 1].label); - if (currentProfile) { - const filePath = currentProfile.profLoc.osLoc ? currentProfile.profLoc.osLoc[0] : ""; - await openConfigFile(filePath); - } - } else { - await tree.deleteSession(allSelectedNodes); - } - } catch (error) { - window.showErrorMessage( - `Something went wrong when deleting the profile - ${JSON.stringify(error, Object.getOwnPropertyNames(error)).replace( - /(\\n\t|\\n|\\t)/gm, - " " - )}` - ); - } - }); -} diff --git a/packages/vsce/src/commands/manageSessionCommand.ts b/packages/vsce/src/commands/manageSessionCommand.ts new file mode 100644 index 00000000..d0ee5f99 --- /dev/null +++ b/packages/vsce/src/commands/manageSessionCommand.ts @@ -0,0 +1,19 @@ +/** + * 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 { commands, ProgressLocation, TreeView, window } from "vscode"; +import { CICSSessionTree } from "../trees/CICSSessionTree"; +import { CICSTree } from "../trees/CICSTree"; +import { findSelectedNodes } from "../utils/commandUtils"; + +export function getManageSessionCommand(tree: CICSTree, treeview: TreeView) { + return commands.registerCommand("cics-extension-for-zowe.manageSession", async (node) => tree.manageProfile(treeview, node)); +} diff --git a/packages/vsce/src/commands/removeSessionCommand.ts b/packages/vsce/src/commands/removeSessionCommand.ts deleted file mode 100644 index ce4542f4..00000000 --- a/packages/vsce/src/commands/removeSessionCommand.ts +++ /dev/null @@ -1,55 +0,0 @@ -/** - * 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 { commands, ProgressLocation, TreeView, window } from "vscode"; -import { CICSSessionTree } from "../trees/CICSSessionTree"; -import { CICSTree } from "../trees/CICSTree"; -import { findSelectedNodes } from "../utils/commandUtils"; - -export function getRemoveSessionCommand(tree: CICSTree, treeview: TreeView) { - return commands.registerCommand("cics-extension-for-zowe.removeSession", async (node) => { - const allSelectedNodes = findSelectedNodes(treeview, CICSSessionTree, node); - if (!allSelectedNodes || !allSelectedNodes.length) { - await window.showErrorMessage("No profile selected to remove"); - return; - } - window.withProgress( - { - title: "Hide Profile", - location: ProgressLocation.Notification, - cancellable: true, - }, - async (progress, token) => { - token.onCancellationRequested(() => { - console.log("Cancelling the hide command"); - }); - for (const index in allSelectedNodes) { - progress.report({ - message: `Hiding ${parseInt(index) + 1} of ${allSelectedNodes.length}`, - increment: (parseInt(index) / allSelectedNodes.length) * 100, - }); - try { - const currentNode = allSelectedNodes[parseInt(index)]; - - await tree.removeSession(currentNode); - } catch (error) { - window.showErrorMessage( - `Something went wrong when hiding the profile - ${JSON.stringify(error, Object.getOwnPropertyNames(error)).replace( - /(\\n\t|\\n|\\t)/gm, - " " - )}` - ); - } - } - } - ); - }); -} diff --git a/packages/vsce/src/commands/updateSessionCommand.ts b/packages/vsce/src/commands/updateSessionCommand.ts deleted file mode 100644 index 88dcaf40..00000000 --- a/packages/vsce/src/commands/updateSessionCommand.ts +++ /dev/null @@ -1,59 +0,0 @@ -/** - * 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 { commands, TreeView, window } from "vscode"; -import { CICSSessionTree } from "../trees/CICSSessionTree"; -import { CICSTree } from "../trees/CICSTree"; -import { findSelectedNodes } from "../utils/commandUtils"; -import { openConfigFile } from "../utils/workspaceUtils"; -import { ProfileManagement } from "../utils/profileManagement"; - -export function getUpdateSessionCommand(tree: CICSTree, treeview: TreeView) { - return commands.registerCommand("cics-extension-for-zowe.updateSession", async (node) => { - const allSelectedNodes = findSelectedNodes(treeview, CICSSessionTree, node); - if (!allSelectedNodes || !allSelectedNodes.length) { - window.showErrorMessage("No profile selected to update"); - return; - } - const configInstance = await ProfileManagement.getConfigInstance(); - if (configInstance.getTeamConfig().exists) { - try { - const currentProfile = await ProfileManagement.getProfilesCache().getProfileFromConfig(allSelectedNodes[allSelectedNodes.length - 1].label); - if (currentProfile) { - const filePath = currentProfile.profLoc.osLoc ? currentProfile.profLoc.osLoc[0] : ""; - await openConfigFile(filePath); - } - } catch (error) { - window.showErrorMessage( - `Something went wrong when updating the profile - ${JSON.stringify(error, Object.getOwnPropertyNames(error)).replace( - /(\\n\t|\\n|\\t)/gm, - " " - )}` - ); - return; - } - } else { - for (const sessionTree of allSelectedNodes) { - try { - await tree.updateSession(sessionTree); - } catch (error) { - window.showErrorMessage( - `Something went wrong when updating the profile - ${JSON.stringify(error, Object.getOwnPropertyNames(error)).replace( - /(\\n\t|\\n|\\t)/gm, - " " - )}` - ); - return; - } - } - } - }); -} diff --git a/packages/vsce/src/extension.ts b/packages/vsce/src/extension.ts index 790064d7..9ca670ce 100644 --- a/packages/vsce/src/extension.ts +++ b/packages/vsce/src/extension.ts @@ -10,38 +10,38 @@ */ import { getDisableProgramCommand } from "./commands/disableCommands/disableProgramCommand"; -import { getRemoveSessionCommand } from "./commands/removeSessionCommand"; +import { getManageSessionCommand } from "./commands/manageSessionCommand"; import { getEnableProgramCommand } from "./commands/enableCommands/enableProgramCommand"; import { getAddSessionCommand } from "./commands/addSessionCommand"; import { getNewCopyCommand } from "./commands/newCopyCommand"; import { ExtensionContext, ProgressLocation, TreeItemCollapsibleState, window } from "vscode"; import { getPhaseInCommand } from "./commands/phaseInCommand"; import { - getShowProgramAttributesCommand, - getShowLibraryAttributesCommand, - getShowLibraryDatasetsAttributesCommand, - getShowTCPIPServiceAttributesCommand, - getShowURIMapAttributesCommand, - getShowRegionAttributes, - getShowTransactionAttributesCommand, - getShowLocalFileAttributesCommand, - getShowTaskAttributesCommand, - getShowPipelineAttributesCommand, - getShowWebServiceAttributesCommand, + getShowProgramAttributesCommand, + getShowLibraryAttributesCommand, + getShowLibraryDatasetsAttributesCommand, + getShowTCPIPServiceAttributesCommand, + getShowURIMapAttributesCommand, + getShowRegionAttributes, + getShowTransactionAttributesCommand, + getShowLocalFileAttributesCommand, + getShowTaskAttributesCommand, + getShowPipelineAttributesCommand, + getShowWebServiceAttributesCommand, } from "./commands/showAttributesCommand"; import { getShowRegionSITParametersCommand } from "./commands/showParameterCommand"; import { - getFilterProgramsCommand, - getFilterDatasetProgramsCommand, - getFilterLibrariesCommand, - getFilterDatasetsCommand, - getFilterTransactionCommand, - getFilterLocalFilesCommand, - getFilterTasksCommand, - getFilterTCPIPSCommand, - getFilterURIMapsCommand, - getFilterPipelinesCommand, - getFilterWebServicesCommand, + getFilterProgramsCommand, + getFilterDatasetProgramsCommand, + getFilterLibrariesCommand, + getFilterDatasetsCommand, + getFilterTransactionCommand, + getFilterLocalFilesCommand, + getFilterTasksCommand, + getFilterTCPIPSCommand, + getFilterURIMapsCommand, + getFilterPipelinesCommand, + getFilterWebServicesCommand, } from "./commands/filterResourceCommands"; import { ProfileManagement } from "./utils/profileManagement"; import { CICSTree } from "./trees/CICSTree"; @@ -49,8 +49,6 @@ import { getClearResourceFilterCommand } from "./commands/clearResourceFilterCom import { getFilterPlexResources } from "./commands/getFilterPlexResources"; import { getClearPlexFilterCommand } from "./commands/clearPlexFilterCommand"; import { getRefreshCommand } from "./commands/refreshCommand"; -import { getUpdateSessionCommand } from "./commands/updateSessionCommand"; -import { getDeleteSessionCommand } from "./commands/deleteSessionCommand"; import { getDisableTransactionCommand } from "./commands/disableCommands/disableTransactionCommand"; import { getEnableTransactionCommand } from "./commands/enableCommands/enableTransactionCommand"; import { getEnableLocalFileCommand } from "./commands/enableCommands/enableLocalFileCommand"; @@ -60,15 +58,15 @@ import { getOpenLocalFileCommand } from "./commands/openLocalFileCommand"; import { CICSSessionTree } from "./trees/CICSSessionTree"; import { viewMoreCommand } from "./commands/viewMoreCommand"; import { - getFilterAllProgramsCommand, - getFilterAllLibrariesCommand, - getFilterAllTransactionsCommand, - getFilterAllLocalFilesCommand, - getFilterAllURIMapsCommand, - getFilterAllTCPIPServicesCommand, - getFilterAllTasksCommand, - getFilterAllPipelinesCommand, - getFilterAllWebServicesCommand, + getFilterAllProgramsCommand, + getFilterAllLibrariesCommand, + getFilterAllTransactionsCommand, + getFilterAllLocalFilesCommand, + getFilterAllURIMapsCommand, + getFilterAllTCPIPServicesCommand, + getFilterAllTasksCommand, + getFilterAllPipelinesCommand, + getFilterAllWebServicesCommand, } from "./commands/filterAllResourceCommand"; import { getIconPathInResources, setIconClosed } from "./utils/profileUtils"; import { plexExpansionHandler, sessionExpansionHandler, regionContainerExpansionHandler } from "./utils/expansionHandler"; @@ -85,466 +83,464 @@ import { Logger } from "@zowe/imperative"; * @returns */ export async function activate(context: ExtensionContext) { - const zeVersion = getZoweExplorerVersion(); - const logger = Logger.getAppLogger(); - let treeDataProv: CICSTree = null; - if (!zeVersion) { - window.showErrorMessage("Zowe Explorer was not found: Please ensure Zowe Explorer v2.0.0 or higher is installed"); - return; - } else if (zeVersion[0] !== "3") { - window.showErrorMessage(`Current version of Zowe Explorer is ${zeVersion}. Please ensure Zowe Explorer v3.0.0 or higher is installed`); - return; - } - if (ProfileManagement.apiDoesExist()) { - try { - // Register 'cics' profiles as a ZE extender - await ProfileManagement.registerCICSProfiles(); - ProfileManagement.getProfilesCache().registerCustomProfilesType("cics"); - const apiRegister = await ProfileManagement.getExplorerApis(); - await apiRegister.getExplorerExtenderApi().reloadProfiles(); - if (apiRegister.onProfilesUpdate) { - apiRegister.onProfilesUpdate(async () => { - await treeDataProv.refreshLoadedProfiles(); - }); - } - logger.debug("Zowe Explorer was modified for the CICS Extension."); - } catch (error) { - console.log(error); - logger.error("IBM CICS for Zowe Explorer was not initialized correctly"); - return; + const zeVersion = getZoweExplorerVersion(); + const logger = Logger.getAppLogger(); + let treeDataProv: CICSTree = null; + if (!zeVersion) { + window.showErrorMessage("Zowe Explorer was not found: Please ensure Zowe Explorer v2.0.0 or higher is installed"); + return; + } else if (zeVersion[0] !== "3") { + window.showErrorMessage(`Current version of Zowe Explorer is ${zeVersion}. Please ensure Zowe Explorer v3.0.0 or higher is installed`); + return; } - } else { - window.showErrorMessage( - "Zowe Explorer was not found: either it is not installed or you are using an older version without extensibility API. Please ensure Zowe Explorer v2.0.0-next.202202221200 or higher is installed" - ); - return; - } - - treeDataProv = new CICSTree(); - const treeview = window.createTreeView("cics-view", { - treeDataProvider: treeDataProv, - showCollapseAll: true, - canSelectMany: true, - }); - - treeview.onDidExpandElement(async (node) => { - // Profile node expanded - if (node.element.contextValue.includes("cicssession.")) { - try { - await sessionExpansionHandler(node.element, treeDataProv); - } catch (error) { - console.log(error); - } - // Plex node expanded - } else if (node.element.contextValue.includes("cicsplex.")) { - try { - await plexExpansionHandler(node.element, treeDataProv); - } catch (error) { - console.log(error); - const newSessionTree = new CICSSessionTree( - node.element.getParent().profile, - getIconPathInResources("profile-disconnected-dark.svg", "profile-disconnected-light.svg") - ); - treeDataProv.loadedProfiles.splice(treeDataProv.getLoadedProfiles().indexOf(node.element.getParent()), 1, newSessionTree); - treeDataProv._onDidChangeTreeData.fire(undefined); - } - // Region node expanded - } else if (node.element.contextValue.includes("cicsregion.")) { - // Web folder node expanded - } else if (node.element.contextValue.includes("cicstreeweb.")) { - window.withProgress( - { - title: "Loading Resources", - location: ProgressLocation.Notification, - cancellable: false, - }, - async (_, token) => { - token.onCancellationRequested(() => { - console.log("Cancelling the loading of resources"); - }); - await node.element.loadContents(); - treeDataProv._onDidChangeTreeData.fire(undefined); - } - ); - node.element.collapsibleState = TreeItemCollapsibleState.Expanded; - // Programs folder node expanded - } else if (node.element.contextValue.includes("cicstreeprogram.")) { - window.withProgress( - { - title: "Loading Programs", - location: ProgressLocation.Notification, - cancellable: false, - }, - async (_, token) => { - token.onCancellationRequested(() => { - console.log("Cancelling the loading of programs"); - }); - await node.element.loadContents(); - treeDataProv._onDidChangeTreeData.fire(undefined); - } - ); - node.element.collapsibleState = TreeItemCollapsibleState.Expanded; - - // Transaction folder node expanded - } else if (node.element.contextValue.includes("cicstreetransaction.")) { - window.withProgress( - { - title: "Loading Transactions", - location: ProgressLocation.Notification, - cancellable: false, - }, - async (_, token) => { - token.onCancellationRequested(() => { - console.log("Cancelling the loading of transactions"); - }); - await node.element.loadContents(); - treeDataProv._onDidChangeTreeData.fire(undefined); - } - ); - node.element.collapsibleState = TreeItemCollapsibleState.Expanded; - - // Local file folder node expanded - } else if (node.element.contextValue.includes("cicstreelocalfile.")) { - window.withProgress( - { - title: "Loading Local Files", - location: ProgressLocation.Notification, - cancellable: false, - }, - async (_, token) => { - token.onCancellationRequested(() => { - console.log("Cancelling the loading of local files"); - }); - await node.element.loadContents(); - treeDataProv._onDidChangeTreeData.fire(undefined); - } - ); - node.element.collapsibleState = TreeItemCollapsibleState.Expanded; - - // Task folder node expanded - } else if (node.element.contextValue.includes("cicstreetask.")) { - window.withProgress( - { - title: "Loading Tasks", - location: ProgressLocation.Notification, - cancellable: false, - }, - async (_, token) => { - token.onCancellationRequested(() => { - console.log("Cancelling the loading of tasks"); - }); - await node.element.loadContents(); - treeDataProv._onDidChangeTreeData.fire(undefined); + if (ProfileManagement.apiDoesExist()) { + try { + // Register 'cics' profiles as a ZE extender + await ProfileManagement.registerCICSProfiles(); + ProfileManagement.getProfilesCache().registerCustomProfilesType("cics"); + const apiRegister = await ProfileManagement.getExplorerApis(); + await apiRegister.getExplorerExtenderApi().reloadProfiles(); + if (apiRegister.onProfilesUpdate) { + apiRegister.onProfilesUpdate(async () => { + await treeDataProv.refreshLoadedProfiles(); + }); + } + logger.debug("Zowe Explorer was modified for the CICS Extension."); + } catch (error) { + console.log(error); + logger.error("IBM CICS for Zowe Explorer was not initialized correctly"); + return; } - ); - node.element.collapsibleState = TreeItemCollapsibleState.Expanded; - - // Library folder node expanded - } else if (node.element.contextValue.includes("cicstreelibrary.")) { - window.withProgress( - { - title: "Loading Libraries", - location: ProgressLocation.Notification, - cancellable: false, - }, - async () => { - await node.element.loadContents(); - treeDataProv._onDidChangeTreeData.fire(undefined); - } - ); - node.element.collapsibleState = TreeItemCollapsibleState.Expanded; - - // Library tree item node expanded to view datasets - } else if (node.element.contextValue.includes("cicslibrary.")) { - window.withProgress( - { - title: "Loading Datasets", - location: ProgressLocation.Notification, - cancellable: false, - }, - async () => { - await node.element.loadContents(); - treeDataProv._onDidChangeTreeData.fire(undefined); - } - ); - node.element.collapsibleState = TreeItemCollapsibleState.Expanded; - - // Dataset node expanded - } else if (node.element.contextValue.includes("cicsdatasets.")) { - window.withProgress( - { - title: "Loading Programs", - location: ProgressLocation.Notification, - cancellable: false, - }, - async () => { - await node.element.loadContents(); - treeDataProv._onDidChangeTreeData.fire(undefined); + } else { + window.showErrorMessage( + "Zowe Explorer was not found: either it is not installed or you are using an older version without extensibility API. Please ensure Zowe Explorer v2.0.0-next.202202221200 or higher is installed" + ); + return; + } + + treeDataProv = new CICSTree(); + const treeview = window.createTreeView("cics-view", { + treeDataProvider: treeDataProv, + showCollapseAll: true, + canSelectMany: true, + }); + + treeview.onDidExpandElement(async (node) => { + // Profile node expanded + if (node.element.contextValue.includes("cicssession.")) { + try { + await sessionExpansionHandler(node.element, treeDataProv); + } catch (error) { + console.log(error); + } + // Plex node expanded + } else if (node.element.contextValue.includes("cicsplex.")) { + try { + await plexExpansionHandler(node.element, treeDataProv); + } catch (error) { + console.log(error); + const newSessionTree = new CICSSessionTree( + node.element.getParent().profile, + getIconPathInResources("profile-disconnected-dark.svg", "profile-disconnected-light.svg") + ); + treeDataProv.loadedProfiles.splice(treeDataProv.getLoadedProfiles().indexOf(node.element.getParent()), 1, newSessionTree); + treeDataProv._onDidChangeTreeData.fire(undefined); + } + // Region node expanded + } else if (node.element.contextValue.includes("cicsregion.")) { + // Web folder node expanded + } else if (node.element.contextValue.includes("cicstreeweb.")) { + window.withProgress( + { + title: "Loading Resources", + location: ProgressLocation.Notification, + cancellable: false, + }, + async (_, token) => { + token.onCancellationRequested(() => { + console.log("Cancelling the loading of resources"); + }); + await node.element.loadContents(); + treeDataProv._onDidChangeTreeData.fire(undefined); + } + ); + node.element.collapsibleState = TreeItemCollapsibleState.Expanded; + // Programs folder node expanded + } else if (node.element.contextValue.includes("cicstreeprogram.")) { + window.withProgress( + { + title: "Loading Programs", + location: ProgressLocation.Notification, + cancellable: false, + }, + async (_, token) => { + token.onCancellationRequested(() => { + console.log("Cancelling the loading of programs"); + }); + await node.element.loadContents(); + treeDataProv._onDidChangeTreeData.fire(undefined); + } + ); + node.element.collapsibleState = TreeItemCollapsibleState.Expanded; + + // Transaction folder node expanded + } else if (node.element.contextValue.includes("cicstreetransaction.")) { + window.withProgress( + { + title: "Loading Transactions", + location: ProgressLocation.Notification, + cancellable: false, + }, + async (_, token) => { + token.onCancellationRequested(() => { + console.log("Cancelling the loading of transactions"); + }); + await node.element.loadContents(); + treeDataProv._onDidChangeTreeData.fire(undefined); + } + ); + node.element.collapsibleState = TreeItemCollapsibleState.Expanded; + + // Local file folder node expanded + } else if (node.element.contextValue.includes("cicstreelocalfile.")) { + window.withProgress( + { + title: "Loading Local Files", + location: ProgressLocation.Notification, + cancellable: false, + }, + async (_, token) => { + token.onCancellationRequested(() => { + console.log("Cancelling the loading of local files"); + }); + await node.element.loadContents(); + treeDataProv._onDidChangeTreeData.fire(undefined); + } + ); + node.element.collapsibleState = TreeItemCollapsibleState.Expanded; + + // Task folder node expanded + } else if (node.element.contextValue.includes("cicstreetask.")) { + window.withProgress( + { + title: "Loading Tasks", + location: ProgressLocation.Notification, + cancellable: false, + }, + async (_, token) => { + token.onCancellationRequested(() => { + console.log("Cancelling the loading of tasks"); + }); + await node.element.loadContents(); + treeDataProv._onDidChangeTreeData.fire(undefined); + } + ); + node.element.collapsibleState = TreeItemCollapsibleState.Expanded; + + // Library folder node expanded + } else if (node.element.contextValue.includes("cicstreelibrary.")) { + window.withProgress( + { + title: "Loading Libraries", + location: ProgressLocation.Notification, + cancellable: false, + }, + async () => { + await node.element.loadContents(); + treeDataProv._onDidChangeTreeData.fire(undefined); + } + ); + node.element.collapsibleState = TreeItemCollapsibleState.Expanded; + + // Library tree item node expanded to view datasets + } else if (node.element.contextValue.includes("cicslibrary.")) { + window.withProgress( + { + title: "Loading Datasets", + location: ProgressLocation.Notification, + cancellable: false, + }, + async () => { + await node.element.loadContents(); + treeDataProv._onDidChangeTreeData.fire(undefined); + } + ); + node.element.collapsibleState = TreeItemCollapsibleState.Expanded; + + // Dataset node expanded + } else if (node.element.contextValue.includes("cicsdatasets.")) { + window.withProgress( + { + title: "Loading Programs", + location: ProgressLocation.Notification, + cancellable: false, + }, + async () => { + await node.element.loadContents(); + treeDataProv._onDidChangeTreeData.fire(undefined); + } + ); + node.element.collapsibleState = TreeItemCollapsibleState.Expanded; + + // TCPIP folder node expanded + } else if (node.element.contextValue.includes("cicstreetcpips.")) { + window.withProgress( + { + title: "Loading TCPIP Services", + location: ProgressLocation.Notification, + cancellable: false, + }, + async (_, token) => { + token.onCancellationRequested(() => { + console.log("Cancelling the loading of TCPIP services"); + }); + await node.element.loadContents(); + treeDataProv._onDidChangeTreeData.fire(undefined); + } + ); + node.element.collapsibleState = TreeItemCollapsibleState.Expanded; + + // Web Services folder node expanded + } else if (node.element.contextValue.includes("cicstreewebservice.")) { + window.withProgress( + { + title: "Loading Web Services", + location: ProgressLocation.Notification, + cancellable: false, + }, + async (_, token) => { + token.onCancellationRequested(() => { + console.log("Cancelling the loading of Web Services"); + }); + await node.element.loadContents(); + treeDataProv._onDidChangeTreeData.fire(undefined); + } + ); + node.element.collapsibleState = TreeItemCollapsibleState.Expanded; + + // Pipeline folder node expanded + } else if (node.element.contextValue.includes("cicstreepipeline.")) { + window.withProgress( + { + title: "Loading Pipeline", + location: ProgressLocation.Notification, + cancellable: false, + }, + async (_, token) => { + token.onCancellationRequested(() => { + console.log("Cancelling the loading of Pipelines"); + }); + await node.element.loadContents(); + treeDataProv._onDidChangeTreeData.fire(undefined); + } + ); + node.element.collapsibleState = TreeItemCollapsibleState.Expanded; + + // URIMap folder node expanded + } else if (node.element.contextValue.includes("cicstreeurimaps.")) { + window.withProgress( + { + title: "Loading URIMaps", + location: ProgressLocation.Notification, + cancellable: false, + }, + async (_, token) => { + token.onCancellationRequested(() => { + console.log("Cancelling the loading of URIMaps"); + }); + await node.element.loadContents(); + treeDataProv._onDidChangeTreeData.fire(undefined); + } + ); + node.element.collapsibleState = TreeItemCollapsibleState.Expanded; + + // All programs folder node expanded + } else if (node.element.contextValue.includes("cicscombinedprogramtree.")) { + // Children only loaded if filter has been applied + if (node.element.getActiveFilter()) { + await node.element.loadContents(treeDataProv); + } + node.element.collapsibleState = TreeItemCollapsibleState.Expanded; + + // All transactions folder node expanded + } else if (node.element.contextValue.includes("cicscombinedtransactiontree.")) { + if (node.element.getActiveFilter()) { + await node.element.loadContents(treeDataProv); + } + node.element.collapsibleState = TreeItemCollapsibleState.Expanded; + + // All local files folder node expanded + } else if (node.element.contextValue.includes("cicscombinedlocalfiletree.")) { + if (node.element.getActiveFilter()) { + await node.element.loadContents(treeDataProv); + } + node.element.collapsibleState = TreeItemCollapsibleState.Expanded; + + // All tasks folder node expanded + } else if (node.element.contextValue.includes("cicscombinedtasktree.")) { + if (node.element.getActiveFilter()) { + await node.element.loadContents(treeDataProv); + } + node.element.collapsibleState = TreeItemCollapsibleState.Expanded; } - ); - node.element.collapsibleState = TreeItemCollapsibleState.Expanded; - - // TCPIP folder node expanded - } else if (node.element.contextValue.includes("cicstreetcpips.")) { - window.withProgress( - { - title: "Loading TCPIP Services", - location: ProgressLocation.Notification, - cancellable: false, - }, - async (_, token) => { - token.onCancellationRequested(() => { - console.log("Cancelling the loading of TCPIP services"); - }); - await node.element.loadContents(); - treeDataProv._onDidChangeTreeData.fire(undefined); + + // All libraries folder node expanded + else if (node.element.contextValue.includes("cicscombinedlibrarytree.")) { + if (node.element.getActiveFilter()) { + await node.element.loadContents(treeDataProv); + } + node.element.collapsibleState = TreeItemCollapsibleState.Expanded; } - ); - node.element.collapsibleState = TreeItemCollapsibleState.Expanded; - - // Web Services folder node expanded - } else if (node.element.contextValue.includes("cicstreewebservice.")) { - window.withProgress( - { - title: "Loading Web Services", - location: ProgressLocation.Notification, - cancellable: false, - }, - async (_, token) => { - token.onCancellationRequested(() => { - console.log("Cancelling the loading of Web Services"); - }); - await node.element.loadContents(); - treeDataProv._onDidChangeTreeData.fire(undefined); + + // All TCPIP Services node expanded + else if (node.element.contextValue.includes("cicscombinedtcpipstree.")) { + if (node.element.getActiveFilter()) { + await node.element.loadContents(treeDataProv); + } + node.element.collapsibleState = TreeItemCollapsibleState.Expanded; } - ); - node.element.collapsibleState = TreeItemCollapsibleState.Expanded; - - // Pipeline folder node expanded - } else if (node.element.contextValue.includes("cicstreepipeline.")) { - window.withProgress( - { - title: "Loading Pipeline", - location: ProgressLocation.Notification, - cancellable: false, - }, - async (_, token) => { - token.onCancellationRequested(() => { - console.log("Cancelling the loading of Pipelines"); - }); - await node.element.loadContents(); - treeDataProv._onDidChangeTreeData.fire(undefined); + + // All URI Maps node expanded + else if (node.element.contextValue.includes("cicscombinedurimapstree.")) { + if (node.element.getActiveFilter()) { + await node.element.loadContents(treeDataProv); + } + node.element.collapsibleState = TreeItemCollapsibleState.Expanded; + + // All Pipeline folder node expanded + } else if (node.element.contextValue.includes("cicscombinedpipelinetree.")) { + if (node.element.getActiveFilter()) { + await node.element.loadContents(treeDataProv); + } + node.element.collapsibleState = TreeItemCollapsibleState.Expanded; + + // All Web Services folder node expanded + } else if (node.element.contextValue.includes("cicscombinedwebservicetree.")) { + if (node.element.getActiveFilter()) { + await node.element.loadContents(treeDataProv); + } + node.element.collapsibleState = TreeItemCollapsibleState.Expanded; + + // Regions container folder node expanded + } else if (node.element.contextValue.includes("cicsregionscontainer.")) { + node.element.iconPath = getIconPathInResources("folder-open-dark.svg", "folder-open-light.svg"); + await regionContainerExpansionHandler(node.element, treeDataProv); + treeDataProv._onDidChangeTreeData.fire(undefined); } - ); - node.element.collapsibleState = TreeItemCollapsibleState.Expanded; - - // URIMap folder node expanded - } else if (node.element.contextValue.includes("cicstreeurimaps.")) { - window.withProgress( - { - title: "Loading URIMaps", - location: ProgressLocation.Notification, - cancellable: false, - }, - async (_, token) => { - token.onCancellationRequested(() => { - console.log("Cancelling the loading of URIMaps"); - }); - await node.element.loadContents(); - treeDataProv._onDidChangeTreeData.fire(undefined); + }); + + treeview.onDidCollapseElement((node) => { + if (node.element.contextValue.includes("cicsregionscontainer.")) { + setIconClosed(node, treeDataProv); + } else if (node.element.contextValue.includes("cicscombinedprogramtree.")) { + setIconClosed(node, treeDataProv); + } else if (node.element.contextValue.includes("cicscombinedtransactiontree.")) { + setIconClosed(node, treeDataProv); + } else if (node.element.contextValue.includes("cicscombinedlocalfiletree.")) { + setIconClosed(node, treeDataProv); + } else if (node.element.contextValue.includes("cicscombinedtasktree.")) { + setIconClosed(node, treeDataProv); + } else if (node.element.contextValue.includes("cicscombinedlibrarytree.")) { + setIconClosed(node, treeDataProv); + } else if (node.element.contextValue.includes("cicscombinedtcpipstree.")) { + setIconClosed(node, treeDataProv); + } else if (node.element.contextValue.includes("cicscombinedurimapstree.")) { + setIconClosed(node, treeDataProv); + } else if (node.element.contextValue.includes("cicscombinedpipelinetree.")) { + setIconClosed(node, treeDataProv); + } else if (node.element.contextValue.includes("cicscombinedwebservicetree.")) { + setIconClosed(node, treeDataProv); + } else if (node.element.contextValue.includes("cicstreeprogram.")) { + setIconClosed(node, treeDataProv); + } else if (node.element.contextValue.includes("cicstreetransaction.")) { + setIconClosed(node, treeDataProv); + } else if (node.element.contextValue.includes("cicstreelocalfile.")) { + setIconClosed(node, treeDataProv); + } else if (node.element.contextValue.includes("cicstreetask.")) { + setIconClosed(node, treeDataProv); + } else if (node.element.contextValue.includes("cicstreelibrary.")) { + setIconClosed(node, treeDataProv); + } else if (node.element.contextValue.includes("cicslibrary.")) { + setIconClosed(node, treeDataProv); + } else if (node.element.contextValue.includes("cicstreeweb.")) { + setIconClosed(node, treeDataProv); + } else if (node.element.contextValue.includes("cicstreetcpips.")) { + setIconClosed(node, treeDataProv); + } else if (node.element.contextValue.includes("cicstreepipeline.")) { + setIconClosed(node, treeDataProv); + } else if (node.element.contextValue.includes("cicstreewebservice.")) { + setIconClosed(node, treeDataProv); + } else if (node.element.contextValue.includes("cicstreeurimaps.")) { + setIconClosed(node, treeDataProv); } - ); - node.element.collapsibleState = TreeItemCollapsibleState.Expanded; - - // All programs folder node expanded - } else if (node.element.contextValue.includes("cicscombinedprogramtree.")) { - // Children only loaded if filter has been applied - if (node.element.getActiveFilter()) { - await node.element.loadContents(treeDataProv); - } - node.element.collapsibleState = TreeItemCollapsibleState.Expanded; - - // All transactions folder node expanded - } else if (node.element.contextValue.includes("cicscombinedtransactiontree.")) { - if (node.element.getActiveFilter()) { - await node.element.loadContents(treeDataProv); - } - node.element.collapsibleState = TreeItemCollapsibleState.Expanded; - - // All local files folder node expanded - } else if (node.element.contextValue.includes("cicscombinedlocalfiletree.")) { - if (node.element.getActiveFilter()) { - await node.element.loadContents(treeDataProv); - } - node.element.collapsibleState = TreeItemCollapsibleState.Expanded; - - // All tasks folder node expanded - } else if (node.element.contextValue.includes("cicscombinedtasktree.")) { - if (node.element.getActiveFilter()) { - await node.element.loadContents(treeDataProv); - } - node.element.collapsibleState = TreeItemCollapsibleState.Expanded; - } - - // All libraries folder node expanded - else if (node.element.contextValue.includes("cicscombinedlibrarytree.")) { - if (node.element.getActiveFilter()) { - await node.element.loadContents(treeDataProv); - } - node.element.collapsibleState = TreeItemCollapsibleState.Expanded; - } - - // All TCPIP Services node expanded - else if (node.element.contextValue.includes("cicscombinedtcpipstree.")) { - if (node.element.getActiveFilter()) { - await node.element.loadContents(treeDataProv); - } - node.element.collapsibleState = TreeItemCollapsibleState.Expanded; - } - - // All URI Maps node expanded - else if (node.element.contextValue.includes("cicscombinedurimapstree.")) { - if (node.element.getActiveFilter()) { - await node.element.loadContents(treeDataProv); - } - node.element.collapsibleState = TreeItemCollapsibleState.Expanded; - - // All Pipeline folder node expanded - } else if (node.element.contextValue.includes("cicscombinedpipelinetree.")) { - if (node.element.getActiveFilter()) { - await node.element.loadContents(treeDataProv); - } - node.element.collapsibleState = TreeItemCollapsibleState.Expanded; - - // All Web Services folder node expanded - } else if (node.element.contextValue.includes("cicscombinedwebservicetree.")) { - if (node.element.getActiveFilter()) { - await node.element.loadContents(treeDataProv); - } - node.element.collapsibleState = TreeItemCollapsibleState.Expanded; - - // Regions container folder node expanded - } else if (node.element.contextValue.includes("cicsregionscontainer.")) { - node.element.iconPath = getIconPathInResources("folder-open-dark.svg", "folder-open-light.svg"); - await regionContainerExpansionHandler(node.element, treeDataProv); - treeDataProv._onDidChangeTreeData.fire(undefined); - } - }); - - treeview.onDidCollapseElement((node) => { - if (node.element.contextValue.includes("cicsregionscontainer.")) { - setIconClosed(node, treeDataProv); - } else if (node.element.contextValue.includes("cicscombinedprogramtree.")) { - setIconClosed(node, treeDataProv); - } else if (node.element.contextValue.includes("cicscombinedtransactiontree.")) { - setIconClosed(node, treeDataProv); - } else if (node.element.contextValue.includes("cicscombinedlocalfiletree.")) { - setIconClosed(node, treeDataProv); - } else if (node.element.contextValue.includes("cicscombinedtasktree.")) { - setIconClosed(node, treeDataProv); - } else if (node.element.contextValue.includes("cicscombinedlibrarytree.")) { - setIconClosed(node, treeDataProv); - } else if (node.element.contextValue.includes("cicscombinedtcpipstree.")) { - setIconClosed(node, treeDataProv); - } else if (node.element.contextValue.includes("cicscombinedurimapstree.")) { - setIconClosed(node, treeDataProv); - } else if (node.element.contextValue.includes("cicscombinedpipelinetree.")) { - setIconClosed(node, treeDataProv); - } else if (node.element.contextValue.includes("cicscombinedwebservicetree.")) { - setIconClosed(node, treeDataProv); - } else if (node.element.contextValue.includes("cicstreeprogram.")) { - setIconClosed(node, treeDataProv); - } else if (node.element.contextValue.includes("cicstreetransaction.")) { - setIconClosed(node, treeDataProv); - } else if (node.element.contextValue.includes("cicstreelocalfile.")) { - setIconClosed(node, treeDataProv); - } else if (node.element.contextValue.includes("cicstreetask.")) { - setIconClosed(node, treeDataProv); - } else if (node.element.contextValue.includes("cicstreelibrary.")) { - setIconClosed(node, treeDataProv); - } else if (node.element.contextValue.includes("cicslibrary.")) { - setIconClosed(node, treeDataProv); - } else if (node.element.contextValue.includes("cicstreeweb.")) { - setIconClosed(node, treeDataProv); - } else if (node.element.contextValue.includes("cicstreetcpips.")) { - setIconClosed(node, treeDataProv); - } else if (node.element.contextValue.includes("cicstreepipeline.")) { - setIconClosed(node, treeDataProv); - } else if (node.element.contextValue.includes("cicstreewebservice.")) { - setIconClosed(node, treeDataProv); - } else if (node.element.contextValue.includes("cicstreeurimaps.")) { - setIconClosed(node, treeDataProv); - } - node.element.collapsibleState = TreeItemCollapsibleState.Collapsed; - }); - - context.subscriptions.push( - getAddSessionCommand(treeDataProv), - getRemoveSessionCommand(treeDataProv, treeview), - getUpdateSessionCommand(treeDataProv, treeview), - getDeleteSessionCommand(treeDataProv, treeview), - - getRefreshCommand(treeDataProv), - - getNewCopyCommand(treeDataProv, treeview), - getPhaseInCommand(treeDataProv, treeview), - - getEnableProgramCommand(treeDataProv, treeview), - getDisableProgramCommand(treeDataProv, treeview), - getEnableTransactionCommand(treeDataProv, treeview), - getDisableTransactionCommand(treeDataProv, treeview), - getEnableLocalFileCommand(treeDataProv, treeview), - getDisableLocalFileCommand(treeDataProv, treeview), - - getCloseLocalFileCommand(treeDataProv, treeview), - getOpenLocalFileCommand(treeDataProv, treeview), - - getPurgeTaskCommand(treeDataProv, treeview), - - getShowRegionAttributes(treeview), - getShowProgramAttributesCommand(treeview), - getShowLibraryAttributesCommand(treeview), - getShowLibraryDatasetsAttributesCommand(treeview), - getShowTCPIPServiceAttributesCommand(treeview), - getShowURIMapAttributesCommand(treeview), - getShowTransactionAttributesCommand(treeview), - getShowLocalFileAttributesCommand(treeview), - getShowTaskAttributesCommand(treeview), - getShowPipelineAttributesCommand(treeview), - getShowWebServiceAttributesCommand(treeview), - - getShowRegionSITParametersCommand(treeview), - - getFilterProgramsCommand(treeDataProv, treeview), - getFilterDatasetProgramsCommand(treeDataProv, treeview), - getFilterLibrariesCommand(treeDataProv, treeview), - getFilterDatasetsCommand(treeDataProv, treeview), - getFilterTransactionCommand(treeDataProv, treeview), - getFilterLocalFilesCommand(treeDataProv, treeview), - getFilterTasksCommand(treeDataProv, treeview), - getFilterTCPIPSCommand(treeDataProv, treeview), - getFilterURIMapsCommand(treeDataProv, treeview), - getFilterPipelinesCommand(treeDataProv, treeview), - getFilterWebServicesCommand(treeDataProv, treeview), - - getFilterAllProgramsCommand(treeDataProv, treeview), - getFilterAllLibrariesCommand(treeDataProv, treeview), - getFilterAllWebServicesCommand(treeDataProv, treeview), - getFilterAllPipelinesCommand(treeDataProv, treeview), - getFilterAllTransactionsCommand(treeDataProv, treeview), - getFilterAllLocalFilesCommand(treeDataProv, treeview), - getFilterAllTasksCommand(treeDataProv, treeview), - getFilterAllTCPIPServicesCommand(treeDataProv, treeview), - getFilterAllURIMapsCommand(treeDataProv, treeview), - - getFilterPlexResources(treeDataProv, treeview), - - getClearResourceFilterCommand(treeDataProv, treeview), - getClearPlexFilterCommand(treeDataProv, treeview), - - viewMoreCommand(treeDataProv, treeview), - - getInquireTransactionCommand(treeDataProv, treeview), - getInquireProgramCommand(treeDataProv, treeview) - ); + node.element.collapsibleState = TreeItemCollapsibleState.Collapsed; + }); + + context.subscriptions.push( + getAddSessionCommand(treeDataProv), + getManageSessionCommand(treeDataProv, treeview), + + getRefreshCommand(treeDataProv), + + getNewCopyCommand(treeDataProv, treeview), + getPhaseInCommand(treeDataProv, treeview), + + getEnableProgramCommand(treeDataProv, treeview), + getDisableProgramCommand(treeDataProv, treeview), + getEnableTransactionCommand(treeDataProv, treeview), + getDisableTransactionCommand(treeDataProv, treeview), + getEnableLocalFileCommand(treeDataProv, treeview), + getDisableLocalFileCommand(treeDataProv, treeview), + + getCloseLocalFileCommand(treeDataProv, treeview), + getOpenLocalFileCommand(treeDataProv, treeview), + + getPurgeTaskCommand(treeDataProv, treeview), + + getShowRegionAttributes(treeview), + getShowProgramAttributesCommand(treeview), + getShowLibraryAttributesCommand(treeview), + getShowLibraryDatasetsAttributesCommand(treeview), + getShowTCPIPServiceAttributesCommand(treeview), + getShowURIMapAttributesCommand(treeview), + getShowTransactionAttributesCommand(treeview), + getShowLocalFileAttributesCommand(treeview), + getShowTaskAttributesCommand(treeview), + getShowPipelineAttributesCommand(treeview), + getShowWebServiceAttributesCommand(treeview), + + getShowRegionSITParametersCommand(treeview), + + getFilterProgramsCommand(treeDataProv, treeview), + getFilterDatasetProgramsCommand(treeDataProv, treeview), + getFilterLibrariesCommand(treeDataProv, treeview), + getFilterDatasetsCommand(treeDataProv, treeview), + getFilterTransactionCommand(treeDataProv, treeview), + getFilterLocalFilesCommand(treeDataProv, treeview), + getFilterTasksCommand(treeDataProv, treeview), + getFilterTCPIPSCommand(treeDataProv, treeview), + getFilterURIMapsCommand(treeDataProv, treeview), + getFilterPipelinesCommand(treeDataProv, treeview), + getFilterWebServicesCommand(treeDataProv, treeview), + + getFilterAllProgramsCommand(treeDataProv, treeview), + getFilterAllLibrariesCommand(treeDataProv, treeview), + getFilterAllWebServicesCommand(treeDataProv, treeview), + getFilterAllPipelinesCommand(treeDataProv, treeview), + getFilterAllTransactionsCommand(treeDataProv, treeview), + getFilterAllLocalFilesCommand(treeDataProv, treeview), + getFilterAllTasksCommand(treeDataProv, treeview), + getFilterAllTCPIPServicesCommand(treeDataProv, treeview), + getFilterAllURIMapsCommand(treeDataProv, treeview), + + getFilterPlexResources(treeDataProv, treeview), + + getClearResourceFilterCommand(treeDataProv, treeview), + getClearPlexFilterCommand(treeDataProv, treeview), + + viewMoreCommand(treeDataProv, treeview), + + getInquireTransactionCommand(treeDataProv, treeview), + getInquireProgramCommand(treeDataProv, treeview) + ); } diff --git a/packages/vsce/src/trees/CICSTree.ts b/packages/vsce/src/trees/CICSTree.ts index 28c85721..d3f71b2e 100644 --- a/packages/vsce/src/trees/CICSTree.ts +++ b/packages/vsce/src/trees/CICSTree.ts @@ -9,6 +9,9 @@ * */ +import * as vscode from "vscode"; +import { FilterDescriptor } from "../utils/filterUtils"; +import { findSelectedNodes } from "../utils/commandUtils"; import { getResource } from "@zowe/cics-for-zowe-sdk"; import { Event, @@ -19,7 +22,8 @@ import { TreeItem, WebviewPanel, window, - commands + commands, + TreeView } from "vscode"; import { PersistentStorage } from "../utils/PersistentStorage"; import { InfoLoaded, ProfileManagement } from "../utils/profileManagement"; @@ -29,562 +33,761 @@ import { CICSRegionTree } from "./CICSRegionTree"; import { CICSSessionTree } from "./CICSSessionTree"; import * as https from "https"; import { getIconPathInResources, missingSessionParameters, promptCredentials } from "../utils/profileUtils"; -import { Gui, imperative } from "@zowe/zowe-explorer-api"; +import { Gui, imperative, FileManagement, ZoweVsCodeExtension } from "@zowe/zowe-explorer-api"; export class CICSTree implements TreeDataProvider { - loadedProfiles: CICSSessionTree[] = []; - constructor() { - this.loadStoredProfileNames(); - } - public getLoadedProfiles() { - return this.loadedProfiles; - } - - public async refreshLoadedProfiles() { - this.clearLoadedProfiles(); - await this.loadStoredProfileNames(); - commands.executeCommand('workbench.actions.treeView.cics-view.collapseAll'); - } - public clearLoadedProfiles() { - this.loadedProfiles = []; - this._onDidChangeTreeData.fire(undefined); - } - - /** - * Searches profiles stored in persistent storage, retrieves information for that profile from - * ZE's PorfilesCache API and then creates CICSSessionTrees with this information and adds - * these as children to the CICSTree (TreeDataProvider) - */ - public async loadStoredProfileNames() { - const persistentStorage = new PersistentStorage("zowe.cics.persistent"); - await ProfileManagement.profilesCacheRefresh(); - // Retrieve previously added profiles from persistent storage - for (const profilename of persistentStorage.getLoadedCICSProfile()) { - try { - const profileToLoad = await ProfileManagement.getProfilesCache().loadNamedProfile(profilename, "cics"); - // avoid accidental repeats - if (!this.loadedProfiles.filter((sessionTree) => sessionTree.label === profilename).length) { - const newSessionTree = new CICSSessionTree(profileToLoad); - this.loadedProfiles.push(newSessionTree); - } - } catch { - continue; - } + loadedProfiles: CICSSessionTree[] = []; + constructor() { + this.loadStoredProfileNames(); + } + public getLoadedProfiles() { + return this.loadedProfiles; + } + + public async refreshLoadedProfiles() { + this.clearLoadedProfiles(); + await this.loadStoredProfileNames(); + commands.executeCommand('workbench.actions.treeView.cics-view.collapseAll'); + } + public clearLoadedProfiles() { + this.loadedProfiles = []; + this._onDidChangeTreeData.fire(undefined); } - this._onDidChangeTreeData.fire(undefined); - } - - /** - * - * Provides user with prompts and allows them to add a profile after clicking the '+' button - */ - async addProfile() { - try { - //const allCICSProfileNames = await ProfileManagement.getProfilesCache().getNamesForType('cics'); - const configInstance = await ProfileManagement.getConfigInstance(); - const allCICSProfiles = (await ProfileManagement.getProfilesCache().getProfileInfo()).getAllProfiles("cics"); - // const allCICSProfiles = await ProfileManagement.getProfilesCache().getProfiles('cics'); - const allCICSProfileNames: string[] = allCICSProfiles ? (allCICSProfiles.map((profile) => profile.profName) as unknown as [string]) : []; - // No cics profiles needed beforhand for team config method - if (configInstance.getTeamConfig().exists || allCICSProfileNames.length > 0) { - const profileNameToLoad = await window.showQuickPick( - [{ label: "\u270F Edit Team Configuration File" }].concat( - allCICSProfileNames - .filter((name) => { - for (const loadedProfile of this.loadedProfiles) { - if (loadedProfile.label === name) { - return false; - } + + /** + * Searches profiles stored in persistent storage, retrieves information for that profile from + * ZE's PorfilesCache API and then creates CICSSessionTrees with this information and adds + * these as children to the CICSTree (TreeDataProvider) + */ + public async loadStoredProfileNames() { + const persistentStorage = new PersistentStorage("zowe.cics.persistent"); + await ProfileManagement.profilesCacheRefresh(); + // Retrieve previously added profiles from persistent storage + for (const profilename of persistentStorage.getLoadedCICSProfile()) { + try { + const profileToLoad = await ProfileManagement.getProfilesCache().loadNamedProfile(profilename, "cics"); + // avoid accidental repeats + if (!this.loadedProfiles.filter((sessionTree) => sessionTree.label === profilename).length) { + const newSessionTree = new CICSSessionTree(profileToLoad); + this.loadedProfiles.push(newSessionTree); } - return true; - }) - .map((profileName) => { - return { label: profileName }; - }) - ), - { - ignoreFocusOut: true, - placeHolder: "Edit Team Configuration File", - } - ); - if (profileNameToLoad) { - // If Create New CICS Profile option chosen - if (profileNameToLoad.label.includes("\u270F")) { - // get all profiles of all types including zosmf - const profiles = configInstance.getAllProfiles(); - const currentProfile = - profiles.length > 0 ? await ProfileManagement.getProfilesCache().getProfileFromConfig(profiles[0].profName) : null; - const teamConfigFilePath = configInstance.getTeamConfig().opts.homeDir + "/zowe.config.json"; - const filePath = currentProfile === null ? teamConfigFilePath : (currentProfile?.profLoc.osLoc?.[0] ?? teamConfigFilePath); - await openConfigFile(filePath); - } else { - let profileToLoad; - // TODO: Just use loadNamedProfile once the method is configured to v2 profiles - if (configInstance.getTeamConfig().exists) { - profileToLoad = await ProfileManagement.getProfilesCache().getLoadedProfConfig(profileNameToLoad.label); //ProfileManagement.getProfilesCache().loadNamedProfile(profileNameToLoad.label, 'cics'); - } else { - await ProfileManagement.profilesCacheRefresh(); - profileToLoad = ProfileManagement.getProfilesCache().loadNamedProfile(profileNameToLoad.label, "cics"); + } catch { + continue; } - const newSessionTree = new CICSSessionTree(profileToLoad); - this.loadedProfiles.push(newSessionTree); - const persistentStorage = new PersistentStorage("zowe.cics.persistent"); - await persistentStorage.addLoadedCICSProfile(profileNameToLoad.label); - this._onDidChangeTreeData.fire(undefined); - } } - } else { - // Create New Profile Form should appear - this.createNewProfile(); - } - } catch (error) { - console.log(error); - window.showErrorMessage(JSON.stringify(error, Object.getOwnPropertyNames(error)).replace(/(\\n\t|\\n|\\t)/gm, " ")); + this._onDidChangeTreeData.fire(undefined); } - } - - /** - * - * @param profile - * @param position number that's passed in when updating or expanding profile - needed - * to replace position of current CICSSessionTree. - * @param sessionTree current CICSSessionTree only passed in if expanding a profile - */ - async loadProfile(profile?: imperative.IProfileLoaded, position?: number | undefined, sessionTree?: CICSSessionTree) { - const persistentStorage = new PersistentStorage("zowe.cics.persistent"); - await persistentStorage.addLoadedCICSProfile(profile.name); - let newSessionTree: CICSSessionTree; - window.withProgress( - { - title: "Load profile", - location: ProgressLocation.Notification, - cancellable: true, - }, - async (progress, token) => { - token.onCancellationRequested(() => { - console.log(`Cancelling the loading of ${profile.name}`); - }); - progress.report({ - message: `Loading ${profile.name}`, - }); + /** + * Provides user with user actions and allows them to manage the selected profile + * @param treeview CICSTree View + * *@param node current selected node + */ + async manageProfile(treeview: TreeView, node: any) { + const allSelectedNodes = findSelectedNodes(treeview, CICSSessionTree, node); + if (!allSelectedNodes || !allSelectedNodes.length) { + window.showErrorMessage("No profile selected to delete"); + return; + } try { - const configInstance = await ProfileManagement.getConfigInstance(); - if (configInstance.getTeamConfig().exists) { - let missingParamters = missingSessionParameters(profile.profile); - if (missingParamters.length) { - const userPass = ["user", "password"]; - if (missingParamters.includes(userPass[0]) || missingParamters.includes(userPass[1])) { - const updatedProfile = await promptCredentials(profile.name, true); - if (!updatedProfile) { - return; - } - profile = updatedProfile; - // Remove "user" and "password" from missing params array - missingParamters = missingParamters.filter((param) => userPass.indexOf(param) === -1 || userPass.indexOf(param) === -1); - } - if (missingParamters.length) { - window.showInformationMessage( - `The following fields are missing from ${profile.name}: ${missingParamters.join(", ")}. Please update them in your config file.` - ); - return; - } - // If profile is expanded and it previously had 401 error code - } else if (sessionTree && sessionTree.getIsUnauthorized()) { - const updatedProfile = await promptCredentials(profile.name, true); - if (!updatedProfile) { - return; - } - profile = updatedProfile; - } - } - const plexInfo: InfoLoaded[] = await ProfileManagement.getPlexInfo(profile); - // Initialise session tree - newSessionTree = new CICSSessionTree(profile, getIconPathInResources("profile-dark.svg", "profile-light.svg")); - // For each InfoLoaded object - happens if there are multiple plexes - for (const item of plexInfo) { - // No plex - if (item.plexname === null) { - const session = new imperative.Session({ - type: "basic", - hostname: profile.profile.host, - port: Number(profile.profile.port), - user: profile.profile.user, - password: profile.profile.password, - rejectUnauthorized: profile.profile.rejectUnauthorized, - protocol: profile.profile.protocol, - }); - try { - https.globalAgent.options.rejectUnauthorized = profile.profile.rejectUnauthorized; - - const regionsObtained = await getResource(session, { - name: "CICSRegion", - regionName: item.regions[0].applid, - }); - // 200 OK received - newSessionTree.setAuthorized(); - https.globalAgent.options.rejectUnauthorized = undefined; - const newRegionTree = new CICSRegionTree( - item.regions[0].applid, - regionsObtained.response.records.cicsregion, - newSessionTree, - undefined, - newSessionTree + const configInstance = await ProfileManagement.getConfigInstance(); + if (configInstance.getTeamConfig().exists) { + const currentProfile = await ProfileManagement.getProfilesCache().getProfileFromConfig( + allSelectedNodes[allSelectedNodes.length - 1].label, ); - newSessionTree.addRegion(newRegionTree); - } catch (error) { - https.globalAgent.options.rejectUnauthorized = undefined; - console.log(error); - } - } else { - if (item.group) { - const newPlexTree = new CICSPlexTree(item.plexname, profile, newSessionTree, profile.profile.regionName); - newPlexTree.setLabel(`${item.plexname} - ${profile.profile.regionName}`); - newSessionTree.addPlex(newPlexTree); - } else { - //Plex - const newPlexTree = new CICSPlexTree(item.plexname, profile, newSessionTree); - newSessionTree.addPlex(newPlexTree); - } - } - } - // If method was called when expanding profile - if (sessionTree) { - this.loadedProfiles.splice(position, 1, newSessionTree); - } - // If method was called when updating profile - else if (position || position === 0) { - this.loadedProfiles.splice(position, 0, newSessionTree); - } else { - this.loadedProfiles.push(newSessionTree); - } - this._onDidChangeTreeData.fire(undefined); - } catch (error) { - https.globalAgent.options.rejectUnauthorized = undefined; - // Change session tree icon to disconnected upon error - newSessionTree = new CICSSessionTree(profile, getIconPathInResources("profile-disconnected-dark.svg", "profile-disconnected-light.svg")); - // If method was called when expanding profile - if (sessionTree) { - this.loadedProfiles.splice(position, 1, newSessionTree); - } - // If method was called when updating profile - else if (position || position === 0) { - this.loadedProfiles.splice(position, 0, newSessionTree); - } else { - this.loadedProfiles.push(newSessionTree); - } - this._onDidChangeTreeData.fire(undefined); - - if (typeof error === "object") { - if ("code" in error) { - switch (error.code) { - case "ETIMEDOUT": - window.showErrorMessage(`Error: connect ETIMEDOUT ${profile.profile.host}:${profile.profile.port} (${profile.name})`); - break; - case "ENOTFOUND": - window.showErrorMessage(`Error: getaddrinfo ENOTFOUND ${profile.profile.host}:${profile.profile.port} (${profile.name})`); - break; - case "ECONNRESET": - window.showErrorMessage(`Error: socket hang up ${profile.profile.host}:${profile.profile.port} (${profile.name})`); - break; - case "EPROTO": - window.showErrorMessage(`Error: write EPROTO ${profile.profile.host}:${profile.profile.port} (${profile.name})`); - break; - case "DEPTH_ZERO_SELF_SIGNED_CERT": - case "SELF_SIGNED_CERT_IN_CHAIN": - case "ERR_TLS_CERT_ALTNAME_INVALID": - case "CERT_HAS_EXPIRED": - // If re-expanding a profile that has an expired certificate - if (sessionTree) { - const decision = await window.showInformationMessage( - `Warning: Your connection is not private (${error.code}) - would you still like to proceed to ${profile.profile.host} (unsafe)?`, - ...["Yes", "No"] - ); - if (decision) { - if (decision === "Yes") { + + const deleteProfile: vscode.QuickPickItem = { + label: `$(trash) ${vscode.l10n.t("Delete Profile")}`, + description: vscode.l10n.t("Delete the selected Profile"), + }; + const hideProfile: vscode.QuickPickItem = { + label: `$(eye-closed) ${vscode.l10n.t("Hide Profile")}`, + description: vscode.l10n.t("Hide profile name from tree view"), + }; + const editProfile: vscode.QuickPickItem = { + label: `$(pencil) ${vscode.l10n.t("Edit Profile")}`, + description: vscode.l10n.t("Update profile connection information"), + }; + + const quickpick = Gui.createQuickPick(); + let addProfilePlaceholder = "Choose profile action for " + currentProfile + " profile"; + quickpick.items = [editProfile, hideProfile, deleteProfile]; + quickpick.placeholder = addProfilePlaceholder; + quickpick.ignoreFocusOut = true; + quickpick.show(); + const choice = await Gui.resolveQuickPick(quickpick); + quickpick.hide(); + const debugMsg = vscode.l10n.t(`Profile selection has been cancelled.`); + if (!choice) { + Gui.showMessage(debugMsg); + return; + } else if (choice === hideProfile) { + await this.hideZoweConfigFile(allSelectedNodes); + return; + } else if (choice === editProfile) { + for (const sessionTree of allSelectedNodes) { + try { + await this.updateSession(sessionTree); + } catch (error) { + window.showErrorMessage( + `Something went wrong when updating the profile - ${JSON.stringify(error, Object.getOwnPropertyNames(error)).replace( + /(\\n\t|\\n|\\t)/gm, + " ", + )}`, + ); + return; + } + } + } else { + try { const configInstance = await ProfileManagement.getConfigInstance(); - let updatedProfile; if (configInstance.getTeamConfig().exists) { - const upd = { profileName: profile.name, profileType: "cics" }; - // const configInstance = await ProfileManagement.getConfigInstance(); - // flip rejectUnauthorized to false - await configInstance.updateProperty({ ...upd, property: "rejectUnauthorized", value: false }); - updatedProfile = await ProfileManagement.getProfilesCache().getLoadedProfConfig(profile.name); + const currentProfile = await ProfileManagement.getProfilesCache().getProfileFromConfig( + allSelectedNodes[allSelectedNodes.length - 1].label, + ); + if (currentProfile) { + const filePath = currentProfile.profLoc.osLoc ? currentProfile.profLoc.osLoc[0] : ""; + await openConfigFile(filePath); + } } else { - // flip rejectUnauthorized to false - const message = { - name: profile.name, - profile: { - ...profile.profile, - rejectUnauthorized: false, - }, - }; - const newProfile = await ProfileManagement.updateProfile(message); - await ProfileManagement.profilesCacheRefresh(); - updatedProfile = await ProfileManagement.getProfilesCache().loadNamedProfile(profile.name, "cics"); + await this.deleteSession(allSelectedNodes); } - await this.removeSession(sessionTree, updatedProfile, position); - } + } catch (error) { + window.showErrorMessage( + `Something went wrong when deleting the profile - ${JSON.stringify(error, Object.getOwnPropertyNames(error)).replace( + /(\\n\t|\\n|\\t)/gm, + " ", + )}`, + ); } - } - break; - default: - window.showErrorMessage( - `Error: An error has occurred ${profile.profile.host}:${profile.profile.port} (${profile.name}) - ${JSON.stringify( - error, - Object.getOwnPropertyNames(error) - ).replace(/(\\n\t|\\n|\\t)/gm, " ")}` - ); - } - } else if ("response" in error) { - if (error.response !== "undefined" && error.response.status) { - switch (error.response.status) { - case 401: - window.showErrorMessage(`Error: Request failed with status code 401 for Profile '${profile.name}'`); - // set the unauthorized flag to true for reprompting of credentials. - newSessionTree.setUnauthorized(); - // Replace old profile tree with new disconnected profile tree item - this.loadedProfiles.splice(position, 1, newSessionTree); - break; - case 404: - window.showErrorMessage(`Error: Request failed with status code 404 for Profile '${profile.name}' - Not Found`); - break; - case 500: - window.showErrorMessage(`Error: Request failed with status code 500 for Profile '${profile.name}'`); - break; - default: - window.showErrorMessage(`Error: Request failed with status code ${error.response.status} for Profile '${profile.name}'`); + return; } - } else { - window.showErrorMessage( - `Error: An error has occurred ${profile.profile.host}:${profile.profile.port} (${profile.name}) - ${JSON.stringify( - error, - Object.getOwnPropertyNames(error) - ).replace(/(\\n\t|\\n|\\t)/gm, " ")}` - ); - } } - } - console.log(error); + } catch (error) { + window.showErrorMessage( + `Something went wrong while managing the profile - ${JSON.stringify(error, Object.getOwnPropertyNames(error)).replace( + /(\\n\t|\\n|\\t)/gm, + " ", + )}`, + ); } - } - ); - } - - /** - * Method for V1 profile configuration that provides UI for user to enter profile details - * and creates a profile. - */ - async createNewProfile() { - if (isTheia()) { - const connnectionName = await Gui.showInputBox({ - prompt: "Name of connection", - placeHolder: "e.g. my-cics-profile", - ignoreFocusOut: true, - }); - if (!connnectionName) { - return; - } - const hostDetails = await Gui.showInputBox({ - prompt: "Input protocol, host and port for connection", - placeHolder: "e.g. https://mycicshostname.com:12345", - ignoreFocusOut: true, - }); - - if (!hostDetails) { - return; - } - - const splitHostDetails = hostDetails.split(":"); - - const protocol = splitHostDetails[0].toLowerCase(); - if (!["http", "https"].includes(protocol)) { - return; - } - - let host = splitHostDetails[1]; - if (host.slice(0, 2) !== "//") { - return; - } - host = host.slice(2); - - const port = parseInt(splitHostDetails[2]); - if (!port || isNaN(port)) { - return; - } - - const username = await Gui.showInputBox({ - prompt: "Input Username", - placeHolder: "e.g. user123", - ignoreFocusOut: true, - }); - if (!username) { - return; - } - - const userPassword = await Gui.showInputBox({ - prompt: "Input Password", - placeHolder: "e.g. 12345678", - password: true, - ignoreFocusOut: true, - }); - if (!userPassword) { - return; - } - - const plexName = await Gui.showInputBox({ - prompt: "Input Plex Name", - placeHolder: "e.g. PLEX123", - ignoreFocusOut: true, - }); - - const regionName = await Gui.showInputBox({ - prompt: "Input Region Name", - placeHolder: "e.g. REGION123", - ignoreFocusOut: true, - }); - - const rejectUnauthorized = await Gui.showQuickPick(["True", "False"], { - placeHolder: "Reject Unauthorized", - ignoreFocusOut: true, - }); - if (!rejectUnauthorized) { - return; - } - const message = { - profile: { - name: connnectionName, - host: host, - port: port, - user: username, - password: userPassword, - rejectUnauthorized: rejectUnauthorized === "True" ? true : false, - protocol: protocol, - cicsPlex: plexName.length === 0 ? undefined : plexName, - regionName: regionName.length === 0 ? undefined : regionName, - }, - name: connnectionName, - type: "CICS", - overwrite: true, - }; - - try { - await ProfileManagement.createNewProfile(message); - await ProfileManagement.profilesCacheRefresh(); - await this.loadProfile(ProfileManagement.getProfilesCache().loadNamedProfile(message.name, "cics")); - } catch (error) { - // @ts-ignore - window.showErrorMessage(error); - } - } else { - // Initialize new team configuration file - const response = await window.showQuickPick([{ label: "\uFF0B Create a New Team Configuration File" }], { - ignoreFocusOut: true, - placeHolder: "Create a New Team Configuration File", - }); - if (response) { - commands.executeCommand("zowe.all.config.init"); - } } - } - - async removeSession(session: CICSSessionTree, profile?: imperative.IProfileLoaded, position?: number) { - const persistentStorage = new PersistentStorage("zowe.cics.persistent"); - await persistentStorage.removeLoadedCICSProfile(session.label.toString()); - this.loadedProfiles = this.loadedProfiles.filter((p) => p.profile.name !== session.label?.toString()); - if (profile && position !== undefined) { - await this.loadProfile(profile, position); + + /** + * + * Provides user with prompts and allows them to add a profile after clicking the '+' button + */ + async addProfile() { + try { + //const allCICSProfileNames = await ProfileManagement.getProfilesCache().getNamesForType('cics'); + const configInstance = await ProfileManagement.getConfigInstance(); + const profileInfo = await ProfileManagement.getProfilesCache().getProfileInfo(); + const allCICSProfiles = profileInfo.getAllProfiles("cics"); + // const allCICSProfiles = await ProfileManagement.getProfilesCache().getProfiles('cics'); + const allCICSProfileNames: string[] = allCICSProfiles ? (allCICSProfiles.map((profile) => profile.profName) as unknown as [string]) : []; + // No cics profiles needed beforhand for team config method + if (configInstance.getTeamConfig().exists || allCICSProfileNames.length > 0) { + const createNewConfig = "Create a New Team Configuration File"; + const editConfig = "Edit Team Configuration File"; + + const configPick = new FilterDescriptor("\uFF0B " + createNewConfig); + const configEdit = new FilterDescriptor("\u270F " + editConfig); + const items: vscode.QuickPickItem[] = []; + + const profAllAttrs = profileInfo.getAllProfiles(); + for (const pName of allCICSProfileNames) { + const osLocInfo = profileInfo.getOsLocInfo(profAllAttrs.find((p) => p.profName === pName)); + items.push(new FilterDescriptor(this.getProfileIcon(osLocInfo)[0] + " " + pName)); + } + const quickpick = Gui.createQuickPick(); + let addProfilePlaceholder = vscode.l10n.t(`Choose "Create new..." to define or select a profile to add to the CICS tree`); + quickpick.items = [configPick, configEdit, ...items]; + quickpick.placeholder = addProfilePlaceholder; + quickpick.ignoreFocusOut = true; + quickpick.show(); + const choice = await Gui.resolveQuickPick(quickpick); + quickpick.hide(); + const debugMsg = vscode.l10n.t(`Profile selection has been cancelled.`); + if (!choice) { + Gui.showMessage(debugMsg); + return; + } else if (choice === configPick) { + await this.createNewProfile(); + return; + } else if (choice === configEdit) { + await this.editZoweConfigFile(); + return; + } else { + await this.loadExistingProfile(choice.label); + return; + } + } else { + // Create New Profile Form should appear + this.createNewProfile(); + } + } catch (error) { + console.log(error); + window.showErrorMessage(JSON.stringify(error, Object.getOwnPropertyNames(error)).replace(/(\\n\t|\\n|\\t)/gm, " ")); + } } - this._onDidChangeTreeData.fire(undefined); - } - - /** - * Delete profile functionality for V1 profile configuration - * @param sessions - */ - async deleteSession(sessions: CICSSessionTree[]) { - let answer; - if (sessions.length === 1) { - answer = await window.showInformationMessage( - `Are you sure you want to delete the profile "${sessions[0].label?.toString()!}"`, - ...["Yes", "No"] - ); - } else if (sessions.length > 1) { - answer = await window.showInformationMessage( - `Are you sure you want to delete the profiles "${sessions.map((sessionTree) => { - return sessionTree.label?.toString()!; - })}"`, - ...["Yes", "No"] - ); + + /** + * + * @param profile + * @param position number that's passed in when updating or expanding profile - needed + * to replace position of current CICSSessionTree. + * @param sessionTree current CICSSessionTree only passed in if expanding a profile + */ + async loadProfile(profile?: imperative.IProfileLoaded, position?: number | undefined, sessionTree?: CICSSessionTree) { + const persistentStorage = new PersistentStorage("zowe.cics.persistent"); + await persistentStorage.addLoadedCICSProfile(profile.name); + let newSessionTree: CICSSessionTree; + window.withProgress( + { + title: "Load profile", + location: ProgressLocation.Notification, + cancellable: true, + }, + async (progress, token) => { + token.onCancellationRequested(() => { + console.log(`Cancelling the loading of ${profile.name}`); + }); + + progress.report({ + message: `Loading ${profile.name}`, + }); + try { + const configInstance = await ProfileManagement.getConfigInstance(); + if (configInstance.getTeamConfig().exists) { + let missingParamters = missingSessionParameters(profile.profile); + if (missingParamters.length) { + const userPass = ["user", "password"]; + if (missingParamters.includes(userPass[0]) || missingParamters.includes(userPass[1])) { + const updatedProfile = await promptCredentials(profile.name, true); + if (!updatedProfile) { + return; + } + profile = updatedProfile; + // Remove "user" and "password" from missing params array + missingParamters = missingParamters.filter((param) => userPass.indexOf(param) === -1 || userPass.indexOf(param) === -1); + } + if (missingParamters.length) { + window.showInformationMessage( + `The following fields are missing from ${profile.name}: ${missingParamters.join(", ")}. Please update them in your config file.` + ); + return; + } + // If profile is expanded and it previously had 401 error code + } else if (sessionTree && sessionTree.getIsUnauthorized()) { + const updatedProfile = await promptCredentials(profile.name, true); + if (!updatedProfile) { + return; + } + profile = updatedProfile; + } + } + const plexInfo: InfoLoaded[] = await ProfileManagement.getPlexInfo(profile); + // Initialise session tree + newSessionTree = new CICSSessionTree(profile, getIconPathInResources("profile-dark.svg", "profile-light.svg")); + // For each InfoLoaded object - happens if there are multiple plexes + for (const item of plexInfo) { + // No plex + if (item.plexname === null) { + const session = new imperative.Session({ + type: "basic", + hostname: profile.profile.host, + port: Number(profile.profile.port), + user: profile.profile.user, + password: profile.profile.password, + rejectUnauthorized: profile.profile.rejectUnauthorized, + protocol: profile.profile.protocol, + }); + try { + https.globalAgent.options.rejectUnauthorized = profile.profile.rejectUnauthorized; + + const regionsObtained = await getResource(session, { + name: "CICSRegion", + regionName: item.regions[0].applid, + }); + // 200 OK received + newSessionTree.setAuthorized(); + https.globalAgent.options.rejectUnauthorized = undefined; + const newRegionTree = new CICSRegionTree( + item.regions[0].applid, + regionsObtained.response.records.cicsregion, + newSessionTree, + undefined, + newSessionTree + ); + newSessionTree.addRegion(newRegionTree); + } catch (error) { + https.globalAgent.options.rejectUnauthorized = undefined; + console.log(error); + } + } else { + if (item.group) { + const newPlexTree = new CICSPlexTree(item.plexname, profile, newSessionTree, profile.profile.regionName); + newPlexTree.setLabel(`${item.plexname} - ${profile.profile.regionName}`); + newSessionTree.addPlex(newPlexTree); + } else { + //Plex + const newPlexTree = new CICSPlexTree(item.plexname, profile, newSessionTree); + newSessionTree.addPlex(newPlexTree); + } + } + } + // If method was called when expanding profile + if (sessionTree) { + this.loadedProfiles.splice(position, 1, newSessionTree); + } + // If method was called when updating profile + else if (position || position === 0) { + this.loadedProfiles.splice(position, 0, newSessionTree); + } else { + this.loadedProfiles.push(newSessionTree); + } + this._onDidChangeTreeData.fire(undefined); + } catch (error) { + https.globalAgent.options.rejectUnauthorized = undefined; + // Change session tree icon to disconnected upon error + newSessionTree = new CICSSessionTree(profile, getIconPathInResources("profile-disconnected-dark.svg", "profile-disconnected-light.svg")); + // If method was called when expanding profile + if (sessionTree) { + this.loadedProfiles.splice(position, 1, newSessionTree); + } + // If method was called when updating profile + else if (position || position === 0) { + this.loadedProfiles.splice(position, 0, newSessionTree); + } else { + this.loadedProfiles.push(newSessionTree); + } + this._onDidChangeTreeData.fire(undefined); + + if (typeof error === "object") { + if ("code" in error) { + switch (error.code) { + case "ETIMEDOUT": + window.showErrorMessage(`Error: connect ETIMEDOUT ${profile.profile.host}:${profile.profile.port} (${profile.name})`); + break; + case "ENOTFOUND": + window.showErrorMessage(`Error: getaddrinfo ENOTFOUND ${profile.profile.host}:${profile.profile.port} (${profile.name})`); + break; + case "ECONNRESET": + window.showErrorMessage(`Error: socket hang up ${profile.profile.host}:${profile.profile.port} (${profile.name})`); + break; + case "EPROTO": + window.showErrorMessage(`Error: write EPROTO ${profile.profile.host}:${profile.profile.port} (${profile.name})`); + break; + case "DEPTH_ZERO_SELF_SIGNED_CERT": + case "SELF_SIGNED_CERT_IN_CHAIN": + case "ERR_TLS_CERT_ALTNAME_INVALID": + case "CERT_HAS_EXPIRED": + // If re-expanding a profile that has an expired certificate + if (sessionTree) { + const decision = await window.showInformationMessage( + `Warning: Your connection is not private (${error.code}) - would you still like to proceed to ${profile.profile.host} (unsafe)?`, + ...["Yes", "No"] + ); + if (decision) { + if (decision === "Yes") { + const configInstance = await ProfileManagement.getConfigInstance(); + let updatedProfile; + if (configInstance.getTeamConfig().exists) { + const upd = { profileName: profile.name, profileType: "cics" }; + // const configInstance = await ProfileManagement.getConfigInstance(); + // flip rejectUnauthorized to false + await configInstance.updateProperty({ ...upd, property: "rejectUnauthorized", value: false }); + updatedProfile = await ProfileManagement.getProfilesCache().getLoadedProfConfig(profile.name); + } else { + // flip rejectUnauthorized to false + const message = { + name: profile.name, + profile: { + ...profile.profile, + rejectUnauthorized: false, + }, + }; + const newProfile = await ProfileManagement.updateProfile(message); + await ProfileManagement.profilesCacheRefresh(); + updatedProfile = await ProfileManagement.getProfilesCache().loadNamedProfile(profile.name, "cics"); + } + await this.removeSession(sessionTree, updatedProfile, position); + } + } + } + break; + default: + window.showErrorMessage( + `Error: An error has occurred ${profile.profile.host}:${profile.profile.port} (${profile.name}) - ${JSON.stringify( + error, + Object.getOwnPropertyNames(error) + ).replace(/(\\n\t|\\n|\\t)/gm, " ")}` + ); + } + } else if ("response" in error) { + if (error.response !== "undefined" && error.response.status) { + switch (error.response.status) { + case 401: + window.showErrorMessage(`Error: Request failed with status code 401 for Profile '${profile.name}'`); + // set the unauthorized flag to true for reprompting of credentials. + newSessionTree.setUnauthorized(); + // Replace old profile tree with new disconnected profile tree item + this.loadedProfiles.splice(position, 1, newSessionTree); + break; + case 404: + window.showErrorMessage(`Error: Request failed with status code 404 for Profile '${profile.name}' - Not Found`); + break; + case 500: + window.showErrorMessage(`Error: Request failed with status code 500 for Profile '${profile.name}'`); + break; + default: + window.showErrorMessage(`Error: Request failed with status code ${error.response.status} for Profile '${profile.name}'`); + } + } else { + window.showErrorMessage( + `Error: An error has occurred ${profile.profile.host}:${profile.profile.port} (${profile.name}) - ${JSON.stringify( + error, + Object.getOwnPropertyNames(error) + ).replace(/(\\n\t|\\n|\\t)/gm, " ")}` + ); + } + } + } + console.log(error); + } + } + ); } - if (answer === "Yes") { - window.withProgress( - { - title: "Delete Profile", - location: ProgressLocation.Notification, - cancellable: true, - }, - async (progress, token) => { - token.onCancellationRequested(() => { - console.log("Cancelling the delete command"); - }); - for (const index in sessions) { - progress.report({ - message: `Deleting profile ${parseInt(index) + 1} of ${sessions.length}`, - increment: (parseInt(index) / sessions.length) * 100, + + /** + * Method for V1 profile configuration that provides UI for user to enter profile details + * and creates a profile. + */ + async createNewProfile() { + if (isTheia()) { + const connnectionName = await Gui.showInputBox({ + prompt: "Name of connection", + placeHolder: "e.g. my-cics-profile", + ignoreFocusOut: true, + }); + if (!connnectionName) { + return; + } + const hostDetails = await Gui.showInputBox({ + prompt: "Input protocol, host and port for connection", + placeHolder: "e.g. https://mycicshostname.com:12345", + ignoreFocusOut: true, }); + + if (!hostDetails) { + return; + } + + const splitHostDetails = hostDetails.split(":"); + + const protocol = splitHostDetails[0].toLowerCase(); + if (!["http", "https"].includes(protocol)) { + return; + } + + let host = splitHostDetails[1]; + if (host.slice(0, 2) !== "//") { + return; + } + host = host.slice(2); + + const port = parseInt(splitHostDetails[2]); + if (!port || isNaN(port)) { + return; + } + + const username = await Gui.showInputBox({ + prompt: "Input Username", + placeHolder: "e.g. user123", + ignoreFocusOut: true, + }); + if (!username) { + return; + } + + const userPassword = await Gui.showInputBox({ + prompt: "Input Password", + placeHolder: "e.g. 12345678", + password: true, + ignoreFocusOut: true, + }); + if (!userPassword) { + return; + } + + const plexName = await Gui.showInputBox({ + prompt: "Input Plex Name", + placeHolder: "e.g. PLEX123", + ignoreFocusOut: true, + }); + + const regionName = await Gui.showInputBox({ + prompt: "Input Region Name", + placeHolder: "e.g. REGION123", + ignoreFocusOut: true, + }); + + const rejectUnauthorized = await Gui.showQuickPick(["True", "False"], { + placeHolder: "Reject Unauthorized", + ignoreFocusOut: true, + }); + if (!rejectUnauthorized) { + return; + } + const message = { + profile: { + name: connnectionName, + host: host, + port: port, + user: username, + password: userPassword, + rejectUnauthorized: rejectUnauthorized === "True" ? true : false, + protocol: protocol, + cicsPlex: plexName.length === 0 ? undefined : plexName, + regionName: regionName.length === 0 ? undefined : regionName, + }, + name: connnectionName, + type: "CICS", + overwrite: true, + }; + try { - await ProfileManagement.deleteProfile({ - name: sessions[parseInt(index)].label?.toString()!, - rejectIfDependency: true, - }); - const persistentStorage = new PersistentStorage("zowe.cics.persistent"); - await persistentStorage.removeLoadedCICSProfile(sessions[parseInt(index)].label.toString()); - - this.loadedProfiles = this.loadedProfiles.filter((profile) => profile !== sessions[parseInt(index)]); - this._onDidChangeTreeData.fire(undefined); + await ProfileManagement.createNewProfile(message); + await ProfileManagement.profilesCacheRefresh(); + await this.loadProfile(ProfileManagement.getProfilesCache().loadNamedProfile(message.name, "cics")); } catch (error) { - // @ts-ignore - window.showErrorMessage(error); + // @ts-ignore + window.showErrorMessage(error); } - } + } else { + commands.executeCommand("zowe.all.config.init"); + } + } + + /** + * Allows user to edit a configuration file based on global or project level context + */ + async editZoweConfigFile() { + let rootPath = FileManagement.getZoweDir(); + const workspaceDir = ZoweVsCodeExtension.workspaceRoot; + const choice = await this.getConfigLocationPrompt("edit"); + if (choice === "global") { + await openConfigFile(rootPath + "/zowe.config.json"); + } else if (choice === "project") { + rootPath = workspaceDir.uri.fsPath; + await openConfigFile(rootPath + "/zowe.config.json"); + } else { + return; } - ); } - } - - async updateSession(session: CICSSessionTree) { - await ProfileManagement.profilesCacheRefresh(); - const profileCache = await ProfileManagement.getProfilesCache(); - const profileToUpdate = profileCache.loadNamedProfile(session.label?.toString()!, "cics"); - const currentProfile = await profileCache.getProfileFromConfig(profileToUpdate.name); - await this.updateSessionHelper(currentProfile); - } - - async updateSessionHelper(profile: imperative.IProfAttrs) { - const response = await window.showQuickPick([{ label: "\u270F Edit CICS Profile" }], { - ignoreFocusOut: true, - placeHolder: "Create a New Team Configuration File", - }); - if (response) { - const configInstance = await ProfileManagement.getConfigInstance(); - const teamConfigFilePath = configInstance.getTeamConfig().opts.homeDir + "/zowe.config.json"; - const filePath = profile?.profLoc.osLoc?.[0] ?? teamConfigFilePath; - await openConfigFile(filePath); + + /** + * Allows user to load an existing file from persistance area instead of creating a new profile. + * @param label name of the selected profile + */ + async loadExistingProfile(label: string) { + label = label.split(/ (.*)/)[1]; + let profileToLoad; + profileToLoad = await ProfileManagement.getProfilesCache().getLoadedProfConfig(label); + const newSessionTree = new CICSSessionTree(profileToLoad); + this.loadedProfiles.push(newSessionTree); + console.debug(label); + const persistentStorage = new PersistentStorage("zowe.cics.persistent"); + await persistentStorage.addLoadedCICSProfile(label); + this._onDidChangeTreeData.fire(undefined); } - } - getTreeItem(element: CICSSessionTree): TreeItem | Thenable { - return element; - } - getChildren(element?: CICSSessionTree): ProviderResult { - return element === undefined ? this.loadedProfiles : element.children; - } + /** + * Method for V1 profile configuration that provides UI for user to hide a selected profile. + * @param allSelectedNodes array of selected nodes + */ + async hideZoweConfigFile(allSelectedNodes: any[]) { + window.withProgress( + { + title: "Hide Profile", + location: ProgressLocation.Notification, + cancellable: true, + }, + async (progress, token) => { + token.onCancellationRequested(() => { + console.log("Cancelling the hide command"); + }); + for (const index in allSelectedNodes) { + progress.report({ + message: `Hiding ${parseInt(index) + 1} of ${allSelectedNodes.length}`, + increment: (parseInt(index) / allSelectedNodes.length) * 100, + }); + try { + const currentNode = allSelectedNodes[parseInt(index)]; + + await this.removeSession(currentNode); + } catch (error) { + window.showErrorMessage( + `Something went wrong when hiding the profile - ${JSON.stringify(error, Object.getOwnPropertyNames(error)).replace( + /(\\n\t|\\n|\\t)/gm, + " ", + )}`, + ); + } + } + }, + ); + } - getParent(element: any): ProviderResult { - element.getParent(); - } + async removeSession(session: CICSSessionTree, profile?: imperative.IProfileLoaded, position?: number) { + const persistentStorage = new PersistentStorage("zowe.cics.persistent"); + await persistentStorage.removeLoadedCICSProfile(session.label.toString()); + this.loadedProfiles = this.loadedProfiles.filter((p) => p.profile.name !== session.label?.toString()); + if (profile && position !== undefined) { + await this.loadProfile(profile, position); + } + this._onDidChangeTreeData.fire(undefined); + } + + /** + * Delete profile functionality for V1 profile configuration + * @param sessions + */ + async deleteSession(sessions: CICSSessionTree[]) { + let answer; + if (sessions.length === 1) { + answer = await window.showInformationMessage( + `Are you sure you want to delete the profile "${sessions[0].label?.toString()!}"`, + ...["Yes", "No"] + ); + } else if (sessions.length > 1) { + answer = await window.showInformationMessage( + `Are you sure you want to delete the profiles "${sessions.map((sessionTree) => { + return sessionTree.label?.toString()!; + })}"`, + ...["Yes", "No"] + ); + } + if (answer === "Yes") { + window.withProgress( + { + title: "Delete Profile", + location: ProgressLocation.Notification, + cancellable: true, + }, + async (progress, token) => { + token.onCancellationRequested(() => { + console.log("Cancelling the delete command"); + }); + for (const index in sessions) { + progress.report({ + message: `Deleting profile ${parseInt(index) + 1} of ${sessions.length}`, + increment: (parseInt(index) / sessions.length) * 100, + }); + try { + await ProfileManagement.deleteProfile({ + name: sessions[parseInt(index)].label?.toString()!, + rejectIfDependency: true, + }); + const persistentStorage = new PersistentStorage("zowe.cics.persistent"); + await persistentStorage.removeLoadedCICSProfile(sessions[parseInt(index)].label.toString()); + + this.loadedProfiles = this.loadedProfiles.filter((profile) => profile !== sessions[parseInt(index)]); + this._onDidChangeTreeData.fire(undefined); + } catch (error) { + // @ts-ignore + window.showErrorMessage(error); + } + } + } + ); + } + } + + /** + * Update profile functionality for V1 profile configuration + * @param session CICSSessions Tree + */ + async updateSession(session: CICSSessionTree) { + await ProfileManagement.profilesCacheRefresh(); + const profileCache = await ProfileManagement.getProfilesCache(); + const profileToUpdate = profileCache.loadNamedProfile(session.label?.toString()!, "cics"); + const currentProfile = await profileCache.getProfileFromConfig(profileToUpdate.name); + await this.updateSessionHelper(currentProfile); + } + + /** + * Helper method to open file config for selected profile + * @param profile instance of IProfAttrs + */ + async updateSessionHelper(profile: imperative.IProfAttrs) { + const response = await window.showQuickPick([{ label: "\u270F Edit CICS Profile" }], { + ignoreFocusOut: true, + placeHolder: "Create a New Team Configuration File", + }); + if (response) { + const configInstance = await ProfileManagement.getConfigInstance(); + const teamConfigFilePath = configInstance.getTeamConfig().opts.homeDir + "/zowe.config.json"; + const filePath = profile?.profLoc.osLoc?.[0] ?? teamConfigFilePath; + await openConfigFile(filePath); + } + } + + /** + * Method for V1 profile configuration that returns the context of a configuration file. + * @param action string create or edit + */ + private async getConfigLocationPrompt(action: string): Promise { + let placeHolderText: string; + if (action === "create") { + placeHolderText = vscode.l10n.t("Select the location where the config file will be initialized"); + } else { + placeHolderText = vscode.l10n.t("Select the location of the config file to edit"); + } + const quickPickOptions: vscode.QuickPickOptions = { + placeHolder: placeHolderText, + ignoreFocusOut: true, + canPickMany: false, + }; + const globalText = vscode.l10n.t("Global: in the Zowe home directory"); + const projectText = vscode.l10n.t("Project: in the current working directory"); + const location = await Gui.showQuickPick([globalText, projectText], quickPickOptions); + // call check for existing and prompt here + switch (location) { + case globalText: + return "global"; + case projectText: + return "project"; + } + } + + /** + * Method that returns the icon based on global or local context. + * @param osLocInfo physical location of of profile on OS + */ + private getProfileIcon(osLocInfo: imperative.IProfLocOsLoc[]): string[] { + const ret: string[] = []; + for (const loc of osLocInfo ?? []) { + if (loc.global) { + ret.push("$(home)"); + } else { + ret.push("$(folder)"); + } + } + return ret; + } + + getTreeItem(element: CICSSessionTree): TreeItem | Thenable { + return element; + } + getChildren(element?: CICSSessionTree): ProviderResult { + return element === undefined ? this.loadedProfiles : element.children; + } + + getParent(element: any): ProviderResult { + element.getParent(); + } - public _onDidChangeTreeData: EventEmitter = new EventEmitter(); - readonly onDidChangeTreeData: Event = this._onDidChangeTreeData.event; + public _onDidChangeTreeData: EventEmitter = new EventEmitter(); + readonly onDidChangeTreeData: Event = this._onDidChangeTreeData.event; }