Sha256: eec83a4392d923e40bd0b48fcf81ae34ff7f5dac09a956792014abb60fcfdbe1

Contents?: true

Size: 1.93 KB

Versions: 36

Compression:

Stored size: 1.93 KB

Contents

var AlertsModel = function() {
    var self = {};

    // Protected variables
    self._application = undefined;
    self._instance = undefined;
    self._component = undefined;
    self._emails = undefined;

    // Getter and setter
    self.__defineGetter__("application", function() {
        return self._application;
    });
    self.__defineSetter__("application", function(application) {
        self._application = application;
        notificationCenter.dispatch(Notifications.alerts.ALERT_CHANGE);
    });

    self.__defineGetter__("instance", function() {
        return self._instance;
    });
    self.__defineSetter__("instance", function(instance) {
        self._instance = instance;
        notificationCenter.dispatch(Notifications.alerts.ALERT_CHANGE);
    });

    self.__defineGetter__("component", function() {
        return self._component;
    });
    self.__defineSetter__("component", function(component) {
        self._component = component;
        notificationCenter.dispatch(Notifications.alerts.ALERT_CHANGE);
    });

    self.__defineGetter__("emails", function() {
        return self._emails;
    });
    self.__defineSetter__("emails", function(emails) {
        self._emails = emails;
        notificationCenter.dispatch(Notifications.alerts.EMAILS_CHANGE);
    });

    // Destructor
    self.deinit = function() {
        // Place here the code for dealloc eventual objects
    };

    self.fetchData = function() {

        var request = {
            application: self.application
        };

        if(self.instance != undefined) {
            request.instance = self.instance;
        }

        if(self.component != undefined) {
            request.component = self.component;
        }

        nutella.net.request("monitoring/alert", request, function(data) {
            self.emails = data.emails;
        });
    };

    // Constructor
    self.init = function() {
    }();

    return self;
};

var alertsModel = AlertsModel();

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
nutella_framework-0.6.4 framework_components/monitoring-interface/js/model/alerts-model.js
nutella_framework-0.6.3 framework_components/monitoring-interface/js/model/alerts-model.js
nutella_framework-0.6.2 framework_components/monitoring-interface/js/model/alerts-model.js
nutella_framework-0.6.1 framework_components/monitoring-interface/js/model/alerts-model.js
nutella_framework-0.6.0 framework_components/monitoring-interface/js/model/alerts-model.js
nutella_framework-0.5.1 framework_components/monitoring-interface/js/model/alerts-model.js
nutella_framework-0.5.0 framework_components/monitoring-interface/js/model/alerts-model.js
nutella_framework-0.4.32 framework_components/monitoring-interface/js/model/alerts-model.js
nutella_framework-0.4.31 framework_components/monitoring-interface/js/model/alerts-model.js
nutella_framework-0.4.30 framework_components/monitoring-interface/js/model/alerts-model.js
nutella_framework-0.4.29 framework_components/monitoring-interface/js/model/alerts-model.js
nutella_framework-0.4.28 framework_components/monitoring-interface/js/model/alerts-model.js
nutella_framework-0.4.27 framework_components/monitoring-interface/js/model/alerts-model.js
nutella_framework-0.4.26 framework_components/monitoring-interface/js/model/alerts-model.js
nutella_framework-0.4.25 framework_components/monitoring-interface/js/model/alerts-model.js
nutella_framework-0.4.24 framework_components/monitoring-interface/js/model/alerts-model.js