fixing code after code review
This commit is contained in:
Родитель
975433b8b2
Коммит
3d8cebd517
|
@ -7,7 +7,7 @@ import utils from '../utils';
|
||||||
interface IConfigurationsActions {
|
interface IConfigurationsActions {
|
||||||
loadConfiguration(): any;
|
loadConfiguration(): any;
|
||||||
loadDashboard(id: string): any;
|
loadDashboard(id: string): any;
|
||||||
loadDashboardComplete(dashboard: IDashboardConfig): any;
|
loadDashboardComplete(dashboard: IDashboardConfig): { dashboard: IDashboardConfig };
|
||||||
createDashboard(dashboard: IDashboardConfig): any;
|
createDashboard(dashboard: IDashboardConfig): any;
|
||||||
loadTemplate(id: string): any;
|
loadTemplate(id: string): any;
|
||||||
saveConfiguration(dashboard: IDashboardConfig): any;
|
saveConfiguration(dashboard: IDashboardConfig): any;
|
||||||
|
@ -84,7 +84,7 @@ class ConfigurationsActions extends AbstractActions implements IConfigurationsAc
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
loadDashboardComplete(dashboard: IDashboardConfig): any {
|
loadDashboardComplete(dashboard: IDashboardConfig): { dashboard: IDashboardConfig } {
|
||||||
return { dashboard };
|
return { dashboard };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -123,8 +123,9 @@ export default class Scorecard extends GenericComponent<IScorecardProps, any> {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let evt = typeof event !== 'undefined' && event || arguments[2];
|
let eventObject = typeof event !== 'undefined' && event || arguments[2];
|
||||||
evt.preventDefault();
|
eventObject.preventDefault();
|
||||||
|
|
||||||
var { title } = this.props || '' as any;
|
var { title } = this.props || '' as any;
|
||||||
var args = { ...value };
|
var args = { ...value };
|
||||||
this.trigger(value.onClick, args);
|
this.trigger(value.onClick, args);
|
||||||
|
|
|
@ -99,7 +99,7 @@ export default class ApplicationInsightsQuery extends DataSourcePlugin<IQueryPar
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var dashboardId = ConfigurationsStore.getState().dashboard.id;
|
let dashboardId = ConfigurationsStore.getState().dashboard.id;
|
||||||
|
|
||||||
return (dispatch) => {
|
return (dispatch) => {
|
||||||
request(
|
request(
|
||||||
|
@ -132,7 +132,7 @@ export default class ApplicationInsightsQuery extends DataSourcePlugin<IQueryPar
|
||||||
}
|
}
|
||||||
|
|
||||||
// Map tables to appropriate results
|
// Map tables to appropriate results
|
||||||
var resultTables = tables.filter((aTable, idx) => {
|
let resultTables = tables.filter((aTable, idx) => {
|
||||||
return idx < resultStatus.length &&
|
return idx < resultStatus.length &&
|
||||||
(resultStatus[idx].Kind === 'QueryResult' || resultStatus[idx].Kind === 'PrimaryResults');
|
(resultStatus[idx].Kind === 'QueryResult' || resultStatus[idx].Kind === 'PrimaryResults');
|
||||||
});
|
});
|
||||||
|
@ -216,7 +216,7 @@ export default class ApplicationInsightsQuery extends DataSourcePlugin<IQueryPar
|
||||||
mappings = mappings || {};
|
mappings = mappings || {};
|
||||||
|
|
||||||
return table.Rows.map((rowValues, rowIdx) => {
|
return table.Rows.map((rowValues, rowIdx) => {
|
||||||
var row = {};
|
let row = {};
|
||||||
|
|
||||||
table.Columns.forEach((col, idx) => {
|
table.Columns.forEach((col, idx) => {
|
||||||
row[col.ColumnName] = rowValues[idx];
|
row[col.ColumnName] = rowValues[idx];
|
||||||
|
|
|
@ -33,8 +33,8 @@ export default class CosmosDBQuery extends DataSourcePlugin<IQueryParams> {
|
||||||
*/
|
*/
|
||||||
dependenciesUpdated(dependencies: any) {
|
dependenciesUpdated(dependencies: any) {
|
||||||
let emptyDependency = false;
|
let emptyDependency = false;
|
||||||
Object.keys(this._props.dependencies).forEach(k => {
|
Object.keys(this._props.dependencies).forEach(dependencyKey => {
|
||||||
if (typeof dependencies[k] === 'undefined') { emptyDependency = true; }
|
if (typeof dependencies[dependencyKey] === 'undefined') { emptyDependency = true; }
|
||||||
});
|
});
|
||||||
|
|
||||||
// If one of the dependencies is not supplied, do not run the query
|
// If one of the dependencies is not supplied, do not run the query
|
||||||
|
|
|
@ -52,15 +52,15 @@ export function scorecard (
|
||||||
|
|
||||||
let checkValue = (values && values[0] && values[0][countField]) || 0;
|
let checkValue = (values && values[0] && values[0][countField]) || 0;
|
||||||
|
|
||||||
let createValue = (value: any, heading: string, color: string, icon: string, sv?: any, sh?: string) => {
|
let createValue = (value: any, heading: string, color: string, icon: string, subValue?: any, subHeading?: string) => {
|
||||||
let item = {};
|
let item = {};
|
||||||
const prefix = getPrefix(format);
|
const prefix = getPrefix(format);
|
||||||
item[prefix + 'value'] = isFinite(value) ? utils.kmNumber(value, postfix) : '-';
|
item[prefix + 'value'] = isFinite(value) ? utils.kmNumber(value, postfix) : '-';
|
||||||
item[prefix + 'heading'] = heading;
|
item[prefix + 'heading'] = heading;
|
||||||
item[prefix + 'color'] = color;
|
item[prefix + 'color'] = color;
|
||||||
item[prefix + 'icon'] = icon;
|
item[prefix + 'icon'] = icon;
|
||||||
item[prefix + 'subvalue'] = isFinite(sv) ? sv : '';
|
item[prefix + 'subvalue'] = isFinite(subValue) ? subValue : '';
|
||||||
item[prefix + 'subheading'] = sh || '';
|
item[prefix + 'subheading'] = subHeading || '';
|
||||||
return item;
|
return item;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче