Skip to content

Commit

Permalink
feat: support fetch query in DS/USS FSP stat calls
Browse files Browse the repository at this point in the history
Signed-off-by: Trae Yelovich <[email protected]>
  • Loading branch information
traeok committed Aug 7, 2024
1 parent 7f12beb commit 69237a1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 4 additions & 2 deletions packages/zowe-explorer/src/trees/dataset/DatasetFSProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,17 @@ export class DatasetFSProvider extends BaseProvider implements vscode.FileSystem
*/
public async stat(uri: vscode.Uri): Promise<vscode.FileStat> {
ZoweLogger.trace(`[DatasetFSProvider] stat called with ${uri.toString()}`);
let isFetching = false;
if (uri.query) {
const queryParams = new URLSearchParams(uri.query);
if (queryParams.has("conflict")) {
return { ...this.lookup(uri, false), permissions: vscode.FilePermission.Readonly };
}
isFetching = queryParams.has("fetch") && queryParams.get("fetch") === "true";
}

const uriInfo = FsAbstractUtils.getInfoForUri(uri, Profiles.getInstance());
const entry = this.lookup(uri, false);
const entry = isFetching ? await this.remoteLookupForResource(uri) : this.lookup(uri, false);
// Return the entry for profiles as there is no remote info to fetch
if (uriInfo.isRoot) {
return entry;

Check warning on line 106 in packages/zowe-explorer/src/trees/dataset/DatasetFSProvider.ts

View check run for this annotation

Codecov / codecov/patch

packages/zowe-explorer/src/trees/dataset/DatasetFSProvider.ts#L106

Added line #L106 was not covered by tests
Expand Down Expand Up @@ -131,7 +133,7 @@ export class DatasetFSProvider extends BaseProvider implements vscode.FileSystem
}
}

return this.lookup(uri, false);
return entry;
}

private async fetchEntriesForProfile(uri: vscode.Uri, uriInfo: UriFsInfo, pattern: string): Promise<FilterEntry> {
Expand Down
4 changes: 3 additions & 1 deletion packages/zowe-explorer/src/trees/uss/UssFSProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,16 @@ export class UssFSProvider extends BaseProvider implements vscode.FileSystemProv
*/
public async stat(uri: vscode.Uri): Promise<vscode.FileStat> {
ZoweLogger.trace(`[UssFSProvider] stat called with ${uri.toString()}`);
let isFetching = false;
if (uri.query) {
const queryParams = new URLSearchParams(uri.query);
if (queryParams.has("conflict")) {
return { ...this.lookup(uri, false), permissions: vscode.FilePermission.Readonly };
}
isFetching = queryParams.has("fetch") && queryParams.get("fetch") === "true";
}

const entry = this.lookup(uri, false);
const entry = isFetching ? await this.remoteLookupForResource(uri) : this.lookup(uri, false);
const uriInfo = FsAbstractUtils.getInfoForUri(uri, Profiles.getInstance());
// Do not perform remote lookup for profile URIs
if (uriInfo.isRoot) {
Expand Down

0 comments on commit 69237a1

Please sign in to comment.