Skip to content

Commit

Permalink
fix: not everything can be converted from Promise to PromiseLike 😢
Browse files Browse the repository at this point in the history
Signed-off-by: zFernand0 <[email protected]>
  • Loading branch information
zFernand0 committed Jul 24, 2024
1 parent 1f34ee9 commit 4e78ff9
Showing 1 changed file with 44 additions and 88 deletions.
132 changes: 44 additions & 88 deletions packages/zowe-explorer-api/src/tree/IZoweTree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,10 @@ export interface IZoweTree<T> extends vscode.TreeDataProvider<T>, Partial<vscode
* Root session nodes
*/
mSessionNodes: IZoweTreeNode[];

/**
* Root favorites node
*/
mFavoriteSession: IZoweTreeNode;

/**
* Array of favorite nodes
*/
Expand Down Expand Up @@ -62,19 +60,19 @@ export interface IZoweTree<T> extends vscode.TreeDataProvider<T>, Partial<vscode
* Adds a session to the container
* @param opts Options for adding sessions to tree
*/
addSession(opts?: Types.AddSessionOpts): void | PromiseLike<void>;
addSession(opts?: Types.AddSessionOpts): Promise<void>;

/**
* Adds a single session to the tree
* @param profile the profile to add to the tree
*/
addSingleSession(profile: imperative.IProfileLoaded): void | PromiseLike<void>;
addSingleSession(profile: imperative.IProfileLoaded): Promise<void>;

/**
* Edit a session to the container
* @param node This parameter identifies the node that needs to be called
*/
editSession(node: IZoweTreeNode): void | PromiseLike<void>;
editSession(node: IZoweTreeNode): Promise<void>;

/**
* Get sessions from persistent object of provider
Expand All @@ -85,176 +83,149 @@ export interface IZoweTree<T> extends vscode.TreeDataProvider<T>, Partial<vscode
* Add a new session to the container
* @param zoweFileProvider The tree to which the profile should be added
*/
createZoweSession(zoweFileProvider: IZoweTree<IZoweTreeNode>): void | PromiseLike<void>;
createZoweSession(zoweFileProvider: IZoweTree<IZoweTreeNode>): Promise<void>;

/**
* Create a brand new Schema
* @param zoweFileProvider The tree from which the schema will be created
*/
createZoweSchema(zoweFileProvider: IZoweTree<IZoweTreeNode>): void | PromiseLike<void>;
createZoweSchema(zoweFileProvider: IZoweTree<IZoweTreeNode>): Promise<void>;

/**
* Adds a favorite node
* @param favorite Adds a favorite node
*/
checkCurrentProfile(node: IZoweTreeNode): void | PromiseLike<void>;
checkCurrentProfile(node: IZoweTreeNode);

/**
* Log in to authentication service
* @param node This parameter identifies the node that needs to be called
*/
ssoLogin(node: IZoweTreeNode): void | PromiseLike<void>;
ssoLogin(node: IZoweTreeNode): Promise<void>;

/**
* Log out from authentication service
* @param node This parameter identifies the node that needs to be called
*/
ssoLogout(node: IZoweTreeNode): void | PromiseLike<void>;
ssoLogout(node: IZoweTreeNode): Promise<void>;

/**
* Adds a favorite node
* @param favorite Adds a favorite node
*/
addFavorite(favorite: IZoweTreeNode): void | PromiseLike<void>;

addFavorite(favorite: IZoweTreeNode): Promise<void>;
/**
* Removes a favorite node
* @param favorite Adds a favorite node
*/
removeFavorite(node: IZoweTreeNode): void | PromiseLike<void>;

removeFavorite(node: IZoweTreeNode): Promise<void>;
/**
* Removes profile node from Favorites section
* @param profileName
*/
removeFavProfile(profileName: string, userSelected: boolean): void | PromiseLike<void>;

removeFavProfile(profileName: string, userSelected: boolean): Promise<void>;
/**
* Refreshes the tree
*/
refresh(): void | PromiseLike<void>;

refresh(): void;
/**
* Refreshes an element of the tree
* @param favorite Node to refresh
*/
refreshElement(node: IZoweTreeNode): void | PromiseLike<void>;

refreshElement(node: IZoweTreeNode): void;
/**
* Signals that node data has changed in the tree view
* @param element to pass to event listener callback
*/
nodeDataChanged?(node: IZoweTreeNode): void | PromiseLike<void>;

