Skip to content

Commit 37f185a

Browse files
authored
Login required command move to login item (#1628)
* Move login command to 'login required' tree item Signed-off-by: Denis Golovin <dgolovin@redhat.com> * Show login required tree item as a leaf Signed-off-by: Denis Golovin <dgolovin@redhat.com>
1 parent 60d991b commit 37f185a

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

src/odo.ts

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -118,15 +118,6 @@ export abstract class OpenShiftObjectImpl implements OpenShiftObject {
118118
return this.name;
119119
}
120120

121-
get command(): VSCommand {
122-
if (this.contextValue === ContextType.LOGIN_REQUIRED) {
123-
return {
124-
command: 'openshift.explorer.login',
125-
title: 'Login to the cluster',
126-
};
127-
}
128-
}
129-
130121
get description(): string {
131122
let suffix = '';
132123
if (this.contextValue === ContextType.COMPONENT) {
@@ -229,7 +220,14 @@ export class OpenShiftClusterDown extends OpenShiftObjectImpl {
229220

230221
export class OpenShiftLoginRequired extends OpenShiftObjectImpl {
231222
constructor() {
232-
super(undefined, 'Please log in to the cluster', ContextType.LOGIN_REQUIRED, 'cluster-down.png');
223+
super(undefined, 'Please log in to the cluster', ContextType.LOGIN_REQUIRED, 'cluster-down.png', TreeItemCollapsibleState.None);
224+
}
225+
226+
get command(): VSCommand {
227+
return {
228+
command: 'openshift.explorer.login',
229+
title: 'Login to the cluster',
230+
};
233231
}
234232
}
235233

@@ -573,7 +571,7 @@ export class OdoImpl implements Odo {
573571
return [... await this._getComponents(application), ... await this._getServices(application)].sort(compareNodes);
574572
}
575573

576-
async getComponents(application: OpenShiftObject, condition: (value: OpenShiftObject) => boolean = (value) => value.contextValue === ContextType.COMPONENT || value.contextValue === ContextType.COMPONENT_NO_CONTEXT || value.contextValue === ContextType.COMPONENT_PUSHED): Promise<OpenShiftObject[]> {
574+
async getComponents(application: OpenShiftObject, condition: (value: OpenShiftObject) => boolean = (value): boolean => value.contextValue === ContextType.COMPONENT || value.contextValue === ContextType.COMPONENT_NO_CONTEXT || value.contextValue === ContextType.COMPONENT_PUSHED): Promise<OpenShiftObject[]> {
577575
return (await this.getApplicationChildren(application)).filter(condition);
578576
}
579577

0 commit comments

Comments
 (0)