Browse Source

[Fix][UI Next][V1.0.0-Alpha] Fix the default items display error in SQOOP. (#9211)

3.0.0/version-upgrade
Amy0104 3 years ago committed by GitHub
parent
commit
0841ccacc0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      dolphinscheduler-ui-next/src/components/form/fields/radio.ts
  2. 4
      dolphinscheduler-ui-next/src/components/form/get-elements-by-json.ts
  3. 2
      dolphinscheduler-ui-next/src/components/form/index.tsx
  4. 4
      dolphinscheduler-ui-next/src/views/projects/task/components/node/fields/use-sqoop-datasource.ts
  5. 11
      dolphinscheduler-ui-next/src/views/projects/task/components/node/fields/use-sqoop-source-type.ts
  6. 6
      dolphinscheduler-ui-next/src/views/projects/task/components/node/fields/use-sqoop-target-type.ts

3
dolphinscheduler-ui-next/src/components/form/fields/radio.ts

@ -32,8 +32,9 @@ export function renderRadio(item: IJsonItem, fields: { [field: string]: any }) {
return h(
NRadioGroup,
{
...props,
value: fields[field],
onUpdateValue: (value) => void (fields[field] = value)
onUpdateValue: (value: any) => void (fields[field] = value)
},
() =>
h(NSpace, null, () =>

4
dolphinscheduler-ui-next/src/components/form/get-elements-by-json.ts

@ -31,7 +31,7 @@ export default function getElementByJson(
const elements: IFormItem[] = []
for (const item of json) {
const mergedItem = isFunction(item) ? item() : item
const { name, value, field, validate, ...rest } = mergedItem
const { name, value, field, children, validate, ...rest } = mergedItem
if (value || value === 0) {
fields[field] = value
initialValues[field] = value
@ -41,7 +41,7 @@ export default function getElementByJson(
showLabel: !!name,
...omit(rest, ['type', 'props', 'options']),
label: name,
path: field,
path: !children ? field : '',
widget: () => getField(item, fields, rules),
span: toRef(mergedItem, 'span') as Ref<number>
}

2
dolphinscheduler-ui-next/src/components/form/index.tsx

@ -60,7 +60,7 @@ const Form = defineComponent({
{...formItemProps}
span={unref(span) === void 0 ? 24 : unref(span)}
path={path}
key={path}
key={path || String(Date.now() + Math.random())}
>
{h(widget)}
</NFormItemGi>

4
dolphinscheduler-ui-next/src/views/projects/task/components/node/fields/use-sqoop-datasource.ts

@ -15,7 +15,7 @@
* limitations under the License.
*/
import { onMounted, ref, unref, Ref } from 'vue'
import { onMounted, ref, Ref } from 'vue'
import { queryDataSourceList } from '@/service/modules/data-source'
import { useI18n } from 'vue-i18n'
import type { IJsonItem, IDataBase } from '../types'
@ -52,7 +52,7 @@ export function useDatasource(
span: span,
options: [{ label: 'MYSQL', value: 'MYSQL' }],
validate: {
required: unref(span) !== 0
required: true
}
},
{

11
dolphinscheduler-ui-next/src/views/projects/task/components/node/fields/use-sqoop-source-type.ts

@ -33,7 +33,7 @@ export function useSourceType(
const columnSpan = ref(0)
const hiveSpan = ref(0)
const hdfsSpan = ref(0)
const datasourceSpan = ref(0)
const datasourceSpan = ref(12)
const resetSpan = () => {
mysqlSpan.value =
unCustomSpan.value && model.sourceType === 'MYSQL' ? 24 : 0
@ -94,7 +94,7 @@ export function useSourceType(
() => model.modelType,
(modelType: ModelType) => {
sourceTypes.value = getSourceTypesByModelType(modelType)
if (!sourceTypes.value.find((type) => model.sourceType === type.value)) {
if (!model.sourceType) {
model.sourceType = sourceTypes.value[0].value
}
}
@ -149,7 +149,12 @@ export function useSourceType(
label: 'SQL',
value: '1'
}
]
],
props: {
'on-update:value': (value: '0' | '1') => {
model.targetType = value === '0' ? 'HIVE' : 'HDFS'
}
}
},
{
type: 'input',

6
dolphinscheduler-ui-next/src/views/projects/task/components/node/fields/use-sqoop-target-type.ts

@ -26,8 +26,8 @@ export function useTargetType(
unCustomSpan: Ref<number>
): IJsonItem[] {
const { t } = useI18n()
const hiveSpan = ref(24)
const hdfsSpan = ref(0)
const hiveSpan = ref(0)
const hdfsSpan = ref(24)
const mysqlSpan = ref(0)
const dataSourceSpan = ref(0)
const updateSpan = ref(0)
@ -103,7 +103,7 @@ export function useTargetType(
() => [model.sourceType, model.srcQueryType],
([sourceType, srcQueryType]) => {
targetTypes.value = getTargetTypesBySourceType(sourceType, srcQueryType)
if (!targetTypes.value.find((type) => model.targetType === type.value)) {
if (!model.targetType) {
model.targetType = targetTypes.value[0].value
}
}

Loading…
Cancel
Save