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

Allow EnvFrom Prefix #2377

Merged

Conversation

cdcabrera
Copy link
Contributor

@cdcabrera cdcabrera commented Oct 25, 2017

Opened envFrom to allow prefix input.

  • Minor display logic updates
  • Design/UX modifications

Related to #2182 and closes #2362

screen shot 2017-10-25 at 5 06 37 pm

@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/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Oct 25, 2017
@openshift-ci-robot openshift-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Oct 25, 2017
@@ -170,7 +170,8 @@
}

.key-value-editor .key-value-editor-input,
.key-value-editor-header {
.key-value-editor-header,
.environment-from-editor-header {
Copy link
Contributor Author

@cdcabrera cdcabrera Oct 26, 2017

Choose a reason for hiding this comment

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

@sg00dwin made adjustment for the column widths see PR screenshot. Still looking like the column containing the prefix field is a few pixels off compared to the ui-select column above

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.

It'd probably be good for EnvironmentService compact method to remove empty prefixes.

@@ -87,6 +87,11 @@
}
};

ctrl.removePrefix = function (entry) {
Copy link
Member

Choose a reason for hiding this comment

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

Should no longer be needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed, on the clean up list

<small class="pficon pficon-help"
aria-hidden="true"
data-toggle="tooltip"
data-original-title="Optional prefix added to each environment variable name for this resource."></small>
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 "for this resource." since it's a column header with many resources.

I know I'm picking nits on my own suggested wording :)

Copy link
Member

Choose a reason for hiding this comment

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

agree, drop the "for this resource"

{{entry.configMapRef.name}}</span>
<span ng-if="entry.secretRef.name">secret
<span ng-if="entry.prefix">"{{entry.prefix}}"</span>
{{entry.secretRef.name}}</span>
Copy link
Member

Choose a reason for hiding this comment

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

Maybe...?

Use all keys and values from config map my-config-map, adding name prefix "my-prefix-"

@jwforres is better at wording stuff then me, though.

Copy link
Member

Choose a reason for hiding this comment

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

tough to stuff that into one sentence, would probably read better as two.

"Use all keys and values from config map my-config-map. Names will be prefixed with "my-prefix".

placeholder="Add prefix"
id="envfrom-prefix-{{$index}}"
name="envfrom-prefix-{{$index}}"
ng-model="entry.prefix"/>
Copy link
Member

Choose a reason for hiding this comment

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

We usually don't include the self-closing /

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Old habits, can remove

<div class="form-group environment-from-input">
<div class="environment-from-input" ng-if="!$ctrl.isEnvFromReadonly(entry) && $ctrl.hasOptions()">
<label for="envfrom-prefix-{{$index}}" class="sr-only">Prefix</label>
<input type="text"
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 have a pattern with a corresponding validation error. (I'll need to look up the correct regex for prefix.)

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 works, yeah send it over

@spadgett
Copy link
Member

@sg00dwin Can you help with the suggested style changes in #2362? (OK as a separate PR.)

@spadgett
Copy link
Member

Looks like prefix has to match the env name regex

https://github.com/kubernetes/kubernetes/blob/5f030f4568822e791054d5c4c3aff7f9f5c85151/pkg/api/validation/validation.go#L1808-L1812

We're using [A-Za-z_][A-Za-z0-9_]*

@spadgett spadgett added the kind/bug Categorizes issue or PR as related to a bug. label Oct 26, 2017
@openshift-ci-robot openshift-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Oct 27, 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 27, 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 27, 2017
@openshift-ci-robot openshift-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Oct 27, 2017
@cdcabrera
Copy link
Contributor Author

@beanh66 @jwforres @spadgett

Prefix and the modal display, is this something we should try to work in?

screen shot 2017-10-26 at 11 58 53 pm

@spadgett
Copy link
Member

@cdcabrera Are you asking if we should show the prefix in the modal? I would just show the names as they are defined in the secret.

@cdcabrera
Copy link
Contributor Author

@spadgett indeed was wondering if the prefix needed to be displayed in some fashion within the modal itself

Opened envFrom to allow prefix input.
@cdcabrera
Copy link
Contributor Author

cdcabrera commented Oct 27, 2017

@spadgett per request removed the extra component bindings. Should now only have the main ones

  • entries
  • envFromSelectorOptions
  • isReadonly

Also as noted the "ng-pattern" copied over from key/values component misses out on special characters tacked onto the end, corrected it. There's still some funkiness around empty strings that happens on both Key/Values and EnvFrom

@sg00dwin your styling updates have been merged into this PR

@cdcabrera cdcabrera changed the title [WIP] Allow EnvFrom Prefix Allow EnvFrom Prefix Oct 27, 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 27, 2017
@spadgett
Copy link
Member

I feel like in read-only mode we should use the same two column display instead of trying to write things out as sentences. Also I don't think we need to use break-all, which breaks in the middle of words when not needed. We might look at this as a follow on, however, to get the blocker fixed.

openshift web console - private browsing 2017-10-30 09-24-34

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.

Code looks good, and this fixes the fundamental bug. We can look at any additional changes to presentation as follow-on work.

@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 30, 2017
@openshift-merge-robot
Copy link
Contributor

Automatic merge from submit-queue.

@openshift-merge-robot openshift-merge-robot merged commit 39494d0 into openshift:master Oct 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Need to handle envFrom prefix
5 participants