-
-
Notifications
You must be signed in to change notification settings - Fork 54
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
Multi tab #347
base: dev
Are you sure you want to change the base?
Conversation
Aller05
commented
Apr 14, 2024
- The muulti-tab function UI and interaction are very similar to vs code;
- Tab supports closing and switching;
- The tab will show the edited asterisk and whether it is locked;
- Double-click the tab name to modify the flow name;
- Adapted to various scenarios of adding new flows and opening flows, including:
- Click on the flow list,
- Added flow,
- Copy flow,
- Save as flow,
- Spotlight search to open flow,
- Open the specified version of flow
效果很好!就是如果tabs里面有dirty的,但是refresh的时候不会弹窗,会直接refresh了 |
ui/src/App.tsx
Outdated
const saveCurWorkflow = useCallback(async () => { | ||
if (curFlowID.current) { | ||
const saveCurWorkflow = useCallback(async (id?: string) => { | ||
const flowId = id || curFlowID.current; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我感觉可以用workflowsTable.curWorkflow.id, 以后curFlowID.current可以deprecate了
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
改掉了
ui/src/App.tsx
Outdated
setTimeout(() => { | ||
loadWorkflowIDImpl(latestWfID!); | ||
}, 200); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里为什么要加settimeout?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
loadWorkflowIDImpl函数内会通过CustomEvent的方式通知MulitTab打开新的tab,刷新页面时,MulitTab组件的加载顺序在App之后,所以会出现MulitTab内的addEventListener还未注册上就dispatchEvent的情况。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
优化了下,去掉定时器了
"Load"或者drag workflow会覆盖当前的workflow |
Screen.Recording.2024-04-15.at.5.15.57.PM.mov刷新的时候topbar右半部分会稍微慢一点? |
奇怪。。我这里是正常的,我回头我录个屏给你看下,而且刷新的弹窗逻辑在App的handleBeforeUnload函数里,这次也没改动它 |
这个是上面那个加定时器的问题相关,我优化了下,去掉了定时器 |
@@ -57,6 +58,7 @@ export default function MultipleSelectionOperation(props: Props) { | |||
onDelete={async () => { | |||
await workflowsTable?.batchDeleteFlow(selectedKeys); | |||
batchOperationCallback("batchDelete"); | |||
tabDataManager.batchDeleteTabData(selectedKeys); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
你觉得这些 tabDataManager.batchDeleteTabData() 或者其他的 tabDataManager操作,是不是放到workflowsTable?.batchDeleteFlow()里面统一操作比较好呢,就不需要每个callsite都写一遍了
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
嗯,可以的,不过tab更多的是打开、关闭、切换,纯tab触发,不涉及db操作,所以我只把flow的删除和修改名字的tab处理放到workflowsTable里了。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
》 不过tab更多的是打开、关闭、切换,纯tab触发,不涉及db操作,
确实 这个也有道理🤔
已修复 |