Commit 4dd19fa0 authored by Marco Ortiz's avatar Marco Ortiz

Preparación para la integración con el nuevo jenkins

parent 9fb7b93f
This diff is collapsed.
......@@ -11,18 +11,22 @@ import { TranslateModule, TranslateLoader, TranslateService } from '@ngx-transla
// XDF
import { XdfLayoutsModule, SettingsService, ByteSettingsService, SettingsFakeBackendInterceptor } from '@xdf/layouts';
import { XdfSecurityModule, ByteAuthenticationService, AuthGuard, OAuthGuard, OAuthAuthenticationService, ResourceAuthGuard, AuthenticationFakeBackendInterceptor, ProgramsFakeBackendInterceptor } from '@xdf/security';
import { XdfCommonsModule, NotificationService, ToastNotificationService, AuthenticationService, INITSERVICE_OPTIONS, InitCommonsService, ErrorsHandler } from '@xdf/commons';
import { XdfSecurityModule, ByteAuthenticationService, AuthGuard, OAuthGuard, OAuthAuthenticationService } from '@xdf/security';
import { ResourceAuthGuard, AuthenticationFakeBackendInterceptor, ProgramsFakeBackendInterceptor } from '@xdf/security';
import { XdfCommonsModule, NotificationService, ToastNotificationService, AuthenticationService } from '@xdf/commons';
import { INITSERVICE_OPTIONS, InitCommonsService, ErrorsHandler } from '@xdf/commons';
//Components
// Components
import { AppComponent } from './app.component';
import { HomeComponent } from './views/home/home.component';
import { ToastrModule } from 'ngx-toastr';
import localeEs from '@angular/common/locales/es-PE';
import localeEn from '@angular/common/locales/en';
import { MAT_DATE_LOCALE, MatDialog, MatButtonModule, MatDialogModule, MatPaginatorIntl, DateAdapter, MAT_DATE_FORMATS, MatIconModule } from '@angular/material';
import { XdfGalleryModule, CustomMatPaginatorIntl, DATERANGEPICKER_LOCALE, DaterangepickerLocaleService, ConflictErrorDialogService, HttpErrorHandleInterceptor } from '@xdf/gallery';
import { MAT_DATE_LOCALE, MatDialog, MatButtonModule, MatDialogModule, MatPaginatorIntl, DateAdapter } from '@angular/material';
import { MAT_DATE_FORMATS, MatIconModule } from '@angular/material';
import { XdfGalleryModule, CustomMatPaginatorIntl, DATERANGEPICKER_LOCALE, DaterangepickerLocaleService } from '@xdf/gallery';
import { ConflictErrorDialogService, HttpErrorHandleInterceptor } from '@xdf/gallery';
import { BytebotSettingsService } from './services/bytebot-settings-service';
import { MultiTranslateHttpLoader } from 'ngx-translate-multi-http-loader';
......@@ -126,7 +130,7 @@ export function createTranslateLoader(http: HttpClient) {
{ provide: HTTP_INTERCEPTORS, useClass: SettingsFakeBackendInterceptor, multi: true },
{ provide: HTTP_INTERCEPTORS, useClass: CustomProgramsFakeBackendInterceptor, multi: true },
{ provide: HTTP_INTERCEPTORS, useClass: AgentFakeBackendInterceptor, multi: true },
//{ provide: HTTP_INTERCEPTORS, useClass: OperativeDashboardFakeBackendInterceptor, multi: true },
// { provide: HTTP_INTERCEPTORS, useClass: OperativeDashboardFakeBackendInterceptor, multi: true },
{ provide: APP_INITIALIZER, useFactory: init_app, deps: [InitCommonsService, TranslateService], multi: true }
......@@ -147,4 +151,4 @@ export function init_app(appLoaderService: InitCommonsService) {
// Para OAUTH
export function loginLoaderFactory(provider: OAuthAuthenticationService) {
return () => provider.login(null, null).toPromise();
}
\ No newline at end of file
}
......@@ -6,81 +6,80 @@ import {
HttpInterceptor,
HttpErrorResponse
} from '@angular/common/http';
import { Observable, throwError, of, EMPTY } from 'rxjs';
import { Injectable } from '@angular/core';
import { catchError, tap, map } from 'rxjs/operators';
import { TranslateService } from '@ngx-translate/core';
import { NotificationService, NotificationType, AuthenticationService } from '@xdf/commons';
import { Router } from '@angular/router';
import { Observable, throwError, of, EMPTY } from 'rxjs';
import { Injectable } from '@angular/core';
import { catchError, tap, map } from 'rxjs/operators';
import { TranslateService } from '@ngx-translate/core';
import { NotificationService, NotificationType, AuthenticationService } from '@xdf/commons';
import { Router } from '@angular/router';
import { ConflictErrorDialogService } from '@xdf/gallery';
@Injectable()
export class CustomErrorHandlerInterceptor implements HttpInterceptor {
constructor(
private router: Router,
private translate: TranslateService,
private authenticationService: AuthenticationService,
private notificationService: NotificationService,
private conflictErrorDialogService: ConflictErrorDialogService) {
}
intercept(
req: HttpRequest<any>, next: HttpHandler): Observable<any> {
return next.handle(req).pipe(
catchError((error: HttpErrorResponse) => {
switch (error.status) {
case 401:
const message = this.translate.instant('message.error.unauthorized');
this.notificationService.showMessage(message, this.translate.instant('title.error'), NotificationType.error);
break;
case 404:
const messageError = error.error ? error.error : error.message;
this.notificationService.showMessage(messageError, this.translate.instant('title.error'), NotificationType.error);
break;
case 409:
const messageDuplicate = this.translate.instant('message.error.duplicated');
this.notificationService.showMessage(messageDuplicate, this.translate.instant('title.error'), NotificationType.error);
break;
case 419:// validar cual es el código correcto
this.conflictErrorDialogService.loadComponent(
null,
'title.error.conflict',
'message.error.conflict',
error.error);
break;
default:
if (error.status === 0) {
this.authenticationService.login(null, null).subscribe(
data => {
window.location.href = './';
@Injectable()
export class CustomErrorHandlerInterceptor implements HttpInterceptor {
constructor(
private router: Router,
private translate: TranslateService,
private authenticationService: AuthenticationService,
private notificationService: NotificationService,
private conflictErrorDialogService: ConflictErrorDialogService) {
}
intercept(
req: HttpRequest<any>, next: HttpHandler): Observable<any> {
return next.handle(req).pipe(
catchError((error: HttpErrorResponse) => {
switch (error.status) {
case 401:
const message = this.translate.instant('message.error.unauthorized');
this.notificationService.showMessage(message, this.translate.instant('title.error'), NotificationType.error);
break;
case 404:
const messageError = error.error ? error.error : error.message;
this.notificationService.showMessage(messageError, this.translate.instant('title.error'), NotificationType.error);
break;
case 409:
const messageDuplicate = this.translate.instant('message.error.duplicated');
this.notificationService.showMessage(messageDuplicate, this.translate.instant('title.error'), NotificationType.error);
break;
case 419: // validar cual es el código correcto
this.conflictErrorDialogService.loadComponent(
null,
'title.error.conflict',
'message.error.conflict',
error.error);
break;
default:
if (error.status === 0) {
this.authenticationService.login(null, null).subscribe(
data => {
window.location.href = './';
});
} else {
let messageDefault = '';
if (error.error) {
if (error.error.params) {
const params = [];
error.error.params.forEach(element => {
params.push(this.translate.instant(element));
});
} else {
let message = '';
if (error.error) {
if (error.error.params) {
const params = [];
error.error.params.forEach(element => {
params.push(this.translate.instant(element));
});
message = this.translate.instant(error.error.message, params);
messageDefault = this.translate.instant(error.error.message, params);
} else {
if (error.error.message) {
messageDefault = this.translate.instant(error.error.message);
} else {
if (error.error.message) {
message = this.translate.instant(error.error.message);
} else {
message = this.translate.instant(error.error);
}
messageDefault = this.translate.instant(error.error);
}
} else {
message = this.translate.instant(error.message);
}
this.notificationService.showMessage(message, this.translate.instant('title.error'), NotificationType.error);
} else {
messageDefault = this.translate.instant(error.message);
}
this.notificationService.showMessage(messageDefault, this.translate.instant('title.error'), NotificationType.error);
}
return throwError(error);
})
);
}
}
return throwError(error);
})
);
}
\ No newline at end of file
}
......@@ -28,7 +28,7 @@ export class CustomProgramsFakeBackendInterceptor implements HttpInterceptor {
case url.match('.*' + basePath) && method === 'GET':
return getList();
case url.match('.*'+ basePathCotnrols + '.*') && method === 'GET':
case url.match('.*' + basePathCotnrols + '.*') && method === 'GET':
return getControls();
default:
// pass through any requests not handled above
......
......@@ -12,7 +12,7 @@ import { CountryDataForWizardResolver } from './resolver/country-data-wizard.res
const routes: Routes = [
{
path: 'agent', component: AgentListComponent, canActivate: [AuthGuard, ResourceAuthGuard],
path: 'agent', component: AgentListComponent, canActivate: [AuthGuard, ResourceAuthGuard],
data: {
program: 'CONVERSATIONAL_AGENT',
// breadcrumb: ''
......@@ -20,7 +20,7 @@ const routes: Routes = [
},
{
path: 'agent/detail/new',
//component: AgentDetailComponent,
// component: AgentDetailComponent,
component: AgentComponent,
resolve: {
countryData : CountryDataForWizardResolver
......@@ -36,7 +36,7 @@ const routes: Routes = [
},
{
path: 'agent/detail/edit/:code',
//component: AgentDetailComponent,
// component: AgentDetailComponent,
component: AgentComponent,
resolve: {
agentDetail: AgentDetailResolver,
......@@ -50,9 +50,9 @@ const routes: Routes = [
breadcrumb: 'Agentes',
backButton: true
}
},{
}, {
path: 'agent/detail/view/:code',
//component: AgentDetailComponent,
// component: AgentDetailComponent,
component: AgentComponent,
resolve: {
agentDetail: AgentDetailResolver,
......
......@@ -6,7 +6,15 @@ import {NgxTributeModule} from 'ngx-tribute';
import { MaterialFileInputModule } from 'ngx-material-file-input';
import { XdfGalleryModule } from '@xdf/gallery';
import { MatProgressSpinnerModule, MatDividerModule, MatSidenavModule, MatListModule, MatStepperModule, MatDialogModule, MatMenuModule, MatIconModule, MatSlideToggleModule, MatCheckboxModule, MatRippleModule, MatNativeDateModule, MatChipsModule, MatExpansionModule, MatTooltipModule, MatToolbarModule, MatTabsModule, MatTableModule, MatSortModule, MatSelectModule, MatRadioModule, MatPaginatorModule, MatInputModule, MatFormFieldModule, MatButtonToggleModule, MatButtonModule, MatCardModule, MatAutocompleteModule, MatSnackBarModule, MatProgressBarModule } from '@angular/material';
import { MatProgressSpinnerModule, MatDividerModule, MatSidenavModule, MatListModule } from '@angular/material';
import { MatStepperModule, MatDialogModule, MatMenuModule, MatIconModule } from '@angular/material';
import { MatSlideToggleModule, MatCheckboxModule, MatRippleModule, MatNativeDateModule } from '@angular/material';
import { MatChipsModule, MatExpansionModule, MatTooltipModule, MatToolbarModule } from '@angular/material';
import { MatTabsModule, MatTableModule, MatSortModule, MatSelectModule, MatRadioModule } from '@angular/material';
import { MatPaginatorModule, MatInputModule, MatFormFieldModule, MatButtonToggleModule } from '@angular/material';
import { MatButtonModule, MatCardModule, MatAutocompleteModule, MatSnackBarModule } from '@angular/material';
import { MatProgressBarModule } from '@angular/material';
import { SlickCarouselModule } from 'ngx-slick-carousel';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
......@@ -23,17 +31,15 @@ import { CaDeploymentChannelsModalComponent } from './view/components/ca-deploym
import { AgentStatusPipe } from './pipe/agent-status.pipe';
import { CaFileUploadModalComponent } from './view/components/ca-file-upload-modal/ca-file-upload-modal.component';
@NgModule({
entryComponents: [
CaDeploymentChannelsModalComponent,
CaFileUploadModalComponent
],
declarations: [
AgentComponent,
AgentListComponent,
AgentDetailComponent,
declarations: [
AgentComponent,
AgentListComponent,
AgentDetailComponent,
DynamicTranslatePipe,
CaGeneralInformationComponent,
CaFrequentQuestionsComponent,
......
......@@ -11,7 +11,7 @@ export class DynamicTranslatePipe implements PipeTransform {
}
transform(value: any, ...args: any[]): any {
let lang = this.translateService.currentLang ? this.translateService.currentLang : this.translateService.defaultLang;
const lang = this.translateService.currentLang ? this.translateService.currentLang : this.translateService.defaultLang;
let traductions;
......
......@@ -5,7 +5,7 @@ import { Observable } from 'rxjs';
@Injectable({ providedIn: 'root' })
export class AgentDataForWizardResolver implements Resolve<any> {
constructor(private service: AgentService) {}
resolve(
......@@ -13,8 +13,8 @@ export class AgentDataForWizardResolver implements Resolve<any> {
state: RouterStateSnapshot
): Observable<any>|Promise<any>|any {
let code = route.paramMap.get('code');
const code = route.paramMap.get('code');
return this.service.getDataForWizard(parseInt(code));
return this.service.getDataForWizard(parseInt(code, 10));
}
}
......@@ -5,7 +5,7 @@ import { Observable } from 'rxjs';
@Injectable({ providedIn: 'root' })
export class AgentDetailResolver implements Resolve<any> {
constructor(private service: AgentService) {}
resolve(
......@@ -13,8 +13,8 @@ export class AgentDetailResolver implements Resolve<any> {
state: RouterStateSnapshot
): Observable<any>|Promise<any>|any {
let code = route.paramMap.get('code');
const code = route.paramMap.get('code');
return this.service.getResult(code);
}
}
......@@ -5,7 +5,7 @@ import { Observable } from 'rxjs';
@Injectable({ providedIn: 'root' })
export class CountryDataForWizardResolver implements Resolve<any> {
constructor(private service: AgentService) {}
resolve(
......
......@@ -21,7 +21,7 @@ export class AgentService extends DynaDataService {
};
}
return this.httpClient.get(this.serviceURL + '/connection/data', {
params: params
params
});
}
......@@ -40,7 +40,7 @@ export class AgentService extends DynaDataService {
return this.httpClient.get(this.serviceURL + '/channels');
}
synchronize(id: number, user:string) {
synchronize(id: number, user: string) {
return this.httpClient.get(this.serviceURL + '/synchronize/' + id, {
params: {
user
......
import { Component, OnInit, ViewChild, ViewContainerRef, Input } from '@angular/core';
import { Component, OnInit, ViewChild, ViewContainerRef, Input, AfterViewInit } from '@angular/core';
import { MatPaginator, MatSort } from '@angular/material';
import { ColumnTemplate, DynaDataSource, ConfirmationDialogService, extractRSQL, FieldFilter } from '@xdf/gallery';
import { Pagination, SortField, NotificationType, NotificationService, AuthenticationService } from '@xdf/commons';
......@@ -135,7 +135,9 @@ const columnTemplateArray = [
const fieldFilters = [
new FieldFilter('agent_code', 'id', 'id', 'number', undefined),
new FieldFilter('agent_name', 'name', 'name', 'string', undefined),
new FieldFilter('agent_status', 'status', 'status', 'valpos', ({ 'DP': 'label.deployed', 'PS': 'label.sync-pending' }) as any),
new FieldFilter('agent_status', 'status', 'status', 'valpos', (
{ DP: 'label.deployed', PS: 'label.sync-pending' }
) as any),
];
@Component({
......@@ -143,7 +145,7 @@ const fieldFilters = [
templateUrl: './agent-list.component.html',
styleUrls: ['./agent-list.component.scss']
})
export class AgentListComponent implements OnInit {
export class AgentListComponent implements OnInit, AfterViewInit {
@ViewChild(MatPaginator, { static: false }) paginator: MatPaginator;
@ViewChild(MatSort, { static: false }) sort: MatSort;
......@@ -232,7 +234,7 @@ export class AgentListComponent implements OnInit {
this.pagination.currentPage = 0;
this.pagination.itemsPerPage = this.pagingSize;
this.pagination.filterExpression = "id != 0";
this.pagination.filterExpression = 'id != 0';
// Ordenación por defecto
if (this.sortColumn && this.sortDirection) {
......@@ -264,14 +266,14 @@ export class AgentListComponent implements OnInit {
for (let i = 0; i < tagsTemp.length; i++) {
if (tagsTemp[i].column !== 'id') {
tagsTemp[i].value = tagsTemp[i].value;
tagsTemp[i].value = tags[i].value;
}
}
this.pagination.filterExpression = extractRSQL(tagsTemp);
if (this.pagination.filterExpression == null || this.pagination.filterExpression == undefined) {
this.pagination.filterExpression = "id != 0";
if (this.pagination.filterExpression === null || this.pagination.filterExpression === undefined) {
this.pagination.filterExpression = 'id != 0';
}
this.dataSource.load(this.pagination);
......@@ -289,9 +291,10 @@ export class AgentListComponent implements OnInit {
if (result) {
this.agentService.delete(item.id).subscribe((rslt: any) => {
if (rslt.statusCode != 200) {
if (rslt.statusCode !== 200) {
this.notificationService.showMessage(
this.translateService.instant(rslt.message), this.translateService.instant('label.error.message.title'), NotificationType.error);
this.translateService.instant(rslt.message), this.translateService.instant('label.error.message.title'),
NotificationType.error);
} else {
this.dataSource.load(this.pagination);
}
......@@ -308,10 +311,10 @@ export class AgentListComponent implements OnInit {
}
synchronize(item) {
let user = (this.authenticationService.currentUserValue ? this.authenticationService.currentUserValue.username : 'admin');
const user = (this.authenticationService.currentUserValue ? this.authenticationService.currentUserValue.username : 'admin');
this.agentService.synchronize(item.id, user).pipe(first()).subscribe(() => {
this.notificationService.showMessage(this.translateService.instant("agent.synchronize.success"), undefined, NotificationType.success);
this.notificationService.showMessage(this.translateService.instant('agent.synchronize.success'), undefined, NotificationType.success);
this.onRefresh();
});
}
......
......@@ -15,7 +15,7 @@
{{'label.general-information.description' | translate}}
</div>
</ng-template>
<byte-ca-general-information [stepper]="stepper" (onNextPage)="updateDirtyStatus($event)"></byte-ca-general-information>
<byte-ca-general-information [stepper]="stepper" (nextPage)="updateDirtyStatus($event)"></byte-ca-general-information>
</mat-step>
<mat-step state="questions">
......@@ -25,7 +25,7 @@
{{'label.questions.description' | translate}}
</div>
</ng-template>
<byte-ca-frequent-questions [stepper]="stepper" (onNextPage)="updateDirtyStatus($event)"></byte-ca-frequent-questions>
<byte-ca-frequent-questions [stepper]="stepper" (nextPage)="updateDirtyStatus($event)"></byte-ca-frequent-questions>
</mat-step>
<mat-step state="deployment-channels">
......
import { Component, OnInit, ViewChild, Input, AfterContentChecked, AfterViewInit, ChangeDetectionStrategy, AfterContentInit, ViewContainerRef } from '@angular/core';
import { Component, OnInit, ViewChild, Input, AfterContentChecked, AfterViewInit } from '@angular/core';
import { ChangeDetectionStrategy, AfterContentInit, ViewContainerRef } from '@angular/core';
import { FormGroup, Validators, FormBuilder } from '@angular/forms';
import { CaGeneralInformationComponent } from '../components/ca-general-information/ca-general-information.component';
import { MAT_STEPPER_GLOBAL_OPTIONS } from '@angular/cdk/stepper';
import { STEPPER_GLOBAL_OPTIONS } from '@angular/cdk/stepper';
import { ActivatedRoute, Router } from '@angular/router';
import { NavigationService } from '@xdf/layouts';
import { IDirty } from '@xdf/gallery';
......@@ -14,7 +15,7 @@ import { CaDeploymentChannelsComponent } from '../components/ca-deployment-chann
templateUrl: './agent.component.html',
styleUrls: ['./agent.component.scss'],
providers: [{
provide: MAT_STEPPER_GLOBAL_OPTIONS, useValue: { displayDefaultIndicatorType: false }
provide: STEPPER_GLOBAL_OPTIONS, useValue: { displayDefaultIndicatorType: false }
}]
})
......@@ -38,18 +39,18 @@ export class AgentComponent implements OnInit, IDirty {
resourceAuth: any;
//dirty acumulado
generalDirty: boolean = false;
// dirty acumulado
generalDirty = false;
constructor(
private _vcRef: ViewContainerRef,
private _activatedRoute: ActivatedRoute,
private _backService: NavigationService,
private _router: Router
private vcRef: ViewContainerRef,
private activatedRoute: ActivatedRoute,
private backService: NavigationService,
private router: Router
) {
this._backService.backAnnounced$.subscribe(data => {
this._router.navigate(['/configuration/agent']);
this.backService.backAnnounced$.subscribe(data => {
this.router.navigate(['/configuration/agent']);
});
}
......@@ -60,21 +61,21 @@ export class AgentComponent implements OnInit, IDirty {
|| this.frequentQuestionsComponent.isDirty();
if (dirty) {
dirty = this.deploymentChannelsComponent.isDirty()
dirty = this.deploymentChannelsComponent.isDirty();
}
return dirty;
}
getRef(): ViewContainerRef {
return this._vcRef;
return this.vcRef;
}
ngOnInit() {
this.stepper.selectedIndex = 0;
const authList = this._activatedRoute.snapshot.paramMap['authorization'];
const authList = this.activatedRoute.snapshot.paramMap['authorization'];
this.resourceAuth = new Object();
......@@ -86,13 +87,13 @@ export class AgentComponent implements OnInit, IDirty {
console.log(this.resourceAuth);
this.isNew = this._activatedRoute.snapshot.data.mode === 'create';
this.isNew = this.activatedRoute.snapshot.data.mode === 'create';
if (this.isNew) {
this.agentDetail = {
};
} else {
this.agentDetail = this._activatedRoute.snapshot.data.agentDetail;
this.agentDetail = this.activatedRoute.snapshot.data.agentDetail;
}
......
......@@ -10,7 +10,7 @@ export class CaDeploymentChannelsModalComponent implements OnInit {
channels: Array<any>;
selectedChannel: any;
applicationSettings:any;
applicationSettings: any;
constructor(
public dialogRef: MatDialogRef<CaDeploymentChannelsModalComponent>,
......
......@@ -15,9 +15,11 @@ import { Form, FormControl, FormGroup, FormGroupDirective, NgForm } from '@angul
})
export class CaDeploymentChannelsComponent implements OnInit {
@Input() stepper: MatStepper;
@Input()
stepper: MatStepper;
@Input() changes: boolean = false;
@Input()
changes = false;
@ViewChild('fieldForm', {static: false})
fieldFormList: any;
......@@ -25,13 +27,13 @@ export class CaDeploymentChannelsComponent implements OnInit {
agentDetail: any;
channels: Array<any>;
deploymentChannels: Array<any> = new Array<any>();
dirty: boolean = true;
dirty = true;
step = -1;
viewMode: boolean = false;
isAvaliableChannels: boolean = false;
mode: string = 'new';
detailText: string = "Detail";
titleText: string = "Titulo"
viewMode = false;
isAvaliableChannels = false;
mode = 'new';
detailText = 'Detail';
titleText = 'Titulo';
constructor(
private activatedRoute: ActivatedRoute,
......@@ -70,8 +72,8 @@ export class CaDeploymentChannelsComponent implements OnInit {
buildList() {
if (this.channels && this.deploymentChannels) {
for (let deploymentChannel of this.deploymentChannels) {
for (let channel of this.channels) {
for (const deploymentChannel of this.deploymentChannels) {
for (const channel of this.channels) {
if (channel.id === deploymentChannel.channelId) {
......@@ -82,8 +84,8 @@ export class CaDeploymentChannelsComponent implements OnInit {
deploymentChannel.suggestDetail = channel.suggestDetail;
for (let parameter of deploymentChannel.parameters) {
for (let field of channel.parameters) {
for (const parameter of deploymentChannel.parameters) {
for (const field of channel.parameters) {
if (parameter.channelParamName === field.name) {
parameter.label = field.label;
......@@ -107,10 +109,10 @@ export class CaDeploymentChannelsComponent implements OnInit {
buildAvaliableChannels() {
this.isAvaliableChannels = false;
mainLoop: for (let channel of this.channels) {
mainLoop: for (const channel of this.channels) {
channel.disabled = false;
for (let deploymentChannel of this.deploymentChannels) {
for (const deploymentChannel of this.deploymentChannels) {
if (channel.id === deploymentChannel.channelId) {
channel.disabled = true;
continue mainLoop;
......@@ -123,7 +125,7 @@ export class CaDeploymentChannelsComponent implements OnInit {
}
addChannel() {
let dialog = this.matDialog.open(CaDeploymentChannelsModalComponent, {
const dialog = this.matDialog.open(CaDeploymentChannelsModalComponent, {
width: '500px',
data: {
message: '',
......@@ -133,7 +135,7 @@ export class CaDeploymentChannelsComponent implements OnInit {
dialog.afterClosed().subscribe(result => {
if (result) {
let selectedChannel = { ...result };
const selectedChannel = { ...result };
selectedChannel.channelId = selectedChannel.id;
selectedChannel.channelName = selectedChannel.name;
......@@ -163,7 +165,7 @@ export class CaDeploymentChannelsComponent implements OnInit {
}
save() {
let isValid: boolean = this.validate();
const isValid: boolean = this.validate();
if (!isValid) {
if (this.fieldFormList && this.fieldFormList.control) {
......@@ -172,7 +174,7 @@ export class CaDeploymentChannelsComponent implements OnInit {
return;
}
let agent: any = {};
const agent: any = {};
agent.id = this.agentDetail.id;
agent.name = this.agentDetail.name;
......@@ -186,8 +188,8 @@ export class CaDeploymentChannelsComponent implements OnInit {
agent.status = this.agentDetail.status;
agent.deploymentChannels = [];
for (let deploymentChannel of this.deploymentChannels) {
let deploymentChannelTmp: any = {};
for (const deploymentChannel of this.deploymentChannels) {
const deploymentChannelTmp: any = {};
deploymentChannelTmp.id = deploymentChannel.id;
deploymentChannelTmp.name = deploymentChannel.name;
......@@ -195,8 +197,8 @@ export class CaDeploymentChannelsComponent implements OnInit {
deploymentChannelTmp.channelId = deploymentChannel.channelId;
deploymentChannelTmp.parameters = [];
for (let parameter of deploymentChannel.parameters) {
let parameterTmp: any = {};
for (const parameter of deploymentChannel.parameters) {
const parameterTmp: any = {};
parameterTmp.id = parameter.id;
parameterTmp.value = parameter.value;
......@@ -238,22 +240,22 @@ export class CaDeploymentChannelsComponent implements OnInit {
validate(): boolean {
let valid = true;
mainLoop: for (let deploymentChannel of this.deploymentChannels) {
let deploymentChannelTmp: any = {};
mainLoop: for (const deploymentChannel of this.deploymentChannels) {
const deploymentChannelTmp: any = {};
// if (!deploymentChannel.name) {
// valid = false;
// break;
// }
for (let parameter of deploymentChannel.parameters) {
for (const parameter of deploymentChannel.parameters) {
parameter.error = false;
if (!parameter.value) {
valid = false;
break mainLoop;
}
if (parameter.regex) {
let regex = new RegExp(parameter.regex);
const regex = new RegExp(parameter.regex);
if (!regex.test(parameter.value)) {
parameter.error = true;
valid = false;
......
......@@ -39,19 +39,19 @@ export class CaFileUploadModalComponent implements OnInit {
dataSource = new MatTableDataSource([]);
displayedColumns: string[] = [];
applicationSettings:any;
applicationSettings: any;
constructor(
private formBuilder: FormBuilder,
private agentService: AgentService,
private _notificationService: NotificationService,
private _translateService: TranslateService,
private notificationService: NotificationService,
private translateService: TranslateService,
public dialogRef: MatDialogRef<CaFileUploadModalComponent>,
@Inject(MAT_DIALOG_DATA) public data: any
) {
this.formGroup = this.formBuilder.group({
description: new FormControl({ value: "", disabled: false }),
description: new FormControl({ value: '', disabled: false }),
file: new FormControl({ value: '', disabled: false }),
filename: new FormControl({ value: '', disabled: true })
});
......@@ -72,20 +72,20 @@ export class CaFileUploadModalComponent implements OnInit {
buildErrorDetail(status, detail) {
this.fileErrorDetail = undefined;
if ("CONTENT_ERROR" === status) {
if ('CONTENT_ERROR' === status) {
this.displayedColumns = ['line', 'type', 'value'];
if (detail) {
let fileErrorDetailTemp = [];
const fileErrorDetailTemp = [];
for (let line of Object.keys(detail)) {
let object = detail[line];
for (const line of Object.keys(detail)) {
const object = detail[line];
let type = Object.keys(object)[0];
const type = Object.keys(object)[0];
fileErrorDetailTemp.push({
line: line,
type: type,
line,
type,
value: object[type],
});
}
......@@ -97,18 +97,18 @@ export class CaFileUploadModalComponent implements OnInit {
}
} else if ("HEADER_ERROR" === status) {
} else if ('HEADER_ERROR' === status) {
this.displayedColumns = ['header', 'value'];
if (detail) {
let fileErrorDetailTemp = [];
const fileErrorDetailTemp = [];
for (let header of Object.keys(detail)) {
let value = detail[header];
for (const header of Object.keys(detail)) {
const value = detail[header];
fileErrorDetailTemp.push({
header: header,
value: value,
header,
value,
});
}
......@@ -131,17 +131,17 @@ export class CaFileUploadModalComponent implements OnInit {
if (event[i] instanceof File) {
const reader = new FileReader();
reader.onload = () => {
//this.formGroup.controls['imageAvatar'].setValue(reader.result as string);
// this.formGroup.controls['imageAvatar'].setValue(reader.result as string);
};
reader.readAsDataURL(event[i]);
let fileSelected = {
const fileSelected = {
data: event[i],
state: 'in',
inProgress: false,
progress: 0,
canRetry: false
}
};
this.validateFile(fileSelected);
}
......@@ -174,12 +174,12 @@ export class CaFileUploadModalComponent implements OnInit {
if (typeof (event) === 'object') {
this.fileErrorDetail = undefined;
this.enabledOK = false;
let info = event.body;
const info = event.body;
this.fileInfo = new FileUploadModel();
if (info) {
let status = info.fileValidationResult.status;
const status = info.fileValidationResult.status;
if ("OK" === status) {
if ('OK' === status) {
this.fileInfo.id = info.id;
this.fileInfo.description = this.formGroup.controls.description.value;
this.fileInfo.uuid = info.uuid;
......@@ -191,20 +191,21 @@ export class CaFileUploadModalComponent implements OnInit {
this.enabledOK = true;
this.fileErrorDetail = undefined;
} else if ("INCOMPATIBLE_EXTENSION" === status) {
} else if ('INCOMPATIBLE_EXTENSION' === status) {
this.formGroup.controls.file.setValue(null);
let message = "label.file.incompatible.extension";
const message = 'label.file.incompatible.extension';
this.enabledOK = false;
this.fileErrorDetail = undefined;
this._notificationService.showMessage(this._translateService.instant(message) + "[" + this.accept + "]", null, NotificationType.error);
this.notificationService.showMessage(this.translateService.instant(message)
+ '[' + this.accept + ']', null, NotificationType.error);
} else if ("CONTENT_ERROR" === status) {
} else if ('CONTENT_ERROR' === status) {
this.formGroup.controls.file.setValue(null);
this.enabledOK = false;
this.buildErrorDetail(status, info.fileValidationResult.recordsErrorMap);
} else if ("HEADER_ERROR" === status) {
} else if ('HEADER_ERROR' === status) {
this.formGroup.controls.file.setValue(null);
this.enabledOK = false;
......
import { Component, OnInit, Input, ViewContainerRef, ViewChild, Output, EventEmitter } from '@angular/core';
import { Component, OnInit, Input, ViewContainerRef, ViewChild, Output } from '@angular/core';
import { AfterViewInit, EventEmitter } from '@angular/core';
import { MatStepper, MatDialog, MatTableDataSource, MatSort } from '@angular/material';
import { ActivatedRoute, Router } from '@angular/router';
import { animate, trigger, state, transition, style } from '@angular/animations';
......@@ -19,16 +20,18 @@ import { CaFileUploadModalComponent, FileUploadModel } from '../ca-file-upload-m
])
]
})
export class CaFrequentQuestionsComponent implements OnInit {
export class CaFrequentQuestionsComponent implements OnInit, AfterViewInit {
@ViewChild(MatSort, { static: false }) sort: MatSort;
@Input() stepper: MatStepper;
@Input()
stepper: MatStepper;
@Output() onNextPage: EventEmitter<boolean> = new EventEmitter<boolean>();
@Output()
nextPage: EventEmitter<boolean> = new EventEmitter<boolean>();
public resourceAuth = new Object();
dirty: boolean = false;
dirty = false;
......@@ -38,29 +41,30 @@ export class CaFrequentQuestionsComponent implements OnInit {
dataSource = new MatTableDataSource<FileUploadModel>([]);
mapStatus = {
"LO": {
"class": "label label-primary",
"text": "label.status.loaded"
LO: {
class: 'label label-primary',
text: 'label.status.loaded'
},
"PS": {
"class": "label label-warning",
"text": "label.status.pending"
PS: {
class: 'label label-warning',
text: 'label.status.pending'
}
};
files = [];
viewMode: boolean;
constructor(protected route: ActivatedRoute,
constructor(
protected route: ActivatedRoute,
protected router: Router,
protected vcRef: ViewContainerRef,
protected authorizationService: AuthorizationService,
private translate: TranslateService,
private _activatedRoute: ActivatedRoute,
private activatedRoute: ActivatedRoute,
private matDialog: MatDialog
) {
this.viewMode = this._activatedRoute.snapshot.data.mode === 'view';
this.viewMode = this.activatedRoute.snapshot.data.mode === 'view';
}
......@@ -89,7 +93,7 @@ export class CaFrequentQuestionsComponent implements OnInit {
}
setDataForWizard(result: any) {
console.log(result)
console.log(result);
/*
this.protocols = result.connectionProtocolOptions;
this.generalProperties = result.generalProperties;
......@@ -112,15 +116,15 @@ export class CaFrequentQuestionsComponent implements OnInit {
}
addFile() {
let dialog = this.matDialog.open(CaFileUploadModalComponent, {
const dialog = this.matDialog.open(CaFileUploadModalComponent, {
width: '600px',
data: null
});
dialog.afterClosed().subscribe(result => {
if (result) {
let fileAdded = { ...result };
let listTemp = this.dataSource.data;
const fileAdded = { ...result };
const listTemp = this.dataSource.data;
listTemp.push(fileAdded);
this.dataSource.data = listTemp;
this.dirty = true;
......@@ -131,27 +135,25 @@ export class CaFrequentQuestionsComponent implements OnInit {
onEditRecord(item, index) {
item.editable = true;
let dialog = this.matDialog.open(CaFileUploadModalComponent, {
const dialog = this.matDialog.open(CaFileUploadModalComponent, {
width: '500px',
data: item
});
dialog.afterClosed().subscribe(result => {
if (result) {
let fileEdited = { ...result };
let listTemp = this.dataSource.data;
if (result) {
const fileEdited = { ...result };
const listTemp = this.dataSource.data;
listTemp[index] = fileEdited;
this.dataSource.data = listTemp;
}
});
}
saveQuestions(validateForm: boolean) {
let success = true;
const success = true;
this.agentDetail.frequentQuestions = this.dataSource.data;
......@@ -159,7 +161,7 @@ export class CaFrequentQuestionsComponent implements OnInit {
}
onDeleteRecord(item, index) {
let listTemp = this.dataSource.data;
const listTemp = this.dataSource.data;
listTemp.splice(index, 1);
this.dataSource.data = listTemp;
this.dirty = true;
......@@ -176,7 +178,7 @@ export class CaFrequentQuestionsComponent implements OnInit {
}
if (this.saveQuestions(true)) {
this.onNextPage.emit(this.isDirty());
this.nextPage.emit(this.isDirty());
this.stepper.next();
}
}
......
......@@ -25,17 +25,19 @@ export const FILE_TYPE = {
})
export class CaGeneralInformationComponent implements OnInit {
@Input() stepper: MatStepper;
@Input()
stepper: MatStepper;
@Output() onNextPage: EventEmitter<boolean> = new EventEmitter<boolean>();
@Output()
nextPage: EventEmitter<boolean> = new EventEmitter<boolean>();
agentDetail: any;
formGroup: FormGroup;
viewMode: boolean;
mode: string = 'new';
mode = 'new';
imageName = "imageAvatar";
imageName = 'imageAvatar';
urlBase = '';
countries = [];
......@@ -43,41 +45,41 @@ export class CaGeneralInformationComponent implements OnInit {
languages = [
{
"code": "ES",
"name": "Español"
code: 'ES',
name: 'Español'
}
];
types = [
{
"code": "FQ",
"name": "Agente de preguntas frecuentes"
code: 'FQ',
name: 'Agente de preguntas frecuentes'
}
];
acceptedImageTypes = ['image/png', 'image/jpeg', 'image/gif'];
acceptedTypes = "PNG, JPEG, GIF";
acceptedTypes = 'PNG, JPEG, GIF';
constructor(
private formBuilder: FormBuilder,
private _activatedRoute: ActivatedRoute,
private _notificationService: NotificationService,
private _translateService: TranslateService
private activatedRoute: ActivatedRoute,
private notificationService: NotificationService,
private translateService: TranslateService
) {
this.mode = this._activatedRoute.snapshot.data.mode;
this.mode = this.activatedRoute.snapshot.data.mode;
this.viewMode = this.mode === 'view';
this.countries = this._activatedRoute.snapshot.data.countryData;
this.countries = this.activatedRoute.snapshot.data.countryData;
this.formGroup = this.formBuilder.group({
name: new FormControl({ value: "", disabled: this.viewMode }),
description: new FormControl({ value: "", disabled: this.viewMode }),
version: new FormControl({ value: "", disabled: this.viewMode }),
imageAvatar: new FormControl({ value: "", disabled: this.viewMode }, { validators: [Validators.required] }),
country: new FormControl({ value: "", disabled: this.viewMode }),
timezone: new FormControl({ value: "", disabled: this.viewMode }),
language: new FormControl({ value: "", disabled: this.viewMode }),
type: new FormControl({ value: "", disabled: this.viewMode })
name: new FormControl({ value: '', disabled: this.viewMode }),
description: new FormControl({ value: '', disabled: this.viewMode }),
version: new FormControl({ value: '', disabled: this.viewMode }),
imageAvatar: new FormControl({ value: '', disabled: this.viewMode }, { validators: [Validators.required] }),
country: new FormControl({ value: '', disabled: this.viewMode }),
timezone: new FormControl({ value: '', disabled: this.viewMode }),
language: new FormControl({ value: '', disabled: this.viewMode }),
type: new FormControl({ value: '', disabled: this.viewMode })
});
}
......@@ -128,7 +130,7 @@ export class CaGeneralInformationComponent implements OnInit {
uploadFiles(event) {
for (const i in event) {
if (event[i] instanceof File) {
let eventTemp = event[i];
const eventTemp = event[i];
if (this.acceptedImageTypes.includes(eventTemp.type)) {
......@@ -138,15 +140,16 @@ export class CaGeneralInformationComponent implements OnInit {
};
reader.readAsDataURL(event[i]);
} else {
let message = "label.imageAvatar.incompatible.extension";
this._notificationService.showMessage(this._translateService.instant(message) + "[" + this.acceptedTypes + "]", null, NotificationType.error);
const message = 'label.imageAvatar.incompatible.extension';
this.notificationService.showMessage(this.translateService.instant(message) +
'[' + this.acceptedTypes + ']', null, NotificationType.error);
}
}
}
}
onCountryChange(obj, deleteTimeZone?: boolean) {
let selectedCountry = obj.value;
const selectedCountry = obj.value;
this.timezones = [];
if (deleteTimeZone) {
......@@ -154,7 +157,7 @@ export class CaGeneralInformationComponent implements OnInit {
}
if (selectedCountry) {
for (var index in this.countries) {
for (const index in this.countries) {
if (selectedCountry === this.countries[index].id) {
this.timezones = this.countries[index].timezones;
break;
......@@ -170,7 +173,7 @@ export class CaGeneralInformationComponent implements OnInit {
}
if (this.saveGeneralInformation(true)) {
this.onNextPage.emit(this.isDirty());
this.nextPage.emit(this.isDirty());
this.stepper.next();
}
}
......
import { HttpClient, HttpEvent, HttpErrorResponse, HttpEventType } from '@angular/common/http';
import { map } from 'rxjs/operators';
import { HttpClient, HttpEvent, HttpErrorResponse, HttpEventType } from '@angular/common/http';
import { map } from 'rxjs/operators';
import { Injectable } from '@angular/core';
@Injectable({
providedIn: 'root'
})
export class UploadService {
SERVER_URL: string = "./service/agent";
@Injectable({
providedIn: 'root'
})
export class UploadService {
SERVER_URL = './service/agent';
constructor(private httpClient: HttpClient) { }
public upload(formData) {
return this.httpClient.post<any>(this.SERVER_URL, formData, {
reportProgress: true,
observe: 'events'
});
return this.httpClient.post<any>(this.SERVER_URL, formData, {
reportProgress: true,
observe: 'events'
});
}
}
......@@ -19,7 +19,7 @@ import { LayoutModule } from '@angular/cdk/layout';
TranslateModule,
LayoutModule
],
entryComponents:[
entryComponents: [
],
exports: [
BytebotLayoutComponent
......
......@@ -8,7 +8,7 @@ import { detectBody } from '../app.helpers';
})
export class BytebotLayoutComponent implements OnInit {
constructor(//protected toogleService: ToogleService
constructor(// protected toogleService: ToogleService
) { }
ngOnInit() {
......@@ -25,8 +25,8 @@ export class BytebotLayoutComponent implements OnInit {
}
onToggle() {
console.log("test");
//this.toogleService.onToggle(true);
console.log('test');
// this.toogleService.onToggle(true);
}
}
......@@ -5,7 +5,7 @@ import { CustomerInteractionComponent } from './views/customer-interaction-dashb
const routes: Routes = [
{
path: 'operative', component: OperativeDashboardComponent,
path: 'operative', component: OperativeDashboardComponent,
data: {
program: 'CONVERSATIONAL_AGENT',
breadcrumb: 'Operativo',
......
......@@ -4,7 +4,8 @@ import { DashboardsRoutingModule } from './dashboards-routing.module';
import { TranslateModule } from '@ngx-translate/core';
import { ReactiveFormsModule, FormsModule } from '@angular/forms';
import { CommonModule } from '@angular/common';
import { MatFormFieldModule, MatSelectModule, MatTooltipModule, MatButtonModule, MatDatepickerModule, MatInputModule, MatPaginatorModule, MatSortModule, MatIconModule } from '@angular/material';
import { MatFormFieldModule, MatSelectModule, MatTooltipModule, MatButtonModule, MatDatepickerModule,
MatInputModule, MatPaginatorModule, MatSortModule, MatIconModule } from '@angular/material';
import { XdfSettingsModule } from '@xdf/settings';
import { XdfLayoutsModule } from '@xdf/layouts';
import { OperativeDashboardComponent } from './views/operative-dashboard/components/operative-dashboard/operative-dashboard.component';
......@@ -23,7 +24,7 @@ import { GaugeChartComponent } from './views/operative-dashboard/components/gaug
import { GaugeChartModule } from 'angular-gauge-chart';
import { InactivitySesionComponent } from './views/operative-dashboard/components/inactivity-sesion/inactivity-sesion.component';
import { HeatMapComponent } from './views/operative-dashboard/components/heat-map/heat-map.component';
import { OperativeDashboardFilterComponent } from './views/operative-dashboard/components/operative-dashboard-filter/operative-dashboard-filter.component'
import { OperativeDashboardFilterComponent } from './views/operative-dashboard/components/operative-dashboard-filter/operative-dashboard-filter.component';
import { NgxMatDateAdapter, NgxMatDatetimePickerModule, NgxMatNativeDateModule, NgxMatTimepickerModule } from '@angular-material-components/datetime-picker';
import { LocalizedDateModule } from '@xdf/commons';
import { StackedColumnChartComponent } from './views/customer-interaction-dashboard/componentes/stacked-column-chart/stacked-column-chart.component';
......@@ -38,9 +39,8 @@ import { AvgIntentByCustomerComponent } from './views/customer-interaction-dashb
import { TracingIntentByCustomerComponent } from './views/customer-interaction-dashboard/componentes/tracing-intent-by-customer/tracing-intent-by-customer.component';
import { MillisToDayHourMinuteSecond } from './pipes/millis-to-day-hour-minute-second.pipe';
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
export function highchartsModules() {
export function highchartsModules() {
// apply Highcharts Modules to this array
return [ more, exporting, highmaps, sankey];
}
......
......@@ -9,26 +9,26 @@ export class MillisToDayHourMinuteSecond implements PipeTransform {
constructor(private translateService: TranslateService) {}
transform(value: any, ...args: any[]) {
let valueNumber: number;
let type = typeof value;
const type = typeof value;
if (type === 'number') {
valueNumber = value;
} else if (type === 'string') {
valueNumber = + value;
}
if (valueNumber > 0) {
let days = Math.trunc(valueNumber / 86400);
const days = Math.trunc(valueNumber / 86400);
valueNumber = valueNumber % 86400;
let hours = Math.trunc(valueNumber / 3600);
const hours = Math.trunc(valueNumber / 3600);
valueNumber = valueNumber % 3600;
let minutes = Math.trunc(valueNumber / 60);
const minutes = Math.trunc(valueNumber / 60);
valueNumber = valueNumber % 60;
let seconds = valueNumber;
return (days < 10 ? '0' : '') + days + this.translateService.instant("pipe.format.day")
+ ' ' + (hours < 10 ? '0' : '') + hours + this.translateService.instant("pipe.format.hour")
+ ' ' + (minutes < 10 ? '0' : '') + minutes + this.translateService.instant("pipe.format.minute")
+ ' ' + (seconds < 10 ? '0' : '') + seconds + this.translateService.instant("pipe.format.seconds");
const seconds = valueNumber;
return (days < 10 ? '0' : '') + days + this.translateService.instant('pipe.format.day')
+ ' ' + (hours < 10 ? '0' : '') + hours + this.translateService.instant('pipe.format.hour')
+ ' ' + (minutes < 10 ? '0' : '') + minutes + this.translateService.instant('pipe.format.minute')
+ ' ' + (seconds < 10 ? '0' : '') + seconds + this.translateService.instant('pipe.format.seconds');
}
return value;
}
}
\ No newline at end of file
}
......@@ -5,7 +5,7 @@ import { Injectable } from '@angular/core';
providedIn: 'root'
})
export class CustomerInteractionService {
constructor(protected http: HttpClient) {
}
......@@ -14,7 +14,7 @@ export class CustomerInteractionService {
return './dashboard/customer-interaction';
}
getSummary(startDate:Date, endDate:Date, channel:string) {
getSummary(startDate: Date, endDate: Date, channel: string) {
return this.http.post(this.serviceURL, {startDate, endDate, channel});
}
......
......@@ -5,7 +5,7 @@ import { Injectable } from '@angular/core';
providedIn: 'root'
})
export class OperationalConsultationService {
constructor(protected http: HttpClient) {
}
......@@ -14,7 +14,7 @@ export class OperationalConsultationService {
return './dashboard/operative';
}
getSummary(startDate:Date, endDate:Date, channel:string) {
getSummary(startDate: Date, endDate: Date, channel: string) {
return this.http.post(this.serviceURL, {startDate, endDate, channel});
}
......
......@@ -48,7 +48,7 @@ export class AvgIntentByCustomerComponent implements OnInit {
type: 'datetime',
tickInterval: 86400000,
labels: {
formatter: function() {
formatter() {
return Highcharts.dateFormat('%e - %b',
this.value);
}
......
......@@ -15,19 +15,19 @@ export class CustomerInteractionFilterComponent implements OnInit {
channels = [
{
value: "W",
label: "Whatsapp"
value: 'W',
label: 'Whatsapp'
},
{
value: "F",
label: "Facebook"
value: 'F',
label: 'Facebook'
}
];
endDateTime: Date;
startDateTime: Date;
selectedChannel: string;
isLoading: Boolean = false;
isLoading = false;
@Input()
header: string;
......@@ -36,10 +36,10 @@ export class CustomerInteractionFilterComponent implements OnInit {
headerDesc: string;
@Input()
icon: string = '<i class="fa fa-bar-chart-o"></i>';
icon = '<i class="fa fa-bar-chart-o"></i>';
@Output()
onFilter: EventEmitter<any> = new EventEmitter();
filtered: EventEmitter<any> = new EventEmitter();
constructor(
protected route: ActivatedRoute,
......@@ -63,8 +63,8 @@ export class CustomerInteractionFilterComponent implements OnInit {
}
search() {
const filters = {startDateTime: this.startDateTime, endDateTime: this.endDateTime, channel: this.selectedChannel}
this.onFilter.emit(filters);
const filters = {startDateTime: this.startDateTime, endDateTime: this.endDateTime, channel: this.selectedChannel};
this.filtered.emit(filters);
}
private getStartDate(endDate: Date): Date {
......@@ -75,7 +75,7 @@ export class CustomerInteractionFilterComponent implements OnInit {
event.preventDefault();
}
clickEvent (event: NgxMatDatetimePicker<any>) {
clickEvent(event: NgxMatDatetimePicker<any>) {
event.open();
}
......
<byte-customer-interaction-filter (onFilter)="filter($event)"></byte-customer-interaction-filter>
<byte-customer-interaction-filter (filtered)="filter($event)"></byte-customer-interaction-filter>
<ng-container *ngIf="isLoading">
<div class="spiner-example">
<div class="sk-spinner sk-spinner-circle">
......
......@@ -13,38 +13,22 @@ export class CustomerInteractionComponent implements OnInit {
links = ['Graph', 'Detail'];
activeLink = this.links[0];
latestDate = new Date();
existDateRange: Boolean = false;
isLoading: Boolean = false;
existDateRange = false;
isLoading = false;
startDate: Date;
endDate: Date;
data: any;
isDataLoaded: Boolean = false;
isDataLoaded = false;
background: ThemePalette = undefined;
constructor(
protected customerInteractionService: CustomerInteractionService,
protected notificationService: NotificationService
) { }
ngOnInit() {
}
toggleBackground() {
this.background = this.background ? undefined : 'primary';
}
addLink() {
this.links.push(`Link ${this.links.length + 1}`);
}
panelOptions = {
elevation: false,
title: {
primary: 'Mensajes por horario de actividad del cliente',
secondary: ''
}
}
};
tracingPanelOptions = {
elevation: false,
......@@ -52,7 +36,7 @@ export class CustomerInteractionComponent implements OnInit {
primary: 'dashboards.customer.interaction.tracing.intent',
secondary: ''
}
}
};
avgIntentOptions = {
elevation: false,
......@@ -60,7 +44,7 @@ export class CustomerInteractionComponent implements OnInit {
primary: 'dashboards.customer.interaction.avg.intent',
secondary: ''
}
}
};
goalPanelOptions = {
elevation: false,
......@@ -68,7 +52,7 @@ export class CustomerInteractionComponent implements OnInit {
primary: 'dashboards.customer.interaction.goals',
secondary: ''
}
}
};
intentCustomer = {
elevation: false,
......@@ -86,6 +70,22 @@ export class CustomerInteractionComponent implements OnInit {
}
};
constructor(
protected customerInteractionService: CustomerInteractionService,
protected notificationService: NotificationService
) { }
ngOnInit() {
}
toggleBackground() {
this.background = this.background ? undefined : 'primary';
}
addLink() {
this.links.push(`Link ${this.links.length + 1}`);
}
filter(filters) {
this.isDataLoaded = false;
this.isLoading = true;
......@@ -97,13 +97,13 @@ export class CustomerInteractionComponent implements OnInit {
this.isLoading = false;
this.isDataLoaded = this.isValidData(this.data);
if (!this.isDataLoaded) {
this.notificationService.showMessage("No se encontró información para el rango de fechas seleccionado", "", NotificationType.error);
this.notificationService.showMessage('No se encontró información para el rango de fechas seleccionado', '', NotificationType.error);
}
}, err => {
this.isLoading = false;
});
}
private isValidData(data:any): Boolean {
private isValidData(data: any): boolean {
if (data['sessionFlow'] && data['sessionFlow']['intent'] && data['sessionFlow']['sentence']) {
if (data['sessionFlow']['intent']['total'] > 0 || data['sessionFlow']['sentence']['total'] > 0) {
return true;
......
import { DataSource } from '@angular/cdk/table';
import { Component, Input, OnInit, ViewChild } from '@angular/core';
import { AfterViewInit, Component, Input, OnInit, ViewChild } from '@angular/core';
import { MatPaginator, MatSort } from '@angular/material';
import { Pagination, SortField } from '@xdf/commons';
import { DynaDataSource } from '@xdf/gallery';
......@@ -11,15 +11,15 @@ import { MessageByIntentService } from './services/message-by-intent.service';
templateUrl: './message-by-intent-table.component.html',
styleUrls: ['./message-by-intent-table.component.scss']
})
export class MessageByIntentTableComponent implements OnInit {
export class MessageByIntentTableComponent implements OnInit, AfterViewInit {
displayedColumns: string[] = ['sentence', 'identifier', 'count', 'customer'];
dataSource: DynaDataSource;
@ViewChild(MatPaginator, { static: false }) paginator: MatPaginator;
@ViewChild(MatSort, { static: false }) sort: MatSort;
sortColumn: string = "count";
sortDirection: string = "desc";
sortColumn = 'count';
sortDirection = 'desc';
statusQuickFilter: string;
pagingSize = 8;
......@@ -36,22 +36,22 @@ export class MessageByIntentTableComponent implements OnInit {
ngOnInit() {
this.dataSource = new DynaDataSource(this.service);
// Paginación
this.pagination = new Pagination();
this.pagination.currentPage = 0;
this.pagination.itemsPerPage = this.pagingSize;
this.pagination.filterExpression = "startDate=" + this.minDate.getTime() + "&&endDate=" + this.maxDate.getTime();
// Ordenación por defecto
if (this.sortColumn && this.sortDirection) {
this.pagination.sortFields = new Array();
const sortField: SortField = new SortField();
sortField.direction = this.sortDirection;
sortField.field = this.sortColumn;
this.pagination.sortFields.push(sortField);
}
this.dataSource.load(this.pagination);
// Paginación
this.pagination = new Pagination();
this.pagination.currentPage = 0;
this.pagination.itemsPerPage = this.pagingSize;
this.pagination.filterExpression = 'startDate=' + this.minDate.getTime() + '&&endDate=' + this.maxDate.getTime();
// Ordenación por defecto
if (this.sortColumn && this.sortDirection) {
this.pagination.sortFields = new Array();
const sortField: SortField = new SortField();
sortField.direction = this.sortDirection;
sortField.field = this.sortColumn;
this.pagination.sortFields.push(sortField);
}
this.dataSource.load(this.pagination);
}
......@@ -80,7 +80,7 @@ export class MessageByIntentTableComponent implements OnInit {
.subscribe();
}
disabledPopper(value: number): Boolean {
disabledPopper(value: number): boolean {
return value <= 30;
}
......
export interface MessageByIntent{
export interface MessageByIntent {
sentence: string;
intent: string;
ocurrency: number;
customers: number;
}
\ No newline at end of file
}
......@@ -11,7 +11,7 @@ import { map } from 'rxjs/operators';
})
export class MessageByIntentService extends DynaDataService {
serviceURL = "./dashboard/customer-interaction/message-by-intent";
serviceURL = './dashboard/customer-interaction/message-by-intent';
constructor(private httpClient: HttpClient) {
super(httpClient);
......@@ -20,4 +20,4 @@ export class MessageByIntentService extends DynaDataService {
getResultPagination(pagination: Pagination): Observable<Pagination> {
return this.httpClient.post(this.serviceURL + '/page', pagination).pipe(map(data => this.getPage(data as Pagination)));
}
}
\ No newline at end of file
}
......@@ -10,7 +10,7 @@ import { Chart } from 'angular-highcharts';
export class SankeyDiagramComponent implements OnInit {
chart: Chart;
startPoint:string = "Session start";
startPoint = 'Session start';
private percentDetail = {};
@Input()
......@@ -22,7 +22,7 @@ export class SankeyDiagramComponent implements OnInit {
if (!this.data) {
return;
}
let dataDiagram = this.generateData(this.data);
const dataDiagram = this.generateData(this.data);
if (!dataDiagram) {
return;
}
......@@ -61,21 +61,20 @@ export class SankeyDiagramComponent implements OnInit {
// dataLabels: {
// formatter: function () {
// console.log(this);
// return "";
// return '';
// }
// },
}] as Array<any>
});
});
}
private generateData(data: any) {
if (!data['topList']) {
return undefined;
}
let dataForDiagram = [];
const dataForDiagram = [];
data['topList'].forEach(x => {
//PercentageInventary.getInstance().setPercent(x['identifier'], x['count']/data['total']*100);
// PercentageInventary.getInstance().setPercent(x['identifier'], x['count']/data['total']*100);
dataForDiagram.push([this.startPoint, x['identifier'], x['count']]);
});
return dataForDiagram;
......@@ -89,9 +88,9 @@ function update(key) {
export class PercentageInventary {
private percentages: any = {};
private static instance: PercentageInventary;
private percentages: any = {};
public static getInstance(): PercentageInventary {
if (!PercentageInventary.instance) {
PercentageInventary.instance = new PercentageInventary();
......@@ -99,10 +98,10 @@ export class PercentageInventary {
return PercentageInventary.instance;
}
getPercent(name: string) {
if (this.percentages[name]) {
return (this.percentages[name] as number).toFixed(2) + "%";
return (this.percentages[name] as number).toFixed(2) + '%';
}
return null;
}
......
......@@ -21,8 +21,8 @@ export class StackedColumnChartComponent implements OnInit {
if (!this.data) {
return;
}
let categories = this.generateData(this.data, 'goal');
let dataSeries = this.generateData(this.data, 'count');
const categories = this.generateData(this.data, 'goal');
const dataSeries = this.generateData(this.data, 'count');
this.chart = new Chart({
chart: {
type: 'column'
......@@ -37,7 +37,7 @@ export class StackedColumnChartComponent implements OnInit {
text: ''
},
xAxis: {
categories: categories
categories
},
credits: {
enabled: false
......@@ -82,7 +82,7 @@ export class StackedColumnChartComponent implements OnInit {
}
private generateData(data: Array<any>, field: string) {
let dataGenerated = [];
const dataGenerated = [];
data.forEach(x => {
dataGenerated.push(x[field]);
});
......
......@@ -25,7 +25,7 @@ export class TracingIntentByCustomerComponent implements OnInit {
ngOnInit() {
console.log(this.minDate);
console.log(this.maxDate);
let series: Array<any> = this.getGenerateData(this.data);
const series: Array<any> = this.getGenerateData(this.data);
this.chart = new Chart({
chart: {
type: 'line'
......@@ -54,9 +54,8 @@ export class TracingIntentByCustomerComponent implements OnInit {
min: this.getDate(this.minDate),
max: this.getDate(this.maxDate),
labels: {
formatter: function() {
return Highcharts.dateFormat('%e - %b',
this.value * 1000);
formatter() {
return Highcharts.dateFormat('%e - %b', this.value * 1000);
}
}
},
......@@ -66,7 +65,7 @@ export class TracingIntentByCustomerComponent implements OnInit {
},
},
tooltip: {
formatter: function() {
formatter() {
return '<b>' + this.series.name + '</b><br/>' +
Highcharts.dateFormat('%e - %b',
this.x * 1000) +
......@@ -80,18 +79,20 @@ export class TracingIntentByCustomerComponent implements OnInit {
}
}
},
series: series
series
});
}
private getGenerateData(data: any): Array<any> {
let series: Array<any> = [];
const series: Array<any> = [];
for (const intent in data) {
let serie = {};
serie['name'] = intent;
serie['data'] = data[intent];
series.push(serie);
console.log(serie);
if (data.hasOwnProperty(intent)) {
const serie = {};
serie['name'] = intent;
serie['data'] = data[intent];
series.push(serie);
console.log(serie);
}
}
return series;
}
......
......@@ -11,7 +11,7 @@ import { map } from 'rxjs/operators';
})
export class UnidentifiedSentenceService extends DynaDataService {
serviceURL = "./dashboard/operative/sentence-by-intent";
serviceURL = './dashboard/operative/sentence-by-intent';
constructor(private httpClient: HttpClient) {
super(httpClient);
......@@ -20,4 +20,4 @@ export class UnidentifiedSentenceService extends DynaDataService {
getResultPagination(pagination: Pagination): Observable<Pagination> {
return this.httpClient.post(this.serviceURL + '/page', pagination).pipe(map(data => this.getPage(data as Pagination)));
}
}
\ No newline at end of file
}
import { Component, Input, OnInit, ViewChild } from '@angular/core';
import { AfterViewInit, Component, Input, OnInit, ViewChild } from '@angular/core';
import { MatPaginator, MatSort } from '@angular/material';
import { Pagination, SortField } from '@xdf/commons';
import { DynaDataSource } from '@xdf/gallery';
......@@ -10,15 +10,15 @@ import { UnidentifiedSentenceService } from './services/unidentified-sentences.s
templateUrl: './unidentified-sentences-table.component.html',
styleUrls: ['./unidentified-sentences-table.component.scss']
})
export class UnidentifiedSentencesTableComponent implements OnInit {
export class UnidentifiedSentencesTableComponent implements OnInit, AfterViewInit {
displayedColumns: string[] = ['identifier', 'count'];
dataSource: DynaDataSource;
@ViewChild(MatPaginator, { static: false }) paginator: MatPaginator;
@ViewChild(MatSort, { static: false }) sort: MatSort;
sortColumn: string = "count";
sortDirection: string = "desc";
sortColumn = 'count';
sortDirection = 'desc';
statusQuickFilter: string;
pagingSize = 8;
......@@ -35,22 +35,22 @@ export class UnidentifiedSentencesTableComponent implements OnInit {
ngOnInit() {
this.dataSource = new DynaDataSource(this.service);
// Paginación
this.pagination = new Pagination();
this.pagination.currentPage = 0;
this.pagination.itemsPerPage = this.pagingSize;
this.pagination.filterExpression = "startDate=" + this.minDate.getTime() + "&&endDate=" + this.maxDate.getTime();
// Ordenación por defecto
if (this.sortColumn && this.sortDirection) {
this.pagination.sortFields = new Array();
const sortField: SortField = new SortField();
sortField.direction = this.sortDirection;
sortField.field = this.sortColumn;
this.pagination.sortFields.push(sortField);
}
this.dataSource.load(this.pagination);
// Paginación
this.pagination = new Pagination();
this.pagination.currentPage = 0;
this.pagination.itemsPerPage = this.pagingSize;
this.pagination.filterExpression = 'startDate=' + this.minDate.getTime() + '&&endDate=' + this.maxDate.getTime();
// Ordenación por defecto
if (this.sortColumn && this.sortDirection) {
this.pagination.sortFields = new Array();
const sortField: SortField = new SortField();
sortField.direction = this.sortDirection;
sortField.field = this.sortColumn;
this.pagination.sortFields.push(sortField);
}
this.dataSource.load(this.pagination);
}
......
......@@ -26,7 +26,6 @@ export class CustomerActivityWidgetComponent implements OnInit {
xAxis: {
allowDecimals: false,
labels: {
},
accessibility: {
rangeDescription: 'Range: 1940 to 2017.'
......@@ -37,7 +36,7 @@ export class CustomerActivityWidgetComponent implements OnInit {
text: 'Nuclear weapon states'
},
labels: {
formatter: function () {
formatter() {
return this.value / 1000 + 'k';
}
}
......
......@@ -19,7 +19,7 @@ export const DEFAULT_OPTIONS_GAUGE_CHART: GaugeChart = {
arcDelimiters: [16, 33],
rangeLabel: ['0', '6'],
needleStartValue: 1,
}
};
@Component({
selector: 'byte-gauge-chart',
......@@ -29,25 +29,25 @@ export const DEFAULT_OPTIONS_GAUGE_CHART: GaugeChart = {
export class GaugeChartComponent implements OnInit {
@Input()
name: string = "Gauge chart";
name = 'Gauge chart';
@Input()
value: any = 1.2;
@Input()
unit: string = "";
unit = '';
@Input()
options: GaugeChart;
@Input()
format: Boolean = false;
format = false;
@Input()
maxValue: number = 6;
maxValue = 6;
canvasWidth = 250
centralLabel = '25'
canvasWidth = 250;
centralLabel = '25';
bottomLabel = '';
constructor() { }
......@@ -60,18 +60,18 @@ export class GaugeChartComponent implements OnInit {
valueNumber = valueNumber / 1000;
}
let valueFormater:number = 0;
let valueFormater = 0;
if (valueNumber >= 86400) {
this.unit = "d";
this.unit = 'd';
valueFormater = valueNumber / 86400;
} else if (valueNumber >= 3600) {
this.unit = "h";
this.unit = 'h';
valueFormater = valueNumber / 3600;
} else if (valueNumber >= 60){
this.unit = "m";
} else if (valueNumber >= 60) {
this.unit = 'm';
valueFormater = valueNumber / 60;
} else {
this.unit = "s";
this.unit = 's';
valueFormater = valueNumber;
}
this.bottomLabel = valueFormater.toFixed(1) + ' ' + this.unit;
......
import { Component, Input, OnDestroy, OnInit } from '@angular/core';
//import { ToogleService } from '@xdf/layouts';
// import { ToogleService } from '@xdf/layouts';
import { Chart } from 'angular-highcharts';
import * as Highcharts from 'highcharts';
import { Subscription } from 'rxjs';
......@@ -23,8 +23,10 @@ export class HeatMapComponent implements OnInit, OnDestroy {
subscriptionToogle: Subscription;
chart: Chart;
constructor(
//protected toogleService: ToogleService
// protected toogleService: ToogleService
) {
}
......@@ -34,8 +36,6 @@ export class HeatMapComponent implements OnInit, OnDestroy {
}
}
chart: Chart;
ngOnInit() {
if (!this.maxDate || !this.minDate) {
return;
......@@ -48,7 +48,7 @@ export class HeatMapComponent implements OnInit, OnDestroy {
marginRight: 40,
type: 'heatmap',
events: {
load: function (event: any) {
load: (event: any) => {
event.target.reflow();
}
}
......@@ -91,9 +91,9 @@ export class HeatMapComponent implements OnInit, OnDestroy {
text: null
},
labels: {
formatter: function () {
//return 'H' + (this.value + 1) + ': ' + (this.value < 10 ? '0' : '') + this.value + ':00' ;
return 'H' + (this.value + 1) + ': ' + (3 * this.value < 10 ? '0' : '') + 3 * this.value + ':00'
formatter() {
// return 'H' + (this.value + 1) + ': ' + (this.value < 10 ? '0' : '') + this.value + ':00' ;
return 'H' + (this.value + 1) + ': ' + (3 * this.value < 10 ? '0' : '') + 3 * this.value + ':00'
+ ' - ' + ((3 * this.value + 3) < 10 ? '0' : '') + (3 * this.value + 3) + ':00';
},
format: 'H{value:}:{3*value}:00 - {value + 3}:00'
......@@ -132,7 +132,7 @@ export class HeatMapComponent implements OnInit, OnDestroy {
colsize: 24 * 36e5, // one day
tooltip: {
headerFormat: '{point.x:%e %b}',
//pointFormat: '{point.x:%e %b, %Y} {point.y}:00: <b>{point.value} ℃</b>'
// pointFormat: '{point.x:%e %b, %Y} {point.y}:00: <b>{point.value} ℃</b>'
pointFormat: '<b>{point.value} mensajes</b>'
},
turboThreshold: Number.MAX_VALUE, // #3404, remove after 4.0.5 release
......
......@@ -12,8 +12,8 @@ export class InactivitySesionComponent implements OnInit, AfterViewInit {
@Input() options = {
width: 200,
height: 60,
fill: "#dfecf9",
stroke: "#024990",
fill: '#dfecf9',
stroke: '#024990',
strokeWidth: 1
};
@Input() values = [1, 12, 3, 15, 5, -1, 10];
......@@ -36,7 +36,7 @@ export class InactivitySesionComponent implements OnInit, AfterViewInit {
}
}
@HostListener('window:resize',['$event'])
@HostListener('window:resize', ['$event'])
public onResize(event) {
const width = event.target.innerWidth;
this.updateWidth(width);
......@@ -45,12 +45,12 @@ export class InactivitySesionComponent implements OnInit, AfterViewInit {
private updateWidth(width: number) {
if (width >= 1600) {
this.options.width = 300
this.options.width = 300;
} else if (width >= 1350) {
this.options.width = 200
} else if (width >= 768){
this.options.width = 200;
} else if (width >= 768) {
this.options.width = 150;
} else if (width >= 576){
} else if (width >= 576) {
this.options.width = 200;
} else {
this.options.width = 300;
......
......@@ -14,19 +14,19 @@ export class OperativeDashboardFilterComponent implements OnInit {
channels = [
{
value: "W",
label: "Whatsapp"
value: 'W',
label: 'Whatsapp'
},
{
value: "F",
label: "Facebook"
value: 'F',
label: 'Facebook'
}
];
endDateTime: Date;
startDateTime: Date;
selectedChannel: string;
isLoading: Boolean = false;
isLoading = false;
@Input()
header: string;
......@@ -35,10 +35,10 @@ export class OperativeDashboardFilterComponent implements OnInit {
headerDesc: string;
@Input()
icon: string = '<i class="fa fa-bar-chart-o"></i>';
icon = '<i class="fa fa-bar-chart-o"></i>';
@Output()
onFilter: EventEmitter<any> = new EventEmitter();
filtered: EventEmitter<any> = new EventEmitter();
constructor(
protected route: ActivatedRoute,
......@@ -62,8 +62,8 @@ export class OperativeDashboardFilterComponent implements OnInit {
}
search() {
const filters = {startDateTime: this.startDateTime, endDateTime: this.endDateTime, channel: this.selectedChannel}
this.onFilter.emit(filters);
const filters = { startDateTime: this.startDateTime, endDateTime: this.endDateTime, channel: this.selectedChannel };
this.filtered.emit(filters);
}
private getStartDate(endDate: Date): Date {
......@@ -74,8 +74,7 @@ export class OperativeDashboardFilterComponent implements OnInit {
event.preventDefault();
}
clickEvent (event: NgxMatDatetimePicker<any>) {
clickEvent(event: NgxMatDatetimePicker<any>) {
event.open();
}
}
<byte-operative-dashboard-filter (onFilter)="filter($event)"></byte-operative-dashboard-filter>
<byte-operative-dashboard-filter (filtered)="filter($event)"></byte-operative-dashboard-filter>
<ng-container *ngIf="isLoading">
<div class="spiner-example">
<div class="sk-spinner sk-spinner-circle">
......
......@@ -14,51 +14,51 @@ import { PetyWidgetModel } from '../summary-peti-widget/summary-peti-widget.comp
export class OperativeDashboardComponent implements OnInit {
latestDate = new Date();
existDateRange: Boolean = false;
isLoading: Boolean = false;
existDateRange = false;
isLoading = false;
startDate: Date;
endDate: Date;
data: any;
isDataLoaded: Boolean = false;
isDataLoaded = false;
formatterNumber: PetiFormatter = new MessageCountFormatter();
panelOptions = {
elevation: false,
title: {
primary: 'dashboards.operative.message.customer.activity',
secondary: ''
}
}
};
optionsInactivitySesion = {
width: 300,
height: 60,
fill: "#C8FEFF",
stroke: "#23c6c8",
fill: '#C8FEFF',
stroke: '#23c6c8',
strokeWidth: 1
};
totalSesionsOptions = {
width: 300,
height: 60,
fill: "#CFECFF",
stroke: "#1c84c6",
fill: '#CFECFF',
stroke: '#1c84c6',
strokeWidth: 1
};
totalReceivedOptions = {
width: 300,
height: 60,
fill: "#D2EEE9",
stroke: "#1ab394",
fill: '#D2EEE9',
stroke: '#1ab394',
strokeWidth: 1
};
totalSentOptions = {
width: 300,
height: 60,
fill: "#FFD9DD",
stroke: "#ed5565",
fill: '#FFD9DD',
stroke: '#ed5565',
strokeWidth: 1
};
......
export interface PetiFormatter {
format(value: number): string;
}
\ No newline at end of file
format(value: number): string;
}
......@@ -3,9 +3,9 @@ import { PetiFormatter } from './formatter';
export class MessageCountFormatter implements PetiFormatter {
format(value: number): string {
if (value < 1000) {
return "" + value;
return '' + value;
}
let newNumber: number = value/1000;
return newNumber.toFixed(1) + "K";
const newNumber: number = value / 1000;
return newNumber.toFixed(1) + 'K';
}
}
\ No newline at end of file
}
import { Component, HostListener, Input, OnInit, ViewChild } from '@angular/core';
import { AfterViewInit, Component, HostListener, Input, OnInit, ViewChild } from '@angular/core';
import { PeityComponent } from '@xdf/graph';
import { PetiFormatter } from './formatter/formatter';
declare var jQuery: any;
......@@ -16,20 +16,20 @@ export class PetyWidgetModel {
templateUrl: './summary-peti-widget.component.html',
styleUrls: ['./summary-peti-widget.component.scss']
})
export class SummaryPetiWidgetComponent implements OnInit {
export class SummaryPetiWidgetComponent implements OnInit, AfterViewInit {
@Input() options = {
width: 200,
height: 60,
fill: "#dfecf9",
stroke: "#024990",
fill: '#dfecf9',
stroke: '#024990',
strokeWidth: 1
};
@Input() values = [1, 12, 3, 15, 5, -1, 10];
@Input() header;
@Input() value: PetyWidgetModel;
@Input() tooltip: string;
@Input() formatter: PetiFormatter
@Input() formatter: PetiFormatter;
@ViewChild('peti', { static: false })
peti: PeityComponent;
......@@ -52,12 +52,11 @@ export class SummaryPetiWidgetComponent implements OnInit {
return this.formatter.format(this.value.value);
}
return this.value.value;
}
@HostListener('window:resize',['$event'])
@HostListener('window:resize', ['$event'])
public onResize(event) {
console.log("aea");
console.log('aea');
const width = event.target.innerWidth;
this.updateWidth(width);
this.peti.updateSize();
......@@ -65,12 +64,12 @@ export class SummaryPetiWidgetComponent implements OnInit {
private updateWidth(width: number) {
if (width >= 1600) {
this.options.width = 300
this.options.width = 300;
} else if (width >= 1350) {
this.options.width = 200
} else if (width >= 768){
this.options.width = 200;
} else if (width >= 768) {
this.options.width = 150;
} else if (width >= 576){
} else if (width >= 576) {
this.options.width = 200;
} else {
this.options.width = 300;
......
......@@ -7,7 +7,7 @@ import { UserRoleFormComponent, AccessDetailResolver } from '@xdf/settings';
const routes: Routes = [
{
path: 'user-role', component: GridViewComponent, canActivate: [AuthGuard, ResourceAuthGuard],
path: 'user-role', component: GridViewComponent, canActivate: [AuthGuard, ResourceAuthGuard],
resolve: { template: TemplateResolver },
data: {
program: 'user_role',
......@@ -15,7 +15,8 @@ const routes: Routes = [
}
},
{
path: 'user-role/detail/:mode', component: UserRoleFormComponent, canActivate: [AuthGuard, ResourceAuthGuard], canDeactivate: [DirtyGuard],
path: 'user-role/detail/:mode', component: UserRoleFormComponent, canActivate: [AuthGuard, ResourceAuthGuard],
canDeactivate: [DirtyGuard],
resolve: { record: RecordResolver, accessList: AccessDetailResolver },
data: {
program: 'user_role',
......@@ -23,7 +24,7 @@ const routes: Routes = [
}
},
{
path: 'user', component: CrudGridComponent, canActivate: [AuthGuard, ResourceAuthGuard],
path: 'user', component: CrudGridComponent, canActivate: [AuthGuard, ResourceAuthGuard],
resolve: { template: TemplateResolver },
data: {
innerTemplate: 'none',
......
......@@ -19,7 +19,7 @@ import { XdfSettingsModule } from '@xdf/settings';
XdfSettingsModule,
SecurityRoutingModule
],
entryComponents:[
entryComponents: [
],
providers: [
{ provide: DirtyGuard, useClass: DirtyGuard }
......
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { AuthGuard } from '@xdf/security';
import { DirtyGuard, TemplateResolver, CrudGridComponent, EditableDataTableTemplateResolver, CrudDetailComponent, FormViewComponent, ListResolver, RecordResolver } from '@xdf/gallery';
import { DirtyGuard, TemplateResolver, CrudGridComponent, EditableDataTableTemplateResolver } from '@xdf/gallery';
import { CrudDetailComponent, FormViewComponent, ListResolver, RecordResolver } from '@xdf/gallery';
import { ResourceAuthGuard } from '@xdf/security';
import { ApplicationFormComponent, ValposFormComponent } from '@xdf/settings';
import { TabsLayoutComponent, TabsTemplateResolver } from '@xdf/layouts';
const routes: Routes = [
{
path: "system-settings", component: TabsLayoutComponent,
path: 'system-settings', component: TabsLayoutComponent,
resolve: { template: TabsTemplateResolver },
data: {
templateName: "system-settings",
templateName: 'system-settings',
},
children: [
{ path: 'information', component: FormViewComponent, canActivate: [AuthGuard, ResourceAuthGuard], canDeactivate: [DirtyGuard],
......@@ -19,8 +20,8 @@ const routes: Routes = [
data: {
option: 'information',
program: 'system_settings_information',
breadcrumb: 'breadcrumb.settings.information'
}
breadcrumb: 'breadcrumb.settings.information'
}
},
{ path: 'information/:mode', component: FormViewComponent, canActivate: [AuthGuard, ResourceAuthGuard], canDeactivate: [DirtyGuard],
resolve: { ecord: ListResolver },
......@@ -28,16 +29,16 @@ const routes: Routes = [
withoutGrid: true,
option: 'information',
program: 'system_settings_information',
breadcrumb: 'breadcrumb.settings.information'
}
breadcrumb: 'breadcrumb.settings.information'
}
},
{ path: 'password', component: FormViewComponent, canActivate: [AuthGuard, ResourceAuthGuard], canDeactivate: [DirtyGuard],
resolve: { record: ListResolver },
data: {
option: 'password',
program: 'system_settings_password',
breadcrumb: 'breadcrumb.settings.password'
}
breadcrumb: 'breadcrumb.settings.password'
}
},
{ path: 'password/:mode', component: FormViewComponent, canActivate: [AuthGuard, ResourceAuthGuard], canDeactivate: [DirtyGuard],
resolve: { record: ListResolver },
......@@ -45,16 +46,16 @@ const routes: Routes = [
withoutGrid: true,
option: 'password',
program: 'system_settings_password',
breadcrumb: 'breadcrumb.settings.password'
}
breadcrumb: 'breadcrumb.settings.password'
}
},
{ path: 'userpolicy', component: FormViewComponent, canActivate: [AuthGuard, ResourceAuthGuard], canDeactivate: [DirtyGuard],
resolve: { record: ListResolver },
data: {
option: 'userpolicy',
program: 'system_settings_userpolicy',
breadcrumb: 'breadcrumb.settings.userpolicy'
}
breadcrumb: 'breadcrumb.settings.userpolicy'
}
},
{ path: 'userpolicy/:mode', component: FormViewComponent, canActivate: [AuthGuard, ResourceAuthGuard], canDeactivate: [DirtyGuard],
resolve: { record: ListResolver },
......@@ -62,8 +63,8 @@ const routes: Routes = [
withoutGrid: true,
option: 'userpolicy',
program: 'system_settings_userpolicy',
breadcrumb: 'breadcrumb.settings.userpolicy'
}
breadcrumb: 'breadcrumb.settings.userpolicy'
}
}
]
},
......@@ -76,7 +77,8 @@ const routes: Routes = [
}
},
{
path: 'application/detail/:mode', component: ApplicationFormComponent, canActivate: [AuthGuard, ResourceAuthGuard], canDeactivate: [DirtyGuard],
path: 'application/detail/:mode', component: ApplicationFormComponent,
canActivate: [AuthGuard, ResourceAuthGuard], canDeactivate: [DirtyGuard],
resolve: { record: RecordResolver },
data: {
program: 'application',
......
......@@ -4,23 +4,23 @@ import { Injectable } from '@angular/core';
providedIn: 'root'
})
export class SharedFilterService {
private _startDate:Date;
private _endDate:Date;
private myStartDate: Date;
private myEndDate: Date;
get startDate():Date {
return this._startDate;
get startDate(): Date {
return this.myStartDate;
}
get endDate():Date {
return this._endDate;
get endDate(): Date {
return this.myEndDate;
}
setStartDate(date: Date) {
this._startDate = date;
this.myStartDate = date;
}
setEndDate(date: Date) {
this._endDate = date;
this.myEndDate = date;
}
}
{
"extends": "tslint:recommended",
"rulesDirectory": [
"codelyzer"
],
"rules": {
"no-string-literal": false,
"array-type": false,
"arrow-parens": false,
"deprecation": {
"severity": "warning"
},
"import-blacklist": [
true,
"rxjs/Rx"
],
"interface-name": false,
"max-classes-per-file": false,
"max-line-length": [
false,
240
],
"member-access": false,
"member-ordering": [
true,
{
"order": [
"static-field",
"instance-field",
"static-method",
"instance-method"
]
}
],
"no-consecutive-blank-lines": false,
"no-console": [
true,
"debug",
"info",
"time",
"timeEnd",
"trace"
],
"no-empty": false,
"no-inferrable-types": [
true,
"ignore-params"
],
"no-non-null-assertion": true,
"no-redundant-jsdoc": true,
"no-switch-case-fall-through": true,
"no-var-requires": false,
"object-literal-key-quotes": [
true,
"as-needed"
],
"object-literal-sort-keys": false,
"ordered-imports": false,
"quotemark": [
true,
"single"
],
"trailing-comma": false,
"component-class-suffix": true,
"contextual-lifecycle": true,
"directive-class-suffix": true,
"no-conflicting-lifecycle": true,
"no-host-metadata-property": true,
"no-input-rename": true,
"no-inputs-metadata-property": true,
"no-output-native": true,
"no-output-on-prefix": true,
"no-output-rename": true,
"no-outputs-metadata-property": true,
"template-banana-in-box": true,
"template-no-negated-async": true,
"use-lifecycle-interface": true,
"use-pipe-transform-interface": true
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment