From 78b1c4535ca2388003ea7a29282962bca18cee0c Mon Sep 17 00:00:00 2001 From: Gerard Braad Date: Thu, 22 Jun 2023 22:05:05 +0800 Subject: [PATCH] PatternFly table --- package.json | 1 + src/app.tsx | 51 +++++++++++++++++++++++++++++---------------------- src/index.tsx | 2 +- 3 files changed, 31 insertions(+), 23 deletions(-) diff --git a/package.json b/package.json index bdde1a5..bf28db6 100644 --- a/package.json +++ b/package.json @@ -36,6 +36,7 @@ "@patternfly/react-core": "5.0.0-prerelease.13", "@patternfly/react-icons": "5.0.0-prerelease.7", "@patternfly/react-styles": "5.0.0-prerelease.5", + "@patternfly/react-table": "5.0.0-prerelease.13", "react": "17.0.2", "react-dom": "17.0.2", "yarn": "^1.22.19" diff --git a/src/app.tsx b/src/app.tsx index aeeef92..dc0387b 100644 --- a/src/app.tsx +++ b/src/app.tsx @@ -4,7 +4,11 @@ import { TailscaleBackendState, TailscalePeer, TailscaleStatus, TailscaleUp } fr import { Icon } from '@patternfly/react-core'; import ExclamationCircleIcon from '@patternfly/react-icons/dist/esm/icons/exclamation-circle-icon'; import CheckCircleIcon from '@patternfly/react-icons/dist/esm/icons/check-circle-icon'; - +import { + ExpandableRowContent, + Table, Caption, Thead, Tbody, Tr, Th, Td, + SortByDirection, +} from '@patternfly/react-table'; type ApplicationProps = { } @@ -30,26 +34,29 @@ export class Application extends React.Component { this.state.Status != null - ? - - - - - - - - { - Object.entries(this.state.Status.Peer).map(peer => { - return + ?
OnlineIPHost name
+ + + + { + Object.entries(this.state.Status.Peer).map(peer => { + return + } + ) } - ) - } - -
Tailscale peers
+ + :

Loading...

} @@ -61,14 +68,14 @@ export class Application extends React.Component { render() { return ( - - + + {this.props.Online ? : - } - {this.props.TailscaleIPs[0]} - {this.props.HostName} - ); + } + {this.props.TailscaleIPs[0]} + {this.props.HostName} + ); } } diff --git a/src/index.tsx b/src/index.tsx index 578b966..26bc6b4 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -6,7 +6,7 @@ import React from 'react'; import ReactDOM from 'react-dom'; import { Application } from './app'; -import "patternfly/patternfly-5-overrides.scss"; +//import "patternfly/patternfly-5-overrides.scss"; document.addEventListener("DOMContentLoaded", function () { ReactDOM.render(