Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#877] add formatting and linting to pipeline-details module #1064

Merged
merged 2 commits into from
Jan 9, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion ui/.eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,3 @@ src/app/info
src/app/login
src/app/notifications
src/app/NS
src/app/pipeline-details
1 change: 0 additions & 1 deletion ui/.prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,3 @@ src/app/info
src/app/login
src/app/notifications
src/app/NS
src/app/pipeline-details
Original file line number Diff line number Diff line change
Expand Up @@ -17,37 +17,70 @@
-->

<sp-basic-inner-panel panelTitle="Actions">
<div fxFlex="100" fxLayoutAlign="center center" fxLayout="row" style="padding:10px">
<div
fxFlex="100"
fxLayoutAlign="center center"
fxLayout="row"
style="padding: 10px"
>
<div fxFlex="30">
<button mat-button mat-raised-button color="accent"
matTooltip="Start Pipeline" matTooltipPosition="above"
(click)="startPipeline()"
[disabled]="starting" *ngIf="!pipeline.running">
<button
mat-button
mat-raised-button
color="accent"
matTooltip="Start Pipeline"
matTooltipPosition="above"
(click)="startPipeline()"
[disabled]="starting"
*ngIf="!pipeline.running"
>
<mat-icon>play_arrow</mat-icon>
<span>&nbsp;Start</span>
</button>
<button mat-button mat-raised-button color="accent"
matTooltip="Stop Pipeline" matTooltipPosition="above"
(click)="stopPipeline()"
[disabled]="stopping" *ngIf="pipeline.running">
<button
mat-button
mat-raised-button
color="accent"
matTooltip="Stop Pipeline"
matTooltipPosition="above"
(click)="stopPipeline()"
[disabled]="stopping"
*ngIf="pipeline.running"
>
<mat-icon>stop</mat-icon>
<span>&nbsp;Stop</span>
</button>
</div>
<div fxFlex="30">
<button mat-button mat-raised-button color="accent"
matTooltip="Modify Pipeline" matTooltipPosition="above"
[disabled]="pipeline.running"
(click)="pipelineOperationsService.modifyPipeline(pipeline._id)">
<button
mat-button
mat-raised-button
color="accent"
matTooltip="Modify Pipeline"
matTooltipPosition="above"
[disabled]="pipeline.running"
(click)="pipelineOperationsService.modifyPipeline(pipeline._id)"
>
<mat-icon>mode_edit</mat-icon>
<span>&nbsp;Modify</span>
</button>
</div>
<div fxFlex="30">
<button mat-button mat-raised-button color="accent"
matTooltip="Delete Pipeline" matTooltipPosition="above"
*ngIf="hasPipelineDeletePrivileges"
(click)="pipelineOperationsService.showDeleteDialog(pipeline, reloadPipelineEmitter, this.switchToPipelineView)">
<button
mat-button
mat-raised-button
color="accent"
matTooltip="Delete Pipeline"
matTooltipPosition="above"
*ngIf="hasPipelineDeletePrivileges"
(click)="
pipelineOperationsService.showDeleteDialog(
pipeline,
reloadPipelineEmitter,
this.switchToPipelineView
)
"
>
<mat-icon>delete</mat-icon>
<span>&nbsp;Delete</span>
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,25 @@
*
*/

import { Component, EventEmitter, Inject, Input, OnInit, Output } from '@angular/core';
import {
Component,
EventEmitter,
Inject,
Input,
OnInit,
Output,
} from '@angular/core';
import { PipelineOperationsService } from '../../../pipelines/services/pipeline-operations.service';
import { Pipeline } from '@streampipes/platform-services';
import { Router } from '@angular/router';
import { AuthService } from '../../../services/auth.service';
import { UserPrivilege } from '../../../_enums/user-privilege.enum';

