Skip to content

Commit

Permalink
fix: 数据源配置兼容各类型的jsonSchema表单展示 (#1950)
Browse files Browse the repository at this point in the history
  • Loading branch information
JoJohw authored Sep 27, 2024
1 parent e516493 commit abcdf1f
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/pages/src/views/setting/data-source/NewDataSource.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
@update-cur-step="updateCurStep"
@update-success="updateSuccess" />
<SchemaForm
v-if="currentType === customPlugin"
v-if="isJsonSchema"
ref="schemaFormRef"
:form-data="formData"
:plugins-config="jsonSchema"
Expand All @@ -36,7 +36,7 @@
</div>
</template>
<script setup lang="ts"> import { onMounted, reactive, ref, watch } from 'vue';
<script setup lang="ts"> import { computed, onMounted, reactive, ref, watch } from 'vue';
import { useRoute } from 'vue-router';
import Success from './ConfigSuccess.vue';
Expand Down Expand Up @@ -68,9 +68,11 @@ const jsonSchema = ref({});
const changePluginConfig = (value: any) => {
formData.plugin_config = value;
};
const customPlugin = 'custom_plugin';
const isNotJsonSchemaIds = ['general', 'local'];
const isJsonSchema = computed(() => !isNotJsonSchemaIds.includes(currentType.value));
const getJsonSchema = () => {
if (currentType.value !== customPlugin) return;
if (!isJsonSchema.value) return;
getCustomPlugin(currentType.value).then((res) => {
jsonSchema.value = res.data?.json_schema;
});
Expand Down

0 comments on commit abcdf1f

Please sign in to comment.