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

feat(ui): Inject Custom CSS #6282

Closed
wants to merge 8 commits into from
Closed

feat(ui): Inject Custom CSS #6282

wants to merge 8 commits into from

Conversation

dtaniwaki
Copy link
Member

@dtaniwaki dtaniwaki commented Jul 5, 2021

Checklist:

Screen Shot 2021-07-05 at 12 41 58 PM

Fixes #1451

You can test this feature by executing the following commands.

$ kubectl -n argo create configmap custom-css --from-literal "custom.css=.nav-bar { background-color: #2196f3; }"
$ kubectl -n argo patch configmap workflow-controller-configmap -p '{"data":{"ui.cssurl":"./extra/custom.css"}}'
$ kubectl -n argo patch deployment argo-server -p '{"spec":{"template":{"spec":{"containers":[{"name":"argo-server","args":["server", "--secure=false", "--auth-mode=hybrid", "--extra-files-dir=/shared/app/custom"], "volumeMounts": [{"name": "custom-css", "mountPath": "/shared/app/custom"}]}], "volumes": [{"name":"custom-css", "configMap": {"name": "custom-css"}}]}}}}'

@dtaniwaki dtaniwaki changed the title [WIP] Inject Custom CSS URL [WIP] Inject Custom CSS Jul 5, 2021
Signed-off-by: Daisuke Taniwaki <[email protected]>
@codecov

This comment was marked as resolved.

dtaniwaki added 4 commits July 5, 2021 19:09
Signed-off-by: Daisuke Taniwaki <[email protected]>
Signed-off-by: Daisuke Taniwaki <[email protected]>
Signed-off-by: Daisuke Taniwaki <[email protected]>
@dtaniwaki dtaniwaki marked this pull request as ready for review July 5, 2021 13:48
@dtaniwaki dtaniwaki requested a review from jessesuen as a code owner July 5, 2021 13:48
@dtaniwaki dtaniwaki changed the title [WIP] Inject Custom CSS Inject Custom CSS Jul 5, 2021
@dtaniwaki dtaniwaki changed the title Inject Custom CSS feat(server): Inject Custom CSS Jul 5, 2021
@dtaniwaki dtaniwaki changed the title feat(server): Inject Custom CSS feat(ui): Inject Custom CSS Jul 5, 2021
@@ -6,29 +6,27 @@ import (
"strings"
)

var (
extraPath = "/extra/"
Copy link
Member Author

Choose a reason for hiding this comment

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

Any good path for extra files?

@dtaniwaki
Copy link
Member Author

dtaniwaki commented Jul 5, 2021

I updated the code so the server won't return 304 on removed extra files.

@alexec
Copy link
Contributor

alexec commented Jul 5, 2021

I suggest doing this different.

  1. Add a new field to GetInfo called “env”. This can be “dev” , “e2e” or “prod”.
  2. Use this to load a CSS file based on the name. Eg dev.css
  3. Bundle CSS using those conventional names.
  4. Add a new parameter to Argo server, “—env” or “ARGO_ENV”.
  5. Display that value below the version number top left.

This would be less flexible, but flexible enough.
It would be secure.
It would be simple, I think we’d use it.

@dtaniwaki
Copy link
Member Author

Thank you for your suggestion. I have 2 questions for the env idea.

What env should we use for a locally running argo server?

We could have 2 argo servers with different instance ID in the production. Should we use different env names like prod_1 and prod_2?

@dtaniwaki
Copy link
Member Author

dtaniwaki commented Jul 6, 2021

By the way, as for the env-like name, I injected it by the following CSS.

    .nav-bar {
      background-color: #3f51b5;
    }
    .nav-bar__logo::before {
      content: 'stg';
      color: white;
      text-align: center;
      display: block;
    }

And got the following result.

Screen Shot 2021-07-06 at 10 55 04 PM

@dtaniwaki
Copy link
Member Author

dtaniwaki commented Jul 6, 2021

However, the env idea is also good. I'd like to hear other people's thoughts too.

Copy link
Contributor

@alexec alexec left a comment

Choose a reason for hiding this comment

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

See comments.

@dtaniwaki
Copy link
Member Author

Hmm... No other comments.

@jessesuen Do you have any thought about the compatibility with ArgoCD?

Copy link
Contributor

@alexec alexec left a comment

Choose a reason for hiding this comment

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

I'd like to revisit this. I like the idea of applying different CSS depending on the environment (e.g. production vs pre-production) or organisation (e.g. dev-ops vs stream processing or other part of your org).

There is a risk of combinatorial explosion of different CSS. So I think we should have themes. E.g. "dark" and "light" and supply the CSS with the app.

Don't worry about Argo CD compatibility. We don't aim for that except in patterns and style.

@stale
Copy link

stale bot commented Oct 27, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Oct 27, 2021
@stale stale bot closed this Nov 7, 2021
@kenchan0130
Copy link

Is there any progress on this?
I'd like to apply CSS with values as well as Argo CD.

@alexec
Copy link
Contributor

alexec commented Nov 17, 2021

This appears to have bene abandoned. Would you like to pick up the work?

@tooptoop4
Copy link
Contributor

where @dtaniwaki

@agilgur5 agilgur5 added area/ui problem/stale This has not had a response in some time area/server labels Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/server area/ui problem/stale This has not had a response in some time
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UI: Add ability to visually distinguish between deployment environments
5 participants