Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Service Instance Details Pages #1906

Merged

Conversation

cdcabrera
Copy link
Contributor

@cdcabrera cdcabrera commented Aug 3, 2017

Prep for update around service instances and bindings. Page for service instances.

Related to Origin Design PR #52
Dependency on Origin-Web-Common PR 164

aug-17-2017 11-42-16-640

@spadgett
Copy link
Member

spadgett commented Aug 7, 2017

@cdcabrera Let me know when you'd like a review, thanks!

@cdcabrera cdcabrera requested a review from spadgett August 8, 2017 13:03
@cdcabrera
Copy link
Contributor Author

cdcabrera commented Aug 8, 2017

@spadgett going through and generating screenshots along with questions

Edit: went ahead and worked a few questions into the review response comments

Copy link
Member

@spadgett spadgett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cdcabrera Thanks. I realize this is a WIP, but I've added some initial comments.

@@ -271,6 +271,16 @@ angular
controller: 'ServiceController',
reloadOnSearch: false
})
.when('/project/:project/browse/provisioned', {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be good to match the API kind in the code even if we prefer to it as "Provisioned Service" in the UI. So I'd suggest /browse/service-instances/ and /browser/services-instances/:instance with corresponding names to the controller and views.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@spadgett what about matching file names too?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, let's be consistent with the filenames also

$routeParams,
DataService,
ProjectsService,
$filter) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: I like to keep the lists alphabetized to keep them more manageable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure thing

$scope.serviceClasses = {};
$scope.alerts = {};
//$scope.renderOptions = $scope.renderOptions || {};
//$scope.renderOptions.hideFilterWidget = true;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The two commented out lines can be removed.


$scope.podFailureReasons = {
"Pending": "This pod will not receive traffic until all of its containers have been created."
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like you have a fair amount of code from the service controller that is not needed here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, used the service controller as the basis. Anything we can wipe out... keep those comments coming

var watches = [];

// receives routes for the current service and maps service ports to each route name
var getPortsByRoute = function() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This entire function can be removed.

<th>Age</th>-->
</tr>
</thead>
<tbody ng-if="(serviceInstances | hashSize) === 0">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use | size instead of | hashSize

<td colspan="5"><em>{{emptyMessage}}</em></td>
</tr>
</tbody>
<tbody ng-if="(serviceInstances | hashSize) > 0">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

| size

</tr>
</tbody>
<tbody ng-if="(serviceInstances | hashSize) > 0">
<tr ng-repeat="serviceInstance in serviceInstances | orderObjectsByDate : true">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to sort in the controller, not the view.

Use track by (serviceInstance | uid)

</tbody>
<tbody ng-if="(serviceInstances | hashSize) > 0">
<tr ng-repeat="serviceInstance in serviceInstances | orderObjectsByDate : true">
<td data-title="Name"><a href="{{serviceInstance | navigateResourceURL}}">{{serviceInstance | serviceInstanceDisplayName:serviceClasses}}</a></td>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: ng-href

</td>
<td data-title="Status">
<div row class="status">
<status-icon status="serviceInstance | deploymentStatus" disable-animation></status-icon>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deploymentStatus is not correct here. You'll need to look at the overview service instance row to see how we determine status.


// TODO: code duplicated from directives/bindService.js
// extract & share
var sortServiceInstances = function() {
Copy link
Member

@jeff-phillips-18 jeff-phillips-18 Aug 8, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

};

var groupBindings = function() {
// Build two maps:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cdcabrera cdcabrera force-pushed the service-instances-bindings branch 3 times, most recently from 6c9d67f to 02d8e1f Compare August 9, 2017 15:19
@openshift-bot openshift-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 9, 2017
return {};
}
return _.get(state, ['notificationsByObjectUID', uid], {});
};*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can go.

DataService.list("secrets", context, null, { errorNotification: false }).then(function(secretData) {
state.secrets = secretData.by("metadata.name");
});
}, 300);*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can go.

group: 'servicecatalog.k8s.io',
resource: 'instances'
}, $routeParams.instance, context, serviceResolved));

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

        watches.push(DataService.watch({
          group: 'servicecatalog.k8s.io',
          resource: 'bindings'
        }, context, function(bindings) {
	  $scope.bindings = _.filter(bindings.by('metadata.name'), { spec: { instanceRef: { name: instance.metadata.name } } });
        }));

setDisplayName();
});

