-
Notifications
You must be signed in to change notification settings - Fork 230
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
Support EnvFrom in the Env Editors #2133
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cdcabrera Great start. One general comment on names containing valueFrom
.
Can you look at the logic here?
We have some code to check if the environment has changed on watch updates. We'll want to check envFrom
as well.
bindings: { | ||
addRowLink: '@', | ||
entries: '=', | ||
valueFromSelectorOptions: '<', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
envFromOptions ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
np, can change. Just reused the valueFromSelectorOptions
since it helps generate the same list... can change the name no problem
return _.includes(cannotDeleteSome, name); | ||
}; | ||
|
||
ctrl.isValueFromReadonly = function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should avoid valueFrom
in names throughout this control. That refers specifically to choosing an individual key from a secret. It's going to get confusing if we use that in names for envFrom
.
ae6f733
to
71ac457
Compare
@openshift/team-ux-review need some input on the tooltip copy for the Environment From section... The original tooltip copy that shows up in the designs...
And a possible alternative...
|
@spadgett looks like updating the Environment Service requires an update to the associated unit test, or some additional checks within the service. I could update the test to avoid this failure by placing an empty array for |
This is fine as long as we handle the case where |
@spadgett verified the "env" vs "envFrom" aspects of the unit tests. Behavior appears to be the same with the addition of an empty array vs the missing resource. Going to push the updated unit test change. Edit: there is a minor difference where "env" comes back as a literal |
ffb97c1
to
24e22d2
Compare
ng-if="$ctrl.showHeader" | ||
class="key-value-editor-entry key-value-editor-entry-header"> | ||
<div class="form-group key-value-editor-header value-header"> | ||
<div class="input-group"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why wrap in a form-group
and input-group
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Part of the classes copied over from the variables component (heads up... may be some clean up there too), also part of the CSS clean up we've been going through, lots of extras to remove.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK to leave if it's reusing the styles and needed
@@ -0,0 +1,94 @@ | |||
<ng-form name="forms.editEnvironmentFrom" novalidate> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be $ctrl.editEnvironmentFrom
here and below?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that a vote to remove the ng-form
?
I may be able to, but was under the impression we were trying to maintain the parent-child relationship with the parent form?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should be able to keep ng-form
and use $ctrl.editEnvironmentForm
I think. Is this sharing the same form object as the parent? I don't think that should be necessary.
<div class="faux-form-control readonly"> | ||
Set to values in {{entry.selectedEnvFrom.kind | humanizeKind : true | lowercase}} | ||
<span | ||
ng-if="!('configmaps' | canI : 'get') || !('secrets' | canI : 'get')"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't look right. If the value is a config map, we should be able to link to that even if I can't view secrets.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can adjust the logic, look at separating it out
href="" | ||
class="add-row-link" | ||
role="button" | ||
aria-label="Add row" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably don't want aria-label
here so that the screen reader uses addRowLink
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can remove sure thing, just heads up... it's copied from the variables display
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's fix it there, too.
<span class="pficon pficon-info" | ||
aria-hidden="true" | ||
data-toggle="tooltip" | ||
data-original-title="Environment From lets you add all key value pairs from a config map or secret."></span> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Environment From lets you add all key-value pairs from a config map or secret as environment variables."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copy update, np
We might rethink the "View Secret" link since it navigates away from the page, losing your edits. cc @beanh66 |
|
||
<h4> | ||
Environment From | ||
<span class="pficon pficon-info" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We usually use a ?
(pficon-help
) for these tooltips, for instance:
@beanh66 Any objection to switching for consistency?
I think the "Variables" heading is self-evident. I wonder if we should just remove that heading? |
24e22d2
to
69e10c9
Compare
69e10c9
to
3ab3d9a
Compare
@spadgett agreed on the view secret link! I talked to @cdcabrera about having the link be called "View Details" or "View Variables" instead and clicking the link would pop a modal to display the secret or config map variables (rather than navigating away). I also mentioned that if we go this route, the link should be available right away after a selection is made. Previously we were only showing that link after the save button was clicked. Thoughts? |
ctrl.$onInit = function() { | ||
ctrl.updateEnvFromEntries(ctrl.entries); | ||
findReferenceValueForEntries(ctrl.envFromEntries, ctrl.envFromSelectorOptions); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you wanting to continue supporting cannotAdd
, cannotSort
, isReadonly
, showHeader
as the <key-value-editor>
had them? If so, I'd prob suggest including them in bindings
above. I believe this chunk of if
statements was so you could put the attrib on the DOM node w/o a value:
<edit-environment-from cannot-add></edit-environment-from>
<!-- both works -->
<edit-environment-from cannot-add="'true'"></edit-environment-from>
} | ||
}); | ||
}; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: for consistency, prob can drop the angular.extend
and just do ctrl.dragControlListeners =
since the rest of the file uses this style.
|
||
var canI = $filter('canI'); | ||
var humanizeKind = $filter('humanizeKind'); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you are using ctrl.$id
in the view, so can prob change this to var id
.
|
||
<div | ||
class="form-group key-value-editor-input" | ||
ng-class="{ 'has-error': (forms.editEnvironmentFrom[uniqueForValue(unique, $index)].$invalid && forms.editEnvironmentFrom[uniqueForValue(unique, $index)].$touched) }"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think the has-error
class will ever be applied, as uniqueForValue
is a function that doesn't exist. It is added to $scope
in key-value-editor
, if you want to use it prob need to add it as $ctrl.uniqueForValue
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also in uniqueForValue(unique, $index)
, unique
is $scope.unique
, which is also missing here (would be ctrl.unique
).
https://github.com/openshift/origin-web-console/blob/master/app/scripts/directives/keyValueEditor.js#L202
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Btw, the uniqueFor
helpers are to generate uniqueIds for the inputs, and match up the labels, has-error
classes, etc.
The ctrl.unique
is used in key-value-editor
to ensure that you can have more than one editor on a page w/o collisions. Basically forms.editEnvironmentFrom[uniqueForValue(unique, $index)]
returns the matching id
of one of the <input id="???">
elements.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed! Removing the forms reference from the earlier review and the lack of the uniqueForValue method seemed to build/accumulate, looks like an adjustment for the readonly section needs to take place
ng-href="{{entry.selectedEnvFrom | navigateResourceURL}}" | ||
class="pficon" | ||
ng-show="entry.selectedEnvFrom" | ||
ng-click="$ctrl.viewDetail(entry)">View {{entry.selectedEnvFrom.kind | humanizeKind : true}}</a> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think $ctrl.viewDetail
doesn't exist? the href works, tho.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeahhhhhhhh =), removing appears superfluous looks like it was from a previous iteration
<edit-environment-from | ||
entries="container.envFrom" | ||
selector-placeholder="Secret/Config Map" | ||
env-from-selector-options="$ctrl.valueFromObjects" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above about env-from-selector-options
.
], | ||
bindings: { | ||
addRowLink: '@', | ||
entries: '=', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I'm crazy about envFromSelectorOptions
...I'd at least like a comment about what it means. Its config for something, but at a glance I'm not sure what (might be my ignorance re: EnvironmentFrom).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An annotation couldn't hurt, we'll add one in
ed143ef
to
1ba99ba
Compare
@spadgett @benjaminapetersen there's still a missing method around
ng-class="{ 'has-error': ($ctrl.editEnvironmentFromForm[uniqueForValue(unique, $index)].$invalid && $ctrl.editEnvironmentFromForm[uniqueForValue(unique, $index)].$touched) }"> |
|
||
var canI = $filter('canI'); | ||
var humanizeKind = $filter('humanizeKind'); | ||
var namespace = $routeParams.project; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to pass the project in than read it from route params. But why is it needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the comment chain, related to the below dummy values referenced in editEnvironmentFrom.js
namespace: namespace | ||
} | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather not set dummy values. Is there another way to handle this? Is this for handling secrets that have been deleted?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the comment chain, we're removing this as discussed
ng-hide="$ctrl.cannotDeleteAny" | ||
ng-click="$ctrl.deleteEntry($index, 1)"></a> | ||
<a | ||
ng-if="!$ctrl.editEnvironmentFromForm.$dirty" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't just check this form because the normal env var form above might have changed.
I suggest we handle "View Secret" as a follow on issue and remove it for now.
@@ -32,6 +34,21 @@ | |||
add-row-with-selectors-link="Add Environment Variable Using a Config Map or Secret" | |||
show-header> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just above this line:
add-row-link="Add Variable"
add-row-with-selectors-link="Add Variable from Config Map or Secret"
@spadgett Do we want to change the Environment From title? @cdcabrera the field level help next to Environment From also doesn't appear to be using the PatternFly styling here, can you take a look? I liked your suggestion for the wording change regarding the tooltip though. |
@beanh66 It's using the style we use for help tooltips throughout the console. I'm not opposed to changing, but I'd like to change them everywhere to be consistent (and probably out of scope for this PR). That said, the icon is larger here than it is in other places. For instance, this is the build config editor with a similar help tooltip: |
18eeb46
to
42ee449
Compare
No secrets or config maps have been added as Environment From. | ||
</div> | ||
<div ng-if="entry.configMapRef.name || entry.secretRef.name" class="faux-form-control readonly"> | ||
Set to values in {{entry.configMapRef.name || entry.secretRef.name}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably should say Use all keys and values from <kind> <name>.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use all keys and values from
<span ng-if="entry.configMapRef.name">config map {{entry.configMapRef.name}}</span>
<span ng-if="entry.secretRef.name">secret {{entry.secretRef.name}}</span>
42ee449
to
034cf29
Compare
[merge] |
|
Add dropdown support to give the ability to add bulk additions within the environment editors
034cf29
to
7165cef
Compare
[merge] |
Evaluated for origin web console merge up to 7165cef |
Origin Web Console Merge Results: SUCCESS (https://ci.openshift.redhat.com/jenkins/job/merge_pull_request_origin_web_console/284/) (Base Commit: ac5246b) (PR Branch Commit: 7165cef) |
https://trello.com/c/rOB7X4pj
Add dropdown support to give the ability to add bulk additions within the environment editors. Design documentation located here
Notes:
Comment clean up still requiredCSS/StylingSome awkward behavior around validation and allowing a save when removing the last "envFrom" entry