Code cleanup part #1: move all the services and directive JS code in the app.js file into its own files
This commit is contained in:
parent
3cae6609a7
commit
9b87999c1c
97 changed files with 7076 additions and 6870 deletions
28
static/js/services/image-metadata-service.js
Normal file
28
static/js/services/image-metadata-service.js
Normal file
|
@ -0,0 +1,28 @@
|
|||
/**
|
||||
* Helper service for returning information extracted from repository image metadata.
|
||||
*/
|
||||
angular.module('quay').factory('ImageMetadataService', ['UtilService', function(UtilService) {
|
||||
var metadataService = {};
|
||||
metadataService.getFormattedCommand = function(image) {
|
||||
if (!image || !image.command || !image.command.length) {
|
||||
return '';
|
||||
}
|
||||
|
||||
var getCommandStr = function(command) {
|
||||
// Handle /bin/sh commands specially.
|
||||
if (command.length > 2 && command[0] == '/bin/sh' && command[1] == '-c') {
|
||||
return command[2];
|
||||
}
|
||||
|
||||
return command.join(' ');
|
||||
};
|
||||
|
||||
return getCommandStr(image.command);
|
||||
};
|
||||
|
||||
metadataService.getEscapedFormattedCommand = function(image) {
|
||||
return UtilService.textToSafeHtml(metadataService.getFormattedCommand(image));
|
||||
};
|
||||
|
||||
return metadataService;
|
||||
}]);
|
Reference in a new issue