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

Save login mode into cookie #5246

Merged
merged 1 commit into from
Jun 12, 2020
Merged

Conversation

shu-mutou
Copy link
Contributor

And use it next time if it exists.

Fixes #5210

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jun 10, 2020
@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 10, 2020
@@ -36,7 +36,7 @@ enum LoginModes {
})
export class LoginComponent implements OnInit {
loginModes = LoginModes;
selectedAuthenticationMode = LoginModes.Kubeconfig;
selectedAuthenticationMode = localStorage.selectedAuthenticationMode;
Copy link
Member

Choose a reason for hiding this comment

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

Use cookie service and save it in a cookie. Try to avoid using things that are not injected through the constructor. It's harder to follow where they're coming from and it's also harder for the angular build to do a proper tree shaking and other optimizations.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done.

@shu-mutou shu-mutou force-pushed the login-mode branch 2 times, most recently from aa4859d to f9f7676 Compare June 10, 2020 08:36
@shu-mutou shu-mutou changed the title Save login mode into localStorage Save login mode into cookie Jun 10, 2020
@@ -36,7 +37,7 @@ enum LoginModes {
})
export class LoginComponent implements OnInit {
loginModes = LoginModes;
selectedAuthenticationMode = LoginModes.Kubeconfig;
selectedAuthenticationMode = this.cookies_.get('selectedAuthenticationMode') || '';
Copy link
Member

@floreks floreks Jun 10, 2020

Choose a reason for hiding this comment

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

Do not hardcode the name. Add it to the config and inject into the constructor.

@Inject(CONFIG_DI_TOKEN) private readonly config_: Config,

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@codecov
Copy link

codecov bot commented Jun 10, 2020

Codecov Report

Merging #5246 into master will increase coverage by 0.00%.
The diff coverage is 90.90%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #5246   +/-   ##
=======================================
  Coverage   45.51%   45.51%           
=======================================
  Files         214      214           
  Lines       10109    10117    +8     
  Branches      105      107    +2     
=======================================
+ Hits         4601     4605    +4     
- Misses       5239     5243    +4     
  Partials      269      269           
Impacted Files Coverage Δ
src/app/frontend/index.config.ts 100.00% <ø> (ø)
src/app/frontend/login/component.ts 82.50% <90.90%> (+0.55%) ⬆️
src/app/backend/sync/secret.go 70.29% <0.00%> (-2.98%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9168675...46be8b7. Read the comment docs.

@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jun 10, 2020
@floreks
Copy link
Member

floreks commented Jun 10, 2020

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 10, 2020
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed lgtm "Looks good to me", indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jun 11, 2020
And use it next time if it exists.
@shu-mutou
Copy link
Contributor Author

fixed tests

@maciaszczykm
Copy link
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 12, 2020
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: floreks, maciaszczykm, shu-mutou

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [floreks,maciaszczykm,shu-mutou]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot merged commit 13aafe3 into kubernetes:master Jun 12, 2020
@shu-mutou shu-mutou deleted the login-mode branch June 13, 2020 03:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ability to set default login-mode?
4 participants