nodeDataChanged?(node: IZoweTreeNode): void;
/**
* Event Emitters used to notify subscribers that the refresh event has fired
*/
onDidChangeConfiguration(e: vscode.ConfigurationChangeEvent): void | PromiseLike<void>;

onDidChangeConfiguration(e: vscode.ConfigurationChangeEvent);
/**
* Change the state of an expandable node
* @param element the node being flipped
* @param isOpen the intended state of the the tree view provider, true or false
*/
flipState(element: IZoweTreeNode, isOpen: boolean): void | PromiseLike<void>;
flipState(element: IZoweTreeNode, isOpen: boolean);

/**
* Rename the node. Begins a dialog.
* @param the node to be renamed
*/
rename(node: IZoweTreeNode): void | PromiseLike<void>;

rename(node: IZoweTreeNode);
/**
* Opens the node. Begins a dialog.
* @param node: the node to be opened
* @param preview: open in preview of edit mode
*/
open(node: IZoweTreeNode, preview: boolean): void | PromiseLike<void>;

open(node: IZoweTreeNode, preview: boolean);
/**
* Begins a copy operation on the node.
* @param node: the node to be copied
*/
copy(node: IZoweTreeNode): void | PromiseLike<void>;

copy(node: IZoweTreeNode);
/**
* Concludes a copy/paste operation on the node.
* @param node: the node to be pasted
*/
paste(node: IZoweTreeNode): void | PromiseLike<void>;

paste(node: IZoweTreeNode);
/**
* Deletes a node.
* @param node: the node to be deleted
*/
delete(node: IZoweTreeNode): void | PromiseLike<void>;

delete(node: IZoweTreeNode);
/**
* Reveals and selects a node within the tree.
* @param treeView: the vscode tree container
* @param node: the node to be selected
*/
setItem(treeView: vscode.TreeView<IZoweTreeNode>, node: IZoweTreeNode): void | PromiseLike<void>;

setItem(treeView: vscode.TreeView<IZoweTreeNode>, node: IZoweTreeNode);
/**
* Saves the currently employed filter as a favorite.
* @param node: A root node representing a session
*/
saveSearch(node: IZoweTreeNode): void | PromiseLike<void>;

saveSearch(node: IZoweTreeNode);
/**
* Saves an edited file.
* @param node: the node to be saved
*/
saveFile(document: vscode.TextDocument): void | PromiseLike<void>;
saveFile(document: vscode.TextDocument);

/**
* Refresh the given node with current mainframe data.
* @param node: the node to be refreshed
*/
refreshPS(node: IZoweTreeNode): void | PromiseLike<void>;
refreshPS(node: IZoweTreeNode);

/**
* Confirmation dialog to upload/save the given node.
* @param node: the node to be uploaded/saved
*/
uploadDialog(node: IZoweTreeNode): void | PromiseLike<void>;
uploadDialog(node: IZoweTreeNode);

/**
* Begins a filter/search operation on a node.
* @param node: the root node to be searched from
*/
filterPrompt(node: IZoweTreeNode): void | PromiseLike<void>;
filterPrompt(node: IZoweTreeNode);

/**
* Adds a search history element to persisted settings.
* @param node: the root node representing the operation
*/
addSearchHistory(element: string): void | PromiseLike<void>;

addSearchHistory(element: string);
/**
* Retrieves search history elements from persisted settings.
*/
getSearchHistory(): string[] | PromiseLike<string[]>;

getSearchHistory();
/**
* Returns the type of the tree provider.
* @returns {PersistenceSchemaEnum} the type of tree: Dataset, USS, or Job
*/
getTreeType(): PersistenceSchemaEnum;

/**
* Deletes a root node from the tree.
* @param node: A root node representing a session
* @param hideFromAllTrees: <optional> whether to hide from all trees or just the single tree
*/
deleteSession(node: IZoweTreeNode, hideFromAllTrees?: boolean): void | PromiseLike<void>;

deleteSession(node: IZoweTreeNode, hideFromAllTrees?: boolean);
/**
* Lets the user open a dataset by filtering the currently-loaded list
*/
getAllLoadedItems?(): IZoweTreeNode[] | Promise<IZoweTreeNode[]>;

