* chore: add prettier as a dev dependency
The project has a .prettierrc, so seems to depend on that for its
formatting, but there was no prettier installed with the node modules.
* chore: add autofocus to all clearly defined first inputs on dialogs.
* fix: wrap the disable env input in a form and give it autofocus.
* fix: submit form when pressing enter
* fix: only autofocus the submit button if there is no other content.
When multiple (enabled) elements have the autofocus attribute, the
browser picks the last element in the tree. This means that if there
is a form with a text input with autofocus and a submit button with
autofocus, the button will win, causing the user to have to tab back up.
Only doing this if there are no children will cause some changes,
however:
Dialogs with textual children will no longer focus the accept-button
when appearing.
However, dialogs such as the create new api token dialog will give the
focus to the first input field instead of to the create button.
* fix: add formId prop to dialog element; adapt behavior
If the component receives a form id, it will treat the primary button
as the submit button for that form. To stop a full page reload, we
call the `preventDefault` on the submit event before calling the handler.
* chore: remove redundant spacing in component.
* fix: hook environment disable form up with the new form id system.
* chore: Update existing modal forms to pass in formId
* fix: Type the dialog event wrapper
* fix: change 'allows' => 'allow' because the noun is pluralized.
* fix: add autofocus to js add-tag-dialog-component.
I've got a feeling this component isn't in use anymore, though, as the
exact same text appears in a TS-version of this component.
* fix: add autofocus to add user form.
This seems to only be used as the main piece of a modal, so adding
autofocus seems pretty safe here, but I could be wrong.
* fix: Update snapshot test after changing wording.
* fix: add autofocus to update user form
* fix: add autofocus to the create toggle form.
This is a little besides the task's actual point. However! This form
is only ever used on the page where it's the only bit of content. I'd
argue that when the user navigates to this form, it's because they
want to create a feature. Thus, adding autofocus to the first field
makes a lot of sense to me.
* refactor: set button type to 'undefined' when it isn't 'submit'
This allows Material to use their default type based on whatever
heuristics they use. It's most likely going to be 'button' for the
foreseeable future, but in the event that they change it, passing
undefined instead should future-proof this a bit.
* fix: set type to button when formId is not present
Co-authored-by: Fredrik Strand Oseberg <fredrik.no@gmail.com>
* task: Add buttons for deleting/editing a constraint
* task: Improve look and feel of constraints buttons
- Make constraints fill their container
- Move constraint buttons to material ui buttons
- Move constraint buttons to top right of their container
* fix: adjust positioning
* fix: added project id to permissin button
* fix: add correct permission
* fix: update create feature path
Co-authored-by: Simon Hornby <simon@getunleash.ai>
Co-authored-by: Fredrik Oseberg <fredrik.no@gmail.com>