mirror of
https://github.com/chirpstack/chirpstack.git
synced 2025-06-18 23:38:20 +00:00
Apply fix for #282 to all forms.
This commit is contained in:
@ -2,6 +2,8 @@ import { Form, Input, Button } from "antd";
|
|||||||
|
|
||||||
import { ApiKey } from "@chirpstack/chirpstack-api-grpc-web/api/internal_pb";
|
import { ApiKey } from "@chirpstack/chirpstack-api-grpc-web/api/internal_pb";
|
||||||
|
|
||||||
|
import { onFinishFailed } from "../helpers";
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
initialValues: ApiKey;
|
initialValues: ApiKey;
|
||||||
onFinish: (obj: ApiKey) => void;
|
onFinish: (obj: ApiKey) => void;
|
||||||
@ -15,7 +17,7 @@ function ApiKeyForm(props: IProps) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Form layout="vertical" initialValues={props.initialValues.toObject()} onFinish={onFinish}>
|
<Form layout="vertical" initialValues={props.initialValues.toObject()} onFinish={onFinish} onFinishFailed={onFinishFailed}>
|
||||||
<Form.Item label="Name" name="name" rules={[{ required: true, message: "Please enter a name!" }]}>
|
<Form.Item label="Name" name="name" rules={[{ required: true, message: "Please enter a name!" }]}>
|
||||||
<Input />
|
<Input />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
import { Application } from "@chirpstack/chirpstack-api-grpc-web/api/application_pb";
|
import { Application } from "@chirpstack/chirpstack-api-grpc-web/api/application_pb";
|
||||||
import { Form, Input, Button } from "antd";
|
import { Form, Input, Button } from "antd";
|
||||||
|
|
||||||
|
import { onFinishFailed } from "../helpers";
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
initialValues: Application;
|
initialValues: Application;
|
||||||
onFinish: (obj: Application) => void;
|
onFinish: (obj: Application) => void;
|
||||||
@ -21,7 +23,7 @@ function ApplicationForm(props: IProps) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Form layout="vertical" initialValues={props.initialValues.toObject()} onFinish={onFinish}>
|
<Form layout="vertical" initialValues={props.initialValues.toObject()} onFinish={onFinish} onFinishFailed={onFinishFailed}>
|
||||||
<Form.Item label="Name" name="name" rules={[{ required: true, message: "Please enter a name!" }]}>
|
<Form.Item label="Name" name="name" rules={[{ required: true, message: "Please enter a name!" }]}>
|
||||||
<Input disabled={props.disabled} />
|
<Input disabled={props.disabled} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
@ -2,6 +2,8 @@ import { Form, Input, Button, Select } from "antd";
|
|||||||
|
|
||||||
import { AzureServiceBusIntegration, Encoding } from "@chirpstack/chirpstack-api-grpc-web/api/application_pb";
|
import { AzureServiceBusIntegration, Encoding } from "@chirpstack/chirpstack-api-grpc-web/api/application_pb";
|
||||||
|
|
||||||
|
import { onFinishFailed } from "../../helpers";
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
initialValues: AzureServiceBusIntegration;
|
initialValues: AzureServiceBusIntegration;
|
||||||
onFinish: (obj: AzureServiceBusIntegration) => void;
|
onFinish: (obj: AzureServiceBusIntegration) => void;
|
||||||
@ -21,7 +23,7 @@ function AzureServiceBusIntegrationForm(props: IProps) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Form layout="vertical" initialValues={props.initialValues.toObject()} onFinish={onFinish}>
|
<Form layout="vertical" initialValues={props.initialValues.toObject()} onFinish={onFinish} onFinishFailed={onFinishFailed}>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label="Payload encoding"
|
label="Payload encoding"
|
||||||
name="encoding"
|
name="encoding"
|
||||||
|
@ -2,6 +2,8 @@ import { Form, Input, Button, Select } from "antd";
|
|||||||
|
|
||||||
import { GcpPubSubIntegration, Encoding } from "@chirpstack/chirpstack-api-grpc-web/api/application_pb";
|
import { GcpPubSubIntegration, Encoding } from "@chirpstack/chirpstack-api-grpc-web/api/application_pb";
|
||||||
|
|
||||||
|
import { onFinishFailed } from "../../helpers";
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
initialValues: GcpPubSubIntegration;
|
initialValues: GcpPubSubIntegration;
|
||||||
onFinish: (obj: GcpPubSubIntegration) => void;
|
onFinish: (obj: GcpPubSubIntegration) => void;
|
||||||
@ -22,7 +24,7 @@ function GcpPubSubIntegrationForm(props: IProps) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Form layout="vertical" initialValues={props.initialValues.toObject()} onFinish={onFinish}>
|
<Form layout="vertical" initialValues={props.initialValues.toObject()} onFinish={onFinish} onFinishFailed={onFinishFailed}>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label="Payload encoding"
|
label="Payload encoding"
|
||||||
name="encoding"
|
name="encoding"
|
||||||
|
@ -3,6 +3,8 @@ import { MinusCircleOutlined, PlusOutlined } from "@ant-design/icons";
|
|||||||
|
|
||||||
import { HttpIntegration, Encoding } from "@chirpstack/chirpstack-api-grpc-web/api/application_pb";
|
import { HttpIntegration, Encoding } from "@chirpstack/chirpstack-api-grpc-web/api/application_pb";
|
||||||
|
|
||||||
|
import { onFinishFailed } from "../../helpers";
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
initialValues: HttpIntegration;
|
initialValues: HttpIntegration;
|
||||||
onFinish: (obj: HttpIntegration) => void;
|
onFinish: (obj: HttpIntegration) => void;
|
||||||
@ -26,7 +28,7 @@ function HttpIntegrationForm(props: IProps) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Form layout="vertical" initialValues={props.initialValues.toObject()} onFinish={onFinish}>
|
<Form layout="vertical" initialValues={props.initialValues.toObject()} onFinish={onFinish} onFinishFailed={onFinishFailed}>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label="Payload encoding"
|
label="Payload encoding"
|
||||||
name="encoding"
|
name="encoding"
|
||||||
|
@ -4,6 +4,8 @@ import { Form, Input, AutoComplete, Button, Row, Col, Switch } from "antd";
|
|||||||
|
|
||||||
import { IftttIntegration } from "@chirpstack/chirpstack-api-grpc-web/api/application_pb";
|
import { IftttIntegration } from "@chirpstack/chirpstack-api-grpc-web/api/application_pb";
|
||||||
|
|
||||||
|
import { onFinishFailed } from "../../helpers";
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
measurementKeys: string[];
|
measurementKeys: string[];
|
||||||
initialValues: IftttIntegration;
|
initialValues: IftttIntegration;
|
||||||
@ -41,7 +43,7 @@ function IftttIntegrationForm(props: IProps) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Form layout="vertical" initialValues={props.initialValues.toObject()} onFinish={onFinish}>
|
<Form layout="vertical" initialValues={props.initialValues.toObject()} onFinish={onFinish} onFinishFailed={onFinishFailed}>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label="Key"
|
label="Key"
|
||||||
name="key"
|
name="key"
|
||||||
|
@ -8,6 +8,8 @@ import {
|
|||||||
InfluxDbVersion,
|
InfluxDbVersion,
|
||||||
} from "@chirpstack/chirpstack-api-grpc-web/api/application_pb";
|
} from "@chirpstack/chirpstack-api-grpc-web/api/application_pb";
|
||||||
|
|
||||||
|
import { onFinishFailed } from "../../helpers";
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
initialValues: InfluxDbIntegration;
|
initialValues: InfluxDbIntegration;
|
||||||
onFinish: (obj: InfluxDbIntegration) => void;
|
onFinish: (obj: InfluxDbIntegration) => void;
|
||||||
@ -44,7 +46,7 @@ function InfluxDbIntegrationForm(props: IProps) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Form layout="vertical" initialValues={props.initialValues.toObject()} onFinish={onFinish}>
|
<Form layout="vertical" initialValues={props.initialValues.toObject()} onFinish={onFinish} onFinishFailed={onFinishFailed}>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label="InfluxDB version"
|
label="InfluxDB version"
|
||||||
name="version"
|
name="version"
|
||||||
|
@ -8,6 +8,8 @@ import {
|
|||||||
LoraCloudModemGeolocationServices,
|
LoraCloudModemGeolocationServices,
|
||||||
} from "@chirpstack/chirpstack-api-grpc-web/api/application_pb";
|
} from "@chirpstack/chirpstack-api-grpc-web/api/application_pb";
|
||||||
|
|
||||||
|
import { onFinishFailed } from "../../helpers";
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
initialValues: LoraCloudIntegration;
|
initialValues: LoraCloudIntegration;
|
||||||
onFinish: (obj: LoraCloudIntegration) => void;
|
onFinish: (obj: LoraCloudIntegration) => void;
|
||||||
@ -85,7 +87,7 @@ function LoRaCloudIntegrationForm(props: IProps) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Form layout="vertical" initialValues={props.initialValues.toObject()} onFinish={onFinish}>
|
<Form layout="vertical" initialValues={props.initialValues.toObject()} onFinish={onFinish} onFinishFailed={onFinishFailed}>
|
||||||
<Tabs>
|
<Tabs>
|
||||||
<Tabs.TabPane tab="Modem & Geolocation Services" key="1">
|
<Tabs.TabPane tab="Modem & Geolocation Services" key="1">
|
||||||
<Form.Item
|
<Form.Item
|
||||||
|
@ -4,6 +4,8 @@ import { Form, Input, Button, Select } from "antd";
|
|||||||
|
|
||||||
import { MyDevicesIntegration } from "@chirpstack/chirpstack-api-grpc-web/api/application_pb";
|
import { MyDevicesIntegration } from "@chirpstack/chirpstack-api-grpc-web/api/application_pb";
|
||||||
|
|
||||||
|
import { onFinishFailed } from "../../helpers";
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
initialValues: MyDevicesIntegration;
|
initialValues: MyDevicesIntegration;
|
||||||
onFinish: (obj: MyDevicesIntegration) => void;
|
onFinish: (obj: MyDevicesIntegration) => void;
|
||||||
@ -36,7 +38,7 @@ function MyDevicesIntegrationForm(props: IProps) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Form layout="vertical" initialValues={props.initialValues.toObject()} onFinish={onFinish}>
|
<Form layout="vertical" initialValues={props.initialValues.toObject()} onFinish={onFinish} onFinishFailed={onFinishFailed}>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label="Select myDevices endpoint"
|
label="Select myDevices endpoint"
|
||||||
name="endpoint"
|
name="endpoint"
|
||||||
|
@ -2,6 +2,8 @@ import { Form, Input, Button } from "antd";
|
|||||||
|
|
||||||
import { PilotThingsIntegration } from "@chirpstack/chirpstack-api-grpc-web/api/application_pb";
|
import { PilotThingsIntegration } from "@chirpstack/chirpstack-api-grpc-web/api/application_pb";
|
||||||
|
|
||||||
|
import { onFinishFailed } from "../../helpers";
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
initialValues: PilotThingsIntegration;
|
initialValues: PilotThingsIntegration;
|
||||||
onFinish: (obj: PilotThingsIntegration) => void;
|
onFinish: (obj: PilotThingsIntegration) => void;
|
||||||
@ -20,7 +22,7 @@ function PilotThingsIntegrationForm(props: IProps) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Form layout="vertical" initialValues={props.initialValues.toObject()} onFinish={onFinish}>
|
<Form layout="vertical" initialValues={props.initialValues.toObject()} onFinish={onFinish} onFinishFailed={onFinishFailed}>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label="Pilot Things server"
|
label="Pilot Things server"
|
||||||
name="server"
|
name="server"
|
||||||
|
@ -2,6 +2,8 @@ import { Form, Input, Button, Typography } from "antd";
|
|||||||
|
|
||||||
import { ThingsBoardIntegration } from "@chirpstack/chirpstack-api-grpc-web/api/application_pb";
|
import { ThingsBoardIntegration } from "@chirpstack/chirpstack-api-grpc-web/api/application_pb";
|
||||||
|
|
||||||
|
import { onFinishFailed } from "../../helpers";
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
initialValues: ThingsBoardIntegration;
|
initialValues: ThingsBoardIntegration;
|
||||||
onFinish: (obj: ThingsBoardIntegration) => void;
|
onFinish: (obj: ThingsBoardIntegration) => void;
|
||||||
@ -19,7 +21,7 @@ function ThingsBoardIntegrationForm(props: IProps) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Form layout="vertical" initialValues={props.initialValues.toObject()} onFinish={onFinish}>
|
<Form layout="vertical" initialValues={props.initialValues.toObject()} onFinish={onFinish} onFinishFailed={onFinishFailed}>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label="ThingsBoard server"
|
label="ThingsBoard server"
|
||||||
name="server"
|
name="server"
|
||||||
|
@ -8,6 +8,7 @@ import { CodecRuntime, Measurement, MeasurementKind } from "@chirpstack/chirpsta
|
|||||||
import { Region, MacVersion, RegParamsRevision } from "@chirpstack/chirpstack-api-grpc-web/common/common_pb";
|
import { Region, MacVersion, RegParamsRevision } from "@chirpstack/chirpstack-api-grpc-web/common/common_pb";
|
||||||
import { ListDeviceProfileAdrAlgorithmsResponse } from "@chirpstack/chirpstack-api-grpc-web/api/device_profile_pb";
|
import { ListDeviceProfileAdrAlgorithmsResponse } from "@chirpstack/chirpstack-api-grpc-web/api/device_profile_pb";
|
||||||
|
|
||||||
|
import { onFinishFailed } from "../helpers";
|
||||||
import DeviceProfileStore from "../../stores/DeviceProfileStore";
|
import DeviceProfileStore from "../../stores/DeviceProfileStore";
|
||||||
import CodeEditor from "../../components/CodeEditor";
|
import CodeEditor from "../../components/CodeEditor";
|
||||||
|
|
||||||
@ -117,7 +118,7 @@ function DeviceProfileTemplateForm(props: IProps) {
|
|||||||
const adrOptions = adrAlgorithms.map(v => <Select.Option value={v[0]}>{v[1]}</Select.Option>);
|
const adrOptions = adrAlgorithms.map(v => <Select.Option value={v[0]}>{v[1]}</Select.Option>);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Form layout="vertical" initialValues={props.initialValues.toObject()} onFinish={onFinish} form={form}>
|
<Form layout="vertical" initialValues={props.initialValues.toObject()} onFinish={onFinish} onFinishFailed={onFinishFailed} form={form}>
|
||||||
<Tabs>
|
<Tabs>
|
||||||
<Tabs.TabPane tab="General" key="1">
|
<Tabs.TabPane tab="General" key="1">
|
||||||
<Form.Item
|
<Form.Item
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import React, { useState, useEffect } from "react";
|
import React, { useState, useEffect } from "react";
|
||||||
|
|
||||||
import { Form, Input, Select, InputNumber, Switch, Row, Col, Button, Tabs, Modal, Spin, Cascader, Card, notification } from "antd";
|
import { Form, Input, Select, InputNumber, Switch, Row, Col, Button, Tabs, Modal, Spin, Cascader, Card } from "antd";
|
||||||
import { MinusCircleOutlined, PlusOutlined } from "@ant-design/icons";
|
import { MinusCircleOutlined, PlusOutlined } from "@ant-design/icons";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@ -24,7 +24,7 @@ import {
|
|||||||
DeviceProfileTemplate,
|
DeviceProfileTemplate,
|
||||||
} from "@chirpstack/chirpstack-api-grpc-web/api/device_profile_template_pb";
|
} from "@chirpstack/chirpstack-api-grpc-web/api/device_profile_template_pb";
|
||||||
|
|
||||||
import { getEnumName } from "../helpers";
|
import { getEnumName, onFinishFailed } from "../helpers";
|
||||||
import InternalStore from "../../stores/InternalStore";
|
import InternalStore from "../../stores/InternalStore";
|
||||||
import DeviceProfileStore from "../../stores/DeviceProfileStore";
|
import DeviceProfileStore from "../../stores/DeviceProfileStore";
|
||||||
import DeviceProfileTemplateStore from "../../stores/DeviceProfileTemplateStore";
|
import DeviceProfileTemplateStore from "../../stores/DeviceProfileTemplateStore";
|
||||||
@ -305,14 +305,6 @@ function DeviceProfileForm(props: IProps) {
|
|||||||
props.onFinish(dp);
|
props.onFinish(dp);
|
||||||
};
|
};
|
||||||
|
|
||||||
const onFinishFailed = () => {
|
|
||||||
notification.error({
|
|
||||||
message: "Validation errors",
|
|
||||||
description: "Please inspect input fields for errors",
|
|
||||||
duration: 30,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const onSupportsOtaaChange = (checked: boolean) => {
|
const onSupportsOtaaChange = (checked: boolean) => {
|
||||||
setSupportsOtaa(checked);
|
setSupportsOtaa(checked);
|
||||||
};
|
};
|
||||||
|
@ -19,6 +19,8 @@ import AesKeyInput from "../../components/AesKeyInput";
|
|||||||
import DevAddrInput from "../../components/DevAddrInput";
|
import DevAddrInput from "../../components/DevAddrInput";
|
||||||
import DeviceStore from "../../stores/DeviceStore";
|
import DeviceStore from "../../stores/DeviceStore";
|
||||||
|
|
||||||
|
import { onFinishFailed } from "../helpers";
|
||||||
|
|
||||||
interface FormProps {
|
interface FormProps {
|
||||||
disabled: boolean;
|
disabled: boolean;
|
||||||
initialValues: DeviceActivationPb;
|
initialValues: DeviceActivationPb;
|
||||||
@ -46,7 +48,7 @@ function LW10DeviceActivationForm(props: FormProps) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Form layout="vertical" initialValues={props.initialValues.toObject()} onFinish={onFinish} form={form}>
|
<Form layout="vertical" initialValues={props.initialValues.toObject()} onFinish={onFinish} onFinishFailed={onFinishFailed} form={form}>
|
||||||
<DevAddrInput
|
<DevAddrInput
|
||||||
label="Device address"
|
label="Device address"
|
||||||
name="devAddr"
|
name="devAddr"
|
||||||
@ -107,7 +109,7 @@ function LW11DeviceActivationForm(props: FormProps) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Form layout="vertical" initialValues={props.initialValues.toObject()} onFinish={onFinish} form={form}>
|
<Form layout="vertical" initialValues={props.initialValues.toObject()} onFinish={onFinish} onFinishFailed={onFinishFailed} form={form}>
|
||||||
<DevAddrInput
|
<DevAddrInput
|
||||||
label="Device address"
|
label="Device address"
|
||||||
name="devAddr"
|
name="devAddr"
|
||||||
|
@ -10,6 +10,7 @@ import {
|
|||||||
GetDeviceProfileResponse,
|
GetDeviceProfileResponse,
|
||||||
} from "@chirpstack/chirpstack-api-grpc-web/api/device_profile_pb";
|
} from "@chirpstack/chirpstack-api-grpc-web/api/device_profile_pb";
|
||||||
|
|
||||||
|
import { onFinishFailed } from "../helpers";
|
||||||
import EuiInput from "../../components/EuiInput";
|
import EuiInput from "../../components/EuiInput";
|
||||||
import { OptionsCallbackFunc, OptionCallbackFunc } from "../../components/Autocomplete";
|
import { OptionsCallbackFunc, OptionCallbackFunc } from "../../components/Autocomplete";
|
||||||
import AutocompleteInput from "../../components/AutocompleteInput";
|
import AutocompleteInput from "../../components/AutocompleteInput";
|
||||||
@ -79,7 +80,7 @@ function DeviceForm(props: IProps) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Form layout="vertical" initialValues={props.initialValues.toObject()} onFinish={onFinish} form={form}>
|
<Form layout="vertical" initialValues={props.initialValues.toObject()} onFinish={onFinish} onFinishFailed={onFinishFailed} form={form}>
|
||||||
<Tabs>
|
<Tabs>
|
||||||
<Tabs.TabPane tab="Device" key="1">
|
<Tabs.TabPane tab="Device" key="1">
|
||||||
<Form.Item label="Name" name="name" rules={[{ required: true, message: "Please enter a name!" }]}>
|
<Form.Item label="Name" name="name" rules={[{ required: true, message: "Please enter a name!" }]}>
|
||||||
|
@ -17,6 +17,7 @@ import {
|
|||||||
DeviceQueueItem,
|
DeviceQueueItem,
|
||||||
} from "@chirpstack/chirpstack-api-grpc-web/api/device_pb";
|
} from "@chirpstack/chirpstack-api-grpc-web/api/device_pb";
|
||||||
|
|
||||||
|
import { onFinishFailed } from "../helpers";
|
||||||
import DataTable, { GetPageCallbackFunc } from "../../components/DataTable";
|
import DataTable, { GetPageCallbackFunc } from "../../components/DataTable";
|
||||||
import DeviceStore from "../../stores/DeviceStore";
|
import DeviceStore from "../../stores/DeviceStore";
|
||||||
import CodeEditor from "../../components/CodeEditor";
|
import CodeEditor from "../../components/CodeEditor";
|
||||||
@ -157,7 +158,7 @@ function DeviceQueue(props: IProps) {
|
|||||||
return (
|
return (
|
||||||
<Space direction="vertical" style={{ width: "100%" }} size="large">
|
<Space direction="vertical" style={{ width: "100%" }} size="large">
|
||||||
<Card title="Enqueue">
|
<Card title="Enqueue">
|
||||||
<Form layout="horizontal" onFinish={onEnqueue} form={form} initialValues={{ fPort: 1 }}>
|
<Form layout="horizontal" onFinish={onEnqueue} onFinishFailed={onFinishFailed} form={form} initialValues={{ fPort: 1 }}>
|
||||||
<Row>
|
<Row>
|
||||||
<Space direction="horizontal" style={{ width: "100%" }} size="large">
|
<Space direction="horizontal" style={{ width: "100%" }} size="large">
|
||||||
<Form.Item name="confirmed" label="Confirmed" valuePropName="checked">
|
<Form.Item name="confirmed" label="Confirmed" valuePropName="checked">
|
||||||
|
@ -17,6 +17,7 @@ import {
|
|||||||
} from "@chirpstack/chirpstack-api-grpc-web/api/device_pb";
|
} from "@chirpstack/chirpstack-api-grpc-web/api/device_pb";
|
||||||
import { MacVersion } from "@chirpstack/chirpstack-api-grpc-web/common/common_pb";
|
import { MacVersion } from "@chirpstack/chirpstack-api-grpc-web/common/common_pb";
|
||||||
|
|
||||||
|
import { onFinishFailed } from "../helpers";
|
||||||
import AesKeyInput from "../../components/AesKeyInput";
|
import AesKeyInput from "../../components/AesKeyInput";
|
||||||
import DeviceStore from "../../stores/DeviceStore";
|
import DeviceStore from "../../stores/DeviceStore";
|
||||||
|
|
||||||
@ -41,7 +42,7 @@ function LW10DeviceKeysForm(props: FormProps) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Form layout="vertical" initialValues={props.initialValues.toObject()} onFinish={onFinish} form={form}>
|
<Form layout="vertical" initialValues={props.initialValues.toObject()} onFinish={onFinish} onFinishFailed={onFinishFailed} form={form}>
|
||||||
<AesKeyInput
|
<AesKeyInput
|
||||||
label="Application key"
|
label="Application key"
|
||||||
name="nwkKey"
|
name="nwkKey"
|
||||||
@ -73,7 +74,7 @@ function LW11DeviceKeysForm(props: FormProps) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Form layout="vertical" initialValues={props.initialValues.toObject()} onFinish={onFinish} form={form}>
|
<Form layout="vertical" initialValues={props.initialValues.toObject()} onFinish={onFinish} onFinishFailed={onFinishFailed} form={form}>
|
||||||
<AesKeyInput
|
<AesKeyInput
|
||||||
label="Application key"
|
label="Application key"
|
||||||
tooltip="For LoRaWAN 1.1 devices. In case your device does not support LoRaWAN 1.1, update the device-profile first."
|
tooltip="For LoRaWAN 1.1 devices. In case your device does not support LoRaWAN 1.1, update the device-profile first."
|
||||||
@ -151,7 +152,7 @@ function SetDeviceKeys(props: IProps) {
|
|||||||
const flushDevNonces = () => {
|
const flushDevNonces = () => {
|
||||||
let req = new FlushDevNoncesRequest();
|
let req = new FlushDevNoncesRequest();
|
||||||
req.setDevEui(props.device.getDevEui());
|
req.setDevEui(props.device.getDevEui());
|
||||||
DeviceStore.flushDevNonces(req, () => {});
|
DeviceStore.flushDevNonces(req, () => { });
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!deviceKeysRequested) {
|
if (!deviceKeysRequested) {
|
||||||
|
@ -6,6 +6,7 @@ import { MinusCircleOutlined, PlusOutlined } from "@ant-design/icons";
|
|||||||
import { Location } from "@chirpstack/chirpstack-api-grpc-web/common/common_pb";
|
import { Location } from "@chirpstack/chirpstack-api-grpc-web/common/common_pb";
|
||||||
import { Gateway } from "@chirpstack/chirpstack-api-grpc-web/api/gateway_pb";
|
import { Gateway } from "@chirpstack/chirpstack-api-grpc-web/api/gateway_pb";
|
||||||
|
|
||||||
|
import { onFinishFailed } from "../helpers";
|
||||||
import EuiInput from "../../components/EuiInput";
|
import EuiInput from "../../components/EuiInput";
|
||||||
import Map, { Marker } from "../../components/Map";
|
import Map, { Marker } from "../../components/Map";
|
||||||
import LocationStore from "../../stores/LocationStore";
|
import LocationStore from "../../stores/LocationStore";
|
||||||
@ -90,7 +91,7 @@ function GatewayForm(props: IProps) {
|
|||||||
const location: [number, number] = [latValue, lonValue];
|
const location: [number, number] = [latValue, lonValue];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Form layout="vertical" initialValues={props.initialValues.toObject()} onFinish={onFinish} form={form}>
|
<Form layout="vertical" initialValues={props.initialValues.toObject()} onFinish={onFinish} onFinishFailed={onFinishFailed} form={form}>
|
||||||
<Tabs>
|
<Tabs>
|
||||||
<Tabs.TabPane tab="General" key="1">
|
<Tabs.TabPane tab="General" key="1">
|
||||||
<Form.Item label="Name" name="name" rules={[{ required: true, message: "Please enter a name!" }]}>
|
<Form.Item label="Name" name="name" rules={[{ required: true, message: "Please enter a name!" }]}>
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { notification } from "antd";
|
||||||
import { MacVersion, RegParamsRevision } from "@chirpstack/chirpstack-api-grpc-web/common/common_pb";
|
import { MacVersion, RegParamsRevision } from "@chirpstack/chirpstack-api-grpc-web/common/common_pb";
|
||||||
|
|
||||||
export function formatMacVersion(m: MacVersion) {
|
export function formatMacVersion(m: MacVersion) {
|
||||||
@ -50,3 +51,11 @@ export function getEnumName(enums: { [key: number]: string }, index: number) {
|
|||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function onFinishFailed() {
|
||||||
|
notification.error({
|
||||||
|
message: "Validation errors",
|
||||||
|
description: "Please inspect input fields for errors",
|
||||||
|
duration: 3,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
@ -10,7 +10,7 @@ import {
|
|||||||
} from "@chirpstack/chirpstack-api-grpc-web/api/multicast_group_pb";
|
} from "@chirpstack/chirpstack-api-grpc-web/api/multicast_group_pb";
|
||||||
import { ListRegionsResponse, RegionListItem } from "@chirpstack/chirpstack-api-grpc-web/api/internal_pb";
|
import { ListRegionsResponse, RegionListItem } from "@chirpstack/chirpstack-api-grpc-web/api/internal_pb";
|
||||||
|
|
||||||
import { getEnumName } from "../helpers";
|
import { getEnumName, onFinishFailed } from "../helpers";
|
||||||
import InternalStore from "../../stores/InternalStore";
|
import InternalStore from "../../stores/InternalStore";
|
||||||
import AesKeyInput from "../../components/AesKeyInput";
|
import AesKeyInput from "../../components/AesKeyInput";
|
||||||
import DevAddrInput from "../../components/DevAddrInput";
|
import DevAddrInput from "../../components/DevAddrInput";
|
||||||
@ -63,7 +63,7 @@ function MulticastGroupForm(props: IProps) {
|
|||||||
.map(v => <Select.Option value={v}>{getEnumName(Region, v).replace("_", "-")}</Select.Option>);
|
.map(v => <Select.Option value={v}>{getEnumName(Region, v).replace("_", "-")}</Select.Option>);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Form layout="vertical" initialValues={props.initialValues.toObject()} onFinish={onFinish} form={form}>
|
<Form layout="vertical" initialValues={props.initialValues.toObject()} onFinish={onFinish} onFinishFailed={onFinishFailed} form={form}>
|
||||||
<Form.Item label="Multicast-group name" name="name" rules={[{ required: true, message: "Please enter a name!" }]}>
|
<Form.Item label="Multicast-group name" name="name" rules={[{ required: true, message: "Please enter a name!" }]}>
|
||||||
<Input disabled={props.disabled} />
|
<Input disabled={props.disabled} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
@ -2,6 +2,8 @@ import { Form, Input, InputNumber, Switch, Row, Col, Button } 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 { onFinishFailed } from "../helpers";
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
initialValues: Tenant;
|
initialValues: Tenant;
|
||||||
onFinish: (obj: Tenant) => void;
|
onFinish: (obj: Tenant) => void;
|
||||||
@ -26,7 +28,7 @@ function TenantForm(props: IProps) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Form layout="vertical" initialValues={props.initialValues.toObject()} onFinish={onFinish}>
|
<Form layout="vertical" initialValues={props.initialValues.toObject()} onFinish={onFinish} onFinishFailed={onFinishFailed}>
|
||||||
<Form.Item label="Name" name="name" rules={[{ required: true, message: "Please enter a name!" }]}>
|
<Form.Item label="Name" name="name" rules={[{ required: true, message: "Please enter a name!" }]}>
|
||||||
<Input disabled={props.disabled} />
|
<Input disabled={props.disabled} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
@ -3,6 +3,8 @@ import { Form, Input, Switch, Row, Col, Button } from "antd";
|
|||||||
|
|
||||||
import { TenantUser } from "@chirpstack/chirpstack-api-grpc-web/api/tenant_pb";
|
import { TenantUser } from "@chirpstack/chirpstack-api-grpc-web/api/tenant_pb";
|
||||||
|
|
||||||
|
import { onFinishFailed } from "../helpers";
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
initialValues: TenantUser;
|
initialValues: TenantUser;
|
||||||
onFinish: (obj: TenantUser) => void;
|
onFinish: (obj: TenantUser) => void;
|
||||||
@ -36,7 +38,7 @@ function TenantUserForm(props: IProps) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Form layout="vertical" initialValues={props.initialValues.toObject()} onFinish={onFinish}>
|
<Form layout="vertical" initialValues={props.initialValues.toObject()} onFinish={onFinish} onFinishFailed={onFinishFailed}>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label="Email (of existing user)"
|
label="Email (of existing user)"
|
||||||
tooltip="An user without additional permissions will be able to see all resources under this tenant and will be able to send and receive device payloads."
|
tooltip="An user without additional permissions will be able to see all resources under this tenant and will be able to send and receive device payloads."
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
import { Form, Input, Button, notification } from "antd";
|
import { Form, Input, Button, notification } from "antd";
|
||||||
|
|
||||||
|
import { onFinishFailed } from "../helpers";
|
||||||
|
|
||||||
interface FormValues {
|
interface FormValues {
|
||||||
password: string;
|
password: string;
|
||||||
passwordConfirm: string;
|
passwordConfirm: string;
|
||||||
@ -22,7 +24,7 @@ function PasswordForm(props: IProps) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Form layout="vertical" onFinish={onFinish}>
|
<Form layout="vertical" onFinish={onFinish} onFinishFailed={onFinishFailed}>
|
||||||
<Form.Item label="Password" name="password" rules={[{ required: true, message: "Please enter a password!" }]}>
|
<Form.Item label="Password" name="password" rules={[{ required: true, message: "Please enter a password!" }]}>
|
||||||
<Input type="password" />
|
<Input type="password" />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
@ -2,6 +2,8 @@ import { Form, Input, Switch, Row, Col, Button } from "antd";
|
|||||||
|
|
||||||
import { User } from "@chirpstack/chirpstack-api-grpc-web/api/user_pb";
|
import { User } from "@chirpstack/chirpstack-api-grpc-web/api/user_pb";
|
||||||
|
|
||||||
|
import { onFinishFailed } from "../helpers";
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
initialValues: User;
|
initialValues: User;
|
||||||
onFinish: (obj: User, password: string) => void;
|
onFinish: (obj: User, password: string) => void;
|
||||||
@ -27,7 +29,7 @@ function UserForm(props: IProps) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Form layout="vertical" initialValues={props.initialValues.toObject()} onFinish={onFinish}>
|
<Form layout="vertical" initialValues={props.initialValues.toObject()} onFinish={onFinish} onFinishFailed={onFinishFailed}>
|
||||||
<Form.Item label="Email" name="email" rules={[{ required: true, message: "Please enter an email address!" }]}>
|
<Form.Item label="Email" name="email" rules={[{ required: true, message: "Please enter an email address!" }]}>
|
||||||
<Input />
|
<Input />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
Reference in New Issue
Block a user