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

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

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

Loading…
Cancel
Save