scripts & processes improvements

This commit is contained in:
lotte
2020-06-26 15:27:48 +02:00
parent 9677e053f5
commit 32c8d9de03
5 changed files with 76 additions and 33 deletions

View File

@@ -18,6 +18,18 @@
</ds-process-detail-field>
</div>
<ds-process-detail-field *ngIf="process && process.startTime" id="process-start-time" [title]="'process.detail.start-time' | translate">
<div>{{ process.startTime }}</div>
</ds-process-detail-field>
<ds-process-detail-field *ngIf="process && process.endTime" id="process-end-time" [title]="'process.detail.end-time' | translate">
<div>{{ process.endTime }}</div>
</ds-process-detail-field>
<ds-process-detail-field *ngIf="process && process.processStatus" id="process-status" [title]="'process.detail.status' | translate">
<div>{{ process.processStatus }}</div>
</ds-process-detail-field>
<!--<ds-process-detail-field id="process-output" [title]="'process.detail.output'">-->
<!--<pre class="font-weight-bold text-secondary bg-light p-3">{{'process.detail.output.alert' | translate}}</pre>-->
<!--</ds-process-detail-field>-->

View File

@@ -12,6 +12,8 @@ import { NotificationsService } from '../../shared/notifications/notifications.s
import { of as observableOf } from 'rxjs';
import { NotificationsServiceStub } from '../../shared/testing/notifications-service.stub';
import { TranslateLoaderMock } from '../../shared/mocks/translate-loader.mock';
import { RequestService } from '../../core/data/request.service';
import { Router } from '@angular/router';
describe('NewProcessComponent', () => {
let component: NewProcessComponent;
@@ -57,6 +59,8 @@ describe('NewProcessComponent', () => {
providers: [
{ provide: ScriptDataService, useValue: scriptService },
{ provide: NotificationsService, useClass: NotificationsServiceStub },
{ provide: RequestService, useValue: {} },
{ provide: Router, useValue: {} },
],
schemas: [NO_ERRORS_SCHEMA]
})

View File

@@ -9,7 +9,8 @@ import { RequestEntry } from '../../core/data/request.reducer';
import { NotificationsService } from '../../shared/notifications/notifications.service';
import { TranslateService } from '@ngx-translate/core';
import { take } from 'rxjs/operators';
import { pipe } from 'rxjs';
import { RequestService } from '../../core/data/request.service';
import { Router } from '@angular/router';
/**
* Component to create a new script
@@ -45,7 +46,12 @@ export class NewProcessComponent implements OnInit {
*/
public missingParameters = [];
constructor(private scriptService: ScriptDataService, private notificationsService: NotificationsService, private translationService: TranslateService) {
constructor(
private scriptService: ScriptDataService,
private notificationsService: NotificationsService,
private translationService: TranslateService,
private requestService: RequestService,
private router: Router) {
}
ngOnInit(): void {
@@ -75,6 +81,7 @@ export class NewProcessComponent implements OnInit {
const title = this.translationService.get('process.new.notification.success.title');
const content = this.translationService.get('process.new.notification.success.content');
this.notificationsService.success(title, content)
this.sendBack();
} else {
const title = this.translationService.get('process.new.notification.error.title');
const content = this.translationService.get('process.new.notification.error.content');
@@ -123,6 +130,13 @@ export class NewProcessComponent implements OnInit {
}
return this.missingParameters.length > 0;
}
private sendBack() {
this.requestService.removeByHrefSubstring('/processes');
/* should subscribe on the previous method to know the action is finished and then navigate,
will fix this when the removeByHrefSubstring changes are merged */
this.router.navigateByUrl('/processes');
}
}
export function controlContainerFactory(controlContainer?: ControlContainer) {

View File

@@ -1,33 +1,38 @@
<div class="container">
<h2>{{'process.overview.title' | translate}}</h2>
<ds-pagination *ngIf="(processesRD$ | async)?.payload?.totalElements > 0"
[paginationOptions]="pageConfig"
[pageInfoState]="(processesRD$ | async)?.payload"
[collectionSize]="(processesRD$ | async)?.payload?.totalElements"
[hideGear]="true"
[hidePagerWhenSinglePage]="true"
(pageChange)="onPageChange($event)">
<table class="table table-striped table-hover table-responsive">
<thead>
<tr>
<th scope="col">{{'process.overview.table.id' | translate}}</th>
<th scope="col">{{'process.overview.table.name' | translate}}</th>
<th scope="col">{{'process.overview.table.user' | translate}}</th>
<th scope="col">{{'process.overview.table.start' | translate}}</th>
<th scope="col">{{'process.overview.table.finish' | translate}}</th>
<th scope="col">{{'process.overview.table.status' | translate}}</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let process of (processesRD$ | async)?.payload?.page">
<td><a [routerLink]="['/processes/', process.processId]">{{process.processId}}</a></td>
<td><a [routerLink]="['/processes/', process.processId]">{{process.scriptName}}</a></td>
<td *ngVar="(getEpersonName(process.userId) | async) as ePersonName">{{ePersonName}}</td>
<td>{{process.startTime | date:dateFormat}}</td>
<td>{{process.endTime | date:dateFormat}}</td>
<td>{{process.processStatus}}</td>
</tr>
</tbody>
</table>
</ds-pagination>
<div class="d-flex">
<h2 class="flex-grow-1">{{'process.overview.title' | translate}}</h2>
<button class="btn btn-lg btn-success " routerLink="/processes/new"><i class="fas fa-plus pr-2"></i>{{'process.overview.new' | translate}}</button>
</div>
<ds-pagination *ngIf="(processesRD$ | async)?.payload?.totalElements > 0"
[paginationOptions]="pageConfig"
[pageInfoState]="(processesRD$ | async)?.payload"
[collectionSize]="(processesRD$ | async)?.payload?.totalElements"
[hideGear]="true"
[hidePagerWhenSinglePage]="true"
(pageChange)="onPageChange($event)">
<div class="table-responsive">
<table class="table table-striped table-hover">
<thead>
<tr>
<th scope="col">{{'process.overview.table.id' | translate}}</th>
<th scope="col">{{'process.overview.table.name' | translate}}</th>
<th scope="col">{{'process.overview.table.user' | translate}}</th>
<th scope="col">{{'process.overview.table.start' | translate}}</th>
<th scope="col">{{'process.overview.table.finish' | translate}}</th>
<th scope="col">{{'process.overview.table.status' | translate}}</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let process of (processesRD$ | async)?.payload?.page">
<td><a [routerLink]="['/processes/', process.processId]">{{process.processId}}</a></td>
<td><a [routerLink]="['/processes/', process.processId]">{{process.scriptName}}</a></td>
<td *ngVar="(getEpersonName(process.userId) | async) as ePersonName">{{ePersonName}}</td>
<td>{{process.startTime | date:dateFormat}}</td>
<td>{{process.endTime | date:dateFormat}}</td>
<td>{{process.processStatus}}</td>
</tr>
</tbody>
</table>
</div>
</ds-pagination>
</div>

View File

@@ -1965,6 +1965,12 @@
"process.detail.title" : "Process: {{ id }} - {{ name }}",
"process.detail.start-time" : "Start time",
"process.detail.end-time" : "Finish time",
"process.detail.status" : "Status",
"process.overview.table.finish" : "Finish time",
@@ -1983,6 +1989,8 @@
"process.overview.breadcrumbs": "Processes Overview",
"process.overview.new": "New",
"profile.breadcrumbs": "Update Profile",