watches.push(DataService.watch({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This watch can go since you're already watching the instance for this page above.

@openshift-bot openshift-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 15, 2017
@cdcabrera cdcabrera force-pushed the service-instances-bindings branch 5 times, most recently from 08c7767 to aafc1fa Compare August 17, 2017 06:22
@cdcabrera
Copy link
Contributor Author

@spadgett & @jeff-phillips-18 additional updates...

Short checklist of things that may need to be altered

@@ -271,6 +271,16 @@ angular
controller: 'ServiceController',
reloadOnSearch: false
})
.when('/project/:project/browse/service-instances', {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that upstream it will either be called ServiceInstance or ServiceCatalogInstance. What you have now looks good, but we might change the name to align with the final name in the upstream service catalog.

(Nothing to change right now)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Following up to say the name upstream will be ServiceInstance, so what you have is good 👍

return _.get(window.OPENSHIFT_CONSTANTS, 'ENABLE_TECH_PREVIEW_FEATURE.service_catalog_landing_page');
},
canI: {
resource: 'rolebindings',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resource: { group: 'servicecatalog.k8s.io', resource: 'instances' }

$filter,
$routeParams,
DataService,
ProjectsService) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indentation


var serviceClassName = _.get($scope.serviceInstance.spec, 'serviceClassName');
$scope.serviceClass = _.get($scope.serviceClasses, [serviceClassName]);
$scope.plan = _.find(_.get($scope.serviceClass, 'plans'), {name: 'default'});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't want name: 'default'. You want whatever plan is set in the service instance

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

 $scope.plan = _.find(_.get($scope.serviceClass, 'plans'), {name: $scope.serviceInstance.spec.planName });

$scope.displayName = $filter('serviceInstanceDisplayName')($scope.serviceInstance, $scope.serviceClasses);
};*/

var setDescription = function() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe updateDescriptionAndPlan since it's not just description, or possibly updateServiceClassMetadata

return status;
};
})
.filter('serviceInstanceMessage', function(statusConditionFilter) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe 'readyConditionMessage'

<a ng-href="{{serviceInstance | editYamlURL}}" role="button">Edit YAML</a>
</li>
<li ng-if="{resource: 'instances', group: 'servicecatalog.k8s.io'} | canI : 'delete'">
<delete-link
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably want the same dialog as used here:

https://github.com/openshift/origin-web-console/blob/master/app/scripts/directives/overview/serviceInstanceRow.js#L84

Let's make it a common component that we can reuse. We'll eventually need to handle bindings.

Copy link
Contributor Author

@cdcabrera cdcabrera Aug 25, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In converting this over to a service, did a comparison on the current directive/component delete link looks like there are obvious "copy" differences, but the core of it is the same. Passing in the additional parameter/option/attribute for "group" and wrapping some of the display logic/ng-ifs with a service instance could solve this while separating out the DOM manipulation/modal call from the service

Purpose we either modify the existing, or create a new component, for the delete link for "service instances". This may make linking to the new "Service Instances Service" unnecessary unless we want to further eliminate the delete logic from the delete link directive/component... a little like pulling on a thread with this one

Copy link
Contributor Author

@cdcabrera cdcabrera Aug 25, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@spadgett after going over the modal designs, talked with @ncameronbritt about the style. The style for...

screen shot 2017-08-25 at 4 34 31 pm

fits more inline with the design aspect as opposed to the current...

screen shot 2017-08-25 at 4 34 49 pm

Since this seems to fit partially with the "Service Instances Service" I can do a few things..

  • leave the new "Service Instances Service" as is, free floating and convert the existing Provisioned Service "delete" links over to the preferred modal design
  • leave the new "Service Instances Service" as is and leave the delete links/buttons alone
  • just convert the new "Service Instances Service" by removing the DOM manipulation/modal
  • or leave everything as is

@beanh66

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably want something closer to the first dialog, but I'd rather do that in a separate PR. Let's reuse what we have for now and revisit the design for both overview and this page later.

{{plan.description}}
</p>
<dl class="dl-horizontal left">
<dt ng-if-start="serviceClass.description">Description:</dt>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably want this above the plan details

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should show externalMetadata.longDescription if it's there even if description is not.

<dt ng-if-start="serviceInstance | serviceInstanceMessage">Status Reason:</dt>
<dd ng-if-end>
{{serviceInstance | serviceInstanceMessage}}
</dd>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've used a somewhat different layout for status on the route page and the build config page

</dl>
</div>
<div class="col-lg-6">
<resource-service-bindings
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might rename this component to just service-bindings if we're using it for service instances too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can do this, it's going to affect a handful of files.

@spadgett
Copy link
Member

[test]

@serenamarie125
Copy link

@beanh66 Can you take a look at this, based on your design?

@spadgett
Copy link
Member

@beanh66 @serenamarie125 Just a heads up that the PR is still WIP, so some things are missing.

@beanh66
Copy link
Member

beanh66 commented Aug 21, 2017

Okay no problem @spadgett! @cdcabrera let me know when this is ready for UI review and we can meet if that's easiest.

@cdcabrera cdcabrera force-pushed the service-instances-bindings branch 2 times, most recently from 55258ed to 99e5d5a Compare August 24, 2017 13:27
@cdcabrera
Copy link
Contributor Author

Reference point for PR #1961 Consider looking at breaking out another component for the status from service instance row.

@cdcabrera cdcabrera force-pushed the service-instances-bindings branch 2 times, most recently from e7ebf2d to 36b4f2f Compare August 25, 2017 18:13
@spadgett
Copy link
Member

@cdcabrera I'm seeing these errors on the overview in the console. Do you see this as well? Doesn't happen on master.

angular.js:14199 TypeError: resource.indexOf is not a function
    at normalizeResource (origin-web-common.js:2162)
    at Object.toResourceGroupVersion (origin-web-common.js:2150)
    at Object.canI (origin-web-common.js:2901)
    at ChildScope.$scope.show (nav.js:85)
    at fn (eval at compile (angular.js:15126), <anonymous>:4:297)
    at Scope.$digest (angular.js:17828)
    at angular.js:18033
    at completeOutstandingRequest (angular.js:6045)
    at angular.js:6324

resource: 'serviceinstances'
},
verb: 'list'
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be

