Add action list to cards with callback (#1392)

- Add the ActionDescriptor functionality. This is a table of information with actionable links
- Also add optional status indicator which shows a color. In the future, would like to extend to have icon in this space as an alternative.
- Fixed 1 issue with account management UI throwing an error on cancel
This commit is contained in:
Kevin Cunnane
2018-05-11 10:59:42 -07:00
committed by GitHub
parent c0a6f3e012
commit 41ffd6e8ae
9 changed files with 178 additions and 29 deletions

View File

@@ -14,6 +14,7 @@ import * as sqlops from 'sqlops';
import { SqlMainContext, ExtHostModelViewShape, MainThreadModelViewShape } from 'sql/workbench/api/node/sqlExtHost.protocol';
import { IItemConfig, ModelComponentTypes, IComponentShape, IComponentEventArgs, ComponentEventType } from 'sql/workbench/api/common/sqlExtHostTypes';
import { IActionDescriptor } from 'vs/editor/standalone/browser/standaloneCodeEditor';
class ModelBuilderImpl implements sqlops.ModelBuilder {
private nextComponentId: number;
@@ -306,7 +307,7 @@ class ComponentWrapper implements sqlops.Component {
} else if (eventArgs) {
let emitter = this._emitterMap.get(eventArgs.eventType);
if (emitter) {
emitter.fire();
emitter.fire(eventArgs.args);
}
}
}
@@ -362,6 +363,7 @@ class CardWrapper extends ComponentWrapper implements sqlops.CardComponent {
constructor(proxy: MainThreadModelViewShape, handle: number, id: string) {
super(proxy, handle, ModelComponentTypes.Card, id);
this.properties = {};
this._emitterMap.set(ComponentEventType.onDidClick, new Emitter<any>());
}
public get label(): string {
@@ -382,6 +384,11 @@ class CardWrapper extends ComponentWrapper implements sqlops.CardComponent {
public set actions(a: sqlops.ActionDescriptor[]) {
this.setProperty('actions', a);
}
public get onDidActionClick(): vscode.Event<sqlops.ActionDescriptor> {
let emitter = this._emitterMap.get(ComponentEventType.onDidClick);
return emitter && emitter.event;
}
}
class InputBoxWrapper extends ComponentWrapper implements sqlops.InputBoxComponent {