Achievements - Station Alert Console

Cheevos, AiAirlock/Restorer, Disposal, FileMan, NetDownloader/Monitor

Station Alert Console

Fix NtosAiRestorer

Remove deleted interfaces from routes.js
This commit is contained in:
Aleksej Komarov
2020-04-19 19:36:42 +03:00
parent 775c318d92
commit 684ce3ff4a
15 changed files with 614 additions and 668 deletions
@@ -8,7 +8,7 @@
usage_flags = PROGRAM_CONSOLE | PROGRAM_LAPTOP
transfer_access = ACCESS_HEADS
available_on_ntnet = TRUE
tgui_id = "AiRestorer"
tgui_id = "NtosAiRestorer"
ui_x = 370
ui_y = 400
/// Variable dictating if we are in the process of restoring the AI in the inserted intellicard
@@ -10,7 +10,7 @@
requires_ntnet_feature = NTNET_SOFTWAREDOWNLOAD
available_on_ntnet = 0
ui_header = "downloader_finished.gif"
tgui_id = "NtosNetMonitor"
tgui_id = "NtosNetDownloader"
ui_x = 480
ui_y = 735
+97 -90
View File
@@ -1,13 +1,105 @@
import { useBackend } from '../backend';
import { Box, Icon, Table, Tabs } from '../components';
import { Window } from '../layouts';
export const Achievement = props => {
export const Achievements = (props, context) => {
const { data } = useBackend(context);
const {
achievements,
categories,
highscore,
user_ckey,
} = data;
return (
<Window resizable>
<Window.Content scrollable>
<Tabs>
{categories.map(category => (
<Tabs.Tab
key={category}
label={category}>
<Table>
{achievements
.filter(x => x.category === category)
.map(achievement => {
if (achievement.score) {
return (
<Score
key={achievement.name}
achievement={achievement} />
);
}
return (
<Achievement
key={achievement.name}
achievement={achievement} />
);
})}
</Table>
</Tabs.Tab>
))}
<Tabs.Tab
label="High Scores">
<Tabs vertical>
{highscore.map(highscore => (
<Tabs.Tab
key={highscore.name}
label={highscore.name}>
<Table>
<Table.Row className="candystripe">
<Table.Cell color="label" textAlign="center">
#
</Table.Cell>
<Table.Cell color="label" textAlign="center">
Key
</Table.Cell>
<Table.Cell color="label" textAlign="center">
Score
</Table.Cell>
</Table.Row>
{Object.keys(highscore.scores).map((key, index) => (
<Table.Row
key={key}
className="candystripe"
m={2}>
<Table.Cell color="label" textAlign="center">
{index + 1}
</Table.Cell>
<Table.Cell
color={key === user_ckey && 'green'}
textAlign="center">
{index === 0 && (
<Icon name="crown" color="gold" mr={2} />
)}
{key}
{index === 0 && (
<Icon name="crown" color="gold" ml={2} />
)}
</Table.Cell>
<Table.Cell textAlign="center">
{highscore.scores[key]}
</Table.Cell>
</Table.Row>
))}
</Table>
</Tabs.Tab>
))}
</Tabs>
</Tabs.Tab>
</Tabs>
</Window.Content>
</Window>
);
};
const Achievement = props => {
const { achievement } = props;
const {
name,
desc,
icon_class,
value,
} = props;
} = achievement;
return (
<tr key={name}>
<td style={{ 'padding': '6px' }}>
@@ -24,13 +116,14 @@ export const Achievement = props => {
);
};
export const Score = props => {
const Score = props => {
const { achievement } = props;
const {
name,
desc,
icon_class,
value,
} = props;
} = achievement;
return (
<tr key={name}>
<td style={{ 'padding': '6px' }}>
@@ -46,89 +139,3 @@ export const Score = props => {
</tr>
);
};
export const Achievements = props => {
const { data } = useBackend(props);
return (
<Tabs>
{data.categories.map(category => (
<Tabs.Tab
key={category}
label={category}>
<Box as="Table">
{data.achievements
.filter(x => x.category === category)
.map(achievement => {
if (achievement.score) {
return (
<Score
key={achievement.name}
name={achievement.name}
desc={achievement.desc}
icon_class={achievement.icon_class}
value={achievement.value} />
);
}
return (
<Achievement
key={achievement.name}
name={achievement.name}
desc={achievement.desc}
icon_class={achievement.icon_class}
value={achievement.value} />
);
})}
</Box>
</Tabs.Tab>
))}
<Tabs.Tab
label="High Scores">
<Tabs vertical>
{data.highscore.map(highscore => (
<Tabs.Tab
key={highscore.name}
label={highscore.name}>
<Table>
<Table.Row className="candystripe">
<Table.Cell color="label" textAlign="center">
#
</Table.Cell>
<Table.Cell color="label" textAlign="center">
Key
</Table.Cell>
<Table.Cell color="label" textAlign="center">
Score
</Table.Cell>
</Table.Row>
{Object.keys(highscore.scores).map((key, index) => (
<Table.Row
key={key}
className="candystripe"
m={2}>
<Table.Cell color="label" textAlign="center">
{index+1}
</Table.Cell>
<Table.Cell
color={key === data.user_ckey && 'green'}
textAlign="center">
{index === 0 && (
<Icon name="crown" color="gold" mr={2} />
)}
{key}
{index === 0 && (
<Icon name="crown" color="gold" ml={2} />
)}
</Table.Cell>
<Table.Cell textAlign="center">
{highscore.scores[key]}
</Table.Cell>
</Table.Row>
))}
</Table>
</Tabs.Tab>
))}
</Tabs>
</Tabs.Tab>
</Tabs>
);
};
+185 -181
View File
@@ -1,196 +1,200 @@
import { Fragment } from 'inferno';
import { useBackend } from '../backend';
import { Button, LabeledList, Section } from '../components';
import { Window } from '../layouts';
const dangerMap = {
2: {
color: 'good',
localStatusText: 'Offline',
},
1: {
color: 'average',
localStatusText: 'Caution',
},
0: {
color: 'bad',
localStatusText: 'Optimal',
},
};
export const AiAirlock = props => {
const { act, data } = useBackend(props);
const dangerMap = {
2: {
color: 'good',
localStatusText: 'Offline',
},
1: {
color: 'average',
localStatusText: 'Caution',
},
0: {
color: 'bad',
localStatusText: 'Optimal',
},
};
const statusMain = dangerMap[data.power.main] || dangerMap[0];
const statusBackup = dangerMap[data.power.backup] || dangerMap[0];
const statusElectrify = dangerMap[data.shock] || dangerMap[0];
return (
<Fragment>
<Section title="Power Status">
<LabeledList>
<LabeledList.Item
label="Main"
color={statusMain.color}
buttons={(
<Button
icon="lightbulb-o"
disabled={!data.power.main}
content="Disrupt"
onClick={() => act('disrupt-main')} />
)}>
{data.power.main ? 'Online' : 'Offline'}
{' '}
{(!data.wires.main_1 || !data.wires.main_2)
&& '[Wires have been cut!]'
|| (data.power.main_timeleft > 0
&& `[${data.power.main_timeleft}s]`)}
</LabeledList.Item>
<LabeledList.Item
label="Backup"
color={statusBackup.color}
buttons={(
<Button
icon="lightbulb-o"
disabled={!data.power.backup}
content="Disrupt"
onClick={() => act('disrupt-backup')} />
)}>
{data.power.backup ? 'Online' : 'Offline'}
{' '}
{(!data.wires.backup_1 || !data.wires.backup_2)
&& '[Wires have been cut!]'
|| (data.power.backup_timeleft > 0
&& `[${data.power.backup_timeleft}s]`)}
</LabeledList.Item>
<LabeledList.Item
label="Electrify"
color={statusElectrify.color}
buttons={(
<Fragment>
<Window>
<Window.Content>
<Section title="Power Status">
<LabeledList>
<LabeledList.Item
label="Main"
color={statusMain.color}
buttons={(
<Button
icon="wrench"
disabled={!(data.wires.shock && data.shock === 0)}
content="Restore"
onClick={() => act('shock-restore')} />
icon="lightbulb-o"
disabled={!data.power.main}
content="Disrupt"
onClick={() => act('disrupt-main')} />
)}>
{data.power.main ? 'Online' : 'Offline'}
{' '}
{(!data.wires.main_1 || !data.wires.main_2)
&& '[Wires have been cut!]'
|| (data.power.main_timeleft > 0
&& `[${data.power.main_timeleft}s]`)}
</LabeledList.Item>
<LabeledList.Item
label="Backup"
color={statusBackup.color}
buttons={(
<Button
icon="bolt"
disabled={!data.wires.shock}
content="Temporary"
onClick={() => act('shock-temp')} />
icon="lightbulb-o"
disabled={!data.power.backup}
content="Disrupt"
onClick={() => act('disrupt-backup')} />
)}>
{data.power.backup ? 'Online' : 'Offline'}
{' '}
{(!data.wires.backup_1 || !data.wires.backup_2)
&& '[Wires have been cut!]'
|| (data.power.backup_timeleft > 0
&& `[${data.power.backup_timeleft}s]`)}
</LabeledList.Item>
<LabeledList.Item
label="Electrify"
color={statusElectrify.color}
buttons={(
<Fragment>
<Button
icon="wrench"
disabled={!(data.wires.shock && data.shock === 0)}
content="Restore"
onClick={() => act('shock-restore')} />
<Button
icon="bolt"
disabled={!data.wires.shock}
content="Temporary"
onClick={() => act('shock-temp')} />
<Button
icon="bolt"
disabled={!data.wires.shock}
content="Permanent"
onClick={() => act('shock-perm')} />
</Fragment>
)}>
{data.shock === 2 ? 'Safe' : 'Electrified'}
{' '}
{!data.wires.shock
&& '[Wires have been cut!]'
|| (data.shock_timeleft > 0
&& `[${data.shock_timeleft}s]`)
|| (data.shock_timeleft === -1
&& '[Permanent]')}
</LabeledList.Item>
</LabeledList>
</Section>
<Section title="Access and Door Control">
<LabeledList>
<LabeledList.Item
label="ID Scan"
color="bad"
buttons={(
<Button
icon="bolt"
disabled={!data.wires.shock}
content="Permanent"
onClick={() => act('shock-perm')} />
</Fragment>
)}>
{data.shock === 2 ? 'Safe' : 'Electrified'}
{' '}
{!data.wires.shock
&& '[Wires have been cut!]'
|| (data.shock_timeleft > 0
&& `[${data.shock_timeleft}s]`)
|| (data.shock_timeleft === -1
&& '[Permanent]')}
</LabeledList.Item>
</LabeledList>
</Section>
<Section title="Access and Door Control">
<LabeledList>
<LabeledList.Item
label="ID Scan"
color="bad"
buttons={(
<Button
icon={data.id_scanner ? 'power-off' : 'times'}
content={data.id_scanner ? 'Enabled' : 'Disabled'}
selected={data.id_scanner}
disabled={!data.wires.id_scanner}
onClick={() => act('idscan-toggle')} />
)}>
{!data.wires.id_scanner && '[Wires have been cut!]'}
</LabeledList.Item>
<LabeledList.Item
label="Emergency Access"
buttons={(
<Button
icon={data.emergency ? 'power-off' : 'times'}
content={data.emergency ? 'Enabled' : 'Disabled'}
selected={data.emergency}
onClick={() => act('emergency-toggle')} />
)} />
<LabeledList.Divider />
<LabeledList.Item
label="Door Bolts"
color="bad"
buttons={(
<Button
icon={data.locked ? 'lock' : 'unlock'}
content={data.locked ? 'Lowered' : 'Raised'}
selected={data.locked}
disabled={!data.wires.bolts}
onClick={() => act('bolt-toggle')} />
)}>
{!data.wires.bolts && '[Wires have been cut!]'}
</LabeledList.Item>
<LabeledList.Item
label="Door Bolt Lights"
color="bad"
buttons={(
<Button
icon={data.lights ? 'power-off' : 'times'}
content={data.lights ? 'Enabled' : 'Disabled'}
selected={data.lights}
disabled={!data.wires.lights}
onClick={() => act('light-toggle')} />
)}>
{!data.wires.lights && '[Wires have been cut!]'}
</LabeledList.Item>
<LabeledList.Item
label="Door Force Sensors"
color="bad"
buttons={(
<Button
icon={data.safe ? 'power-off' : 'times'}
content={data.safe ? 'Enabled' : 'Disabled'}
selected={data.safe}
disabled={!data.wires.safe}
onClick={() => act('safe-toggle')} />
)}>
{!data.wires.safe && '[Wires have been cut!]'}
</LabeledList.Item>
<LabeledList.Item
label="Door Timing Safety"
color="bad"
buttons={(
<Button
icon={data.speed ? 'power-off' : 'times'}
content={data.speed ? 'Enabled' : 'Disabled'}
selected={data.speed}
disabled={!data.wires.timing}
onClick={() => act('speed-toggle')} />
)}>
{!data.wires.timing && '[Wires have been cut!]'}
</LabeledList.Item>
<LabeledList.Divider />
<LabeledList.Item
label="Door Control"
color="bad"
buttons={(
<Button
icon={data.opened ? 'sign-out-alt' : 'sign-in-alt'}
content={data.opened ? 'Open' : 'Closed'}
selected={data.opened}
disabled={(data.locked || data.welded)}
onClick={() => act('open-close')} />
)}>
{!!(data.locked || data.welded) && (
<span>
[Door is {data.locked ? 'bolted' : ''}
{(data.locked && data.welded) ? ' and ' : ''}
{data.welded ? 'welded' : ''}!]
</span>
)}
</LabeledList.Item>
</LabeledList>
</Section>
</Fragment>
icon={data.id_scanner ? 'power-off' : 'times'}
content={data.id_scanner ? 'Enabled' : 'Disabled'}
selected={data.id_scanner}
disabled={!data.wires.id_scanner}
onClick={() => act('idscan-toggle')} />
)}>
{!data.wires.id_scanner && '[Wires have been cut!]'}
</LabeledList.Item>
<LabeledList.Item
label="Emergency Access"
buttons={(
<Button
icon={data.emergency ? 'power-off' : 'times'}
content={data.emergency ? 'Enabled' : 'Disabled'}
selected={data.emergency}
onClick={() => act('emergency-toggle')} />
)} />
<LabeledList.Divider />
<LabeledList.Item
label="Door Bolts"
color="bad"
buttons={(
<Button
icon={data.locked ? 'lock' : 'unlock'}
content={data.locked ? 'Lowered' : 'Raised'}
selected={data.locked}
disabled={!data.wires.bolts}
onClick={() => act('bolt-toggle')} />
)}>
{!data.wires.bolts && '[Wires have been cut!]'}
</LabeledList.Item>
<LabeledList.Item
label="Door Bolt Lights"
color="bad"
buttons={(
<Button
icon={data.lights ? 'power-off' : 'times'}
content={data.lights ? 'Enabled' : 'Disabled'}
selected={data.lights}
disabled={!data.wires.lights}
onClick={() => act('light-toggle')} />
)}>
{!data.wires.lights && '[Wires have been cut!]'}
</LabeledList.Item>
<LabeledList.Item
label="Door Force Sensors"
color="bad"
buttons={(
<Button
icon={data.safe ? 'power-off' : 'times'}
content={data.safe ? 'Enabled' : 'Disabled'}
selected={data.safe}
disabled={!data.wires.safe}
onClick={() => act('safe-toggle')} />
)}>
{!data.wires.safe && '[Wires have been cut!]'}
</LabeledList.Item>
<LabeledList.Item
label="Door Timing Safety"
color="bad"
buttons={(
<Button
icon={data.speed ? 'power-off' : 'times'}
content={data.speed ? 'Enabled' : 'Disabled'}
selected={data.speed}
disabled={!data.wires.timing}
onClick={() => act('speed-toggle')} />
)}>
{!data.wires.timing && '[Wires have been cut!]'}
</LabeledList.Item>
<LabeledList.Divider />
<LabeledList.Item
label="Door Control"
color="bad"
buttons={(
<Button
icon={data.opened ? 'sign-out-alt' : 'sign-in-alt'}
content={data.opened ? 'Open' : 'Closed'}
selected={data.opened}
disabled={(data.locked || data.welded)}
onClick={() => act('open-close')} />
)}>
{!!(data.locked || data.welded) && (
<span>
[Door is {data.locked ? 'bolted' : ''}
{(data.locked && data.welded) ? ' and ' : ''}
{data.welded ? 'welded' : ''}!]
</span>
)}
</LabeledList.Item>
</LabeledList>
</Section>
</Window.Content>
</Window>
);
};
+17 -9
View File
@@ -1,9 +1,20 @@
import { Fragment } from 'inferno';
import { useBackend } from "../backend";
import { Section, Box, Button, NoticeBox, ProgressBar, LabeledList } from "../components";
import { useBackend } from '../backend';
import { Box, Button, LabeledList, NoticeBox, ProgressBar, Section } from '../components';
import { Window } from '../layouts';
export const AiRestorer = props => {
const { act, data } = useBackend(props);
export const AiRestorer = () => {
return (
<Window resizable>
<Window.Content scrollable>
<AiRestorerContent />
</Window.Content>
</Window>
);
};
export const AiRestorerContent = (props, context) => {
const { act, data } = useBackend(context);
const {
AI_present,
error,
@@ -14,7 +25,6 @@ export const AiRestorer = props => {
health,
ejectable,
} = data;
return (
<Fragment>
{error && (
@@ -28,8 +38,7 @@ export const AiRestorer = props => {
icon="eject"
content={AI_present ? name : "----------"}
disabled={!AI_present}
onClick={() => act('PRG_eject')}
/>
onClick={() => act('PRG_eject')} />
)}
{!!AI_present && (
<Section
@@ -71,8 +80,7 @@ export const AiRestorer = props => {
content="Begin Reconstruction"
disabled={restoring}
mt={1}
onClick={() => act('PRG_beginReconstruction')}
/>
onClick={() => act('PRG_beginReconstruction')} />
<Section title="Laws" level={2}>
{laws.map(law => (
<Box key={law} className="candystripe">
+52 -47
View File
@@ -1,8 +1,9 @@
import { useBackend } from '../backend';
import { Button, LabeledList, ProgressBar, Section } from '../components';
import { Window } from '../layouts';
export const DisposalUnit = props => {
const { act, data } = useBackend(props);
export const DisposalUnit = (props, context) => {
const { act, data } = useBackend(context);
let stateColor;
let stateText;
if (data.full_pressure) {
@@ -22,50 +23,54 @@ export const DisposalUnit = props => {
stateText = 'Off';
}
return (
<Section>
<LabeledList>
<LabeledList.Item
label="State"
color={stateColor}>
{stateText}
</LabeledList.Item>
<LabeledList.Item
label="Pressure">
<ProgressBar
value={data.per}
color="good" />
</LabeledList.Item>
<LabeledList.Item
label="Handle">
<Button
icon={data.flush ? 'toggle-on' : 'toggle-off'}
disabled={data.isai || data.panel_open}
content={data.flush ? 'Disengage' : 'Engage'}
onClick={() => act(data.flush
? 'handle-0'
: 'handle-1')}
/>
</LabeledList.Item>
<LabeledList.Item
label="Eject">
<Button
icon="sign-out-alt"
disabled={data.isai}
content="Eject Contents"
onClick={() => act('eject')} />
</LabeledList.Item>
<LabeledList.Item
label="Power">
<Button
icon="power-off"
disabled={data.panel_open}
selected={data.pressure_charging}
onClick={() => act(data.pressure_charging
? 'pump-0'
: 'pump-1')}
/>
</LabeledList.Item>
</LabeledList>
</Section>
<Window>
<Window.Content>
<Section>
<LabeledList>
<LabeledList.Item
label="State"
color={stateColor}>
{stateText}
</LabeledList.Item>
<LabeledList.Item
label="Pressure">
<ProgressBar
value={data.per}
color="good" />
</LabeledList.Item>
<LabeledList.Item
label="Handle">
<Button
icon={data.flush ? 'toggle-on' : 'toggle-off'}
disabled={data.isai || data.panel_open}
content={data.flush ? 'Disengage' : 'Engage'}
onClick={() => act(data.flush
? 'handle-0'
: 'handle-1')}
/>
</LabeledList.Item>
<LabeledList.Item
label="Eject">
<Button
icon="sign-out-alt"
disabled={data.isai}
content="Eject Contents"
onClick={() => act('eject')} />
</LabeledList.Item>
<LabeledList.Item
label="Power">
<Button
icon="power-off"
disabled={data.panel_open}
selected={data.pressure_charging}
onClick={() => act(data.pressure_charging
? 'pump-0'
: 'pump-1')}
/>
</LabeledList.Item>
</LabeledList>
</Section>
</Window.Content>
</Window>
);
};
@@ -0,0 +1,12 @@
import { NtosWindow } from '../layouts';
import { AiRestorerContent } from './AiRestorer';
export const AiRestorer = () => {
return (
<NtosWindow resizable>
<NtosWindow.Content scrollable>
<AiRestorerContent />
</NtosWindow.Content>
</NtosWindow>
);
};
@@ -1,8 +1,51 @@
import { Section, Table, Button } from "../components";
import { useBackend } from "../backend";
import { Fragment } from "inferno";
import { Fragment } from 'inferno';
import { useBackend } from '../backend';
import { Button, Section, Table } from '../components';
import { NtosWindow } from '../layouts';
export const FileTable = props => {
export const NtosFileManager = (props, context) => {
const { act, data } = useBackend(context);
const {
usbconnected,
files = [],
usbfiles = [],
} = data;
return (
<NtosWindow resizable>
<NtosWindow.Content scrollable>
<Section>
<FileTable
files={files}
usbconnected={usbconnected}
onUpload={file => act('PRG_copytousb', { name: file })}
onDelete={file => act('PRG_deletefile', { name: file })}
onRename={(file, newName) => act('PRG_rename', {
name: file,
new_name: newName,
})}
onDuplicate={file => act('PRG_clone', { file: file })} />
</Section>
{usbconnected && (
<Section title="Data Disk">
<FileTable
usbmode
files={usbfiles}
usbconnected={usbconnected}
onUpload={file => act('PRG_copyfromusb', { name: file })}
onDelete={file => act('PRG_deletefile', { name: file })}
onRename={(file, newName) => act('PRG_rename', {
name: file,
new_name: newName,
})}
onDuplicate={file => act('PRG_clone', { file: file })} />
</Section>
)}
</NtosWindow.Content>
</NtosWindow>
);
};
const FileTable = props => {
const {
files = [],
usbconnected,
@@ -11,7 +54,6 @@ export const FileTable = props => {
onDelete,
onRename,
} = props;
return (
<Table>
<Table.Row header>
@@ -75,45 +117,3 @@ export const FileTable = props => {
</Table>
);
};
export const NtosFileManager = props => {
const { act, data } = useBackend(props);
const {
usbconnected,
files = [],
usbfiles = [],
} = data;
return (
<Fragment>
<Section>
<FileTable
files={files}
usbconnected={usbconnected}
onUpload={file => act('PRG_copytousb', { name: file })}
onDelete={file => act('PRG_deletefile', { name: file })}
onRename={(file, newName) => act('PRG_rename', {
name: file,
new_name: newName,
})}
onDuplicate={file => act('PRG_clone', { file: file })} />
</Section>
{usbconnected && (
<Section title="Data Disk">
<FileTable
usbmode
files={usbfiles}
usbconnected={usbconnected}
onUpload={file => act('PRG_copyfromusb', { name: file })}
onDelete={file => act('PRG_deletefile', { name: file })}
onRename={(file, newName) => act('PRG_rename', {
name: file,
new_name: newName,
})}
onDuplicate={file => act('PRG_clone', { file: file })} />
</Section>
)}
</Fragment>
);
};
@@ -1,10 +1,9 @@
import { Fragment } from 'inferno';
import { useBackend } from '../backend';
import { Box, Button, Flex, Icon, LabeledList, NoticeBox, ProgressBar, Section } from '../components';
import { NtosWindow } from '../layouts';
export const NtosNetDownloader = props => {
const { state } = props;
const { act, data } = useBackend(props);
export const NtosNetDownloader = (props, context) => {
const { act, data } = useBackend(context);
const {
disk_size,
disk_used,
@@ -14,58 +13,58 @@ export const NtosNetDownloader = props => {
hackedavailable,
} = data;
return (
<Fragment>
{!!error && (
<NoticeBox>
<Box mb={1}>
{error}
</Box>
<Button
content="Reset"
onClick={() => act('PRG_reseterror')} />
</NoticeBox>
)}
<Section>
<LabeledList>
<LabeledList.Item label="Disk usage">
<ProgressBar
value={disk_used}
minValue={0}
maxValue={disk_size}>
{`${disk_used} GQ / ${disk_size} GQ`}
</ProgressBar>
</LabeledList.Item>
</LabeledList>
</Section>
<Section>
{downloadable_programs.map(program => (
<Program
key={program.filename}
state={state}
program={program} />
))}
</Section>
{!!hackedavailable && (
<Section title="UNKNOWN Software Repository">
<NoticeBox mb={1}>
Please note that Nanotrasen does not recommend download
of software from non-official servers.
<NtosWindow resizable>
<NtosWindow.Content scrollable>
{!!error && (
<NoticeBox>
<Box mb={1}>
{error}
</Box>
<Button
content="Reset"
onClick={() => act('PRG_reseterror')} />
</NoticeBox>
{hacked_programs.map(program => (
)}
<Section>
<LabeledList>
<LabeledList.Item label="Disk usage">
<ProgressBar
value={disk_used}
minValue={0}
maxValue={disk_size}>
{`${disk_used} GQ / ${disk_size} GQ`}
</ProgressBar>
</LabeledList.Item>
</LabeledList>
</Section>
<Section>
{downloadable_programs.map(program => (
<Program
key={program.filename}
state={state}
program={program} />
))}
</Section>
)}
</Fragment>
{!!hackedavailable && (
<Section title="UNKNOWN Software Repository">
<NoticeBox mb={1}>
Please note that Nanotrasen does not recommend download
of software from non-official servers.
</NoticeBox>
{hacked_programs.map(program => (
<Program
key={program.filename}
program={program} />
))}
</Section>
)}
</NtosWindow.Content>
</NtosWindow>
);
};
const Program = props => {
const Program = (props, context) => {
const { program } = props;
const { act, data } = useBackend(props);
const { act, data } = useBackend(context);
const {
disk_size,
disk_used,
+123 -122
View File
@@ -1,10 +1,10 @@
import { Section, Box, Button, NoticeBox, ProgressBar, LabeledList, NumberInput } from "../components";
import { Section, Box, Button, NoticeBox, LabeledList, NumberInput } from "../components";
import { useBackend } from "../backend";
import { Fragment } from "inferno";
import { NtosWindow } from "../layouts";
export const NtosNetMonitor = props => {
const { act, data } = useBackend(props);
export const NtosNetMonitor = (props, context) => {
const { act, data } = useBackend(context);
const {
ntnetrelays,
ntnetstatus,
@@ -19,129 +19,130 @@ export const NtosNetMonitor = props => {
minlogs,
ntnetlogs = [],
} = data;
return (
<Fragment>
<NoticeBox>
WARNING: Disabling wireless transmitters when using
a wireless device may prevent you from reenabling them!
</NoticeBox>
<Section
title="Wireless Connectivity"
buttons={(
<Button.Confirm
icon={ntnetstatus ? 'power-off' : 'times'}
content={ntnetstatus ? 'ENABLED' : 'DISABLED'}
selected={ntnetstatus}
onClick={() => act('toggleWireless')} />
)}>
{ntnetrelays ? (
<LabeledList>
<LabeledList.Item label="Active NTNet Relays">
{ntnetrelays}
</LabeledList.Item>
</LabeledList>
) : "No Relays Connected"}
</Section>
<Section title="Firewall Configuration">
<LabeledList>
<LabeledList.Item
label="Software Downloads"
buttons={(
<Button
icon={config_softwaredownload ? 'power-off' : 'times'}
content={config_softwaredownload ? 'ENABLED' : 'DISABLED'}
selected={config_softwaredownload}
onClick={() => act('toggle_function', { id: "1" })} />
)} />
<LabeledList.Item
label="Peer to Peer Traffic"
buttons={(
<Button
icon={config_peertopeer ? 'power-off' : 'times'}
content={config_peertopeer ? 'ENABLED' : 'DISABLED'}
selected={config_peertopeer}
onClick={() => act('toggle_function', { id: "2" })} />
)} />
<LabeledList.Item
label="Communication Systems"
buttons={(
<Button
icon={config_communication ? 'power-off' : 'times'}
content={config_communication ? 'ENABLED' : 'DISABLED'}
selected={config_communication}
onClick={() => act('toggle_function', { id: "3" })} />
)} />
<LabeledList.Item
label="Remote System Control"
buttons={(
<Button
icon={config_systemcontrol ? 'power-off' : 'times'}
content={config_systemcontrol ? 'ENABLED' : 'DISABLED'}
selected={config_systemcontrol}
onClick={() => act('toggle_function', { id: "4" })} />
)} />
</LabeledList>
</Section>
<Section title="Security Systems">
{!!idsalarm && (
<Fragment>
<NoticeBox>
NETWORK INCURSION DETECTED
</NoticeBox>
<Box italics>
Abnormal activity has been detected in the network.
Check system logs for more information
</Box>
</Fragment>
)}
<LabeledList>
<LabeledList.Item
label="IDS Status"
buttons={(
<Fragment>
<Button
icon={idsstatus ? 'power-off' : 'times'}
content={idsstatus ? 'ENABLED' : 'DISABLED'}
selected={idsstatus}
onClick={() => act('toggleIDS')} />
<Button
icon="sync"
content="Reset"
color="bad"
onClick={() => act('resetIDS')} />
</Fragment>
)} />
<LabeledList.Item
label="Max Log Count"
buttons={(
<NumberInput
value={ntnetmaxlogs}
minValue={minlogs}
maxValue={maxlogs}
width="39px"
onChange={(e, value) => act('updatemaxlogs', {
new_number: value,
})}
/>
)} />
</LabeledList>
<NtosWindow resizable>
<NtosWindow.Content scrollable>
<NoticeBox>
WARNING: Disabling wireless transmitters when using
a wireless device may prevent you from reenabling them!
</NoticeBox>
<Section
title="System Log"
level={2}
title="Wireless Connectivity"
buttons={(
<Button.Confirm
icon="trash"
content="Clear Logs"
onClick={() => act('purgelogs')} />
icon={ntnetstatus ? 'power-off' : 'times'}
content={ntnetstatus ? 'ENABLED' : 'DISABLED'}
selected={ntnetstatus}
onClick={() => act('toggleWireless')} />
)}>
{ntnetlogs.map(log => (
<Box key={log.entry} className="candystripe">
{log.entry}
</Box>
))}
{ntnetrelays ? (
<LabeledList>
<LabeledList.Item label="Active NTNet Relays">
{ntnetrelays}
</LabeledList.Item>
</LabeledList>
) : "No Relays Connected"}
</Section>
</Section>
</Fragment>
<Section title="Firewall Configuration">
<LabeledList>
<LabeledList.Item
label="Software Downloads"
buttons={(
<Button
icon={config_softwaredownload ? 'power-off' : 'times'}
content={config_softwaredownload ? 'ENABLED' : 'DISABLED'}
selected={config_softwaredownload}
onClick={() => act('toggle_function', { id: "1" })} />
)} />
<LabeledList.Item
label="Peer to Peer Traffic"
buttons={(
<Button
icon={config_peertopeer ? 'power-off' : 'times'}
content={config_peertopeer ? 'ENABLED' : 'DISABLED'}
selected={config_peertopeer}
onClick={() => act('toggle_function', { id: "2" })} />
)} />
<LabeledList.Item
label="Communication Systems"
buttons={(
<Button
icon={config_communication ? 'power-off' : 'times'}
content={config_communication ? 'ENABLED' : 'DISABLED'}
selected={config_communication}
onClick={() => act('toggle_function', { id: "3" })} />
)} />
<LabeledList.Item
label="Remote System Control"
buttons={(
<Button
icon={config_systemcontrol ? 'power-off' : 'times'}
content={config_systemcontrol ? 'ENABLED' : 'DISABLED'}
selected={config_systemcontrol}
onClick={() => act('toggle_function', { id: "4" })} />
)} />
</LabeledList>
</Section>
<Section title="Security Systems">
{!!idsalarm && (
<Fragment>
<NoticeBox>
NETWORK INCURSION DETECTED
</NoticeBox>
<Box italics>
Abnormal activity has been detected in the network.
Check system logs for more information
</Box>
</Fragment>
)}
<LabeledList>
<LabeledList.Item
label="IDS Status"
buttons={(
<Fragment>
<Button
icon={idsstatus ? 'power-off' : 'times'}
content={idsstatus ? 'ENABLED' : 'DISABLED'}
selected={idsstatus}
onClick={() => act('toggleIDS')} />
<Button
icon="sync"
content="Reset"
color="bad"
onClick={() => act('resetIDS')} />
</Fragment>
)} />
<LabeledList.Item
label="Max Log Count"
buttons={(
<NumberInput
value={ntnetmaxlogs}
minValue={minlogs}
maxValue={maxlogs}
width="39px"
onChange={(e, value) => act('updatemaxlogs', {
new_number: value,
})}
/>
)} />
</LabeledList>
<Section
title="System Log"
level={2}
buttons={(
<Button.Confirm
icon="trash"
content="Clear Logs"
onClick={() => act('purgelogs')} />
)}>
{ntnetlogs.map(log => (
<Box key={log.entry} className="candystripe">
{log.entry}
</Box>
))}
</Section>
</Section>
</NtosWindow.Content>
</NtosWindow>
);
};
@@ -0,0 +1,12 @@
import { NtosWindow } from '../layouts';
import { StationAlertConsoleContent } from './StationAlertConsole';
export const NtosStationAlertConsole = () => {
return (
<NtosWindow resizable>
<NtosWindow.Content scrollable>
<StationAlertConsoleContent />
</NtosWindow.Content>
</NtosWindow>
);
};
@@ -1,9 +1,20 @@
import { Fragment } from 'inferno';
import { useBackend } from '../backend';
import { Section } from '../components';
import { Window } from '../layouts';
export const StationAlertConsole = props => {
const { data } = useBackend(props);
export const StationAlertConsole = () => {
return (
<Window resizable>
<Window.Content scrollable>
<StationAlertConsole />
</Window.Content>
</Window>
);
};
export const StationAlertConsoleContent = (props, context) => {
const { data } = useBackend(context);
const categories = data.alarms || [];
const fire = categories['Fire'] || [];
const atmos = categories['Atmosphere'] || [];
+8 -2
View File
@@ -4,7 +4,11 @@ import { refocusLayout } from './Layout';
import { Window } from './Window';
export const NtosWindow = (props, context) => {
const { children } = props;
const {
resizable,
theme = 'ntos',
children,
} = props;
const { act, data } = useBackend(context);
const {
PC_batteryicon,
@@ -17,7 +21,9 @@ export const NtosWindow = (props, context) => {
PC_showexitprogram,
} = data;
return (
<Window theme="ntos">
<Window
theme={theme}
resizable={resizable}>
<div className="NtosWindow">
<div
className="NtosWindow__header NtosHeader"
+1 -1
View File
@@ -44,7 +44,7 @@ export const createLogger = ns => {
};
/**
* A generic instance of a logger.
* A generic instance of the logger.
*
* Does not have a namespace associated with it.
*/
-119
View File
@@ -19,26 +19,10 @@ export const getRoutedComponent = state => {
};
// const ROUTES = {
// achievements: {
// component: () => Achievements,
// scrollable: true,
// },
// ai_airlock: {
// component: () => AiAirlock,
// scrollable: false,
// },
// ai_restorer: {
// component: () => AiRestorer,
// scrollable: true,
// },
// airlock_electronics: {
// component: () => AirlockElectronics,
// scrollable: false,
// },
// apc: {
// component: () => Apc,
// scrollable: false,
// },
// atmos_alert: {
// component: () => AtmosAlertConsole,
// scrollable: true,
@@ -93,10 +77,6 @@ export const getRoutedComponent = state => {
// wrapper: () => CameraConsoleWrapper,
// scrollable: true,
// },
// canister: {
// component: () => Canister,
// scrollable: false,
// },
// canvas: {
// component: () => Canvas,
// scrollable: false,
@@ -327,12 +307,6 @@ export const getRoutedComponent = state => {
// component: () => NtnetRelay,
// scrollable: false,
// },
// ntos_ai_restorer: {
// component: () => AiRestorer,
// wrapper: () => NtosWrapper,
// scrollable: true,
// theme: 'ntos',
// },
// ntos_atmos: {
// component: () => NtosAtmos,
// wrapper: () => NtosWrapper,
@@ -369,24 +343,12 @@ export const getRoutedComponent = state => {
// scrollable: true,
// theme: 'ntos',
// },
// ntos_file_manager: {
// component: () => NtosFileManager,
// wrapper: () => NtosWrapper,
// scrollable: true,
// theme: 'ntos',
// },
// ntos_job_manager: {
// component: () => NtosJobManager,
// wrapper: () => NtosWrapper,
// scrollable: true,
// theme: 'ntos',
// },
// ntos_main: {
// component: () => NtosMain,
// wrapper: () => NtosWrapper,
// scrollable: true,
// theme: 'ntos',
// },
// ntos_net_chat: {
// component: () => NtosNetChat,
// wrapper: () => NtosWrapper,
@@ -399,24 +361,6 @@ export const getRoutedComponent = state => {
// scrollable: false,
// theme: 'syndicate',
// },
// ntos_net_downloader: {
// component: () => NtosNetDownloader,
// wrapper: () => NtosWrapper,
// scrollable: true,
// theme: 'ntos',
// },
// ntos_net_monitor: {
// component: () => NtosNetMonitor,
// wrapper: () => NtosWrapper,
// scrollable: true,
// theme: 'ntos',
// },
// ntos_power_monitor: {
// component: () => PowerMonitor,
// wrapper: () => NtosWrapper,
// scrollable: true,
// theme: 'ntos',
// },
// ntos_revelation: {
// component: () => NtosRevelation,
// wrapper: () => NtosWrapper,
@@ -435,12 +379,6 @@ export const getRoutedComponent = state => {
// scrollable: true,
// theme: 'ntos',
// },
// ntos_station_alert: {
// component: () => StationAlertConsole,
// wrapper: () => NtosWrapper,
// scrollable: true,
// theme: 'ntos',
// },
// ntos_supermatter_monitor: {
// component: () => NtosSupermatterMonitor,
// wrapper: () => NtosWrapper,
@@ -484,10 +422,6 @@ export const getRoutedComponent = state => {
// component: () => PortableScrubber,
// scrollable: false,
// },
// power_monitor: {
// component: () => PowerMonitor,
// scrollable: true,
// },
// proximity_sensor: {
// component: () => ProximitySensor,
// scrollable: false,
@@ -546,10 +480,6 @@ export const getRoutedComponent = state => {
// component: () => SmartVend,
// scrollable: true,
// },
// smes: {
// component: () => Smes,
// scrollable: false,
// },
// smoke_machine: {
// component: () => SmokeMachine,
// scrollable: false,
@@ -566,10 +496,6 @@ export const getRoutedComponent = state => {
// component: () => SpawnersMenu,
// scrollable: true,
// },
// station_alert: {
// component: () => StationAlertConsole,
// scrollable: true,
// },
// suit_storage_unit: {
// component: () => SuitStorageUnit,
// scrollable: false,
@@ -580,51 +506,6 @@ export const getRoutedComponent = state => {
// scrollable: true,
// theme: 'syndicate',
// },
// tanks: {
// component: () => Tank,
// scrollable: false,
// },
// tank_dispenser: {
// component: () => TankDispenser,
// scrollable: false,
// },
// teleporter: {
// component: () => Teleporter,
// scrollable: false,
// },
// thermomachine: {
// component: () => ThermoMachine,
// scrollable: false,
// },
// timer: {
// component: () => Timer,
// scrollable: false,
// },
// transfer_valve: {
// component: () => TransferValve,
// scrollable: false,
// },
// turbine_computer: {
// component: () => TurbineComputer,
// scrollable: false,
// },
// uplink: {
// component: () => Uplink,
// scrollable: true,
// theme: 'syndicate',
// },
// vault_controller: {
// component: () => VaultController,
// scrollable: false,
// },
// vending: {
// component: () => Vending,
// scrollable: true,
// },
// wires: {
// component: () => Wires,
// scrollable: false,
// },
// scan_consolenew: {
// component: () => DnaConsole,
// scrollable: true,