mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-12 19:18:32 -05:00
move code from parts to contrib (#8319)
This commit is contained in:
45
src/sql/workbench/contrib/charts/browser/countInsight.ts
Normal file
45
src/sql/workbench/contrib/charts/browser/countInsight.ts
Normal file
@@ -0,0 +1,45 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import 'vs/css!./media/countInsight';
|
||||
|
||||
import { IInsight, IInsightData } from './interfaces';
|
||||
|
||||
import { $, clearNode } from 'vs/base/browser/dom';
|
||||
import { InsightType } from 'sql/workbench/contrib/charts/common/interfaces';
|
||||
|
||||
export class CountInsight implements IInsight {
|
||||
public options;
|
||||
public static readonly types = [InsightType.Count];
|
||||
public readonly types = CountInsight.types;
|
||||
|
||||
private countImage: HTMLElement;
|
||||
|
||||
constructor(container: HTMLElement, options: any) {
|
||||
this.countImage = $('div');
|
||||
container.appendChild(this.countImage);
|
||||
}
|
||||
|
||||
public layout() { }
|
||||
|
||||
set data(data: IInsightData) {
|
||||
clearNode(this.countImage);
|
||||
|
||||
for (let i = 0; i < data.columns.length; i++) {
|
||||
let container = $('div.count-label-container');
|
||||
let label = $('span.label-container');
|
||||
label.innerText = data.columns[i];
|
||||
let value = $('span.value-container');
|
||||
value.innerText = data.rows[0][i];
|
||||
container.appendChild(label);
|
||||
container.appendChild(value);
|
||||
this.countImage.appendChild(container);
|
||||
}
|
||||
}
|
||||
|
||||
dispose() {
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user