Run yarn format.

This commit is contained in:
Orne Brocaar 2022-11-01 10:28:57 +00:00
parent 5b3b44bce4
commit 577a33ec9a
5 changed files with 42 additions and 34 deletions

View File

@ -72,13 +72,13 @@ class Header extends Component<IProps, IState> {
if (!oidc.getEnabled() || oidc.getLogoutUrl() === "") { if (!oidc.getEnabled() || oidc.getLogoutUrl() === "") {
SessionStore.logout(true, () => { SessionStore.logout(true, () => {
this.props.history.push("/login"); this.props.history.push("/login");
}); });
} else { } else {
SessionStore.logout(false, () => { SessionStore.logout(false, () => {
window.location.assign(oidc.getLogoutUrl()); window.location.assign(oidc.getLogoutUrl());
}); });
} }
} };
render() { render() {
if (this.state.settings === undefined) { if (this.state.settings === undefined) {
@ -94,9 +94,7 @@ class Header extends Component<IProps, IState> {
<Link to={`/users/${this.props.user.getId()}/password`}>Change password</Link> <Link to={`/users/${this.props.user.getId()}/password`}>Change password</Link>
</Menu.Item> </Menu.Item>
)} )}
<Menu.Item onClick={this.onLogout}> <Menu.Item onClick={this.onLogout}>Logout</Menu.Item>
Logout
</Menu.Item>
</Menu> </Menu>
); );

View File

@ -186,9 +186,7 @@ class SideMenu extends Component<RouteComponentProps, IState> {
key: "ns", key: "ns",
label: "Network Server", label: "Network Server",
icon: <CloudOutlined />, icon: <CloudOutlined />,
children: [ children: [{ key: "ns-regions", icon: <CompassOutlined />, label: <Link to="/regions">Regions</Link> }],
{ key: "ns-regions", icon: <CompassOutlined />, label: <Link to="/regions">Regions</Link> },
],
}); });
} }

View File

@ -211,7 +211,7 @@ class InternalStore extends EventEmitter {
callbackFunc(resp); callbackFunc(resp);
}); });
} };
getRegion = (req: GetRegionRequest, callbackFunc: (resp: GetRegionResponse) => void) => { getRegion = (req: GetRegionRequest, callbackFunc: (resp: GetRegionResponse) => void) => {
this.client.getRegion(req, SessionStore.getMetadata(), (err, resp) => { this.client.getRegion(req, SessionStore.getMetadata(), (err, resp) => {
@ -222,7 +222,7 @@ class InternalStore extends EventEmitter {
callbackFunc(resp); callbackFunc(resp);
}); });
} };
} }
const internalStore = new InternalStore(); const internalStore = new InternalStore();

View File

