-
Notifications
You must be signed in to change notification settings - Fork 231
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
Warn when secret keys are not valid env var names #2039
Conversation
<label class="add-choice" for="mountVolume"> | ||
<input type="radio" ng-model="ctrl.addType" value="volume" ng-disabled="ctrl.disableInputs"> | ||
<label class="add-choice" for="volume"> | ||
<input id="volume" type="radio" ng-model="ctrl.addType" value="volume" ng-disabled="ctrl.disableInputs"> |
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.
If the <label>
element wraps the <input>
, you don't need the for
and id
attributes.
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.
If I remove it then clicking on the label does not toggle the radio. It's hard to click on just the little radio button.
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.
Really? Hm. It seems to work here, but maybe browser specific?
https://getbootstrap.com/docs/3.3/css/#checkboxes-and-radios
OK to leave if it's 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.
You're right, dunno what I was doing wrong before...
</label> | ||
<div class="alert alert-warning env-warning" ng-show="ctrl.invalidEnvVars.length"> | ||
<span class="pficon pficon-warning-triangle-o"></span> | ||
<span>Some of the keys for secret <strong>{{ctrl.secret.metadata.name}}</strong> are not valid environment variable names and will not be added.</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.
Looks like you have two periods
Environment variables | ||
</label> | ||
<div class="alert alert-warning env-warning" ng-show="ctrl.invalidEnvVars.length"> | ||
<span class="pficon pficon-warning-triangle-o"></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.
aria-hidden="true"
if (!keyValidator.test(nextKey)) { | ||
ctrl.invalidEnvVars.push(nextKey); | ||
} | ||
}); |
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.
If you only care if some key is invalid, this could be
ctrl.hasInvalidEnvVars = _.some(ctrl.secret.data, function(value, key) {
return !keyValidator.test(key);
});
Otherwise, I'd probably avoid the extra keys
call by using
_.each(ctrl.secret.data, function(value, key) {
if (!keyValidator.test(key)) {
ctrl.invalidEnvVars.push(key);
}
});
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.
Yeah, I was going do do that but wasn't sure if we wanted to be able to list the invalid keys at some point. Thoughts?
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.
Still working on getting the validator to work correctly.
var keyValidator = new RegExp("[A-Za-z_][A-Za-z0-9_]*");
is allowing 'database-name' (as well as 'database=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.
Maybe
var keyValidator = new RegExp("^[A-Za-z_][A-Za-z0-9_]*$");
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 believe I've got it working with:
var keyValidator = new RegExp("^[A-Za-z_]{1}[A-Za-z0-9_]{0,}$");
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.
Isn't *
OK instead of {0,}
?
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.
Yes, it is. Got carried away with some other attempts... ;)
eb34522
to
381269a
Compare
Believe I have addressed all of @spadgett's comments. |
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.
LGTM, thanks @jeff-phillips-18
Thanks @jeff-phillips-18 the new visuals look great 👍 |
[merge][severity: bug] |
[Test]ing while waiting on the merge queue |
Evaluated for origin web console test up to 381269a |
Origin Web Console Test Results: FAILURE (https://ci.openshift.redhat.com/jenkins/job/test_pull_request_origin_web_console/160/) (Base Commit: 375e384) (PR Branch Commit: 381269a) |
[merge][severity: bug] |
WebDriver flake [merge][severity:bug] |
[merge][severity:bug] |
1 similar comment
[merge][severity:bug] |
Evaluated for origin web console merge up to 381269a |
Origin Web Console Merge Results: SUCCESS (https://ci.openshift.redhat.com/jenkins/job/merge_pull_request_origin_web_console/168/) (Base Commit: ca54bec) (PR Branch Commit: 381269a) (Extended Tests: bug) |
fixes #2029
@beanh66