Cleaning up code from PR feedback

This commit is contained in:
Jared Tabor 2016-04-08 14:55:46 -07:00
parent 72ae8f46c9
commit de56747d1c
7 changed files with 30 additions and 93 deletions

View File

@ -36,7 +36,6 @@ export default
for (i = 0; i < $scope.notification_type_options.length; i++) {
if ($scope.notification_type_options[i].value === '') {
$scope.notification_type_options[i].value="manual";
// $scope.scm_type = $scope.scm_type_options[i];
break;
}
}
@ -79,7 +78,6 @@ export default
// Save
$scope.formSave = function () {
var params,
// config,
v = $scope.notification_type.value;
generator.clearApiErrors();

View File

@ -39,7 +39,6 @@ export default
for (i = 0; i < $scope.notification_type_options.length; i++) {
if ($scope.notification_type_options[i].value === '') {
$scope.notification_type_options[i].value="manual";
// $scope.scm_type = $scope.scm_type_options[i];
break;
}
}
@ -80,14 +79,6 @@ export default
}
}
// if ($scope.notification_type.value !== 'manual') {
// $scope.pathRequired = false;
// $scope.scmRequired = true;
// } else {
// $scope.pathRequired = true;
// $scope.scmRequired = false;
// }
master.notification_type = $scope.notification_type;
CreateSelect2({
element: '#notifier_notification_type',
@ -135,7 +126,6 @@ export default
$scope.formSave = function(){
var params,
// config,
v = $scope.notification_type.value;
generator.clearApiErrors();

View File

@ -102,7 +102,7 @@ export default
$compile(elem)(scope);
elem.on('shown.bs.popover', function() {
$('.popover').each(function() {
// $compile($(this))(scope); //make nested directives work!
$compile($(this))(scope); //make nested directives work!
});
$('.popover-content, .popover-title').click(function() {
elem.popover('hide');
@ -135,8 +135,7 @@ export default
recent_notifications.forEach(function(row) {
html += "<tr>\n";
html += "<td><a href=\"#/jobs/" + row.id + "\" " + "aw-tool-tip=\"" + row.status.charAt(0).toUpperCase() + row.status.slice(1) +
". Click for details\" aw-tip-placement=\"top\"><i class=\"fa icon-job-" + row.status + "\"></i></a></td>\n";
html += "<td><i class=\"fa icon-job-" + row.status + "\"></i></td>\n";
html += "<td>" + ($filter('longDate')(row.created)).replace(/ /,'<br />') + "</td>\n";
html += "</tr>\n";
});
@ -150,9 +149,6 @@ export default
}
};
scope.testNotification = function(){
var name = this.notifier.name;
Rest.setUrl(defaultUrl + this.notifier.id +'/test/');
@ -182,7 +178,6 @@ export default
};
scope.deleteNotification = function(id, name){
var action = function () {
$('#prompt-modal').modal('hide');
Wait('start');
@ -197,7 +192,6 @@ export default
msg: 'Call to ' + url + ' failed. DELETE returned status: ' + status });
});
};
var bodyHtml = '<div class="Prompt-bodyQuery">Are you sure you want to delete the inventory below?</div><div class="Prompt-bodyTarget">' + name + '</div>';
Prompt({
hdr: 'Delete',
@ -206,7 +200,5 @@ export default
actionText: 'DELETE'
});
};
}
];

View File

@ -116,7 +116,6 @@ export default function() {
variable: "password_required" ,
init: "false"
},
// ngRequired:"notification_type.value == 'email' || notification_type.value == 'irc'",
ngShow: "notification_type.value == 'email' || notification_type.value == 'irc' ",
subForm: 'typeSubForm'
},
@ -164,7 +163,6 @@ export default function() {
variable: "token_required",
init: "false"
},
// ngRequired:"notification_type.value == 'slack' || notification_type.value == 'pagerduty' || notification_type.value == 'hipchat'",
ngShow: "notification_type.value == 'slack' || notification_type.value == 'pagerduty' || notification_type.value == 'hipchat'",
subForm: 'typeSubForm'
},

View File

@ -4,8 +4,6 @@
* All Rights Reserved
*************************************************/
export default function(){
return {
name: 'notifications' ,
@ -24,13 +22,12 @@ export default function(){
notification_type: {
label: 'Type',
searchType: 'select',
searchOptions: [], // will be set by Options call to projects resource
searchOptions: [],
excludeModal: true,
columnClass: 'col-md-4 hidden-sm hidden-xs'
},
notifiers_success: {
label: 'Successful',
// columnClass: 'List-staticColumn--toggle',
flag: 'notifiers_success',
type: "toggle",
ngClick: "toggleNotification($event, notification.id, \"notifiers_success\")",

View File

@ -23,68 +23,33 @@ export default ['Wait', 'GetBasePath', 'ProcessErrors', 'Rest',
notifier_id = params.notifier.id,
callback = params.callback,
column = params.column, // notifiers_success/notifiers_error
url = params.url;
url = params.url+ id+ "/"+ column + '/';
url = url + id+ "/"+ column + '/';
if(!notifier[column]){
params = {
id: notifier_id
};
}
else {
params = {
id: notifier_id,
disassociate: 1
};
}
Rest.setUrl(url);
Rest.post(params)
.success( function(data) {
if (callback) {
scope.$emit(callback, data.id);
notifier[column] = !notifier[column];
}
else {
Wait('stop');
}
})
.error( function(data, status) {
ProcessErrors(scope, data, status, null, { hdr: 'Error!',
msg: 'Failed to update notification ' + data.id + ' PUT returned: ' + status });
});
// // Perform the update
// if (scope.removeScheduleFound) {
// scope.removeScheduleFound();
// }
// scope.removeScheduleFound = scope.$on('ScheduleFound', function(e, data) {
// data.id = (data.enabled) ? false : true;
// Rest.put(data)
// .success( function() {
// if (callback) {
// scope.$emit(callback, id);
// }
// else {
// Wait('stop');
// }
// })
// .error( function(data, status) {
// ProcessErrors(scope, data, status, null, { hdr: 'Error!',
// msg: 'Failed to update schedule ' + id + ' PUT returned: ' + status });
// });
// });
//
// Wait('start');
//
// // Get the schedule
// Rest.setUrl(url);
// Rest.get()
// .success(function(data) {
// scope.$emit('ScheduleFound', data);
// })
// .error(function(data,status){
// ProcessErrors(scope, data, status, null, { hdr: 'Error!',
// msg: 'Failed to retrieve schedule ' + id + ' GET returned: ' + status });
// });
if(!notifier[column]){
params = {
id: notifier_id
};
}
else {
params = {
id: notifier_id,
disassociate: 1
};
}
Rest.setUrl(url);
Rest.post(params)
.success( function(data) {
if (callback) {
scope.$emit(callback, data.id);
notifier[column] = !notifier[column];
}
else {
Wait('stop');
}
})
.error( function(data, status) {
ProcessErrors(scope, data, status, null, { hdr: 'Error!',
msg: 'Failed to update notification ' + data.id + ' PUT returned: ' + status });
});
};
}];

View File

@ -1227,9 +1227,6 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
} else {
html += "<span class=\"Form-inputLabel\">" + field.label + "</span>";
}
// html += '<span class=\"Form-inputLabel\">' + field.label + "</span>";
// html += (field.labelBind) ? "ng-bind=\"" + field.labelBind + "\" " : "";
html += (field.awPopOver) ? this.attr(field, 'awPopOver', fld) : "";
html += "</label>\n";