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

add refresh button to healthcheck table. #286

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
25 changes: 18 additions & 7 deletions src/components/content/systemStatus/HealthCheckStatus.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ import React, { useEffect, useState } from 'react';
import { Alert, Button, Space, Table } from 'antd';
import { ColumnsType } from 'antd/es/table';
import { ApiError, BackendSystemStatus, Response, SystemStatus } from '../../../xpanse-api/generated';
import { DashboardOutlined } from '@ant-design/icons';
import { SyncOutlined } from '@ant-design/icons';
import SystemStatusIcon from './SystemStatusIcon';
import { ColumnFilterItem } from 'antd/es/table/interface';
import { convertStringArrayToUnorderedList } from '../../utils/generateUnorderedList';
import { useHealthCheckStatusQuery } from './useHealthCheckStatusQuery';
import '../../../styles/health_status.css';

interface DataType {
key: React.Key;
backendSystemType: BackendSystemStatus.backendSystemType;
Expand Down Expand Up @@ -194,16 +196,25 @@ export const HealthCheckStatus = (): JSX.Element => {
setHealthStatusFilters(filters);
};

const refreshData = () => {
void healthCheckQuery.refetch();
};

return (
<>
<div className={'generic-table-container'}>
<div className={'health-status-title'}>
<h3>
<DashboardOutlined />
&nbsp; Health Status
</h3>
</div>
{healthCheckError}
<div className={'health-status-refresh'}>
<Button
type='primary'
icon={<SyncOutlined />}
onClick={() => {
refreshData();
}}
>
refresh
</Button>
</div>
<Table columns={columns} dataSource={backendSystemStatusList} />
</div>
</>
Expand Down
4 changes: 2 additions & 2 deletions src/styles/health_status.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
* SPDX-FileCopyrightText: Huawei Inc.
*/

.health-status-title {
margin: 1% 0 1% 0;
.health-status-refresh {
margin-bottom: 1%;
}