mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-28 01:25:39 -05:00
Initial work on Arc controller + MIAA dashboards (#10781)
* initial * postgres overview dashboard * fewer dependencies * stricter compile options * make vsce package work * Add localizedConstants * Add localizedConstants (cherry picked from commit 3ceed3e82b918ac829a7eac01487844e7d2ec02d) * common WIP * Initial dashboard work * separate ui and models * extend DashboardPage * remove error handling * wip * Add more localized constants * More updates * Use api to populate instances * merge master, strict mode, error handling, propertiesContainer, openInAzure * use more localizedConstants * localization * connection strings and properties pages * don't include arc extension by default * don't include arc extension by default * Address PR feedback * undo changes to modelview components * localize copied to clipboard * localize copied to clipboard with function * Update gulpfile.hygiene.js * Move the gulpfile * More updates * more updates * More updates * re-delete file * Fix compile error * PR comments Co-authored-by: Brian Bergeron <brberger@microsoft.com> Co-authored-by: Brian Bergeron <brian.e.bergeron@gmail.com> Co-authored-by: Amir Omidi <amomidi@microsoft.com>
This commit is contained in:
@@ -6,14 +6,16 @@
|
||||
import * as vscode from 'vscode';
|
||||
import { Authentication } from '../controller/auth';
|
||||
import { EndpointsRouterApi, EndpointModel, RegistrationRouterApi, RegistrationResponse, TokenRouterApi } from '../controller/generated/v1/api';
|
||||
import { ResourceType } from '../common/utils';
|
||||
|
||||
export class ControllerModel {
|
||||
private _endpointsRouter: EndpointsRouterApi;
|
||||
private _tokenRouter: TokenRouterApi;
|
||||
private _registrationRouter: RegistrationRouterApi;
|
||||
private _endpoints?: EndpointModel[];
|
||||
private _namespace?: string;
|
||||
private _registrations?: RegistrationResponse[];
|
||||
private _endpoints: EndpointModel[] = [];
|
||||
private _namespace: string = '';
|
||||
private _registrations: RegistrationResponse[] = [];
|
||||
private _controllerRegistration: RegistrationResponse | undefined = undefined;
|
||||
|
||||
private readonly _onEndpointsUpdated = new vscode.EventEmitter<EndpointModel[]>();
|
||||
private readonly _onRegistrationsUpdated = new vscode.EventEmitter<RegistrationResponse[]>();
|
||||
@@ -43,30 +45,35 @@ export class ControllerModel {
|
||||
this._tokenRouter.apiV1TokenPost().then(async response => {
|
||||
this._namespace = response.body.namespace!;
|
||||
this._registrations = (await this._registrationRouter.apiV1RegistrationListResourcesNsGet(this._namespace)).body;
|
||||
this._controllerRegistration = this._registrations.find(r => r.instanceType === ResourceType.dataControllers);
|
||||
this.registrationsLastUpdated = new Date();
|
||||
this._onRegistrationsUpdated.fire(this._registrations);
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
||||
public endpoints(): EndpointModel[] | undefined {
|
||||
public endpoints(): EndpointModel[] {
|
||||
return this._endpoints;
|
||||
}
|
||||
|
||||
public endpoint(name: string): EndpointModel | undefined {
|
||||
return this._endpoints?.find(e => e.name === name);
|
||||
return this._endpoints.find(e => e.name === name);
|
||||
}
|
||||
|
||||
public namespace(): string | undefined {
|
||||
public namespace(): string {
|
||||
return this._namespace;
|
||||
}
|
||||
|
||||
public registrations(): RegistrationResponse[] | undefined {
|
||||
public registrations(): RegistrationResponse[] {
|
||||
return this._registrations;
|
||||
}
|
||||
|
||||
public registration(type: string, namespace: string, name: string): RegistrationResponse | undefined {
|
||||
return this._registrations?.find(r => {
|
||||
public get controllerRegistration(): RegistrationResponse | undefined {
|
||||
return this._controllerRegistration;
|
||||
}
|
||||
|
||||
public getRegistration(type: string, namespace: string, name: string): RegistrationResponse | undefined {
|
||||
return this._registrations.find(r => {
|
||||
// Resources deployed outside the controller's namespace are named in the format 'namespace_name'
|
||||
let instanceName = r.instanceName!;
|
||||
const parts: string[] = instanceName.split('_');
|
||||
|
||||
Reference in New Issue
Block a user