mirror of
https://github.com/ansible/awx.git
synced 2026-03-07 19:51:08 -03:30
Cleaning up code from PR feedback
This commit is contained in:
@@ -36,7 +36,6 @@ export default
|
|||||||
for (i = 0; i < $scope.notification_type_options.length; i++) {
|
for (i = 0; i < $scope.notification_type_options.length; i++) {
|
||||||
if ($scope.notification_type_options[i].value === '') {
|
if ($scope.notification_type_options[i].value === '') {
|
||||||
$scope.notification_type_options[i].value="manual";
|
$scope.notification_type_options[i].value="manual";
|
||||||
// $scope.scm_type = $scope.scm_type_options[i];
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -79,7 +78,6 @@ export default
|
|||||||
// Save
|
// Save
|
||||||
$scope.formSave = function () {
|
$scope.formSave = function () {
|
||||||
var params,
|
var params,
|
||||||
// config,
|
|
||||||
v = $scope.notification_type.value;
|
v = $scope.notification_type.value;
|
||||||
|
|
||||||
generator.clearApiErrors();
|
generator.clearApiErrors();
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ export default
|
|||||||
for (i = 0; i < $scope.notification_type_options.length; i++) {
|
for (i = 0; i < $scope.notification_type_options.length; i++) {
|
||||||
if ($scope.notification_type_options[i].value === '') {
|
if ($scope.notification_type_options[i].value === '') {
|
||||||
$scope.notification_type_options[i].value="manual";
|
$scope.notification_type_options[i].value="manual";
|
||||||
// $scope.scm_type = $scope.scm_type_options[i];
|
|
||||||
break;
|
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;
|
master.notification_type = $scope.notification_type;
|
||||||
CreateSelect2({
|
CreateSelect2({
|
||||||
element: '#notifier_notification_type',
|
element: '#notifier_notification_type',
|
||||||
@@ -135,7 +126,6 @@ export default
|
|||||||
|
|
||||||
$scope.formSave = function(){
|
$scope.formSave = function(){
|
||||||
var params,
|
var params,
|
||||||
// config,
|
|
||||||
v = $scope.notification_type.value;
|
v = $scope.notification_type.value;
|
||||||
|
|
||||||
generator.clearApiErrors();
|
generator.clearApiErrors();
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ export default
|
|||||||
$compile(elem)(scope);
|
$compile(elem)(scope);
|
||||||
elem.on('shown.bs.popover', function() {
|
elem.on('shown.bs.popover', function() {
|
||||||
$('.popover').each(function() {
|
$('.popover').each(function() {
|
||||||
// $compile($(this))(scope); //make nested directives work!
|
$compile($(this))(scope); //make nested directives work!
|
||||||
});
|
});
|
||||||
$('.popover-content, .popover-title').click(function() {
|
$('.popover-content, .popover-title').click(function() {
|
||||||
elem.popover('hide');
|
elem.popover('hide');
|
||||||
@@ -135,8 +135,7 @@ export default
|
|||||||
|
|
||||||
recent_notifications.forEach(function(row) {
|
recent_notifications.forEach(function(row) {
|
||||||
html += "<tr>\n";
|
html += "<tr>\n";
|
||||||
html += "<td><a href=\"#/jobs/" + row.id + "\" " + "aw-tool-tip=\"" + row.status.charAt(0).toUpperCase() + row.status.slice(1) +
|
html += "<td><i class=\"fa icon-job-" + row.status + "\"></i></td>\n";
|
||||||
". Click for details\" aw-tip-placement=\"top\"><i class=\"fa icon-job-" + row.status + "\"></i></a></td>\n";
|
|
||||||
html += "<td>" + ($filter('longDate')(row.created)).replace(/ /,'<br />') + "</td>\n";
|
html += "<td>" + ($filter('longDate')(row.created)).replace(/ /,'<br />') + "</td>\n";
|
||||||
html += "</tr>\n";
|
html += "</tr>\n";
|
||||||
});
|
});
|
||||||
@@ -150,9 +149,6 @@ export default
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
scope.testNotification = function(){
|
scope.testNotification = function(){
|
||||||
var name = this.notifier.name;
|
var name = this.notifier.name;
|
||||||
Rest.setUrl(defaultUrl + this.notifier.id +'/test/');
|
Rest.setUrl(defaultUrl + this.notifier.id +'/test/');
|
||||||
@@ -182,7 +178,6 @@ export default
|
|||||||
};
|
};
|
||||||
|
|
||||||
scope.deleteNotification = function(id, name){
|
scope.deleteNotification = function(id, name){
|
||||||
|
|
||||||
var action = function () {
|
var action = function () {
|
||||||
$('#prompt-modal').modal('hide');
|
$('#prompt-modal').modal('hide');
|
||||||
Wait('start');
|
Wait('start');
|
||||||
@@ -197,7 +192,6 @@ export default
|
|||||||
msg: 'Call to ' + url + ' failed. DELETE returned status: ' + status });
|
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>';
|
var bodyHtml = '<div class="Prompt-bodyQuery">Are you sure you want to delete the inventory below?</div><div class="Prompt-bodyTarget">' + name + '</div>';
|
||||||
Prompt({
|
Prompt({
|
||||||
hdr: 'Delete',
|
hdr: 'Delete',
|
||||||
@@ -206,7 +200,5 @@ export default
|
|||||||
actionText: 'DELETE'
|
actionText: 'DELETE'
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -116,7 +116,6 @@ export default function() {
|
|||||||
variable: "password_required" ,
|
variable: "password_required" ,
|
||||||
init: "false"
|
init: "false"
|
||||||
},
|
},
|
||||||
// ngRequired:"notification_type.value == 'email' || notification_type.value == 'irc'",
|
|
||||||
ngShow: "notification_type.value == 'email' || notification_type.value == 'irc' ",
|
ngShow: "notification_type.value == 'email' || notification_type.value == 'irc' ",
|
||||||
subForm: 'typeSubForm'
|
subForm: 'typeSubForm'
|
||||||
},
|
},
|
||||||
@@ -164,7 +163,6 @@ export default function() {
|
|||||||
variable: "token_required",
|
variable: "token_required",
|
||||||
init: "false"
|
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'",
|
ngShow: "notification_type.value == 'slack' || notification_type.value == 'pagerduty' || notification_type.value == 'hipchat'",
|
||||||
subForm: 'typeSubForm'
|
subForm: 'typeSubForm'
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -4,8 +4,6 @@
|
|||||||
* All Rights Reserved
|
* All Rights Reserved
|
||||||
*************************************************/
|
*************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export default function(){
|
export default function(){
|
||||||
return {
|
return {
|
||||||
name: 'notifications' ,
|
name: 'notifications' ,
|
||||||
@@ -24,13 +22,12 @@ export default function(){
|
|||||||
notification_type: {
|
notification_type: {
|
||||||
label: 'Type',
|
label: 'Type',
|
||||||
searchType: 'select',
|
searchType: 'select',
|
||||||
searchOptions: [], // will be set by Options call to projects resource
|
searchOptions: [],
|
||||||
excludeModal: true,
|
excludeModal: true,
|
||||||
columnClass: 'col-md-4 hidden-sm hidden-xs'
|
columnClass: 'col-md-4 hidden-sm hidden-xs'
|
||||||
},
|
},
|
||||||
notifiers_success: {
|
notifiers_success: {
|
||||||
label: 'Successful',
|
label: 'Successful',
|
||||||
// columnClass: 'List-staticColumn--toggle',
|
|
||||||
flag: 'notifiers_success',
|
flag: 'notifiers_success',
|
||||||
type: "toggle",
|
type: "toggle",
|
||||||
ngClick: "toggleNotification($event, notification.id, \"notifiers_success\")",
|
ngClick: "toggleNotification($event, notification.id, \"notifiers_success\")",
|
||||||
|
|||||||
@@ -23,68 +23,33 @@ export default ['Wait', 'GetBasePath', 'ProcessErrors', 'Rest',
|
|||||||
notifier_id = params.notifier.id,
|
notifier_id = params.notifier.id,
|
||||||
callback = params.callback,
|
callback = params.callback,
|
||||||
column = params.column, // notifiers_success/notifiers_error
|
column = params.column, // notifiers_success/notifiers_error
|
||||||
url = params.url;
|
url = params.url+ id+ "/"+ column + '/';
|
||||||
|
|
||||||
|
if(!notifier[column]){
|
||||||
url = url + id+ "/"+ column + '/';
|
params = {
|
||||||
if(!notifier[column]){
|
id: notifier_id
|
||||||
params = {
|
};
|
||||||
id: notifier_id
|
}
|
||||||
};
|
else {
|
||||||
}
|
params = {
|
||||||
else {
|
id: notifier_id,
|
||||||
params = {
|
disassociate: 1
|
||||||
id: notifier_id,
|
};
|
||||||
disassociate: 1
|
}
|
||||||
};
|
Rest.setUrl(url);
|
||||||
}
|
Rest.post(params)
|
||||||
Rest.setUrl(url);
|
.success( function(data) {
|
||||||
Rest.post(params)
|
if (callback) {
|
||||||
.success( function(data) {
|
scope.$emit(callback, data.id);
|
||||||
if (callback) {
|
notifier[column] = !notifier[column];
|
||||||
scope.$emit(callback, data.id);
|
}
|
||||||
notifier[column] = !notifier[column];
|
else {
|
||||||
}
|
Wait('stop');
|
||||||
else {
|
}
|
||||||
Wait('stop');
|
})
|
||||||
}
|
.error( function(data, status) {
|
||||||
})
|
ProcessErrors(scope, data, status, null, { hdr: 'Error!',
|
||||||
.error( function(data, status) {
|
msg: 'Failed to update notification ' + data.id + ' PUT returned: ' + 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 });
|
|
||||||
// });
|
|
||||||
};
|
};
|
||||||
}];
|
}];
|
||||||
|
|||||||
@@ -1227,9 +1227,6 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
|
|||||||
} else {
|
} else {
|
||||||
html += "<span class=\"Form-inputLabel\">" + field.label + "</span>";
|
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 += (field.awPopOver) ? this.attr(field, 'awPopOver', fld) : "";
|
||||||
html += "</label>\n";
|
html += "</label>\n";
|
||||||
|
|||||||
Reference in New Issue
Block a user