Some general cleanup/fixes for Arc dashboards (#11066)

* Some general cleanup/fixes for Arc dashboards

* more disposables

* refresh controller model for miaa dashboard too

* fixes
This commit is contained in:
Charles Gagnon
2020-06-24 09:06:28 -07:00
committed by GitHub
parent ca4ab55380
commit 2ba0de10df
20 changed files with 378 additions and 257 deletions

View File

@@ -10,6 +10,7 @@ import { parseEndpoint, parseInstanceName } from '../common/utils';
import { ResourceType } from '../constants';
import { ConnectToControllerDialog } from '../ui/dialogs/connectControllerDialog';
import { AzureArcTreeDataProvider } from '../ui/tree/azureArcTreeDataProvider';
import * as loc from '../localizedConstants';
export type ControllerInfo = {
url: string,
@@ -88,6 +89,13 @@ export class ControllerModel {
this._endpoints = response.body;
this.endpointsLastUpdated = new Date();
this._onEndpointsUpdated.fire(this._endpoints);
}).catch(err => {
// If an error occurs show a message so the user knows something failed but still
// fire the event so callers can know to update (e.g. so dashboards don't show the
// loading icon forever)
vscode.window.showErrorMessage(loc.fetchEndpointsFailed(this.info.url, err));
this._onEndpointsUpdated.fire(this._endpoints);
throw err;
}),
this._tokenRouter.apiV1TokenPost().then(async response => {
this._namespace = response.body.namespace!;
@@ -95,7 +103,14 @@ export class ControllerModel {
this._controllerRegistration = this._registrations.find(r => r.instanceType === ResourceType.dataControllers);
this.registrationsLastUpdated = new Date();
this._onRegistrationsUpdated.fire(this._registrations);
})
}).catch(err => {
// If an error occurs show a message so the user knows something failed but still
// fire the event so callers can know to update (e.g. so dashboards don't show the
// loading icon forever)
vscode.window.showErrorMessage(loc.fetchRegistrationsFailed(this.info.url, err));
this._onRegistrationsUpdated.fire(this._registrations);
throw err;
}),
]);
}