Added new maintenance tasks in the UI. Old indexes management component merged with the new one viewed on /maintenance-tasks
This commit is contained in:
parent
1aec9d4eff
commit
f9839b14ed
|
@ -329,17 +329,6 @@ const appRoutes: Routes = [
|
|||
})
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'index-managment',
|
||||
loadChildren: () => import('./ui/admin/index-managment/index-managment.module').then(m => m.IndexManagmentModule),
|
||||
data: {
|
||||
authContext: {
|
||||
permissions: [AppPermission.ViewMaintenancePage]
|
||||
},
|
||||
breadcrumb: true,
|
||||
title: 'GENERAL.TITLES.INDEX-MANAGMENT'
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'maintenance-tasks',
|
||||
loadChildren: () => import('./ui/admin/maintenance-tasks/maintenance-tasks.module').then(m => m.MaintenanceTasksModule),
|
||||
|
@ -347,7 +336,8 @@ const appRoutes: Routes = [
|
|||
authContext: {
|
||||
permissions: [AppPermission.ViewMaintenancePage]
|
||||
},
|
||||
breadcrumb: true
|
||||
breadcrumb: true,
|
||||
title: 'GENERAL.TITLES.MAINTENANCE-TASKS'
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
|
@ -28,4 +28,18 @@ export class MaintenanceService extends BaseService {
|
|||
.delete<any>(url).pipe(
|
||||
catchError((error: any) => throwError(error)));
|
||||
}
|
||||
|
||||
sendUserTouchEvents(): Observable<any> {
|
||||
const url = `${this.apiBase}/events/users/touch`;
|
||||
return this.http
|
||||
.delete<any>(url).pipe(
|
||||
catchError((error: any) => throwError(error)));
|
||||
}
|
||||
|
||||
sendTenantTouchEvents(): Observable<any> {
|
||||
const url = `${this.apiBase}/events/users/touch`;
|
||||
return this.http
|
||||
.delete<any>(url).pipe(
|
||||
catchError((error: any) => throwError(error)));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
<div class="container-fluid">
|
||||
<div class="row root">
|
||||
<div class="col-md-10 offset-md-1">
|
||||
<div class="mt-4 mb-4"></div>
|
||||
<mat-card class="p-2">
|
||||
<div class="mt-2">
|
||||
<div style="color: red;">Warning: Danger zone. It might delete Dataset tags if not careful</div>
|
||||
<button mat-raised-button color="primary" (click)="generateIndex($event)" class="lightblue-btn button">Generate Index</button>
|
||||
<button mat-raised-button color="primary" (click)="clearIndex($event)" class="lightblue-btn button">Clear Index</button>
|
||||
</div>
|
||||
</mat-card>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
.root {
|
||||
// padding-bottom: 2em;
|
||||
|
||||
.button {
|
||||
margin: 5px;
|
||||
}
|
||||
}
|
|
@ -1,87 +0,0 @@
|
|||
import { Component, OnInit } from '@angular/core';
|
||||
import { BaseComponent } from '@common/base/base.component';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
import { UiNotificationService, SnackBarNotificationLevel } from '@app/core/services/notification/ui-notification-service';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { MaintenanceService } from '@app/core/services/maintenance/maintenance.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-index-managment',
|
||||
templateUrl: './index-managment.component.html',
|
||||
styleUrls: ['./index-managment.component.scss']
|
||||
})
|
||||
export class IndexManagmentComponent extends BaseComponent implements OnInit {
|
||||
|
||||
constructor(
|
||||
private uiNotificationService: UiNotificationService,
|
||||
private translate: TranslateService,
|
||||
private router: Router,
|
||||
private maintenanceService: MaintenanceService
|
||||
)
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
generateIndex(ev: Event) {
|
||||
(ev.target as HTMLButtonElement).disabled = true;
|
||||
// this.datasetService.generateIndex().pipe(takeUntil(this._destroyed)).subscribe(
|
||||
// response => {
|
||||
// (ev.target as HTMLButtonElement).disabled = false;
|
||||
// this.onCallbackSuccess();
|
||||
// },
|
||||
// error => {
|
||||
// (ev.target as HTMLButtonElement).disabled = false;
|
||||
// this.onCallbackError(error);
|
||||
// }
|
||||
// );
|
||||
this.maintenanceService.generateElasticIndex().pipe(takeUntil(this._destroyed)).subscribe(
|
||||
response => {
|
||||
(ev.target as HTMLButtonElement).disabled = false;
|
||||
this.onCallbackSuccess();
|
||||
},
|
||||
error => {
|
||||
(ev.target as HTMLButtonElement).disabled = false;
|
||||
this.onCallbackError(error);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
clearIndex(ev: Event) {
|
||||
(ev.target as HTMLButtonElement).disabled = true;
|
||||
// this.datasetService.clearIndex().pipe(takeUntil(this._destroyed)).subscribe(
|
||||
// response => {
|
||||
// (ev.target as HTMLButtonElement).disabled = false;
|
||||
// this.onCallbackSuccess();
|
||||
// },
|
||||
// error => {
|
||||
// (ev.target as HTMLButtonElement).disabled = false;
|
||||
// this.onCallbackError(error);
|
||||
// }
|
||||
// );
|
||||
this.maintenanceService.clearElasticIndex().pipe(takeUntil(this._destroyed)).subscribe(
|
||||
response => {
|
||||
(ev.target as HTMLButtonElement).disabled = false;
|
||||
this.onCallbackSuccess();
|
||||
},
|
||||
error => {
|
||||
(ev.target as HTMLButtonElement).disabled = false;
|
||||
this.onCallbackError(error);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
onCallbackSuccess(): void {
|
||||
this.uiNotificationService.snackBarNotification( this.translate.instant('GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE'), SnackBarNotificationLevel.Success);
|
||||
this.router.navigate(['/reload']).then(() => this.router.navigate(['/index-managment']));
|
||||
}
|
||||
|
||||
onCallbackError(error: any) {
|
||||
this.uiNotificationService.snackBarNotification( error, SnackBarNotificationLevel.Error);
|
||||
//this.validateAllFormFields(this.formGroup);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
import { NgModule } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
|
||||
import { IndexManagmentRoutingModule } from './index-managment.routing';
|
||||
import { IndexManagmentComponent } from './index-managment.component';
|
||||
import { CommonUiModule } from '@common/ui/common-ui.module';
|
||||
import { CommonFormsModule } from '@common/forms/common-forms.module';
|
||||
import { ConfirmationDialogModule } from '@common/modules/confirmation-dialog/confirmation-dialog.module';
|
||||
|
||||
|
||||
@NgModule({
|
||||
declarations: [IndexManagmentComponent],
|
||||
imports: [
|
||||
CommonUiModule,
|
||||
CommonFormsModule,
|
||||
ConfirmationDialogModule,
|
||||
IndexManagmentRoutingModule
|
||||
]
|
||||
})
|
||||
export class IndexManagmentModule { }
|
|
@ -1,15 +0,0 @@
|
|||
import { NgModule } from '@angular/core';
|
||||
import { Routes, RouterModule } from '@angular/router';
|
||||
import { IndexManagmentComponent } from './index-managment.component';
|
||||
import { AdminAuthGuard } from '@app/core/admin-auth-guard.service';
|
||||
|
||||
|
||||
const routes: Routes = [
|
||||
{ path: '', component: IndexManagmentComponent, canActivate: [AdminAuthGuard] },
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [RouterModule.forChild(routes)],
|
||||
exports: [RouterModule]
|
||||
})
|
||||
export class IndexManagmentRoutingModule { }
|
|
@ -1,10 +1,47 @@
|
|||
<!-- <div class="row root"> -->
|
||||
<!-- <div class="row root">
|
||||
<div class="d-flex justify-content-center">
|
||||
<mat-card class="p-4 mt-4">
|
||||
<div style="color: red;">Warning: Danger zone. Irreversible actions!</div>
|
||||
<div>
|
||||
<!-- <button mat-raised-button color="primary" (click)="migrateSemantics($event)" class="lightblue-btn button">Migrate semantics</button> -->
|
||||
<!-- <button mat-raised-button color="primary" (click)="addRdaInSemantics($event)" class="lightblue-btn button">Add rda in semantics</button> -->
|
||||
<button mat-raised-button color="primary" (click)="migrateSemantics($event)" class="lightblue-btn button">Migrate semantics</button>
|
||||
<button mat-raised-button color="primary" (click)="addRdaInSemantics($event)" class="lightblue-btn button">Add rda in semantics</button>
|
||||
</div>
|
||||
</mat-card>
|
||||
</div> -->
|
||||
<div class="container-fluid">
|
||||
<div class="row root">
|
||||
<div class="col-md-10 offset-md-1">
|
||||
<div class="row mt-4 mb-4"></div>
|
||||
<mat-accordion multi>
|
||||
<mat-expansion-panel>
|
||||
<mat-expansion-panel-header>
|
||||
<mat-panel-title>
|
||||
{{language.instant('MAINTENANCE-TASKS.SECTIONS.INDEXES.TITLE')}}
|
||||
</mat-panel-title>
|
||||
<mat-panel-description>
|
||||
{{language.instant('MAINTENANCE-TASKS.SECTIONS.INDEXES.DESCRIPTION')}}
|
||||
</mat-panel-description>
|
||||
</mat-expansion-panel-header>
|
||||
<div class="mt-2">
|
||||
<button mat-raised-button color="primary" (click)="generateIndex($event)" class="lightblue-btn button">{{language.instant('MAINTENANCE-TASKS.SECTIONS.INDEXES.ACTIONS.GENERATE-INDEX')}}</button>
|
||||
<button mat-raised-button color="primary" (click)="clearIndex($event)" class="lightblue-btn button">{{language.instant('MAINTENANCE-TASKS.SECTIONS.INDEXES.ACTIONS.CLEAR-INDEX')}}</button>
|
||||
</div>
|
||||
</mat-expansion-panel>
|
||||
<mat-expansion-panel>
|
||||
<mat-expansion-panel-header>
|
||||
<mat-panel-title>
|
||||
{{language.instant('MAINTENANCE-TASKS.SECTIONS.EVENTS.TITLE')}}
|
||||
</mat-panel-title>
|
||||
<mat-panel-description>
|
||||
{{language.instant('MAINTENANCE-TASKS.SECTIONS.EVENTS.DESCRIPTION')}}
|
||||
</mat-panel-description>
|
||||
</mat-expansion-panel-header>
|
||||
<div class="mt-2">
|
||||
<button mat-raised-button color="primary" (click)="sendUserTouchEvents($event)" class="lightblue-btn button">{{language.instant('MAINTENANCE-TASKS.SECTIONS.EVENTS.ACTIONS.SEND-USER-TOUCH')}}</button>
|
||||
<button mat-raised-button color="primary" (click)="sendTenantTouchEvents($event)" class="lightblue-btn button">{{language.instant('MAINTENANCE-TASKS.SECTIONS.EVENTS.ACTIONS.SEND-TENANT-TOUCH')}}</button>
|
||||
</div>
|
||||
</mat-expansion-panel>
|
||||
</mat-accordion>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
import { Component, OnInit } from '@angular/core';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { Router } from '@angular/router';
|
||||
import { MaintenanceService } from '@app/core/services/maintenance/maintenance.service';
|
||||
import { SnackBarNotificationLevel, UiNotificationService } from '@app/core/services/notification/ui-notification-service';
|
||||
import { BaseComponent } from '@common/base/base.component';
|
||||
import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
|
||||
@Component({
|
||||
selector: 'app-maintenance-tasks',
|
||||
|
@ -13,6 +16,8 @@ import { TranslateService } from '@ngx-translate/core';
|
|||
export class MaintenanceTasksComponent extends BaseComponent implements OnInit {
|
||||
|
||||
constructor(
|
||||
protected dialog: MatDialog,
|
||||
protected language: TranslateService,
|
||||
private maintenanceService: MaintenanceService,
|
||||
private uiNotificationService: UiNotificationService,
|
||||
private translate: TranslateService,
|
||||
|
@ -53,6 +58,130 @@ export class MaintenanceTasksComponent extends BaseComponent implements OnInit {
|
|||
// );
|
||||
// }
|
||||
|
||||
generateIndex(ev: Event) {
|
||||
this.dialog.open(ConfirmationDialogComponent, {
|
||||
data: {
|
||||
message: this.language.instant('MAINTENANCE-TASKS.CONFIRMATION.MESSAGE'),
|
||||
confirmButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.CONFIRM'),
|
||||
cancelButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.CANCEL')
|
||||
},
|
||||
maxWidth: '30em'
|
||||
})
|
||||
.afterClosed()
|
||||
.subscribe(confirm => {
|
||||
if (confirm) {
|
||||
this.doGenerateIndex(ev);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private doGenerateIndex(ev: Event) {
|
||||
(ev.target as HTMLButtonElement).disabled = true;
|
||||
this.maintenanceService.generateElasticIndex().pipe(takeUntil(this._destroyed)).subscribe(
|
||||
_ => {
|
||||
(ev.target as HTMLButtonElement).disabled = false;
|
||||
this.onCallbackSuccess();
|
||||
},
|
||||
error => {
|
||||
(ev.target as HTMLButtonElement).disabled = false;
|
||||
this.onCallbackError(error);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
clearIndex(ev: Event) {
|
||||
this.dialog.open(ConfirmationDialogComponent, {
|
||||
data: {
|
||||
message: this.language.instant('MAINTENANCE-TASKS.CONFIRMATION.MESSAGE'),
|
||||
confirmButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.CONFIRM'),
|
||||
cancelButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.CANCEL')
|
||||
},
|
||||
maxWidth: '30em'
|
||||
})
|
||||
.afterClosed()
|
||||
.subscribe(confirm => {
|
||||
if (confirm) {
|
||||
this.doClearIndex(ev);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private doClearIndex(ev: Event) {
|
||||
(ev.target as HTMLButtonElement).disabled = true;
|
||||
this.maintenanceService.clearElasticIndex().pipe(takeUntil(this._destroyed)).subscribe(
|
||||
_ => {
|
||||
(ev.target as HTMLButtonElement).disabled = false;
|
||||
this.onCallbackSuccess();
|
||||
},
|
||||
error => {
|
||||
(ev.target as HTMLButtonElement).disabled = false;
|
||||
this.onCallbackError(error);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
sendUserTouchEvents(ev: Event) {
|
||||
this.dialog.open(ConfirmationDialogComponent, {
|
||||
data: {
|
||||
message: this.language.instant('MAINTENANCE-TASKS.CONFIRMATION.MESSAGE'),
|
||||
confirmButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.CONFIRM'),
|
||||
cancelButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.CANCEL')
|
||||
},
|
||||
maxWidth: '30em'
|
||||
})
|
||||
.afterClosed()
|
||||
.subscribe(confirm => {
|
||||
if (confirm) {
|
||||
this.doSendUserTouchEvents(ev);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private doSendUserTouchEvents(ev: Event) {
|
||||
(ev.target as HTMLButtonElement).disabled = true;
|
||||
this.maintenanceService.sendUserTouchEvents().pipe(takeUntil(this._destroyed)).subscribe(
|
||||
_ => {
|
||||
(ev.target as HTMLButtonElement).disabled = false;
|
||||
this.onCallbackSuccess();
|
||||
},
|
||||
error => {
|
||||
(ev.target as HTMLButtonElement).disabled = false;
|
||||
this.onCallbackError(error);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
sendTenantTouchEvents(ev: Event) {
|
||||
this.dialog.open(ConfirmationDialogComponent, {
|
||||
data: {
|
||||
message: this.language.instant('MAINTENANCE-TASKS.CONFIRMATION.MESSAGE'),
|
||||
confirmButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.CONFIRM'),
|
||||
cancelButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.CANCEL')
|
||||
},
|
||||
maxWidth: '30em'
|
||||
})
|
||||
.afterClosed()
|
||||
.subscribe(confirm => {
|
||||
if (confirm) {
|
||||
this.doSendTenantTouchEvents(ev);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private doSendTenantTouchEvents(ev: Event) {
|
||||
(ev.target as HTMLButtonElement).disabled = true;
|
||||
this.maintenanceService.sendTenantTouchEvents().pipe(takeUntil(this._destroyed)).subscribe(
|
||||
_ => {
|
||||
(ev.target as HTMLButtonElement).disabled = false;
|
||||
this.onCallbackSuccess();
|
||||
},
|
||||
error => {
|
||||
(ev.target as HTMLButtonElement).disabled = false;
|
||||
this.onCallbackError(error);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
onCallbackSuccess(): void {
|
||||
this.uiNotificationService.snackBarNotification(this.translate.instant('GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE'), SnackBarNotificationLevel.Success);
|
||||
this.router.navigate(['/reload']).then(() => this.router.navigate(['/maintenance-tasks']));
|
||||
|
|
|
@ -119,7 +119,7 @@ export class SidebarComponent implements OnInit {
|
|||
if (this.authentication.hasPermission(AppPermission.ViewSupportiveMaterialPage)) this.adminItems.routes.push({ path: '/supportive-material', title: 'SIDE-BAR.SUPPORTIVE-MATERIAL', icon: 'help_center' });
|
||||
if (this.authentication.hasPermission(AppPermission.ViewNotificationTemplatePage)) this.adminItems.routes.push({ path: '/notification-templates', title: 'SIDE-BAR.NOTIFICATION-TEMPLATES', icon: 'grid_guides' });
|
||||
if (this.authentication.hasPermission(AppPermission.ViewNotificationPage)) this.adminItems.routes.push({ path: '/notifications', title: 'SIDE-BAR.NOTIFICATIONS', icon: 'notifications' });
|
||||
if (this.authentication.hasPermission(AppPermission.ViewMaintenancePage)) this.adminItems.routes.push({ path: '/index-managment', title: 'SIDE-BAR.MAINTENANCE', icon: 'build' });
|
||||
if (this.authentication.hasPermission(AppPermission.ViewMaintenancePage)) this.adminItems.routes.push({ path: '/maintenance-tasks', title: 'SIDE-BAR.MAINTENANCE', icon: 'build' });
|
||||
this.groupMenuItems.push(this.adminItems);
|
||||
|
||||
this.infoItems = {
|
||||
|
|
|
@ -90,7 +90,8 @@
|
|||
"USERS": "Users",
|
||||
"PROFILE": "My Profile",
|
||||
"LOGIN": "Login",
|
||||
"DATASET-OVERVIEW": "Description Overview"
|
||||
"DATASET-OVERVIEW": "Description Overview",
|
||||
"MAINTENANCE-TASKS": "Maintenance"
|
||||
},
|
||||
"FILE-TRANSFORMER": {
|
||||
"PDF": "PDF",
|
||||
|
@ -271,6 +272,29 @@
|
|||
"PRIVATE": "Hidden"
|
||||
}
|
||||
},
|
||||
"MAINTENANCE-TASKS": {
|
||||
"SECTIONS": {
|
||||
"INDEXES": {
|
||||
"TITLE": "Manage indexes",
|
||||
"DESCRIPTION": "From here you can manage the Elastic indexes",
|
||||
"ACTIONS": {
|
||||
"GENERATE-INDEX": "Generate Index",
|
||||
"CLEAR-INDEX": "Clear Index"
|
||||
}
|
||||
},
|
||||
"EVENTS": {
|
||||
"TITLE": "Manage events",
|
||||
"DESCRIPTION": "From here you can manage the Message Queue events",
|
||||
"ACTIONS": {
|
||||
"SEND-USER-TOUCH": "Send user touch events",
|
||||
"SEND-TENANT-TOUCH": "Send tenant touch events"
|
||||
}
|
||||
}
|
||||
},
|
||||
"CONFIRMATION": {
|
||||
"MESSAGE": "Are you sure you want to perform this action?"
|
||||
}
|
||||
},
|
||||
"DESCRIPTION-TEMPLATE-EDITOR": {
|
||||
"TITLE": {
|
||||
"NEW": "New API Client",
|
||||
|
|
Loading…
Reference in New Issue