Re: [PR] NIFI-13044: Adding support to move to front [nifi]

2024-04-15 Thread via GitHub


rfellows merged PR #8646:
URL: https://github.com/apache/nifi/pull/8646


-- 
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: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] NIFI-13044: Adding support to move to front [nifi]

2024-04-15 Thread via GitHub


rfellows commented on code in PR #8646:
URL: https://github.com/apache/nifi/pull/8646#discussion_r1565869058


##
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/flow-designer/state/flow/flow.effects.ts:
##
@@ -3153,4 +3157,41 @@ export class FlowEffects {
 ),
 { dispatch: false }
 );
+
+moveToFront$ = createEffect(() =>
+this.actions$.pipe(
+ofType(FlowActions.moveToFront),
+map((action) => action.request),
+concatLatestFrom((request) => 
this.store.select(selectMaxZIndex(request.componentType))),
+switchMap(([request, maxZIndex]) => {
+const updateRequest: UpdateComponentRequest = {
+id: request.id,
+type: request.componentType,
+uri: request.uri,
+payload: {
+revision: request.revision,
+disconnectedNodeAcknowledged: 
this.clusterConnectionService.isDisconnectionAcknowledged(),
+component: {
+id: request.id,
+zIndex: maxZIndex + 1

Review Comment:
   Should we compare the max with the zIndex of the selection? If they are the 
same, don't bother to increment?



##
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/flow-designer/service/manager/label-manager.service.ts:
##
@@ -76,6 +76,17 @@ export class LabelManager {
 });
 }
 
+/**
+ * Sorts the specified labels according to the z index.
+ *
+ * @param {type} labels
+ */
+private sort(labels: any[]): void {
+labels.sort(function (a, b) {
+return a.zIndex === b.zIndex ? 0 : a.zIndex > b.zIndex ? 1 : -1;
+});
+}

Review Comment:
   ```suggestion
   private sort(labels: any[]): void {
   labels.sort((a, b) => {
   return this.nifiCommon.compareNumber(a.zIndex, b.zIndex);
   });
   }
   ```



-- 
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: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org