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

Multi tab #347

Open
wants to merge 11 commits into
base: dev
Choose a base branch
from
Open

Multi tab #347

wants to merge 11 commits into from

Conversation

Aller05
Copy link
Collaborator

@Aller05 Aller05 commented Apr 14, 2024

  1. The muulti-tab function UI and interaction are very similar to vs code;
  2. Tab supports closing and switching;
  3. The tab will show the edited asterisk and whether it is locked;
  4. Double-click the tab name to modify the flow name;
  5. 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

image

@Aller05 Aller05 requested a review from Weixuanf April 14, 2024 17:18
@Weixuanf
Copy link
Contributor

效果很好!就是如果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;
Copy link
Contributor

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了

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

改掉了

@Weixuanf
Copy link
Contributor

Screenshot 2024-04-15 at 4 30 25 PM

这里好像有ts error

@Weixuanf
Copy link
Contributor

Screenshot 2024-04-15 at 4 44 53 PM

删除当前tab里有的file会变成这样

ui/src/App.tsx Outdated
Comment on lines 166 to 168
setTimeout(() => {
loadWorkflowIDImpl(latestWfID!);
}, 200);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里为什么要加settimeout?

Copy link
Collaborator Author

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的情况。

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

优化了下,去掉定时器了

@Weixuanf
Copy link
Contributor

"Load"或者drag workflow会覆盖当前的workflow

@Weixuanf
Copy link
Contributor

Screen.Recording.2024-04-15.at.5.15.57.PM.mov

刷新的时候topbar右半部分会稍微慢一点?

@Aller05
Copy link
Collaborator Author

Aller05 commented Apr 17, 2024

效果很好!就是如果选项卡里面有脏的,但是刷新的时候不会弹窗,会直接刷新了

奇怪。。我这里是正常的,我回头我录个屏给你看下,而且刷新的弹窗逻辑在App的handleBeforeUnload函数里,这次也没改动它

@Aller05
Copy link
Collaborator Author

Aller05 commented Apr 17, 2024

Screenshot 2024-04-15 at 4 30 25 PM 这里好像有ts error

已修复

@Aller05
Copy link
Collaborator Author

Aller05 commented Apr 17, 2024

Screenshot 2024-04-15 at 4 44 53 PM 删除当前tab里有的file会变成这样

已修复,删除和批量删除都做了相关适配

@Aller05
Copy link
Collaborator Author

Aller05 commented Apr 17, 2024

Screen.Recording.2024-04-15.at.5.15.57.PM.mov
刷新的时候topbar右半部分会稍微慢一点?

这个是上面那个加定时器的问题相关,我优化了下,去掉了定时器

@@ -57,6 +58,7 @@ export default function MultipleSelectionOperation(props: Props) {
onDelete={async () => {
await workflowsTable?.batchDeleteFlow(selectedKeys);
batchOperationCallback("batchDelete");
tabDataManager.batchDeleteTabData(selectedKeys);
Copy link
Contributor

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都写一遍了

Copy link
Collaborator Author

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里了。

Copy link
Contributor

@Weixuanf Weixuanf Apr 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

》 不过tab更多的是打开、关闭、切换,纯tab触发,不涉及db操作,
确实 这个也有道理🤔

@Aller05
Copy link
Collaborator Author

Aller05 commented Apr 18, 2024

"Load"或者drag workflow会覆盖当前的workflow

已修复

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants