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

ui: style login page #26066

Merged
merged 12 commits into from
Jun 7, 2018
Merged

ui: style login page #26066

merged 12 commits into from
Jun 7, 2018

Conversation

couchand
Copy link
Contributor

@couchand couchand commented May 24, 2018

Adds some initial styling to the login page and the login indicator in the navigation sidebar.

Sidebar:
screen shot 2018-05-29 at 1 59 44 pm

Login page:
screen shot 2018-06-04 at 4 28 40 pm

Login page with error:
screen shot 2018-06-04 at 4 45 40 pm

Insecure mode (temporary design):
screen shot 2018-06-04 at 5 10 56 pm

Closes #24939.

@couchand couchand added the do-not-merge bors won't merge a PR with this label. label May 24, 2018
@couchand couchand requested a review from a team May 24, 2018 21:35
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@couchand couchand force-pushed the feature/login-styling branch from 0e1c6a0 to 893f64d Compare May 29, 2018 18:01
@couchand couchand changed the title [WIP] ui: style login page ui: style login page May 29, 2018
@couchand couchand removed the do-not-merge bors won't merge a PR with this label. label May 29, 2018
@couchand
Copy link
Contributor Author

cc @josueeee for design review

@vilterp
Copy link
Contributor

vilterp commented May 29, 2018

:lgtm: with a couple non-blocking nits. Tested locally.

Would be good to disable the button while the login api call is happening, and change the text to "signing in..." or something.

Spacing in the text box seems a bit excessive: ✂-1


Review status: all files reviewed at latest revision, all discussions resolved, all commit checks successful.


pkg/ui/src/views/login/loginPage.tsx, line 67 at r3 (raw file):

    let message = "Invalid username or password.";
    if (error.message !== "Unauthorized") {

Can you add a comment noting why have to look at the response body (generated somewhere in the depths of grpc-gateway or net/http or somewhere), and not the status code?

I'm ok with doing this for now, but we should leave clues for our future selves to fix this.


Comments from Reviewable

@vilterp
Copy link
Contributor

vilterp commented May 29, 2018

Also, what does the sidebar look like in insecure mode?


Review status: all files reviewed at latest revision, 1 unresolved discussion, all commit checks successful.


Comments from Reviewable

@couchand
Copy link
Contributor Author

couchand commented Jun 4, 2018

Review status: all files reviewed at latest revision, 1 unresolved discussion, some commit checks failed.


pkg/ui/src/views/login/loginPage.tsx, line 67 at r3 (raw file):

Previously, vilterp (Pete Vilter) wrote…

Can you add a comment noting why have to look at the response body (generated somewhere in the depths of grpc-gateway or net/http or somewhere), and not the status code?

I'm ok with doing this for now, but we should leave clues for our future selves to fix this.

It's just here:

throw Error(res.statusText);

But now that I've made a bunch of these hacks all over maybe it's time I actually fix it.


Comments from Reviewable

@couchand couchand force-pushed the feature/login-styling branch from 893f64d to 522ed74 Compare June 4, 2018 20:44
@couchand couchand requested review from a team June 4, 2018 20:44
@couchand couchand added the do-not-merge bors won't merge a PR with this label. label Jun 4, 2018
@couchand couchand force-pushed the feature/login-styling branch from 522ed74 to d43824c Compare June 4, 2018 21:21
@couchand couchand removed the do-not-merge bors won't merge a PR with this label. label Jun 4, 2018
@couchand
Copy link
Contributor Author

couchand commented Jun 4, 2018

Ready to go @vilterp PTAL

Copy link
Contributor

@vilterp vilterp left a comment

Choose a reason for hiding this comment

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

Don't see insecure indicator in insecure mode. Otherwise looks good.

@@ -70,7 +71,13 @@ function LoginIndicator({ loginState, handleLogout }: LoginIndicatorProps) {
}

if (!loginState.loginEnabled()) {
return (<div className="login-indicator">Insecure mode</div>);
return (
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't see this indicator when I start a cluster in insecure mode. Just blank space above the cockroach icon.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Are you sure you had the environment variable set? I am seeing it...

@@ -1928,6 +1928,7 @@ func serveUIAssets(fileServer http.Handler, cfg Config) http.Handler {
tmplArgs := ui.IndexHTMLArgs{
ExperimentalUseLogin: cfg.EnableWebSessionAuthentication,
LoginEnabled: cfg.RequireWebSession(),
Tag: build.GetInfo().Tag,
Copy link
Contributor

Choose a reason for hiding this comment

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

looks like this is what broke the ServeIndexHTML test in CI. It's pretty brittle — asserts the exact HTML that comes out. Not sure how to make that always pass, since the build tag will keep changing… Maybe can just sprintf it into the expected HTML.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Tests updated.

import LoginPage from "src/views/login/loginPage";

export const LOGIN_PAGE = "/login";
export const LOGOUT_PAGE = "/logout";

export default function(store: Store<AdminUIState>): JSX.Element {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I don't like exporting anonymous functions; prefer to give them names (I think you can still export them in the same statement; maybe need an export statement below). Always giving functions names makes them easier to grep for and find via stack traces (as if we ever have reasonable stack traces… 😢 but that's a separate issue)

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

>
{ user[0] }
</div>
<Link to="/logout" onClick={handleLogout}>Sign Out</Link>
Copy link
Contributor

Choose a reason for hiding this comment

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

was gonna suggest that you make the whole thing clickable, but maybe the log out button should be pretty small so you don't click it accidentally.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep. Maybe one day we'll have a user menu of some kind?!

couchand added 11 commits June 7, 2018 11:04
Add some initial styling to the login page.

Contributes to cockroachdb#24939.

Release note: None
Add some styling and clean up the error text on login page.

Contributes to cockroachdb#24939.

Release note: None
Adds some initial styling to the login indicator on the navigation sidebar.

Release note: None
An explicit logout route can be useful, so this adds one.

Release note: None
Some TypeScript errors slipped through due to cockroachdb#26255.  This fixes them.

Release note: None
This will get shown on the login page.

Release note: None
This updates the login page styling to the latest designs.

Release note: None
This is temporary styling for the insecure mode indicator.  A final design will
be implemented later, but this will hold us over for now.

Release note: None
@craig craig bot requested review from a team June 7, 2018 16:06
@craig craig bot requested a review from a team as a code owner June 7, 2018 16:06
@craig craig bot requested review from a team June 7, 2018 16:06
@couchand couchand force-pushed the feature/login-styling branch from d43824c to de8d6f1 Compare June 7, 2018 16:06
@couchand couchand removed request for a team June 7, 2018 16:07
@vilterp
Copy link
Contributor

vilterp commented Jun 7, 2018

Ah, started in insecure mode with the flag and I see the indicator now. LGTM!

@couchand
Copy link
Contributor Author

couchand commented Jun 7, 2018

bors r+

craig bot pushed a commit that referenced this pull request Jun 7, 2018
26066: ui: style login page r=couchand a=couchand

Adds some initial styling to the login page and the login indicator in the navigation sidebar.

Sidebar:
<img width="710" alt="screen shot 2018-05-29 at 1 59 44 pm" src="https://user-images.githubusercontent.com/793969/40676560-110e3a7e-6349-11e8-812a-9c8e682f5670.png">

Login page:
<img width="1274" alt="screen shot 2018-06-04 at 4 28 40 pm" src="https://user-images.githubusercontent.com/793969/40940739-c0c6eb10-6816-11e8-9b24-8a0b492239b3.png">

Login page with error:
<img width="1277" alt="screen shot 2018-06-04 at 4 45 40 pm" src="https://user-images.githubusercontent.com/793969/40940744-c4cb2d66-6816-11e8-90d4-d8b3c52927b6.png">

Insecure mode (temporary design):
<img width="161" alt="screen shot 2018-06-04 at 5 10 56 pm" src="https://user-images.githubusercontent.com/793969/40942388-016f9478-681c-11e8-929c-36d0b7aa7463.png">

Closes #24939.

Co-authored-by: Andrew Couch <[email protected]>
account access and password restoration.
</p>
<p className="aside">
<a href={docsURL("admin-ui-overview.html")} className="docs-link">
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

@Amruta-Ranade will this link change?

@craig
Copy link
Contributor

craig bot commented Jun 7, 2018

Build succeeded

@craig craig bot merged commit de8d6f1 into cockroachdb:master Jun 7, 2018
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.

3 participants