From 7bd1dfdf0f75593e8cfda9546fc4c1f827c22498 Mon Sep 17 00:00:00 2001 From: Charles Gagnon Date: Wed, 22 Apr 2020 17:36:21 -0700 Subject: [PATCH] Move loading component out of common properties component (#10134) --- src/sql/azdata.proposed.d.ts | 4 -- .../propertiesContainer.component.html | 2 - .../propertiesContainer.component.ts | 43 ++++++------------- .../propertiesContainer.component.ts | 10 ----- .../properties/propertiesWidget.component.ts | 13 +++--- 5 files changed, 19 insertions(+), 53 deletions(-) diff --git a/src/sql/azdata.proposed.d.ts b/src/sql/azdata.proposed.d.ts index 2f6443ad99..4e0e1d6b81 100644 --- a/src/sql/azdata.proposed.d.ts +++ b/src/sql/azdata.proposed.d.ts @@ -335,10 +335,6 @@ declare module 'azdata' { * The properties to display */ propertyItems?: PropertiesContainerItem[]; - /** - * Whether the component is currently loading - */ - loading?: boolean; } export namespace nb { diff --git a/src/sql/base/browser/ui/propertiesContainer/propertiesContainer.component.html b/src/sql/base/browser/ui/propertiesContainer/propertiesContainer.component.html index 9c7198743a..444dc3f0c2 100644 --- a/src/sql/base/browser/ui/propertiesContainer/propertiesContainer.component.html +++ b/src/sql/base/browser/ui/propertiesContainer/propertiesContainer.component.html @@ -4,8 +4,6 @@ * Licensed under the Source EULA. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ --> -
diff --git a/src/sql/base/browser/ui/propertiesContainer/propertiesContainer.component.ts b/src/sql/base/browser/ui/propertiesContainer/propertiesContainer.component.ts index 91727a90b6..f89241190c 100644 --- a/src/sql/base/browser/ui/propertiesContainer/propertiesContainer.component.ts +++ b/src/sql/base/browser/ui/propertiesContainer/propertiesContainer.component.ts @@ -6,7 +6,6 @@ import 'vs/css!./media/propertiesContainer'; import { Component, Inject, forwardRef, ChangeDetectorRef, OnInit, ElementRef, OnDestroy } from '@angular/core'; import { EventType, addDisposableListener } from 'vs/base/browser/dom'; -import * as nls from 'vs/nls'; import { Disposable } from 'vs/base/common/lifecycle'; enum GridDisplayLayout { @@ -35,11 +34,8 @@ const verticalPropertyHeight = 46; export class PropertiesContainer extends Disposable implements OnInit, OnDestroy { public gridDisplayLayout = GridDisplayLayout.twoColumns; public propertyLayout = PropertyLayoutDirection.row; - public loadingMessage: string = nls.localize('loadingProperties', "Loading properties"); - public loadingCompletedMessage: string = nls.localize('loadingPropertiesCompleted', "Loading properties completed"); public height: number; - private _loading: boolean = true; private _displayProperties: DisplayProperty[] = []; constructor( @@ -63,23 +59,21 @@ export class PropertiesContainer extends Disposable implements OnInit, OnDestroy // 2 columns w/ horizontal alignment : 1366px and above // 2 columns w/ vertical alignment : 1024 - 1365px // 1 column w/ vertical alignment : 1024px or less - if (!this.loading) { - if (window.innerWidth >= 1366) { - this.gridDisplayLayout = GridDisplayLayout.twoColumns; - this.propertyLayout = PropertyLayoutDirection.row; - this.height = Math.ceil(this.displayProperties.length / 2) * horizontalPropertyHeight + collapseHeight; - } else if (window.innerWidth < 1366 && window.innerWidth >= 1024) { - this.gridDisplayLayout = GridDisplayLayout.twoColumns; - this.propertyLayout = PropertyLayoutDirection.column; - this.height = Math.ceil(this.displayProperties.length / 2) * verticalPropertyHeight + collapseHeight; - } else if (window.innerWidth < 1024) { - this.gridDisplayLayout = GridDisplayLayout.oneColumn; - this.propertyLayout = PropertyLayoutDirection.column; - this.height = this.displayProperties.length * verticalPropertyHeight + collapseHeight; - } - - this._changeRef.detectChanges(); + if (window.innerWidth >= 1366) { + this.gridDisplayLayout = GridDisplayLayout.twoColumns; + this.propertyLayout = PropertyLayoutDirection.row; + this.height = Math.ceil(this.displayProperties.length / 2) * horizontalPropertyHeight + collapseHeight; + } else if (window.innerWidth < 1366 && window.innerWidth >= 1024) { + this.gridDisplayLayout = GridDisplayLayout.twoColumns; + this.propertyLayout = PropertyLayoutDirection.column; + this.height = Math.ceil(this.displayProperties.length / 2) * verticalPropertyHeight + collapseHeight; + } else if (window.innerWidth < 1024) { + this.gridDisplayLayout = GridDisplayLayout.oneColumn; + this.propertyLayout = PropertyLayoutDirection.column; + this.height = this.displayProperties.length * verticalPropertyHeight + collapseHeight; } + + this._changeRef.detectChanges(); } public set displayProperties(displayProperties: DisplayProperty[]) { @@ -90,13 +84,4 @@ export class PropertiesContainer extends Disposable implements OnInit, OnDestroy public get displayProperties(): DisplayProperty[] { return this._displayProperties; } - - public set loading(loading: boolean) { - this._loading = loading; - this._changeRef.detectChanges(); - } - - public get loading(): boolean { - return this._loading; - } } diff --git a/src/sql/workbench/browser/modelComponents/propertiesContainer.component.ts b/src/sql/workbench/browser/modelComponents/propertiesContainer.component.ts index 245d2eafda..3589bb07a3 100644 --- a/src/sql/workbench/browser/modelComponents/propertiesContainer.component.ts +++ b/src/sql/workbench/browser/modelComponents/propertiesContainer.component.ts @@ -42,16 +42,6 @@ export default class PropertiesContainerComponent extends ComponentBase implemen public setProperties(properties: { [key: string]: any; }): void { super.setProperties(properties); this._propertiesContainer.displayProperties = this.displayProperties; - this._propertiesContainer.loading = this.loading; - } - - public get loading(): boolean { - return this.getPropertyOrDefault((props) => props.loading, true); - } - - public set loading(newValue: boolean) { - this.setPropertyFromUI((props, value) => props.loading = value, newValue); - this._propertiesContainer.loading = newValue; } public get displayProperties(): DisplayProperty[] { diff --git a/src/sql/workbench/contrib/dashboard/browser/widgets/properties/propertiesWidget.component.ts b/src/sql/workbench/contrib/dashboard/browser/widgets/properties/propertiesWidget.component.ts index 544fb0192b..cf1ae2bcfb 100644 --- a/src/sql/workbench/contrib/dashboard/browser/widgets/properties/propertiesWidget.component.ts +++ b/src/sql/workbench/contrib/dashboard/browser/widgets/properties/propertiesWidget.component.ts @@ -52,10 +52,14 @@ const dashboardRegistry = Registry.as(DashboardExtensions.Da @Component({ selector: 'properties-widget', - template: '' + template: ` + + ` }) export class PropertiesWidgetComponent extends DashboardWidget implements IDashboardWidget, OnInit { @ViewChild(PropertiesContainer) private _propertiesContainer: PropertiesContainer; + public loadingMessage: string = nls.localize('loadingProperties', "Loading properties"); + public loadingCompletedMessage: string = nls.localize('loadingPropertiesCompleted', "Loading properties completed"); private _connection: ConnectionManagementInfo; constructor( @@ -245,13 +249,6 @@ export class PropertiesWidgetComponent extends DashboardWidget implements IDashb return val; } - protected setLoadingStatus(loading: boolean): void { - super.setLoadingStatus(loading); - if (this._inited) { - this._propertiesContainer.loading = loading; - } - } - public get height(): number { return convertSizeToNumber(this._propertiesContainer.height); }