Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor resource trees to common TreeItem #214

Draft
wants to merge 17 commits into
base: main
Choose a base branch
from
Draft
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
4 changes: 3 additions & 1 deletion packages/sdk/src/doc/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@ export * from "./ICMCIApiResponse";
export * from "./ICMCIRequestOptions";
export * from "./ICMCIResponseResultSummary";
export * from "./ICSDGroupParms";
export * from "./IGetResourceUriOptions";
export * from "./IProgramParms";
export * from "./IResourceParms";
export * from "./IResourceQueryParms";
export * from "./IResultCacheParms";
export * from "./ITransactionParms";
export * from "./IURIMapParms";
export * from "./IWebServiceParms";
export * from "./IGetResourceUriOptions";
export * from "./resources";

19 changes: 19 additions & 0 deletions packages/sdk/src/doc/resources/ILocalFile.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/**
* This program and the accompanying materials are made available under the terms of the
* Eclipse Public License v2.0 which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-v20.html
*
* SPDX-License-Identifier: EPL-2.0
*
* Copyright Contributors to the Zowe Project.
*
*/

import { IResource } from "./IResource";

export interface ILocalFile extends IResource {
file: string;
enablestatus: string;
openstatus: string;
}

16 changes: 16 additions & 0 deletions packages/sdk/src/doc/resources/IPipeline.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* This program and the accompanying materials are made available under the terms of the
* Eclipse Public License v2.0 which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-v20.html
*
* SPDX-License-Identifier: EPL-2.0
*
* Copyright Contributors to the Zowe Project.
*
*/

import { IResource } from "./IResource";

export interface IPipeline extends IResource {
name: string;
}
18 changes: 18 additions & 0 deletions packages/sdk/src/doc/resources/IProgram.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/**
* This program and the accompanying materials are made available under the terms of the
* Eclipse Public License v2.0 which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-v20.html
*
* SPDX-License-Identifier: EPL-2.0
*
* Copyright Contributors to the Zowe Project.
*
*/

import { IResource } from "./IResource";

export interface IProgram extends IResource {
program: string;
status: string;
newcopycnt?: string;
}
20 changes: 20 additions & 0 deletions packages/sdk/src/doc/resources/IRegion.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/**
* This program and the accompanying materials are made available under the terms of the
* Eclipse Public License v2.0 which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-v20.html
*
* SPDX-License-Identifier: EPL-2.0
*
* Copyright Contributors to the Zowe Project.
*
*/

import { IResource } from "./IResource";

export interface IRegion extends IResource {
applid: string;
cicsstate: string;
cicsstatus: string;
cicsname: string;
}

15 changes: 15 additions & 0 deletions packages/sdk/src/doc/resources/IResource.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* This program and the accompanying materials are made available under the terms of the
* Eclipse Public License v2.0 which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-v20.html
*
* SPDX-License-Identifier: EPL-2.0
*
* Copyright Contributors to the Zowe Project.
*
*/


export interface IResource {
eyu_cicsname: string;
}
17 changes: 17 additions & 0 deletions packages/sdk/src/doc/resources/ITCPIP.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* This program and the accompanying materials are made available under the terms of the
* Eclipse Public License v2.0 which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-v20.html
*
* SPDX-License-Identifier: EPL-2.0
*
* Copyright Contributors to the Zowe Project.
*
*/

import { IResource } from "./IResource";

export interface ITCPIP extends IResource {
name: string;
port: string;
}
18 changes: 18 additions & 0 deletions packages/sdk/src/doc/resources/ITask.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/**
* This program and the accompanying materials are made available under the terms of the
* Eclipse Public License v2.0 which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-v20.html
*
* SPDX-License-Identifier: EPL-2.0
*
* Copyright Contributors to the Zowe Project.
*
*/

import { IResource } from "./IResource";

