Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
- Controller Service Listing.
- Adding lazy loading to the Canvas with the introduction of the Controller Service listing.
- Reorganizing existing components in the Flow Designer.
- Allowing the current Process Group to be configured.
- Inline Service creation.
  • Loading branch information
mcgilman committed Nov 30, 2023
1 parent d14686c commit aba402b
Show file tree
Hide file tree
Showing 234 changed files with 2,217 additions and 482 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@
import org.apache.nifi.web.api.entity.CurrentUserEntity;
import org.apache.nifi.web.api.entity.FlowAnalysisResultEntity;
import org.apache.nifi.web.api.entity.FlowAnalysisRuleEntity;
import org.apache.nifi.web.api.entity.FlowBreadcrumbEntity;
import org.apache.nifi.web.api.entity.FlowComparisonEntity;
import org.apache.nifi.web.api.entity.FlowConfigurationEntity;
import org.apache.nifi.web.api.entity.FlowEntity;
Expand Down Expand Up @@ -1008,6 +1009,14 @@ Set<DocumentedTypeDTO> getControllerServiceTypes(final String serviceType, final
*/
ProcessGroupFlowEntity getProcessGroupFlow(String groupId, boolean uiOnly);

/**
* Returns the breadcrumbs for the specified group.
*
* @param groupId group id
* @return the breadcrumbs
*/
FlowBreadcrumbEntity getProcessGroupBreadcrumbs(String groupId);

// ----------------------------------------
// ProcessGroup methods
// ----------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@
import org.apache.nifi.web.api.entity.CurrentUserEntity;
import org.apache.nifi.web.api.entity.FlowAnalysisResultEntity;
import org.apache.nifi.web.api.entity.FlowAnalysisRuleEntity;
import org.apache.nifi.web.api.entity.FlowBreadcrumbEntity;
import org.apache.nifi.web.api.entity.FlowComparisonEntity;
import org.apache.nifi.web.api.entity.FlowConfigurationEntity;
import org.apache.nifi.web.api.entity.FlowEntity;
Expand Down Expand Up @@ -4783,6 +4784,12 @@ public ProcessGroupFlowEntity getProcessGroupFlow(final String groupId, final bo
return entityFactory.createProcessGroupFlowEntity(dtoFactory.createProcessGroupFlowDto(processGroup, groupStatus, revisionManager, this::getProcessGroupBulletins, uiOnly), permissions);
}

@Override
public FlowBreadcrumbEntity getProcessGroupBreadcrumbs(final String groupId) {
final ProcessGroup processGroup = processGroupDAO.getProcessGroup(groupId);
return dtoFactory.createBreadcrumbEntity(processGroup);
}

@Override
public ProcessGroupEntity getProcessGroup(final String groupId) {
final ProcessGroup processGroup = processGroupDAO.getProcessGroup(groupId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
import org.apache.nifi.web.api.entity.CurrentUserEntity;
import org.apache.nifi.web.api.entity.FlowAnalysisResultEntity;
import org.apache.nifi.web.api.entity.FlowAnalysisRuleTypesEntity;
import org.apache.nifi.web.api.entity.FlowBreadcrumbEntity;
import org.apache.nifi.web.api.entity.FlowConfigurationEntity;
import org.apache.nifi.web.api.entity.FlowRegistryBucketEntity;
import org.apache.nifi.web.api.entity.FlowRegistryBucketsEntity;
Expand Down Expand Up @@ -401,6 +402,43 @@ public Response getFlow(
return generateOkResponse(entity).build();
}

@GET
@Consumes(MediaType.WILDCARD)
@Produces(MediaType.APPLICATION_JSON)
@Path("process-groups/{id}/breadcrumbs")
@ApiOperation(
value = "Gets the breadcrumbs for a process group",
response = FlowBreadcrumbEntity.class,
authorizations = {
@Authorization(value = "Read - /flow")
}
)
@ApiResponses(
value = {
@ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."),
@ApiResponse(code = 401, message = "Client could not be authenticated."),
@ApiResponse(code = 403, message = "Client is not authorized to make this request."),
@ApiResponse(code = 404, message = "The specified resource could not be found."),
@ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.")
}
)
public Response getBreadcrumbs(
@ApiParam(
value = "The process group id."
)
@PathParam("id") final String groupId) {

authorizeFlow();

if (isReplicateRequest()) {
return replicate(HttpMethod.GET);
}

// get the breadcrumbs for this process group
final FlowBreadcrumbEntity breadcrumbEntity = serviceFacade.getProcessGroupBreadcrumbs(groupId);
return generateOkResponse(breadcrumbEntity).build();
}

/**
* Retrieves the metrics of the entire flow.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1842,7 +1842,6 @@ public ControllerServiceReferencingComponentDTO createControllerServiceReferenci
Collection<ValidationResult> validationErrors = null;
if (component instanceof ProcessorNode) {
final ProcessorNode node = ((ProcessorNode) component);
dto.setGroupId(node.getProcessGroup().getIdentifier());
dto.setState(node.getScheduledState().name());
dto.setActiveThreadCount(node.getActiveThreadCount());
dto.setType(node.getComponentType());
Expand Down Expand Up @@ -1919,6 +1918,7 @@ public int compare(final PropertyDescriptor o1, final PropertyDescriptor o2) {
orderedProperties.putAll(sortedProperties);

// build the descriptor and property dtos
dto.setGroupId(processGroupId);
dto.setDescriptors(new LinkedHashMap<String, PropertyDescriptorDTO>());
dto.setProperties(new LinkedHashMap<String, String>());
for (final Map.Entry<PropertyDescriptor, String> entry : orderedProperties.entrySet()) {
Expand Down Expand Up @@ -2091,7 +2091,7 @@ public RemoteProcessGroupDTO createRemoteProcessGroupDto(final RemoteProcessGrou
* @param group group
* @return dto
*/
private FlowBreadcrumbEntity createBreadcrumbEntity(final ProcessGroup group) {
public FlowBreadcrumbEntity createBreadcrumbEntity(final ProcessGroup group) {
if (group == null) {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ const routes: Routes = [
{
path: '',
canMatch: [authGuard],
loadChildren: () => import('./pages/canvas/feature/flow-designer.module').then((m) => m.FlowDesignerModule)
loadChildren: () =>
import('./pages/flow-designer/feature/flow-designer.module').then((m) => m.FlowDesignerModule)
}
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { BrowserModule } from '@angular/platform-browser';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { FlowDesignerModule } from './pages/canvas/feature/flow-designer.module';
import { FlowDesignerModule } from './pages/flow-designer/feature/flow-designer.module';
import { StoreModule } from '@ngrx/store';
import { EffectsModule } from '@ngrx/effects';
import { StoreDevtoolsModule } from '@ngrx/store-devtools';
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { EffectsModule } from '@ngrx/effects';
import { CounterListingEffects } from '../state/counter-listing/counter-listing.effects';
import { CounterListingModule } from '../ui/counter-listing/counter-listing.module';
import { ParameterContextListingModule } from '../../parameter-contexts/ui/parameter-context-listing/parameter-context-listing.module';
import { MatDialogModule } from '@angular/material/dialog';

@NgModule({
declarations: [Counters],
Expand All @@ -35,7 +36,8 @@ import { ParameterContextListingModule } from '../../parameter-contexts/ui/param
StoreModule.forFeature(countersFeatureKey, reducers),
EffectsModule.forFeature(CounterListingEffects),
CounterListingModule,
ParameterContextListingModule
ParameterContextListingModule,
MatDialogModule
]
})
export class CountersModule {}
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,28 @@ import { RouterModule, Routes } from '@angular/router';
import { FlowDesigner } from './flow-designer.component';
import { RootGroupRedirector } from '../ui/root/redirector/root-group-redirector.component';
import { rootGroupGuard } from '../ui/root/guard/root-group.guard';
import { Canvas } from '../ui/canvas/canvas.component';
import { ControllerServices } from '../ui/controller-service/controller-services.component';

const routes: Routes = [
{
path: 'process-groups/:processGroupId',
component: FlowDesigner,
children: [
{ path: 'bulk/:ids', component: FlowDesigner },
{
path: ':type/:id',
component: FlowDesigner,
children: [{ path: 'edit', component: FlowDesigner }]
path: 'controller-services',
loadChildren: () =>
import('../ui/controller-service/controller-services.module').then(
(m) => m.ControllerServicesModule
)
},
{
path: '',
loadChildren: () => import('../ui/canvas/canvas.module').then((m) => m.CanvasModule)
}
]
},
{ path: '', component: RootGroupRedirector, canActivate: [rootGroupGuard] }
// { path: '**', component: FlowDesignerComponent }
];

@NgModule({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,4 @@
~ limitations under the License.
-->

<div class="flex flex-col h-screen justify-between">
<fd-header></fd-header>
<fd-canvas class="flex-1"></fd-canvas>
<fd-footer></fd-footer>
</div>
<router-outlet></router-outlet>
Original file line number Diff line number Diff line change
Expand Up @@ -20,33 +20,16 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
import { FlowDesigner } from './flow-designer.component';
import { provideMockStore } from '@ngrx/store/testing';
import { initialState } from '../state/flow/flow.reducer';
import { Component } from '@angular/core';
import { RouterTestingModule } from '@angular/router/testing';

describe('FlowDesigner', () => {
let component: FlowDesigner;
let fixture: ComponentFixture<FlowDesigner>;

@Component({
selector: 'fd-header',
template: ''
})
class MockHeader {}

@Component({
selector: 'fd-canvas',
template: ''
})
class MockCanvas {}

@Component({
selector: 'fd-footer',
template: ''
})
class MockFooter {}

beforeEach(() => {
TestBed.configureTestingModule({
declarations: [FlowDesigner, MockHeader, MockCanvas, MockFooter],
declarations: [FlowDesigner],
imports: [RouterTestingModule],
providers: [
provideMockStore({
initialState
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ import { NgModule } from '@angular/core';
import { CommonModule, NgOptimizedImage } from '@angular/common';
import { FlowDesigner } from './flow-designer.component';
import { FlowDesignerRoutingModule } from './flow-designer-routing.module';
import { HeaderModule } from '../ui/header/header.module';
import { FooterModule } from '../ui/footer/footer.module';
import { CanvasModule } from '../ui/canvas/canvas.module';
import { StoreModule } from '@ngrx/store';
import { EffectsModule } from '@ngrx/effects';
Expand All @@ -29,18 +27,17 @@ import { TransformEffects } from '../state/transform/transform.effects';
import { VersionControlTip } from '../ui/common/tooltips/version-control-tip/version-control-tip.component';
import { canvasFeatureKey, reducers } from '../state';
import { MatDialogModule } from '@angular/material/dialog';
import { ControllerServicesModule } from '../ui/controller-service/controller-services.module';
import { ControllerServicesEffects } from '../state/controller-services/controller-services.effects';

@NgModule({
declarations: [FlowDesigner, VersionControlTip],
exports: [FlowDesigner],
imports: [
CommonModule,
HeaderModule,
CanvasModule,
FooterModule,
FlowDesignerRoutingModule,
StoreModule.forFeature(canvasFeatureKey, reducers),
EffectsModule.forFeature(FlowEffects, TransformEffects),
EffectsModule.forFeature(FlowEffects, TransformEffects, ControllerServicesEffects),
NgOptimizedImage,
MatDialogModule
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,17 @@ import { flowFeatureKey } from '../../state/flow';
import { selectFlowState } from '../../state/flow/flow.selectors';
import { CanvasState } from '../../state';
import { transformFeatureKey } from '../../state/transform';
import { controllerServicesFeatureKey } from '../../state/controller-services';
import * as fromControllerServices from '../../state/controller-services/controller-services.reducer';

describe('ConnectableBehavior', () => {
let service: ConnectableBehavior;

beforeEach(() => {
const initialState: CanvasState = {
[flowFeatureKey]: fromFlow.initialState,
[transformFeatureKey]: fromTransform.initialState
[transformFeatureKey]: fromTransform.initialState,
[controllerServicesFeatureKey]: fromControllerServices.initialState
};

TestBed.configureTestingModule({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,21 @@ import * as fromFlow from '../../state/flow/flow.reducer';
import * as fromTransform from '../../state/transform/transform.reducer';
import { provideMockStore } from '@ngrx/store/testing';
import { selectTransform } from '../../state/transform/transform.selectors';
import { initialState } from '../../state/transform/transform.reducer';
import { CanvasState } from '../../state';
import { flowFeatureKey } from '../../state/flow';
import { transformFeatureKey } from '../../state/transform';
import { selectFlowState } from '../../state/flow/flow.selectors';
import { controllerServicesFeatureKey } from '../../state/controller-services';
import * as fromControllerServices from '../../state/controller-services/controller-services.reducer';

describe('DraggableBehavior', () => {
let service: DraggableBehavior;

beforeEach(() => {
const initialState: CanvasState = {
[flowFeatureKey]: fromFlow.initialState,
[transformFeatureKey]: fromTransform.initialState
[transformFeatureKey]: fromTransform.initialState,
[controllerServicesFeatureKey]: fromControllerServices.initialState
};

TestBed.configureTestingModule({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,16 @@ import * as fromFlow from '../../state/flow/flow.reducer';
import { transformFeatureKey } from '../../state/transform';
import * as fromTransform from '../../state/transform/transform.reducer';
import { selectTransform } from '../../state/transform/transform.selectors';
import { controllerServicesFeatureKey } from '../../state/controller-services';
import * as fromControllerServices from '../../state/controller-services/controller-services.reducer';

describe('EditableBehaviorService', () => {
let service: EditableBehavior;

const initialState: CanvasState = {
[flowFeatureKey]: fromFlow.initialState,
[transformFeatureKey]: fromTransform.initialState
[transformFeatureKey]: fromTransform.initialState,
[controllerServicesFeatureKey]: fromControllerServices.initialState
};

beforeEach(() => {
Expand Down
Loading

0 comments on commit aba402b

Please sign in to comment.