Sha256: eccb49392f3f75051a7eed1e4d2cc883a63bca51d0d1333b7aaa4fce52090e9d

Contents?: true

Size: 1.9 KB

Versions: 36

Compression:

Stored size: 1.9 KB

Contents

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

    // Public variables
    self.data = undefined;
    self.viewControllerApplicationSelected = undefined;
    self.viewControllerInstanceSelected = undefined;

    self.getApplicationData = function(name) {
        var appData = self.data.applications.filter(function(d) {
            return d.name == name;
        });

        if(appData.length == 0) {
            return undefined;
        }

        return appData[0];
    };

    self.getInstanceData = function(appName, instanceName) {
        var appData = self.getApplicationData(appName);

        if(appData == undefined)
            return undefined;

        var instanceData = appData.instances.filter(function(instance) {
            return instance.name == instanceName;
        });

        if(instanceData.length == 0) {
            return undefined;
        }

        return instanceData[0];
    };

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

    self.fetchData = function(url) {

        /*
         d3.json(url, function(error, data) {
         if (error)
         return console.warn(error);

         self.data = data;

         notificationCenter.dispatch(Notifications.data.APPLICATION_DATA_CHANGE);
         });
        */

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

            notificationCenter.dispatch(Notifications.data.APPLICATION_DATA_CHANGE);
        });

        setInterval(function(){
            nutella.net.request("monitoring/application", {}, function(payload) {
                self.data = payload;

                notificationCenter.dispatch(Notifications.data.APPLICATION_DATA_CHANGE);
            });
        }, 2000);
    };

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

    return self;
};

var applicationModel = ApplicationsModel();

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
nutella_framework-0.7.3 framework_components/monitoring-interface/js/model/applications-model.js
nutella_framework-0.7.2 framework_components/monitoring-interface/js/model/applications-model.js
nutella_framework-0.7.1 framework_components/monitoring-interface/js/model/applications-model.js
nutella_framework-0.7.0 framework_components/monitoring-interface/js/model/applications-model.js
nutella_framework-0.6.21 framework_components/monitoring-interface/js/model/applications-model.js
nutella_framework-0.6.20 framework_components/monitoring-interface/js/model/applications-model.js
nutella_framework-0.6.19 framework_components/monitoring-interface/js/model/applications-model.js
nutella_framework-0.6.18 framework_components/monitoring-interface/js/model/applications-model.js
nutella_framework-0.6.17 framework_components/monitoring-interface/js/model/applications-model.js
nutella_framework-0.6.16 framework_components/monitoring-interface/js/model/applications-model.js
nutella_framework-0.6.15 framework_components/monitoring-interface/js/model/applications-model.js
nutella_framework-0.6.13 framework_components/monitoring-interface/js/model/applications-model.js
nutella_framework-0.6.12 framework_components/monitoring-interface/js/model/applications-model.js
nutella_framework-0.6.11 framework_components/monitoring-interface/js/model/applications-model.js
nutella_framework-0.6.10 framework_components/monitoring-interface/js/model/applications-model.js
nutella_framework-0.6.9 framework_components/monitoring-interface/js/model/applications-model.js
nutella_framework-0.6.8 framework_components/monitoring-interface/js/model/applications-model.js
nutella_framework-0.6.7 framework_components/monitoring-interface/js/model/applications-model.js
nutella_framework-0.6.6 framework_components/monitoring-interface/js/model/applications-model.js
nutella_framework-0.6.5 framework_components/monitoring-interface/js/model/applications-model.js