kunwp1 commented on code in PR #4280:
URL: https://github.com/apache/texera/pull/4280#discussion_r2923005064


##########
frontend/src/app/dashboard/component/user/user-workflow/user-workflow.component.ts:
##########
@@ -289,27 +290,13 @@ export class UserWorkflowComponent implements 
AfterViewInit {
           );
         }
 
-        const userIds = new Set<number>();
-        duplicatedWorkflowsInfo.forEach(workflow => {
-          if (workflow.ownerId) {
-            userIds.add(workflow.ownerId);
-          }
-        });
-
-        let userIdToInfoMap: { [key: number]: UserInfo } = {};
-        if (userIds.size > 0) {
-          userIdToInfoMap = await 
firstValueFrom(this.searchService.getUserInfo(Array.from(userIds)));
-        }
-
-        const newEntries = duplicatedWorkflowsInfo.map(duplicatedWorkflowInfo 
=> {
-          const entry = new DashboardEntry(duplicatedWorkflowInfo);
-          const userInfo = userIdToInfoMap[duplicatedWorkflowInfo.ownerId];
-          if (userInfo) {
-            entry.setOwnerName(userInfo.userName);
-            entry.setOwnerGoogleAvatar(userInfo.googleAvatar ?? "");
-          }
-          return entry;
-        });
+        const searchResultItems: SearchResultItem[] = 
duplicatedWorkflowsInfo.map(w => ({
+          resourceType: "workflow",
+          workflow: w,
+        }));
+        const newEntries = await firstValueFrom(
+          
this.searchService.extendSearchResultsWithHubActivityInfo(searchResultItems, 
this.isLogin, ["access"])

Review Comment:
   I think your fix is an overkill. Your fix relies on Hub service for the new 
duplicated workflow which is adding an extra network call. For a workflow we 
just duplicated, the frontend already knows the current user is the owner of 
the workflow. So I suggest you fix the place that decides the link (whether to 
open a workspace or a preview page).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to