This is an automated email from the ASF dual-hosted git repository.
dockerzhang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/inlong.git
The following commit(s) were added to refs/heads/master by this push:
new e6b58bfeb [INLONG-6699][Dashboard] Support MQTT source (#6719)
e6b58bfeb is described below
commit e6b58bfebaedfde0d3cdc24180ab299122e29336
Author: Lizhen <[email protected]>
AuthorDate: Mon Dec 5 11:47:23 2022 +0800
[INLONG-6699][Dashboard] Support MQTT source (#6719)
---
inlong-dashboard/src/locales/cn.json | 3 +
inlong-dashboard/src/locales/en.json | 3 +
.../src/metas/sources/defaults/MQTT.ts | 105 +++++++++++++++++++++
.../src/metas/sources/defaults/index.ts | 5 +
4 files changed, 116 insertions(+)
diff --git a/inlong-dashboard/src/locales/cn.json
b/inlong-dashboard/src/locales/cn.json
index 817547fcb..93ae6fdae 100644
--- a/inlong-dashboard/src/locales/cn.json
+++ b/inlong-dashboard/src/locales/cn.json
@@ -89,6 +89,9 @@
"meta.Sources.Redis.LookupCacheMaxRows": "查找缓存最大行数",
"meta.Sources.Redis.LookupCacheTtl": "查找缓存 TTL",
"meta.Sources.Redis.LookupMaxRetries": "查找最大重试字段",
+ "meta.Sources.MQTT.Username": "用户",
+ "meta.Sources.MQTT.Password": "密码",
+ "meta.Sources.MQTT.MqttVersion": "MQTT 版本",
"meta.Sinks.SinkName": "名称",
"meta.Sinks.SinkNameRule": "以英文字母开头,只能包含英文字母、数字、中划线、下划线",
"meta.Sinks.SinkType": "类型",
diff --git a/inlong-dashboard/src/locales/en.json
b/inlong-dashboard/src/locales/en.json
index c041ab8e8..0759809c7 100644
--- a/inlong-dashboard/src/locales/en.json
+++ b/inlong-dashboard/src/locales/en.json
@@ -89,6 +89,9 @@
"meta.Sources.Redis.LookupCacheMaxRows": "Cache Max Rows",
"meta.Sources.Redis.LookupCacheTtl": "Lookup Cache TTL",
"meta.Sources.Redis.LookupMaxRetries": "Lookup Max Retries",
+ "meta.Sources.MQTT.Username": "Username",
+ "meta.Sources.MQTT.Password": "Password",
+ "meta.Sources.MQTT.MqttVersion": "MQTT Version",
"meta.Sinks.SinkName": "Name",
"meta.Sinks.SinkNameRule": "At the beginning of English letters, only
English letters, numbers, minus, and underscores",
"meta.Sinks.SinkType": "Type",
diff --git a/inlong-dashboard/src/metas/sources/defaults/MQTT.ts
b/inlong-dashboard/src/metas/sources/defaults/MQTT.ts
new file mode 100644
index 000000000..e26216777
--- /dev/null
+++ b/inlong-dashboard/src/metas/sources/defaults/MQTT.ts
@@ -0,0 +1,105 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { DataWithBackend } from '@/metas/DataWithBackend';
+import { RenderRow } from '@/metas/RenderRow';
+import { RenderList } from '@/metas/RenderList';
+import { SourceInfo } from '../common/SourceInfo';
+
+const { I18n } = DataWithBackend;
+const { FieldDecorator } = RenderRow;
+
+export default class MQTTSource
+ extends SourceInfo
+ implements DataWithBackend, RenderRow, RenderList
+{
+ @FieldDecorator({
+ type: 'input',
+ rules: [{ required: true }],
+ initialValue: 'tcp://broker.hivemq.com:1883',
+ props: values => ({
+ disabled: values?.status === 101,
+ }),
+ })
+ @I18n('Server URI')
+ serverURI: string;
+
+ @FieldDecorator({
+ type: 'input',
+ rules: [{ required: true }],
+ props: values => ({
+ disabled: values?.status === 101,
+ }),
+ })
+ @I18n('meta.Sources.MQTT.Username')
+ username: string;
+
+ @FieldDecorator({
+ type: 'password',
+ rules: [{ required: true }],
+ props: values => ({
+ disabled: values?.status === 101,
+ }),
+ })
+ @I18n('meta.Sources.MQTT.Password')
+ password: string;
+
+ @FieldDecorator({
+ type: 'input',
+ rules: [{ required: true }],
+ props: values => ({
+ disabled: values?.status === 101,
+ }),
+ })
+ @I18n('Topic')
+ topic: string;
+
+ @FieldDecorator({
+ type: 'inputnumber',
+ rules: [{ required: true }],
+ initialValue: 1,
+ props: values => ({
+ disabled: values?.status === 101,
+ min: 0,
+ max: 2,
+ }),
+ })
+ @I18n('QoS')
+ qos: number;
+
+ @FieldDecorator({
+ type: 'input',
+ rules: [{ required: true }],
+ props: values => ({
+ disabled: values?.status === 101,
+ }),
+ })
+ @I18n('Client ID')
+ clientId: string;
+
+ @FieldDecorator({
+ type: 'input',
+ rules: [{ required: true }],
+ props: values => ({
+ disabled: values?.status === 101,
+ }),
+ })
+ @I18n('meta.Sources.MQTT.MqttVersion')
+ mqttVersion: string;
+}
diff --git a/inlong-dashboard/src/metas/sources/defaults/index.ts
b/inlong-dashboard/src/metas/sources/defaults/index.ts
index e1df78e59..b2ce797b4 100644
--- a/inlong-dashboard/src/metas/sources/defaults/index.ts
+++ b/inlong-dashboard/src/metas/sources/defaults/index.ts
@@ -46,6 +46,11 @@ export const allDefaultSources:
MetaExportWithBackendList<SourceMetaType> = [
value: 'MONGODB',
LoadEntity: () => import('./Mongodb'),
},
+ {
+ label: 'Mqtt',
+ value: 'MQTT',
+ LoadEntity: () => import('./MQTT'),
+ },
{
label: 'Oracle',
value: 'ORACLE',