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: move healthcheck to tabs #531

Merged
merged 6 commits into from
Sep 18, 2023
Merged
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
4 changes: 0 additions & 4 deletions src/components/CircularProgressBar/CircularProgressBar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

&__wrapper {
position: relative;

display: inline;
}
&__content {
position: absolute;
Expand All @@ -26,8 +24,6 @@
stroke: var(--yc-color-base-simple-hover);

fill: none;

transition: stroke 0.1s;
}

&__circle {
Expand Down
3 changes: 0 additions & 3 deletions src/components/DiagnosticCard/DiagnosticCard.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
border-radius: 8px;
background-color: transparent;

transition: all 0.1s;
transition-property: box-shadow, background-color, border-color;

&_active {
border-color: var(--yc-color-base-info-heavy);
background-color: var(--yc-color-base-selection);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
$section-title-margin: 20px;
$section-title-line-height: 24px;

.kv-detailed-overview {
display: flex;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {Icon} from '../../../../components/Icon';
import {useSetting} from '../../../../utils/hooks';
import {ENABLE_NEW_TENANT_DIAGNOSTICS_DESIGN} from '../../../../utils/constants';
import Overview from '../Overview/Overview';
import {Healthcheck} from '../Healthcheck';
import {Healthcheck} from '../OldHealthcheck';
import {TenantOverview} from '../TenantOverview/TenantOverview';
import {OldTenantOverview} from '../TenantOverview/OldTenantOverview';

Expand Down Expand Up @@ -65,7 +65,6 @@ function DetailedOverview(props: DetailedOverviewProps) {
<TenantOverview
tenantName={tenantName}
additionalTenantProps={additionalTenantProps}
showMoreHandler={openModalHandler}
/>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import type {IResponseError} from '../../../../../types/api/error';
import type {IIssuesTree} from '../../../../../types/store/healthcheck';
import {ResponseError} from '../../../../../components/Errors/ResponseError';

import IssueTree from '../IssuesViewer/IssueTree';
import IssueTree from '../../TenantOverview/Healthcheck/IssuesViewer/IssueTree';

import i18n from '../i18n';
import i18n from '../../TenantOverview/Healthcheck/i18n';

const b = cn('healthcheck');
const b = cn('old-healthcheck');

interface DetailsProps {
issueTrees?: IIssuesTree[];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
@use '../DetailedOverview/DetailedOverview.scss' as detailedOverview;
@import '../../../../styles/mixins.scss';
@import '@gravity-ui/uikit/styles/mixins.scss';

.healthcheck {
.old-healthcheck {
display: flex;

&_expanded {
Expand All @@ -12,6 +11,7 @@
}

&__details {
width: 860px;
padding: 25px 20px 20px;
}

Expand All @@ -27,11 +27,6 @@
max-height: 70vh;
}

&__loader {
display: flex;
justify-content: center;
}

&__message-container {
padding: 15px 0;
}
Expand All @@ -53,8 +48,18 @@
margin-left: 10px;
}

&__preview {
width: 206px;
padding: 16px;
padding-bottom: 28px;

border: 1px solid var(--yc-color-line-generic);
border-radius: 8px;
background-color: transparent;
}

&__preview-header {
margin-bottom: detailedOverview.$section-title-margin;
margin-bottom: var(--diagnostics-section-title-margin);
gap: 8px;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {
selectIssuesTrees,
setDataWasNotLoaded,
} from '../../../../store/reducers/healthcheckInfo';
import {DiagnosticCard} from '../../../../components/DiagnosticCard/DiagnosticCard';

import {Details} from './Details';
import {Preview} from './Preview';
Expand All @@ -24,13 +23,12 @@ interface HealthcheckProps {
preview?: boolean;
fetchData?: boolean;
showMoreHandler?: VoidFunction;
active?: boolean;
}

const b = cn('healthcheck');
const b = cn('old-healthcheck');

export const Healthcheck = (props: HealthcheckProps) => {
const {tenant, preview, fetchData = true, showMoreHandler, active} = props;
const {tenant, preview, fetchData = true, showMoreHandler} = props;

const dispatch = useDispatch();

Expand Down Expand Up @@ -65,11 +63,12 @@ export const Healthcheck = (props: HealthcheckProps) => {
const renderContent = () => {
if (loading && !wasLoaded) {
return (
<DiagnosticCard className={b('loader')}>
<div className={b('old-preview', {loader: true})}>
<Loader size="m" />
</DiagnosticCard>
</div>
);
}

return preview ? (
<Preview
issuesStatistics={issuesStatistics}
Expand All @@ -78,7 +77,6 @@ export const Healthcheck = (props: HealthcheckProps) => {
onShowMore={showMoreHandler}
onUpdate={fetchHealthcheck}
error={error}
active={active}
/>
) : (
<Details
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@ import updateArrow from '../../../../../assets/icons/update-arrow.svg';

import {SelfCheckResult, type StatusFlag} from '../../../../../types/api/healthcheck';
import type {IResponseError} from '../../../../../types/api/error';
import {DiagnosticCard} from '../../../../../components/DiagnosticCard/DiagnosticCard';
import EntityStatus from '../../../../../components/EntityStatus/EntityStatus';
import {ResponseError} from '../../../../../components/Errors/ResponseError';

import i18n from '../i18n';
import i18n from '../../TenantOverview/Healthcheck/i18n';

const b = cn('healthcheck');
const b = cn('old-healthcheck');

interface PreviewProps {
selfCheckResult: SelfCheckResult;
Expand All @@ -21,13 +20,10 @@ interface PreviewProps {
onShowMore?: VoidFunction;
onUpdate: VoidFunction;
error?: IResponseError;
active?: boolean;
}

export const Preview = (props: PreviewProps) => {
const {selfCheckResult, issuesStatistics, loading, onShowMore, onUpdate, error, active} = props;

const isStatusOK = selfCheckResult === SelfCheckResult.GOOD;
const {selfCheckResult, issuesStatistics, loading, onShowMore, onUpdate, error} = props;

const renderHeader = () => {
const modifier = selfCheckResult.toLowerCase();
Expand All @@ -54,7 +50,7 @@ export const Preview = (props: PreviewProps) => {

return (
<div className={b('preview-content')}>
{isStatusOK || !issuesStatistics || !issuesStatistics.length ? (
{!issuesStatistics || !issuesStatistics.length ? (
i18n('status_message.ok')
) : (
<>
Expand All @@ -78,9 +74,9 @@ export const Preview = (props: PreviewProps) => {
};

return (
<DiagnosticCard active={active}>
<div className={b('preview')}>
{renderHeader()}
{renderContent()}
</DiagnosticCard>
</div>
);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
@import '../../../../../styles/mixins.scss';

.healthcheck {
display: flex;

&_expanded {
// Since most of the inner containers have fixed width, we can set fixed width here as well
// Thus we will get rid of unneeded layout shift when scrollbar appear
min-width: 885px;
}

&__issue-preview {
margin-bottom: 15px;
}

&__message-container {
padding: 15px 0;
}

&__details {
width: 872px;
}

&__details-content-wrapper {
overflow-x: hidden;
}

&__preview {
height: 100%;
}

&__preview-header {
margin-bottom: var(--diagnostics-section-title-margin);
gap: 8px;
}

&__preview-title {
font-weight: 600;
@include lead-typography();
}

&__preview-content {
line-height: 24px;
}

&__preview-title-wrapper {
display: flex;
align-items: center;

margin-bottom: 4px;

gap: 8px;
}

&__issues-statistics {
display: flex;
flex-wrap: wrap;
align-items: center;

margin: 8px 0;

gap: 10px;
}

&__self-check-status-indicator {
display: inline-block;

padding: 0 8px;

font-size: 13px;
line-height: 24px;

border-radius: 4px;

&_good,
&_green {
color: var(--yc-color-text-positive);
background-color: var(--yc-color-base-positive);
}
&_degraded,
&_yellow {
color: var(--yc-color-text-warning);
background-color: var(--yc-color-base-warning);
}

&_blue {
color: var(--yc-color-text-info);
background-color: var(--yc-color-base-info);
}

&_emergency,
&_red {
color: var(--yc-color-text-danger);
background-color: var(--yc-color-base-danger);
}
&_unspecified,
&_gray,
&_grey {
color: var(--yc-color-text-misc);
background-color: var(--yc-color-base-misc);
}
&_maintenance_required,
&_orange {
color: var(--yc-color-text-warning-heavy);
background-color: var(--yc-color-infographics-warning-light);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import cn from 'bem-cn-lite';

import type {IResponseError} from '../../../../../types/api/error';
import type {IIssuesTree} from '../../../../../types/store/healthcheck';
import {ResponseError} from '../../../../../components/Errors/ResponseError';

import IssueTree from './IssuesViewer/IssueTree';

import i18n from './i18n';
import './Healthcheck.scss';

const b = cn('healthcheck');

interface HealthcheckDetailsProps {
issueTrees?: IIssuesTree[];
error?: IResponseError;
}

export function HealthcheckDetails(props: HealthcheckDetailsProps) {
const {issueTrees, error} = props;

const renderContent = () => {
if (error) {
return <ResponseError error={error} defaultMessage={i18n('no-data')} />;
}

if (!issueTrees || !issueTrees.length) {
return i18n('status_message.ok');
}

return (
<>
{issueTrees.map((issueTree) => (
<IssueTree key={issueTree.id} issueTree={issueTree} />
))}
</>
);
};

return (
<div className={b('details')}>
<div className={b('details-content-wrapper')}>{renderContent()}</div>
</div>
);
}
Loading
Loading