@@ -85,32 +85,27 @@ export class CICSTree implements TreeDataProvider<CICSSessionTree> {
85
85
* @param treeview CICSTree View
86
86
* *@param node current selected node
87
87
*/
88
- async manageProfile ( treeview : TreeView < any > , node : any ) {
89
- const allSelectedNodes = findSelectedNodes ( treeview , CICSSessionTree , node ) ;
90
- if ( ! allSelectedNodes || ! allSelectedNodes . length ) {
91
- window . showErrorMessage ( "No profile selected to manage" ) ;
92
- return ;
93
- }
88
+ async manageProfile ( treeview : TreeView < any > , node : CICSSessionTree ) {
94
89
try {
95
90
const configInstance = await ProfileManagement . getConfigInstance ( ) ;
96
91
if ( configInstance . getTeamConfig ( ) . exists ) {
97
- const currentProfile = await ProfileManagement . getProfilesCache ( ) . getProfileFromConfig ( allSelectedNodes [ allSelectedNodes . length - 1 ] . label ) ;
92
+ const currentProfile = await ProfileManagement . getProfilesCache ( ) . getProfileFromConfig ( String ( node . label ) ) ;
98
93
99
94
const deleteProfile : QuickPickItem = {
100
- label : `$(trash) ${ l10n . t ( `Delete Profile${ allSelectedNodes . length > 1 ? "s" : "" } ` ) } ` ,
101
- description : l10n . t ( `Delete the selected Profile${ allSelectedNodes . length > 1 ? "s" : "" } ` ) ,
95
+ label : `$(trash) ${ l10n . t ( `Delete Profile` ) } ` ,
96
+ description : l10n . t ( `Delete the selected Profile` ) ,
102
97
} ;
103
98
const hideProfile : QuickPickItem = {
104
- label : `$(eye-closed) ${ l10n . t ( `Hide Profile${ allSelectedNodes . length > 1 ? "s" : "" } ` ) } ` ,
105
- description : l10n . t ( `Hide the selected Profile${ allSelectedNodes . length > 1 ? "s" : "" } ` ) ,
99
+ label : `$(eye-closed) ${ l10n . t ( `Hide Profile` ) } ` ,
100
+ description : l10n . t ( `Hide the selected Profile` ) ,
106
101
} ;
107
102
const editProfile : QuickPickItem = {
108
- label : `$(pencil) ${ l10n . t ( `Edit Profile${ allSelectedNodes . length > 1 ? "s" : "" } ` ) } ` ,
109
- description : l10n . t ( `Update the selected Profile${ allSelectedNodes . length > 1 ? "s" : "" } ` ) ,
103
+ label : `$(pencil) ${ l10n . t ( `Edit Profile` ) } ` ,
104
+ description : l10n . t ( `Update the selected Profile` ) ,
110
105
} ;
111
106
112
107
const quickpick = Gui . createQuickPick ( ) ;
113
- const addProfilePlaceholder = "Choose user action for selected profiles " ;
108
+ const addProfilePlaceholder = "Choose user action for selected profile " ;
114
109
quickpick . items = [ editProfile , hideProfile , deleteProfile ] ;
115
110
quickpick . placeholder = addProfilePlaceholder ;
116
111
quickpick . ignoreFocusOut = true ;
@@ -122,13 +117,10 @@ export class CICSTree implements TreeDataProvider<CICSSessionTree> {
122
117
Gui . showMessage ( debugMsg ) ;
123
118
return ;
124
119
} else if ( choice === hideProfile ) {
125
- this . hideZoweConfigFile ( allSelectedNodes ) ;
120
+ await this . removeSession ( node ) ;
126
121
return ;
127
- } else if ( choice === editProfile ) {
128
- for ( const sessionTree of allSelectedNodes ) {
129
- await this . updateSession ( sessionTree , configInstance ) ;
130
- }
131
122
} else {
123
+ // editProfile or deleteProfile
132
124
const filePath = currentProfile . profLoc . osLoc [ 0 ] ;
133
125
await openConfigFile ( filePath ) ;
134
126
return ;
@@ -451,26 +443,6 @@ export class CICSTree implements TreeDataProvider<CICSSessionTree> {
451
443
this . _onDidChangeTreeData . fire ( undefined ) ;
452
444
}
453
445
454
- /**
455
- * Method for profile configuration that provides UI for user to hide a selected profile.
456
- * @param allSelectedNodes array of selected nodes
457
- */
458
- async hideZoweConfigFile ( allSelectedNodes : any [ ] ) {
459
- for ( const index in allSelectedNodes ) {
460
- try {
461
- const currentNode = allSelectedNodes [ parseInt ( index ) ] ;
462
- await this . removeSession ( currentNode ) ;
463
- } catch ( error ) {
464
- window . showErrorMessage (
465
- `Something went wrong when hiding the profile - ${ JSON . stringify ( error , Object . getOwnPropertyNames ( error ) ) . replace (
466
- / ( \\ n \t | \\ n | \\ t ) / gm,
467
- " " ,
468
- ) } `,
469
- ) ;
470
- }
471
- }
472
- }
473
-
474
446
async removeSession ( session : CICSSessionTree , profile ?: imperative . IProfileLoaded , position ?: number ) {
475
447
const persistentStorage = new PersistentStorage ( "zowe.cics.persistent" ) ;
476
448
await persistentStorage . removeLoadedCICSProfile ( session . label . toString ( ) ) ;
@@ -481,20 +453,6 @@ export class CICSTree implements TreeDataProvider<CICSSessionTree> {
481
453
this . _onDidChangeTreeData . fire ( undefined ) ;
482
454
}
483
455
484
- /**
485
- * Update profile functionality for profile configuration
486
- * @param session CICSSessions Tree
487
- */
488
- async updateSession ( session : CICSSessionTree , configInstance : imperative . ProfileInfo ) {
489
- await ProfileManagement . profilesCacheRefresh ( ) ;
490
- const profileCache = await ProfileManagement . getProfilesCache ( ) ;
491
- const profileToUpdate = profileCache . loadNamedProfile ( session . label ?. toString ( ) ! , "cics" ) ;
492
- const currentProfile = await profileCache . getProfileFromConfig ( profileToUpdate . name ) ;
493
- const teamConfigFilePath = configInstance . getTeamConfig ( ) . opts . homeDir + "/zowe.config.json" ;
494
- const filePath = currentProfile ?. profLoc . osLoc ?. [ 0 ] ?? teamConfigFilePath ;
495
- await openConfigFile ( filePath ) ;
496
- }
497
-
498
456
/**
499
457
* Method for profile configuration that returns the context of a configuration file.
500
458
* @param action string create or edit
0 commit comments