sardell commented on code in PR #9855:
URL: https://github.com/apache/nifi/pull/9855#discussion_r2223914707


##########
nifi-frontend/src/main/frontend/apps/nifi-registry/src/app/pages/expolorer/feature/explorer.component.ts:
##########
@@ -0,0 +1,237 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { Component, OnInit } from '@angular/core';
+import {
+    selectDropletIdFromRoute,
+    selectDroplets,
+    selectDropletState
+} from '../../../state/droplets/droplets.selectors';
+import {
+    loadDroplets,
+    openDeleteDropletDialog,
+    openExportFlowVersionDialog,
+    openFlowVersionsDialog,
+    openImportNewFlowDialog,
+    openImportNewFlowVersionDialog,
+    selectDroplet
+} from '../../../state/droplets/droplets.actions';
+import { Droplet } from '../../../state/droplets';
+import { Store } from '@ngrx/store';
+import { MatTableDataSource } from '@angular/material/table';
+import { Observable } from 'rxjs';
+import { Sort } from '@angular/material/sort';
+import { NiFiCommon, selectQueryParams } from '@nifi/shared';
+import { loadBuckets } from '../../../state/buckets/buckets.actions';
+import { Bucket } from '../../../state/buckets';
+import { selectBuckets } from '../../../state/buckets/buckets.selectors';
+import { DropletTableFilterContext } from 
'./ui/droplet-table-filter/droplet-table-filter.component';
+import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
+import { ActivatedRoute, Router } from '@angular/router';
+
+import { CommonModule } from '@angular/common';
+import { MatTableModule } from '@angular/material/table';
+import { MatSortModule } from '@angular/material/sort';
+import { MatMenuModule } from '@angular/material/menu';
+import { DropletTableFilterComponent } from 
'./ui/droplet-table-filter/droplet-table-filter.component';
+import { MatButtonModule } from '@angular/material/button';
+import { DropletTableComponent } from 
'./ui/droplet-table/droplet-table.component';
+
+@Component({
+    selector: 'explorer',
+    imports: [
+        CommonModule,
+        MatTableModule,
+        MatSortModule,
+        MatMenuModule,
+        DropletTableFilterComponent,
+        MatButtonModule,
+        MatButtonModule,
+        DropletTableComponent
+    ],
+    templateUrl: './explorer.component.html',
+    styleUrl: './explorer.component.scss',
+    standalone: true
+})
+export class ExplorerComponent implements OnInit {
+    droplets$: Observable<Droplet[]>;
+    buckets$: Observable<Bucket[]>;
+    buckets: Bucket[] = [];
+    dataSource: MatTableDataSource<Droplet> = new 
MatTableDataSource<Droplet>();
+    displayedColumns: string[] = [
+        'name',
+        'type',
+        'bucketName',
+        'bucketIdentifier',
+        'identifier',
+        'versions',
+        'actions'
+    ];
+    sort: Sort = {
+        active: 'name',
+        direction: 'asc'
+    };
+    filterTerm = '';
+    filterBucket = 'All';
+    filterColumn = '';
+    dropletsState$ = this.store.select(selectDropletState);
+    selectedDropletId$ = this.store.select(selectDropletIdFromRoute);
+
+    constructor(
+        private store: Store,
+        private nifiCommon: NiFiCommon,
+        private router: Router,
+        private activatedRoute: ActivatedRoute
+    ) {
+        this.droplets$ = 
this.store.select(selectDroplets).pipe(takeUntilDestroyed());
+        this.buckets$ = 
this.store.select(selectBuckets).pipe(takeUntilDestroyed());
+        this.store
+            .select(selectQueryParams)
+            .pipe(takeUntilDestroyed())
+            .subscribe((queryParams) => {
+                if (queryParams) {
+                    this.filterTerm = queryParams['filterTerm'] || '';
+                    this.filterBucket = queryParams['filterBucket'] || 'All';
+                    this.filterColumn = queryParams['filterColumn'] || '';
+                    this.dataSource.filter = JSON.stringify(queryParams);
+                }
+            });
+    }

Review Comment:
   >Secondly, the routes in this new NiFi registry application explorer view do 
not behave the same way as the legacy UI and I think we need to honor the 
existing routes. Users from the existing NiFi Registry may have bookmarks etc 
and expect those to work and since NiFi Registry is part of the NiFi release I 
don't think we want to have breaking changes like this in a minor release. It 
is kind of like an api.
   
   Couldn't we just add a redirect to handle legacy urls instead of locking 
into a convention that IMO is not very intuitive? Additionally, is the 
expectation really to have no breaking changes whatsoever when rewriting an 
entire UI? Why wouldn't we just follow semantic versioning if there are 
breaking changes?
   
   I think most people would agree that 
`nifi-registry/#/resources/<resource-id>` is much simpler and easier to 
understand than 
`nifi-registry/resources/grid-list/buckets/<bucket-id>/flows/<resource-id>`. I 
think path parameters make sense when viewing a specific resource, but it's 
pretty common convention to use query parameters to handle the persistence of 
filter values selected on a page. 
   
   I'm fine not persisting filter values since we don't persist them in NiFi, 
but if we do want to support that in the url I don't think the deep linking 
you're proposing is the way we should it. Long urls like that make sense on the 
canvas, where it's a literally drill-down view of nested components without a 
filter, but we aren't doing that in list views. For example, when you look at 
the summary of a processor in NiFi, the url is `nifi/#/summary/processors` and 
not `nifi/#/summary/process-groups/<process-group-id>/processors`.



-- 
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