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 namespace picker to service account tab on membership page #1213

Conversation

benjaminapetersen
Copy link
Contributor

Fix #1191
Fix #850

@jwforres @spadgett

screen shot 2017-02-01 at 2 14 05 pm

mobile:

screen shot 2017-02-01 at 2 13 53 pm

@benjaminapetersen
Copy link
Contributor Author

Is it necessary to watch service accounts rather than list? I don't know how common it is to manipulate them.

@benjaminapetersen benjaminapetersen force-pushed the issue-1191-default-service-account branch from 871d64c to 21d7698 Compare February 1, 2017 19:17
@spadgett
Copy link
Member

spadgett commented Feb 1, 2017

Suggest making the selects

[my-project       v] / [service-account v]

mirroring how we display them above. We do something similar with image streams. Should be able to take up two columns since there will be no assigned roles, right?

@openshift-bot openshift-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 1, 2017
.then(function(resp) {
var serviceAccounts = _.map(resp.by('metadata.name'), function(sa) {
return sa.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.

Maybe

var serviceAccountNames = _.keys(resp.by('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.

Should we remove service accounts from the list that already have roles above?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Doesn't matter to me, the update will put the 2nd role on the SA either way. Prefer to eliminate it from the dropdown?

Copy link
Member

Choose a reason for hiding this comment

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

Prefer to eliminate it from the dropdown?

I think so to avoid confusion. Probably want to sort as well.

var serviceAccountNames = _.keys(resp.by('metadata.name')).sort();



DataService
.list('serviceaccounts', requestContext)
Copy link
Member

Choose a reason for hiding this comment

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

Don't we need to be getting service accounts from the selected namespace? Won't this only get the service accounts from the current namespace?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah thats helpful. I have the ability to enter an unlisted, but should def request & update whenever the namespace changes.

<div
ng-if="newBinding.kind === 'ServiceAccount'"
class="service-account-namespace hidden-sm hidden-md hidden-lg"
class="service-account-name pad-bottom-sm"
aria-hidden="true">
Copy link
Member

Choose a reason for hiding this comment

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

Why is this aria-hidden?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch, I need to remove that tag now as I previously had 2 <ui-select> for namespace, but now only have 1.

</ui-select-choices>
</ui-select>
</div>
&nbsp;
Copy link
Member

Choose a reason for hiding this comment

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

Why the non-breaking space? If we need whitespace, we should use CSS

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, to keep the flex from collapsing completely, habit, I think its irrelevant, I'll remove & the extra axis stuff.

@spadgett spadgett self-assigned this Feb 1, 2017
@benjaminapetersen
Copy link
Contributor Author

@spadget on this:

[my-project       v] / [service-account v]

& your comments on #850, I like the 2 columns side-by-side, but it will put the 2nd select back under the 'Roles' heading... any concerns?

@benjaminapetersen
Copy link
Contributor Author

WIP, updated to refresh the service accounts list to match the selected project:
screen shot 2017-02-02 at 5 12 47 pm

@jwforres
Copy link
Member

jwforres commented Feb 2, 2017 via email

@benjaminapetersen benjaminapetersen force-pushed the issue-1191-default-service-account branch 2 times, most recently from 4a45b7d to 310723c Compare February 3, 2017 16:24
@benjaminapetersen
Copy link
Contributor Author

Tablet / mobile:
screen shot 2017-02-03 at 11 15 09 am
screen shot 2017-02-03 at 11 15 30 am

There is a spot between tablet & larger screens where multiple roles added to a user/SA can cause some layout wobble. Is unrelated to this change, so I'll create an issue & get to work on tweaking that.

@spadgett ready for another pass

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.

A few small comments.

I noticed that I won't be able to add a service account from a namespace I don't have access to. That can be a follow-on if not a new limitation, although I don't see a reason to block it.

DataService
.list('serviceaccounts', ctx)
.then(function(resp) {
var serviceAccounts = _.keys(resp.by('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.

Maybe

_.keys(resp.by('metadata.name')).sort();

so the list is sorted?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah sounds good.

var projects = _.map(resp.by('metadata.name'), function(project) {
return project.metadata.name;
});
var projects = _.keys(resp.by('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.

var projects = _.keys(resp.by('metadata.name')).sort();

?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good catch, will update!

repeat="saName in serviceAccounts | filter: $select.search"
refresh="refreshServiceAccounts($select.search)"
refresh-delay="200">
<div>{{saName}}</div>
Copy link
Member

Choose a reason for hiding this comment

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

<div ng-bind-html="saName | highlight : $select.search"></div>

Copy link
Member

Choose a reason for hiding this comment

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

Probably should add this to the project select above, too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nice, ill add.

type="text"
class="form-control input-name"
placeholder="Name"
ng-model="newBinding.name"
autocorrect="off"
autocapitalize="off"
spellcheck="false">
<!-- namespace entry/picker for service accounts -->
Copy link
Member

Choose a reason for hiding this comment

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

indentation

Copy link
Contributor Author

Choose a reason for hiding this comment

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

got it.

class="select-role">
<ui-select-match
placeholder="Service account">
<span ng-bind="newBinding.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.

Any reason to prefer ng-bind instead of just using the curly braces for expressions?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think I have that because it was part of ui-select docs when i first dropped them in, I'll swap to the {{}}.

@spadgett
Copy link
Member

spadgett commented Feb 3, 2017

Nit: In the very last screenshot, the project/sa selects should probably fill the width like the role select.

@openshift-bot openshift-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 3, 2017
@benjaminapetersen
Copy link
Contributor Author

Agree, this looks better:
screen shot 2017-02-03 at 2 01 29 pm

@benjaminapetersen benjaminapetersen force-pushed the issue-1191-default-service-account branch from 310723c to e46dcaf Compare February 3, 2017 19:06
@benjaminapetersen
Copy link
Contributor Author

updated & rebased.

@spadgett
Copy link
Member

spadgett commented Feb 3, 2017

I noticed when I select a service account then immediately switch back to the users tab, it pre-fills the service account name in the user input. Same if I enter a user and switch to service accounts.

@benjaminapetersen
Copy link
Contributor Author

Hmm. Also a bit of a flicker going back and forth between the SA tab & others as the input appears/disappears.

@benjaminapetersen benjaminapetersen force-pushed the issue-1191-default-service-account branch from e46dcaf to 35980fa Compare February 3, 2017 20:22
- Refresh service accounts list when project/namespace select changes
@benjaminapetersen benjaminapetersen force-pushed the issue-1191-default-service-account branch from 9217e9c to f65cab0 Compare February 3, 2017 20:33
@benjaminapetersen
Copy link
Contributor Author

Updated to clear the name when tabs are changed

@spadgett
Copy link
Member

spadgett commented Feb 3, 2017

Thanks @benjaminapetersen

[merge]

@openshift-bot
Copy link

Evaluated for origin web console merge up to f65cab0

@openshift-bot
Copy link

openshift-bot commented Feb 3, 2017

Origin Web Console Merge Results: SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pull_requests_origin_web_console/1008/) (Base Commit: 16ebed8)

@openshift-bot openshift-bot merged commit aac7d52 into openshift:master Feb 3, 2017
@benjaminapetersen benjaminapetersen deleted the issue-1191-default-service-account branch February 6, 2017 14:33
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.

4 participants