feat: tour integration
Tour Integration
This commit is contained in:
@@ -1,13 +1,17 @@
|
||||
/** Angular Imports */
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { Component, OnInit, TemplateRef, ElementRef, ViewChild, AfterViewInit } from '@angular/core';
|
||||
import { MatPaginator } from '@angular/material/paginator';
|
||||
import { MatSort } from '@angular/material/sort';
|
||||
import { MatTableDataSource } from '@angular/material/table';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
|
||||
/** rxjs Imports */
|
||||
import { of } from 'rxjs';
|
||||
|
||||
/** Custom Services */
|
||||
import { PopoverService } from '../../configuration-wizard/popover/popover.service';
|
||||
import { ConfigurationWizardService } from '../../configuration-wizard/configuration-wizard.service';
|
||||
|
||||
/**
|
||||
* Manage Data Tables component.
|
||||
*/
|
||||
@@ -16,7 +20,7 @@ import { of } from 'rxjs';
|
||||
templateUrl: './manage-data-tables.component.html',
|
||||
styleUrls: ['./manage-data-tables.component.scss']
|
||||
})
|
||||
export class ManageDataTablesComponent implements OnInit {
|
||||
export class ManageDataTablesComponent implements OnInit, AfterViewInit {
|
||||
|
||||
/** Data table data. */
|
||||
dataTableData: any;
|
||||
@@ -30,11 +34,26 @@ export class ManageDataTablesComponent implements OnInit {
|
||||
/** Sorter for manage data tables table. */
|
||||
@ViewChild(MatSort, { static: true }) sort: MatSort;
|
||||
|
||||
/* Reference of create datatables button */
|
||||
@ViewChild('createDatatableRef') createDatatableRef: ElementRef<any>;
|
||||
/* Template for popover on create datatables button */
|
||||
@ViewChild('templateCreateDatatableRef') templateCreateDatatableRef: TemplateRef<any>;
|
||||
/* Reference of list of datatables */
|
||||
@ViewChild('datatablesList') datatablesList: ElementRef<any>;
|
||||
/* Template for popover on list of datatables */
|
||||
@ViewChild('templateDatatablesList') templateDatatablesList: TemplateRef<any>;
|
||||
|
||||
/**
|
||||
* Retrieves the data tables data from `resolve`.
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
* @param {Router} router Router.
|
||||
* @param {ConfigurationWizardService} configurationWizardService ConfigurationWizard Service.
|
||||
* @param {PopoverService} popoverService PopoverService.
|
||||
*/
|
||||
constructor(private route: ActivatedRoute) {
|
||||
constructor(private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private configurationWizardService: ConfigurationWizardService,
|
||||
private popoverService: PopoverService) {
|
||||
this.route.data.subscribe(( data: { dataTables: any }) => {
|
||||
this.dataTableData = data.dataTables;
|
||||
});
|
||||
@@ -64,4 +83,50 @@ export class ManageDataTablesComponent implements OnInit {
|
||||
this.dataSource.sort = this.sort;
|
||||
}
|
||||
|
||||
/**
|
||||
* Popover function
|
||||
* @param template TemplateRef<any>.
|
||||
* @param target HTMLElement | ElementRef<any>.
|
||||
* @param position String.
|
||||
* @param backdrop Boolean.
|
||||
*/
|
||||
showPopover(template: TemplateRef<any>, target: HTMLElement | ElementRef<any>, position: string, backdrop: boolean): void {
|
||||
setTimeout(() => this.popoverService.open(template, target, position, backdrop, {}), 200);
|
||||
}
|
||||
|
||||
/**
|
||||
* To show popover.
|
||||
*/
|
||||
ngAfterViewInit() {
|
||||
if (this.configurationWizardService.showDatatablesPage === true) {
|
||||
setTimeout(() => {
|
||||
this.showPopover(this.templateCreateDatatableRef, this.createDatatableRef.nativeElement, 'bottom', true);
|
||||
});
|
||||
}
|
||||
if (this.configurationWizardService.showDatatablesList === true) {
|
||||
setTimeout(() => {
|
||||
this.showPopover(this.templateDatatablesList, this.datatablesList.nativeElement, 'top', true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Next Step (Create data tables Page) Configuration Wizard.
|
||||
*/
|
||||
nextStep() {
|
||||
this.configurationWizardService.showDatatablesPage = false;
|
||||
this.configurationWizardService.showDatatablesList = false;
|
||||
this.configurationWizardService.showDatatablesForm = true;
|
||||
this.router.navigate(['/system/data-tables/create']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Previous Step (Manage Datables system Page) Configuration Wizard.
|
||||
*/
|
||||
previousStep() {
|
||||
this.configurationWizardService.showDatatablesPage = false;
|
||||
this.configurationWizardService.showDatatablesList = false;
|
||||
this.configurationWizardService.showDatatables = true;
|
||||
this.router.navigate(['/system']);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user