|
|
|
|
@ -86,59 +86,57 @@ const CreateFromDSLModal = ({
|
|
|
|
|
if (isCreatingRef.current)
|
|
|
|
|
return
|
|
|
|
|
isCreatingRef.current = true
|
|
|
|
|
try {
|
|
|
|
|
let response
|
|
|
|
|
if (currentTab === CreateFromDSLModalTab.FROM_FILE) {
|
|
|
|
|
response = await importDSL({
|
|
|
|
|
mode: DSLImportMode.YAML_CONTENT,
|
|
|
|
|
yaml_content: fileContent || '',
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
if (currentTab === CreateFromDSLModalTab.FROM_URL) {
|
|
|
|
|
response = await importDSL({
|
|
|
|
|
mode: DSLImportMode.YAML_URL,
|
|
|
|
|
yaml_url: dslUrlValue || '',
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
let response
|
|
|
|
|
if (currentTab === CreateFromDSLModalTab.FROM_FILE) {
|
|
|
|
|
response = await importDSL({
|
|
|
|
|
mode: DSLImportMode.YAML_CONTENT,
|
|
|
|
|
yaml_content: fileContent || '',
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
if (currentTab === CreateFromDSLModalTab.FROM_URL) {
|
|
|
|
|
response = await importDSL({
|
|
|
|
|
mode: DSLImportMode.YAML_URL,
|
|
|
|
|
yaml_url: dslUrlValue || '',
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!response)
|
|
|
|
|
return
|
|
|
|
|
const { id, status, pipeline_id, dataset_id, imported_dsl_version, current_dsl_version } = response
|
|
|
|
|
if (status === DSLImportStatus.COMPLETED || status === DSLImportStatus.COMPLETED_WITH_WARNINGS) {
|
|
|
|
|
if (onSuccess)
|
|
|
|
|
onSuccess()
|
|
|
|
|
if (onClose)
|
|
|
|
|
onClose()
|
|
|
|
|
if (!response) {
|
|
|
|
|
notify({ type: 'error', message: t('app.newApp.appCreateFailed') })
|
|
|
|
|
isCreatingRef.current = false
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
const { id, status, pipeline_id, dataset_id, imported_dsl_version, current_dsl_version } = response
|
|
|
|
|
if (status === DSLImportStatus.COMPLETED || status === DSLImportStatus.COMPLETED_WITH_WARNINGS) {
|
|
|
|
|
if (onSuccess)
|
|
|
|
|
onSuccess()
|
|
|
|
|
if (onClose)
|
|
|
|
|
onClose()
|
|
|
|
|
|
|
|
|
|
notify({
|
|
|
|
|
type: status === DSLImportStatus.COMPLETED ? 'success' : 'warning',
|
|
|
|
|
message: t(status === DSLImportStatus.COMPLETED ? 'app.newApp.appCreated' : 'app.newApp.caution'),
|
|
|
|
|
children: status === DSLImportStatus.COMPLETED_WITH_WARNINGS && t('app.newApp.appCreateDSLWarning'),
|
|
|
|
|
})
|
|
|
|
|
if (pipeline_id)
|
|
|
|
|
await handleCheckPluginDependencies(pipeline_id, true)
|
|
|
|
|
push(`datasets/${dataset_id}/pipeline`)
|
|
|
|
|
}
|
|
|
|
|
else if (status === DSLImportStatus.PENDING) {
|
|
|
|
|
setVersions({
|
|
|
|
|
importedVersion: imported_dsl_version ?? '',
|
|
|
|
|
systemVersion: current_dsl_version ?? '',
|
|
|
|
|
})
|
|
|
|
|
if (onClose)
|
|
|
|
|
onClose()
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
setShowErrorModal(true)
|
|
|
|
|
}, 300)
|
|
|
|
|
setImportId(id)
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
notify({ type: 'error', message: t('app.newApp.appCreateFailed') })
|
|
|
|
|
}
|
|
|
|
|
notify({
|
|
|
|
|
type: status === DSLImportStatus.COMPLETED ? 'success' : 'warning',
|
|
|
|
|
message: t(status === DSLImportStatus.COMPLETED ? 'app.newApp.appCreated' : 'app.newApp.caution'),
|
|
|
|
|
children: status === DSLImportStatus.COMPLETED_WITH_WARNINGS && t('app.newApp.appCreateDSLWarning'),
|
|
|
|
|
})
|
|
|
|
|
if (pipeline_id)
|
|
|
|
|
await handleCheckPluginDependencies(pipeline_id, true)
|
|
|
|
|
push(`/datasets/${dataset_id}/pipeline`)
|
|
|
|
|
isCreatingRef.current = false
|
|
|
|
|
}
|
|
|
|
|
catch {
|
|
|
|
|
notify({ type: 'error', message: t('app.newApp.appCreateFailed') })
|
|
|
|
|
else if (status === DSLImportStatus.PENDING) {
|
|
|
|
|
setVersions({
|
|
|
|
|
importedVersion: imported_dsl_version ?? '',
|
|
|
|
|
systemVersion: current_dsl_version ?? '',
|
|
|
|
|
})
|
|
|
|
|
if (onClose)
|
|
|
|
|
onClose()
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
setShowErrorModal(true)
|
|
|
|
|
}, 300)
|
|
|
|
|
setImportId(id)
|
|
|
|
|
isCreatingRef.current = false
|
|
|
|
|
}
|
|
|
|
|
finally {
|
|
|
|
|
else {
|
|
|
|
|
notify({ type: 'error', message: t('app.newApp.appCreateFailed') })
|
|
|
|
|
isCreatingRef.current = false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -153,32 +151,32 @@ const CreateFromDSLModal = ({
|
|
|
|
|
const { mutateAsync: importDSLConfirm } = useImportPipelineDSLConfirm()
|
|
|
|
|
|
|
|
|
|
const onDSLConfirm = async () => {
|
|
|
|
|
try {
|
|
|
|
|
if (!importId)
|
|
|
|
|
return
|
|
|
|
|
const response = await importDSLConfirm(importId)
|
|
|
|
|
if (!importId)
|
|
|
|
|
return
|
|
|
|
|
const response = await importDSLConfirm(importId)
|
|
|
|
|
|
|
|
|
|
if (!response) {
|
|
|
|
|
notify({ type: 'error', message: t('app.newApp.appCreateFailed') })
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const { status, pipeline_id, dataset_id } = response
|
|
|
|
|
const { status, pipeline_id, dataset_id } = response
|
|
|
|
|
|
|
|
|
|
if (status === DSLImportStatus.COMPLETED) {
|
|
|
|
|
if (onSuccess)
|
|
|
|
|
onSuccess()
|
|
|
|
|
if (onClose)
|
|
|
|
|
onClose()
|
|
|
|
|
if (status === DSLImportStatus.COMPLETED) {
|
|
|
|
|
if (onSuccess)
|
|
|
|
|
onSuccess()
|
|
|
|
|
if (onClose)
|
|
|
|
|
onClose()
|
|
|
|
|
|
|
|
|
|
notify({
|
|
|
|
|
type: 'success',
|
|
|
|
|
message: t('app.newApp.appCreated'),
|
|
|
|
|
})
|
|
|
|
|
if (pipeline_id)
|
|
|
|
|
await handleCheckPluginDependencies(pipeline_id, true)
|
|
|
|
|
push(`datasets/${dataset_id}/pipeline`)
|
|
|
|
|
}
|
|
|
|
|
else if (status === DSLImportStatus.FAILED) {
|
|
|
|
|
notify({ type: 'error', message: t('app.newApp.appCreateFailed') })
|
|
|
|
|
}
|
|
|
|
|
notify({
|
|
|
|
|
type: 'success',
|
|
|
|
|
message: t('app.newApp.appCreated'),
|
|
|
|
|
})
|
|
|
|
|
if (pipeline_id)
|
|
|
|
|
await handleCheckPluginDependencies(pipeline_id, true)
|
|
|
|
|
push(`datasets/${dataset_id}/pipeline`)
|
|
|
|
|
}
|
|
|
|
|
catch {
|
|
|
|
|
else if (status === DSLImportStatus.FAILED) {
|
|
|
|
|
notify({ type: 'error', message: t('app.newApp.appCreateFailed') })
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|