Commit f250d002 by Jeffrey Phillips Committed by GitHub

Merge pull request #15 from dtaylor113/annotation-icon-filter

Added 'imageStreamTagIconClass' and 'imageStreamTagAnnotation' filters
parents a503f73a c48dd2ff
......@@ -29,7 +29,7 @@ module.exports = function (grunt) {
separator: ';'
},
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'
},
services: {
......
......@@ -901,7 +901,41 @@ angular.module('openshiftCommonUI')
}
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('imageStreamTagTags', ["imageStreamTagAnnotationFilter", function(imageStreamTagAnnotationFilter) {
// Return ImageStream.spec.tag[tag].annotation.tags as an array
return function(resource, /* optional */ tagName) {
var imageTags = imageStreamTagAnnotationFilter(resource, 'tags', tagName);
if (!imageTags) {
return [];
}
return imageTags.split(/\s*,\s*/);
};
}])
.filter('imageStreamTagIconClass', ["imageStreamTagAnnotationFilter", function(imageStreamTagAnnotationFilter) {
return function(resource, /* optional */ tagName) {
var icon = imageStreamTagAnnotationFilter(resource, "iconClass", tagName);
return (icon) ? icon : "fa fa-cube";
};
}]);
;'use strict';
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -52,5 +52,39 @@ angular.module('openshiftCommonUI')
}
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('imageStreamTagTags', function(imageStreamTagAnnotationFilter) {
// Return ImageStream.spec.tag[tag].annotation.tags as an array
return function(resource, /* optional */ tagName) {
var imageTags = imageStreamTagAnnotationFilter(resource, 'tags', tagName);
if (!imageTags) {
return [];
}
return imageTags.split(/\s*,\s*/);
};
})
.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