Skip to content

Commit

Permalink
Merge remote-tracking branch 'zowe/main' into MvsCopyCrossLpar
Browse files Browse the repository at this point in the history
Signed-off-by: likhithanimma1 <[email protected]>
  • Loading branch information
likhithanimma1 committed Jan 15, 2025
2 parents 739ad19 + f2b54c8 commit 16ee193
Show file tree
Hide file tree
Showing 8 changed files with 100 additions and 55 deletions.
2 changes: 1 addition & 1 deletion packages/zowe-explorer-api/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ All notable changes to the "zowe-explorer-api" extension will be documented in t
- Added optional `setEncoding`, `getEncoding`, and `getEncodingInMap` functions to the `IZoweJobTreeNode` interface. [#3361](https://github.com/zowe/zowe-explorer-vscode/pull/3361)
- Added an `AuthHandler` class with functions for locking/unlocking profiles, prompting for credentials and SSO login support. Extenders can now lock profiles after an authentication error, ensuring that an invalid profile is not used asynchronously until the error is resolved. [#3329](https://github.com/zowe/zowe-explorer-vscode/issues/3329)
- Added individual user settings for MVS, TSO, and Unix commands. [#3079](https://github.com/zowe/zowe-explorer-vscode/pull/3079)
- Added new `copyDataSetCrossLpar` API to provide ability to copy/paste datasets cross lpars. [#3012](https://github.com/zowe/zowe-explorer-vscode/issues/3012)
- Added new `copyDataSetCrossLpar` API to provide ability to copy/paste data sets across LPARs. [#3012](https://github.com/zowe/zowe-explorer-vscode/issues/3012)

### Bug fixes

Expand Down
8 changes: 7 additions & 1 deletion packages/zowe-explorer/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

All notable changes to the "vscode-extension-for-zowe" extension will be documented in this file.

## Bug Fixes

- Fixed data loss when creating a data set member with the same name as an existing member. When creating a new member, the user is now prompted to replace it if the member already exists. [[#3327](https://github.com/zowe/zowe-explorer-vscode/issues/3327)]

## TBD Release

### New features and enhancements
Expand All @@ -19,7 +23,8 @@ All notable changes to the "vscode-extension-for-zowe" extension will be documen
- You can now add multiple partitioned data sets or USS directories to your workspace at once using the "Add to Workspace" feature. [#3324](https://github.com/zowe/zowe-explorer-vscode/issues/3324)
- Exposed read and write access to local storage keys for Zowe Explorer extenders. [#3180](https://github.com/zowe/zowe-explorer-vscode/issues/3180)
- Added `Open with Encoding` to the context menu of Job Spool files. [#1941](https://github.com/zowe/zowe-explorer-vscode/issues/1941)
- Implemented copy/paste functionality of datasets within and cross lpars. [#3012](https://github.com/zowe/zowe-explorer-vscode/issues/3012)
- Added Time Started, Time Ended, and Time Submitted job properties to the Jobs table view. [#3055](https://github.com/zowe/zowe-explorer-vscode/issues/3055)
- Implemented copy/paste functionality of data sets within and across LPARs. [#3012](https://github.com/zowe/zowe-explorer-vscode/issues/3012)

### Bug fixes

Expand All @@ -36,6 +41,7 @@ All notable changes to the "vscode-extension-for-zowe" extension will be documen
- Fixed an issue where cached encoding was applied for all profiles with the same data set or USS path in the "Open with Encoding" menu. [#3363](https://github.com/zowe/zowe-explorer-vscode/pull/3363)
- Removed "Delete Profile" action from the "Manage Profile" menu since this action is currently not supported in Zowe Explorer. [#3037](https://github.com/zowe/zowe-explorer-vscode/issues/3037)
- Fixed an issue where the filesystem continued to use a profile with invalid credentials to fetch resources. Now, after an authentication error occurs for a profile, it cannot be used again in the filesystem until the authentication error is resolved. [#3329](https://github.com/zowe/zowe-explorer-vscode/issues/3329)
- Resolved user interface bug with tables that caused an inconsistent table height within the VS Code Panel. [#3389](https://github.com/zowe/zowe-explorer-vscode/pull/3389)

## `3.0.3`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ export function createIJobObject() {
type: "JOB",
url: "fake/url",
"exec-member": "sampleMember",
"exec-ended": "2024-03-07T00:04:67:980z",
"exec-ended": "2024-03-07T00:04:27:980z",
"exec-started": "2024-03-06T00:04:27:100z",
"exec-submitted": "2024-03-07T00:04:07:000z",
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ describe("Dataset Actions Unit Tests - Function createMember", () => {
etag: "123",
},
});
jest.spyOn(blockMocks.mvsApi, "allMembers").mockImplementation(jest.fn());

await DatasetActions.createMember(parent, blockMocks.testDatasetTree);

Expand Down Expand Up @@ -280,6 +281,28 @@ describe("Dataset Actions Unit Tests - Function createMember", () => {
}
);
});

it("should not replace existing member when user cancels the replacement prompt", async () => {
const blockMocks = createBlockMocksShared();
const parent = new ZoweDatasetNode({
label: "parent",
collapsibleState: vscode.TreeItemCollapsibleState.Collapsed,
parentNode: blockMocks.datasetSessionNode,
session: blockMocks.session,
});

blockMocks.testDatasetTree.getChildren = jest.fn().mockResolvedValueOnce([{ ...parent, label: "TESTMEMBER" } as any] as any);

jest.spyOn(DatasetActions, "determineReplacement").mockResolvedValueOnce("cancel" as any);
mocked(vscode.window.showInputBox).mockResolvedValueOnce("TESTMEMBER");

jest.spyOn(DatasetFSProvider.instance, "fetchDatasetAtUri").mockResolvedValueOnce(true as any);

await DatasetActions.createMember(parent, blockMocks.testDatasetTree);

expect(vscode.commands.executeCommand).toHaveBeenCalledWith("vscode.open", { path: "/parent/parent/TESTMEMBER", scheme: "zowe-ds" });
expect(blockMocks.testDatasetTree.refresh).toHaveBeenCalled();
});
});

describe("Dataset Actions Unit Tests - Function refreshPS", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,11 +202,27 @@ describe("JobTableView unit tests", () => {
});
});

describe("expectedFields", () => {
it("includes exec-started, exec-submitted and exec-ended properties", () => {
for (const prop of ["exec-started", "exec-submitted", "exec-ended"]) {
expect((JobTableView as any).expectedFields.some((f) => f.field === prop)).toBe(true);
}
});
});

describe("jobPropertiesFor", () => {
it("returns job properties from the job node", () => {
const blockMocks = getBlockMocks();
const expectedProperties = { ...blockMocks.jobNode.job };
expect((JobTableView as any).jobPropertiesFor(blockMocks.jobNode)).toStrictEqual(expectedProperties);
});

it("returns exec-started, exec-submitted and exec-ended properties from the job node", () => {
const blockMocks = getBlockMocks();
const jobProperties = (JobTableView as any).jobPropertiesFor(blockMocks.jobNode);
expect(jobProperties).toHaveProperty("exec-started");
expect(jobProperties).toHaveProperty("exec-submitted");
expect(jobProperties).toHaveProperty("exec-ended");
});
});
});
35 changes: 22 additions & 13 deletions packages/zowe-explorer/src/trees/dataset/DatasetActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -693,10 +693,18 @@ export class DatasetActions {
if (name) {
const label = parent.label as string;
const profile = parent.getProfile();
let replace: Definitions.ShouldReplace;
const memberUri = vscode.Uri.from({
scheme: ZoweScheme.DS,
path: path.posix.join(parent.resourceUri.path, name),
});
try {
await ZoweExplorerApiRegister.getMvsApi(profile).createDataSetMember(label + "(" + name + ")", {
responseTimeout: profile.profile?.responseTimeout,
});
replace = await DatasetActions.determineReplacement(profile, `${label}(${name})`, "mem");
if (replace !== "cancel") {
await ZoweExplorerApiRegister.getMvsApi(profile).createDataSetMember(label + "(" + name + ")", {
responseTimeout: profile.profile?.responseTimeout,
});
}
} catch (err) {
if (err instanceof Error) {
await AuthUtils.errorHandling(err, {
Expand All @@ -707,16 +715,17 @@ export class DatasetActions {
}
throw err;
}
if (replace === "notFound") {
const newNode = new ZoweDatasetNode({
label: name,
collapsibleState: vscode.TreeItemCollapsibleState.None,
parentNode: parent,
profile: parent.getProfile(),
});
parent.children.push(newNode);
await vscode.workspace.fs.writeFile(memberUri, new Uint8Array());
}

const newNode = new ZoweDatasetNode({
label: name,
collapsibleState: vscode.TreeItemCollapsibleState.None,
parentNode: parent,
profile: parent.getProfile(),
});
await vscode.workspace.fs.writeFile(newNode.resourceUri, new Uint8Array());

parent.children.push(newNode);
parent.dirty = true;
datasetProvider.refreshElement(parent);

Expand All @@ -726,7 +735,7 @@ export class DatasetActions {
datasetProvider.refreshElement(otherTreeParent);
}

await vscode.commands.executeCommand("vscode.open", newNode.resourceUri);
await vscode.commands.executeCommand("vscode.open", memberUri);
datasetProvider.refresh();
}
}
Expand Down
53 changes: 27 additions & 26 deletions packages/zowe-explorer/src/trees/job/JobTableView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,32 @@ export class JobTableView {
type: "primary",
},
};
// These fields are typically included in job metadata.
private static expectedFields = [
{
field: "jobname",
headerName: l10n.t("Name"),
sort: "asc",
} as Table.ColumnOpts,
{
field: "class",
headerName: l10n.t("Class"),
},
{ field: "owner", headerName: l10n.t("Owner") },
{ field: "jobid", headerName: l10n.t("ID") },
{ field: "retcode", headerName: l10n.t("Return Code") },
{ field: "status", headerName: l10n.t("Status") },
{ field: "subsystem", headerName: l10n.t("Subsystem") },
{ field: "type", headerName: l10n.t("Type") },
{ field: "job-correlator", headerName: l10n.t("Job Correlator") },
{ field: "phase", headerName: l10n.t("Phase") },
{ field: "phase-name", headerName: l10n.t("Phase Name") },
{ field: "exec-started", headerName: l10n.t("Time Started") },
{ field: "exec-submitted", headerName: l10n.t("Time Submitted") },
{ field: "exec-ended", headerName: l10n.t("Time Ended") },
{ field: "reason-not-running", headerName: l10n.t("Error Details") },
];

private static table: Table.Instance;

private static buildTitle(profileNode: IZoweJobTreeNode): string {
Expand Down Expand Up @@ -187,32 +213,7 @@ export class JobTableView {
.isView()
.title(this.buildTitle(profileNode))
.rows(...JobTableView.cachedChildren.map((item) => this.jobPropertiesFor(item)))
.columns(
...[
{
field: "jobname",
headerName: l10n.t("Name"),
filter: true,
sort: "asc",
} as Table.ColumnOpts,
{
field: "class",
headerName: l10n.t("Class"),
filter: true,
},
{ field: "owner", headerName: l10n.t("Owner"), filter: true },
{ field: "jobid", headerName: l10n.t("ID"), filter: true },
{ field: "retcode", headerName: l10n.t("Return Code"), filter: true },
{ field: "status", headerName: l10n.t("Status"), filter: true },
{ field: "subsystem", headerName: l10n.t("Subsystem"), filter: true },
{ field: "type", headerName: l10n.t("Type"), filter: true },
{ field: "job-correlator", headerName: l10n.t("Job Correlator"), filter: true },
{ field: "phase", headerName: l10n.t("Phase"), filter: true },
{ field: "phase-name", headerName: l10n.t("Phase Name"), filter: true },
{ field: "reason-not-running", headerName: l10n.t("Error Details"), filter: true },
{ field: "actions", hide: true },
]
)
.columns(...[...this.expectedFields.map((field) => ({ filter: true, ...field })), { field: "actions", hide: true }])
.addContextOption("all", this.contextOptions.getJcl)
.addContextOption("all", this.contextOptions.displayInTree)
.addRowAction("all", this.rowActions.cancelJob)
Expand Down
14 changes: 1 addition & 13 deletions packages/zowe-explorer/src/webviews/src/table-view/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ html {

.table-view {
margin-top: 1em;
height: 88vh;
height: calc(100vh - 5em);
}

.ag-theme-vsc {
Expand All @@ -22,18 +22,6 @@ html {
--ag-selected-row-background-color: var(--vscode-notebook-selectedCellBackground);
}

@media (max-height: 480px) {
.table-view {
height: 78vh;
}
}

@media (max-height: 300px) {
.table-view {
height: 68vh;
}
}

.ctx-menu-open .ag-body-viewport {
overflow: hidden !important;
}
Expand Down

0 comments on commit 16ee193

Please sign in to comment.