Skip to content

Commit

Permalink
consolidate command types to interface
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Twydell <[email protected]>
  • Loading branch information
AndrewTwydell committed Jan 9, 2025
1 parent 4556bab commit 0ef0905
Show file tree
Hide file tree
Showing 10 changed files with 46 additions and 9 deletions.
28 changes: 28 additions & 0 deletions packages/vsce/src/commands/ICommandParams.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* 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.
*
*/

/**
* Parameters passed to a command
*/
export interface ICommandParams {
/**
* Name of resource to find in filter
*/
name: string;
/**
* Region Applid to perform action
*/
regionName: string;
/**
* CICS Plex to perform action
*/
cicsPlex: string;
}
3 changes: 2 additions & 1 deletion packages/vsce/src/commands/closeLocalFileCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { CICSRegionsContainer } from "../trees/CICSRegionsContainer";
import { CICSLocalFileTreeItem } from "../trees/treeItems/CICSLocalFileTreeItem";
import { findSelectedNodes, splitCmciErrorMessage } from "../utils/commandUtils";
import { CICSCombinedLocalFileTree } from "../trees/CICSCombinedTrees/CICSCombinedLocalFileTree";
import { ICommandParams } from "./ICommandParams";

export function getCloseLocalFileCommand(tree: CICSTree, treeview: TreeView<any>) {
return commands.registerCommand("cics-extension-for-zowe.closeLocalFile", async (clickedNode) => {
Expand Down Expand Up @@ -118,7 +119,7 @@ export function getCloseLocalFileCommand(tree: CICSTree, treeview: TreeView<any>

async function closeLocalFile(
session: imperative.AbstractSession,
parms: { name: string; regionName: string; cicsPlex: string; },
parms: ICommandParams,
busyDecision: string
): Promise<ICMCIApiResponse> {
const requestBody: any = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { CICSRegionsContainer } from "../../trees/CICSRegionsContainer";
import { findSelectedNodes } from "../../utils/commandUtils";
import { CICSLocalFileTreeItem } from "../../trees/treeItems/CICSLocalFileTreeItem";
import { CICSCombinedLocalFileTree } from "../../trees/CICSCombinedTrees/CICSCombinedLocalFileTree";
import { ICommandParams } from "../ICommandParams";

export function getDisableLocalFileCommand(tree: CICSTree, treeview: TreeView<any>) {
return commands.registerCommand("cics-extension-for-zowe.disableLocalFile", async (clickedNode) => {
Expand Down Expand Up @@ -107,7 +108,7 @@ export function getDisableLocalFileCommand(tree: CICSTree, treeview: TreeView<an

async function disableLocalFile(
session: imperative.AbstractSession,
parms: { name: string; regionName: string; cicsPlex: string },
parms: ICommandParams,
busyDecision: string
): Promise<ICMCIApiResponse> {
const requestBody: any = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { CICSRegionsContainer } from "../../trees/CICSRegionsContainer";
import { findSelectedNodes } from "../../utils/commandUtils";
import { CICSProgramTreeItem } from "../../trees/treeItems/CICSProgramTreeItem";
import { CICSCombinedProgramTree } from "../../trees/CICSCombinedTrees/CICSCombinedProgramTree";
import { ICommandParams } from "../ICommandParams";

/**
* Performs disable on selected CICSProgram nodes.
Expand Down Expand Up @@ -101,7 +102,7 @@ export function getDisableProgramCommand(tree: CICSTree, treeview: TreeView<any>
});
}

function disableProgram(session: imperative.AbstractSession, parms: { name: string; regionName: string; cicsPlex: string }): Promise<ICMCIApiResponse> {
function disableProgram(session: imperative.AbstractSession, parms: ICommandParams): Promise<ICMCIApiResponse> {
const requestBody: any = {
request: {
action: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { CICSRegionsContainer } from "../../trees/CICSRegionsContainer";
import { findSelectedNodes, splitCmciErrorMessage } from "../../utils/commandUtils";
import { CICSTransactionTreeItem } from "../../trees/treeItems/CICSTransactionTreeItem";
import { CICSCombinedTransactionsTree } from "../../trees/CICSCombinedTrees/CICSCombinedTransactionTree";
import { ICommandParams } from "../ICommandParams";

export function getDisableTransactionCommand(tree: CICSTree, treeview: TreeView<any>) {
return commands.registerCommand("cics-extension-for-zowe.disableTransaction", async (clickedNode) => {
Expand Down Expand Up @@ -108,7 +109,7 @@ export function getDisableTransactionCommand(tree: CICSTree, treeview: TreeView<

async function disableTransaction(
session: imperative.AbstractSession,
parms: { name: string; regionName: string; cicsPlex: string }
parms: ICommandParams
): Promise<ICMCIApiResponse> {
const requestBody: any = {
request: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { CICSRegionsContainer } from "../../trees/CICSRegionsContainer";
import { CICSLocalFileTreeItem } from "../../trees/treeItems/CICSLocalFileTreeItem";
import { findSelectedNodes } from "../../utils/commandUtils";
import { CICSCombinedLocalFileTree } from "../../trees/CICSCombinedTrees/CICSCombinedLocalFileTree";
import { ICommandParams } from "../ICommandParams";

export function getEnableLocalFileCommand(tree: CICSTree, treeview: TreeView<any>) {
return commands.registerCommand("cics-extension-for-zowe.enableLocalFile", async (clickedNode) => {
Expand Down Expand Up @@ -95,7 +96,7 @@ export function getEnableLocalFileCommand(tree: CICSTree, treeview: TreeView<any
});
}

async function enableLocalFile(session: imperative.AbstractSession, parms: { name: string; regionName: string; cicsPlex: string }): Promise<ICMCIApiResponse> {
async function enableLocalFile(session: imperative.AbstractSession, parms: ICommandParams): Promise<ICMCIApiResponse> {
const requestBody: any = {
request: {
action: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { CICSRegionsContainer } from "../../trees/CICSRegionsContainer";
import { CICSProgramTreeItem } from "../../trees/treeItems/CICSProgramTreeItem";
import { findSelectedNodes } from "../../utils/commandUtils";
import { CICSCombinedProgramTree } from "../../trees/CICSCombinedTrees/CICSCombinedProgramTree";
import { ICommandParams } from "../ICommandParams";

/**
* Performs enable on selected CICSProgram nodes.
Expand Down Expand Up @@ -99,7 +100,7 @@ export function getEnableProgramCommand(tree: CICSTree, treeview: TreeView<any>)
});
}

async function enableProgram(session: imperative.AbstractSession, parms: { name: string; regionName: string; cicsPlex: string; }): Promise<ICMCIApiResponse> {
async function enableProgram(session: imperative.AbstractSession, parms: ICommandParams): Promise<ICMCIApiResponse> {
const requestBody: any = {
request: {
action: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { CICSRegionsContainer } from "../../trees/CICSRegionsContainer";
import { findSelectedNodes } from "../../utils/commandUtils";
import { CICSTransactionTreeItem } from "../../trees/treeItems/CICSTransactionTreeItem";
import { CICSCombinedTransactionsTree } from "../../trees/CICSCombinedTrees/CICSCombinedTransactionTree";
import { ICommandParams } from "../ICommandParams";

export function getEnableTransactionCommand(tree: CICSTree, treeview: TreeView<any>) {
return commands.registerCommand("cics-extension-for-zowe.enableTransaction", async (clickedNode) => {
Expand Down Expand Up @@ -95,7 +96,7 @@ export function getEnableTransactionCommand(tree: CICSTree, treeview: TreeView<a
});
}

async function enableTransaction(session: imperative.AbstractSession, parms: { name: string; regionName: string; cicsPlex: string; }): Promise<ICMCIApiResponse> {
async function enableTransaction(session: imperative.AbstractSession, parms: ICommandParams): Promise<ICMCIApiResponse> {
const requestBody: any = {
request: {
action: {
Expand Down
3 changes: 2 additions & 1 deletion packages/vsce/src/commands/openLocalFileCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { CICSRegionsContainer } from "../trees/CICSRegionsContainer";
import { CICSLocalFileTreeItem } from "../trees/treeItems/CICSLocalFileTreeItem";
import { findSelectedNodes, splitCmciErrorMessage } from "../utils/commandUtils";
import { CICSCombinedLocalFileTree } from "../trees/CICSCombinedTrees/CICSCombinedLocalFileTree";
import { ICommandParams } from "./ICommandParams";

export function getOpenLocalFileCommand(tree: CICSTree, treeview: TreeView<any>) {
return commands.registerCommand("cics-extension-for-zowe.openLocalFile", async (clickedNode) => {
Expand Down Expand Up @@ -103,7 +104,7 @@ export function getOpenLocalFileCommand(tree: CICSTree, treeview: TreeView<any>)
});
}

async function openLocalFile(session: imperative.AbstractSession, parms: { name: string; regionName: string; cicsPlex: string; }): Promise<ICMCIApiResponse> {
async function openLocalFile(session: imperative.AbstractSession, parms: ICommandParams): Promise<ICMCIApiResponse> {
const requestBody: any = {
request: {
action: {
Expand Down
3 changes: 2 additions & 1 deletion packages/vsce/src/commands/purgeTaskCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { findSelectedNodes, splitCmciErrorMessage } from "../utils/commandUtils"
import { CICSTaskTreeItem } from "../trees/treeItems/CICSTaskTreeItem";
import { CICSRegionsContainer } from "../trees/CICSRegionsContainer";
import { CICSCombinedTaskTree } from "../trees/CICSCombinedTrees/CICSCombinedTaskTree";
import { ICommandParams } from "./ICommandParams";

/**
* Purge a CICS Task and reload the CICS Task tree contents and the combined Task tree contents
Expand Down Expand Up @@ -130,7 +131,7 @@ export function getPurgeTaskCommand(tree: CICSTree, treeview: TreeView<any>) {
*/
async function purgeTask(
session: imperative.AbstractSession,
parms: { name: string; regionName: string; cicsPlex: string; },
parms: ICommandParams,
purgeType: string
): Promise<ICMCIApiResponse> {
const requestBody: any = {
Expand Down

0 comments on commit 0ef0905

Please sign in to comment.