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

Improve UI for schema requests per topic #1592

Closed
programmiri opened this issue Aug 9, 2023 · 1 comment · Fixed by #1599
Closed

Improve UI for schema requests per topic #1592

programmiri opened this issue Aug 9, 2023 · 1 comment · Fixed by #1599
Assignees
Labels
Backend Backend tasks Frontend Relates to coral (react app)

Comments

@programmiri
Copy link
Contributor

Description

When a user is on the topic details view / schema, we show a "button" "Request new version/schema". It's a link to the schema request form and it will add the environment to a query:

1

(please note that the environment for the topic is TST while the related schema environment is TST_SCH -> this is intentionally and will be fixed at some point, we're using the schema-env for the forms at the moment, bc the endpoints still expect them, but will switch to using one env for all)

This env (TST_SCH) is passed to be used as prefilled readonly value in the request-schema form. To make sure we're using a correct environment, we're calling endpoint /getEnvsForSchemaRequests and see if the id or name of the environment is a valid one. If not, we'll redirect the user back to where they come from:

queryFn: () => getEnvironmentsForSchemaRequest(),
    onSuccess: (environments) => {
      if (presetEnvironment) {
        const validEnv = environments.find(
          (env) =>
            presetEnvironment === env.id || presetEnvironment === env.name
        );

        // Allows to pass environment name as well as environment id as search param
        if (validEnv && isNaN(Number(presetEnvironment))) {
          form.setValue("environment", validEnv.id);
          return;
        }

        if (validEnv === undefined) {
          navigate(-1);
        }
      }
    },

This is correct - we want to make sure that a user can only fill out and sent the form with a valid env from the URL and not for example use an old link with an env that is no longer valid (or try to just change the value in the url).

BUT we've enabled superadmin user in Klaw to add a lot of settings (which is good 😅 ),. One of those is that superadmin can prevent user from being to able to make a schema request against an environment and instead enforce them to create a schema at the lowest env and work their way up (aka promote the schema).

We want to make that more clear in the UI:

  • the endpoint /getSchemaOfTopic will add a property to SchemaOverview to determine if a user can actually request a schema on a higher env or if this schema is "promoteable only" (naming will backend do better than me :D)
  • if this is implemented, the UI will use this property to decide wether to show the button OR a short information about why the button is missing (input from @harshini-rangaswamy is needed for a good text and Mustafa for a useful layout)
@programmiri programmiri added Backend Backend tasks Frontend Relates to coral (react app) labels Aug 9, 2023
@programmiri programmiri added this to the Klaw Release 2.5 milestone Aug 9, 2023
@programmiri
Copy link
Contributor Author

programmiri commented Aug 11, 2023

BE part: #1596, #1598

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backend Backend tasks Frontend Relates to coral (react app)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants