mirror of
https://github.com/ansible/awx.git
synced 2026-02-28 08:18:43 -03:30
Merge pull request #2509 from jaredevantabor/notification_templates
Notification templates -- recent notifications popover fix
This commit is contained in:
@@ -109,41 +109,41 @@ export default
|
|||||||
}
|
}
|
||||||
|
|
||||||
scope.showSummary = function(event, id) {
|
scope.showSummary = function(event, id) {
|
||||||
|
setTimeout(function(){
|
||||||
|
if (!Empty(id)) {
|
||||||
|
var recent_notifications,
|
||||||
|
html, title = "Recent Notifications";
|
||||||
|
|
||||||
if (!Empty(id)) {
|
scope.notification_templates.forEach(function(notification_template){
|
||||||
var recent_notifications,
|
if(notification_template.id === id){
|
||||||
html, title = "Recent Notifications";
|
recent_notifications = notification_template.summary_fields.recent_notifications;
|
||||||
|
}
|
||||||
scope.notification_templates.forEach(function(notification_template){
|
|
||||||
if(notification_template.id === id){
|
|
||||||
recent_notifications = notification_template.summary_fields.recent_notifications;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
Wait('stop');
|
|
||||||
if (recent_notifications.length > 0) {
|
|
||||||
html = "<table class=\"table table-condensed flyout\" style=\"width: 100%\">\n";
|
|
||||||
html += "<thead>\n";
|
|
||||||
html += "<tr>";
|
|
||||||
html += "<th>Status</th>";
|
|
||||||
html += "<th>Time</th>";
|
|
||||||
html += "</tr>\n";
|
|
||||||
html += "</thead>\n";
|
|
||||||
html += "<tbody>\n";
|
|
||||||
|
|
||||||
recent_notifications.forEach(function(row) {
|
|
||||||
html += "<tr>\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";
|
|
||||||
});
|
});
|
||||||
html += "</tbody>\n";
|
if (recent_notifications.length > 0) {
|
||||||
html += "</table>\n";
|
html = "<table class=\"table table-condensed flyout\" style=\"width: 100%\">\n";
|
||||||
|
html += "<thead>\n";
|
||||||
|
html += "<tr>";
|
||||||
|
html += "<th>Status</th>";
|
||||||
|
html += "<th>Time</th>";
|
||||||
|
html += "</tr>\n";
|
||||||
|
html += "</thead>\n";
|
||||||
|
html += "<tbody>\n";
|
||||||
|
|
||||||
|
recent_notifications.forEach(function(row) {
|
||||||
|
html += "<tr>\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";
|
||||||
|
});
|
||||||
|
html += "</tbody>\n";
|
||||||
|
html += "</table>\n";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
html = "<p>No recent notifications.</p>\n";
|
||||||
|
}
|
||||||
|
attachElem(event, html, title);
|
||||||
}
|
}
|
||||||
else {
|
}, 100);
|
||||||
html = "<p>No recent notifications.</p>\n";
|
|
||||||
}
|
|
||||||
attachElem(event, html, title);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
scope.testNotification = function(){
|
scope.testNotification = function(){
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ export default function(){
|
|||||||
icon: "{{ 'icon-job-' + notification_template.status }}",
|
icon: "{{ 'icon-job-' + notification_template.status }}",
|
||||||
awToolTip: "Click for recent notifications",
|
awToolTip: "Click for recent notifications",
|
||||||
awTipPlacement: "right",
|
awTipPlacement: "right",
|
||||||
ngClick: "showSummary($event, notification_templates.id)",
|
ngClick: "showSummary($event, notification_template.id)",
|
||||||
ngClass: ""
|
ngClass: ""
|
||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -36,7 +36,8 @@
|
|||||||
Create and edit scripts to dynamically load hosts from any source.
|
Create and edit scripts to dynamically load hosts from any source.
|
||||||
</p>
|
</p>
|
||||||
</a>
|
</a>
|
||||||
<a ui-sref="notifications" class="SetupItem">
|
<a ui-sref="notifications" class="SetupItem"
|
||||||
|
ng-if="orgAdmin">
|
||||||
<h4 class="SetupItem-title">Notifications</h4>
|
<h4 class="SetupItem-title">Notifications</h4>
|
||||||
<p class="SetupItem-description">
|
<p class="SetupItem-description">
|
||||||
Create templates for sending notifications with Email, HipChat, Slack, and SMS.
|
Create templates for sending notifications with Email, HipChat, Slack, and SMS.
|
||||||
|
|||||||
@@ -6,5 +6,39 @@ export default {
|
|||||||
ncyBreadcrumb: {
|
ncyBreadcrumb: {
|
||||||
label: "SETTINGS"
|
label: "SETTINGS"
|
||||||
},
|
},
|
||||||
templateUrl: templateUrl('setup-menu/setup-menu')
|
templateUrl: templateUrl('setup-menu/setup-menu'),
|
||||||
|
controller: function(orgAdmin, $scope){
|
||||||
|
$scope.orgAdmin = orgAdmin;
|
||||||
|
},
|
||||||
|
resolve: {
|
||||||
|
orgAdmin:
|
||||||
|
['$rootScope', 'ProcessErrors', 'Rest',
|
||||||
|
function($rootScope, ProcessErrors, Rest){
|
||||||
|
|
||||||
|
return $rootScope.loginConfig.promise.then(function () {
|
||||||
|
if($rootScope.current_user.related.admin_of_organizations){
|
||||||
|
$rootScope.orgAdmin = false;
|
||||||
|
if ($rootScope.current_user.is_superuser) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
Rest.setUrl(`/api/v1/users/${$rootScope.current_user.id}/admin_of_organizations`);
|
||||||
|
return Rest.get().then(function(data){
|
||||||
|
if(data.data.count){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(function (data, status) {
|
||||||
|
ProcessErrors($rootScope, data, status, null, { hdr: 'Error!', msg: 'Failed to find if users is admin of org' + status });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}]
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user