mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Add loading spinner for insight widgets while they're in a loading state (#4136)
- This was very confusing without status indicator, is it complete or in progress? Please let me know if you see issues with this e.g. was there a reason we didn't do this up to now? Initial state:  On loading / error: 
This commit is contained in:
@@ -59,12 +59,13 @@ import { Checkbox } from 'sql/base/browser/ui/checkbox/checkbox.component';
|
|||||||
import { SelectBox } from 'sql/base/browser/ui/selectBox/selectBox.component';
|
import { SelectBox } from 'sql/base/browser/ui/selectBox/selectBox.component';
|
||||||
import { EditableDropDown } from 'sql/base/browser/ui/editableDropdown/editableDropdown.component';
|
import { EditableDropDown } from 'sql/base/browser/ui/editableDropdown/editableDropdown.component';
|
||||||
import { InputBox } from 'sql/base/browser/ui/inputBox/inputBox.component';
|
import { InputBox } from 'sql/base/browser/ui/inputBox/inputBox.component';
|
||||||
|
import LoadingSpinner from 'sql/parts/modelComponents/loadingSpinner.component';
|
||||||
|
|
||||||
let baseComponents = [DashboardHomeContainer, DashboardComponent, DashboardWidgetWrapper, DashboardWebviewContainer,
|
let baseComponents = [DashboardHomeContainer, DashboardComponent, DashboardWidgetWrapper, DashboardWebviewContainer,
|
||||||
DashboardWidgetContainer, DashboardGridContainer, DashboardErrorContainer, DashboardNavSection, ModelViewContent, WebviewContent, WidgetContent,
|
DashboardWidgetContainer, DashboardGridContainer, DashboardErrorContainer, DashboardNavSection, ModelViewContent, WebviewContent, WidgetContent,
|
||||||
ComponentHostDirective, BreadcrumbComponent, ControlHostContent, DashboardControlHostContainer,
|
ComponentHostDirective, BreadcrumbComponent, ControlHostContent, DashboardControlHostContainer,
|
||||||
JobsViewComponent, AgentViewComponent, JobHistoryComponent, JobStepsViewComponent, AlertsViewComponent, ProxiesViewComponent, OperatorsViewComponent,
|
JobsViewComponent, AgentViewComponent, JobHistoryComponent, JobStepsViewComponent, AlertsViewComponent, ProxiesViewComponent, OperatorsViewComponent,
|
||||||
DashboardModelViewContainer, ModelComponentWrapper, Checkbox, EditableDropDown, SelectBox, InputBox,];
|
DashboardModelViewContainer, ModelComponentWrapper, Checkbox, EditableDropDown, SelectBox, InputBox, LoadingSpinner ];
|
||||||
|
|
||||||
/* Panel */
|
/* Panel */
|
||||||
import { PanelModule } from 'sql/base/browser/ui/panel/panel.module';
|
import { PanelModule } from 'sql/base/browser/ui/panel/panel.module';
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ interface IStorageResult {
|
|||||||
<div *ngIf="lastUpdated" style="font-style: italic; font-size: 80%; margin-left: 5px">{{lastUpdated}}</div>
|
<div *ngIf="lastUpdated" style="font-style: italic; font-size: 80%; margin-left: 5px">{{lastUpdated}}</div>
|
||||||
<div style="margin: 10px; width: calc(100% - 20px); height: calc(100% - 20px)">
|
<div style="margin: 10px; width: calc(100% - 20px); height: calc(100% - 20px)">
|
||||||
<ng-template component-host></ng-template>
|
<ng-template component-host></ng-template>
|
||||||
|
<loading-spinner [loading]="_loading"></loading-spinner>
|
||||||
</div>`,
|
</div>`,
|
||||||
styles: [':host { width: 100%; height: 100% }']
|
styles: [':host { width: 100%; height: 100% }']
|
||||||
})
|
})
|
||||||
@@ -58,6 +59,7 @@ export class InsightsWidget extends DashboardWidget implements IDashboardWidget,
|
|||||||
|
|
||||||
private _typeKey: string;
|
private _typeKey: string;
|
||||||
private _init: boolean = false;
|
private _init: boolean = false;
|
||||||
|
private _loading: boolean = true;
|
||||||
private _intervalTimer: IntervalTimer;
|
private _intervalTimer: IntervalTimer;
|
||||||
|
|
||||||
public error: string;
|
public error: string;
|
||||||
@@ -86,6 +88,7 @@ export class InsightsWidget extends DashboardWidget implements IDashboardWidget,
|
|||||||
let cancelablePromise = createCancelablePromise(() => {
|
let cancelablePromise = createCancelablePromise(() => {
|
||||||
return promise.then(
|
return promise.then(
|
||||||
result => {
|
result => {
|
||||||
|
this._loading = false;
|
||||||
if (this._init) {
|
if (this._init) {
|
||||||
this._updateChild(result);
|
this._updateChild(result);
|
||||||
this.setupInterval();
|
this.setupInterval();
|
||||||
@@ -94,6 +97,7 @@ export class InsightsWidget extends DashboardWidget implements IDashboardWidget,
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
error => {
|
error => {
|
||||||
|
this._loading = false;
|
||||||
if (isPromiseCanceledError(error)) {
|
if (isPromiseCanceledError(error)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -117,10 +121,12 @@ export class InsightsWidget extends DashboardWidget implements IDashboardWidget,
|
|||||||
if (this.queryObv) {
|
if (this.queryObv) {
|
||||||
this._register(toDisposableSubscription(this.queryObv.subscribe(
|
this._register(toDisposableSubscription(this.queryObv.subscribe(
|
||||||
result => {
|
result => {
|
||||||
|
this._loading = false;
|
||||||
this._updateChild(result);
|
this._updateChild(result);
|
||||||
this.setupInterval();
|
this.setupInterval();
|
||||||
},
|
},
|
||||||
error => {
|
error => {
|
||||||
|
this._loading = false;
|
||||||
this.showError(error);
|
this.showError(error);
|
||||||
}
|
}
|
||||||
)));
|
)));
|
||||||
|
|||||||
Reference in New Issue
Block a user