mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-12 07:08:58 +08:00
feat: add Request Dashboard button and improve dashboard list styles (#6251)
* feat: add Request Dashboard button and improve dashboard list styles * feat: support for empty state and dashboard list state
This commit is contained in:
parent
a31c4b8339
commit
4be0508dd2
@ -5,6 +5,17 @@
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
|
// overridding the request integration style to fix the spacing for dashboard list
|
||||||
|
.request-entity-container {
|
||||||
|
margin-bottom: 16px !important;
|
||||||
|
margin-top: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.integrations-content {
|
||||||
|
max-width: 100% !important;
|
||||||
|
width: 100% !important;
|
||||||
|
}
|
||||||
|
|
||||||
.dashboards-list-view-content {
|
.dashboards-list-view-content {
|
||||||
width: calc(100% - 30px);
|
width: calc(100% - 30px);
|
||||||
max-width: 836px;
|
max-width: 836px;
|
||||||
|
@ -77,6 +77,7 @@ import { isCloudUser } from 'utils/app';
|
|||||||
|
|
||||||
import DashboardTemplatesModal from './DashboardTemplates/DashboardTemplatesModal';
|
import DashboardTemplatesModal from './DashboardTemplates/DashboardTemplatesModal';
|
||||||
import ImportJSON from './ImportJSON';
|
import ImportJSON from './ImportJSON';
|
||||||
|
import { RequestDashboardBtn } from './RequestDashboardBtn';
|
||||||
import { DeleteButton } from './TableComponents/DeleteButton';
|
import { DeleteButton } from './TableComponents/DeleteButton';
|
||||||
import {
|
import {
|
||||||
DashboardDynamicColumns,
|
DashboardDynamicColumns,
|
||||||
@ -692,6 +693,13 @@ function DashboardsList(): JSX.Element {
|
|||||||
Create and manage dashboards for your workspace.
|
Create and manage dashboards for your workspace.
|
||||||
</Typography.Text>
|
</Typography.Text>
|
||||||
</Flex>
|
</Flex>
|
||||||
|
{isCloudUser() && (
|
||||||
|
<div className="integrations-container">
|
||||||
|
<div className="integrations-content">
|
||||||
|
<RequestDashboardBtn />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{isDashboardListLoading ||
|
{isDashboardListLoading ||
|
||||||
|
@ -0,0 +1,95 @@
|
|||||||
|
import '../../pages/Integrations/Integrations.styles.scss';
|
||||||
|
|
||||||
|
import { LoadingOutlined } from '@ant-design/icons';
|
||||||
|
import { Button, Input, Space, Typography } from 'antd';
|
||||||
|
import logEvent from 'api/common/logEvent';
|
||||||
|
import { useNotifications } from 'hooks/useNotifications';
|
||||||
|
import { Check } from 'lucide-react';
|
||||||
|
import { useState } from 'react';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
|
export function RequestDashboardBtn(): JSX.Element {
|
||||||
|
const [
|
||||||
|
isSubmittingRequestForDashboard,
|
||||||
|
setIsSubmittingRequestForDashboard,
|
||||||
|
] = useState(false);
|
||||||
|
|
||||||
|
const [requestedDashboardName, setRequestedDashboardName] = useState('');
|
||||||
|
|
||||||
|
const { notifications } = useNotifications();
|
||||||
|
const { t } = useTranslation(['common']);
|
||||||
|
|
||||||
|
const handleRequestDashboardSubmit = async (): Promise<void> => {
|
||||||
|
try {
|
||||||
|
setIsSubmittingRequestForDashboard(true);
|
||||||
|
const response = await logEvent('Dashboard Requested', {
|
||||||
|
screen: 'Dashboard list page',
|
||||||
|
dashboard: requestedDashboardName,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (response.statusCode === 200) {
|
||||||
|
notifications.success({
|
||||||
|
message: 'Dashboard Request Submitted',
|
||||||
|
});
|
||||||
|
|
||||||
|
setIsSubmittingRequestForDashboard(false);
|
||||||
|
} else {
|
||||||
|
notifications.error({
|
||||||
|
message:
|
||||||
|
response.error ||
|
||||||
|
t('something_went_wrong', {
|
||||||
|
ns: 'common',
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
setIsSubmittingRequestForDashboard(false);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
notifications.error({
|
||||||
|
message: t('something_went_wrong', {
|
||||||
|
ns: 'common',
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
setIsSubmittingRequestForDashboard(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="request-entity-container">
|
||||||
|
<Typography.Text>
|
||||||
|
Can't find the dashboard you need? Request a new Dashboard.
|
||||||
|
</Typography.Text>
|
||||||
|
|
||||||
|
<div className="form-section">
|
||||||
|
<Space.Compact style={{ width: '100%' }}>
|
||||||
|
<Input
|
||||||
|
placeholder="Enter dashboard name..."
|
||||||
|
style={{ width: 300, marginBottom: 0 }}
|
||||||
|
value={requestedDashboardName}
|
||||||
|
onChange={(e): void => setRequestedDashboardName(e.target.value)}
|
||||||
|
/>
|
||||||
|
<Button
|
||||||
|
className="periscope-btn primary"
|
||||||
|
icon={
|
||||||
|
isSubmittingRequestForDashboard ? (
|
||||||
|
<LoadingOutlined />
|
||||||
|
) : (
|
||||||
|
<Check size={12} />
|
||||||
|
)
|
||||||
|
}
|
||||||
|
type="primary"
|
||||||
|
onClick={handleRequestDashboardSubmit}
|
||||||
|
disabled={
|
||||||
|
isSubmittingRequestForDashboard ||
|
||||||
|
!requestedDashboardName ||
|
||||||
|
requestedDashboardName?.trim().length === 0
|
||||||
|
}
|
||||||
|
>
|
||||||
|
Submit
|
||||||
|
</Button>
|
||||||
|
</Space.Compact>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
@ -15,7 +15,6 @@
|
|||||||
font-style: normal;
|
font-style: normal;
|
||||||
line-height: 28px; /* 155.556% */
|
line-height: 28px; /* 155.556% */
|
||||||
letter-spacing: -0.09px;
|
letter-spacing: -0.09px;
|
||||||
font-family: Inter;
|
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -25,7 +24,6 @@
|
|||||||
font-style: normal;
|
font-style: normal;
|
||||||
line-height: 20px; /* 142.857% */
|
line-height: 20px; /* 142.857% */
|
||||||
letter-spacing: -0.07px;
|
letter-spacing: -0.07px;
|
||||||
font-family: Inter;
|
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,7 +127,6 @@
|
|||||||
|
|
||||||
.heading {
|
.heading {
|
||||||
color: var(--bg-vanilla-100);
|
color: var(--bg-vanilla-100);
|
||||||
font-family: Inter;
|
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
@ -140,7 +137,6 @@
|
|||||||
|
|
||||||
.description {
|
.description {
|
||||||
color: var(--bg-vanilla-400);
|
color: var(--bg-vanilla-400);
|
||||||
font-family: Inter;
|
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
@ -163,7 +159,6 @@
|
|||||||
background: var(--bg-ink-200);
|
background: var(--bg-ink-200);
|
||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
color: var(--bg-vanilla-400);
|
color: var(--bg-vanilla-400);
|
||||||
font-family: Inter;
|
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user