in src/annotations/graphite.ts [26:63]
constructor(opts: Partial<GrafanaGraphiteAnnotation> = {}) {
if (!opts.name) {
throw errors.UnfulfilledRequirement.create(
'{component} missing requirement: {unfulfilledArg}',
{
component: 'grafana.annotations.Graphite',
unfulfilledArg: 'name',
}
);
}
if (!opts.target) {
throw errors.UnfulfilledRequirement.create(
'{component} missing requirement: {unfulfilledArg}',
{
component: 'grafana.annotations.Graphite',
unfulfilledArg: 'target',
}
);
}
const defaults: GrafanaGraphiteAnnotation = {
name: 'no name',
datasource: 'graphite',
showLine: true,
iconColor: 'rgb(255, 234, 0)',
lineColor: 'rgba(165, 161, 70, 0.59)',
iconSize: 10,
enable: true,
target: '',
};
this.state = defaults;
// Overwrite defaults with custom values
Object.keys(opts).forEach((opt) => {
this.state[opt] = opts[opt];
});
}