export interface ITask extends IResource {
task: string;
runstatus: string;
tranid: string;
}
18 changes: 18 additions & 0 deletions packages/sdk/src/doc/resources/ITransaction.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/**
* This program and the accompanying materials are made available under the terms of the
* Eclipse Public License v2.0 which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-v20.html
*
* SPDX-License-Identifier: EPL-2.0
*
* Copyright Contributors to the Zowe Project.
*
*/

import { IResource } from "./IResource";

export interface ITransaction extends IResource {
tranid: string;
program: string;
status: string;
}
18 changes: 18 additions & 0 deletions packages/sdk/src/doc/resources/IUriMap.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/**
* This program and the accompanying materials are made available under the terms of the
* Eclipse Public License v2.0 which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-v20.html
*
* SPDX-License-Identifier: EPL-2.0
*
* Copyright Contributors to the Zowe Project.
*
*/

import { IResource } from "./IResource";

export interface IUriMap extends IResource {
name: string;
scheme: string;
path: string;
}
16 changes: 16 additions & 0 deletions packages/sdk/src/doc/resources/IWebService.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* This program and the accompanying materials are made available under the terms of the
* Eclipse Public License v2.0 which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-v20.html
*
* SPDX-License-Identifier: EPL-2.0
*
* Copyright Contributors to the Zowe Project.
*
*/

import { IResource } from "./IResource";

export interface IWebService extends IResource {
name: string;
}
24 changes: 24 additions & 0 deletions packages/sdk/src/doc/resources/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/**
* This program and the accompanying materials are made available under the terms of the
* Eclipse Public License v2.0 which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-v20.html
*
* SPDX-License-Identifier: EPL-2.0
*
* Copyright Contributors to the Zowe Project.
*
*/



export * from './ILocalFile';
export * from './IPipeline';
export * from './IProgram';
export * from './IRegion';
export * from './IResource';
export * from './ITask';
export * from './ITCPIP';
export * from './ITransaction';
export * from './IUriMap';
export * from './IWebService';

1 change: 1 addition & 0 deletions packages/vsce/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ All notable changes to the "cics-extension-for-zowe" extension will be documente

