function Graphite()

in grafana/annotations/graphite.js [25:65]


function Graphite(opts) {
    opts = opts || {};
    var self = this;

    if (!opts.name) {
        throw errors.UnfulfilledRequirement(
            "{component} missing requirement: {unfulfilledArg}",
            {
                component: 'grafana.annotations.Graphite',
                unfulfilledArg: 'name'
            }
        );
    }

    if (!opts.target) {
        throw errors.UnfulfilledRequirement(
            "{component} missing requirement: {unfulfilledArg}",
            {
                component: 'grafana.annotations.Graphite',
                unfulfilledArg: 'target'
            }
        );
    }

    var defaults = {
        name: 'no name',
        datasource: 'graphite',
        showLine: true,
        iconColor: 'rgb(255, 234, 0)',
        lineColor: 'rgba(165, 161, 70, 0.59)',
        iconSize: 10,
        enable: true,
        target: ''
    };
    self.state = defaults;

    // Overwrite defaults with custom values
    Object.keys(opts).forEach(function eachOpt(opt) {
        self.state[opt] = opts[opt];
    });
}