mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-10 01:43:43 +00:00
2fa397548a
* feat/navigate upgrade react router * feat/navigate migrate to react router 6 * feat/navigate style modal * feat/navigate create endpoints for app settings * feat/navigate protect editor with pin * feat/navigate apply dynamic routing draft * feat/navigate upgrade relevant packages * feat/navigate restructure directory and add tests * feat/navigate test aliases validation * feat/navigate validate aliases before sending * feat/navigate create data endpoint * feat/navigate config: prettier * feat/navigate invalidate empty strings * feat/navigate create endpoints * feat/navigate parse on import * feat/navigate navigate to alias * feat/navigate user help and sample data * feat/navigate refact aliases modal * feat/navigate refact settings style * feat/navigate update sample db * feat/navigate link is relative to hostname * feat/navigate navigate to first match * feat/navigate update readme and version bump * feat/navigate config: create shared module * feat/navigate config: cheat module install * feat/navigate fix tests * feat/navigate run tests in pull request * Update ontime_cy.yml
42 lines
1.3 KiB
React
42 lines
1.3 KiB
React
import { useState } from 'react';
|
|
import { APP_TABLE } from 'app/api/apiConstants';
|
|
import { getInfo, ontimePlaceholderInfo } from 'app/api/ontimeApi';
|
|
import { useFetch } from 'app/hooks/useFetch';
|
|
import style from './Info.module.scss';
|
|
import CollapseBar from '../../common/components/collapseBar/CollapseBar';
|
|
import handleLink from '../../common/utils/handleLink';
|
|
|
|
export default function InfoNif() {
|
|
const { data, status } = useFetch(APP_TABLE, getInfo, {
|
|
placeholderData: ontimePlaceholderInfo,
|
|
});
|
|
const [collapsed, setCollapsed] = useState(false);
|
|
const baseURL = 'http://__IP__:4001';
|
|
|
|
return (
|
|
<div className={style.container}>
|
|
<CollapseBar title={'Network Info'} isCollapsed={collapsed} onClick={() => setCollapsed((c) => !c)}/>
|
|
{!collapsed && (
|
|
<div>
|
|
{status === 'success' && (
|
|
<>
|
|
{data?.networkInterfaces.map((e) => {
|
|
return (
|
|
<a
|
|
key={e.address}
|
|
href='#!'
|
|
onClick={() =>
|
|
handleLink(baseURL.replace('__IP__', e.address))
|
|
}
|
|
className={style.if}
|
|
>{`${e.name} - ${e.address}`}</a>
|
|
);
|
|
})}
|
|
</>
|
|
)}
|
|
</div>
|
|
)}
|
|
</div>
|
|
);
|
|
}
|