rfellows commented on code in PR #11304:
URL: https://github.com/apache/nifi/pull/11304#discussion_r3349913107
##########
nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/access-policies/service/access-policy.service.spec.ts:
##########
Review Comment:
Maybe add a couple more tests that ensure the two public methods actually
consume `buildResourcePath` correctly:
```typescript
it('createAccessPolicy POSTs with canonical /data/connectors resource', ()
=> {
const httpMock = TestBed.inject(HttpTestingController);
service.createAccessPolicy({
resource: 'connectors',
resourceIdentifier: 'data',
action: Action.Read
}).subscribe();
const req = httpMock.expectOne('../nifi-api/policies');
expect(req.request.method).toBe('POST');
expect(req.request.body.component.resource).toBe('/data/connectors');
expect(req.request.body.component.resourceIdentifier).toBeUndefined();
req.flush({});
httpMock.verify();
});
it('getAccessPolicy GETs the canonical /data/connectors URL', () => {
const httpMock = TestBed.inject(HttpTestingController);
service.getAccessPolicy({
resource: 'connectors',
resourceIdentifier: 'data',
action: Action.Read
}).subscribe();
httpMock.expectOne('../nifi-api/policies/read/data/connectors').flush({});
httpMock.verify();
});
```
##########
nifi-frontend/src/main/frontend/libs/shared/src/components/component-context/component-context.component.ts:
##########
@@ -63,8 +63,14 @@ export class ComponentContext {
return 'icon-label';
case ComponentType.RemoteProcessGroup:
return 'icon-group-remote';
+ case ComponentType.Connector:
+ return 'fa fa-plug primary-color';
default:
return 'icon-drop';
}
}
+
+ usesFontAwesomeIcon(): boolean {
+ return this.componentIconClass.startsWith('fa');
+ }
Review Comment:
This feels a bit wrong. Since the `getIconClassName` is private, we can
refactor it without risk of breaking anything else. I'd suggest changing this
to return some object structure rather than just the classname string. Maybe
something like:
```typescript
interface IconMeta {
className: string;
iconType: 'font-awesome' | 'icon-font';
}
```
--
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]