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

Progress bar #152

Merged
merged 5 commits into from
Jan 28, 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
11 changes: 10 additions & 1 deletion src/commands/clearResourceFilterCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*
*/

import { commands, TreeView, window } from "vscode";
import { commands, ProgressLocation, TreeView, window } from "vscode";
import { CICSLocalFileTree } from "../trees/CICSLocalFileTree";
import { CICSProgramTree } from "../trees/CICSProgramTree";
import { CICSTransactionTree } from "../trees/CICSTransactionTree";
Expand All @@ -30,8 +30,17 @@ export function getClearResourceFilterCommand(tree: CICSTree, treeview: TreeView
}
for (const node of allSelectedNodes) {
node.clearFilter();
window.withProgress({
title: 'Loading Resources',
location: ProgressLocation.Notification,
cancellable: false
}, async (_, token) => {
token.onCancellationRequested(() => {
console.log("Cancelling the loading of resources");
});
await node.loadContents();
tree._onDidChangeTreeData.fire(undefined);
});
}
}
);
Expand Down
17 changes: 13 additions & 4 deletions src/commands/filterLocalFileCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*
*/

import { commands, TreeView, window } from "vscode";
import { commands, ProgressLocation, TreeView, window } from "vscode";
import { CICSLocalFileTree } from "../trees/CICSLocalFileTree";
import { CICSTree } from "../trees/CICSTree";
import { getPatternFromFilter } from "../utils/FilterUtils";
Expand All @@ -20,7 +20,7 @@ export function getFilterLocalFilesCommand(tree: CICSTree, treeview: TreeView<an
"cics-extension-for-zowe.filterLocalFiles",
async (node) => {
const selection = treeview.selection;
let chosenNode;
let chosenNode: CICSLocalFileTree;
if (node) {
chosenNode = node;
} else if (selection[selection.length-1] && selection[selection.length-1] instanceof CICSLocalFileTree) {
Expand All @@ -36,8 +36,17 @@ export function getFilterLocalFilesCommand(tree: CICSTree, treeview: TreeView<an
}
await persistentStorage.addLocalFileSearchHistory(pattern!);
chosenNode.setFilter(pattern!);
await chosenNode.loadContents();
tree._onDidChangeTreeData.fire(undefined);
window.withProgress({
title: 'Loading Local Files',
location: ProgressLocation.Notification,
cancellable: false
}, async (_, token) => {
token.onCancellationRequested(() => {
console.log("Cancelling the loading of local files");
});
await chosenNode.loadContents();
tree._onDidChangeTreeData.fire(undefined);
});
}
);
}
13 changes: 11 additions & 2 deletions src/commands/filterProgramsCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*
*/

import { commands, TreeView, window } from "vscode";
import { commands, ProgressLocation, TreeView, window } from "vscode";
import { CICSProgramTree } from "../trees/CICSProgramTree";
import { CICSTree } from "../trees/CICSTree";
import { getPatternFromFilter } from "../utils/FilterUtils";
Expand All @@ -20,7 +20,7 @@ export function getFilterProgramsCommand(tree: CICSTree, treeview: TreeView<any>
"cics-extension-for-zowe.filterPrograms",
async (node) => {
const selection = treeview.selection;
let chosenNode;
let chosenNode: CICSProgramTree;
if (node) {
chosenNode = node;
} else if (selection[selection.length-1] && selection[selection.length-1] instanceof CICSProgramTree) {
Expand All @@ -36,8 +36,17 @@ export function getFilterProgramsCommand(tree: CICSTree, treeview: TreeView<any>
}
await persistentStorage.addProgramSearchHistory(pattern!);
chosenNode.setFilter(pattern!);
window.withProgress({
title: 'Loading Programs',
location: ProgressLocation.Notification,
cancellable: false
}, async (_, token) => {
token.onCancellationRequested(() => {
console.log("Cancelling the loading of programs");
});
await chosenNode.loadContents();
tree._onDidChangeTreeData.fire(undefined);
});
}
);
}
17 changes: 13 additions & 4 deletions src/commands/filterTransactionCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*
*/

import { commands, TreeView, window } from "vscode";
import { commands, ProgressLocation, TreeView, window } from "vscode";
import { CICSTransactionTree } from "../trees/CICSTransactionTree";
import { CICSTree } from "../trees/CICSTree";
import { getPatternFromFilter } from "../utils/FilterUtils";
Expand All @@ -20,7 +20,7 @@ export function getFilterTransactionCommand(tree: CICSTree, treeview: TreeView<a
"cics-extension-for-zowe.filterTransactions",
async (node) => {
const selection = treeview.selection;
let chosenNode;
let chosenNode: CICSTransactionTree;
if (node) {
chosenNode = node;
} else if (selection[selection.length-1] && selection[selection.length-1] instanceof CICSTransactionTree) {
Expand All @@ -36,8 +36,17 @@ export function getFilterTransactionCommand(tree: CICSTree, treeview: TreeView<a
}
await persistentStorage.addTransactionSearchHistory(pattern!);
chosenNode.setFilter(pattern!);
await chosenNode.loadContents();
tree._onDidChangeTreeData.fire(undefined);
window.withProgress({
title: 'Loading Transactions',
location: ProgressLocation.Notification,
cancellable: false
}, async (_, token) => {
token.onCancellationRequested(() => {
console.log("Cancelling the loading of transactions");
});
await chosenNode.loadContents();
tree._onDidChangeTreeData.fire(undefined);
});
}
);
}
81 changes: 46 additions & 35 deletions src/commands/getFilterPlexResources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*
*/

