Browse Source

[Fix][UI Next][V1.0.0-Beta] Fix the color matching problem of the relationship diagram. (#9546)

3.0.0/version-upgrade
songjianet 2 years ago committed by GitHub
parent
commit
e190ef9d0d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 47
      dolphinscheduler-ui-next/src/views/projects/workflow/relation/components/Graph.tsx
  2. 156
      dolphinscheduler-ui-next/src/views/security/alarm-instance-manage/detail.tsx

47
dolphinscheduler-ui-next/src/views/projects/workflow/relation/components/Graph.tsx

@ -47,9 +47,9 @@ const GraphChart = defineComponent({
const { t } = useI18n()
const legendData = [
{ name: t('project.workflow.online') },
{ name: t('project.workflow.workflow_offline') },
{ name: t('project.workflow.schedule_offline') }
{ color: '#2D8DF0', name: t('project.workflow.online') },
{ color: '#f37373', name: t('project.workflow.workflow_offline') },
{ color: '#ba3e3e', name: t('project.workflow.schedule_offline') }
]
const getCategory = (schedulerStatus: number, workflowStatus: number) => {
@ -100,11 +100,16 @@ const GraphChart = defineComponent({
`
}
},
legend: [
{
data: legendData?.map((item) => item.name)
}
],
legend: {
data: legendData?.map((item) => {
return {
name: item.name,
itemStyle: {
color: item.color
}
}
})
},
series: [
{
type: 'graph',
@ -132,13 +137,26 @@ const GraphChart = defineComponent({
}
},
data: props.seriesData.map((item) => {
const category = getCategory(
Number(item.schedulePublishStatus),
Number(item.workFlowPublishStatus)
)
const itemStyle = {
color: ''
}
if (category === 1) {
itemStyle.color = '#f37373'
} else if (category === 2) {
itemStyle.color = '#ba3e3e'
} else if (category === 0) {
itemStyle.color = '#2D8DF0'
}
return {
name: item.name,
id: item.id,
category: getCategory(
Number(item.schedulePublishStatus),
Number(item.workFlowPublishStatus)
),
category,
workFlowPublishStatus:
Number(item.workFlowPublishStatus) === 0
? t('project.workflow.offline')
@ -151,7 +169,10 @@ const GraphChart = defineComponent({
scheduleStartTime: item.scheduleStartTime
? item.scheduleStartTime
: '-',
scheduleEndTime: item.scheduleEndTime ? item.scheduleEndTime : '-'
scheduleEndTime: item.scheduleEndTime
? item.scheduleEndTime
: '-',
itemStyle
}
}),
categories: legendData

156
dolphinscheduler-ui-next/src/views/security/alarm-instance-manage/detail.tsx

@ -81,26 +81,26 @@ const DetailModal = defineComponent({
const onChangePlugin = changePlugin
watch(
() => props.show,
async () => {
props.show && props.currentRecord && setDetail(props.currentRecord)
}
() => props.show,
async () => {
props.show && props.currentRecord && setDetail(props.currentRecord)
}
)
watch(
() => state.json,
() => {
if (!state.json?.length) return
state.json.forEach((item) => {
const mergedItem = isFunction(item) ? item() : item
mergedItem.name = t(
'security.alarm_instance' + '.' + mergedItem.field
)
})
const { rules: fieldsRules, elements: fieldsElements } =
getElementByJson(state.json, state.detailForm)
rules.value = fieldsRules
elements.value = fieldsElements
}
() => state.json,
() => {
if (!state.json?.length) return
state.json.forEach((item) => {
const mergedItem = isFunction(item) ? item() : item
mergedItem.name = t(
'security.alarm_instance' + '.' + mergedItem.field
)
})
const { rules: fieldsRules, elements: fieldsElements } =
getElementByJson(state.json, state.detailForm)
rules.value = fieldsRules
elements.value = fieldsElements
}
)
onMounted(() => {
@ -137,66 +137,66 @@ const DetailModal = defineComponent({
} = this
const { currentRecord } = props
return (
<Modal
show={show}
title={t(
currentRecord?.id
? 'security.alarm_instance.edit_alarm_instance'
: 'security.alarm_instance.create_alarm_instance'
)}
onConfirm={onSubmit}
confirmLoading={saving || loading}
onCancel={onCancel}
>
{{
default: () => (
<Form
ref='detailFormRef'
loading={loading || pluginsLoading}
meta={{
...meta,
rules: {
...meta.rules,
...rules
},
elements: [
{
path: 'instanceName',
label: t('security.alarm_instance.alarm_instance_name'),
widget: (
<NInput
v-model={[detailForm.instanceName, 'value']}
placeholder={t(
'security.alarm_instance.alarm_instance_name_tips'
)}
/>
)
},
{
path: 'pluginDefineId',
label: t('security.alarm_instance.select_plugin'),
widget: (
<NSelect
v-model={[detailForm.pluginDefineId, 'value']}
options={uiPlugins}
disabled={!!currentRecord?.id}
placeholder={t(
'security.alarm_instance.select_plugin_tips'
)}
on-update:value={onChangePlugin}
/>
)
},
...elements
]
}}
layout={{
cols: 24
}}
/>
)
}}
</Modal>
<Modal
show={show}
title={t(
currentRecord?.id
? 'security.alarm_instance.edit_alarm_instance'
: 'security.alarm_instance.create_alarm_instance'
)}
onConfirm={onSubmit}
confirmLoading={saving || loading}
onCancel={onCancel}
>
{{
default: () => (
<Form
ref='detailFormRef'
loading={loading || pluginsLoading}
meta={{
...meta,
rules: {
...meta.rules,
...rules
},
elements: [
{
path: 'instanceName',
label: t('security.alarm_instance.alarm_instance_name'),
widget: (
<NInput
v-model={[detailForm.instanceName, 'value']}
placeholder={t(
'security.alarm_instance.alarm_instance_name_tips'
)}
/>
)
},
{
path: 'pluginDefineId',
label: t('security.alarm_instance.select_plugin'),
widget: (
<NSelect
v-model={[detailForm.pluginDefineId, 'value']}
options={uiPlugins}
disabled={!!currentRecord?.id}
placeholder={t(
'security.alarm_instance.select_plugin_tips'
)}
on-update:value={onChangePlugin}
/>
)
},
...elements
]
}}
layout={{
cols: 24
}}
/>
)
}}
</Modal>
)
}
})

Loading…
Cancel
Save