- Change updated_tags into the expected dict, not a list
- Update the event code on both sides to expect the dict - Add filter support to the string builder
This commit is contained in:
parent
420d02cd71
commit
7e8713171e
3 changed files with 35 additions and 7 deletions
|
@ -548,6 +548,18 @@ quayApp = angular.module('quay', quayDependencies, function($provide, cfpLoading
|
|||
'client_id': 'chain'
|
||||
};
|
||||
|
||||
var filters = {
|
||||
'obj': function(value) {
|
||||
if (!value) { return []; }
|
||||
return Object.getOwnPropertyNames(value);
|
||||
},
|
||||
|
||||
'updated_tags': function(value) {
|
||||
if (!value) { return []; }
|
||||
return Object.getOwnPropertyNames(value);
|
||||
}
|
||||
};
|
||||
|
||||
var description = value_or_func;
|
||||
if (typeof description != 'string') {
|
||||
description = description(metadata);
|
||||
|
@ -555,7 +567,17 @@ quayApp = angular.module('quay', quayDependencies, function($provide, cfpLoading
|
|||
|
||||
for (var key in metadata) {
|
||||
if (metadata.hasOwnProperty(key)) {
|
||||
var value = metadata[key] != null ? metadata[key].toString() : '(Unknown)';
|
||||
var value = metadata[key] != null ? metadata[key] : '(Unknown)';
|
||||
if (filters[key]) {
|
||||
value = filters[key](value);
|
||||
}
|
||||
|
||||
if (Array.isArray(value)) {
|
||||
value = value.join(', ');
|
||||
}
|
||||
|
||||
value = value.toString();
|
||||
|
||||
if (key.indexOf('image') >= 0) {
|
||||
value = value.substr(0, 12);
|
||||
}
|
||||
|
@ -1083,7 +1105,7 @@ quayApp = angular.module('quay', quayDependencies, function($provide, cfpLoading
|
|||
var notificationKinds = {
|
||||
'test_notification': {
|
||||
'level': 'primary',
|
||||
'message': 'This notification is a long message for testing',
|
||||
'message': 'This notification is a long message for testing: {obj}',
|
||||
'page': '/about/',
|
||||
'dismissable': true
|
||||
},
|
||||
|
@ -1119,7 +1141,13 @@ quayApp = angular.module('quay', quayDependencies, function($provide, cfpLoading
|
|||
},
|
||||
'repo_push': {
|
||||
'level': 'info',
|
||||
'message': 'Repository {repository} has been pushed with the following tags updated: {updated_tags}',
|
||||
'message': function(metadata) {
|
||||
if (metadata.updated_tags && Object.getOwnPropertyNames(metadata.updated_tags).length) {
|
||||
return 'Repository {repository} has been pushed with the following tags updated: {updated_tags}';
|
||||
} else {
|
||||
return 'Repository {repository} has been pushed';
|
||||
}
|
||||
},
|
||||
'page': function(metadata) {
|
||||
return '/repository/' + metadata.repository;
|
||||
},
|
||||
|
|
Reference in a new issue