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

Add the ability to add a secret to an application #2021

Merged
merged 1 commit into from
Sep 7, 2017

Conversation

jeff-phillips-18
Copy link
Member

@@ -98,3 +98,51 @@ dl.secret-data {
margin-bottom: 10px;
}
}

.add-secret-to-application {
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. This rule should come first.

}
}
.form-group > label {
font-size: 14px;
Copy link
Member

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>
Copy link
Member

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>
Copy link
Member

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...

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.

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();
});
};
Copy link
Member

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.

Copy link
Member Author

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) {
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 open a follow on for letting the user pick containers if there's more than one.

Copy link
Member Author

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);
Copy link
Member

@spadgett spadgett Sep 6, 2017

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
};
Copy link
Member

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-');
Copy link
Member

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.

@@ -32,6 +38,8 @@ <h1 class="contains-actions">
</li>
</ul>
</div>
<div class="pull-right" ng-hide="!('secrets' | canIDoAny)">
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 probably just remove the canIDoAny check if "Add to Application" is always enabled. Otherwise we need to update the canIDoAny filter for secrets.

Copy link
Member Author

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 + "."
});
Copy link
Member

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.

@jeff-phillips-18
Copy link
Member Author

@rhamilto Addressed your issues.

Also noticed the placement of the volume input did not match the design, updated:

image

@jeff-phillips-18
Copy link
Member Author

@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
Copy link
Member

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.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed

@spadgett
Copy link
Member

spadgett commented Sep 6, 2017

[merge]

@openshift-bot
Copy link

[Test]ing while waiting on the merge queue

@openshift-bot
Copy link

Evaluated for origin web console test up to c9f4d62

@openshift-bot
Copy link

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)

@openshift-bot
Copy link

Evaluated for origin web console merge up to c9f4d62

@openshift-bot
Copy link

openshift-bot commented Sep 7, 2017

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)

@openshift-bot openshift-bot merged commit 77a9ae8 into openshift:master Sep 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants