-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ui): Enhance resource creation experience when limits are reached (
#19103) * feat(ui): add AssetLimitOverlay * feat(ui): enable create bucket button * feat(ui): enable create dashboard and task buttons * feat(ui): add reusable AssetLimitButton * feat(ui): change alerts limit experience * feat(ui): update changelog * feat(ui): address review comments
- Loading branch information
Showing
17 changed files
with
374 additions
and
124 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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// Libraries | ||
import React, {FC} from 'react' | ||
import {connect, ConnectedProps} from 'react-redux' | ||
|
||
// Components | ||
import {Button, ComponentColor, IconFont} from '@influxdata/clockface' | ||
|
||
// Actions | ||
import {showOverlay, dismissOverlay} from 'src/overlays/actions/overlays' | ||
|
||
interface OwnProps { | ||
color?: ComponentColor | ||
resourceName: string | ||
buttonText?: string | ||
} | ||
|
||
type ReduxProps = ConnectedProps<typeof connector> | ||
|
||
const AssetLimitButton: FC<OwnProps & ReduxProps> = ({ | ||
color = ComponentColor.Primary, | ||
buttonText, | ||
resourceName, | ||
onShowOverlay, | ||
onDismissOverlay, | ||
}) => { | ||
const handleClick = () => { | ||
onShowOverlay('asset-limit', {asset: `${resourceName}s`}, onDismissOverlay) | ||
} | ||
return ( | ||
<Button | ||
icon={IconFont.Plus} | ||
text={buttonText || `Create ${resourceName}`} | ||
color={color} | ||
titleText={`Click to create ${resourceName}`} | ||
onClick={handleClick} | ||
testID={`create-${resourceName.toLowerCase()}`} | ||
/> | ||
) | ||
} | ||
|
||
const mdtp = { | ||
onShowOverlay: showOverlay, | ||
onDismissOverlay: dismissOverlay, | ||
} | ||
|
||
const connector = connect(null, mdtp) | ||
|
||
export default connector(AssetLimitButton) |
Oops, something went wrong.