Skip to content

Commit

Permalink
Adds link to content in MeterAsset
Browse files Browse the repository at this point in the history
  • Loading branch information
collins-self committed Nov 22, 2024
1 parent caf0162 commit a7f478d
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import { SelectRoles } from '../Store/UserSettings';
import GenerationAttributes from '../AssetAttribute/Generation';
import StationAuxAttributes from '../AssetAttribute/StationAux';
import StationBatteryAttributes from '../AssetAttribute/StationBattery';
import { SystemCenterSettingSlice } from '../Store/Store';

declare var homePath: string;

Expand All @@ -51,6 +52,9 @@ const MeterAssetWindow = (props: IProps) => {
const MeterAssetController = new GenericController<OpenXDA.Types.MeterAsset>(`${homePath}api/OpenXDA/DetailedMeterAsset/${props.Meter.ID}`, "AssetName", true);
const PagingID = 'MeterAssetPage'

const settings = useAppSelector(SystemCenterSettingSlice.Data);
const settingStatus = useAppSelector(SystemCenterSettingSlice.Status);

const [assetTypes, setAssetTypes] = React.useState<OpenXDA.Types.AssetType[]>([]);
const [newEdit, setNewEdit] = React.useState<Application.Types.NewEdit>('New');

Expand All @@ -75,6 +79,11 @@ const MeterAssetWindow = (props: IProps) => {
const [pageInfo, setPageInfo] = React.useState<{ RecordsPerPage: number, NumberOfPages: number, TotalRecords: number }>({ RecordsPerPage: 0, NumberOfPages: 0, TotalRecords: 0 });
const [pageState, setPageState] = React.useState<'error' | 'idle' | 'loading'>('idle');

React.useEffect(() => {
if (settingStatus == 'unintiated' || settingStatus == 'changed')
dispatch(SystemCenterSettingSlice.Fetch());
}, [settingStatus]);

React.useEffect(() => {
let h = getAssetTypes()
h.done((data: Array<OpenXDA.Types.AssetType>) => {
Expand Down Expand Up @@ -163,6 +172,10 @@ const MeterAssetWindow = (props: IProps) => {
Field={'AssetKey'}
HeaderStyle={{ width: 'auto' }}
RowStyle={{ width: 'auto' }}
Content={({ item, field }) =>
<a href={`${homePath}index.cshtml?name=Asset&AssetID=${item.ID}`} target='_blank'>
{item[field]}
</a>}
> Key
</ReactTable.Column>
<ReactTable.Column<OpenXDA.Types.MeterAsset>
Expand Down

0 comments on commit a7f478d

Please sign in to comment.