mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-28 17:23:19 -05:00
Feat/model backed ui (#1145)
This is an initial PR for a new model-driven UI where extensions can provide definitions of the components & how they're laid out using Containers. #1140, #1141, #1142, #1143 and #1144 are all tracking additional work needed to improve the initial implementation and fix some issues with the implementation. Features: - Supports defining a FlexContainer that maps to a flexbox-based layout. - Supports creating a card component, which is a key-value pair based control that will lay out simple information to a user. Eventually this will have an optional set of actions associated with it. - Has a sample project which shows how to use the API and was used for verification
This commit is contained in:
31
src/sql/services/dashboard/common/dashboardViewService.ts
Normal file
31
src/sql/services/dashboard/common/dashboardViewService.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
|
||||
import Event from 'vs/base/common/event';
|
||||
|
||||
import * as sqlops from 'sqlops';
|
||||
import { IItemConfig, IComponentShape } from 'sql/workbench/api/common/sqlExtHostTypes';
|
||||
import { IView, IModelView } from 'sql/services/model/modelViewService';
|
||||
|
||||
export const SERVICE_ID = 'dashboardViewService';
|
||||
|
||||
export interface IDashboardWebview extends IView {
|
||||
setHtml(html: string): void;
|
||||
onMessage: Event<string>;
|
||||
sendMessage(message: string);
|
||||
}
|
||||
|
||||
export interface IDashboardViewService {
|
||||
_serviceBrand: any;
|
||||
onRegisteredWebview: Event<IDashboardWebview>;
|
||||
registerWebview(widget: IDashboardWebview);
|
||||
onRegisteredModelView: Event<IModelView>;
|
||||
registerModelView(widget: IModelView);
|
||||
}
|
||||
|
||||
export const IDashboardViewService = createDecorator<IDashboardViewService>(SERVICE_ID);
|
||||
@@ -0,0 +1,28 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import { IDashboardViewService, IDashboardWebview } from 'sql/services/dashboard/common/dashboardViewService';
|
||||
import Event, { Emitter } from 'vs/base/common/event';
|
||||
import { IModelView } from 'sql/services/model/modelViewService';
|
||||
|
||||
export class DashboardViewService implements IDashboardViewService {
|
||||
_serviceBrand: any;
|
||||
|
||||
private _onRegisteredWebview = new Emitter<IDashboardWebview>();
|
||||
public readonly onRegisteredWebview: Event<IDashboardWebview> = this._onRegisteredWebview.event;
|
||||
|
||||
private _onRegisteredModelView = new Emitter<IModelView>();
|
||||
public readonly onRegisteredModelView: Event<IModelView> = this._onRegisteredModelView.event;
|
||||
|
||||
public registerWebview(widget: IDashboardWebview) {
|
||||
this._onRegisteredWebview.fire(widget);
|
||||
}
|
||||
|
||||
registerModelView(view: IModelView) {
|
||||
this._onRegisteredModelView.fire(view);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user