Skip to content

Commit

Permalink
Define listener to try or relesae the lock
Browse files Browse the repository at this point in the history
See also: #13
  • Loading branch information
BECATRUE committed Dec 7, 2024
1 parent cac7c6a commit 1ef6f39
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
8 changes: 7 additions & 1 deletion wlm-ui/src/MainPage/Channel/Channel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ interface IProps extends ChannelInfo {
onClickSetInUse: (inUse: boolean) => void;
onClickSetExposure: (exposure: number) => void;
onClickSetPeriod: (period: number) => void;
onClickTryLock: () => void;
onClickReleaseLock: () => void;
};

const Channel = (props: IProps) => {
Expand Down Expand Up @@ -203,7 +205,11 @@ const Channel = (props: IProps) => {
</div>
<div className='channel-lock-container'>
<span>{props.lock.locked ? `Locked by ${props.lock.owner}` : 'Open'}</span>
<button>{props.hasLock ? 'Release' : 'Acquire'}</button>
<button
onClick={props.hasLock ? props.onClickReleaseLock : props.onClickTryLock }
>
{props.hasLock ? 'Release' : 'Acquire'}
</button>
</div>
<div className='channel-attr-viewer-container'>
<b>Exp. time</b>
Expand Down
10 changes: 10 additions & 0 deletions wlm-ui/src/MainPage/Channel/ChannelList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ const ChannelList = () => {
dispatch(postPeriod({ channel: channel, period: period }));
};

const onClickTryLock = (channel: number) => {

};

const onClickReleaseLock = (channel: number) => {

};

return (
<div>
<button onClick={onClickRefreshChannelList}>Refresh</button>
Expand All @@ -46,6 +54,8 @@ const ChannelList = () => {
onClickSetExposure(info.channel.channel, exposure)}
onClickSetPeriod={(period: number) =>
onClickSetPeriod(info.channel.channel, period)}
onClickTryLock={() => onClickTryLock(info.channel.channel)}
onClickReleaseLock={() => onClickReleaseLock(info.channel.channel)}
/>
</article>
))}
Expand Down

0 comments on commit 1ef6f39

Please sign in to comment.