- BugFix: Editing profile results in exception - removed ability to multi-select profiles. [#222](https://github.com/zowe/cics-for-zowe-client/issues/222)
- BugFix: Update documentation to reflect changes to fully support V3 profiles. [#209](https://github.com/zowe/cics-for-zowe-client/issues/209)
- Moved web-based resources in tree out of `Web` folder inline with others.

## `3.3.1`

Expand Down
112 changes: 112 additions & 0 deletions packages/vsce/__tests__/__unit__/doc/meta.localfile.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
/**
* This program and the accompanying materials are made available under the terms of the
* Eclipse Public License v2.0 which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-v20.html
*
* SPDX-License-Identifier: EPL-2.0
*
* Copyright Contributors to the Zowe Project.
*
*/

import { ILocalFile } from "@zowe/cics-for-zowe-sdk";
import { LocalFileMeta } from "../../../src/doc/LocalFileMeta";

describe("Local File Meta", () => {

let localFileMock: ILocalFile;

beforeEach(() => {
localFileMock = {
file: "MYFILE",
enablestatus: "ENABLED",
eyu_cicsname: "MYREG",
openstatus: "OPEN"
};
});

it("should return label", () => {
const label = LocalFileMeta.getLabel(localFileMock);
expect(label).toEqual(`MYFILE`);
});
it("should return label with disabled", () => {
localFileMock.enablestatus = "DISABLED";
const label = LocalFileMeta.getLabel(localFileMock);
expect(label).toEqual(`MYFILE (Disabled)`);
});
it("should return label with unenabled", () => {
localFileMock.enablestatus = "UNENABLED";
const label = LocalFileMeta.getLabel(localFileMock);
expect(label).toEqual(`MYFILE (Unenabled)`);
});
it("should return label with closed", () => {
localFileMock.openstatus = "CLOSED";
const label = LocalFileMeta.getLabel(localFileMock);
expect(label).toEqual(`MYFILE (Closed)`);
});
it("should return label with disabled and closed", () => {
localFileMock.openstatus = "CLOSED";
localFileMock.enablestatus = "DISABLED";
const label = LocalFileMeta.getLabel(localFileMock);
expect(label).toEqual(`MYFILE (Disabled) (Closed)`);
});
it("should return label with unenabled and closed", () => {
localFileMock.openstatus = "CLOSED";
localFileMock.enablestatus = "UNENABLED";
const label = LocalFileMeta.getLabel(localFileMock);
expect(label).toEqual(`MYFILE (Unenabled) (Closed)`);
});

it("should return context", () => {
const context = LocalFileMeta.getContext(localFileMock);
expect(context).toEqual(`cicslocalfile.enabled.open.MYFILE`);
});
it("should return context with disabled", () => {
localFileMock.enablestatus = "DISABLED";
const context = LocalFileMeta.getContext(localFileMock);
expect(context).toEqual(`cicslocalfile.disabled.open.MYFILE`);
});
it("should return context with unenabled", () => {
localFileMock.enablestatus = "UNENABLED";
const context = LocalFileMeta.getContext(localFileMock);
expect(context).toEqual(`cicslocalfile.unenabled.open.MYFILE`);
});
it("should return context with closed", () => {
localFileMock.openstatus = "closed";
const context = LocalFileMeta.getContext(localFileMock);
expect(context).toEqual(`cicslocalfile.enabled.closed.MYFILE`);
});
it("should return context with disabled and closed", () => {
localFileMock.openstatus = "closed";
localFileMock.enablestatus = "DISABLED";
const context = LocalFileMeta.getContext(localFileMock);
expect(context).toEqual(`cicslocalfile.disabled.closed.MYFILE`);
});
it("should return context with unenabled and closed", () => {
localFileMock.openstatus = "closed";
localFileMock.enablestatus = "UNENABLED";
const context = LocalFileMeta.getContext(localFileMock);
expect(context).toEqual(`cicslocalfile.unenabled.closed.MYFILE`);
});

it("should return icon name", () => {
const iconName = LocalFileMeta.getIconName(localFileMock);
expect(iconName).toEqual(`local-file`);
});
it("should return icon name with disabled", () => {
localFileMock.enablestatus = "DISABLED";
const iconName = LocalFileMeta.getIconName(localFileMock);
expect(iconName).toEqual(`local-file-disabled`);
});
it("should return icon name with closed", () => {
localFileMock.openstatus = "CLOSED";
const iconName = LocalFileMeta.getIconName(localFileMock);
expect(iconName).toEqual(`local-file-closed`);
});
it("should return icon name with closed and disabled", () => {
localFileMock.openstatus = "CLOSED";
localFileMock.enablestatus = "DISABLED";
const iconName = LocalFileMeta.getIconName(localFileMock);
expect(iconName).toEqual(`local-file-disabled-closed`);
});
});
40 changes: 40 additions & 0 deletions packages/vsce/__tests__/__unit__/doc/meta.pipeline.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/**
* This program and the accompanying materials are made available under the terms of the
* Eclipse Public License v2.0 which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-v20.html
*
* SPDX-License-Identifier: EPL-2.0
*
* Copyright Contributors to the Zowe Project.
*
*/

import { IPipeline } from "@zowe/cics-for-zowe-sdk";
import { PipelineMeta } from "../../../src/doc/PipelineMeta";

describe("Pipeline Meta", () => {

let pipelineMock: IPipeline;

beforeEach(() => {
pipelineMock = {
name: "MYPIPE",
eyu_cicsname: "MYREG"
};
});

it("should return label", () => {
const label = PipelineMeta.getLabel(pipelineMock);
expect(label).toEqual(`MYPIPE`);
});

it("should return context", () => {
const context = PipelineMeta.getContext(pipelineMock);
expect(context).toEqual(`cicspipeline.MYPIPE`);
});

it("should return icon name", () => {
const iconName = PipelineMeta.getIconName(pipelineMock);
expect(iconName).toEqual(`program`);
});
});
Loading
Loading