Skip to content
Open
Show file tree
Hide file tree
Changes from 7 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
1 change: 1 addition & 0 deletions packages/zowe-explorer/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ All notable changes to the "vscode-extension-for-zowe" extension will be documen

### Bug fixes

- Fixed an issue where deleting an open PDS resulted in an error. [#3908](https://github.com/zowe/zowe-explorer-vscode/pull/3908)
- Fixed an issue where `ssh` type profiles were throwing errors when making file system calls. [#3891](https://github.com/zowe/zowe-explorer-vscode/pull/3891)
- Fixed duplicate credential prompts that occurred when logging out of SSO with multiple virtual workspaces open. [#3858](https://github.com/zowe/zowe-explorer-vscode/issues/3858)
- Fixed race conditions in parallel file system calls made with invalid credentials. [#3830](https://github.com/zowe/zowe-explorer-vscode/pull/3830)
Expand Down
18 changes: 16 additions & 2 deletions packages/zowe-explorer/src/trees/dataset/DatasetActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {
type AttributeInfo,
DataSetAttributesProvider,
ZosEncoding,
Paginator,
} from "@zowe/zowe-explorer-api";
import { ZoweDatasetNode } from "./ZoweDatasetNode";
import { DatasetUtils } from "./DatasetUtils";
Expand All @@ -44,6 +45,7 @@ import { Definitions } from "../../configuration/Definitions";
import { TreeViewUtils } from "../../utils/TreeViewUtils";
import { SharedTreeProviders } from "../shared/SharedTreeProviders";
import { DatasetTree } from "./DatasetTree";
import { SettingsConfig } from "../../configuration/SettingsConfig";

export class DatasetActions {
public static typeEnum: zosfiles.CreateDataSetTypeEnum;
Expand Down Expand Up @@ -1526,6 +1528,20 @@ export class DatasetActions {
await datasetProvider.checkCurrentProfile(node);
if (Profiles.getInstance().validProfile !== Validation.ValidationType.INVALID) {
await vscode.workspace.fs.delete(node.resourceUri, { recursive: false });
if (node?.children) {
node.children = node.children.filter((child) => child !== node);
}

const dataSetNode = node.getSessionNode() as ZoweDatasetNode;
const isSession = SharedContext.isSession(dataSetNode) || SharedContext.isFavoriteSearch(dataSetNode);
const fetchFunction = isSession
? dataSetNode.listDatasetsInRange.bind(dataSetNode)
: dataSetNode.listMembersInRange.bind(dataSetNode);

const itemsPerPage = SettingsConfig.getDirectValue<number>(Constants.SETTINGS_DATASETS_PER_PAGE) ?? Constants.DEFAULT_ITEMS_PER_PAGE;

dataSetNode.paginator = new Paginator(itemsPerPage, fetchFunction);
dataSetNode.paginatorData = undefined;
} else {
return;
}
Expand All @@ -1551,7 +1567,6 @@ export class DatasetActions {
throw err;
}

// remove node from tree
if (fav) {
datasetProvider.mSessionNodes.forEach((ses) => {
if (node.getProfileName() === ses.label.toString()) {
Expand All @@ -1574,7 +1589,6 @@ export class DatasetActions {
// Refresh the correct node (parent of node to delete) to reflect changes
datasetProvider.refreshElement(isMember ? parentNode : parentNode.getParent());
}

datasetProvider.refreshElement(node.getSessionNode());
}

Expand Down
9 changes: 4 additions & 5 deletions packages/zowe-explorer/src/trees/dataset/ZoweDatasetNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ export class ZoweDatasetNode extends ZoweTreeNode implements IZoweDatasetTreeNod
public persistence = new ZowePersistentFilters(PersistenceSchemaEnum.Dataset);
public inFilterPrompt = false;

private paginator?: Paginator<IZosFilesResponse>;
private paginatorData?: {
public paginator?: Paginator<IZosFilesResponse>;
public paginatorData?: {
totalItems?: number;
lastItemName?: string;
};
Expand Down Expand Up @@ -681,7 +681,7 @@ export class ZoweDatasetNode extends ZoweTreeNode implements IZoweDatasetTreeNod
return fileEntry?.etag;
}

private async listDatasetsInRange(start?: string, limit?: number): Promise<IFetchResult<IZosFilesResponse, string>> {
public async listDatasetsInRange(start?: string, limit?: number): Promise<IFetchResult<IZosFilesResponse, string>> {
let totalItems = this.paginatorData?.totalItems;
let lastDatasetName = this.paginatorData?.lastItemName;
const responses: IZosFilesResponse[] = [];
Expand Down Expand Up @@ -803,7 +803,7 @@ export class ZoweDatasetNode extends ZoweTreeNode implements IZoweDatasetTreeNod
}
}

private async listMembersInRange(start?: string, limit?: number): Promise<IFetchResult<IZosFilesResponse, string>> {
public async listMembersInRange(start?: string, limit?: number): Promise<IFetchResult<IZosFilesResponse, string>> {
let totalItems = this.paginatorData?.totalItems;
let lastMemberName = this.paginatorData?.lastItemName;
let allMembers: IZosmfListResponse[] = [];
Expand Down Expand Up @@ -954,7 +954,6 @@ export class ZoweDatasetNode extends ZoweTreeNode implements IZoweDatasetTreeNod
// Lazy initialization or re-initialization of paginator if needed
const fetchFunction = isSession ? this.listDatasetsInRange.bind(this) : this.listMembersInRange.bind(this);
this.itemsPerPage = SettingsConfig.getDirectValue<number>(Constants.SETTINGS_DATASETS_PER_PAGE) ?? Constants.DEFAULT_ITEMS_PER_PAGE;

if (isSession && patternChanged) {
// Check if pattern changed for session
this.paginator = this.paginatorData = undefined;
Expand Down