Commit 8ec00908 by David Taylor

Added 'imageStreamTagIconClass' and 'imageStreamTagAnnotation' filters. Fix to…

Added 'imageStreamTagIconClass' and 'imageStreamTagAnnotation' filters.  Fix to include filters in origin-web-common-ui.js
parent 4a6361ac
...@@ -29,7 +29,7 @@ module.exports = function (grunt) { ...@@ -29,7 +29,7 @@ module.exports = function (grunt) {
separator: ';' separator: ';'
}, },
ui: { ui: {
src: ['src/**/*UI.module.js', 'dist/scripts/templates.js', 'src/components/**/*.js', 'src/filers/**/*.js'], src: ['src/**/*UI.module.js', 'dist/scripts/templates.js', 'src/components/**/*.js', 'src/filters/**/*.js'],
dest: 'dist/origin-web-common-ui.js' dest: 'dist/origin-web-common-ui.js'
}, },
services: { services: {
......
...@@ -901,7 +901,30 @@ angular.module('openshiftCommonUI') ...@@ -901,7 +901,30 @@ angular.module('openshiftCommonUI')
} }
return null; return null;
}; };
}]); }])
.filter('imageStreamTagAnnotation', function() {
// Look up annotations on ImageStream.spec.tags[tag].annotations
return function(resource, key, /* optional */ tagName) {
tagName = tagName || 'latest';
if (resource && resource.spec && resource.spec.tags){
var tags = resource.spec.tags;
for(var i=0; i < tags.length; ++i){
var tag = tags[i];
if(tagName === tag.name && tag.annotations){
return tag.annotations[key];
}
}
}
return null;
};
})
.filter('imageStreamTagIconClass', ["imageStreamTagAnnotationFilter", function(imageStreamTagAnnotationFilter) {
return function(resource, /* optional */ tagName) {
var icon = imageStreamTagAnnotationFilter(resource, "iconClass", tagName);
return (icon) ? icon : "fa fa-cube";
};
}]);
;'use strict'; ;'use strict';
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -52,5 +52,28 @@ angular.module('openshiftCommonUI') ...@@ -52,5 +52,28 @@ angular.module('openshiftCommonUI')
} }
return null; return null;
}; };
}); })
.filter('imageStreamTagAnnotation', function() {
// Look up annotations on ImageStream.spec.tags[tag].annotations
return function(resource, key, /* optional */ tagName) {
tagName = tagName || 'latest';
if (resource && resource.spec && resource.spec.tags){
var tags = resource.spec.tags;
for(var i=0; i < tags.length; ++i){
var tag = tags[i];
if(tagName === tag.name && tag.annotations){
return tag.annotations[key];
}
}
}
return null;
};
})
.filter('imageStreamTagIconClass', function(imageStreamTagAnnotationFilter) {
return function(resource, /* optional */ tagName) {
var icon = imageStreamTagAnnotationFilter(resource, "iconClass", tagName);
return (icon) ? icon : "fa fa-cube";
};
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment