control the auto refresh state (#6577)

* control the auto refresh state

* visual indicator when autorefresh is off
This commit is contained in:
Alan Ren
2019-08-16 16:36:03 -07:00
committed by GitHub
parent bae87a0a24
commit 076aa51524
3 changed files with 40 additions and 4 deletions

View File

@@ -25,6 +25,7 @@ export interface IInsightsConfig {
queryFile?: string;
details?: IInsightsConfigDetails;
autoRefreshInterval?: number;
id?: string;
}
export interface IInsightsLabel {
@@ -124,3 +125,14 @@ platform.Registry.add(Extensions.InsightContribution, insightRegistry);
export function registerInsight(id: string, description: string, schema: IJSONSchema, ctor: Type<IInsightsView>): InsightIdentifier {
return insightRegistry.registerInsight(id, description, schema, ctor);
}
const WidgetAutoRefreshState: { [key: string]: boolean } = {};
export function getWidgetAutoRefreshState(widgetId: string, connectionId: string): boolean {
const key = widgetId + connectionId;
return Object.keys(WidgetAutoRefreshState).indexOf(key) === -1 || WidgetAutoRefreshState[key];
}
export function setWidgetAutoRefreshState(widgetId: string, connectionId: string, state: boolean): void {
WidgetAutoRefreshState[widgetId + connectionId] = state;
}