getAllLoadedItems?(): Promise<IZoweTreeNode[]>;
/**
* Retrieves the vscode tree container
*/
Expand All @@ -266,106 +237,91 @@ export interface IZoweTree<T> extends vscode.TreeDataProvider<T>, Partial<vscode
* @param {IZoweTreeNode} node
*/
findFavoritedNode(node: IZoweTreeNode): IZoweTreeNode;

/**
* Finds the equivalent node but not as a favorite
*
* @param {IZoweTreeNode} node
*/
findNonFavoritedNode(node: IZoweTreeNode): IZoweTreeNode;

/**
* Finds the equivalent node, based on isFavorite
* @param {IZoweTreeNode} node
*/
findEquivalentNode(node: IZoweTreeNode, isFavorite: boolean): IZoweTreeNode;

/**
* Updates favorite
*/
updateFavorites(): void | PromiseLike<void>;

updateFavorites();
/**
* Renames a node from the favorites list
*
* @param {IZoweTreeNode} node
*/
renameFavorite(node: IZoweTreeNode, newLabel: string): void | PromiseLike<void>;

renameFavorite(node: IZoweTreeNode, newLabel: string);
/**
* Renames a node based on the profile and it's label
*
* @param {string} criteria the member name to add
*/
addFileHistory?(criteria: string): void | PromiseLike<void>;

addFileHistory?(criteria: string);
/**
* Returns the array of recently-opened member names
*
* @returns {string[]} the array of recently-opened member names
*/
getFileHistory?(): string[] | PromiseLike<string[]>;

getFileHistory?();
/**
* Removes a member name from the recently-opened members array
*
* @param {string} name the member to remove
*/
removeFileHistory?(name: string): void | PromiseLike<void>;

removeFileHistory?(name: string);
/**
* Removes session from the session array
* @param {string} name the sessions to remove
*/
removeSession?(name: string): void | PromiseLike<void>;

removeSession?(name: string): void;
/**
* Returns a new dataset filter string, from an old filter and a new string
*
* @param {string} newFilter the new filter to add
* @param {IZoweTreeNode} node the node with the old filter
*/
createFilterString?(newFilter: string, node: IZoweTreeNode): string | PromiseLike<string>;

createFilterString?(newFilter: string, node: IZoweTreeNode);
/**
* @param {string} profileLabel
* @param {string} beforeLabel
* @param {string} afterLabel
*/
renameNode(profile: string, beforeDataSetName: string, afterDataSetName: string): void | PromiseLike<void>;

renameNode(profile: string, beforeDataSetName: string, afterDataSetName: string);
/**
* Opens an item & reveals it in the tree
*
* @param {string} path the path of the item
* @param {IZoweTreeNode} sessionNode the session to use
*/
openItemFromPath?(path: string, sessionNode: IZoweTreeNode): void | PromiseLike<void>;

openItemFromPath?(path: string, sessionNode: IZoweTreeNode);
/**
* Adds template for data set creation attributes
*
* @param {any} criteria the member name to add
*/
addDsTemplate?(criteria: Types.DataSetAllocTemplate): void | PromiseLike<void>;

addDsTemplate?(criteria: Types.DataSetAllocTemplate): Promise<void>;
/**
* Returns the array of saved templates for data set creation attributes
*
* @returns {DataSetAllocTemplate[]} the array of recently-opened member names
*/
getDsTemplates?(): Types.DataSetAllocTemplate[] | PromiseLike<Types.DataSetAllocTemplate[]>;

getDsTemplates?(): Types.DataSetAllocTemplate[];
/* Initializes polling (refresh w/ configurable interval) for the provided node.
*
* @param {IZoweTreeNode} node the node to poll data for
*/
pollData?(node: IZoweTreeNode): void | PromiseLike<void>;

pollData?(node: IZoweTreeNode): any;
/**
* Opens resource for the provided node using encoding specified by user.
* @param {IZoweTreeNode} node
* @param {ZosEncoding} encoding File encoding, user will be prompted if undefined
*/
openWithEncoding?(node: IZoweTreeNode, encoding?: ZosEncoding): void | PromiseLike<void>;
openWithEncoding?(node: IZoweTreeNode, encoding?: ZosEncoding): Promise<void>;
}

0 comments on commit 4e78ff9

Please sign in to comment.