This is an automated email from the ASF dual-hosted git repository.
klesh pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
The following commit(s) were added to refs/heads/main by this push:
new b2c04bf83 feat(config-ui): support field db url in connection (#5628)
b2c04bf83 is described below
commit b2c04bf83697d387fcedbf894eb3908abbc69faa
Author: 青湛 <[email protected]>
AuthorDate: Thu Jul 6 14:12:14 2023 +1200
feat(config-ui): support field db url in connection (#5628)
---
.../register/zentao/{config.ts => config.tsx} | 8 ++++
.../register/zentao/connection-fields/db-url.tsx | 48 ++++++++++++++++++++++
.../register/zentao/connection-fields/index.ts | 19 +++++++++
3 files changed, 75 insertions(+)
diff --git a/config-ui/src/plugins/register/zentao/config.ts
b/config-ui/src/plugins/register/zentao/config.tsx
similarity index 88%
rename from config-ui/src/plugins/register/zentao/config.ts
rename to config-ui/src/plugins/register/zentao/config.tsx
index 857927935..c668ff2a8 100644
--- a/config-ui/src/plugins/register/zentao/config.ts
+++ b/config-ui/src/plugins/register/zentao/config.tsx
@@ -19,6 +19,7 @@
import type { PluginConfigType } from '../../types';
import { PluginType } from '../../types';
+import { DBUrl } from './connection-fields';
import Icon from './assets/icon.svg';
export const ZenTaoConfig: PluginConfigType = {
@@ -38,6 +39,13 @@ export const ZenTaoConfig: PluginConfigType = {
},
'username',
'password',
+ ({ initialValues, values, setValues }: any) => (
+ <DBUrl
+ initialValue={initialValues.dbUrl}
+ value={values.dbUrl}
+ setValue={(value) => setValues({ dbUrl: value })}
+ />
+ ),
'proxy',
{
key: 'rateLimitPerHour',
diff --git a/config-ui/src/plugins/register/zentao/connection-fields/db-url.tsx
b/config-ui/src/plugins/register/zentao/connection-fields/db-url.tsx
new file mode 100644
index 000000000..bee065687
--- /dev/null
+++ b/config-ui/src/plugins/register/zentao/connection-fields/db-url.tsx
@@ -0,0 +1,48 @@
+/*
+ * 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 { useEffect } from 'react';
+import { InputGroup } from '@blueprintjs/core';
+
+import { FormItem } from '@/components';
+
+interface Props {
+ initialValue: string;
+ value: string;
+ setValue: (value: string) => void;
+}
+
+export const DBUrl = ({ initialValue, value, setValue }: Props) => {
+ useEffect(() => {
+ setValue(initialValue);
+ }, [initialValue]);
+
+ const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
+ setValue(e.target.value);
+ };
+
+ return (
+ <FormItem label="Database URL" subLabel="Provide the DB URL of Zentao if
you want to collect issue changelogs.">
+ <InputGroup
+ placeholder="e.g.
mysql://root:devlake@sshd-proxy:3306/zentao?charset=utf8mb4&parseTime=True"
+ value={value}
+ onChange={handleChange}
+ />
+ </FormItem>
+ );
+};
diff --git a/config-ui/src/plugins/register/zentao/connection-fields/index.ts
b/config-ui/src/plugins/register/zentao/connection-fields/index.ts
new file mode 100644
index 000000000..4dc5219f6
--- /dev/null
+++ b/config-ui/src/plugins/register/zentao/connection-fields/index.ts
@@ -0,0 +1,19 @@
+/*
+ * 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.
+ *
+ */
+
+export * from './db-url';