Skip to content

Commit

Permalink
Merge pull request #487 from spadgett/is-provider-display-name
Browse files Browse the repository at this point in the history
Look for provider display name annotation on image streams
  • Loading branch information
spadgett authored Oct 20, 2017
2 parents c23c304 + e2e4281 commit 8ecf1f2
Show file tree
Hide file tree
Showing 7 changed files with 108 additions and 85 deletions.
41 changes: 22 additions & 19 deletions app/mockServices/mockData/openshift-images.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ export const imagesData = {
'jenkins': {
'metadata': {
'name': 'jenkins',
'namespace': 'openshift',
'selfLink': '/oapi/v1/namespaces/openshift/imagestreams/jenkins',
'uid': 'jenkins',
'resourceVersion': '658',
'generation': 2,
'creationTimestamp': '2017-03-15T15:46:25Z',
'annotations': {
'openshift.io/display-name': 'Jenkins',
'openshift.io/image.dockerRepositoryCheck': '2017-03-15T15:46:49Z'
'namespace': 'openshift',
'selfLink': '/oapi/v1/namespaces/openshift/imagestreams/jenkins',
'uid': 'jenkins',
'resourceVersion': '658',
'generation': 2,
'creationTimestamp': '2017-03-15T15:46:25Z',
'annotations': {
'openshift.io/display-name': 'Jenkins',
'openshift.io/image.dockerRepositoryCheck': '2017-03-15T15:46:49Z'
}
},
'spec': {
Expand Down Expand Up @@ -424,17 +424,20 @@ export const imagesData = {
'apiVersion': 'v1'
},
'nodejs': {
'metadata': {
'metadata': {
'name': 'nodejs',
'namespace': 'openshift',
'selfLink': '/oapi/v1/namespaces/openshift/imagestreams/nodejs',
'uid': 'nodejs',
'resourceVersion': '594',
'generation': 2,
'creationTimestamp': '2017-03-15T15:46:24Z',
'annotations': {
'openshift.io/display-name': 'Node.js',
'openshift.io/image.dockerRepositoryCheck': '2017-03-15T15:46:36Z'
'namespace': 'openshift',
'selfLink': '/oapi/v1/namespaces/openshift/imagestreams/nodejs',
'uid': 'nodejs',
'resourceVersion': '594',
'generation': 2,
'creationTimestamp': '2017-03-15T15:46:24Z',
'annotations': {
'openshift.io/display-name': 'Node.js',
'openshift.io/provider-display-name': 'Red Hat, Inc.',
'openshift.io/documentation-url': 'https://nodejs.org/en/docs/',
'openshift.io/support-url': 'https://access.redhat.com',
'openshift.io/image.dockerRepositoryCheck': '2017-03-15T15:46:36Z'
}
},
'spec': {
Expand Down
120 changes: 62 additions & 58 deletions dist/origin-web-catalogs.js

Large diffs are not rendered by default.

15 changes: 13 additions & 2 deletions src/components/create-from-builder/create-from-builder-info.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="order-service-details">
<div class="order-service-details-top">
<div class="order-service-details-top" ng-class="{'order-service-details-top-icon-top': $ctrl.imageStream.vendor || $ctrl.documentationUrl || $ctrl.supportUrl}">
<div class="service-icon">
<span ng-if="!$ctrl.imageStream.imageUrl" class="icon {{$ctrl.imageStream.iconClass}}" aria-hidden="true"></span>
<span ng-if="$ctrl.imageStream.imageUrl" class="image"><img ng-src="{{$ctrl.imageStream.imageUrl}}" alt=""></span>
Expand All @@ -9,19 +9,30 @@
{{$ctrl.imageStream.name}}
{{$ctrl.istag.name}}
</div>
<div ng-if="$ctrl.imageStream.vendor" class="service-vendor">
{{$ctrl.imageStream.vendor}}
</div>
<div class="order-service-tags">
<span ng-repeat="tag in $ctrl.istag.annotations.tags.split(',')" class="tag">
{{tag}}
</span>
</div>
<ul ng-if="$ctrl.documentationUrl || $ctrl.supportUrl" class="list-inline order-service-documentation-url">
<li ng-if="$ctrl.documentationUrl">
<a ng-href="{{$ctrl.documentationUrl}}" target="_blank" class="learn-more-link">View Documentation <i class="fa fa-external-link" aria-hidden="true"></i></a>
</li>
<li ng-if="$ctrl.supportUrl">
<a ng-href="{{$ctrl.supportUrl}}" target="_blank" class="learn-more-link">Get Support <i class="fa fa-external-link" aria-hidden="true"></i></a>
</li>
</ul>
</div>
</div>
<div class="order-service-description-block">
<p ng-bind-html="($ctrl.istag.annotations.description | linky : '_blank') || 'No description provided.'" class="description"></p>
<p ng-if="$ctrl.istag.annotations.sampleRepo">
Sample Repository:
<!-- TODO: Use Git link filter, needs to be added to origin-web-common -->
<span ng-bind-html="$ctrl.istag.annotations.sampleRepo | linky : '_blank'">
<span ng-bind-html="$ctrl.istag.annotations.sampleRepo | linky : '_blank'"></span>
</p>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ export class CreateFromBuilderController implements angular.IController {
this.ctrl.updating = false;
this.ctrl.noProjectsCantCreate = false;

let annotation = this.$filter('annotation');
this.ctrl.documentationUrl = annotation(this.ctrl.imageStream.resource, 'openshift.io/documentation-url');
this.ctrl.supportUrl = annotation(this.ctrl.imageStream.resource, 'openshift.io/support-url');

this.ctrl.serviceInstances = [];
this.selectedProjectWatch = this.$scope.$watch(
() => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/order-service/order-service-info.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="order-service-details">
<div class="order-service-details-top" ng-class="{'order-service-details-top-icon-top': ($ctrl.serviceClass.vendor || ($ctrl.docUrl || $ctrl.supportUrl))}">
<div class="order-service-details-top" ng-class="{'order-service-details-top-icon-top': $ctrl.serviceClass.vendor || $ctrl.docUrl || $ctrl.supportUrl}">
<div class="service-icon">
<span ng-if="!$ctrl.imageUrl" class="icon {{$ctrl.iconClass}}" aria-hidden="true"></span>
<span ng-if="$ctrl.imageUrl" class="image"><img ng-src="{{$ctrl.imageUrl}}" alt=""></span>
Expand Down
7 changes: 4 additions & 3 deletions src/services/catalog.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,8 @@ export class ImageItem implements IServiceItem {
}

private getVendor(): string {
return '';
let provider = _.get(this.resource, ['metadata', 'annotations', 'openshift.io/provider-display-name'], '');
return this.catalogSrv.getPublisherSynonym(provider);
}

private getDescription() {
Expand Down Expand Up @@ -542,15 +543,15 @@ export class TemplateItem implements IServiceItem {
}

private getLongDescription() {
return _.get(this.resource, ['metadata', 'annotations', 'template.openshift.io/long-description'], '');
return _.get(this.resource, ['metadata', 'annotations', 'openshift.io/long-description'], '');
}

private getTags() {
return _.get(this.resource, 'metadata.annotations.tags', '').split(/\s*,\s*/);
}

private getVendor(): string {
var rawVendor = _.get(this.resource, ['metadata', 'annotations', 'template.openshift.io/provider-display-name']) as string || '';
var rawVendor = _.get(this.resource, ['metadata', 'annotations', 'openshift.io/provider-display-name']) as string || '';
return this.catalogSrv.getPublisherSynonym(rawVendor);
}
}
4 changes: 2 additions & 2 deletions test/services-view.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ describe('servicesView', () => {
var element = componentTest.rawElement;

var vendorFilters = jQuery(element).find('.category-option-label');
expect(vendorFilters.length).toBe(3);
expect(jQuery(vendorFilters[1]).text()).toBe('Vendor B, Inc.');
expect(vendorFilters.length).toBe(4);
expect(jQuery(vendorFilters[2]).text()).toBe('Vendor B, Inc.');
});
});

0 comments on commit 8ecf1f2

Please sign in to comment.