-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MIRROR] New views for mc controller ui (#2142)
* New views for mc controller ui (#82769) ## About The Pull Request Lots of qol improvements for controller tgui - Auto sort order based on type - Bar view for items in deciseconds <details> <summary>vids</summary> in a live round ![image](https://github.com/tgstation/tgstation/assets/42397676/52fd4677-763a-4ea9-965a-386ab59cd353) modals ![Tzp0i9yfwP](https://github.com/tgstation/tgstation/assets/42397676/06ca6d9e-c528-4f02-8dbb-d302d2380396) bar view with defaults for decisecond sorts ![2X6IqQIE7c](https://github.com/tgstation/tgstation/assets/42397676/88b80fd4-1116-4ba1-aa0b-6bac56827e6b) </details> ## Why It's Good For The Game Better admin tools ## Changelog :cl: add: Admin tools buffed, check the Controller Overview add: Controller Overview moved to debug tab /:cl: * New views for mc controller ui --------- Co-authored-by: Jeremiah <[email protected]>
- Loading branch information
1 parent
df3285b
commit 8cb5f8c
Showing
10 changed files
with
621 additions
and
246 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
57 changes: 57 additions & 0 deletions
57
tgui/packages/tgui/interfaces/ControllerOverview/OverviewSection.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import { useBackend } from '../../backend'; | ||
import { Button, LabeledList, Section, Stack } from '../../components'; | ||
import { ControllerData } from './types'; | ||
|
||
export function OverviewSection(props) { | ||
const { act, data } = useBackend<ControllerData>(); | ||
const { fast_update, map_cpu, subsystems = [], world_time } = data; | ||
|
||
let overallUsage = 0; | ||
let overallOverrun = 0; | ||
for (let i = 0; i < subsystems.length; i++) { | ||
overallUsage += subsystems[i].tick_usage; | ||
overallOverrun += subsystems[i].tick_overrun; | ||
} | ||
|
||
return ( | ||
<Section | ||
fill | ||
title="Master Overview" | ||
buttons={ | ||
<Button | ||
tooltip="Fast Update" | ||
icon={fast_update ? 'check-square-o' : 'square-o'} | ||
color={fast_update && 'average'} | ||
onClick={() => { | ||
act('toggle_fast_update'); | ||
}} | ||
> | ||
Fast | ||
</Button> | ||
} | ||
> | ||
<Stack fill> | ||
<Stack.Item grow> | ||
<LabeledList> | ||
<LabeledList.Item label="World Time"> | ||
{world_time.toFixed(1)} | ||
</LabeledList.Item> | ||
<LabeledList.Item label="Map CPU"> | ||
{map_cpu.toFixed(2)}% | ||
</LabeledList.Item> | ||
</LabeledList> | ||
</Stack.Item> | ||
<Stack.Item grow> | ||
<LabeledList> | ||
<LabeledList.Item label="Overall Usage"> | ||
{(overallUsage * 0.01).toFixed(2)}% | ||
</LabeledList.Item> | ||
<LabeledList.Item label="Overall Overrun"> | ||
{(overallOverrun * 0.01).toFixed(2)}% | ||
</LabeledList.Item> | ||
</LabeledList> | ||
</Stack.Item> | ||
</Stack> | ||
</Section> | ||
); | ||
} |
69 changes: 69 additions & 0 deletions
69
tgui/packages/tgui/interfaces/ControllerOverview/SubsystemDialog.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import { | ||
Box, | ||
Button, | ||
Divider, | ||
LabeledList, | ||
Modal, | ||
Stack, | ||
} from '../../components'; | ||
import { SubsystemData } from './types'; | ||
|
||
type Props = { | ||
subsystem: SubsystemData; | ||
onClose: () => void; | ||
}; | ||
|
||
export function SubsystemDialog(props: Props) { | ||
const { subsystem, onClose } = props; | ||
const { | ||
cost_ms, | ||
init_order, | ||
initialization_failure_message, | ||
last_fire, | ||
name, | ||
next_fire, | ||
tick_overrun, | ||
tick_usage, | ||
} = subsystem; | ||
|
||
return ( | ||
<Modal width="85%" ml={7}> | ||
<Stack fill> | ||
<Stack.Item grow fontSize="22px"> | ||
{name} | ||
</Stack.Item> | ||
<Stack.Item> | ||
<Button color="bad" icon="times" onClick={onClose} /> | ||
</Stack.Item> | ||
</Stack> | ||
<Divider /> | ||
<Box p={1}> | ||
<LabeledList> | ||
<LabeledList.Item label="Init Order">{init_order}</LabeledList.Item> | ||
<LabeledList.Item label="Last Fire">{last_fire}</LabeledList.Item> | ||
<LabeledList.Item label="Next Fire">{next_fire}</LabeledList.Item> | ||
<LabeledList.Item label="Cost">{cost_ms}ms</LabeledList.Item> | ||
<LabeledList.Item label="Tick Usage"> | ||
{(tick_usage * 0.01).toFixed(2)}% | ||
</LabeledList.Item> | ||
<LabeledList.Item label="Tick Overrun"> | ||
{(tick_overrun * 0.01).toFixed(2)}% | ||
</LabeledList.Item> | ||
{initialization_failure_message && ( | ||
<LabeledList.Item color="bad"> | ||
{initialization_failure_message} | ||
</LabeledList.Item> | ||
)} | ||
</LabeledList> | ||
</Box> | ||
<Stack fill justify="space-between"> | ||
<Stack.Item /> | ||
<Stack.Item> | ||
<Button color="good" onClick={onClose} px={3} py={1}> | ||
Close | ||
</Button> | ||
</Stack.Item> | ||
</Stack> | ||
</Modal> | ||
); | ||
} |
Oops, something went wrong.