Skip to content

Commit

Permalink
Remove dependency on react-router from CMS sysmon (#292)
Browse files Browse the repository at this point in the history
Co-authored-by: Jake Rosenberg <[email protected]>
  • Loading branch information
jarosenb and Jake Rosenberg authored Aug 7, 2023
1 parent 6f47283 commit 3725e26
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion apps/tup-cms-react/src/Sysmon/Sysmon.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SystemMonitorTable } from '@tacc/tup-components';

const Sysmon: React.FC = () => <SystemMonitorTable />;
const Sysmon: React.FC = () => <SystemMonitorTable useLinks={false} />;

export default Sysmon;
5 changes: 3 additions & 2 deletions libs/tup-components/src/system-status/SystemMonitor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
InlineMessage,
SectionTableWrapper,
} from '@tacc/core-components';
import { Display, Operational, Load } from './SystemMonitorCells';
import { Display, Operational, Load, TextDisplay } from './SystemMonitorCells';
import { SystemMonitorRawSystem, useSystemMonitor } from '@tacc/tup-hooks';
import styles from './SystemMonitor.module.css';
import { EmptyTablePlaceholder } from '../utils';
Expand All @@ -25,6 +25,7 @@ export const isSystemOnline = (rawSystem: SystemMonitorRawSystem): boolean => {

export const SystemMonitorTable: React.FC<SystemDetailProps> = ({
tas_name,
useLinks = true,
}) => {
const { data: systemMonitorData, isLoading, error } = useSystemMonitor();
let data = systemMonitorData;
Expand All @@ -35,7 +36,7 @@ export const SystemMonitorTable: React.FC<SystemDetailProps> = ({
{
accessor: 'display_name',
Header: 'System',
Cell: Display,
Cell: useLinks ? Display : TextDisplay,
},
{
accessor: isSystemOnline,
Expand Down
6 changes: 6 additions & 0 deletions libs/tup-components/src/system-status/SystemMonitorCells.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ export const Display: React.FC<{
</Link>
);

export const TextDisplay: React.FC<{
cell: Cell<SystemMonitorRawSystem, string>;
}> = ({ cell: { row } }) => {
return row.original.display_name;
};

export const Operational: React.FC<{
cell: Cell<SystemMonitorRawSystem, boolean>;
}> = ({ cell: { value } }) => {
Expand Down
1 change: 1 addition & 0 deletions libs/tup-components/src/system-status/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export type SystemDetailProps = {
tas_name?: string;
useLinks?: boolean;
};

export { SystemMonitor, SystemMonitorTable } from './SystemMonitor';
Expand Down

0 comments on commit 3725e26

Please sign in to comment.