import { commands, TreeItemCollapsibleState, TreeView, window } from "vscode";
import { commands, ProgressLocation, TreeItemCollapsibleState, TreeView, window } from "vscode";
import { CICSRegionsContainer } from "../trees/CICSRegionsContainer";
import { CICSRegionTree } from "../trees/CICSRegionTree";
import { CICSTree } from "../trees/CICSTree";
Expand All @@ -21,7 +21,7 @@ export function getFilterPlexResources(tree: CICSTree, treeview: TreeView<any>)
"cics-extension-for-zowe.filterPlexResources",
async (node) => {
const selection = treeview.selection;
let chosenNode;
let chosenNode: any;
if (node) {
chosenNode = node;
} else if (selection[selection.length-1] && selection[selection.length-1] instanceof CICSRegionsContainer) {
Expand All @@ -32,7 +32,7 @@ export function getFilterPlexResources(tree: CICSTree, treeview: TreeView<any>)
}
const plex = chosenNode.getParent();
const plexProfile = plex.getProfile();
let resourceToFilter;
let resourceToFilter: any;
if (plexProfile.profile.regionName && plexProfile.profile.cicsPlex) {
resourceToFilter = await window.showQuickPick(["Programs", "Local Transactions", "Local Files"]);
} else {
Expand All @@ -53,44 +53,55 @@ export function getFilterPlexResources(tree: CICSTree, treeview: TreeView<any>)
return;
}
const pattern = await getPatternFromFilter(resourceToFilter.slice(0,-1), resourceHistory);
if (pattern) {
if (resourceToFilter === "Programs"){
await persistentStorage.addProgramSearchHistory(pattern);
} else if(resourceToFilter === "Local Transactions"){
await persistentStorage.addTransactionSearchHistory(pattern);
} else if (resourceToFilter === "Local Files"){
await persistentStorage.addLocalFileSearchHistory(pattern);
} else if (resourceToFilter === "Regions"){
await persistentStorage.addRegionSearchHistory(pattern);
}

if (resourceToFilter === "Programs"){
await persistentStorage.addProgramSearchHistory(pattern!);
} else if(resourceToFilter === "Local Transactions"){
await persistentStorage.addTransactionSearchHistory(pattern!);
} else if (resourceToFilter === "Local Files"){
await persistentStorage.addLocalFileSearchHistory(pattern!);
} else if (resourceToFilter === "Regions"){
await persistentStorage.addRegionSearchHistory(pattern!);
}

chosenNode.collapsibleState = TreeItemCollapsibleState.Expanded;
chosenNode.collapsibleState = TreeItemCollapsibleState.Expanded;

if (resourceToFilter === "Regions"){
chosenNode.filterRegions(pattern!, tree);
} else {
for (const region of chosenNode.children){
if (region instanceof CICSRegionTree) {
if (region.getIsActive()) {
let treeToFilter;
if (resourceToFilter === "Programs"){
treeToFilter = region.children?.filter((child: any) => child.contextValue.includes("cicstreeprogram."))[0];
} else if (resourceToFilter === "Local Transactions"){
treeToFilter = region.children?.filter((child: any) => child.contextValue.includes("cicstreetransaction."))[0];
} else if (resourceToFilter === "Local Files"){
treeToFilter = region.children?.filter((child: any) => child.contextValue.includes("cicstreelocalfile."))[0];
}
if (treeToFilter) {
treeToFilter.setFilter(pattern!);
await treeToFilter.loadContents();
treeToFilter.collapsibleState = TreeItemCollapsibleState.Expanded;
if (resourceToFilter === "Regions"){
chosenNode.filterRegions(pattern!, tree);
} else {
window.withProgress({
title: 'Loading Resources',
location: ProgressLocation.Notification,
cancellable: true
}, async (_, token) => {
token.onCancellationRequested(() => {
console.log("Cancelling the loading of resources");
});
for (const region of chosenNode.children){
if (region instanceof CICSRegionTree) {
if (region.getIsActive()) {
let treeToFilter;
if (resourceToFilter === "Programs"){
treeToFilter = region.children?.filter((child: any) => child.contextValue.includes("cicstreeprogram."))[0];
} else if (resourceToFilter === "Local Transactions"){
treeToFilter = region.children?.filter((child: any) => child.contextValue.includes("cicstreetransaction."))[0];
} else if (resourceToFilter === "Local Files"){
treeToFilter = region.children?.filter((child: any) => child.contextValue.includes("cicstreelocalfile."))[0];
}
if (treeToFilter) {
treeToFilter.setFilter(pattern!);
await treeToFilter.loadContents();
treeToFilter.collapsibleState = TreeItemCollapsibleState.Expanded;
}
region.collapsibleState = TreeItemCollapsibleState.Expanded;
}
region.collapsibleState = TreeItemCollapsibleState.Expanded;
}
}
tree._onDidChangeTreeData.fire(undefined);
});
}
tree._onDidChangeTreeData.fire(undefined);
}
tree._onDidChangeTreeData.fire(undefined);
}
}
);
}