-
Notifications
You must be signed in to change notification settings - Fork 209
[UI] Default fleet in project wizard #3464
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
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
d435a0b
[UI] Default fleet in project wizard #373
olgenn 3c3ae8c
Minor cosmetic changes
peterschmidt85 c0ce9cf
Fixes after review
olgenn a72e91c
Was added create project wizard for oss
olgenn 965359a
Cosmetical changes + help info
peterschmidt85 6dec62a
Was added create fleet wizard
olgenn e8a5661
Fixes after review
olgenn ead8601
Refactoring after review
olgenn d0c938b
Fixes after review
olgenn ab674d7
Fixes after review
olgenn a39ce2e
Cosmetics
peterschmidt85 62db74e
Fixes after review
olgenn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| import type { RootState } from 'store'; | ||
| import { createSlice, PayloadAction } from '@reduxjs/toolkit'; | ||
|
|
||
| import { IProps as ConfirmationDialogProps } from './types'; | ||
|
|
||
| type ConfirmationDialogPropsWithUuid = ConfirmationDialogProps & { uuid: string }; | ||
|
|
||
| type ConfirmationDialogsStata = { | ||
| dialogs: Array<ConfirmationDialogPropsWithUuid>; | ||
| }; | ||
|
|
||
| const initialState: ConfirmationDialogsStata = { | ||
| dialogs: [], | ||
| }; | ||
|
|
||
| export const confirmationSlice = createSlice({ | ||
| name: 'confirmation', | ||
| initialState, | ||
|
|
||
| reducers: { | ||
| open: (state, action: PayloadAction<ConfirmationDialogPropsWithUuid>) => { | ||
| state.dialogs = [...state.dialogs, action.payload]; | ||
| }, | ||
| close: (state, action: PayloadAction<ConfirmationDialogPropsWithUuid['uuid']>) => { | ||
| state.dialogs = state.dialogs.filter((i) => i.uuid !== action.payload); | ||
| }, | ||
| }, | ||
| }); | ||
|
|
||
| export const { open, close } = confirmationSlice.actions; | ||
|
|
||
| export const selectConfirmationDialogs = (state: RootState) => state.confirmation.dialogs; | ||
|
|
||
| export default confirmationSlice.reducer; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| @use '@cloudscape-design/design-tokens/index' as awsui; | ||
|
|
||
| .labelWithInfo { | ||
| display: inline-flex; | ||
| align-items: center; | ||
| } | ||
|
|
||
| .divider { | ||
| display: inline-block; | ||
| height: 16px; | ||
| border-left: 1px solid awsui.$color-border-divider-default; | ||
| margin: 0 8px; | ||
| } | ||
|
|
||
| .info { | ||
| display: inline-flex; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| import React from 'react'; | ||
| import { Controller, FieldValues } from 'react-hook-form'; | ||
| import FormField from '@cloudscape-design/components/form-field'; | ||
| import ToggleCSD from '@cloudscape-design/components/toggle'; | ||
|
|
||
| import { FormToggleProps } from './types'; | ||
|
|
||
| import styles from './index.module.scss'; | ||
|
|
||
| export const FormToggle = <T extends FieldValues>({ | ||
| name, | ||
| control, | ||
| rules, | ||
| label, | ||
| info, | ||
| constraintText, | ||
| description, | ||
| secondaryControl, | ||
| stretch, | ||
| leftContent, | ||
| toggleLabel, | ||
| onChange: onChangeProp, | ||
| toggleDescription, | ||
| toggleInfo, | ||
| ...props | ||
| }: FormToggleProps<T>) => { | ||
| return ( | ||
| <Controller | ||
| name={name} | ||
| control={control} | ||
| rules={rules} | ||
| render={({ field: { onChange, value, ...fieldRest }, fieldState: { error } }) => { | ||
| return ( | ||
| <FormField | ||
| description={description} | ||
| label={label} | ||
| info={info} | ||
| stretch={stretch} | ||
| constraintText={constraintText} | ||
| secondaryControl={secondaryControl} | ||
| errorText={error?.message} | ||
| > | ||
| {leftContent} | ||
|
|
||
| <ToggleCSD | ||
| {...fieldRest} | ||
| {...props} | ||
| checked={value} | ||
| onChange={(event) => { | ||
| onChange(event.detail.checked); | ||
| onChangeProp?.(event); | ||
| }} | ||
| description={toggleDescription} | ||
| > | ||
| {(toggleLabel || toggleInfo) && ( | ||
| <span className={styles.labelWithInfo}> | ||
| {toggleLabel} | ||
| {toggleLabel && toggleInfo && <span aria-hidden="true" className={styles.divider} />} | ||
| {toggleInfo && ( | ||
| <span | ||
| className={styles.info} | ||
| onClick={(e) => e.stopPropagation()} | ||
| onMouseDown={(e) => e.stopPropagation()} | ||
| onPointerDown={(e) => e.stopPropagation()} | ||
| onKeyDown={(e) => e.stopPropagation()} | ||
| > | ||
| {toggleInfo} | ||
| </span> | ||
| )} | ||
| </span> | ||
| )} | ||
| </ToggleCSD> | ||
| </FormField> | ||
| ); | ||
| }} | ||
| /> | ||
| ); | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| import { ReactNode } from 'react'; | ||
| import { ControllerProps, FieldValues } from 'react-hook-form'; | ||
| import { FormFieldProps } from '@cloudscape-design/components/form-field'; | ||
| import { ToggleProps } from '@cloudscape-design/components/toggle'; | ||
|
|
||
| export type FormToggleProps<T extends FieldValues> = Omit<ToggleProps, 'value' | 'checked' | 'name'> & | ||
| Omit<FormFieldProps, 'errorText'> & | ||
| Pick<ControllerProps<T>, 'control' | 'name' | 'rules'> & { | ||
| toggleDescription?: ReactNode; | ||
| leftContent?: ReactNode; | ||
| toggleLabel?: ReactNode | string; | ||
| toggleInfo?: ReactNode; | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| import { close, open } from 'components/ConfirmationDialog/slice'; | ||
| import { IProps as ConfirmationDialogProps } from 'components/ConfirmationDialog/types'; | ||
|
|
||
| import { getUid } from '../libs'; | ||
| import useAppDispatch from './useAppDispatch'; | ||
|
|
||
| export const useConfirmationDialog = () => { | ||
| const dispatch = useAppDispatch(); | ||
|
|
||
| const onDiscard = (uuid: string) => { | ||
| dispatch(close(uuid)); | ||
| }; | ||
|
|
||
| const openConfirmationDialog = (props: Omit<ConfirmationDialogProps, 'onDiscard'>) => { | ||
| const uuid = getUid(); | ||
|
|
||
| dispatch( | ||
| open({ | ||
| uuid, | ||
| ...props, | ||
| onDiscard: () => onDiscard(uuid), | ||
| }), | ||
| ); | ||
| }; | ||
|
|
||
| return [openConfirmationDialog]; | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confirmation dialog doesn't close after user confirms
High Severity
The
useConfirmationDialoghook wrapsonDiscardto close the dialog but doesn't wraponConfirm. When the user clicks confirm, the originalonConfirmcallback runs but the dialog remains visible becauseclose(uuid)is never dispatched. The dialog will stay open until the user clicks Cancel or dismisses it manually.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
onConfirm was implemented in ConfirmationDialof componentd