This repository has been archived by the owner on Jul 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 200
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5782 from elvisisking/5715
- Loading branch information
Showing
15 changed files
with
334 additions
and
73 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
50 changes: 50 additions & 0 deletions
50
app/ui-react/packages/ui/src/Integration/IntegrationsEmptyState.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,50 @@ | ||
import * as H from '@syndesis/history'; | ||
import { EmptyState, OverlayTrigger, Tooltip } from 'patternfly-react'; | ||
import * as React from 'react'; | ||
import { ButtonLink } from '../Layout'; | ||
|
||
export interface IIntegrationsEmptyStateProps { | ||
i18nCreateIntegration: string; | ||
i18nCreateIntegrationTip?: string; | ||
i18nEmptyStateInfo: string; | ||
i18nEmptyStateTitle: string; | ||
linkCreateIntegration: H.LocationDescriptor; | ||
} | ||
|
||
export class IntegrationsEmptyState extends React.Component< | ||
IIntegrationsEmptyStateProps | ||
> { | ||
public getCreateIntegrationTooltip() { | ||
return ( | ||
<Tooltip id="createTip"> | ||
{this.props.i18nCreateIntegrationTip | ||
? this.props.i18nCreateIntegrationTip | ||
: this.props.i18nCreateIntegration} | ||
</Tooltip> | ||
); | ||
} | ||
|
||
public render() { | ||
return ( | ||
<EmptyState> | ||
<EmptyState.Icon /> | ||
<EmptyState.Title>{this.props.i18nEmptyStateTitle}</EmptyState.Title> | ||
<EmptyState.Info>{this.props.i18nEmptyStateInfo}</EmptyState.Info> | ||
<EmptyState.Action> | ||
<OverlayTrigger | ||
overlay={this.getCreateIntegrationTooltip()} | ||
placement="top" | ||
> | ||
<ButtonLink | ||
data-testid={'integrations-empty-state-create-button'} | ||
href={this.props.linkCreateIntegration} | ||
as={'primary'} | ||
> | ||
{this.props.i18nCreateIntegration} | ||
</ButtonLink> | ||
</OverlayTrigger> | ||
</EmptyState.Action> | ||
</EmptyState> | ||
); | ||
} | ||
} |
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
46 changes: 46 additions & 0 deletions
46
app/ui-react/packages/ui/stories/Integration/IntegrationsEmptyState.stories.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 { action } from '@storybook/addon-actions'; | ||
import { storiesOf } from '@storybook/react'; | ||
import * as React from 'react'; | ||
import { BrowserRouter as Router } from 'react-router-dom'; | ||
import { IntegrationsEmptyState } from '../../src'; | ||
|
||
const stories = storiesOf('Integration/IntegrationsEmptyState', module); | ||
|
||
const createTip = 'Click to begin creating a new integration'; | ||
const info = | ||
'There are currently no integrations. Click the button below to create one.'; | ||
const link = '/integrations/create/new-integration/start/abcdefg'; | ||
const title = 'Create Integration'; | ||
|
||
const storyNotes = | ||
'- Verify title is "' + | ||
title + | ||
'"\n' + | ||
'- Verify info is "' + | ||
info + | ||
'"\n' + | ||
'- Verify button text is "' + | ||
title + | ||
'"\n' + | ||
'- Verify button toolipt is "' + | ||
createTip + | ||
'"\n' + | ||
'- Verify clicking button prints "' + | ||
link + | ||
'" in the **Actions** tab'; | ||
|
||
stories.add( | ||
'render', | ||
() => ( | ||
<Router> | ||
<IntegrationsEmptyState | ||
i18nCreateIntegration={title} | ||
i18nCreateIntegrationTip={createTip} | ||
i18nEmptyStateInfo={info} | ||
i18nEmptyStateTitle={title} | ||
linkCreateIntegration={action('blah')} | ||
/> | ||
</Router> | ||
), | ||
{ notes: storyNotes } | ||
); |
47 changes: 47 additions & 0 deletions
47
app/ui-react/packages/ui/stories/Integration/Metrics/IntegrationDetailsMetrics.stories.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,47 @@ | ||
import { storiesOf } from '@storybook/react'; | ||
import * as React from 'react'; | ||
import { | ||
IIntegrationDetailMetricsProps, | ||
IntegrationDetailMetrics, | ||
} from '../../../src'; | ||
|
||
const stories = storiesOf( | ||
'Integration/Metrics/IntegrationDetailMetrics', | ||
module | ||
); | ||
|
||
const durationDifference = '3:15:59'; | ||
const errors = 2; | ||
const i18nLastProcessed = 'Last Processed'; | ||
const i18nNoDataAvailable = 'No data available'; | ||
const i18nSince = 'Since '; | ||
const i18nTotalErrors = 'Total Errors'; | ||
const i18nTotalMessages = 'Total Messages'; | ||
const i18nUptime = 'Uptime'; | ||
const lastProcessed = '2 May 2019 08:19:42 GMT'; | ||
const messages = 26126; | ||
const start = 2323342333; | ||
|
||
const propsOnlyRequired = { | ||
i18nLastProcessed, | ||
i18nNoDataAvailable, | ||
i18nSince, | ||
i18nTotalErrors, | ||
i18nTotalMessages, | ||
i18nUptime, | ||
} as IIntegrationDetailMetricsProps; | ||
|
||
const propsAll = { | ||
...propsOnlyRequired, | ||
durationDifference, | ||
errors, | ||
lastProcessed, | ||
messages, | ||
start, | ||
} as IIntegrationDetailMetricsProps; | ||
|
||
stories | ||
|
||
.add('empty state', () => <IntegrationDetailMetrics {...propsOnlyRequired} />) | ||
|
||
.add('all props', () => <IntegrationDetailMetrics {...propsAll} />); |
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
Oops, something went wrong.