fix(plugin-workflow): fix workflow version dropdown overflow (#4542)

This commit is contained in:
Junyi 2024-06-02 23:01:35 +08:00 committed by GitHub
parent 63f71994ab
commit 1c990ba0a5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 37 additions and 35 deletions

View File

@ -177,41 +177,40 @@ export function WorkflowCanvas() {
/>
</header>
<aside>
<div className="workflow-versions">
<Dropdown
trigger={['click']}
menu={{
onClick: onSwitchVersion,
defaultSelectedKeys: [`${workflow.id}`],
className: cx(styles.dropdownClass, styles.workflowVersionDropdownClass),
items: revisions
.sort((a, b) => b.id - a.id)
.map((item, index) => ({
role: 'button',
'aria-label': `version-${index}`,
key: `${item.id}`,
icon: item.current ? <RightOutlined /> : null,
className: cx({
executed: item.executed,
unexecuted: !item.executed,
enabled: item.enabled,
}),
label: (
<>
<strong>{`#${item.id}`}</strong>
<time>{str2moment(item.createdAt).format('YYYY-MM-DD HH:mm:ss')}</time>
</>
),
})),
}}
>
<Button type="text" aria-label="version">
<label>{lang('Version')}</label>
<span>{workflow?.id ? `#${workflow.id}` : null}</span>
<DownOutlined />
</Button>
</Dropdown>
</div>
<Dropdown
className="workflow-versions"
trigger={['click']}
menu={{
onClick: onSwitchVersion,
defaultSelectedKeys: [`${workflow.id}`],
className: cx(styles.dropdownClass, styles.workflowVersionDropdownClass),
items: revisions
.sort((a, b) => b.id - a.id)
.map((item, index) => ({
role: 'button',
'aria-label': `version-${index}`,
key: `${item.id}`,
icon: item.current ? <RightOutlined /> : null,
className: cx({
executed: item.executed,
unexecuted: !item.executed,
enabled: item.enabled,
}),
label: (
<>
<strong>{`#${item.id}`}</strong>
<time>{str2moment(item.createdAt).format('YYYY-MM-DD HH:mm:ss')}</time>
</>
),
})),
}}
>
<Button type="text" aria-label="version">
<label>{lang('Version')}</label>
<span>{workflow?.id ? `#${workflow.id}` : null}</span>
<DownOutlined />
</Button>
</Dropdown>
<Switch
checked={workflow.enabled}
onChange={onToggle}

View File

@ -96,6 +96,9 @@ const useStyles = createStyles(({ css, token }) => {
`,
workflowVersionDropdownClass: css`
max-height: 80vh;
overflow-y: auto;
.ant-dropdown-menu-item {
.ant-dropdown-menu-title-content {
strong {