mirror of
https://github.com/chirpstack/chirpstack.git
synced 2025-05-02 00:53:08 +00:00
parent
68b1de87f3
commit
72e72446a2
@ -1,7 +1,7 @@
|
|||||||
import React, { Component } from "react";
|
import React, { Component } from "react";
|
||||||
import { RouteComponentProps } from "react-router-dom";
|
import { RouteComponentProps } from "react-router-dom";
|
||||||
|
|
||||||
import { Space, Form, Button, Row, Col, InputNumber } from "antd";
|
import { Space, Form, Button, Row, Col, InputNumber, Alert } from "antd";
|
||||||
|
|
||||||
import { Tenant } from "@chirpstack/chirpstack-api-grpc-web/api/tenant_pb";
|
import { Tenant } from "@chirpstack/chirpstack-api-grpc-web/api/tenant_pb";
|
||||||
import { Application } from "@chirpstack/chirpstack-api-grpc-web/api/application_pb";
|
import { Application } from "@chirpstack/chirpstack-api-grpc-web/api/application_pb";
|
||||||
@ -20,6 +20,7 @@ import DevAddrInput from "../../components/DevAddrInput";
|
|||||||
import DeviceStore from "../../stores/DeviceStore";
|
import DeviceStore from "../../stores/DeviceStore";
|
||||||
|
|
||||||
interface FormProps {
|
interface FormProps {
|
||||||
|
disabled: boolean;
|
||||||
initialValues: DeviceActivationPb;
|
initialValues: DeviceActivationPb;
|
||||||
device: Device;
|
device: Device;
|
||||||
onFinish: (obj: DeviceActivationPb) => void;
|
onFinish: (obj: DeviceActivationPb) => void;
|
||||||
@ -58,6 +59,7 @@ class LW10DeviceActivationForm extends Component<FormProps> {
|
|||||||
value={this.props.initialValues.getDevAddr()}
|
value={this.props.initialValues.getDevAddr()}
|
||||||
devEui={this.props.device.getDevEui()}
|
devEui={this.props.device.getDevEui()}
|
||||||
formRef={this.formRef}
|
formRef={this.formRef}
|
||||||
|
disabled={this.props.disabled}
|
||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
<AesKeyInput
|
<AesKeyInput
|
||||||
@ -65,6 +67,7 @@ class LW10DeviceActivationForm extends Component<FormProps> {
|
|||||||
name="nwkSEncKey"
|
name="nwkSEncKey"
|
||||||
value={this.props.initialValues.getNwkSEncKey()}
|
value={this.props.initialValues.getNwkSEncKey()}
|
||||||
formRef={this.formRef}
|
formRef={this.formRef}
|
||||||
|
disabled={this.props.disabled}
|
||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
<AesKeyInput
|
<AesKeyInput
|
||||||
@ -72,22 +75,23 @@ class LW10DeviceActivationForm extends Component<FormProps> {
|
|||||||
name="appSKey"
|
name="appSKey"
|
||||||
value={this.props.initialValues.getAppSKey()}
|
value={this.props.initialValues.getAppSKey()}
|
||||||
formRef={this.formRef}
|
formRef={this.formRef}
|
||||||
|
disabled={this.props.disabled}
|
||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
<Row gutter={24}>
|
<Row gutter={24}>
|
||||||
<Col span={6}>
|
<Col span={6}>
|
||||||
<Form.Item label="Uplink frame-counter" name="fCntUp">
|
<Form.Item label="Uplink frame-counter" name="fCntUp">
|
||||||
<InputNumber min={0} />
|
<InputNumber min={0} disabled={this.props.disabled} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={6}>
|
<Col span={6}>
|
||||||
<Form.Item label="Downlink frame-counter" name="nFCntDown">
|
<Form.Item label="Downlink frame-counter" name="nFCntDown">
|
||||||
<InputNumber min={0} />
|
<InputNumber min={0} disabled={this.props.disabled} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
<Form.Item>
|
<Form.Item>
|
||||||
<Button type="primary" htmlType="submit">
|
<Button type="primary" htmlType="submit" disabled={this.props.disabled}>
|
||||||
(Re)activate device
|
(Re)activate device
|
||||||
</Button>
|
</Button>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
@ -129,6 +133,7 @@ class LW11DeviceActivationForm extends Component<FormProps> {
|
|||||||
value={this.props.initialValues.getDevAddr()}
|
value={this.props.initialValues.getDevAddr()}
|
||||||
devEui={this.props.device.getDevEui()}
|
devEui={this.props.device.getDevEui()}
|
||||||
formRef={this.formRef}
|
formRef={this.formRef}
|
||||||
|
disabled={this.props.disabled}
|
||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
<AesKeyInput
|
<AesKeyInput
|
||||||
@ -136,6 +141,7 @@ class LW11DeviceActivationForm extends Component<FormProps> {
|
|||||||
name="nwkSEncKey"
|
name="nwkSEncKey"
|
||||||
value={this.props.initialValues.getNwkSEncKey()}
|
value={this.props.initialValues.getNwkSEncKey()}
|
||||||
formRef={this.formRef}
|
formRef={this.formRef}
|
||||||
|
disabled={this.props.disabled}
|
||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
<AesKeyInput
|
<AesKeyInput
|
||||||
@ -143,6 +149,7 @@ class LW11DeviceActivationForm extends Component<FormProps> {
|
|||||||
name="sNwkSIntKey"
|
name="sNwkSIntKey"
|
||||||
value={this.props.initialValues.getSNwkSIntKey()}
|
value={this.props.initialValues.getSNwkSIntKey()}
|
||||||
formRef={this.formRef}
|
formRef={this.formRef}
|
||||||
|
disabled={this.props.disabled}
|
||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
<AesKeyInput
|
<AesKeyInput
|
||||||
@ -150,6 +157,7 @@ class LW11DeviceActivationForm extends Component<FormProps> {
|
|||||||
name="fNwkSIntKey"
|
name="fNwkSIntKey"
|
||||||
value={this.props.initialValues.getFNwkSIntKey()}
|
value={this.props.initialValues.getFNwkSIntKey()}
|
||||||
formRef={this.formRef}
|
formRef={this.formRef}
|
||||||
|
disabled={this.props.disabled}
|
||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
<AesKeyInput
|
<AesKeyInput
|
||||||
@ -157,27 +165,28 @@ class LW11DeviceActivationForm extends Component<FormProps> {
|
|||||||
name="appSKey"
|
name="appSKey"
|
||||||
value={this.props.initialValues.getAppSKey()}
|
value={this.props.initialValues.getAppSKey()}
|
||||||
formRef={this.formRef}
|
formRef={this.formRef}
|
||||||
|
disabled={this.props.disabled}
|
||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
<Row gutter={24}>
|
<Row gutter={24}>
|
||||||
<Col span={6}>
|
<Col span={6}>
|
||||||
<Form.Item label="Uplink frame-counter" name="fCntUp">
|
<Form.Item label="Uplink frame-counter" name="fCntUp">
|
||||||
<InputNumber min={0} />
|
<InputNumber min={0} disabled={this.props.disabled} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={6}>
|
<Col span={6}>
|
||||||
<Form.Item label="Downlink frame-counter (network)" name="nFCntDown">
|
<Form.Item label="Downlink frame-counter (network)" name="nFCntDown">
|
||||||
<InputNumber min={0} />
|
<InputNumber min={0} disabled={this.props.disabled} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={6}>
|
<Col span={6}>
|
||||||
<Form.Item label="Downlink frame-counter (application)" name="aFCntDown">
|
<Form.Item label="Downlink frame-counter (application)" name="aFCntDown">
|
||||||
<InputNumber min={0} />
|
<InputNumber min={0} disabled={this.props.disabled} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
<Form.Item>
|
<Form.Item>
|
||||||
<Button type="primary" htmlType="submit">
|
<Button type="primary" htmlType="submit" disabled={this.props.disabled}>
|
||||||
(Re)activate device
|
(Re)activate device
|
||||||
</Button>
|
</Button>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
@ -235,6 +244,10 @@ class DeviceActivation extends Component<IProps, IState> {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!this.state.deviceActivation && this.props.deviceProfile.getSupportsOtaa()) {
|
||||||
|
return <Alert type="info" showIcon message="This device has not (yet) been activated." />;
|
||||||
|
}
|
||||||
|
|
||||||
let macVersion = this.props.deviceProfile.getMacVersion();
|
let macVersion = this.props.deviceProfile.getMacVersion();
|
||||||
const lw11 = macVersion === MacVersion.LORAWAN_1_1_0;
|
const lw11 = macVersion === MacVersion.LORAWAN_1_1_0;
|
||||||
|
|
||||||
@ -246,10 +259,20 @@ class DeviceActivation extends Component<IProps, IState> {
|
|||||||
return (
|
return (
|
||||||
<Space direction="vertical" style={{ width: "100%" }} size="large">
|
<Space direction="vertical" style={{ width: "100%" }} size="large">
|
||||||
{!lw11 && (
|
{!lw11 && (
|
||||||
<LW10DeviceActivationForm initialValues={initialValues} device={this.props.device} onFinish={this.onFinish} />
|
<LW10DeviceActivationForm
|
||||||
|
initialValues={initialValues}
|
||||||
|
device={this.props.device}
|
||||||
|
onFinish={this.onFinish}
|
||||||
|
disabled={this.props.deviceProfile.getSupportsOtaa()}
|
||||||
|
/>
|
||||||
)}
|
)}
|
||||||
{lw11 && (
|
{lw11 && (
|
||||||
<LW11DeviceActivationForm initialValues={initialValues} device={this.props.device} onFinish={this.onFinish} />
|
<LW11DeviceActivationForm
|
||||||
|
initialValues={initialValues}
|
||||||
|
device={this.props.device}
|
||||||
|
onFinish={this.onFinish}
|
||||||
|
disabled={this.props.deviceProfile.getSupportsOtaa()}
|
||||||
|
/>
|
||||||
)}
|
)}
|
||||||
</Space>
|
</Space>
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user