mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-15 10:58:31 -05:00
Collapsible properties (#771)
* started moving properties to home tab * moved properties * refactored panel in dashboard * fix errors * fix miss-naming * added collapsable properties * revert unnecessary change * add icon for collapsing properties
This commit is contained in:
@@ -197,3 +197,36 @@ export class AddFeatureTabAction extends Action {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export class CollapseWidgetAction extends Action {
|
||||
private static readonly ID = 'collapseWidget';
|
||||
private static readonly COLLPASE_LABEL = nls.localize('collapseWidget', "Collapse");
|
||||
private static readonly EXPAND_LABEL = nls.localize('expandWidget', "Expand");
|
||||
private static readonly COLLAPSE_ICON = 'maximize-panel-action';
|
||||
private static readonly EXPAND_ICON = 'minimize-panel-action';
|
||||
|
||||
constructor(
|
||||
private _uri: string,
|
||||
private _widgetUuid: string,
|
||||
private collpasedState: boolean,
|
||||
@IAngularEventingService private _angularEventService: IAngularEventingService
|
||||
) {
|
||||
super(
|
||||
CollapseWidgetAction.ID,
|
||||
collpasedState ? CollapseWidgetAction.EXPAND_LABEL : CollapseWidgetAction.COLLPASE_LABEL,
|
||||
collpasedState ? CollapseWidgetAction.EXPAND_ICON : CollapseWidgetAction.COLLAPSE_ICON
|
||||
);
|
||||
}
|
||||
|
||||
run(): TPromise<boolean> {
|
||||
this._toggleState();
|
||||
this._angularEventService.sendAngularEvent(this._uri, AngularEventType.COLLAPSE_WIDGET, this._widgetUuid);
|
||||
return TPromise.as(true);
|
||||
}
|
||||
|
||||
private _toggleState(): void {
|
||||
this.collpasedState = !this.collpasedState;
|
||||
this._setClass(this.collpasedState ? CollapseWidgetAction.EXPAND_ICON : CollapseWidgetAction.COLLAPSE_ICON);
|
||||
this._setLabel(this.collpasedState ? CollapseWidgetAction.EXPAND_LABEL : CollapseWidgetAction.COLLPASE_LABEL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,7 +89,6 @@ export abstract class DashboardPage extends Disposable implements OnDestroy {
|
||||
|
||||
constructor(
|
||||
@Inject(forwardRef(() => DashboardServiceInterface)) protected dashboardService: DashboardServiceInterface,
|
||||
@Inject(BOOTSTRAP_SERVICE_ID) protected bootstrapService: IBootstrapService,
|
||||
@Inject(forwardRef(() => ElementRef)) protected _el: ElementRef,
|
||||
@Inject(forwardRef(() => ChangeDetectorRef)) protected _cd: ChangeDetectorRef
|
||||
) {
|
||||
@@ -252,12 +251,14 @@ export abstract class DashboardPage extends Disposable implements OnDestroy {
|
||||
}
|
||||
|
||||
private getProperties(): Array<WidgetConfig> {
|
||||
let properties = this.dashboardService.getSettings<IPropertiesConfig[]>([this.context, 'properties'].join('.'));
|
||||
let properties = this.dashboardService.getSettings<IPropertiesConfig[] | string | boolean>([this.context, 'properties'].join('.'));
|
||||
this._propertiesConfigLocation = 'default';
|
||||
if (types.isUndefinedOrNull(properties)) {
|
||||
return [this.propertiesWidget];
|
||||
} else if (types.isBoolean(properties)) {
|
||||
return properties ? [this.propertiesWidget] : [];
|
||||
} else if (types.isString(properties) && properties === 'collapsed') {
|
||||
return [this.propertiesWidget];
|
||||
} else if (types.isArray(properties)) {
|
||||
return properties.map((item) => {
|
||||
let retVal = Object.assign({}, this.propertiesWidget);
|
||||
@@ -302,6 +303,6 @@ export abstract class DashboardPage extends Disposable implements OnDestroy {
|
||||
let index = this.tabs.findIndex(i => i.id === tab.identifier);
|
||||
this.tabs.splice(index, 1);
|
||||
this._cd.detectChanges();
|
||||
this.bootstrapService.angularEventingService.sendAngularEvent(this.dashboardService.getUnderlyingUri(), AngularEventType.CLOSE_TAB, { id: tab.identifier });
|
||||
this.dashboardService.angularEventingService.sendAngularEvent(this.dashboardService.getUnderlyingUri(), AngularEventType.CLOSE_TAB, { id: tab.identifier });
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user