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 configuration and edit #2237

Merged
merged 1 commit into from Oct 19, 2017

Conversation

jeff-phillips-18
Copy link
Member

@jeff-phillips-18 jeff-phillips-18 commented Oct 9, 2017

Depends on openshift/origin-web-catalog#474

Fixes #2278 with catalog version bump

Bumped origin-web-catalog to 0.0.56

@openshift-ci-robot openshift-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Oct 9, 2017

$scope.showConfigValues = false;

$scope.toggleConfigValues = function() {
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 have a small preference for calling them parameter values in the code since it's what they're called in the API.

$scope.parameterData = angular.extend($scope.parameterData, _.get($scope.serviceInstance, 'spec.parameters', {}));

_.each(_.get($scope.serviceInstance, 'spec.parametersFrom'), function(parametersSource) {
secretWatcher = DataService.watchObject("secrets", _.get(parametersSource, 'secretKeyRef.name'), $scope.projectContext, function (secret) {
Copy link
Member

Choose a reason for hiding this comment

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

If there's more than one secret, you'll lose the previous secretWatcher reference and leak watches

var updatePlan = function() {
if (ServiceInstancesService.isCurrentPlan($scope.serviceInstance, $scope.plan)) {
var updateParameterSchema = function() {
$scope.parameterFormDefinition = angular.copy(_.get($scope.plan, 'spec.externalMetadata.schemas.service_instance.create.openshift_form_definition'));
Copy link
Member

Choose a reason for hiding this comment

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

For update I think this should be

spec.externalMetadata.schemas.service_instance.update.openshift_form_definition

var updateParameterSchema = function() {
$scope.parameterFormDefinition = angular.copy(_.get($scope.plan, 'spec.externalMetadata.schemas.service_instance.create.openshift_form_definition'));

$scope.parameterSchema = angular.copy(_.get($scope.plan, 'spec.instanceCreateParameterSchema'));
Copy link
Member

Choose a reason for hiding this comment

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

spec.instanceUpdateParameterSchema

$scope.displayName = serviceInstanceDisplayName($scope.serviceInstance, $scope.serviceClass);
updateBreadcrumbs();

Catalog.getServicePlans().then(function(plans) {
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 be able to only request plans for a specific service class, but OK for now. I worry down the road that this might be a lot of data, though.

<overlay-panel show-panel="editDialogShown" handle-close="closeEditDialog">
<update-service
project="project"
display-name="serviceInstance | serviceInstanceDisplayName:serviceClasses"
Copy link
Member

Choose a reason for hiding this comment

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

You'll need to rebase. This now takes in one service class instead of a map.

@@ -48,4 +48,18 @@
View Secret
</a>
</div>
<div class="service-binding-parameters" ng-if="$ctrl.bindParameterSchema.properties && (true || !($ctrl.binding | isBindingFailed) && ($ctrl.binding | isBindingReady))">
Copy link
Member

Choose a reason for hiding this comment

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

Is there a reason not to show parameter for failed bindings? It might help the user debug.

@@ -48,4 +48,18 @@
View Secret
</a>
</div>
<div class="service-binding-parameters" ng-if="$ctrl.bindParameterSchema.properties && (true || !($ctrl.binding | isBindingFailed) && ($ctrl.binding | isBindingReady))">
<span class="parameters-heading">PARAMETERS</span>
Copy link
Member

Choose a reason for hiding this comment

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

<span class="parameters-heading">Parameters</span>

and use text-transform to make it uppercase in CSS

@@ -48,4 +48,18 @@
View Secret
</a>
</div>
<div class="service-binding-parameters" ng-if="$ctrl.bindParameterSchema.properties && (true || !($ctrl.binding | isBindingFailed) && ($ctrl.binding | isBindingReady))">
<span class="parameters-heading">PARAMETERS</span>
<a href="" ng-click="$ctrl.toggleShowParameterValues()">{{$ctrl.showParameterValues ? 'Hide Values' : 'Reveal Values'}}</a>
Copy link
Member

Choose a reason for hiding this comment

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

role="button"

<div class="service-binding-parameters" ng-if="$ctrl.bindParameterSchema.properties && (true || !($ctrl.binding | isBindingFailed) && ($ctrl.binding | isBindingReady))">
<span class="parameters-heading">PARAMETERS</span>
<a href="" ng-click="$ctrl.toggleShowParameterValues()">{{$ctrl.showParameterValues ? 'Hide Values' : 'Reveal Values'}}</a>
<a ng-if="!$ctrl.binding.metadata.deletionTimestamp" href="" ng-click="$ctrl.editParameters()">Edit</a>
Copy link
Member

Choose a reason for hiding this comment

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

role="button"

@openshift-ci-robot openshift-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Oct 11, 2017
@jeff-phillips-18
Copy link
Member Author

Believe I have addressed @spadgett comments.

Have not been able to test with multiple plans and/or editable plans.

@openshift-ci-robot openshift-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Oct 12, 2017
@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 13, 2017
@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 13, 2017
@spadgett
Copy link
Member

@jmontleon FYI, this is the plan and parameter update PR. We saw some problems (in our code) when working against your ASB changes that we're debugging now.

@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 17, 2017
@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 17, 2017
@openshift-ci-robot openshift-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Oct 17, 2017
@jeff-phillips-18
Copy link
Member Author

Fixed updating the plan editability while being updated. No known issues atm, but have not tested updating the service instance's parameters with an instanceUpdateParameterSchema.

@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 17, 2017
@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 17, 2017

$scope.parameterData = angular.extend($scope.parameterData, _.get($scope.serviceInstance, 'spec.parameters', {}));

if (AuthorizationService.canI('secrets', 'get', $scope.projectName)) {
Copy link
Member

Choose a reason for hiding this comment

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

This means that you will not be able to see that there's a parameter at all when it comes from a secret and you can't get the secret, correct?

We could possibly fill in the redacted values using status.externalProperties.parameters when users can't list secrets (without letting them reveal). I'm OK handling this as a follow on, however.

Copy link
Member Author

Choose a reason for hiding this comment

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

@spadgett What should we do when the user does reveal and we have redacted values for some of the parameters? Continue to show ***** for those parameters?

Copy link
Member

Choose a reason for hiding this comment

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

Maybe remove the "reveal" action?

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 we're close enough here it should be a follow-on anyway.

@spadgett
Copy link
Member

Checkboxes look a little odd to me in read only mode:

openshift web console 2017-10-18 10-24-20

@jeff-phillips-18
Copy link
Member Author

The checkboxes issue is fixed in the catalog-parameters component

@@ -105,6 +105,32 @@
border-bottom: 0;
padding-bottom: 0;
}

.config-parameters-form {
Copy link
Member

Choose a reason for hiding this comment

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

Nit: alpha of this rule and the rules nested within

Copy link
Member Author

Choose a reason for hiding this comment

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

@rhamilto do we alpha ignoring the . or are there any preferences on selector type ordering?

Copy link
Member

Choose a reason for hiding this comment

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

Generally ignore the non-alpha characters as I think most folks don't think about 'em when they're scanning the code. The overall goal is to make the Less more human-readable. You would not believe the number of times I've seen rules declared multiple times or even the same declaration twice within the same rule. Either way this rule should come first in this block. :)

</dl>
<div class="hidden-lg">
<h3 ng-if-start="serviceClass.spec.description || serviceClass.spec.externalMetadata.longDescription">Description</h3>
<dl ng-if-end class="dl-horizontal left">
Copy link
Member

Choose a reason for hiding this comment

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

A dl should only contain dt, dd, or div/script/template elements. So either don't use a dl or change the p elements to divs and add a margin using a helper class (e.g., mar-bottom-md)? I think I prefer the former as that maintains the semantic value of the p.

Copy link
Member

Choose a reason for hiding this comment

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

No need for the dl. Just remove it and render the p as individual elements.

<div class="col-lg-6">
<div class="hidden-xs hidden-sm hidden-md">
<h3 ng-if-start="serviceClass.spec.description || serviceClass.spec.externalMetadata.longDescription">Description</h3>
<dl ng-if-end class="dl-horizontal left">
Copy link
Member

Choose a reason for hiding this comment

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

Same dl issue as before.

@jeff-phillips-18 jeff-phillips-18 changed the title [WIP - DO NOT MERGE] Service instance details configuration and edit Service instance details configuration and edit Oct 19, 2017
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 19, 2017
@jeff-phillips-18
Copy link
Member Author

Addressed @rhamilto comments. Removed WIP status 🙌 🤘

if (ServiceInstancesService.isCurrentPlan($scope.serviceInstance, $scope.plan)) {
return;
}
Catalog.getServicePlans().then(function (plans) {
Copy link
Member

Choose a reason for hiding this comment

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

When we fix the removed plans, let's use a field filter on list to get just the plans for this service class and filter removed plans client side (follow on)

_.each(_.get(ctrl.binding, 'spec.parametersFrom'), function (parametersSource) {
DataService.get('secrets', _.get(parametersSource, 'secretKeyRef.name'), context).then(function (secret) {
try {
_.extend(ctrl.parameterData, SecretsService.decodeSecretData(secret.data).parameters);
Copy link
Member

Choose a reason for hiding this comment

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

This is not always parameters. It is the secretKeyRef.key

Copy link
Member

Choose a reason for hiding this comment

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

Surprised you don't need a JSON.parse here

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes. Thanks, I do need a JSON.parse here.

Copy link
Member

@rhamilto rhamilto left a comment

Choose a reason for hiding this comment

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

🥇

@spadgett
Copy link
Member

Looks like a dist mismatch

@jeff-phillips-18
Copy link
Member Author

/retest

@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 19, 2017
@spadgett
Copy link
Member

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Oct 19, 2017
@openshift-merge-robot
Copy link
Contributor

Automatic merge from submit-queue.

@openshift-merge-robot openshift-merge-robot merged commit f127c70 into openshift:master Oct 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm Indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants