-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
179 additions
and
17 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
22 changes: 22 additions & 0 deletions
22
packages/react/src/components/Metrics/DefaultEmptyState/index.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,22 @@ | ||
import React from 'react'; | ||
import TroubleshootIcon from '@mui/icons-material/Troubleshoot'; | ||
import Stack from '@mui/joy/Stack'; | ||
import Typography from '@mui/joy/Typography'; | ||
|
||
export default function DefaultEmptyState() { | ||
return ( | ||
<Stack | ||
direction="row" | ||
spacing={1} | ||
sx={{ | ||
flex: 1, | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
minHeight: '300px', | ||
}} | ||
> | ||
<TroubleshootIcon sx={{ fontSize: 32 }} /> | ||
<Typography>No results</Typography> | ||
</Stack> | ||
); | ||
} |
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
67 changes: 67 additions & 0 deletions
67
packages/react/stories/Metrics/CustomizedEmptyChart.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,67 @@ | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-nocheck | ||
import React from 'react'; | ||
import { AggregationRequestBucketSizeEnum } from '@theniledev/js'; | ||
import { Story } from '@storybook/react'; | ||
import Stack from '@mui/joy/Stack'; | ||
import Typography from '@mui/joy/Typography'; | ||
|
||
import { MetricsBarChart } from '../../src/components/Metrics'; | ||
import { AggregationType } from '../../src/components/Metrics/types'; | ||
import { NileProvider } from '../../src/context'; | ||
|
||
const meta = { | ||
component: MetricsBarChart, | ||
parameters: { | ||
controls: { expanded: false }, | ||
}, | ||
}; | ||
|
||
export default meta; | ||
|
||
const Empty: Story<null> = () => { | ||
const aggregation = { | ||
aggregationType: AggregationType.Sum, | ||
aggregationRequest: { | ||
organizationId: 'myOrganization', | ||
bucketSize: AggregationRequestBucketSizeEnum._10m, | ||
}, | ||
metricName: 'my.metric', | ||
}; | ||
return ( | ||
<NileProvider basePath="http://localhost:8080" workspace="workspace"> | ||
<MetricsBarChart | ||
aggregation={aggregation} | ||
emptyState={ | ||
<Stack sx={{ width: '560px' }}> | ||
{/* eslint-disable-next-line react/no-unknown-property*/} | ||
<marquee behavior="alternate" scrollamount="20"> | ||
<Typography level="h1">NO METRICS</Typography> | ||
</marquee> | ||
<iframe | ||
width="560" | ||
height="315" | ||
src="https://www.youtube.com/embed/dQw4w9WgXcQ?autoplay=true" | ||
title="YouTube video player" | ||
frameBorder="0" | ||
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" | ||
/> | ||
</Stack> | ||
} | ||
/> | ||
</NileProvider> | ||
); | ||
}; | ||
|
||
export const CustomizedEmptyChart = Empty.bind({}); | ||
|
||
CustomizedEmptyChart.parameters = { | ||
mockData: [ | ||
{ | ||
url: 'http://localhost:8080/workspaces/workspace/metrics/my.metric/aggregate', | ||
method: 'POST', | ||
status: 200, | ||
response: [], | ||
}, | ||
], | ||
}; |
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,45 @@ | ||
import React from 'react'; | ||
import { AggregationRequestBucketSizeEnum } from '@theniledev/js'; | ||
import { Story } from '@storybook/react'; | ||
|
||
import { MetricsBarChart } from '../../src/components/Metrics'; | ||
import { AggregationType } from '../../src/components/Metrics/types'; | ||
import { NileProvider } from '../../src/context'; | ||
|
||
const meta = { | ||
component: MetricsBarChart, | ||
parameters: { | ||
controls: { expanded: false }, | ||
}, | ||
}; | ||
|
||
export default meta; | ||
|
||
const Empty: Story<null> = () => { | ||
const aggregation = { | ||
aggregationType: AggregationType.Sum, | ||
aggregationRequest: { | ||
organizationId: 'myOrganization', | ||
bucketSize: AggregationRequestBucketSizeEnum._10m, | ||
}, | ||
metricName: 'my.metric', | ||
}; | ||
return ( | ||
<NileProvider basePath="http://localhost:8080" workspace="workspace"> | ||
<MetricsBarChart aggregation={aggregation} /> | ||
</NileProvider> | ||
); | ||
}; | ||
|
||
export const EmptyChart = Empty.bind({}); | ||
|
||
EmptyChart.parameters = { | ||
mockData: [ | ||
{ | ||
url: 'http://localhost:8080/workspaces/workspace/metrics/my.metric/aggregate', | ||
method: 'POST', | ||
status: 200, | ||
response: [], | ||
}, | ||
], | ||
}; |
b3fe2e1
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.
Successfully deployed to the following URLs:
nile-js – ./
nile-js.vercel.app
nile-js-theniledev.vercel.app
nile-js-git-master-theniledev.vercel.app
b3fe2e1
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.
Successfully deployed to the following URLs:
react-storybook – ./
react-storybook-theniledev.vercel.app
react-storybook-git-master-theniledev.vercel.app
react-storybook-ten.vercel.app
storybook.thenile.dev