@Component({
selector: 'pipeline-actions',
selector: 'sp-pipeline-actions',
templateUrl: './pipeline-actions.component.html',
})
export class PipelineActionsComponent implements OnInit {

starting = false;
stopping = false;

Expand All @@ -40,24 +46,27 @@ export class PipelineActionsComponent implements OnInit {

hasPipelineDeletePrivileges = false;

constructor(public pipelineOperationsService: PipelineOperationsService,
private router: Router,
private authService: AuthService) {
}
constructor(
public pipelineOperationsService: PipelineOperationsService,
private router: Router,
private authService: AuthService,
) {}

ngOnInit() {
this.authService.user$.subscribe(user => {
this.hasPipelineDeletePrivileges = this.authService.hasRole(UserPrivilege.PRIVILEGE_DELETE_PIPELINE);
this.hasPipelineDeletePrivileges = this.authService.hasRole(
UserPrivilege.PRIVILEGE_DELETE_PIPELINE,
);
});
this.toggleRunningOperation = this.toggleRunningOperation.bind(this);
this.switchToPipelineView = this.switchToPipelineView.bind(this);
}

toggleRunningOperation(currentOperation) {
if (currentOperation === 'starting') {
this.starting = !(this.starting);
this.starting = !this.starting;
} else {
this.stopping = !(this.stopping);
this.stopping = !this.stopping;
}
}

Expand All @@ -66,11 +75,18 @@ export class PipelineActionsComponent implements OnInit {
}

startPipeline() {
this.pipelineOperationsService.startPipeline(this.pipeline._id, this.reloadPipelineEmitter, this.toggleRunningOperation);
this.pipelineOperationsService.startPipeline(
this.pipeline._id,
this.reloadPipelineEmitter,
this.toggleRunningOperation,
);
}

stopPipeline() {
this.pipelineOperationsService.stopPipeline(this.pipeline._id, this.reloadPipelineEmitter, this.toggleRunningOperation);
this.pipelineOperationsService.stopPipeline(
this.pipeline._id,
this.reloadPipelineEmitter,
this.toggleRunningOperation,
);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,52 +16,75 @@
~
-->

<sp-basic-nav-tabs [spNavigationItems]="tabs"
[activeLink]="'quick-edit'"
[showBackLink]="true"
[backLinkTarget]="['pipelines']">

<sp-basic-nav-tabs
[spNavigationItems]="tabs"
[activeLink]="'sp-quick-edit'"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it correct to adapt this reference as well?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, this should not be changed.
This is related to the route and not the component.
The route is registered in the module (see [1])

[1] https://github.com/apache/streampipes/blob/dev/ui/src/app/pipelines/pipelines.module.ts

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, then I'll revert it 🙂

[showBackLink]="true"
[backLinkTarget]="['pipelines']"
>
<div fxLayout="column" class="page-container-padding" *ngIf="pipeline">
<pipeline-preview [jspcanvas]="'assembly-preview'"
[pipeline]="pipeline"
(selectedElementEmitter)="selectElement($event)"
style="margin-bottom:15px;"
class="md-padding"
*ngIf="pipelineAvailable"></pipeline-preview>
<sp-pipeline-preview
[jspcanvas]="'assembly-preview'"
[pipeline]="pipeline"
(selectedElementEmitter)="selectElement($event)"
style="margin-bottom: 15px"
class="md-padding"
*ngIf="pipelineAvailable"
></sp-pipeline-preview>

<sp-basic-inner-panel panelTitle="Edit Configuration">
<div header fxLayoutAlign="end center" fxFlex="100" fxLayout="row">
<button color="accent" mat-button mat-raised-button matTooltip="Save Pipeline"
matTooltipPosition="above"
style="display:flex;align-items:center;" class="settings-bar-icon-button"
[disabled]="(!formValid || pipelineUpdating)"
(click)="updatePipeline()">
<button
color="accent"
mat-button
mat-raised-button
matTooltip="Save Pipeline"
matTooltipPosition="above"
style="display: flex; align-items: center"
class="settings-bar-icon-button"
[disabled]="!formValid || pipelineUpdating"
(click)="updatePipeline()"
>
<mat-icon>save</mat-icon>
<span>&nbsp;Update pipeline</span>
</button>
</div>
<div fxFlex="100" fxLayout="column">
<div *ngIf="selectedElement">
<div fxLayout="column" style="padding:5px;padding-left:10px;">
<pipeline-elements-row [pipeline]="pipeline"
[element]="selectedElement"></pipeline-elements-row>
<div
fxLayout="column"
style="padding: 5px; padding-left: 10px"
>
<sp-pipeline-elements-row
[pipeline]="pipeline"
[element]="selectedElement"
></sp-pipeline-elements-row>

<div fxFlex="100" fxLayout="column"
*ngIf="isInvocable">
<div fxFlex="100" fxLayout="column" *ngIf="isInvocable">
<form [formGroup]="parentForm" fxFlex="100">
<app-static-property *ngFor="let config of _selectedElement.staticProperties"
[staticProperty]="config"
[displayRecommended]="true"
[staticProperties]="_selectedElement.staticProperties"
[eventSchemas]="eventSchemas"
[parentForm]="parentForm"
[fieldName]="config.internalName">
<app-static-property
*ngFor="
let config of _selectedElement.staticProperties
"
[staticProperty]="config"
[displayRecommended]="true"
[staticProperties]="
_selectedElement.staticProperties
"
[eventSchemas]="eventSchemas"
[parentForm]="parentForm"
[fieldName]="config.internalName"
>
</app-static-property>
</form>
</div>
</div>
</div>
<div fxLayout="column" fxLayoutAlign="center center" *ngIf="!selectedElement">
<div
fxLayout="column"
fxLayoutAlign="center center"
*ngIf="!selectedElement"
>
(select an element in the preview window to modify it)
</div>
</div>
Expand Down
Loading