Skip to content

Commit

Permalink
fix(ds): Add sorting/filtering support for FTP nodes; fix DatasetTree…
Browse files Browse the repository at this point in the history
… test cases

Signed-off-by: Trae Yelovich <[email protected]>
  • Loading branch information
traeok committed Oct 10, 2023
1 parent 3884a3e commit 9efbf03
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2808,27 +2808,21 @@ describe("Dataset Tree Unit Tests - Function filterPdsMembersDialog", () => {
showInputBox: jest.spyOn(Gui, "showInputBox"),
});
const testSession = new ZoweDatasetNode("testSession", vscode.TreeItemCollapsibleState.Collapsed, null, createISession());
testSession.contextValue = globals.DS_SESSION_CONTEXT;
const testPds = new ZoweDatasetNode("testPds", vscode.TreeItemCollapsibleState.Collapsed, testSession, createISession());
testPds.contextValue = globals.DS_PDS_CONTEXT;

beforeEach(() => {
const mocks = getBlockMocks();
mocks.getParent.mockReturnValue(testSession);
testPds.children = [
{ label: "A", stats: { user: "someUser", m4date: Date.now() }, getParent: mocks.getParent } as unknown as ZoweDatasetNode,
{
label: "B",
stats: { user: "anotherUser", m4date: Date.parse("2022-01-01T12:00:00") },
getParent: mocks.getParent,
} as unknown as ZoweDatasetNode,
{
label: "C",
stats: { user: "someUser", m4date: Date.parse("2022-03-15T16:30:00") },
getParent: mocks.getParent,
} as unknown as ZoweDatasetNode,
];
const nodeA = new ZoweDatasetNode("A", vscode.TreeItemCollapsibleState.Collapsed, testPds, createISession());
nodeA.stats = { user: "someUser", m4date: new Date() };
const nodeB = new ZoweDatasetNode("B", vscode.TreeItemCollapsibleState.Collapsed, testPds, createISession());
nodeB.stats = { user: "anotherUser", m4date: new Date("2022-01-01T12:00:00") };
const nodeC = new ZoweDatasetNode("C", vscode.TreeItemCollapsibleState.Collapsed, testPds, createISession());
nodeC.stats = { user: "someUser", m4date: new Date("2022-03-15T16:30:00") };
testPds.children = [nodeA, nodeB, nodeC];
testSession.children = [testPds];
testPds.filter = undefined as any;
testSession.filter = undefined as any;
});

afterEach(() => {
Expand Down
8 changes: 7 additions & 1 deletion packages/zowe-explorer/src/dataset/ZoweDatasetNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,13 @@ export class ZoweDatasetNode extends ZoweTreeNode implements IZoweDatasetTreeNod
if (m4date) {
temp.stats = {
user: item.user,
m4date: new Date(`${m4date.replace(/\//g, "-")}T${mtime}:${msec}`),
m4date: dayjs(`${m4date} ${mtime}:${msec}`).toDate(),
};
} else {
// missing keys from API response; check for FTP keys
temp.stats = {
user: item.user ?? item.id,
m4date: item.changed ? dayjs(item.changed).toDate() : null,
};
}
elementChildren[temp.label.toString()] = temp;
Expand Down

0 comments on commit 9efbf03

Please sign in to comment.