mirror of
https://github.com/openmhz/trunk-server.git
synced 2026-11-13 17:27:37 -05:00
baby steps
This commit is contained in:
@@ -17,6 +17,7 @@ function get_calls(query, numResults, res) {
|
|||||||
var fields = {
|
var fields = {
|
||||||
_id: true,
|
_id: true,
|
||||||
talkgroupNum: true,
|
talkgroupNum: true,
|
||||||
|
shortName: true,
|
||||||
path: true,
|
path: true,
|
||||||
name: true,
|
name: true,
|
||||||
time: true,
|
time: true,
|
||||||
@@ -38,6 +39,7 @@ function get_calls(query, numResults, res) {
|
|||||||
if (item) {
|
if (item) {
|
||||||
call = {
|
call = {
|
||||||
_id: item._id.toHexString(),
|
_id: item._id.toHexString(),
|
||||||
|
shortName: item.shortName,
|
||||||
talkgroupNum: item.talkgroupNum,
|
talkgroupNum: item.talkgroupNum,
|
||||||
url: item.url,
|
url: item.url,
|
||||||
filename: item.path + item.name,
|
filename: item.path + item.name,
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import {
|
|||||||
Tab
|
Tab
|
||||||
} from "semantic-ui-react";
|
} from "semantic-ui-react";
|
||||||
import PlaylistBuilder from "./PlaylistBuilder"
|
import PlaylistBuilder from "./PlaylistBuilder"
|
||||||
|
import CallInfoPane from "./CallInfoPane"
|
||||||
// ----------------------------------------------------
|
// ----------------------------------------------------
|
||||||
function CallInfo(props) {
|
function CallInfo(props) {
|
||||||
const { shortName } = useParams();
|
const { shortName } = useParams();
|
||||||
@@ -51,56 +52,18 @@ function CallInfo(props) {
|
|||||||
|
|
||||||
const panes = [
|
const panes = [
|
||||||
{
|
{
|
||||||
menuItem: 'Call Info', render: () => {
|
menuItem: { key: 'info', icon: 'info', content: 'Call Info' }, render: () => {
|
||||||
return (
|
return (
|
||||||
<div>
|
|
||||||
<Tab.Pane attached='bottom'>
|
|
||||||
<Header as='h1'>{header}</Header>
|
|
||||||
<List bulleted horizontal link>
|
|
||||||
{srcList}
|
|
||||||
</List>
|
|
||||||
<Divider />
|
|
||||||
<Statistic size='small'>
|
|
||||||
<Statistic.Label>Seconds</Statistic.Label>
|
|
||||||
<Statistic.Value>{callLength}</Statistic.Value>
|
|
||||||
</Statistic>
|
|
||||||
<Statistic size='small'>
|
|
||||||
<Statistic.Label>Talkgroup</Statistic.Label>
|
|
||||||
<Statistic.Value>{talkgroupNum}</Statistic.Value>
|
|
||||||
</Statistic>
|
|
||||||
|
|
||||||
<List divided verticalAlign='middle'>
|
<Tab.Pane attached='bottom'>
|
||||||
<List.Item>
|
<CallInfoPane call={props.call} />
|
||||||
<Icon name="wait" />
|
|
||||||
<List.Content>
|
|
||||||
{callTime}
|
|
||||||
</List.Content>
|
|
||||||
</List.Item>
|
|
||||||
<List.Item>
|
|
||||||
<Icon name="calendar outline" />
|
|
||||||
<List.Content>
|
|
||||||
{callDate}
|
|
||||||
</List.Content>
|
|
||||||
</List.Item>
|
|
||||||
<List.Item>
|
|
||||||
<Icon name="cubes" />
|
|
||||||
<List.Content>
|
|
||||||
{callFreq} MHz
|
|
||||||
</List.Content>
|
|
||||||
</List.Item>
|
|
||||||
</List>
|
|
||||||
</Tab.Pane>
|
</Tab.Pane>
|
||||||
<Menu>
|
|
||||||
<a href={callTweet}><Menu.Item name="tweet" ><Icon name='twitter' />Tweet</Menu.Item></a>
|
|
||||||
<a href={callDownload}><Menu.Item name="download"><Icon name="download" />Download</Menu.Item></a>
|
|
||||||
<a href={callLink}><Menu.Item name="link"><Icon name="at" />Link</Menu.Item></a>
|
|
||||||
</Menu>
|
|
||||||
</div>
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
menuItem: 'Playlist', render: () => {
|
menuItem: { key: 'list', icon: 'list', content: 'Create Event' }, render: () => {
|
||||||
return (
|
return (
|
||||||
<PlaylistBuilder />
|
<PlaylistBuilder />
|
||||||
)
|
)
|
||||||
@@ -111,7 +74,7 @@ function CallInfo(props) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Tab menu={{ attached: 'top' }} panes={panes} defaultActiveIndex={activeTab} onTabChange={handleTabChange} />
|
<Tab menu={{ attached: 'top', fluid: true, widths: 2 }} panes={panes} defaultActiveIndex={activeTab} onTabChange={handleTabChange} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
98
frontend/src/Call/components/CallInfoPane.js
Normal file
98
frontend/src/Call/components/CallInfoPane.js
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
import React, { useState } from "react";
|
||||||
|
import { useCallLink } from "./CallLinks";
|
||||||
|
import {skipToken} from '@reduxjs/toolkit/query'
|
||||||
|
import { useGetGroupsQuery, useGetTalkgroupsQuery } from '../../features/api/apiSlice'
|
||||||
|
import { Link, useLocation, useParams, useNavigate } from 'react-router-dom';
|
||||||
|
import {
|
||||||
|
Header,
|
||||||
|
Divider,
|
||||||
|
List,
|
||||||
|
Segment,
|
||||||
|
Statistic,
|
||||||
|
Icon,
|
||||||
|
Menu,
|
||||||
|
Tab
|
||||||
|
} from "semantic-ui-react";
|
||||||
|
import PlaylistBuilder from "./PlaylistBuilder"
|
||||||
|
// ----------------------------------------------------
|
||||||
|
function CallInfoPane(props) {
|
||||||
|
|
||||||
|
|
||||||
|
let srcList = "";
|
||||||
|
let callLength = "-";
|
||||||
|
let callFreq = "-";
|
||||||
|
let callDate = "-";
|
||||||
|
let callTime = "-";
|
||||||
|
let talkgroupNum = "-";
|
||||||
|
let header = "Call Info"
|
||||||
|
const currentCall = props.call?props.call:false;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const { data: talkgroupsData, isSuccess: isTalkgroupsSuccess } = useGetTalkgroupsQuery(currentCall?currentCall.shortName:skipToken);
|
||||||
|
|
||||||
|
if (currentCall) {
|
||||||
|
if ((talkgroupsData) && talkgroupsData.talkgroups[currentCall.talkgroupNum]) {
|
||||||
|
header = talkgroupsData.talkgroups[currentCall.talkgroupNum].description;
|
||||||
|
}
|
||||||
|
const time = new Date(currentCall.time);
|
||||||
|
callTime = time.toLocaleTimeString();
|
||||||
|
callDate = time.toLocaleDateString();
|
||||||
|
if (currentCall.freq) {
|
||||||
|
const freq = currentCall.freq / 1000000;
|
||||||
|
callFreq = Math.round(freq * 1000) / 1000;
|
||||||
|
}
|
||||||
|
srcList = currentCall.srcList.map((source, index) => <List.Item key={index}>{source.src}[{source.pos}]</List.Item>);
|
||||||
|
callLength = currentCall.len;
|
||||||
|
talkgroupNum = currentCall.talkgroupNum;
|
||||||
|
|
||||||
|
}
|
||||||
|
const { callLink, callDownload, callTweet } = useCallLink(props.call)
|
||||||
|
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Header as='h1'>{header}</Header>
|
||||||
|
<List bulleted horizontal link>
|
||||||
|
{srcList}
|
||||||
|
</List>
|
||||||
|
<Divider />
|
||||||
|
<Statistic size='small'>
|
||||||
|
<Statistic.Label>Seconds</Statistic.Label>
|
||||||
|
<Statistic.Value>{callLength}</Statistic.Value>
|
||||||
|
</Statistic>
|
||||||
|
<Statistic size='small'>
|
||||||
|
<Statistic.Label>Talkgroup</Statistic.Label>
|
||||||
|
<Statistic.Value>{talkgroupNum}</Statistic.Value>
|
||||||
|
</Statistic>
|
||||||
|
|
||||||
|
<List divided verticalAlign='middle'>
|
||||||
|
<List.Item>
|
||||||
|
<Icon name="wait" />
|
||||||
|
<List.Content>
|
||||||
|
{callTime}
|
||||||
|
</List.Content>
|
||||||
|
</List.Item>
|
||||||
|
<List.Item>
|
||||||
|
<Icon name="calendar outline" />
|
||||||
|
<List.Content>
|
||||||
|
{callDate}
|
||||||
|
</List.Content>
|
||||||
|
</List.Item>
|
||||||
|
<List.Item>
|
||||||
|
<Icon name="cubes" />
|
||||||
|
<List.Content>
|
||||||
|
{callFreq} MHz
|
||||||
|
</List.Content>
|
||||||
|
</List.Item>
|
||||||
|
</List>
|
||||||
|
<Divider />
|
||||||
|
<Menu secondary fluid widths={2}>
|
||||||
|
<Menu.Item name="download" href={callDownload}><Icon name="download" />Download</Menu.Item>
|
||||||
|
<Menu.Item name="link" href={callLink}><Icon name="at" />Link</Menu.Item>
|
||||||
|
</Menu>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default CallInfoPane;
|
||||||
@@ -164,7 +164,7 @@ function PlaylistBuilder(props) {
|
|||||||
</Table.Body>
|
</Table.Body>
|
||||||
</Table>
|
</Table>
|
||||||
</Tab.Pane>
|
</Tab.Pane>
|
||||||
<Menu>
|
<Menu fluid widths={2}>
|
||||||
<Menu.Item name="clear" onClick={() => setPlaylist([])}><Icon name='delete' />Clear</Menu.Item>
|
<Menu.Item name="clear" onClick={() => setPlaylist([])}><Icon name='delete' />Clear</Menu.Item>
|
||||||
<Menu.Item active name="submit" onClick={submitPlaylist}><Icon name="cloud upload" />Submit</Menu.Item>
|
<Menu.Item active name="submit" onClick={submitPlaylist}><Icon name="cloud upload" />Submit</Menu.Item>
|
||||||
</Menu>
|
</Menu>
|
||||||
|
|||||||
28
frontend/src/Event/EventCallInfo.js
Normal file
28
frontend/src/Event/EventCallInfo.js
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
import React, { useState } from "react";
|
||||||
|
import { Link, useLocation, useParams, useNavigate } from 'react-router-dom';
|
||||||
|
import {
|
||||||
|
Header,
|
||||||
|
Divider,
|
||||||
|
List,
|
||||||
|
Segment,
|
||||||
|
Statistic,
|
||||||
|
Icon,
|
||||||
|
Menu,
|
||||||
|
Tab
|
||||||
|
} from "semantic-ui-react";
|
||||||
|
import CallInfoPane from "../Call/components/CallInfoPane"
|
||||||
|
// ----------------------------------------------------
|
||||||
|
function EventCallInfo(props) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Segment>
|
||||||
|
<CallInfoPane call={props.call} />
|
||||||
|
</Segment>
|
||||||
|
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default EventCallInfo;
|
||||||
@@ -5,7 +5,7 @@ import MediaPlayer from "../Call/components/MediaPlayer";
|
|||||||
|
|
||||||
import SupportModal from "../Call/components/SupportModal";
|
import SupportModal from "../Call/components/SupportModal";
|
||||||
|
|
||||||
import CallInfo from "../Call/components/CallInfo";
|
import EventCallInfo from "./EventCallInfo";
|
||||||
import ListEventCalls from "./ListEventCalls";
|
import ListEventCalls from "./ListEventCalls";
|
||||||
import { useSelector, useDispatch } from 'react-redux'
|
import { useSelector, useDispatch } from 'react-redux'
|
||||||
|
|
||||||
@@ -110,7 +110,7 @@ function EventPlayer(props) {
|
|||||||
</Sidebar.Pushable>
|
</Sidebar.Pushable>
|
||||||
<Rail position='right' className="desktop-only" >
|
<Rail position='right' className="desktop-only" >
|
||||||
<Sticky offset={60} context={positionRef}>
|
<Sticky offset={60} context={positionRef}>
|
||||||
<CallInfo call={currentCall} />
|
<EventCallInfo call={currentCall} />
|
||||||
</Sticky>
|
</Sticky>
|
||||||
</Rail>
|
</Rail>
|
||||||
</Container>
|
</Container>
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ function ViewEvent(props) {
|
|||||||
</Container>
|
</Container>
|
||||||
</Menu>
|
</Menu>
|
||||||
<Grid style={{ paddingTop: '4em' }}>
|
<Grid style={{ paddingTop: '4em' }}>
|
||||||
<Grid.Column mobile={0} tablet={0} computer={1} ></Grid.Column>
|
<Grid.Column mobile={1} tablet={1} computer={1} ></Grid.Column>
|
||||||
<Grid.Column mobile={16} tablet={8} computer={4}>
|
<Grid.Column mobile={16} tablet={8} computer={4}>
|
||||||
<Container text >
|
<Container text >
|
||||||
{eventData && eventData.description}
|
{eventData && eventData.description}
|
||||||
@@ -135,15 +135,15 @@ function ViewEvent(props) {
|
|||||||
<Grid.Column mobile={8} tablet={8} computer={2}>
|
<Grid.Column mobile={8} tablet={8} computer={2}>
|
||||||
|
|
||||||
<Statistic>
|
<Statistic>
|
||||||
<Statistic.Value>{eventData.numCalls}</Statistic.Value>
|
<Statistic.Value>{eventData && eventData.numCalls}</Statistic.Value>
|
||||||
<Statistic.Label>Calls</Statistic.Label>
|
<Statistic.Label>Calls</Statistic.Label>
|
||||||
</Statistic>
|
</Statistic>
|
||||||
</Grid.Column>
|
</Grid.Column>
|
||||||
|
|
||||||
<Grid.Column mobile={0} tablet={0} computer={5}>
|
<Grid.Column mobile={1} tablet={1} computer={5}>
|
||||||
</Grid.Column>
|
</Grid.Column>
|
||||||
</Grid>
|
</Grid>
|
||||||
<EventPlayer eventData={eventData} selectCallId={selectCallId} />
|
{eventData && <EventPlayer eventData={eventData} selectCallId={selectCallId} />}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user