Skip to content

Commit

Permalink
add checking for favorites before deleting job
Browse files Browse the repository at this point in the history
Signed-off-by: Richelle Anne Craw <richelleanne.craw@broadcom.com>
  • Loading branch information
crawr committed Mar 3, 2021
1 parent bc944b8 commit 133818f
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions packages/zowe-explorer/src/job/ZosJobsProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -455,17 +455,19 @@ export class ZosJobsProvider extends ZoweTreeProvider implements IZoweTree<IZowe
// Get node's profile node in favorites
const profileName = node.getProfileName();
const profileNodeInFavorites = this.findMatchingProfileInArray(this.mFavorites, profileName);
const startLength = profileNodeInFavorites.children.length;
profileNodeInFavorites.children = profileNodeInFavorites.children.filter(
(temp) => !(temp.label === node.label && temp.contextValue.startsWith(node.contextValue))
);
// Remove profile node from Favorites if it contains no more favorites.
if (profileNodeInFavorites.children.length < 1) {
return this.removeFavProfile(profileName, false);
}
if (startLength !== profileNodeInFavorites.children.length) {
await this.updateFavorites();
this.refreshElement(this.mFavoriteSession);
if (profileNodeInFavorites) {
const startLength = profileNodeInFavorites.children.length;
profileNodeInFavorites.children = profileNodeInFavorites.children.filter(
(temp) => !(temp.label === node.label && temp.contextValue.startsWith(node.contextValue))
);
// Remove profile node from Favorites if it contains no more favorites.
if (profileNodeInFavorites.children.length < 1) {
return this.removeFavProfile(profileName, false);
}
if (startLength !== profileNodeInFavorites.children.length) {
await this.updateFavorites();
this.refreshElement(this.mFavoriteSession);
}
}
return;
}
Expand Down

0 comments on commit 133818f

Please sign in to comment.