Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -906,7 +906,8 @@
"viewsWelcome": [
{
"view": "openshiftProjectExplorer",
"contents": "Cluster is not accessible or you are not logged in.\n[Login](command:openshift.explorer.login)\n[Select Kubernetes Context ](command:openshift.explorer.switchContext)\n[Add OpenShift Cluster](command:openshift.explorer.addCluster)"
"contents": "Cluster is not accessible or you are not logged in.\n[Login](command:openshift.explorer.login)\n[Select Kubernetes Context ](command:openshift.explorer.switchContext)\n[Add OpenShift Cluster](command:openshift.explorer.addCluster)",
"enablement": "openshift.app.explorer.init"
},
{
"view": "openshiftComponentsView",
Expand Down
15 changes: 14 additions & 1 deletion src/explorer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { WatchUtil, FileContentChangeNotifier } from './util/watch';
import { KubeConfigUtils } from './util/kubeUtils';
import { vsCommand } from './vscommand';
import { ComponentTypesView } from './componentTypesView';
import { isThenable } from './util/async';

const kubeConfigFolder: string = path.join(Platform.getUserHomePath(), '.kube');

Expand Down Expand Up @@ -95,7 +96,19 @@ export class OpenShiftExplorer implements TreeDataProvider<OpenShiftObject>, Dis

// eslint-disable-next-line class-methods-use-this
getChildren(element?: OpenShiftObject): ProviderResult<OpenShiftObject[]> {
return element ? element.getChildren() : OpenShiftExplorer.odoctl.getClusters();
let result;
if (element) {
result = element.getChildren();
} else {
result = OpenShiftExplorer.odoctl.getClusters();
}
if (isThenable(result)) {
result = result.then(async (value: OpenShiftObject[]) => {
await commands.executeCommand('setContext', 'openshift.app.explorer.init', value.length === 0);
return value;
})
}
return result;
}

// eslint-disable-next-line class-methods-use-this
Expand Down