Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Improvement-11386][UI] Concise the logic available for task action buttons #11419

Merged
merged 1 commit into from
Aug 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,11 @@ import { IWorkflowTaskInstance } from './types'
import { NButton } from 'naive-ui'

const props = {
startButtonDisplay: {
type: Boolean as PropType<boolean>,
default: true
},
startReadonly: {
startDisplay: {
type: Boolean as PropType<boolean>,
default: false
},
menuReadonly: {
menuDisplay: {
type: Boolean as PropType<boolean>,
default: false
},
Expand Down Expand Up @@ -131,36 +127,36 @@ export default defineComponent({
class={styles['dag-context-menu']}
style={{ left: `${this.left}px`, top: `${this.top}px` }}
>
{this.startButtonDisplay && (
{this.startDisplay && (
<NButton
class={`${styles['menu-item']}`}
disabled={this.startReadonly}
onClick={this.startRunning}
>
{t('project.node.start')}
</NButton>)
}
<NButton
class={`${styles['menu-item']}`}
disabled={this.menuReadonly}
onClick={this.handleEdit}
>
{t('project.node.edit')}
</NButton>
<NButton
class={`${styles['menu-item']}`}
disabled={this.menuReadonly}
onClick={this.handleCopy}
>
{t('project.node.copy')}
</NButton>
<NButton
class={`${styles['menu-item']}`}
disabled={this.menuReadonly}
onClick={this.handleDelete}
>
{t('project.node.delete')}
</NButton>
{this.menuDisplay && (
<>
<NButton
class={`${styles['menu-item']}`}
onClick={this.handleEdit}
>
{t('project.node.edit')}
</NButton>
<NButton
class={`${styles['menu-item']}`}
onClick={this.handleCopy}
>
{t('project.node.copy')}
</NButton>
<NButton
class={`${styles['menu-item']}`}
onClick={this.handleDelete}
>
{t('project.node.delete')}
</NButton>
</>
)}
sketchmind marked this conversation as resolved.
Show resolved Hide resolved
{this.taskInstance && (
<NButton
class={`${styles['menu-item']}`}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,29 +119,29 @@ export default defineComponent({
})

// start button in the dag node menu
const startReadonly = computed(() => {
const startDisplay = computed(() => {
if (props.definition) {
return (
route.name === 'workflow-definition-detail' &&
props.definition!.processDefinition.releaseState === 'NOT_RELEASE'
props.definition!.processDefinition.releaseState === 'ONLINE'
)
} else {
return false
}
})

// other button in the dag node menu
const menuReadonly = computed(() => {
const menuDisplay = computed(() => {
if (props.instance) {
return (
props.instance.state !== 'WAITING_THREAD' &&
props.instance.state !== 'SUCCESS' &&
props.instance.state !== 'PAUSE' &&
props.instance.state !== 'FAILURE' &&
props.instance.state !== 'STOP'
props.instance.state === 'WAITING_THREAD' ||
props.instance.state === 'SUCCESS' ||
props.instance.state === 'PAUSE' ||
props.instance.state === 'FAILURE' ||
props.instance.state === 'STOP'
)
} else if (props.definition) {
return props.definition!.processDefinition.releaseState === 'ONLINE'
return props.definition!.processDefinition.releaseState === 'OFFLINE'
} else {
return false
}
Expand Down Expand Up @@ -337,7 +337,7 @@ export default defineComponent({
/>
{!!props.definition && (
<VersionModal
isInstance={props.instance ? true : false}
isInstance={!!props.instance}
v-model:row={props.definition.processDefinition}
v-model:show={versionModalShow.value}
onUpdateList={refreshDetail}
Expand All @@ -362,9 +362,8 @@ export default defineComponent({
onCancel={taskCancel}
/>
<ContextMenuItem
startButtonDisplay={!props.instance}
startReadonly={startReadonly.value}
menuReadonly={menuReadonly.value}
startDisplay={startDisplay.value}
menuDisplay={menuDisplay.value}
taskInstance={taskInstance.value}
cell={nodeVariables.menuCell as Cell}
visible={nodeVariables.menuVisible}
Expand Down