-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Supporting changes for Cloud email invites #32439
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
30 commits
Select commit
Hold shift + click to select a range
fac191d
Add WIP implementation of Teleport email invites
timothyb89 bfa7b05
Bump e ref and add new validation rule
timothyb89 32fcf4a
Various improvements to enable Cloud email invites
timothyb89 f92f373
Merge remote-tracking branch 'origin/master' into timothyb89/teleport…
timothyb89 8f5f9d7
Add support for Cloud collaborator invites during onboarding
timothyb89 8cddab0
Update e ref for the invite-collaborators branch
timothyb89 59c690d
Honor the `inputId` parameter if set
timothyb89 1f5a8e9
bump e ref
timothyb89 8fa63da
Improve typing for `requiredEmailLike` to add a error category
timothyb89 6e2c387
bump e ref
timothyb89 fc6a52b
Destructure the InviteCollaborators component sanely
timothyb89 41a5c41
Set `setDisplayInviteCollaborators` to `null` instead of `false`
timothyb89 1606e3b
Split `FieldSelectCreatable` into its own file
timothyb89 d277405
Merge remote-tracking branch 'origin/master' into timothyb89/teleport…
timothyb89 a9e49a1
Fix lint
timothyb89 36fd61f
Merge remote-tracking branch 'origin/master' into timothyb89/teleport…
timothyb89 b27873c
add story for SelectCreatable
timothyb89 ea21b51
Add tests for `requiredEmailLike`
timothyb89 f784af8
Rename `initial` flag to `invite`
timothyb89 86d0acc
Add tests for invite collaborators feedback and users rendering
timothyb89 79e061d
Add rendering test for the invite collaborators card
timothyb89 68cb212
Clean up lints
timothyb89 499b0f6
Rename types.tsx -> shared.tsx
timothyb89 c5ff2cb
Relocate invite constant to `Welcome/const.ts`
timothyb89 20e29c0
Split `SelectCreatable` into its own story
timothyb89 25323a0
Clarify SelectCreatable story
timothyb89 497782f
Merge remote-tracking branch 'origin/master' into timothyb89/teleport…
timothyb89 0df07be
Simplify story; fix lint
timothyb89 442c3ad
Fix type checker failure
timothyb89 e7032af
Rename `preset-roles` endpoint to `presetroles` to follow API convent…
timothyb89 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
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
102 changes: 102 additions & 0 deletions
102
web/packages/shared/components/FieldSelect/FieldSelectCreatable.tsx
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,102 @@ | ||
| /* | ||
| Copyright 2023 Gravitational, Inc. | ||
|
|
||
| Licensed under the Apache License, Version 2.0 (the "License"); | ||
| you may not use this file except in compliance with the License. | ||
| You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, software | ||
| distributed under the License is distributed on an "AS IS" BASIS, | ||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| See the License for the specific language governing permissions and | ||
| limitations under the License. | ||
| */ | ||
|
|
||
| import React from 'react'; | ||
|
|
||
| import { Box, LabelInput } from 'design'; | ||
|
|
||
| import { useRule } from 'shared/components/Validation'; | ||
|
|
||
| import { | ||
| SelectCreatable, | ||
| CreatableProps as SelectCreatableProps, | ||
| } from '../Select'; | ||
|
|
||
| import { LabelTip, defaultRule } from './shared'; | ||
|
|
||
| export function FieldSelectCreatable({ | ||
| components, | ||
| label, | ||
| labelTip, | ||
| value, | ||
| name, | ||
| onChange, | ||
| placeholder, | ||
| maxMenuHeight, | ||
| isClearable, | ||
| isMulti, | ||
| menuIsOpen, | ||
| menuPosition, | ||
| inputValue, | ||
| onKeyDown, | ||
| onInputChange, | ||
| onBlur, | ||
| rule = defaultRule, | ||
| stylesConfig, | ||
| isSearchable = false, | ||
| isSimpleValue = false, | ||
| autoFocus = false, | ||
| isDisabled = false, | ||
| elevated = false, | ||
| inputId = 'select', | ||
| ...styles | ||
| }: CreatableProps) { | ||
| const { valid, message } = useRule(rule(value)); | ||
| const hasError = Boolean(!valid); | ||
| const labelText = hasError ? message : label; | ||
| return ( | ||
| <Box mb="4" {...styles}> | ||
| {label && ( | ||
| <LabelInput htmlFor={inputId} hasError={hasError}> | ||
| {labelText} | ||
| {labelTip && <LabelTip text={labelTip} />} | ||
| </LabelInput> | ||
| )} | ||
| <SelectCreatable | ||
| components={components} | ||
| inputId={inputId} | ||
| name={name} | ||
| menuPosition={menuPosition} | ||
| hasError={hasError} | ||
| isSimpleValue={isSimpleValue} | ||
| isSearchable={isSearchable} | ||
| isClearable={isClearable} | ||
| value={value} | ||
| onChange={onChange} | ||
| onKeyDown={onKeyDown} | ||
| onInputChange={onInputChange} | ||
| onBlur={onBlur} | ||
| inputValue={inputValue} | ||
| maxMenuHeight={maxMenuHeight} | ||
| placeholder={placeholder} | ||
| isMulti={isMulti} | ||
| autoFocus={autoFocus} | ||
| isDisabled={isDisabled} | ||
| elevated={elevated} | ||
| menuIsOpen={menuIsOpen} | ||
| stylesConfig={stylesConfig} | ||
| /> | ||
| </Box> | ||
| ); | ||
| } | ||
|
|
||
| type CreatableProps = SelectCreatableProps & { | ||
| autoFocus?: boolean; | ||
| label?: string; | ||
| rule?: (options: unknown) => () => unknown; | ||
| // styles | ||
| [key: string]: any; | ||
| }; |
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,23 @@ | ||
| /* | ||
| Copyright 2023 Gravitational, Inc. | ||
|
|
||
| Licensed under the Apache License, Version 2.0 (the "License"); | ||
| you may not use this file except in compliance with the License. | ||
| You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, software | ||
| distributed under the License is distributed on an "AS IS" BASIS, | ||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| See the License for the specific language governing permissions and | ||
| limitations under the License. | ||
| */ | ||
|
|
||
| export const defaultRule = () => () => ({ valid: true }); | ||
|
|
||
| export const LabelTip = ({ text }) => ( | ||
| <span | ||
| css={{ fontWeight: 'normal', textTransform: 'none' }} | ||
| >{` - ${text}`}</span> | ||
| ); |
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.
Uh oh!
There was an error while loading. Please reload this page.