Browse Source

[Feature][UI Next][V1.0.0-Alpha]Unified processing of back-end error messages (#8779)

* Unified processing of back-end error messages

* Fixed the problem of English and Chinese being unified on the front and back ends

* Fix the $message mount problem

* Delete messages that are processed separately

* Delete all try catch related operations
3.0.0/version-upgrade
labbomb 3 years ago committed by GitHub
parent
commit
38fba609cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 17
      dolphinscheduler-ui-next/src/service/service.ts
  2. 4
      dolphinscheduler-ui-next/src/utils/index.ts
  3. 64
      dolphinscheduler-ui-next/src/utils/log.ts
  4. 17
      dolphinscheduler-ui-next/src/views/datasource/list/use-detail.ts
  5. 4
      dolphinscheduler-ui-next/src/views/datasource/list/use-form.ts
  6. 10
      dolphinscheduler-ui-next/src/views/datasource/list/use-table.ts
  7. 7
      dolphinscheduler-ui-next/src/views/login/index.tsx
  8. 2
      dolphinscheduler-ui-next/src/views/login/use-translate.ts
  9. 6
      dolphinscheduler-ui-next/src/views/projects/task/components/node/fields/use-child-node.ts
  10. 4
      dolphinscheduler-ui-next/src/views/projects/task/components/node/fields/use-datasource-type.ts
  11. 4
      dolphinscheduler-ui-next/src/views/projects/task/components/node/fields/use-datasource.ts
  12. 4
      dolphinscheduler-ui-next/src/views/projects/task/components/node/fields/use-datax.ts
  13. 6
      dolphinscheduler-ui-next/src/views/projects/task/components/node/fields/use-dependent.ts
  14. 4
      dolphinscheduler-ui-next/src/views/projects/task/components/node/fields/use-environment-name.ts
  15. 2
      dolphinscheduler-ui-next/src/views/projects/task/components/node/fields/use-flink.ts
  16. 2
      dolphinscheduler-ui-next/src/views/projects/task/components/node/fields/use-mr.ts
  17. 6
      dolphinscheduler-ui-next/src/views/projects/task/components/node/fields/use-process-name.ts
  18. 10
      dolphinscheduler-ui-next/src/views/projects/task/components/node/fields/use-rules.ts
  19. 4
      dolphinscheduler-ui-next/src/views/projects/task/components/node/fields/use-sea-tunnel.ts
  20. 4
      dolphinscheduler-ui-next/src/views/projects/task/components/node/fields/use-shell.ts
  21. 2
      dolphinscheduler-ui-next/src/views/projects/task/components/node/fields/use-spark.ts
  22. 4
      dolphinscheduler-ui-next/src/views/projects/task/components/node/fields/use-sql-type.ts
  23. 4
      dolphinscheduler-ui-next/src/views/projects/task/components/node/fields/use-sql.ts
  24. 4
      dolphinscheduler-ui-next/src/views/projects/task/components/node/fields/use-sqoop-datasource.ts
  25. 4
      dolphinscheduler-ui-next/src/views/projects/task/components/node/fields/use-switch.ts
  26. 4
      dolphinscheduler-ui-next/src/views/projects/task/components/node/fields/use-task-group.ts
  27. 4
      dolphinscheduler-ui-next/src/views/projects/task/components/node/fields/use-worker-group.ts
  28. 10
      dolphinscheduler-ui-next/src/views/projects/task/definition/use-task.ts
  29. 3
      dolphinscheduler-ui-next/src/views/projects/workflow/components/dag/dag-save-modal.tsx
  30. 2
      dolphinscheduler-ui-next/src/views/projects/workflow/components/dag/use-custom-cell-builder.ts
  31. 22
      dolphinscheduler-ui-next/src/views/projects/workflow/definition/components/use-modal.ts
  32. 6
      dolphinscheduler-ui-next/src/views/projects/workflow/definition/components/use-table.ts
  33. 3
      dolphinscheduler-ui-next/src/views/projects/workflow/definition/create/index.tsx
  34. 3
      dolphinscheduler-ui-next/src/views/projects/workflow/definition/detail/index.tsx
  35. 3
      dolphinscheduler-ui-next/src/views/projects/workflow/definition/timing/use-table.ts
  36. 12
      dolphinscheduler-ui-next/src/views/projects/workflow/definition/use-table.ts
  37. 10
      dolphinscheduler-ui-next/src/views/projects/workflow/instance/components/log-modal.tsx
  38. 16
      dolphinscheduler-ui-next/src/views/projects/workflow/instance/use-table.ts
  39. 4
      dolphinscheduler-ui-next/src/views/resource/file/create/use-create.ts
  40. 4
      dolphinscheduler-ui-next/src/views/resource/file/edit/use-edit.ts
  41. 4
      dolphinscheduler-ui-next/src/views/resource/file/folder/use-folder.ts
  42. 4
      dolphinscheduler-ui-next/src/views/resource/file/rename/use-rename.ts
  43. 4
      dolphinscheduler-ui-next/src/views/resource/file/upload/use-upload.ts
  44. 8
      dolphinscheduler-ui-next/src/views/resource/udf/function/components/use-modal.ts
  45. 8
      dolphinscheduler-ui-next/src/views/resource/udf/resource/components/use-modal.ts
  46. 3
      dolphinscheduler-ui-next/src/views/resource/udf/resource/use-table.ts
  47. 6
      dolphinscheduler-ui-next/src/views/security/alarm-instance-manage/use-detail.ts
  48. 10
      dolphinscheduler-ui-next/src/views/security/alarm-instance-manage/use-form.ts
  49. 11
      dolphinscheduler-ui-next/src/views/security/alarm-instance-manage/use-table.ts

17
dolphinscheduler-ui-next/src/service/service.ts

@ -21,9 +21,23 @@ import qs from 'qs'
import _ from 'lodash'
import cookies from 'js-cookie'
import router from '@/router'
import utils from '@/utils'
const userStore = useUserStore()
/**
* @description Log and display errors
* @param {Error} error Error object
*/
const handleError = (res: AxiosResponse<any, any>) => {
// Print to console
if (import.meta.env.MODE === 'development') {
utils.log.capsule('DolphinScheduler', 'UI-NEXT')
utils.log.error(res)
}
window.$message.error(res.data.msg)
}
const baseRequestConfig: AxiosRequestConfig = {
baseURL:
import.meta.env.MODE === 'development'
@ -76,7 +90,8 @@ service.interceptors.response.use((res: AxiosResponse) => {
case 0:
return res.data.data
default:
throw new Error(`${res.data.msg}: ${res.config.url}`)
handleError(res)
throw new Error()
}
}, err)

4
dolphinscheduler-ui-next/src/utils/index.ts

@ -18,11 +18,13 @@
import mapping from './mapping'
import regex from './regex'
import truncateText from './truncate-text'
import log from './log'
const utils = {
mapping,
regex,
truncateText
truncateText,
log
}
export default utils

64
dolphinscheduler-ui-next/src/utils/log.ts

@ -0,0 +1,64 @@
/*
* 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.
*/
const log = {
capsule: (title: string, text: string, type?: string) => {},
error: (info: any) => {}
}
/**
* @description Returns the color value of the style
* @param {String} type The style name [ primary | success | warning | error ]
*/
const typeColor = (type = 'primary') => {
let color = ''
switch (type) {
case 'primary': color = '#1890ff'; break
case 'success': color = '#52c41a'; break
case 'warning': color = '#faad14'; break
case 'error': color = '#ff4d4f'; break
default:; break
}
return color
}
/**
* @description capsule
* @param {String} title title text
* @param {String} text info text
* @param {String} type style
*/
log.capsule = (title: string, text: string, type: string = 'primary') => {
console.log(
`%c ${title} %c ${text} %c`,
'background:#35495E; padding: 2px ; border-radius: 3px 0 0 3px; color: #fff;',
`background:${typeColor(type)}; padding: 2px; border-radius: 0 3px 3px 0; color: #fff;`,
'background:transparent'
)
}
/**
* @description Prints text in error style
*/
log.error = function (info) {
console.group('error info')
console.log('responseURL: ', `${info.config.baseURL}${info.config.url}`)
console.log('msg: ', info.data.msg)
console.groupEnd()
}
export default log

17
dolphinscheduler-ui-next/src/views/datasource/list/use-detail.ts

@ -47,22 +47,15 @@ export function useDetail(getFieldsValue: Function) {
const queryById = async (id: number) => {
if (status.loading) return {}
status.loading = true
try {
const dataSourceRes = await queryDataSource(id)
status.loading = false
PREV_NAME = dataSourceRes.name
return dataSourceRes
} catch (e) {
window.$message.error((e as Error).message)
status.loading = false
return {}
}
}
const testConnect = async () => {
if (status.testing) return
status.testing = true
try {
const res = await connectDataSource(formatParams())
window.$message.success(
res
@ -70,10 +63,6 @@ export function useDetail(getFieldsValue: Function) {
: `${t('datasource.test_connect')} ${t('datasource.success')}`
)
status.testing = false
} catch (e) {
window.$message.error((e as Error).message)
status.testing = false
}
}
const createOrUpdate = async (id?: number) => {
@ -81,7 +70,6 @@ export function useDetail(getFieldsValue: Function) {
if (status.saving || !values.name) return false
status.saving = true
try {
if (PREV_NAME !== values.name) {
await verifyDataSourceName({ name: values.name })
}
@ -92,11 +80,6 @@ export function useDetail(getFieldsValue: Function) {
status.saving = false
return true
} catch (e) {
window.$message.error((e as Error).message)
status.saving = false
return false
}
}
return { status, queryById, testConnect, createOrUpdate }

4
dolphinscheduler-ui-next/src/views/datasource/list/use-form.ts

@ -123,11 +123,7 @@ export function useForm(id?: number) {
state.showConnectType = type === 'ORACLE'
if (type === 'HIVE' || type === 'SPARK') {
try {
state.showPrincipal = await getKerberosStartupState()
} catch (e) {
window.$message.error((e as Error).message)
}
} else {
state.showPrincipal = false
}

10
dolphinscheduler-ui-next/src/views/datasource/list/use-table.ts

@ -35,7 +35,6 @@ export function useTable() {
if (data.loading) return
data.loading = true
try {
const listRes = await queryDataSourceListPaging({
pageNo: data.page,
pageSize: data.pageSize,
@ -44,11 +43,6 @@ export function useTable() {
data.loading = false
data.list = listRes.totalList
data.itemCount = listRes.total
} catch (e) {
window.$message.error((e as Error).message)
data.loading = false
data.list = []
}
}
const updateList = () => {
@ -59,12 +53,8 @@ export function useTable() {
}
const deleteRecord = async (id: number) => {
try {
const ignored = await deleteDataSource(id)
updateList()
} catch (e) {
window.$message.error((e as Error).message)
}
}
const changePage = (page: number) => {

7
dolphinscheduler-ui-next/src/views/login/index.tsx

@ -17,16 +17,19 @@
import { defineComponent, toRefs, withKeys } from 'vue'
import styles from './index.module.scss'
import { NInput, NButton, NSwitch, NForm, NFormItem } from 'naive-ui'
import { NInput, NButton, NSwitch, NForm, NFormItem, useMessage } from 'naive-ui'
import { useForm } from './use-form'
import { useTranslate } from './use-translate'
import { useLogin } from './use-login'
import { useLocalesStore } from '@/store/locales/locales'
import { useThemeStore } from '@/store/theme/theme'
import cookies from 'js-cookie'
const login = defineComponent({
name: 'login',
setup() {
window.$message = useMessage()
const { state, t, locale } = useForm()
const { handleChange } = useTranslate(locale)
const { handleLogin } = useLogin(state)
@ -37,6 +40,8 @@ const login = defineComponent({
themeStore.setDarkTheme()
}
cookies.set('language', localesStore.getLocales, { path: '/' })
return { t, handleChange, handleLogin, ...toRefs(state), localesStore }
},
render() {

2
dolphinscheduler-ui-next/src/views/login/use-translate.ts

@ -18,6 +18,7 @@
import { WritableComputedRef } from 'vue'
import { useLocalesStore } from '@/store/locales/locales'
import type { Locales } from '@/store/locales/types'
import cookies from 'js-cookie'
export function useTranslate(locale: WritableComputedRef<string>) {
const localesStore = useLocalesStore()
@ -25,6 +26,7 @@ export function useTranslate(locale: WritableComputedRef<string>) {
const handleChange = (value: Locales) => {
locale.value = value
localesStore.setLocales(value)
cookies.set('language', locale.value, { path: '/' })
}
return {
handleChange

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

@ -45,23 +45,17 @@ export function useChildNode({
const getProcessList = async () => {
if (loading.value) return
loading.value = true
try {
const res = await querySimpleList(projectCode)
options.value = res.map((option: { name: string; code: number }) => ({
label: option.name,
value: option.code
}))
loading.value = false
} catch (err) {
loading.value = false
}
}
const getProcessListByCode = async (processCode: number) => {
if (!processCode) return
try {
const res = await queryProcessDefinitionByCode(processCode, projectCode)
getTaskOptions(res)
} catch (err) {}
}
const getTaskOptions = (processDefinition: {
processTaskRelationList: []

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

@ -86,7 +86,6 @@ export function useDatasourceType(
const getDatasourceTypes = async () => {
if (loading.value) return
loading.value = true
try {
options.value = datasourceTypes
.filter((item) => {
if (item.disabled) {
@ -99,9 +98,6 @@ export function useDatasourceType(
})
.map((item) => ({ label: item.code, value: item.code }))
loading.value = false
} catch (err) {
loading.value = false
}
}
const onChange = (type: string) => {

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

@ -35,12 +35,8 @@ export function useDatasource(
const getDatasources = async () => {
if (loading.value) return
loading.value = true
try {
await refreshOptions()
loading.value = false
} catch (err) {
loading.value = false
}
}
const refreshOptions = async () => {

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

@ -153,14 +153,10 @@ export function useDataX(model: { [field: string]: any }): IJsonItem[] {
const getDatasourceTypes = async () => {
if (loading.value) return
loading.value = true
try {
datasourceTypeOptions.value = datasourceTypes
.filter((item) => !item.disabled)
.map((item) => ({ label: item.code, value: item.code }))
loading.value = false
} catch (err) {
loading.value = false
}
}
const getDatasourceInstances = async () => {

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

@ -157,7 +157,6 @@ export function useDependent(model: { [field: string]: any }): IJsonItem[] {
}
const getProjectList = async () => {
try {
const result = await queryProjectCreatedAndAuthorizedByUser()
projectList.value = result.map(
(item: { code: number; name: string }) => ({
@ -166,13 +165,11 @@ export function useDependent(model: { [field: string]: any }): IJsonItem[] {
})
)
return projectList
} catch (err) {}
}
const getProcessList = async (code: number) => {
if (processCache[code]) {
return processCache[code]
}
try {
const result = await queryAllByProjectCode(code)
const processList = result.map(
(item: { processDefinition: { code: number; name: string } }) => ({
@ -183,14 +180,12 @@ export function useDependent(model: { [field: string]: any }): IJsonItem[] {
processCache[code] = processList
return processList
} catch (err) {}
}
const getTaskList = async (code: number, processCode: number) => {
if (taskCache[processCode]) {
return taskCache[processCode]
}
try {
const result = await getTasksByDefinitionCode(code, processCode)
const taskList = result.map((item: { code: number; name: string }) => ({
value: item.code,
@ -202,7 +197,6 @@ export function useDependent(model: { [field: string]: any }): IJsonItem[] {
})
taskCache[processCode] = taskList
return taskList
} catch (err) {}
}
onMounted(() => {

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

@ -34,7 +34,6 @@ export function useEnvironmentName(
const getEnvironmentList = async () => {
if (loading.value) return
loading.value = true
try {
const res = await queryAllEnvironmentList()
environmentList = res.map(
(item: { code: string; name: string; workerGroups: string[] }) => ({
@ -47,9 +46,6 @@ export function useEnvironmentName(
filterByWorkerGroup(option)
)
loading.value = false
} catch (err) {
loading.value = false
}
}
const filterByWorkerGroup = (option: IEnvironmentNameOption) => {

2
dolphinscheduler-ui-next/src/views/projects/task/components/node/fields/use-flink.ts

@ -44,7 +44,6 @@ export function useFlink(model: { [field: string]: any }): IJsonItem[] {
mainJarOptions.value = resources[programType]
return
}
try {
const res = await queryResourceByProgramType({
type: 'FILE',
programType
@ -52,7 +51,6 @@ export function useFlink(model: { [field: string]: any }): IJsonItem[] {
removeUselessChildren(res)
mainJarOptions.value = res || []
resources[programType] = res
} catch (err) {}
}
onMounted(() => {

2
dolphinscheduler-ui-next/src/views/projects/task/components/node/fields/use-mr.ts

@ -37,7 +37,6 @@ export function useMr(model: { [field: string]: any }): IJsonItem[] {
mainJarOptions.value = resources[programType]
return
}
try {
const res = await queryResourceByProgramType({
type: 'FILE',
programType
@ -45,7 +44,6 @@ export function useMr(model: { [field: string]: any }): IJsonItem[] {
removeUselessChildren(res)
mainJarOptions.value = res || []
resources[programType] = res
} catch (err) {}
}
onMounted(() => {

6
dolphinscheduler-ui-next/src/views/projects/task/components/node/fields/use-process-name.ts

@ -47,23 +47,17 @@ export function useProcessName({
const getProcessList = async () => {
if (loading.value) return
loading.value = true
try {
const res = await querySimpleList(projectCode)
options.value = res.map((option: { name: string; code: number }) => ({
label: option.name,
value: option.code
}))
loading.value = false
} catch (err) {
loading.value = false
}
}
const getProcessListByCode = async (processCode: number) => {
if (!processCode) return
try {
const res = await queryProcessDefinitionByCode(processCode, projectCode)
getTaskOptions(res)
} catch (err) {}
}
const getTaskOptions = (processDefinition: {
processTaskRelationList: []

10
dolphinscheduler-ui-next/src/views/projects/task/components/node/fields/use-rules.ts

@ -47,7 +47,6 @@ export function useRules(
const getRuleList = async () => {
if (ruleLoading.value) return
ruleLoading.value = true
try {
const result = await queryRuleList()
rules.value = result.map((item: { id: number; name: string }) => {
let name = ''
@ -60,15 +59,11 @@ export function useRules(
}
})
ruleLoading.value = false
} catch (err) {
ruleLoading.value = false
}
}
const getRuleById = async (ruleId: number) => {
if (ruleLoading.value) return
ruleLoading.value = true
try {
const result = await getRuleFormCreateJson(ruleId)
const items = JSON.parse(result).map((item: IResponseJsonItem) =>
formatResponseJson(item)
@ -76,9 +71,6 @@ export function useRules(
updateRules(items, preItemLen)
preItemLen = items.length
ruleLoading.value = false
} catch (err) {
ruleLoading.value = false
}
}
const formatResponseJson = (
@ -138,7 +130,6 @@ export function useRules(
}
const onFieldChange = async (value: string | number, field: string) => {
try {
if (field === 'src_connector_type' && typeof value === 'number') {
const result = await getDatasourceOptionsById(value)
srcDatasourceOptions.value = result || []
@ -191,7 +182,6 @@ export function useRules(
targetTableColumnOptions.value = result || []
model.target_field = null
}
} catch (err) {}
}
onMounted(async () => {

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

@ -55,15 +55,11 @@ export function useSeaTunnel(model: { [field: string]: any }): IJsonItem[] {
const getResourceList = async () => {
if (loading.value) return
loading.value = true
try {
model.resourceFiles = []
const res = await queryResourceList({ type: 'FILE' })
removeUselessChildren(res)
options.value = res || []
loading.value = false
} catch (err) {
loading.value = false
}
}
function removeUselessChildren(

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

@ -29,14 +29,10 @@ export function useShell(model: { [field: string]: any }): IJsonItem[] {
const getResourceList = async () => {
if (loading.value) return
loading.value = true
try {
const res = await queryResourceList({ type: 'FILE' })
removeUselessChildren(res)
options.value = res || []
loading.value = false
} catch (err) {
loading.value = false
}
}
onMounted(() => {

2
dolphinscheduler-ui-next/src/views/projects/task/components/node/fields/use-spark.ts

@ -44,7 +44,6 @@ export function useSpark(model: { [field: string]: any }): IJsonItem[] {
mainJarOptions.value = resources[programType]
return
}
try {
const res = await queryResourceByProgramType({
type: 'FILE',
programType
@ -52,7 +51,6 @@ export function useSpark(model: { [field: string]: any }): IJsonItem[] {
removeUselessChildren(res)
mainJarOptions.value = res || []
resources[programType] = res
} catch (err) {}
}
onMounted(() => {

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

@ -39,15 +39,11 @@ export function useSqlType(unusedModel: { [field: string]: any }): IJsonItem {
const getSqlTypes = async () => {
if (loading.value) return
loading.value = true
try {
options.value = sqlTypes.map((item) => ({
label: item.code,
value: item.id
}))
loading.value = false
} catch (err) {
loading.value = false
}
}
onMounted(() => {

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

@ -28,14 +28,10 @@ export function useSql(model: { [field: string]: any }): IJsonItem[] {
const getResourceList = async () => {
if (loading.value) return
loading.value = true
try {
const res = await queryResourceList({ type: 'FILE' })
removeUselessChildren(res)
options.value = res || []
loading.value = false
} catch (err) {
loading.value = false
}
}
onMounted(() => {

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

@ -33,7 +33,6 @@ export function useDatasource(
const getDataSource = async (type: IDataBase) => {
if (loading.value) return
loading.value = true
try {
const result = await queryDataSourceList({ type })
dataSourceList.value = result.map(
(item: { name: string; id: number }) => ({
@ -42,9 +41,6 @@ export function useDatasource(
})
)
loading.value = false
} catch (err) {
loading.value = false
}
}
onMounted(() => {
getDataSource('MYSQL')

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

@ -32,7 +32,6 @@ export function useSwitch(
if (loading.value) return
loading.value = true
branchFlowOptions.value = []
try {
const res = await queryProcessDefinitionByCode(
model.processName,
projectCode
@ -43,9 +42,6 @@ export function useSwitch(
}
})
loading.value = false
} catch (err) {
loading.value = false
}
}
watch(

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

@ -33,7 +33,6 @@ export function useTaskGroup(
const getTaskGroupList = async () => {
if (loading.value) return
loading.value = true
try {
const { totalList = [] } = await queryTaskGroupListPagingByProjectCode({
pageNo: 1,
pageSize: 2147483647,
@ -44,9 +43,6 @@ export function useTaskGroup(
value: item.id
}))
loading.value = false
} catch (err) {
loading.value = false
}
}
onMounted(() => {

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

@ -29,13 +29,9 @@ export function useWorkerGroup(): IJsonItem {
const getWorkerGroups = async () => {
if (loading.value) return
loading.value = true
try {
const res = await queryAllWorkerGroups()
options.value = res.map((item: string) => ({ label: item, value: item }))
loading.value = false
} catch (err) {
loading.value = false
}
}
onMounted(() => {

10
dolphinscheduler-ui-next/src/views/projects/task/definition/use-task.ts

@ -60,7 +60,6 @@ export function useTask(projectCode: number) {
task.taskShow = show
}
const onTaskSave = async (data: INodeData) => {
try {
if (task.taskSaving) return
task.taskSaving = true
if (data.id) {
@ -80,22 +79,13 @@ export function useTask(projectCode: number) {
task.taskSaving = false
return true
} catch (e) {
window.$message.error((e as Error).message)
task.taskSaving = false
return false
}
}
const onEditTask = async (row: IRecord, readonly: boolean) => {
try {
const result = await queryTaskDefinitionByCode(row.taskCode, projectCode)
task.taskData = { ...result, processName: row.processDefinitionCode }
task.taskShow = true
task.taskReadonly = readonly
} catch (e) {
window.$message.error((e as Error).message)
}
}
const onInitTask = () => {

3
dolphinscheduler-ui-next/src/views/projects/workflow/components/dag/dag-save-modal.tsx

@ -133,9 +133,6 @@ export default defineComponent({
) {
verifyName(params, projectCode)
.then(() => context.emit('save', formValue.value))
.catch((error: any) => {
window.$message.error(error.message)
})
} else {
context.emit('save', formValue.value)
}

2
dolphinscheduler-ui-next/src/views/projects/workflow/components/dag/use-custom-cell-builder.ts

@ -29,9 +29,7 @@ export function useCustomCellBuilder() {
function parseLocationStr(locationStr: string) {
let locations = null
if (!locationStr) return locations
try {
locations = JSON.parse(locationStr)
} catch (error) {}
return Array.isArray(locations) ? locations : null
}

22
dolphinscheduler-ui-next/src/views/projects/workflow/definition/components/use-modal.ts

@ -61,7 +61,6 @@ export function useModal(
const handleImportDefinition = () => {
state.importFormRef.validate(async (valid: any) => {
if (!valid) {
try {
const formData = new FormData()
formData.append('file', state.importForm.file)
const code = Number(router.currentRoute.value.params.projectCode)
@ -70,9 +69,6 @@ export function useModal(
ctx.emit('updateList')
ctx.emit('update:show')
resetImportForm()
} catch (error: any) {
window.$message.error(error.message)
}
}
})
}
@ -103,14 +99,10 @@ export function useModal(
? JSON.stringify(startParams)
: ''
try {
await startProcessInstance(state.startForm, variables.projectCode)
window.$message.success(t('project.workflow.success'))
ctx.emit('updateList')
ctx.emit('update:show')
} catch (error: any) {
window.$message.error(error.message)
}
}
})
}
@ -121,14 +113,10 @@ export function useModal(
const data: any = getTimingData()
data.processDefinitionCode = code
try {
await createSchedule(data, variables.projectCode)
window.$message.success(t('project.workflow.success'))
ctx.emit('updateList')
ctx.emit('update:show')
} catch (error: any) {
window.$message.error(error.message)
}
}
})
}
@ -139,14 +127,10 @@ export function useModal(
const data: any = getTimingData()
data.id = id
try {
await updateSchedule(data, variables.projectCode, id)
window.$message.success(t('project.workflow.success'))
ctx.emit('updateList')
ctx.emit('update:show')
} catch (error: any) {
window.$message.error(error.message)
}
}
})
}
@ -214,9 +198,6 @@ export function useModal(
.then((res: any) => {
variables.startParamsList = res.processDefinition.globalParamList
})
.catch((error: any) => {
window.$message.error(error.message)
})
}
const getPreviewSchedule = () => {
@ -242,9 +223,6 @@ export function useModal(
.then((res: any) => {
variables.schedulePreviewList = res
})
.catch((error: any) => {
window.$message.error(error.message)
})
}
})
}

6
dolphinscheduler-ui-next/src/views/projects/workflow/definition/components/use-table.ts

@ -178,9 +178,6 @@ export function useTable(
ctx.emit('updateList')
getTableData(variables.row)
})
.catch((error: any) => {
window.$message.error(error.message)
})
}
const handleDeleteVersion = (version: number) => {
@ -190,9 +187,6 @@ export function useTable(
ctx.emit('updateList')
getTableData(variables.row)
})
.catch((error: any) => {
window.$message.error(error.message)
})
}
return {

3
dolphinscheduler-ui-next/src/views/projects/workflow/definition/create/index.tsx

@ -80,9 +80,6 @@ export default defineComponent({
message.success(t('project.dag.success'))
router.push({ path: `/projects/${projectCode}/workflow-definition` })
})
.catch((error: any) => {
window.$message.error(error.message)
})
}
return () => (

3
dolphinscheduler-ui-next/src/views/projects/workflow/definition/detail/index.tsx

@ -99,9 +99,6 @@ export default defineComponent({
message.success(t('project.dag.success'))
router.push({ path: `/projects/${projectCode}/workflow-definition` })
})
.catch((error: any) => {
window.$message.error(error.message)
})
}
onMounted(() => {

3
dolphinscheduler-ui-next/src/views/projects/workflow/definition/timing/use-table.ts

@ -262,9 +262,6 @@ export function useTable() {
searchVal: variables.searchVal
})
})
.catch((error: any) => {
window.$message.error(error.message)
})
}
return {

12
dolphinscheduler-ui-next/src/views/projects/workflow/definition/use-table.ts

@ -200,9 +200,6 @@ export function useTable() {
searchVal: variables.searchVal
})
})
.catch((error: any) => {
window.$message.error(error.message)
})
}
const releaseWorkflow = (row: any) => {
@ -221,9 +218,6 @@ export function useTable() {
searchVal: variables.searchVal
})
})
.catch((error: any) => {
window.$message.error(error.message)
})
}
const copyWorkflow = (row: any) => {
@ -240,9 +234,6 @@ export function useTable() {
searchVal: variables.searchVal
})
})
.catch((error: any) => {
window.$message.error(error.message)
})
}
const downloadBlob = (data: any, fileNameS = 'json') => {
@ -280,9 +271,6 @@ export function useTable() {
.then((res: any) => {
downloadBlob(res, fileName)
})
.catch((error: any) => {
window.$message.error(error.message)
})
}
const gotoTimingManage = (row: any) => {

10
dolphinscheduler-ui-next/src/views/projects/workflow/instance/components/log-modal.tsx

@ -96,10 +96,6 @@ export default defineComponent({
}, 1500)
textareaLog.value.innerHTML = res || t('project.workflow.no_log')
})
.catch((error: any) => {
window.$message.error(error.message || '')
loadingRef.value = false
})
}
const showLog = () => {
@ -126,9 +122,6 @@ export default defineComponent({
}, 800)
}
})
.catch((error: any) => {
window.$message.error(error.message || '')
})
}
const initLog = () => {
@ -259,7 +252,7 @@ export default defineComponent({
render() {
return (
<div>
<span class={styles['log-model']}>
<span>
{this.taskInstanceId && this.taskInstanceType !== 'SUB_PROCESS' && (
<span>
{renderSlot(this.$slots, 'history')}
@ -349,7 +342,6 @@ export default defineComponent({
<div class={styles['content']} ref='logContent'>
<div class={styles['content-log-box']} ref='logContentBox'>
<textarea
class={styles['textarea-ft']}
style={`width: 100%; height: ${this.textareaHeight}px`}
spellcheck='false'
ref='textareaLog'

16
dolphinscheduler-ui-next/src/views/projects/workflow/instance/use-table.ts

@ -285,10 +285,6 @@ export function useTable() {
getTableData()
})
.catch((error: any) => {
window.$message.error(error.message || '')
getTableData()
})
}
const batchDeleteInstance = () => {
@ -310,10 +306,6 @@ export function useTable() {
variables.checkedRowKeys = []
getTableData()
})
.catch((error: any) => {
window.$message.error(error.message || '')
getTableData()
})
}
/**
@ -326,10 +318,6 @@ export function useTable() {
getTableData()
})
.catch((error: any) => {
window.$message.error(error.message || '')
getTableData()
})
}
/**
@ -368,10 +356,6 @@ export function useTable() {
getTableData()
}, index)
})
.catch((error: any) => {
window.$message.error(error.message)
getTableData()
})
}
return {

4
dolphinscheduler-ui-next/src/views/resource/file/create/use-create.ts

@ -31,7 +31,6 @@ export function useCreate(state: any) {
const currentDir = fileStore.getCurrentDir || '/'
state.fileFormRef.validate(async (valid: any) => {
if (!valid) {
try {
await onlineCreateResource({
...state.fileForm,
...{ pid, currentDir }
@ -40,9 +39,6 @@ export function useCreate(state: any) {
window.$message.success(t('resource.file.success'))
const name = pid ? 'resource-file-subdirectory' : 'file'
router.push({ name, params: { id: pid } })
} catch (error: any) {
window.$message.error(error.message)
}
}
})
}

4
dolphinscheduler-ui-next/src/views/resource/file/edit/use-edit.ts

@ -43,7 +43,6 @@ export function useEdit(state: any) {
const handleUpdateContent = (id: number) => {
state.fileFormRef.validate(async (valid: any) => {
if (!valid) {
try {
await updateResourceContent(
{
...state.fileForm
@ -53,9 +52,6 @@ export function useEdit(state: any) {
window.$message.success(t('resource.file.success'))
router.go(-1)
} catch (error: any) {
window.$message.error(error.message)
}
}
})
}

4
dolphinscheduler-ui-next/src/views/resource/file/folder/use-folder.ts

@ -36,7 +36,6 @@ export function useFolder(state: any) {
const currentDir = fileStore.getCurrentDir || '/'
state.folderFormRef.validate(async (valid: any) => {
if (!valid) {
try {
await createDirectory({
...state.folderForm,
...{ pid, currentDir }
@ -44,9 +43,6 @@ export function useFolder(state: any) {
window.$message.success(t('resource.file.success'))
emit('updateList')
} catch (error: any) {
window.$message.error(error.message)
}
hideModal()
resetForm()
}

4
dolphinscheduler-ui-next/src/views/resource/file/rename/use-rename.ts

@ -29,7 +29,6 @@ export function useRename(state: any) {
) => {
state.renameFormRef.validate(async (valid: any) => {
if (!valid) {
try {
await updateResource(
{
...state.renameForm
@ -38,9 +37,6 @@ export function useRename(state: any) {
)
window.$message.success(t('resource.file.success'))
emit('updateList')
} catch (error: any) {
window.$message.error(error.message)
}
}
hideModal()

4
dolphinscheduler-ui-next/src/views/resource/file/upload/use-upload.ts

@ -44,13 +44,9 @@ export function useUpload(state: any) {
formData.append('currentDir', currentDir)
formData.append('description', state.uploadForm.description)
try {
await createResource(formData as any)
window.$message.success(t('resource.file.success'))
emit('updateList')
} catch (error: any) {
window.$message.error(error.message)
}
hideModal()
resetForm()

8
dolphinscheduler-ui-next/src/views/resource/udf/function/components/use-modal.ts

@ -61,14 +61,10 @@ export function useModal(
const submitRequest = (serviceHandle: any) => {
state.functionFormRef.validate(async (valid: any) => {
if (!valid) {
try {
await serviceHandle()
window.$message.success(t('resource.udf.success'))
ctx.emit('updateList')
ctx.emit('update:show')
} catch (error: any) {
window.$message.error(error.message)
}
}
})
}
@ -160,16 +156,12 @@ export function useModal(
formData.append('currentDir', uploadState.uploadForm.currentDir)
formData.append('description', uploadState.uploadForm.description)
try {
const res = await createResource(formData as any)
window.$message.success(t('resource.function.success'))
variables.uploadShow = false
resetUploadForm()
getUdfList()
state.functionForm.resourceId = res.id
} catch (error: any) {
window.$message.error(error.message)
}
}
})
}

8
dolphinscheduler-ui-next/src/views/resource/udf/resource/components/use-modal.ts

@ -62,14 +62,10 @@ export function useModal(
const submitRequest = (serviceHandle: any) => {
state.folderFormRef.validate(async (valid: any) => {
if (!valid) {
try {
await serviceHandle()
window.$message.success(t('resource.udf.success'))
ctx.emit('updateList')
ctx.emit('update:show')
} catch (error: any) {
window.$message.error(error.message)
}
}
})
}
@ -93,15 +89,11 @@ export function useModal(
formData.append('currentDir', currentDir)
formData.append('description', state.uploadForm.description)
try {
await createResource(formData as any)
window.$message.success(t('resource.udf.success'))
ctx.emit('updateList')
ctx.emit('update:show')
resetUploadForm()
} catch (error: any) {
window.$message.error(error.message)
}
}
})
}

3
dolphinscheduler-ui-next/src/views/resource/udf/resource/use-table.ts

@ -270,9 +270,6 @@ export function useTable() {
fileStore.setCurrentDir(res.fullName)
router.push({ name: 'resource-sub-manage', params: { id: res.id } })
})
.catch((error: any) => {
window.$message.error(error.message)
})
}
return {

6
dolphinscheduler-ui-next/src/views/security/alarm-instance-manage/use-detail.ts

@ -45,7 +45,6 @@ export function useDetail(getFormValues: Function) {
const values = getFormValues()
if (status.saving) return false
status.saving = true
try {
if (currentRecord?.instanceName !== values.instanceName) {
await verifyAlertInstanceName({
alertInstanceName: values.instanceName
@ -69,11 +68,6 @@ export function useDetail(getFormValues: Function) {
status.saving = false
return true
} catch (e) {
window.$message.error((e as Error).message)
status.saving = false
return false
}
}
return { status, createOrUpdate }

10
dolphinscheduler-ui-next/src/views/security/alarm-instance-manage/use-form.ts

@ -72,33 +72,23 @@ export function useForm() {
const getUiPluginsByType = async () => {
if (state.pluginsLoading) return
state.pluginsLoading = true
try {
const plugins = await queryUiPluginsByType({ pluginType: 'ALERT' })
state.uiPlugins = plugins.map((plugin: IPlugin) => ({
label: plugin.pluginName,
value: plugin.id
}))
state.pluginsLoading = false
} catch (err) {
state.uiPlugins = []
state.pluginsLoading = false
}
}
const changePlugin = async (pluginId: IPluginId) => {
if (state.pluginsLoading) return
state.pluginsLoading = true
state.detailForm.pluginDefineId = pluginId
try {
const { pluginParams } = await queryUiPluginDetailById(pluginId)
if (pluginParams) {
state.json = JSON.parse(pluginParams)
}
state.pluginsLoading = false
} catch (e) {
window.$message.error((e as Error).message)
state.pluginsLoading = false
}
}
const initForm = () => {

11
dolphinscheduler-ui-next/src/views/security/alarm-instance-manage/use-table.ts

@ -38,7 +38,6 @@ export function useTable() {
if (data.loading) return
data.loading = true
try {
const { totalList, total } = await queryAlertPluginInstanceListPaging({
pageNo: data.page,
pageSize: data.pageSize,
@ -57,12 +56,6 @@ export function useTable() {
})
data.itemCount = total
} catch (e) {
if ((e as Error).message) window.$message.error((e as Error).message)
data.loading = false
data.list = []
data.itemCount = 0
}
}
const updateList = () => {
@ -73,12 +66,8 @@ export function useTable() {
}
const deleteRecord = async (id: number) => {
try {
const ignored = await deleteAlertPluginInstance(id)
updateList()
} catch (e) {
window.$message.error((e as Error).message)
}
}
const changePage = (page: number) => {

Loading…
Cancel
Save