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

global: environment labeling #227

Merged

Conversation

FlorianCassayre
Copy link
Member

@FlorianCassayre FlorianCassayre commented Oct 7, 2020

Displays a label on all pages indicating the current environment that is being run. If production nothing is displayed. The environment type can be set in .env by setting a value to REACT_APP_ENV_NAME. The currently supported values are development, preprod and production. An empty value is considered as a development environment. The component in charge of this can be overridden to support more environment types, along with their label.

Development environment

Frontsite

image

Login

image

Backoffice

image

Pre-prod / QA

image

(ditto for the two other ends)

Copy link
Contributor

@ntarocco ntarocco left a comment

Choose a reason for hiding this comment

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

super nice thank you!


const EnvironmentLabelComponent = ({ pointing, ...uiProps }) => {
const environment = process.env.REACT_APP_ENV_NAME;
if (!environment || environment === 'development') {
Copy link
Contributor

Choose a reason for hiding this comment

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

I would propose to put by default our envs, so we don't have to override :)
or maybe you can add to the invenioConfig.APP a new obj/list with all the possible envs, e.g.:

invenioConfig.APP.environments: [{
  name: 'dev',
  text: 'Dev environment',
  color: 'blue'
 icon: ...
}]

and then here:

env = invenioConfig.APP.environments.filter(env => env.name === process.env.REACT_APP_ENV_NAME);
return (
      <EnvironmentLabelLayout
        icon="code"
        text="Development environment"
        color="blue"
        pointing={pointing}
        {...uiProps}
      />
    );
...

in CDS-ILS, we will have only to add the config.
WDYT?

I will add now the var REACT_APP_ENV_NAME to the deployment

Copy link
Member Author

Choose a reason for hiding this comment

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

What REACT_APP_ENV_NAME name did you use in the end? So that we align.

Edit: sandbox

Copy link
Contributor

@ntarocco ntarocco left a comment

Choose a reason for hiding this comment

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

If we want to make more visible, maybe we can add a colored very thick line on the very top?

(sorry for the bad screenshot, but it is just do explain what I mean...)
CERN_TS

},
},
{
name: 'qa',
Copy link
Contributor

Choose a reason for hiding this comment

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

In CDS-ILS this will be called sandbox, and prod not sure yet between prod and production. If you keep qa here, please create a PR in CDS-ILS to override the config

Copy link
Contributor

Choose a reason for hiding this comment

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

If we go with the red maybe we can take a bit less eyes hurting shade? :)

Copy link
Member Author

Choose a reason for hiding this comment

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

Will update qa to sandbox. For the naming I would personally go for production and development, to match sandbox.

@FlorianCassayre
Copy link
Member Author

I came up with the following:

{
  name: 'production',
  display: {
    roles: ['admin'],
    text: 'Production environment',
    color: 'red',
    icon: 'warning',
  },
}

Production will be highlighted to logged-in admins only.

image

The other environment configurations (development and sandbox) are left untouched and will be highlighted regardless of the role.

@ntarocco ntarocco merged commit 304f854 into inveniosoftware:master Oct 9, 2020
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

3 participants