canI: {
  resource: 'serviceinstances',
  group: 'servicecatalog.k8s.io',
  verb: 'list'
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that would break, sure thing

],
isValid: function(){
return _.get(window.OPENSHIFT_CONSTANTS, 'ENABLE_TECH_PREVIEW_FEATURE.service_catalog_landing_page');
},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be able to remove isValid now that #2078 is in the merge queue. The canI check below should hide the menu item when service catalog is not enabled.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#2078 has merged

@cdcabrera
Copy link
Contributor Author

@spadgett, yeah looks like I need to verify something and possible rebase

@spadgett
Copy link
Member

Yeah you'll want to rebase to pick up #2048 to properly test

@cdcabrera
Copy link
Contributor Author

@spadgett rebased, don't see any errors on my end.

Do we still need the line in constants.js around isValid for the navigation?

isValid: function(){
  return _.get(window.OPENSHIFT_CONSTANTS, 'ENABLE_TECH_PREVIEW_FEATURE.service_catalog_landing_page');
},

@spadgett
Copy link
Member

You can remove isValid now

@spadgett
Copy link
Member

don't see any errors on my end.

See my comment above on the canI check for the nav item. That's the cause.

#1906 (comment)

<div ng-if="!loaded" class="mar-top-xl">Loading...</div>
<div ng-if="serviceInstance">
<h1 class="contains-actions">
<div class="pull-right dropdown" ng-hide="!('instances' | canIDoAny)">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs to be serviceInstances here or the menu will never show up.

<div class="pull-right dropdown" ng-if="'serviceInstances' | canIDoAny">

@spadgett
Copy link
Member

You need to update resourceServiceBindings.js with

  ctrl.showBindings = CatalogService.SERVICE_CATALOG_ENABLED &&
                      (_.get(ctrl, 'apiObject.kind') === 'ServiceInstance' || enableTechPreviewFeature('pod_presets'));

https://github.com/openshift/origin-web-console/blob/master/app/scripts/directives/resourceServiceBindings.js#L30

@cdcabrera cdcabrera force-pushed the service-instances-bindings branch 2 times, most recently from 8e9be4a to fe5187b Compare September 18, 2017 18:33
@spadgett spadgett changed the title Prep for Service Instances & Bindings Service Instance Details Pages Sep 18, 2017
Copy link
Member

@spadgett spadgett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @cdcabrera

@spadgett
Copy link
Member

[merge]

@spadgett
Copy link
Member

[merge]

@spadgett
Copy link
Member

Origin Web Console Test Results: FAILURE (https://ci.openshift.redhat.com/jenkins/job/test_pull_request_origin_web_console/232/) (Base Commit: 181d896) (PR Branch Commit: 0fd1a62)

Flake #1685

[test]

@spadgett
Copy link
Member

@cdcabrera You have a dist mismatch. Try rebase, bower install, and grunt build

@cdcabrera
Copy link
Contributor Author

Can do @spadgett

Updates for service instances. Prep to allow updates
to chosen parameters for instance and bindings.
@openshift-bot
Copy link

Evaluated for origin web console test up to f015611

@spadgett
Copy link
Member

[merge]

@openshift-bot
Copy link

Evaluated for origin web console merge up to f015611

@openshift-bot
Copy link

openshift-bot commented Sep 18, 2017

Origin Web Console Merge Results: SUCCESS (https://ci.openshift.redhat.com/jenkins/job/merge_pull_request_origin_web_console/219/) (Base Commit: d06b7c0) (PR Branch Commit: f015611)

@openshift-bot
Copy link

Origin Web Console Test Results: SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pull_request_origin_web_console/234/) (Base Commit: d06b7c0) (PR Branch Commit: f015611)

@openshift-bot openshift-bot merged commit e1ba88d into openshift:master Sep 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants