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

Add cics tasks #224

Merged
merged 18 commits into from
May 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,15 @@
"dark": "resources/imgs/filter-light.svg"
}
},
{
"command": "cics-extension-for-zowe.filterTasks",
"title": "Filter Tasks by Transaction ID",
"category": "Zowe Explorer for IBM CICS",
"icon": {
"light": "resources/imgs/filter-dark.svg",
"dark": "resources/imgs/filter-light.svg"
}
},
{
"command": "cics-extension-for-zowe.filterLocalFiles",
"title": "Filter Local Files",
Expand Down Expand Up @@ -133,6 +142,15 @@
"dark": "resources/imgs/filter-light.svg"
}
},
{
"command": "cics-extension-for-zowe.filterAllTasks",
"title": "Filter All Tasks by Transaction ID",
"category": "Zowe Explorer for IBM CICS",
"icon": {
"light": "resources/imgs/filter-dark.svg",
"dark": "resources/imgs/filter-light.svg"
}
},
{
"command": "cics-extension-for-zowe.clearFilter",
"title": "Clear Resource Filter",
Expand Down Expand Up @@ -166,6 +184,11 @@
"title": "Show Attributes",
"category": "Zowe Explorer for IBM CICS"
},
{
"command": "cics-extension-for-zowe.showTaskAttributes",
"title": "Show Attributes",
"category": "Zowe Explorer for IBM CICS"
},
{
"command": "cics-extension-for-zowe.showRegionAttributes",
"title": "Show Attributes",
Expand Down Expand Up @@ -234,6 +257,16 @@
"command": "cics-extension-for-zowe.deleteSession",
"title": "Delete Profile",
"category": "Zowe Explorer for IBM CICS"
},
{
"command": "cics-extension-for-zowe.revealTransaction",
"title": "Reveal Transaction",
"category": "Zowe Explorer for IBM CICS"
},
{
"command": "cics-extension-for-zowe.purgeTask",
"title": "Purge Task",
"category": "Zowe Explorer for IBM CICS"
}
],
"menus": {
Expand Down Expand Up @@ -295,11 +328,21 @@
"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 =~ /^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",
Expand All @@ -325,6 +368,11 @@
"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",
Expand All @@ -345,6 +393,11 @@
"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 =~ /^cicsprogram.disabled.*/",
"command": "cics-extension-for-zowe.enableProgram",
Expand Down Expand Up @@ -404,6 +457,16 @@
"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.revealTransaction",
"group": "001_zowecics_reveal@0"
},
{
"when": "view == cics-view && viewItem =~ /^cicstask.*/",
"command": "cics-extension-for-zowe.purgeTask",
"group": "000_zowecics_main@1"
}
]
},
Expand Down
4 changes: 3 additions & 1 deletion src/commands/clearResourceFilterCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import { commands, ProgressLocation, TreeView, window } from "vscode";
import { CICSLocalFileTree } from "../trees/CICSLocalFileTree";
import { CICSProgramTree } from "../trees/CICSProgramTree";
import { CICSTaskTree } from "../trees/CICSTaskTree";
import { CICSTransactionTree } from "../trees/CICSTransactionTree";
import { CICSTree } from "../trees/CICSTree";
import { findSelectedNodes } from "../utils/commandUtils";
Expand All @@ -23,7 +24,8 @@ export function getClearResourceFilterCommand(tree: CICSTree, treeview: TreeView
const allSelectedProgramTreeNodes = findSelectedNodes(treeview, CICSProgramTree, node);
const allSelectedTransactionTreeNodes = findSelectedNodes(treeview, CICSTransactionTree, node);
const allSelectedLocalFileTreeNodes = findSelectedNodes(treeview, CICSLocalFileTree, node);
const allSelectedNodes = [...allSelectedProgramTreeNodes, ...allSelectedTransactionTreeNodes, ...allSelectedLocalFileTreeNodes];
const allSelectedTaskTreeNodes = findSelectedNodes(treeview, CICSTaskTree, node);
const allSelectedNodes = [...allSelectedProgramTreeNodes, ...allSelectedTransactionTreeNodes, ...allSelectedLocalFileTreeNodes, ...allSelectedTaskTreeNodes];
if (!allSelectedNodes || !allSelectedNodes.length) {
window.showErrorMessage("No CICS resource tree selected");
return;
Expand Down
43 changes: 43 additions & 0 deletions src/commands/filterAllTasksCommand.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* 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 { CICSCombinedTaskTree } from "../trees/CICSCombinedTaskTree";
import { CICSTree } from "../trees/CICSTree";
import { getPatternFromFilter } from "../utils/filterUtils";
import { PersistentStorage } from "../utils/PersistentStorage";

export function getFilterAllTasksCommand(tree: CICSTree, treeview: TreeView<any>) {
return commands.registerCommand(
"cics-extension-for-zowe.filterAllTasks",
async (node) => {
const selection = treeview.selection;
let chosenNode;
if (node) {
chosenNode = node;
} else if (selection[selection.length-1] && selection[selection.length-1] instanceof CICSCombinedTaskTree) {
chosenNode = selection[selection.length-1];
} else {
window.showErrorMessage("No CICS 'All Tasks' tree selected");
return;
}
const persistentStorage = new PersistentStorage("zowe.cics.persistent");
const pattern = await getPatternFromFilter("Transaction ID", persistentStorage.getTransactionSearchHistory());
if (!pattern) {
return;
}
await persistentStorage.addTransactionSearchHistory(pattern!);
chosenNode.setFilter(pattern!);
await chosenNode.loadContents(tree);
tree._onDidChangeTreeData.fire(undefined);
}
);
}
52 changes: 52 additions & 0 deletions src/commands/filterTasksCommand.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* This program and the accompanying materials are made available under the terms of the
* Eclipse Public License v2.0 which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-v20.html
*
* SPDX-License-Identifier: EPL-2.0
*
* Copyright Contributors to the Zowe Project.
*
*/

import { commands, ProgressLocation, TreeView, window } from "vscode";
import { CICSTaskTree } from "../trees/CICSTaskTree";
import { CICSTree } from "../trees/CICSTree";
import { getPatternFromFilter } from "../utils/filterUtils";
import { PersistentStorage } from "../utils/PersistentStorage";

export function getFilterTasksCommand(tree: CICSTree, treeview: TreeView<any>) {
return commands.registerCommand(
"cics-extension-for-zowe.filterTasks",
async (node) => {
const selection = treeview.selection;
let chosenNode: CICSTaskTree;
if (node) {
chosenNode = node;
} else if (selection[selection.length-1] && selection[selection.length-1] instanceof CICSTaskTree) {
chosenNode = selection[selection.length-1];
} else {
window.showErrorMessage("No CICS task tree selected");
return;
}
const persistentStorage = new PersistentStorage("zowe.cics.persistent");
const pattern = await getPatternFromFilter("Transaction ID", persistentStorage.getTransactionSearchHistory());
if (!pattern) {
return;
}
await persistentStorage.addTransactionSearchHistory(pattern!);
chosenNode.setFilter(pattern!);
window.withProgress({
title: 'Loading Tasks',
location: ProgressLocation.Notification,
cancellable: false
}, async (_, token) => {
token.onCancellationRequested(() => {
console.log("Cancelling the loading of tasks");
});
await chosenNode.loadContents();
tree._onDidChangeTreeData.fire(undefined);
});
}
);
}
Loading