<commit_before>define('app/views/machine_monitoring',
    [
        'app/views/templated',
        'app/models/graph',
        'app/models/datasource'
    ],
    //
    //  Machine Monitoring View
    //
    //  @returns Class
    //
    function (TemplatedView, Graph, Datasource) {

        'use strict';

        return TemplatedView.extend({


            //
            //
            //  Properties
            //
            //


            rules: [],
            graphs: [],
            metrics: [],
            machine: null,
            gettingCommand: null,


            //
            //
            //  Initialization
            //
            //


            load: function () {

            }.on('didInsertElement'),


            unload: function () {
                this._clear();
                this._hideGraphs();
            }.on('willDestroyElement'),



            showMonitoring: function () {
                this._clear();
                this._updateRules();
                this._updateMetrics();
                this._updateGraphs();
                this._showGraphs();
            },


            hideMonitoring: function () {
                this._hideGraphs();
                this._clear();
            },


            //
            //
            //  Methods
            //
            //


            addGraphClicked: function () {
                Mist.metricAddController.open(this.machine);
            },


            //
            //
            //  Actions
            //
            //


            actions: {

                enableMonitoringClicked: function () {

                    // Make sure user is logged in
                    if (!Mist.authenticated)
                        Mist.loginController.open();

                    // Make sure user has purchased a plan
                    else if (!Mist.current_plan)
                        this._showMissingPlanMessage();

                    // Make sure machine has a key
                    else if (!this.machine.probed)
                        this._showManualMonitoringCommand();

                    // Confrim to enable monitoring
                    else
                        this._showEnableMonitoringConfirmation();
                },


                disableMonitoringClicked: function () {
                    var machine = this.machine;
                    Mist.dialogController.open({
                        type: DIALOG_TYPES.YES_NO,
                        head: 'Disable monitoring',
                        body: [
                            {
                                paragraph: 'Are you sure you want to disable' +
                                    'monitoring for this machine?'
                            }
                        ],
                        callback: disableMonitoring
                    });

                    function disableMonitoring (didConfirm) {

                        if (!didConfirm) return;

                        // Removing a bunch of graphs from the user's face
                        // clumpsy. So we scroll to top and present a nice
                        // message while disabling monitoring

                        Mist.smoothScroll(0);

                        // Disable monitoring after a while to enalbe
                        // smoothScroll to scroll to top
                        Ember.run.later(function () {
                            Mist.monitoringController
                                .disableMonitoring(machine,
                                    function (success) {
                                        if (success)
                                            Mist.graphsController.close();
                                    }
                                );<commit_msg>Add missing word to comment<commit_after>define('app/views/machine_monitoring',
    [
        'app/views/templated',
        'app/models/graph',
        'app/models/datasource'
    ],
    //
    //  Machine Monitoring View
    //
    //  @returns Class
    //
    function (TemplatedView, Graph, Datasource) {

        'use strict';

        return TemplatedView.extend({


            //
            //
            //  Properties
            //
            //


            rules: [],
            graphs: [],
            metrics: [],
            machine: null,
            gettingCommand: null,


            //
            //
            //  Initialization
            //
            //


            load: function () {

            }.on('didInsertElement'),


            unload: function () {
                this._clear();
                this._hideGraphs();
            }.on('willDestroyElement'),



            showMonitoring: function () {
                this._clear();
                this._updateRules();
                this._updateMetrics();
                this._updateGraphs();
                this._showGraphs();
            },


            hideMonitoring: function () {
                this._hideGraphs();
                this._clear();
            },


            //
            //
            //  Methods
            //
            //


            addGraphClicked: function () {
                Mist.metricAddController.open(this.machine);
            },


            //
            //
            //  Actions
            //
            //


            actions: {

                enableMonitoringClicked: function () {

                    // Make sure user is logged in
                    if (!Mist.authenticated)
                        Mist.loginController.open();

                    // Make sure user has purchased a plan
                    else if (!Mist.current_plan)
                        this._showMissingPlanMessage();

                    // Make sure machine has a key
                    else if (!this.machine.probed)
                        this._showManualMonitoringCommand();

                    // Confrim to enable monitoring
                    else
                        this._showEnableMonitoringConfirmation();
                },


                disableMonitoringClicked: function () {
                    var machine = this.machine;
                    Mist.dialogController.open({
                        type: DIALOG_TYPES.YES_NO,
                        head: 'Disable monitoring',
                        body: [
                            {
                                paragraph: 'Are you sure you want to disable' +
                                    'monitoring for this machine?'
                            }
                        ],
                        callback: disableMonitoring
                    });

                    function disableMonitoring (didConfirm) {

                        if (!didConfirm) return;

                        // Removing a bunch of graphs from the user's face
                        // feels clumpsy. So we scroll to top and present a
                        // nice message while disabling monitoring

                        Mist.smoothScroll(0);

                        // Disable monitoring after a while to enalbe
                        // smoothScroll to scroll to top
                        Ember.run.later(function () {
                            Mist.monitoringController
                                .disableMonitoring(machine,
                                    function (success) {
                                        if (success)
                                            Mist.graphsController.close();
                                    }
                                );
{'fraction_non_alphanumeric': 0.08215223097112861, 'fraction_numerical': 0.00026246719160104987, 'mean_word_length': 0.7914903620122238, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 14, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7482968', 'n_tokens_mistral': 1680, 'n_tokens_neox': 1493, 'n_words': 335}