-
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
Add the ability to add a secret to an application #2021
Conversation
app/styles/_secrets.less
Outdated
@@ -98,3 +98,51 @@ dl.secret-data { | |||
margin-bottom: 10px; | |||
} | |||
} | |||
|
|||
.add-secret-to-application { |
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: alpha. This rule should come first.
app/styles/_secrets.less
Outdated
} | ||
} | ||
.form-group > label { | ||
font-size: 14px; |
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 variable (e.g., @font-size-base + 1) so font sizes stay customizable.
<form name="addToApplicationForm" novalidate> | ||
<fieldset ng-disabled="disableInputs"> | ||
<div class="form-group"> | ||
<label>Add this secret to application:</label> |
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.
Ideally label elements get a for attribute to associate them with the input they are for (here and throughout the file).
</div> | ||
</div> | ||
<div class="form-group"> | ||
<label>Add secret as:</label> |
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.
Semantically, this would be better as a legend element inside of a fieldset. Not sure we have styling for that...
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.
Thanks @jeff-phillips-18. In a follow on, I'd like to generalize this so we can use it for config maps, too, since they also work with envFrom
and volumes.
(Not necessary for this PR.)
statefulSets = _.toArray(statefulSetData.by('metadata.name')); | ||
sortApplications(); | ||
}); | ||
}; |
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're doing this now in enough places now that it would be good to put this logic into a separate service (ApplicationsService?).
Not for this PR, though.
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.
Heh, I thought the same and started working on it but I ran out of time to make the change.
Added issue: openshift/origin-web-common#175
}; | ||
|
||
// For each container, add the new volume mount. | ||
_.each(podTemplate.spec.containers, function(container) { |
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 open a follow on for letting the user pick containers if there's more than one.
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.
Added #2024
// For each container, add the new volume mount. | ||
_.each(podTemplate.spec.containers, function(container) { | ||
container.envFrom = container.envFrom || []; | ||
container.envFrom.push(newEnvFrom); |
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 call angular.copy
before we start changing the resource. Otherwise it mutates an object that's in the DataService cache
if (ctrl.addType === 'env') { | ||
var newEnvFrom = { | ||
secretRef: ctrl.secret.metadata | ||
}; |
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 prefer only adding valid API fields, even if other metdata is ignored. So
var newEnvFrom = {
secretRef: {
name: ctrl.secret.metadata.name
}
};
}); | ||
} else { | ||
var generateName = $filter('generateName'); | ||
var name = generateName('volume-'); |
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.
It might be better to use the secret name as the generateName prefix so it's more obvious what the volume is for.
app/views/browse/secret.html
Outdated
@@ -32,6 +38,8 @@ <h1 class="contains-actions"> | |||
</li> | |||
</ul> | |||
</div> | |||
<div class="pull-right" ng-hide="!('secrets' | canIDoAny)"> |
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 probably just remove the canIDoAny
check if "Add to Application" is always enabled. Otherwise we need to update the canIDoAny
filter for 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.
Sorry this was a left over empty div.
NotificationsService.addNotification({ | ||
type: "success", | ||
message: "Successfully added " + sourceKind + " " + ctrl.secret.metadata.name + " to " + targetKind + " " + ctrl.application.metadata.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.
Might be nice to link to the deployment config here.
93fb759
to
fd6cb24
Compare
@rhamilto Addressed your issues. Also noticed the placement of the volume input did not match the design, updated: |
fd6cb24
to
efbb650
Compare
@spadgett I believe I have addressed your issues. Thanks! |
message: "Successfully added " + sourceKind + " " + ctrl.secret.metadata.name + " to " + targetKind + " " + applicationToUpdate.metadata.name + ".", | ||
links: [{ | ||
href: Navigate.resourceURL(applicationToUpdate), | ||
label: "View " + targetKind |
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: better to call humanizeKind(applicationToUpdate.kind, true)
to get title case. This is consistent with our other notification links.
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.
Fixed
[merge] |
[Test]ing while waiting on the merge queue |
efbb650
to
c9f4d62
Compare
Evaluated for origin web console test up to c9f4d62 |
Origin Web Console Test Results: FAILURE (https://ci.openshift.redhat.com/jenkins/job/test_pull_request_origin_web_console/145/) (Base Commit: a6bf807) (PR Branch Commit: c9f4d62) |
Evaluated for origin web console merge up to c9f4d62 |
Origin Web Console Merge Results: SUCCESS (https://ci.openshift.redhat.com/jenkins/job/merge_pull_request_origin_web_console/137/) (Base Commit: 5688784) (PR Branch Commit: c9f4d62) |
@beanh66