You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@linkis.apache.org by pe...@apache.org on 2022/02/18 07:57:57 UTC

[incubator-linkis] branch dev-1.1.0-datasource updated: support all type url (#1510)

This is an automated email from the ASF dual-hosted git repository.

peacewong pushed a commit to branch dev-1.1.0-datasource
in repository https://gitbox.apache.org/repos/asf/incubator-linkis.git


The following commit(s) were added to refs/heads/dev-1.1.0-datasource by this push:
     new e0b38fd  support all type url (#1510)
e0b38fd is described below

commit e0b38fd3949e34e89871cdf4e8b3d551f947ee2d
Author: luxl@chinatelecom.cn <li...@126.com>
AuthorDate: Fri Feb 18 15:57:06 2022 +0800

    support all type url (#1510)
---
 .../linkis/module/datasource/datasourceForm/index.vue    | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/web/src/apps/linkis/module/datasource/datasourceForm/index.vue b/web/src/apps/linkis/module/datasource/datasourceForm/index.vue
index 6960314..cd19bbb 100644
--- a/web/src/apps/linkis/module/datasource/datasourceForm/index.vue
+++ b/web/src/apps/linkis/module/datasource/datasourceForm/index.vue
@@ -5,16 +5,16 @@
   ~ 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.
   -->
-  
+
 <template>
   <div class="table-warp">
     <form-create :rule="rule" v-model="fApi" :option="options" :value.sync="formData"/>
@@ -62,7 +62,9 @@ const typesMap = {
   // dataSource: 'options',
   dataSource: (data, source, self)=>{
     const fApi = self.fApi;
-    if(/^https?:/.test(data.dataSource)){
+    try {
+      return {options: JSON.parse(data.dataSource)}
+    } catch (error) {
       api.fetch(data.dataSource, {}, 'get').then(result=>{
         delete source.options;
         source.options = result.env_list.map(item=>{
@@ -72,12 +74,6 @@ const typesMap = {
         fApi.refreshOptions();
       })
       return {options: []}
-    }else {
-      try {
-        return {options: JSON.parse(data.dataSource)}
-      } catch (error) {
-        return {options: []}
-      }
     }
   },
   key: 'field',

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@linkis.apache.org
For additional commands, e-mail: commits-help@linkis.apache.org