Add ability to configure columns in metric and chart blocks
This commit is contained in:
@@ -1,11 +1,14 @@
|
||||
import { PageBlock, PageBlockInput, Registry } from './base'
|
||||
import { Apply, CortezaID, NoID } from '../../../cast'
|
||||
import { Apply,NoID } from '../../../cast'
|
||||
import { Options as PageBlockRecordListOptions } from './record-list'
|
||||
import { cloneDeep, merge } from 'lodash'
|
||||
|
||||
const kind = 'Chart'
|
||||
|
||||
interface DrillDown {
|
||||
enabled: boolean;
|
||||
blockID?: string;
|
||||
blockID: string;
|
||||
recordListOptions: Partial<PageBlockRecordListOptions>;
|
||||
}
|
||||
|
||||
interface Options {
|
||||
@@ -24,7 +27,10 @@ const defaults: Readonly<Options> = Object.freeze({
|
||||
drillDown: {
|
||||
enabled: false,
|
||||
blockID: '',
|
||||
},
|
||||
recordListOptions: {
|
||||
fields: [],
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
export class PageBlockChart extends PageBlock {
|
||||
@@ -47,9 +53,13 @@ export class PageBlockChart extends PageBlock {
|
||||
Apply(this.options, o, Boolean, 'showRefresh')
|
||||
|
||||
if (o.drillDown) {
|
||||
this.options.drillDown = o.drillDown
|
||||
this.options.drillDown = merge({}, defaults.drillDown, o.drillDown)
|
||||
}
|
||||
}
|
||||
|
||||
resetDrillDown(): void {
|
||||
this.options.drillDown = cloneDeep(defaults.drillDown)
|
||||
}
|
||||
}
|
||||
|
||||
Registry.set(kind, PageBlockChart)
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
import { PageBlock, PageBlockInput, Registry } from './base'
|
||||
import { merge } from 'lodash'
|
||||
import { Apply } from '../../../cast'
|
||||
|
||||
import { Options as PageBlockRecordListOptions } from './record-list'
|
||||
const kind = 'Metric'
|
||||
|
||||
type Reporter = (p: ReporterParams) => Promise<any>
|
||||
|
||||
interface DrillDown {
|
||||
enabled: boolean;
|
||||
blockID?: string;
|
||||
blockID: string;
|
||||
recordListOptions: Partial<PageBlockRecordListOptions>;
|
||||
}
|
||||
|
||||
interface ReporterParams {
|
||||
@@ -62,9 +63,13 @@ const defaultMetric: Readonly<Metric> = Object.freeze({
|
||||
color: '#000000',
|
||||
fontSize: undefined,
|
||||
},
|
||||
|
||||
drillDown: {
|
||||
enabled: false,
|
||||
blockID: '',
|
||||
recordListOptions: {
|
||||
fields: [],
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ interface FilterPreset {
|
||||
roles: string[];
|
||||
}
|
||||
|
||||
interface Options {
|
||||
export interface Options {
|
||||
moduleID: string;
|
||||
prefilter: string;
|
||||
presort: string;
|
||||
|
||||
Reference in New Issue
Block a user