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 _ from 'lodash'
import cookies from 'js-cookie' import cookies from 'js-cookie'
import router from '@/router' import router from '@/router'
import utils from '@/utils'
const userStore = useUserStore() 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 = { const baseRequestConfig: AxiosRequestConfig = {
baseURL: baseURL:
import.meta.env.MODE === 'development' import.meta.env.MODE === 'development'
@ -76,7 +90,8 @@ service.interceptors.response.use((res: AxiosResponse) => {
case 0: case 0:
return res.data.data return res.data.data
default: default:
throw new Error(`${res.data.msg}: ${res.config.url}`) handleError(res)
throw new Error()
} }
}, err) }, err)

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

@ -18,11 +18,13 @@
import mapping from './mapping' import mapping from './mapping'
import regex from './regex' import regex from './regex'
import truncateText from './truncate-text' import truncateText from './truncate-text'
import log from './log'
const utils = { const utils = {
mapping, mapping,
regex, regex,
truncateText truncateText,
log
} }
export default utils 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) => { const queryById = async (id: number) => {
if (status.loading) return {} if (status.loading) return {}
status.loading = true status.loading = true
try {
const dataSourceRes = await queryDataSource(id) const dataSourceRes = await queryDataSource(id)
status.loading = false status.loading = false
PREV_NAME = dataSourceRes.name PREV_NAME = dataSourceRes.name
return dataSourceRes return dataSourceRes
} catch (e) {
window.$message.error((e as Error).message)
status.loading = false
return {}
}
} }
const testConnect = async () => { const testConnect = async () => {
if (status.testing) return if (status.testing) return
status.testing = true status.testing = true
try {
const res = await connectDataSource(formatParams()) const res = await connectDataSource(formatParams())
window.$message.success( window.$message.success(
res res
@ -70,10 +63,6 @@ export function useDetail(getFieldsValue: Function) {
: `${t('datasource.test_connect')} ${t('datasource.success')}` : `${t('datasource.test_connect')} ${t('datasource.success')}`
) )
status.testing = false status.testing = false
} catch (e) {
window.$message.error((e as Error).message)
status.testing = false
}
} }
const createOrUpdate = async (id?: number) => { const createOrUpdate = async (id?: number) => {
@ -81,7 +70,6 @@ export function useDetail(getFieldsValue: Function) {
if (status.saving || !values.name) return false if (status.saving || !values.name) return false
status.saving = true status.saving = true
try {
if (PREV_NAME !== values.name) { if (PREV_NAME !== values.name) {
await verifyDataSourceName({ name: values.name }) await verifyDataSourceName({ name: values.name })
} }
@ -92,11 +80,6 @@ export function useDetail(getFieldsValue: Function) {
status.saving = false status.saving = false
return true return true
} catch (e) {
window.$message.error((e as Error).message)
status.saving = false
return false
}
} }
return { status, queryById, testConnect, createOrUpdate } 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' state.showConnectType = type === 'ORACLE'
if (type === 'HIVE' || type === 'SPARK') { if (type === 'HIVE' || type === 'SPARK') {
try {
state.showPrincipal = await getKerberosStartupState() state.showPrincipal = await getKerberosStartupState()
} catch (e) {
window.$message.error((e as Error).message)
}
} else { } else {
state.showPrincipal = false 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 if (data.loading) return
data.loading = true data.loading = true
try {
const listRes = await queryDataSourceListPaging({ const listRes = await queryDataSourceListPaging({
pageNo: data.page, pageNo: data.page,
pageSize: data.pageSize, pageSize: data.pageSize,
@ -44,11 +43,6 @@ export function useTable() {
data.loading = false data.loading = false
data.list = listRes.totalList data.list = listRes.totalList
data.itemCount = listRes.total data.itemCount = listRes.total
} catch (e) {
window.$message.error((e as Error).message)
data.loading = false
data.list = []
}
} }
const updateList = () => { const updateList = () => {
@ -59,12 +53,8 @@ export function useTable() {
} }
const deleteRecord = async (id: number) => { const deleteRecord = async (id: number) => {
try {
const ignored = await deleteDataSource(id) const ignored = await deleteDataSource(id)
updateList() updateList()
} catch (e) {
window.$message.error((e as Error).message)
}
} }
const changePage = (page: number) => { const changePage = (page: number) => {

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

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

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

@ -18,6 +18,7 @@
import { WritableComputedRef } from 'vue' import { WritableComputedRef } from 'vue'
import { useLocalesStore } from '@/store/locales/locales' import { useLocalesStore } from '@/store/locales/locales'
import type { Locales } from '@/store/locales/types' import type { Locales } from '@/store/locales/types'
import cookies from 'js-cookie'
export function useTranslate(locale: WritableComputedRef<string>) { export function useTranslate(locale: WritableComputedRef<string>) {
const localesStore = useLocalesStore() const localesStore = useLocalesStore()
@ -25,6 +26,7 @@ export function useTranslate(locale: WritableComputedRef<string>) {
const handleChange = (value: Locales) => { const handleChange = (value: Locales) => {
locale.value = value locale.value = value
localesStore.setLocales(value) localesStore.setLocales(value)
cookies.set('language', locale.value, { path: '/' })
} }
return { return {
handleChange 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 () => { const getProcessList = async () => {
if (loading.value) return if (loading.value) return
loading.value = true loading.value = true
try {
const res = await querySimpleList(projectCode) const res = await querySimpleList(projectCode)
options.value = res.map((option: { name: string; code: number }) => ({ options.value = res.map((option: { name: string; code: number }) => ({
label: option.name, label: option.name,
value: option.code value: option.code
})) }))
loading.value = false loading.value = false
} catch (err) {
loading.value = false
}
} }
const getProcessListByCode = async (processCode: number) => { const getProcessListByCode = async (processCode: number) => {
if (!processCode) return if (!processCode) return
try {
const res = await queryProcessDefinitionByCode(processCode, projectCode) const res = await queryProcessDefinitionByCode(processCode, projectCode)
getTaskOptions(res) getTaskOptions(res)
} catch (err) {}
} }
const getTaskOptions = (processDefinition: { const getTaskOptions = (processDefinition: {
processTaskRelationList: [] 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 () => { const getDatasourceTypes = async () => {
if (loading.value) return if (loading.value) return
loading.value = true loading.value = true
try {
options.value = datasourceTypes options.value = datasourceTypes
.filter((item) => { .filter((item) => {
if (item.disabled) { if (item.disabled) {
@ -99,9 +98,6 @@ export function useDatasourceType(
}) })
.map((item) => ({ label: item.code, value: item.code })) .map((item) => ({ label: item.code, value: item.code }))
loading.value = false loading.value = false
} catch (err) {
loading.value = false
}
} }
const onChange = (type: string) => { 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 () => { const getDatasources = async () => {
if (loading.value) return if (loading.value) return
loading.value = true loading.value = true
try {
await refreshOptions() await refreshOptions()
loading.value = false loading.value = false
} catch (err) {
loading.value = false
}
} }
const refreshOptions = async () => { 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 () => { const getDatasourceTypes = async () => {
if (loading.value) return if (loading.value) return
loading.value = true loading.value = true
try {
datasourceTypeOptions.value = datasourceTypes datasourceTypeOptions.value = datasourceTypes
.filter((item) => !item.disabled) .filter((item) => !item.disabled)
.map((item) => ({ label: item.code, value: item.code })) .map((item) => ({ label: item.code, value: item.code }))
loading.value = false loading.value = false
} catch (err) {
loading.value = false
}
} }
const getDatasourceInstances = async () => { 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 () => { const getProjectList = async () => {
try {
const result = await queryProjectCreatedAndAuthorizedByUser() const result = await queryProjectCreatedAndAuthorizedByUser()
projectList.value = result.map( projectList.value = result.map(
(item: { code: number; name: string }) => ({ (item: { code: number; name: string }) => ({
@ -166,13 +165,11 @@ export function useDependent(model: { [field: string]: any }): IJsonItem[] {
}) })
) )
return projectList return projectList
} catch (err) {}
} }
const getProcessList = async (code: number) => { const getProcessList = async (code: number) => {
if (processCache[code]) { if (processCache[code]) {
return processCache[code] return processCache[code]
} }
try {
const result = await queryAllByProjectCode(code) const result = await queryAllByProjectCode(code)
const processList = result.map( const processList = result.map(
(item: { processDefinition: { code: number; name: string } }) => ({ (item: { processDefinition: { code: number; name: string } }) => ({
@ -183,14 +180,12 @@ export function useDependent(model: { [field: string]: any }): IJsonItem[] {
processCache[code] = processList processCache[code] = processList
return processList return processList
} catch (err) {}
} }
const getTaskList = async (code: number, processCode: number) => { const getTaskList = async (code: number, processCode: number) => {
if (taskCache[processCode]) { if (taskCache[processCode]) {
return taskCache[processCode] return taskCache[processCode]
} }
try {
const result = await getTasksByDefinitionCode(code, processCode) const result = await getTasksByDefinitionCode(code, processCode)
const taskList = result.map((item: { code: number; name: string }) => ({ const taskList = result.map((item: { code: number; name: string }) => ({
value: item.code, value: item.code,
@ -202,7 +197,6 @@ export function useDependent(model: { [field: string]: any }): IJsonItem[] {
}) })
taskCache[processCode] = taskList taskCache[processCode] = taskList
return taskList return taskList
} catch (err) {}
} }
onMounted(() => { 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 () => { const getEnvironmentList = async () => {
if (loading.value) return if (loading.value) return
loading.value = true loading.value = true
try {
const res = await queryAllEnvironmentList() const res = await queryAllEnvironmentList()
environmentList = res.map( environmentList = res.map(
(item: { code: string; name: string; workerGroups: string[] }) => ({ (item: { code: string; name: string; workerGroups: string[] }) => ({
@ -47,9 +46,6 @@ export function useEnvironmentName(
filterByWorkerGroup(option) filterByWorkerGroup(option)
) )
loading.value = false loading.value = false
} catch (err) {
loading.value = false
}
} }
const filterByWorkerGroup = (option: IEnvironmentNameOption) => { 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] mainJarOptions.value = resources[programType]
return return
} }
try {
const res = await queryResourceByProgramType({ const res = await queryResourceByProgramType({
type: 'FILE', type: 'FILE',
programType programType
@ -52,7 +51,6 @@ export function useFlink(model: { [field: string]: any }): IJsonItem[] {
removeUselessChildren(res) removeUselessChildren(res)
mainJarOptions.value = res || [] mainJarOptions.value = res || []
resources[programType] = res resources[programType] = res
} catch (err) {}
} }
onMounted(() => { 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] mainJarOptions.value = resources[programType]
return return
} }
try {
const res = await queryResourceByProgramType({ const res = await queryResourceByProgramType({
type: 'FILE', type: 'FILE',
programType programType
@ -45,7 +44,6 @@ export function useMr(model: { [field: string]: any }): IJsonItem[] {
removeUselessChildren(res) removeUselessChildren(res)
mainJarOptions.value = res || [] mainJarOptions.value = res || []
resources[programType] = res resources[programType] = res
} catch (err) {}
} }
onMounted(() => { 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 () => { const getProcessList = async () => {
if (loading.value) return if (loading.value) return
loading.value = true loading.value = true
try {
const res = await querySimpleList(projectCode) const res = await querySimpleList(projectCode)
options.value = res.map((option: { name: string; code: number }) => ({ options.value = res.map((option: { name: string; code: number }) => ({
label: option.name, label: option.name,
value: option.code value: option.code
})) }))
loading.value = false loading.value = false
} catch (err) {
loading.value = false
}
} }
const getProcessListByCode = async (processCode: number) => { const getProcessListByCode = async (processCode: number) => {
if (!processCode) return if (!processCode) return
try {
const res = await queryProcessDefinitionByCode(processCode, projectCode) const res = await queryProcessDefinitionByCode(processCode, projectCode)
getTaskOptions(res) getTaskOptions(res)
} catch (err) {}
} }
const getTaskOptions = (processDefinition: { const getTaskOptions = (processDefinition: {
processTaskRelationList: [] 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 () => { const getRuleList = async () => {
if (ruleLoading.value) return if (ruleLoading.value) return
ruleLoading.value = true ruleLoading.value = true
try {
const result = await queryRuleList() const result = await queryRuleList()
rules.value = result.map((item: { id: number; name: string }) => { rules.value = result.map((item: { id: number; name: string }) => {
let name = '' let name = ''
@ -60,15 +59,11 @@ export function useRules(
} }
}) })
ruleLoading.value = false ruleLoading.value = false
} catch (err) {
ruleLoading.value = false
}
} }
const getRuleById = async (ruleId: number) => { const getRuleById = async (ruleId: number) => {
if (ruleLoading.value) return if (ruleLoading.value) return
ruleLoading.value = true ruleLoading.value = true
try {
const result = await getRuleFormCreateJson(ruleId) const result = await getRuleFormCreateJson(ruleId)
const items = JSON.parse(result).map((item: IResponseJsonItem) => const items = JSON.parse(result).map((item: IResponseJsonItem) =>
formatResponseJson(item) formatResponseJson(item)
@ -76,9 +71,6 @@ export function useRules(
updateRules(items, preItemLen) updateRules(items, preItemLen)
preItemLen = items.length preItemLen = items.length
ruleLoading.value = false ruleLoading.value = false
} catch (err) {
ruleLoading.value = false
}
} }
const formatResponseJson = ( const formatResponseJson = (
@ -138,7 +130,6 @@ export function useRules(
} }
const onFieldChange = async (value: string | number, field: string) => { const onFieldChange = async (value: string | number, field: string) => {
try {
if (field === 'src_connector_type' && typeof value === 'number') { if (field === 'src_connector_type' && typeof value === 'number') {
const result = await getDatasourceOptionsById(value) const result = await getDatasourceOptionsById(value)
srcDatasourceOptions.value = result || [] srcDatasourceOptions.value = result || []
@ -191,7 +182,6 @@ export function useRules(
targetTableColumnOptions.value = result || [] targetTableColumnOptions.value = result || []
model.target_field = null model.target_field = null
} }
} catch (err) {}
} }
onMounted(async () => { 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 () => { const getResourceList = async () => {
if (loading.value) return if (loading.value) return
loading.value = true loading.value = true
try {
model.resourceFiles = [] model.resourceFiles = []
const res = await queryResourceList({ type: 'FILE' }) const res = await queryResourceList({ type: 'FILE' })
removeUselessChildren(res) removeUselessChildren(res)
options.value = res || [] options.value = res || []
loading.value = false loading.value = false
} catch (err) {
loading.value = false
}
} }
function removeUselessChildren( 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 () => { const getResourceList = async () => {
if (loading.value) return if (loading.value) return
loading.value = true loading.value = true
try {
const res = await queryResourceList({ type: 'FILE' }) const res = await queryResourceList({ type: 'FILE' })
removeUselessChildren(res) removeUselessChildren(res)
options.value = res || [] options.value = res || []
loading.value = false loading.value = false
} catch (err) {
loading.value = false
}
} }
onMounted(() => { 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] mainJarOptions.value = resources[programType]
return return
} }
try {
const res = await queryResourceByProgramType({ const res = await queryResourceByProgramType({
type: 'FILE', type: 'FILE',
programType programType
@ -52,7 +51,6 @@ export function useSpark(model: { [field: string]: any }): IJsonItem[] {
removeUselessChildren(res) removeUselessChildren(res)
mainJarOptions.value = res || [] mainJarOptions.value = res || []
resources[programType] = res resources[programType] = res
} catch (err) {}
} }
onMounted(() => { 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 () => { const getSqlTypes = async () => {
if (loading.value) return if (loading.value) return
loading.value = true loading.value = true
try {
options.value = sqlTypes.map((item) => ({ options.value = sqlTypes.map((item) => ({
label: item.code, label: item.code,
value: item.id value: item.id
})) }))
loading.value = false loading.value = false
} catch (err) {
loading.value = false
}
} }
onMounted(() => { 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 () => { const getResourceList = async () => {
if (loading.value) return if (loading.value) return
loading.value = true loading.value = true
try {
const res = await queryResourceList({ type: 'FILE' }) const res = await queryResourceList({ type: 'FILE' })
removeUselessChildren(res) removeUselessChildren(res)
options.value = res || [] options.value = res || []
loading.value = false loading.value = false
} catch (err) {
loading.value = false
}
} }
onMounted(() => { 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) => { const getDataSource = async (type: IDataBase) => {
if (loading.value) return if (loading.value) return
loading.value = true loading.value = true
try {
const result = await queryDataSourceList({ type }) const result = await queryDataSourceList({ type })
dataSourceList.value = result.map( dataSourceList.value = result.map(
(item: { name: string; id: number }) => ({ (item: { name: string; id: number }) => ({
@ -42,9 +41,6 @@ export function useDatasource(
}) })
) )
loading.value = false loading.value = false
} catch (err) {
loading.value = false
}
} }
onMounted(() => { onMounted(() => {
getDataSource('MYSQL') 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 if (loading.value) return
loading.value = true loading.value = true
branchFlowOptions.value = [] branchFlowOptions.value = []
try {
const res = await queryProcessDefinitionByCode( const res = await queryProcessDefinitionByCode(
model.processName, model.processName,
projectCode projectCode
@ -43,9 +42,6 @@ export function useSwitch(
} }
}) })
loading.value = false loading.value = false
} catch (err) {
loading.value = false
}
} }
watch( 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 () => { const getTaskGroupList = async () => {
if (loading.value) return if (loading.value) return
loading.value = true loading.value = true
try {
const { totalList = [] } = await queryTaskGroupListPagingByProjectCode({ const { totalList = [] } = await queryTaskGroupListPagingByProjectCode({
pageNo: 1, pageNo: 1,
pageSize: 2147483647, pageSize: 2147483647,
@ -44,9 +43,6 @@ export function useTaskGroup(
value: item.id value: item.id
})) }))
loading.value = false loading.value = false
} catch (err) {
loading.value = false
}
} }
onMounted(() => { 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 () => { const getWorkerGroups = async () => {
if (loading.value) return if (loading.value) return
loading.value = true loading.value = true
try {
const res = await queryAllWorkerGroups() const res = await queryAllWorkerGroups()
options.value = res.map((item: string) => ({ label: item, value: item })) options.value = res.map((item: string) => ({ label: item, value: item }))
loading.value = false loading.value = false
} catch (err) {
loading.value = false
}
} }
onMounted(() => { 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 task.taskShow = show
} }
const onTaskSave = async (data: INodeData) => { const onTaskSave = async (data: INodeData) => {
try {
if (task.taskSaving) return if (task.taskSaving) return
task.taskSaving = true task.taskSaving = true
if (data.id) { if (data.id) {
@ -80,22 +79,13 @@ export function useTask(projectCode: number) {
task.taskSaving = false task.taskSaving = false
return true return true
} catch (e) {
window.$message.error((e as Error).message)
task.taskSaving = false
return false
}
} }
const onEditTask = async (row: IRecord, readonly: boolean) => { const onEditTask = async (row: IRecord, readonly: boolean) => {
try {
const result = await queryTaskDefinitionByCode(row.taskCode, projectCode) const result = await queryTaskDefinitionByCode(row.taskCode, projectCode)
task.taskData = { ...result, processName: row.processDefinitionCode } task.taskData = { ...result, processName: row.processDefinitionCode }
task.taskShow = true task.taskShow = true
task.taskReadonly = readonly task.taskReadonly = readonly
} catch (e) {
window.$message.error((e as Error).message)
}
} }
const onInitTask = () => { 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) verifyName(params, projectCode)
.then(() => context.emit('save', formValue.value)) .then(() => context.emit('save', formValue.value))
.catch((error: any) => {
window.$message.error(error.message)
})
} else { } else {
context.emit('save', formValue.value) 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) { function parseLocationStr(locationStr: string) {
let locations = null let locations = null
if (!locationStr) return locations if (!locationStr) return locations
try {
locations = JSON.parse(locationStr) locations = JSON.parse(locationStr)
} catch (error) {}
return Array.isArray(locations) ? locations : null 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 = () => { const handleImportDefinition = () => {
state.importFormRef.validate(async (valid: any) => { state.importFormRef.validate(async (valid: any) => {
if (!valid) { if (!valid) {
try {
const formData = new FormData() const formData = new FormData()
formData.append('file', state.importForm.file) formData.append('file', state.importForm.file)
const code = Number(router.currentRoute.value.params.projectCode) const code = Number(router.currentRoute.value.params.projectCode)
@ -70,9 +69,6 @@ export function useModal(
ctx.emit('updateList') ctx.emit('updateList')
ctx.emit('update:show') ctx.emit('update:show')
resetImportForm() resetImportForm()
} catch (error: any) {
window.$message.error(error.message)
}
} }
}) })
} }
@ -103,14 +99,10 @@ export function useModal(
? JSON.stringify(startParams) ? JSON.stringify(startParams)
: '' : ''
try {
await startProcessInstance(state.startForm, variables.projectCode) await startProcessInstance(state.startForm, variables.projectCode)
window.$message.success(t('project.workflow.success')) window.$message.success(t('project.workflow.success'))
ctx.emit('updateList') ctx.emit('updateList')
ctx.emit('update:show') ctx.emit('update:show')
} catch (error: any) {
window.$message.error(error.message)
}
} }
}) })
} }
@ -121,14 +113,10 @@ export function useModal(
const data: any = getTimingData() const data: any = getTimingData()
data.processDefinitionCode = code data.processDefinitionCode = code
try {
await createSchedule(data, variables.projectCode) await createSchedule(data, variables.projectCode)
window.$message.success(t('project.workflow.success')) window.$message.success(t('project.workflow.success'))
ctx.emit('updateList') ctx.emit('updateList')
ctx.emit('update:show') ctx.emit('update:show')
} catch (error: any) {
window.$message.error(error.message)
}
} }
}) })
} }
@ -139,14 +127,10 @@ export function useModal(
const data: any = getTimingData() const data: any = getTimingData()
data.id = id data.id = id
try {
await updateSchedule(data, variables.projectCode, id) await updateSchedule(data, variables.projectCode, id)
window.$message.success(t('project.workflow.success')) window.$message.success(t('project.workflow.success'))
ctx.emit('updateList') ctx.emit('updateList')
ctx.emit('update:show') ctx.emit('update:show')
} catch (error: any) {
window.$message.error(error.message)
}
} }
}) })
} }
@ -214,9 +198,6 @@ export function useModal(
.then((res: any) => { .then((res: any) => {
variables.startParamsList = res.processDefinition.globalParamList variables.startParamsList = res.processDefinition.globalParamList
}) })
.catch((error: any) => {
window.$message.error(error.message)
})
} }
const getPreviewSchedule = () => { const getPreviewSchedule = () => {
@ -242,9 +223,6 @@ export function useModal(
.then((res: any) => { .then((res: any) => {
variables.schedulePreviewList = res 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') ctx.emit('updateList')
getTableData(variables.row) getTableData(variables.row)
}) })
.catch((error: any) => {
window.$message.error(error.message)
})
} }
const handleDeleteVersion = (version: number) => { const handleDeleteVersion = (version: number) => {
@ -190,9 +187,6 @@ export function useTable(
ctx.emit('updateList') ctx.emit('updateList')
getTableData(variables.row) getTableData(variables.row)
}) })
.catch((error: any) => {
window.$message.error(error.message)
})
} }
return { 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')) message.success(t('project.dag.success'))
router.push({ path: `/projects/${projectCode}/workflow-definition` }) router.push({ path: `/projects/${projectCode}/workflow-definition` })
}) })
.catch((error: any) => {
window.$message.error(error.message)
})
} }
return () => ( 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')) message.success(t('project.dag.success'))
router.push({ path: `/projects/${projectCode}/workflow-definition` }) router.push({ path: `/projects/${projectCode}/workflow-definition` })
}) })
.catch((error: any) => {
window.$message.error(error.message)
})
} }
onMounted(() => { onMounted(() => {

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

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

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

@ -200,9 +200,6 @@ export function useTable() {
searchVal: variables.searchVal searchVal: variables.searchVal
}) })
}) })
.catch((error: any) => {
window.$message.error(error.message)
})
} }
const releaseWorkflow = (row: any) => { const releaseWorkflow = (row: any) => {
@ -221,9 +218,6 @@ export function useTable() {
searchVal: variables.searchVal searchVal: variables.searchVal
}) })
}) })
.catch((error: any) => {
window.$message.error(error.message)
})
} }
const copyWorkflow = (row: any) => { const copyWorkflow = (row: any) => {
@ -240,9 +234,6 @@ export function useTable() {
searchVal: variables.searchVal searchVal: variables.searchVal
}) })
}) })
.catch((error: any) => {
window.$message.error(error.message)
})
} }
const downloadBlob = (data: any, fileNameS = 'json') => { const downloadBlob = (data: any, fileNameS = 'json') => {
@ -280,9 +271,6 @@ export function useTable() {
.then((res: any) => { .then((res: any) => {
downloadBlob(res, fileName) downloadBlob(res, fileName)
}) })
.catch((error: any) => {
window.$message.error(error.message)
})
} }
const gotoTimingManage = (row: any) => { 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) }, 1500)
textareaLog.value.innerHTML = res || t('project.workflow.no_log') textareaLog.value.innerHTML = res || t('project.workflow.no_log')
}) })
.catch((error: any) => {
window.$message.error(error.message || '')
loadingRef.value = false
})
} }
const showLog = () => { const showLog = () => {
@ -126,9 +122,6 @@ export default defineComponent({
}, 800) }, 800)
} }
}) })
.catch((error: any) => {
window.$message.error(error.message || '')
})
} }
const initLog = () => { const initLog = () => {
@ -259,7 +252,7 @@ export default defineComponent({
render() { render() {
return ( return (
<div> <div>
<span class={styles['log-model']}> <span>
{this.taskInstanceId && this.taskInstanceType !== 'SUB_PROCESS' && ( {this.taskInstanceId && this.taskInstanceType !== 'SUB_PROCESS' && (
<span> <span>
{renderSlot(this.$slots, 'history')} {renderSlot(this.$slots, 'history')}
@ -349,7 +342,6 @@ export default defineComponent({
<div class={styles['content']} ref='logContent'> <div class={styles['content']} ref='logContent'>
<div class={styles['content-log-box']} ref='logContentBox'> <div class={styles['content-log-box']} ref='logContentBox'>
<textarea <textarea
class={styles['textarea-ft']}
style={`width: 100%; height: ${this.textareaHeight}px`} style={`width: 100%; height: ${this.textareaHeight}px`}
spellcheck='false' spellcheck='false'
ref='textareaLog' ref='textareaLog'

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

@ -285,10 +285,6 @@ export function useTable() {
getTableData() getTableData()
}) })
.catch((error: any) => {
window.$message.error(error.message || '')
getTableData()
})
} }
const batchDeleteInstance = () => { const batchDeleteInstance = () => {
@ -310,10 +306,6 @@ export function useTable() {
variables.checkedRowKeys = [] variables.checkedRowKeys = []
getTableData() getTableData()
}) })
.catch((error: any) => {
window.$message.error(error.message || '')
getTableData()
})
} }
/** /**
@ -326,10 +318,6 @@ export function useTable() {
getTableData() getTableData()
}) })
.catch((error: any) => {
window.$message.error(error.message || '')
getTableData()
})
} }
/** /**
@ -368,10 +356,6 @@ export function useTable() {
getTableData() getTableData()
}, index) }, index)
}) })
.catch((error: any) => {
window.$message.error(error.message)
getTableData()
})
} }
return { 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 || '/' const currentDir = fileStore.getCurrentDir || '/'
state.fileFormRef.validate(async (valid: any) => { state.fileFormRef.validate(async (valid: any) => {
if (!valid) { if (!valid) {
try {
await onlineCreateResource({ await onlineCreateResource({
...state.fileForm, ...state.fileForm,
...{ pid, currentDir } ...{ pid, currentDir }
@ -40,9 +39,6 @@ export function useCreate(state: any) {
window.$message.success(t('resource.file.success')) window.$message.success(t('resource.file.success'))
const name = pid ? 'resource-file-subdirectory' : 'file' const name = pid ? 'resource-file-subdirectory' : 'file'
router.push({ name, params: { id: pid } }) 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) => { const handleUpdateContent = (id: number) => {
state.fileFormRef.validate(async (valid: any) => { state.fileFormRef.validate(async (valid: any) => {
if (!valid) { if (!valid) {
try {
await updateResourceContent( await updateResourceContent(
{ {
...state.fileForm ...state.fileForm
@ -53,9 +52,6 @@ export function useEdit(state: any) {
window.$message.success(t('resource.file.success')) window.$message.success(t('resource.file.success'))
router.go(-1) 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 || '/' const currentDir = fileStore.getCurrentDir || '/'
state.folderFormRef.validate(async (valid: any) => { state.folderFormRef.validate(async (valid: any) => {
if (!valid) { if (!valid) {
try {
await createDirectory({ await createDirectory({
...state.folderForm, ...state.folderForm,
...{ pid, currentDir } ...{ pid, currentDir }
@ -44,9 +43,6 @@ export function useFolder(state: any) {
window.$message.success(t('resource.file.success')) window.$message.success(t('resource.file.success'))
emit('updateList') emit('updateList')
} catch (error: any) {
window.$message.error(error.message)
}
hideModal() hideModal()
resetForm() 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) => { state.renameFormRef.validate(async (valid: any) => {
if (!valid) { if (!valid) {
try {
await updateResource( await updateResource(
{ {
...state.renameForm ...state.renameForm
@ -38,9 +37,6 @@ export function useRename(state: any) {
) )
window.$message.success(t('resource.file.success')) window.$message.success(t('resource.file.success'))
emit('updateList') emit('updateList')
} catch (error: any) {
window.$message.error(error.message)
}
} }
hideModal() 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('currentDir', currentDir)
formData.append('description', state.uploadForm.description) formData.append('description', state.uploadForm.description)
try {
await createResource(formData as any) await createResource(formData as any)
window.$message.success(t('resource.file.success')) window.$message.success(t('resource.file.success'))
emit('updateList') emit('updateList')
} catch (error: any) {
window.$message.error(error.message)
}
hideModal() hideModal()
resetForm() 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) => { const submitRequest = (serviceHandle: any) => {
state.functionFormRef.validate(async (valid: any) => { state.functionFormRef.validate(async (valid: any) => {
if (!valid) { if (!valid) {
try {
await serviceHandle() await serviceHandle()
window.$message.success(t('resource.udf.success')) window.$message.success(t('resource.udf.success'))
ctx.emit('updateList') ctx.emit('updateList')
ctx.emit('update:show') 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('currentDir', uploadState.uploadForm.currentDir)
formData.append('description', uploadState.uploadForm.description) formData.append('description', uploadState.uploadForm.description)
try {
const res = await createResource(formData as any) const res = await createResource(formData as any)
window.$message.success(t('resource.function.success')) window.$message.success(t('resource.function.success'))
variables.uploadShow = false variables.uploadShow = false
resetUploadForm() resetUploadForm()
getUdfList() getUdfList()
state.functionForm.resourceId = res.id 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) => { const submitRequest = (serviceHandle: any) => {
state.folderFormRef.validate(async (valid: any) => { state.folderFormRef.validate(async (valid: any) => {
if (!valid) { if (!valid) {
try {
await serviceHandle() await serviceHandle()
window.$message.success(t('resource.udf.success')) window.$message.success(t('resource.udf.success'))
ctx.emit('updateList') ctx.emit('updateList')
ctx.emit('update:show') 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('currentDir', currentDir)
formData.append('description', state.uploadForm.description) formData.append('description', state.uploadForm.description)
try {
await createResource(formData as any) await createResource(formData as any)
window.$message.success(t('resource.udf.success')) window.$message.success(t('resource.udf.success'))
ctx.emit('updateList') ctx.emit('updateList')
ctx.emit('update:show') ctx.emit('update:show')
resetUploadForm() 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) fileStore.setCurrentDir(res.fullName)
router.push({ name: 'resource-sub-manage', params: { id: res.id } }) router.push({ name: 'resource-sub-manage', params: { id: res.id } })
}) })
.catch((error: any) => {
window.$message.error(error.message)
})
} }
return { 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() const values = getFormValues()
if (status.saving) return false if (status.saving) return false
status.saving = true status.saving = true
try {
if (currentRecord?.instanceName !== values.instanceName) { if (currentRecord?.instanceName !== values.instanceName) {
await verifyAlertInstanceName({ await verifyAlertInstanceName({
alertInstanceName: values.instanceName alertInstanceName: values.instanceName
@ -69,11 +68,6 @@ export function useDetail(getFormValues: Function) {
status.saving = false status.saving = false
return true return true
} catch (e) {
window.$message.error((e as Error).message)
status.saving = false
return false
}
} }
return { status, createOrUpdate } 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 () => { const getUiPluginsByType = async () => {
if (state.pluginsLoading) return if (state.pluginsLoading) return
state.pluginsLoading = true state.pluginsLoading = true
try {
const plugins = await queryUiPluginsByType({ pluginType: 'ALERT' }) const plugins = await queryUiPluginsByType({ pluginType: 'ALERT' })
state.uiPlugins = plugins.map((plugin: IPlugin) => ({ state.uiPlugins = plugins.map((plugin: IPlugin) => ({
label: plugin.pluginName, label: plugin.pluginName,
value: plugin.id value: plugin.id
})) }))
state.pluginsLoading = false state.pluginsLoading = false
} catch (err) {
state.uiPlugins = []
state.pluginsLoading = false
}
} }
const changePlugin = async (pluginId: IPluginId) => { const changePlugin = async (pluginId: IPluginId) => {
if (state.pluginsLoading) return if (state.pluginsLoading) return
state.pluginsLoading = true state.pluginsLoading = true
state.detailForm.pluginDefineId = pluginId state.detailForm.pluginDefineId = pluginId
try {
const { pluginParams } = await queryUiPluginDetailById(pluginId) const { pluginParams } = await queryUiPluginDetailById(pluginId)
if (pluginParams) { if (pluginParams) {
state.json = JSON.parse(pluginParams) state.json = JSON.parse(pluginParams)
} }
state.pluginsLoading = false state.pluginsLoading = false
} catch (e) {
window.$message.error((e as Error).message)
state.pluginsLoading = false
}
} }
const initForm = () => { 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 if (data.loading) return
data.loading = true data.loading = true
try {
const { totalList, total } = await queryAlertPluginInstanceListPaging({ const { totalList, total } = await queryAlertPluginInstanceListPaging({
pageNo: data.page, pageNo: data.page,
pageSize: data.pageSize, pageSize: data.pageSize,
@ -57,12 +56,6 @@ export function useTable() {
}) })
data.itemCount = total 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 = () => { const updateList = () => {
@ -73,12 +66,8 @@ export function useTable() {
} }
const deleteRecord = async (id: number) => { const deleteRecord = async (id: number) => {
try {
const ignored = await deleteAlertPluginInstance(id) const ignored = await deleteAlertPluginInstance(id)
updateList() updateList()
} catch (e) {
window.$message.error((e as Error).message)
}
} }
const changePage = (page: number) => { const changePage = (page: number) => {

Loading…
Cancel
Save