_bindHandlers: function()

in aws-ecs-server/src/main/resources/buildServerResources/ecsSettings.js [98:208]


    _bindHandlers: function () {
        var self = this;

        this.$showAddImageDialogButton.on('click', this._showDialogClickHandler.bind(this));
        this.$addImageButton.on('click', this._submitDialogClickHandler.bind(this));
        this.$cancelAddImageButton.on('click', this._cancelDialogClickHandler.bind(this));

        this.$imagesTable.on('click', this.selectors.rmImageLink, function () {
            self.showDeleteImageDialog($j(this));
            return false;
        });
        this.$deleteImageButton.on('click', this._submitDeleteImageDialogClickHandler.bind(this));
        this.$cancelDeleteImageButton.on('click', this._cancelDeleteImageDialogClickHandler.bind(this));

        var editDelegates = this.selectors.imagesTableRow + ' .highlight, ' + this.selectors.editImageLink;
        var that = this;
        this.$imagesTable.on('click', editDelegates, function () {
            if (!that.$addImageButton.prop('disabled')) {
                self.showEditImageDialog($j(this));
            }
            return false;
        });

        this.$launchType.on('change', function (e, value) {
            if(value !== undefined) this.$launchType.val(value);
            this._image['launchType'] = this.$launchType.val();
            this.validateOptions(e.target.getAttribute('data-id'));
            var subnetsTr = $j('.fargate-only');
            if(this.$launchType.val() === 'FARGATE'){
                subnetsTr.each(function(){
                    $j(this).removeClass("advancedSetting");
                    $j(this).removeClass("advancedSettingHighlight");
                    $j(this).removeClass("advanced_hidden");
                })
            } else {
                subnetsTr.each(function(){
                    $j(this).addClass("advancedSetting");
                    if($j("tr[class*='advancedSettingHighlight']")) {
                        $j(this).addClass("advancedSettingHighlight");
                    }
                    if($j("tr[class*='advanced_hidden']")) {
                        $j(this).addClass("advanced_hidden");
                    }
                })
            }
        }.bind(this));

        this.$taskDefinition.on('change', function (e, value) {
            if(value !== undefined) this.$taskDefinition.val(value);
            this._image['taskDefinition'] = this.$taskDefinition.val();
            this.validateOptions(e.target.getAttribute('data-id'));
        }.bind(this));

        this.$agentNamePrefix.on('change', function (e, value) {
            if(value !== undefined) this.$agentNamePrefix.val(value);
            this._image['agentNamePrefix'] = this.$agentNamePrefix.val();
            this.validateOptions(e.target.getAttribute('data-id'));
        }.bind(this));

        this.$cluster.on('change', function (e, value) {
            if(value !== undefined) this.$cluster.val(value);
            this._image['cluster'] = this.$cluster.val();
            this.validateOptions(e.target.getAttribute('data-id'));
        }.bind(this));

        this.$taskGroup.on('change', function (e, value) {
            if(value !== undefined) this.$taskGroup.val(value);
            this._image['taskGroup'] = this.$taskGroup.val();
            this.validateOptions(e.target.getAttribute('data-id'));
        }.bind(this));

        this.$subnets.on('change', function (e, value) {
            if(value !== undefined) this.$subnets.val(value);
            this._image['subnets'] = this.$subnets.val();
            this.validateOptions(e.target.getAttribute('data-id'));
        }.bind(this));

        this.$fargatePlatformVersion.on('change', function (e, value) {
            if(value !== undefined) this.$fargatePlatformVersion.val(value);
            this._image['fargatePlatformVersion'] = this.$fargatePlatformVersion.val();
            this.validateOptions(e.target.getAttribute('data-id'));
        }.bind(this));

        this.$securityGroups.on('change', function (e, value) {
            if(value !== undefined) this.$securityGroups.val(value);
            this._image['securityGroups'] = this.$securityGroups.val();
            this.validateOptions(e.target.getAttribute('data-id'));
        }.bind(this));

        this.$assignPublicIp.click(function() {
            this._image['assignPublicIp'] = this.$assignPublicIp.prop('checked');
        }.bind(this));

        this.$maxInstances.on('change', function (e, value) {
            if(value !== undefined) this.$maxInstances.val(value);
            this._image['maxInstances'] = this.$maxInstances.val();
            this.validateOptions(e.target.getAttribute('data-id'));
        }.bind(this));

        this.$cpuReservationLimit.on('change', function (e, value) {
            if(value !== undefined) this.$cpuReservationLimit.val(value);
            this._image['cpuReservationLimit'] = this.$cpuReservationLimit.val();
            this.validateOptions(e.target.getAttribute('data-id'));
        }.bind(this));

        this.$agentPoolId.on('change', function (e, value) {
            if(value !== undefined) this.$agentPoolId.val(value);
            this._image['agent_pool_id'] = this.$agentPoolId.val();
            this.validateOptions(e.target.getAttribute('data-id'));
        }.bind(this));
    },