@ -4,10 +4,7 @@ import { Link } from "react-router-dom";
import { Space, Breadcrumb, PageHeader, Table } from "antd"; import { Space, Breadcrumb, PageHeader, Table } from "antd";
import { Region } from "@chirpstack/chirpstack-api-grpc-web/common/common_pb"; import { Region } from "@chirpstack/chirpstack-api-grpc-web/common/common_pb";
import { import { ListRegionsResponse, RegionListItem } from "@chirpstack/chirpstack-api-grpc-web/api/internal_pb";
ListRegionsResponse,
RegionListItem,
} from "@chirpstack/chirpstack-api-grpc-web/api/internal_pb";
import { getEnumName } from "../helpers"; import { getEnumName } from "../helpers";
import InternalStore from "../../stores/InternalStore"; import InternalStore from "../../stores/InternalStore";
@ -18,7 +15,6 @@ interface IState {
regions?: ListRegionsResponse; regions?: ListRegionsResponse;
} }
class ListRegions extends Component<IProps, IState> { class ListRegions extends Component<IProps, IState> {
constructor(props: IProps) { constructor(props: IProps) {
super(props); super(props);
@ -65,9 +61,7 @@ class ListRegions extends Component<IProps, IState> {
title: "Name", title: "Name",
dataIndex: "name", dataIndex: "name",
key: "name", key: "name",
render: (text, record) => ( render: (text, record) => <Link to={`/regions/${text}`}>{text}</Link>,
<Link to={`/regions/${text}`}>{text}</Link>
),
}, },
{ {
title: "Region", title: "Region",

View File

@ -6,10 +6,7 @@ import { Space, Breadcrumb, PageHeader, Card, Row, Col, List, Typography } from
import ReactMarkdown from "react-markdown"; import ReactMarkdown from "react-markdown";
import { Region } from "@chirpstack/chirpstack-api-grpc-web/common/common_pb"; import { Region } from "@chirpstack/chirpstack-api-grpc-web/common/common_pb";
import { import { GetRegionRequest, GetRegionResponse } from "@chirpstack/chirpstack-api-grpc-web/api/internal_pb";
GetRegionRequest,
GetRegionResponse,
} from "@chirpstack/chirpstack-api-grpc-web/api/internal_pb";
import { getEnumName } from "../helpers"; import { getEnumName } from "../helpers";
import InternalStore from "../../stores/InternalStore"; import InternalStore from "../../stores/InternalStore";
@ -19,7 +16,7 @@ interface MatchParams {
} }
interface IState { interface IState {
region?: GetRegionResponse, region?: GetRegionResponse;
} }
interface IProps extends RouteComponentProps<MatchParams> {} interface IProps extends RouteComponentProps<MatchParams> {}
@ -56,7 +53,9 @@ class RegionDetails extends Component<IProps, IState> {
<span>Network Server</span> <span>Network Server</span>
</Breadcrumb.Item> </Breadcrumb.Item>
<Breadcrumb.Item> <Breadcrumb.Item>
<span><Link to="/regions">Regions</Link></span> <span>
<Link to="/regions">Regions</Link>
</span>
</Breadcrumb.Item> </Breadcrumb.Item>
<Breadcrumb.Item> <Breadcrumb.Item>
<span>{this.props.match.params.name}</span> <span>{this.props.match.params.name}</span>
@ -66,14 +65,14 @@ class RegionDetails extends Component<IProps, IState> {
title={this.props.match.params.name} title={this.props.match.params.name}
subTitle={`common-name: ${getEnumName(Region, this.state.region.getRegion())}`} subTitle={`common-name: ${getEnumName(Region, this.state.region.getRegion())}`}
/> />
{this.state.region.getUserInfo() !== "" && <Card> {this.state.region.getUserInfo() !== "" && (
<ReactMarkdown> <Card>
{this.state.region.getUserInfo()} <ReactMarkdown>{this.state.region.getUserInfo()}</ReactMarkdown>
</ReactMarkdown> </Card>
</Card>} )}
<Row gutter={24}> <Row gutter={24}>
<Col span={12}> <Col span={12}>
<Space direction="vertical" style={{width: "100%"}} size="large"> <Space direction="vertical" style={{ width: "100%" }} size="large">
<Card title="Uplink channels"> <Card title="Uplink channels">
<List <List
itemLayout="horizontal" itemLayout="horizontal"
@ -91,7 +90,7 @@ class RegionDetails extends Component<IProps, IState> {
</Space> </Space>
</Col> </Col>
<Col span={12}> <Col span={12}>
<Space direction="vertical" style={{width: "100%"}} size="large"> <Space direction="vertical" style={{ width: "100%" }} size="large">
<Card title="Downlink"> <Card title="Downlink">
<List <List
dataSource={[ dataSource={[
@ -100,16 +99,35 @@ class RegionDetails extends Component<IProps, IState> {
["RX2 DR", this.state.region.getRx2Dr()], ["RX2 DR", this.state.region.getRx2Dr()],
["RX2 frequency", `${this.state.region.getRx2Frequency()} Hz`], ["RX2 frequency", `${this.state.region.getRx2Frequency()} Hz`],
]} ]}
renderItem={item => <List.Item><Typography.Text strong style={{width: "175px", display: "block", float: "left"}}>{item[0]}:</Typography.Text> {item[1]}</List.Item>} renderItem={item => (
<List.Item>
<Typography.Text strong style={{ width: "175px", display: "block", float: "left" }}>
{item[0]}:
</Typography.Text>{" "}
{item[1]}
</List.Item>
)}
/> />
</Card> </Card>
<Card title="Class-B"> <Card title="Class-B">
<List <List
dataSource={[ dataSource={[
["Ping-slot DR", this.state.region.getClassBPingSlotDr()], ["Ping-slot DR", this.state.region.getClassBPingSlotDr()],
["Ping-slot frequency", this.state.region.getClassBPingSlotFrequency() === 0 ? "default frequency or frequency hopping" : `${this.state.region.getClassBPingSlotFrequency()} Hz`], [
"Ping-slot frequency",
this.state.region.getClassBPingSlotFrequency() === 0
? "default frequency or frequency hopping"
: `${this.state.region.getClassBPingSlotFrequency()} Hz`,
],
]} ]}
renderItem={item => <List.Item><Typography.Text strong style={{width: "175px", display: "block", float: "left"}}>{item[0]}:</Typography.Text> {item[1]}</List.Item>} renderItem={item => (
<List.Item>
<Typography.Text strong style={{ width: "175px", display: "block", float: "left" }}>
{item[0]}:
</Typography.Text>{" "}
{item[1]}
</List.Item>
)}
/> />
</Card> </Card>
</Space> </Space>