Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added map view tab and coming soon message for the map detail view #6404

Open
wants to merge 1 commit into
base: host-lists
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions frontend/src/pages/InfraMonitoringHosts/HostsMapView.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import './InfraMonitoring.styles.scss';

import { Typography } from 'antd';

function HostsMapView(): JSX.Element {
return (
<div className="hosts-map-view">
<Typography.Title level={3}>Map view is coming Soon.</Typography.Title>
</div>
);
}

export default HostsMapView;
163 changes: 157 additions & 6 deletions frontend/src/pages/InfraMonitoringHosts/InfraMonitoring.styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,28 @@
.infra-monitoring-tabs {
width: 100%;

:global(.ant-tabs-nav) {
.ant-tabs-nav {
margin: 0;

.ant-tabs-tab {
padding: 5px 16px;
margin: 0;
color: var(--bg-vanilla-400);

&:hover {
color: var(--bg-vanilla-100);
}

&.ant-tabs-tab-active {
.ant-tabs-tab-btn {
color: var(--bg-vanilla-100);
}
}
}

.ant-tabs-ink-bar {
background: var(--bg-primary-400);
}
}
}
}
Expand All @@ -34,8 +54,31 @@
}
}

.no-hosts-message {
display: flex;
justify-content: center;
align-items: center;
min-height: 500px;
}

.hosts-list-controls {
margin: 1rem 0.5rem;

.ant-select-selection-search {
width: auto !important;
min-width: 85rem;
}

.ant-select-multiple {
.ant-select-selection-overflow {
flex-wrap: wrap;
overflow: visible;
}

.ant-select-selection-overflow-item {
flex: 0 0 auto;
}
}
}

.progress-container {
Expand All @@ -44,16 +87,124 @@
}

.progress-bar {
flex: 1;
margin-right: 8px;
flex: 1;
margin-right: 8px;
}

.clickable-row {
cursor: pointer;
cursor: pointer;
}

.infra-monitoring-tags {
border-radius: 10px;
width: fit-content;
border-radius: 10px;
width: fit-content;
}

.ant-table {
.ant-table-thead > tr > th {
padding: 12px 16px;
font-weight: 500;
font-size: 12px;
line-height: 18px;
}

.ant-table-cell {
padding: 16px;
font-size: 14px;
line-height: 20px;
color: var(--bg-vanilla-100);
}

.status-cell {
.active-tag {
color: var(--bg-success-400);
padding: 4px 8px;
border-radius: 4px;
font-size: 12px;
font-weight: 500;
}
}

.progress-container {
.ant-progress-bg {
height: 8px !important;
border-radius: 4px;
}
}

.ant-table-tbody > tr:hover > td {
background: rgba(255, 255, 255, 0.04);
}

.ant-table-cell:first-child {
text-align: justify;
}

.ant-table-cell:nth-child(2) {
padding-left: 16px;
padding-right: 16px;
}

.ant-table-cell:nth-child(n+3) {
padding-right: 24px;
}
.column-header-right {
text-align: right;
}
.ant-table-tbody > tr > td {
border-bottom: none;
}
}

.ant-pagination {
margin: 16px 24px;

.ant-pagination-item {
border-radius: 4px;

&-active {
background: var(--bg-primary-400);
border-color: var(--bg-primary-400);
}
}
}
.hosts-map-view {
display: flex;
justify-content: center;
align-items: center;
min-height: 500px;
}
}

.lightMode {
.infra-monitoring-container {
.ant-table-thead > tr > th {
background: var(--bg-vanilla-100);
color: var(--bg-ink-500);
}

.ant-table-cell {
color: var(--bg-ink-500);
}

.hosts-map-view {
background: var(--bg-slate-100);
}

.infra-monitoring-tabs {
.ant-tabs-tab {
color: var(--bg-ink-400);

&:hover {
color: var(--bg-ink-500);
}

&.ant-tabs-tab-active {
.ant-tabs-tab-btn {
color: var(--bg-primary-500);
}
}
}
}
}
}
12 changes: 11 additions & 1 deletion frontend/src/pages/InfraMonitoringHosts/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,32 @@ import './InfraMonitoring.styles.scss';

import * as Sentry from '@sentry/react';
import { Tabs } from 'antd';
import { PANEL_TYPES } from 'constants/queryBuilder';
import DateTimeSelectionV2 from 'container/TopNav/DateTimeSelectionV2';
import ErrorBoundaryFallback from 'pages/ErrorBoundaryFallback/ErrorBoundaryFallback';
import { useState } from 'react';

import { getTabsItems } from './utils';

function InfraMonitoringHosts(): JSX.Element {
const [activeTab, setActiveTab] = useState<string>(PANEL_TYPES.LIST);

const handleTabChange = (key: string): void => {
setActiveTab(key);
};
return (
<Sentry.ErrorBoundary fallback={<ErrorBoundaryFallback />}>
<div className="infra-monitoring-container">
<div className="infra-monitoring-header">
<div className="tabs-wrapper">
<Tabs
defaultActiveKey="list"
activeKey={activeTab}
onChange={handleTabChange}
items={getTabsItems()}
className="infra-monitoring-tabs"
type="card"
defaultActiveKey={activeTab}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

defaultActiveKey is redundant when activeKey is controlled by state. Consider removing it.

Suggested change
defaultActiveKey={activeTab}

destroyInactiveTabPane
/>
</div>
</div>
Expand Down
9 changes: 7 additions & 2 deletions frontend/src/pages/InfraMonitoringHosts/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import { Color } from '@signozhq/design-tokens';
import { Progress, TabsProps, Tag } from 'antd';
import { ColumnType } from 'antd/es/table';
import { HostData, HostListPayload } from 'api/infraMonitoring/getHostLists';
import TabLabel from 'components/TabLabel';
import { PANEL_TYPES } from 'constants/queryBuilder';

import HostsList from './HostsList';
import HostsMapView from './HostsMapView';

export interface HostRowData {
hostName: string;
Expand All @@ -28,10 +28,15 @@ export const getHostListsQuery = (): HostListPayload => ({
});
export const getTabsItems = (): TabsProps['items'] => [
{
label: <TabLabel label="List View" isDisabled={false} tooltipText="" />,
label: 'List View',
key: PANEL_TYPES.LIST,
children: <HostsList />,
},
{
label: 'Map View',
key: PANEL_TYPES.TIME_SERIES,
children: <HostsMapView />,
},
];

export const getHostsListColumns = (): ColumnType<HostRowData>[] => [
Expand Down
Loading