-
Notifications
You must be signed in to change notification settings - Fork 367
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: [M3-6254] - Show warning message for only Linode clone and backu…
…ps (#8888) * fix: [M3-6254] show warning message for only Linode clone and backups flow * PR -feedback * PR Feedback * PR Feedback
- Loading branch information
Showing
5 changed files
with
58 additions
and
50 deletions.
There are no files selected for viewing
This file contains 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
30 changes: 0 additions & 30 deletions
30
packages/manager/src/features/linodes/LinodesCreate/UserDataAccordion/AccordionHeading.tsx
This file was deleted.
Oops, something went wrong.
This file contains 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 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
46 changes: 46 additions & 0 deletions
46
...manager/src/features/linodes/LinodesCreate/UserDataAccordion/UserDataAccordionHeading.tsx
This file contains 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,46 @@ | ||
import * as React from 'react'; | ||
import Link from 'src/components/Link'; | ||
import Notice from 'src/components/Notice'; | ||
import { StyledHelpIcon } from './UserDataAccordion.styles'; | ||
|
||
export const LINODE_CREATE_FROM = { | ||
BACKUPS: 'fromBackup', | ||
CLONE: 'fromLinode', | ||
}; | ||
|
||
interface Props { | ||
createType?: string | undefined; | ||
} | ||
|
||
const UserDataAccordionHeading = ({ createType }: Props) => { | ||
const userDataHeaderWarningMessage = | ||
createType === LINODE_CREATE_FROM.BACKUPS | ||
? 'Existing user data is not available when creating a Linode from a backup.' | ||
: 'User data is not cloned.'; | ||
const showWarningMessage = | ||
createType && | ||
[LINODE_CREATE_FROM.BACKUPS, LINODE_CREATE_FROM.CLONE].includes(createType); | ||
|
||
return ( | ||
<> | ||
Add User Data{' '} | ||
<StyledHelpIcon | ||
text={ | ||
<> | ||
User data is part of a virtual machine’s cloud-init metadata | ||
containing information related to a user’s local account.{' '} | ||
<Link to="/">Learn more.</Link> | ||
</> | ||
} | ||
interactive | ||
/> | ||
{showWarningMessage ? ( | ||
<Notice warning spacingTop={16} spacingBottom={16}> | ||
{userDataHeaderWarningMessage} | ||
</Notice> | ||
) : null} | ||
</> | ||
); | ||
}; | ||
|
||
export default UserDataAccordionHeading; |