Commit 592c0764 authored by Aaron Gutierrez's avatar Aaron Gutierrez

Mejoras y correccion de errores

parent a138d96f
...@@ -1832,7 +1832,7 @@ ...@@ -1832,7 +1832,7 @@
}, },
"@xdf/layouts": { "@xdf/layouts": {
"version": "file:../../XDF/ng-byte-framework/dist/xdf-layouts/xdf-layouts-1.0.1.tgz", "version": "file:../../XDF/ng-byte-framework/dist/xdf-layouts/xdf-layouts-1.0.1.tgz",
"integrity": "sha512-lTM1Hz6J6DzteSeUNPbxVXLxzurDwxzPyBe+p6ZpOEGuhrGeFPx33bb3ap5dyz6VyQxi6t4JSLQEHbJJvJ3/bw==", "integrity": "sha512-yF8ay/2Yc2/o3AjBIcNkMIY0PmKD/OEfu1GHVymfVUWp3F5BrTXYo3Lvy1Nz/E+GEN9aDtGEkyrZe0zpzO+Irg==",
"requires": { "requires": {
"tslib": "^1.9.0" "tslib": "^1.9.0"
} }
......
...@@ -121,7 +121,7 @@ export function createTranslateLoader(http: HttpClient) { ...@@ -121,7 +121,7 @@ export function createTranslateLoader(http: HttpClient) {
// { provide: AuthGuard, useClass: AuthGuard}, // { provide: AuthGuard, useClass: AuthGuard},
// { provide: AuthenticationService, useClass: ByteAuthenticationService }, // { provide: AuthenticationService, useClass: ByteAuthenticationService },
// { provide: HTTP_INTERCEPTORS, useClass: AuthenticationFakeBackendInterceptor, multi: true}, // { provide: HTTP_INTERCEPTORS, useClass: AuthenticationFakeBackendInterceptor, multi: true},
//{ provide: HTTP_INTERCEPTORS, useClass: SettingsFakeBackendInterceptor, multi: true }, { provide: HTTP_INTERCEPTORS, useClass: SettingsFakeBackendInterceptor, multi: true },
//{ provide: HTTP_INTERCEPTORS, useClass: CustomProgramsFakeBackendInterceptor, multi: true }, //{ provide: HTTP_INTERCEPTORS, useClass: CustomProgramsFakeBackendInterceptor, multi: true },
// { provide: HTTP_INTERCEPTORS, useClass: AgentFakeBackendInterceptor, multi: true }, // { provide: HTTP_INTERCEPTORS, useClass: AgentFakeBackendInterceptor, multi: true },
......
...@@ -65,7 +65,7 @@ const columnTemplateArray = [ ...@@ -65,7 +65,7 @@ const columnTemplateArray = [
{ {
name: 'version', name: 'version',
sortable: true, sortable: true,
title: 'agent_version', title: 'agent_publish_version',
visible: true, visible: true,
filtable: true, filtable: true,
style: { width: 'auto' }, style: { width: 'auto' },
......
<div class="wrapper wrapper-content animated fadeInRight"> <div class="wrapper wrapper-content animated fadeInRight">
<div class="row"> <div class="row">
<div class="col-lg-12"> <div class="col-lg-12">
<div class="ibox float-e-margins"> <div class="ibox float-e-margins">
<!-- <div class="ibox-title"> <!-- <div class="ibox-title">
<h5>{{'reconciliation.title' | translate}}</h5> <h5>{{'reconciliation.title' | translate}}</h5>
</div> --> </div> -->
<div class="ibox-content"> <div class="ibox-content">
<mat-horizontal-stepper labelPosition="bottom" #stepper [linear]="true"> <mat-horizontal-stepper labelPosition="bottom" #stepper [linear]="true">
<mat-step state="info"> <mat-step state="info">
<ng-template matStepLabel> <ng-template matStepLabel>
<span class="font-bold">{{'label.general-information.title' | translate}}</span> <span class="font-bold">{{'label.general-information.title' | translate}}</span>
<div class="font-size-description" [title]="'label.general-information.description' | translate"> <div class="font-size-description" [title]="'label.general-information.description' | translate">
{{'label.general-information.description' | translate}} {{'label.general-information.description' | translate}}
</div> </div>
</ng-template> </ng-template>
<byte-ca-general-information [stepper]="stepper"></byte-ca-general-information> <byte-ca-general-information [stepper]="stepper" (onNextPage)="updateDirtyStatus($event)"></byte-ca-general-information>
</mat-step> </mat-step>
<mat-step state="questions"> <mat-step state="questions">
<ng-template matStepLabel> <ng-template matStepLabel>
<span class="font-bold">{{'label.questions.title' | translate}}</span> <span class="font-bold">{{'label.questions.title' | translate}}</span>
<div class="font-size-description" [title]="'label.questions.description' | translate"> <div class="font-size-description" [title]="'label.questions.description' | translate">
{{'label.questions.description' | translate}} {{'label.questions.description' | translate}}
</div> </div>
</ng-template>
<byte-ca-frequent-questions [stepper]="stepper"></byte-ca-frequent-questions>
</mat-step>
<mat-step state="deployment-channels">
<ng-template matStepLabel>
<span class="font-bold">{{'label.deployment-channels.title' | translate}}</span>
<div class="font-size-description" [title]="'label.deployment-channels.description' | translate">
{{'label.deployment-channels.description' | translate}}
</div>
</ng-template>
<byte-ca-deployment-channels [stepper]="stepper"></byte-ca-deployment-channels>
</mat-step>
<!--
<mat-step state="summary">
<ng-template matStepLabel>
<span class="font-bold">{{'label.summary.title' | translate}}</span>
<div class="font-size-description" [title]="'label.summary.description' | translate">
{{'label.summary.description' | translate}}
</div>
</ng-template>
<byte-es-summary [stepper]="stepper"></byte-es-summary>
</mat-step>
-->
<ng-template matStepperIcon="info">
<mat-icon>info</mat-icon>
</ng-template>
<ng-template matStepperIcon="questions">
<mat-icon>dns</mat-icon>
</ng-template> </ng-template>
<ng-template matStepperIcon="deployment-channels"> <byte-ca-frequent-questions [stepper]="stepper" (onNextPage)="updateDirtyStatus($event)"></byte-ca-frequent-questions>
<mat-icon>chat</mat-icon> </mat-step>
</ng-template>
<!-- <mat-step state="deployment-channels">
<ng-template matStepperIcon="summary"> <ng-template matStepLabel>
<mat-icon>done_all</mat-icon> <span class="font-bold">{{'label.deployment-channels.title' | translate}}</span>
<div class="font-size-description" [title]="'label.deployment-channels.description' | translate">
{{'label.deployment-channels.description' | translate}}
</div>
</ng-template>
<byte-ca-deployment-channels [stepper]="stepper" [changes]="generalDirty"></byte-ca-deployment-channels>
</mat-step>
<!--
<mat-step state="summary">
<ng-template matStepLabel>
<span class="font-bold">{{'label.summary.title' | translate}}</span>
<div class="font-size-description" [title]="'label.summary.description' | translate">
{{'label.summary.description' | translate}}
</div>
</ng-template> </ng-template>
--> <byte-es-summary [stepper]="stepper"></byte-es-summary>
</mat-horizontal-stepper> </mat-step>
-->
</div>
<ng-template matStepperIcon="info">
<mat-icon>info</mat-icon>
</ng-template>
<ng-template matStepperIcon="questions">
<mat-icon>dns</mat-icon>
</ng-template>
<ng-template matStepperIcon="deployment-channels">
<mat-icon>chat</mat-icon>
</ng-template>
<!--
<ng-template matStepperIcon="summary">
<mat-icon>done_all</mat-icon>
</ng-template>
-->
</mat-horizontal-stepper>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div>
\ No newline at end of file
...@@ -38,6 +38,8 @@ export class AgentComponent implements OnInit, IDirty { ...@@ -38,6 +38,8 @@ export class AgentComponent implements OnInit, IDirty {
resourceAuth: any; resourceAuth: any;
//dirty acumulado
generalDirty: boolean = false;
constructor( constructor(
private _vcRef: ViewContainerRef, private _vcRef: ViewContainerRef,
...@@ -100,4 +102,8 @@ export class AgentComponent implements OnInit, IDirty { ...@@ -100,4 +102,8 @@ export class AgentComponent implements OnInit, IDirty {
} }
updateDirtyStatus(event: boolean) {
this.generalDirty = this.generalDirty || event;
}
} }
...@@ -10,6 +10,7 @@ export class CaDeploymentChannelsModalComponent implements OnInit { ...@@ -10,6 +10,7 @@ export class CaDeploymentChannelsModalComponent implements OnInit {
channels: Array<any>; channels: Array<any>;
selectedChannel: any; selectedChannel: any;
applicationSettings:any;
constructor( constructor(
public dialogRef: MatDialogRef<CaDeploymentChannelsModalComponent>, public dialogRef: MatDialogRef<CaDeploymentChannelsModalComponent>,
......
...@@ -22,8 +22,15 @@ ...@@ -22,8 +22,15 @@
</div> --> </div> -->
<h4 class="mt-3"> <h4 class="mt-3">
<button class="pull-right" mat-icon-button (click)="addChannel()" *ngIf="!viewMode"> <!-- <button class="pull-right" mat-icon-button (click)="addChannel()" *ngIf="!viewMode && isAvaliableChannels">
<i class="fa fa-plus"></i> <i class="fa fa-plus"></i>
</button> -->
<button type="button" class="btn btn-outline-primary btn-sm pull-right" (click)="addChannel()"
*ngIf="!viewMode && (deploymentChannels && deploymentChannels.length) && isAvaliableChannels">
<i class="fa fa-file"></i>
<span class="visible-md-inline visible-lg-inline visible-xl-inline">
{{'Añadir canal' | translate}}
</span>
</button> </button>
<b>{{'label.channels' | translate}}</b> <b>{{'label.channels' | translate}}</b>
</h4> </h4>
...@@ -36,35 +43,48 @@ ...@@ -36,35 +43,48 @@
<img [src]="channel.channelImage" class="icon"> <img [src]="channel.channelImage" class="icon">
<div> <div>
<span style="margin-right: 8px;">{{ channel.channelName }}</span> <span style="margin-right: 8px;">{{ channel.channelName }}</span>
<small class="text-muted">{{ channel.name }}</small> <ng-container *ngIf="channel?.suggestTitle && channel?.suggestDetail">
<ng-template #popContent><div [innerHTML]="channel?.suggestDetail"></div></ng-template>
<ng-template #popoverTitle><div [innerHTML]="channel?.suggestTitle"></div></ng-template>
<i class="fa fa-info-circle" placement="top" style="color: rgba(0, 0, 0, 0.54);"
[ngbPopover]="popContent"
[popoverTitle]="popoverTitle" triggers="hover"></i>
</ng-container>
<!-- <small class="text-muted">{{ channel.name }}</small> -->
</div> </div>
</mat-panel-title> </mat-panel-title>
<mat-panel-description> <mat-panel-description>
<label class="label label-success" <!-- <label class="label label-success"
*ngIf="channel.active">{{'label.active' | translate}}</label> *ngIf="channel.active">{{'label.active' | translate}}</label>
<label class="label label-default" <label class="label label-default"
*ngIf="!channel.active">{{'label.inactive' | translate}}</label> *ngIf="!channel.active">{{'label.inactive' | translate}}</label> -->
<mat-slide-toggle [(ngModel)]="channel.active" [disabled]="viewMode"
style="margin-top: 0;" [ngModelOptions]="{standalone: true}" color="primary"
(click)="$event.stopPropagation();">
<span *ngIf="channel.active">{{'label.active' | translate}}</span>
<span *ngIf="!channel.active">{{'label.inactive' | translate}}</span>
</mat-slide-toggle>
</mat-panel-description> </mat-panel-description>
</mat-expansion-panel-header> </mat-expansion-panel-header>
<div> <div>
<form role="form" novalidate (ngSubmit)="ok()" #myForm="ngForm" autocomplete="off"> <form role="form" novalidate #myForm="ngForm" autocomplete="off">
<div class="row"> <div class="row">
<div class="col-6"> <!-- <div class="col-6">
<mat-form-field class="amd-form-control"> <mat-form-field class="amd-form-control">
<mat-label>{{'label.name' | translate}}</mat-label> <mat-label>{{'label.name' | translate}}</mat-label>
<input matInput maxlength="80" [type]="text" required="true" <input matInput maxlength="80" [type]="text" required="true"
[disabled]="viewMode" [(ngModel)]="channel.name" [disabled]="viewMode" [(ngModel)]="channel.name"
[ngModelOptions]="{standalone: true}"> [ngModelOptions]="{standalone: true}">
</mat-form-field> </mat-form-field>
</div> </div> -->
<div class="col-6"> <!-- <div class="col-6">
<mat-slide-toggle [(ngModel)]="channel.active" [disabled]="viewMode" <mat-slide-toggle [(ngModel)]="channel.active" [disabled]="viewMode"
[ngModelOptions]="{standalone: true}" color="primary"> [ngModelOptions]="{standalone: true}" color="primary">
<span *ngIf="channel.active">{{'label.active' | translate}}</span> <span *ngIf="channel.active">{{'label.active' | translate}}</span>
<span *ngIf="!channel.active">{{'label.inactive' | translate}}</span> <span *ngIf="!channel.active">{{'label.inactive' | translate}}</span>
</mat-slide-toggle> </mat-slide-toggle>
</div> </div> -->
</div> </div>
<div class="row" *ngFor="let field of channel.parameters"> <div class="row" *ngFor="let field of channel.parameters">
<div class="col-12"> <div class="col-12">
...@@ -76,7 +96,11 @@ ...@@ -76,7 +96,11 @@
--> -->
<input matInput [maxlength]="field.maxlength" [(ngModel)]="field.value" <input matInput [maxlength]="field.maxlength" [(ngModel)]="field.value"
[ngModelOptions]="{standalone: true}" [disabled]="viewMode" [ngModelOptions]="{standalone: true}" [disabled]="viewMode"
[type]="(field.type ? field.type : 'text')" [required]="field.required"> #fieldForm='ngModel' [type]="(field.type ? field.type : 'text')"
[required]="field.required" (ngModelChange)="onChange(fieldForm)"
[pattern]="field?.regex">
<mat-error *ngIf="fieldForm.errors?.pattern">
{{ 'Formato inválido' | translate }}</mat-error>
</mat-form-field> </mat-form-field>
</div> </div>
</div> </div>
...@@ -93,7 +117,13 @@ ...@@ -93,7 +117,13 @@
</mat-accordion> </mat-accordion>
<div *ngIf="!(deploymentChannels && deploymentChannels.length)" class="border-all text-center"> <div *ngIf="!(deploymentChannels && deploymentChannels.length)" class="border-all text-center">
Seleccione <i class="fa fa-plus"></i> para agregar un canal de despliegue <button type="button" class="btn btn-outline-primary btn-sm" (click)="addChannel()"
*ngIf="!viewMode && isAvaliableChannels">
<i class="fa fa-file"></i>
<span class="visible-md-inline visible-lg-inline visible-xl-inline">
{{'Añadir canal' | translate}}
</span>
</button>
<!-- {{'label.delete-channel' | translate}} --> <!-- {{'label.delete-channel' | translate}} -->
</div> </div>
</div> </div>
...@@ -108,7 +138,8 @@ ...@@ -108,7 +138,8 @@
<i class="fa fa-chevron-left"></i> <i class="fa fa-chevron-left"></i>
<span class="pl-1">{{'btn.previous' | translate}}</span> <span class="pl-1">{{'btn.previous' | translate}}</span>
</button> </button>
<button mat-stroked-button color="primary" (click)="save()" class="pull-right" *ngIf="!viewMode"> <button mat-stroked-button color="primary" type="submit" (click)="save()" class="pull-right"
*ngIf="!viewMode">
<span class="pr-1">{{'btn.save' | translate}}</span> <span class="pr-1">{{'btn.save' | translate}}</span>
<i class="fa fa-chevron-right"></i> <i class="fa fa-chevron-right"></i>
</button> </button>
......
import { Component, OnInit, Input } from '@angular/core'; import { Component, OnInit, Input, ViewChild } from '@angular/core';
import { MatStepper, MatDialog } from '@angular/material'; import { MatStepper, MatDialog, ErrorStateMatcher, MatInput } from '@angular/material';
import { CaDeploymentChannelsModalComponent } from '../ca-deployment-channels-modal/ca-deployment-channels-modal.component'; import { CaDeploymentChannelsModalComponent } from '../ca-deployment-channels-modal/ca-deployment-channels-modal.component';
import { AgentService } from '../../../service/agent.service'; import { AgentService } from '../../../service/agent.service';
import { first } from 'rxjs/operators'; import { first } from 'rxjs/operators';
import { NotificationType, NotificationService } from '@xdf/commons'; import { NotificationType, NotificationService } from '@xdf/commons';
import { TranslateService } from '@ngx-translate/core'; import { TranslateService } from '@ngx-translate/core';
import { Router, ActivatedRoute } from '@angular/router'; import { Router, ActivatedRoute } from '@angular/router';
import { Form, FormControl, FormGroup, FormGroupDirective, NgForm } from '@angular/forms';
@Component({ @Component({
selector: 'byte-ca-deployment-channels', selector: 'byte-ca-deployment-channels',
...@@ -16,12 +17,21 @@ export class CaDeploymentChannelsComponent implements OnInit { ...@@ -16,12 +17,21 @@ export class CaDeploymentChannelsComponent implements OnInit {
@Input() stepper: MatStepper; @Input() stepper: MatStepper;
@Input() changes: boolean = false;
@ViewChild('fieldForm', {static: false})
fieldFormList: any;
agentDetail: any; agentDetail: any;
channels: Array<any>; channels: Array<any>;
deploymentChannels: Array<any> = new Array<any>(); deploymentChannels: Array<any> = new Array<any>();
dirty: boolean = true; dirty: boolean = true;
step = -1; step = -1;
viewMode: boolean = false; viewMode: boolean = false;
isAvaliableChannels: boolean = false;
mode: string = 'new';
detailText: string = "Detail";
titleText: string = "Titulo"
constructor( constructor(
private activatedRoute: ActivatedRoute, private activatedRoute: ActivatedRoute,
...@@ -32,7 +42,8 @@ export class CaDeploymentChannelsComponent implements OnInit { ...@@ -32,7 +42,8 @@ export class CaDeploymentChannelsComponent implements OnInit {
private router: Router private router: Router
) { ) {
this.viewMode = this.activatedRoute.snapshot.data.mode === 'view'; this.mode = this.activatedRoute.snapshot.data.mode;
this.viewMode = this.mode === 'view';
} }
...@@ -46,6 +57,7 @@ export class CaDeploymentChannelsComponent implements OnInit { ...@@ -46,6 +57,7 @@ export class CaDeploymentChannelsComponent implements OnInit {
} }
this.buildList(); this.buildList();
this.buildAvaliableChannels();
}); });
} }
...@@ -66,6 +78,8 @@ export class CaDeploymentChannelsComponent implements OnInit { ...@@ -66,6 +78,8 @@ export class CaDeploymentChannelsComponent implements OnInit {
deploymentChannel.channelName = channel.name; deploymentChannel.channelName = channel.name;
deploymentChannel.channelImage = channel.image; deploymentChannel.channelImage = channel.image;
deploymentChannel.active = (deploymentChannel.status === 'AC'); deploymentChannel.active = (deploymentChannel.status === 'AC');
deploymentChannel.suggestTitle = channel.suggestTitle;
deploymentChannel.suggestDetail = channel.suggestDetail;
for (let parameter of deploymentChannel.parameters) { for (let parameter of deploymentChannel.parameters) {
...@@ -77,6 +91,7 @@ export class CaDeploymentChannelsComponent implements OnInit { ...@@ -77,6 +91,7 @@ export class CaDeploymentChannelsComponent implements OnInit {
parameter.required = field.required; parameter.required = field.required;
parameter.traductions = field.traductions; parameter.traductions = field.traductions;
parameter.maxlength = field.maxlength; parameter.maxlength = field.maxlength;
parameter.regex = field.regex;
break; break;
} }
...@@ -90,7 +105,8 @@ export class CaDeploymentChannelsComponent implements OnInit { ...@@ -90,7 +105,8 @@ export class CaDeploymentChannelsComponent implements OnInit {
} }
} }
addChannel() { buildAvaliableChannels() {
this.isAvaliableChannels = false;
mainLoop: for (let channel of this.channels) { mainLoop: for (let channel of this.channels) {
channel.disabled = false; channel.disabled = false;
...@@ -100,9 +116,13 @@ export class CaDeploymentChannelsComponent implements OnInit { ...@@ -100,9 +116,13 @@ export class CaDeploymentChannelsComponent implements OnInit {
continue mainLoop; continue mainLoop;
} }
} }
if (!channel.disabled) {
this.isAvaliableChannels = true;
}
} }
}
addChannel() {
let dialog = this.matDialog.open(CaDeploymentChannelsModalComponent, { let dialog = this.matDialog.open(CaDeploymentChannelsModalComponent, {
width: '500px', width: '500px',
data: { data: {
...@@ -123,12 +143,14 @@ export class CaDeploymentChannelsComponent implements OnInit { ...@@ -123,12 +143,14 @@ export class CaDeploymentChannelsComponent implements OnInit {
this.deploymentChannels.push(selectedChannel); this.deploymentChannels.push(selectedChannel);
this.setStep(this.deploymentChannels.length - 1); this.setStep(this.deploymentChannels.length - 1);
this.buildAvaliableChannels();
} }
}); });
} }
deleteChannel(i) { deleteChannel(i) {
this.deploymentChannels.splice(i, 1); this.deploymentChannels.splice(i, 1);
this.buildAvaliableChannels();
} }
exit() { exit() {
...@@ -141,10 +163,12 @@ export class CaDeploymentChannelsComponent implements OnInit { ...@@ -141,10 +163,12 @@ export class CaDeploymentChannelsComponent implements OnInit {
} }
save() { save() {
let isValid: boolean = this.validate(); let isValid: boolean = this.validate();
if (!isValid) { if (!isValid) {
if (this.fieldFormList && this.fieldFormList.control) {
this.fieldFormList.control.markAsTouched();
}
return; return;
} }
...@@ -201,6 +225,12 @@ export class CaDeploymentChannelsComponent implements OnInit { ...@@ -201,6 +225,12 @@ export class CaDeploymentChannelsComponent implements OnInit {
} }
onChange(fieldForm) {
if (!fieldForm.control.touched) {
fieldForm.control.markAsTouched();
}
}
setStep(step) { setStep(step) {
this.step = step; this.step = step;
} }
...@@ -211,16 +241,25 @@ export class CaDeploymentChannelsComponent implements OnInit { ...@@ -211,16 +241,25 @@ export class CaDeploymentChannelsComponent implements OnInit {
mainLoop: for (let deploymentChannel of this.deploymentChannels) { mainLoop: for (let deploymentChannel of this.deploymentChannels) {
let deploymentChannelTmp: any = {}; let deploymentChannelTmp: any = {};
if (!deploymentChannel.name) { // if (!deploymentChannel.name) {
valid = false; // valid = false;
break; // break;
} // }
for (let parameter of deploymentChannel.parameters) { for (let parameter of deploymentChannel.parameters) {
parameter.error = false;
if (!parameter.value) { if (!parameter.value) {
valid = false; valid = false;
break mainLoop; break mainLoop;
} }
if (parameter.regex) {
let regex = new RegExp(parameter.regex);
if (!regex.test(parameter.value)) {
parameter.error = true;
valid = false;
break mainLoop;
}
}
} }
} }
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
</div> </div>
<div class="title_header_popup"> <div class="title_header_popup">
<h2 mat-dialog-title> <h2 mat-dialog-title>
<span> {{'label.file-upload.title' | translate}} </span> <i class="fa fa-exclamation-triangle" [hidden]="!fileErrorDetail"></i><span> {{'label.file-upload.title' | translate}} </span>
</h2> </h2>
</div> </div>
</div> </div>
...@@ -97,9 +97,15 @@ ...@@ -97,9 +97,15 @@
</div> </div>
</mat-dialog-content> </mat-dialog-content>
<mat-dialog-actions align="end"> <!-- <mat-dialog-actions align="end">
<button mat-button mat-dialog-close>{{'btn.cancel' | translate}}</button> <button mat-button mat-dialog-close>{{'btn.cancel' | translate}}</button>
<button mat-button (click)="retry()" *ngIf="fileErrorDetail">{{'btn.retry' | translate}}</button> <button mat-button (click)="retry()" *ngIf="fileErrorDetail">{{'btn.retry' | translate}}</button>
<button mat-button (click)="ok()" cdkFocusInitial *ngIf="!fileErrorDetail" <button mat-button (click)="ok()" cdkFocusInitial *ngIf="!fileErrorDetail"
[disabled]="formGroup.invalid || !enabledOK">{{'btn.accept' | translate}}</button> [disabled]="formGroup.invalid || !enabledOK">{{'btn.accept' | translate}}</button>
</mat-dialog-actions> </mat-dialog-actions> -->
\ No newline at end of file <div mat-dialog-actions class="border-top">
<button mat-button mat-dialog-close>{{'btn.cancel' | translate}}</button>
<button mat-button (click)="retry()" *ngIf="fileErrorDetail">{{'btn.retry' | translate}}</button>
<button mat-button (click)="ok()" cdkFocusInitial *ngIf="!fileErrorDetail"
[disabled]="formGroup.invalid || !enabledOK">{{'btn.accept' | translate}}</button>
</div>
\ No newline at end of file
...@@ -10,3 +10,11 @@ table { ...@@ -10,3 +10,11 @@ table {
.none-overflow{ .none-overflow{
overflow: hidden; overflow: hidden;
} }
.title_header_popup {
i {
font-size: 28px;
padding-right: 20px;
color: red;
}
}
\ No newline at end of file
...@@ -39,6 +39,7 @@ export class CaFileUploadModalComponent implements OnInit { ...@@ -39,6 +39,7 @@ export class CaFileUploadModalComponent implements OnInit {
dataSource = new MatTableDataSource([]); dataSource = new MatTableDataSource([]);
displayedColumns: string[] = []; displayedColumns: string[] = [];
applicationSettings:any;
constructor( constructor(
...@@ -170,7 +171,6 @@ export class CaFileUploadModalComponent implements OnInit { ...@@ -170,7 +171,6 @@ export class CaFileUploadModalComponent implements OnInit {
return of(`${file.data.name} upload failed.`); return of(`${file.data.name} upload failed.`);
}) })
).subscribe((event: any) => { ).subscribe((event: any) => {
console.log(event);
if (typeof (event) === 'object') { if (typeof (event) === 'object') {
this.fileErrorDetail = undefined; this.fileErrorDetail = undefined;
this.enabledOK = false; this.enabledOK = false;
......
...@@ -20,12 +20,12 @@ ...@@ -20,12 +20,12 @@
</div> </div>
<div class="border-all text-center" *ngIf="!(dataSource.data && dataSource.data.length)"> <div class="border-all text-center" *ngIf="!(dataSource.data && dataSource.data.length)">
Seleccione <button type="button" class="btn btn-outline-primary btn-sm " (click)="addFile()"> <button type="button" class="btn btn-outline-primary btn-sm " (click)="addFile()">
<i class="fa fa-file-excel-o"></i> <i class="fa fa-file-excel-o"></i>
<span class="visible-md-inline visible-lg-inline visible-xl-inline"> <span class="visible-md-inline visible-lg-inline visible-xl-inline">
{{'btn.new.file' | translate}} {{'btn.upload.file' | translate}}
</span> </span>
</button> para cargar un archivo de preguntas frecuentes </button>
</div> </div>
<div class="table-container mat-elevation-z8 p-b-15 mt-3" [hidden]="!(dataSource.data && dataSource.data.length)"> <div class="table-container mat-elevation-z8 p-b-15 mt-3" [hidden]="!(dataSource.data && dataSource.data.length)">
......
import { Component, OnInit, Input, ViewContainerRef, ViewChild } from '@angular/core'; import { Component, OnInit, Input, ViewContainerRef, ViewChild, Output, EventEmitter } from '@angular/core';
import { MatStepper, MatDialog, MatTableDataSource, MatSort } from '@angular/material'; import { MatStepper, MatDialog, MatTableDataSource, MatSort } from '@angular/material';
import { ActivatedRoute, Router } from '@angular/router'; import { ActivatedRoute, Router } from '@angular/router';
import { animate, trigger, state, transition, style } from '@angular/animations'; import { animate, trigger, state, transition, style } from '@angular/animations';
...@@ -25,7 +25,10 @@ export class CaFrequentQuestionsComponent implements OnInit { ...@@ -25,7 +25,10 @@ export class CaFrequentQuestionsComponent implements OnInit {
@Input() stepper: MatStepper; @Input() stepper: MatStepper;
@Output() onNextPage: EventEmitter<boolean> = new EventEmitter<boolean>();
public resourceAuth = new Object(); public resourceAuth = new Object();
dirty: boolean = false;
...@@ -74,7 +77,7 @@ export class CaFrequentQuestionsComponent implements OnInit { ...@@ -74,7 +77,7 @@ export class CaFrequentQuestionsComponent implements OnInit {
} }
isDirty() { isDirty() {
return false; return this.dirty;
} }
buildForm(agentDetail: any) { buildForm(agentDetail: any) {
...@@ -120,6 +123,7 @@ export class CaFrequentQuestionsComponent implements OnInit { ...@@ -120,6 +123,7 @@ export class CaFrequentQuestionsComponent implements OnInit {
let listTemp = this.dataSource.data; let listTemp = this.dataSource.data;
listTemp.push(fileAdded); listTemp.push(fileAdded);
this.dataSource.data = listTemp; this.dataSource.data = listTemp;
this.dirty = true;
} }
}); });
} }
...@@ -158,6 +162,7 @@ export class CaFrequentQuestionsComponent implements OnInit { ...@@ -158,6 +162,7 @@ export class CaFrequentQuestionsComponent implements OnInit {
let listTemp = this.dataSource.data; let listTemp = this.dataSource.data;
listTemp.splice(index, 1); listTemp.splice(index, 1);
this.dataSource.data = listTemp; this.dataSource.data = listTemp;
this.dirty = true;
} }
next() { next() {
...@@ -171,6 +176,7 @@ export class CaFrequentQuestionsComponent implements OnInit { ...@@ -171,6 +176,7 @@ export class CaFrequentQuestionsComponent implements OnInit {
} }
if (this.saveQuestions(true)) { if (this.saveQuestions(true)) {
this.onNextPage.emit(this.isDirty());
this.stepper.next(); this.stepper.next();
} }
} }
......
...@@ -20,9 +20,8 @@ ...@@ -20,9 +20,8 @@
class="mat-placeholder-required mat-form-field-required-marker"> *</span> class="mat-placeholder-required mat-form-field-required-marker"> *</span>
</label> </label>
<div class="h-85"> <div class="h-85">
<div [ngStyle]="{'height': (height && height !== '') ? (height) : '','width': (width && width !== '') ? (width) : ''}" <div class="image-preview">
class="image-preview"> <div [ngClass]="{'with-image': formGroup.controls['imageAvatar'].value, 'edit-image': formGroup.controls['imageAvatar'].value, 'without-image': !formGroup.controls['imageAvatar'].value}">
<div [ngClass]="{'with-image': formGroup.controls['imageAvatar'].value && disabled, 'edit-image': formGroup.controls['imageAvatar'].value && !disabled, 'without-image': !formGroup.controls['imageAvatar'].value}">
<img src="{{ urlBase + formGroup.controls['imageAvatar'].value }}" <img src="{{ urlBase + formGroup.controls['imageAvatar'].value }}"
style="height: 100%;" style="height: 100%;"
*ngIf="formGroup.controls['imageAvatar'].value"> *ngIf="formGroup.controls['imageAvatar'].value">
...@@ -32,12 +31,12 @@ ...@@ -32,12 +31,12 @@
<button type="button" mat-stroked-button (click)="fileInput.click()" <button type="button" mat-stroked-button (click)="fileInput.click()"
*ngIf="!viewMode" class="btn-upload-image"> *ngIf="!viewMode" class="btn-upload-image">
<mat-icon>file_upload</mat-icon> <mat-icon>file_upload</mat-icon>
{{text | translate}} <!-- {{text | translate}} -->
</button> </button>
</div> </div>
</div> </div>
<input type="file" #fileInput name="fileUpload" <input type="file" #fileInput name="fileUpload"
(change)="uploadFiles($event.target.files)" accept="{{accept}}" (change)="uploadFiles($event.target.files)"
style="display:none;" > style="display:none;" >
</div> </div>
</div> </div>
......
import { Component, OnInit, Input, ViewContainerRef } from '@angular/core'; import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
import { Subscription, of } from 'rxjs';
import { FormGroup, FormBuilder, FormControl, Validators } from '@angular/forms'; import { FormGroup, FormBuilder, FormControl, Validators } from '@angular/forms';
import { MatStepper } from '@angular/material'; import { MatStepper } from '@angular/material';
import { ActivatedRoute } from '@angular/router'; import { ActivatedRoute } from '@angular/router';
...@@ -28,10 +27,13 @@ export class CaGeneralInformationComponent implements OnInit { ...@@ -28,10 +27,13 @@ export class CaGeneralInformationComponent implements OnInit {
@Input() stepper: MatStepper; @Input() stepper: MatStepper;
@Output() onNextPage: EventEmitter<boolean> = new EventEmitter<boolean>();
agentDetail: any; agentDetail: any;
formGroup: FormGroup; formGroup: FormGroup;
viewMode: boolean; viewMode: boolean;
mode: string = 'new';
imageName = "imageAvatar"; imageName = "imageAvatar";
urlBase = ''; urlBase = '';
...@@ -63,7 +65,8 @@ export class CaGeneralInformationComponent implements OnInit { ...@@ -63,7 +65,8 @@ export class CaGeneralInformationComponent implements OnInit {
private _translateService: TranslateService private _translateService: TranslateService
) { ) {
this.viewMode = this._activatedRoute.snapshot.data.mode === 'view'; 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({ this.formGroup = this.formBuilder.group({
...@@ -167,6 +170,7 @@ export class CaGeneralInformationComponent implements OnInit { ...@@ -167,6 +170,7 @@ export class CaGeneralInformationComponent implements OnInit {
} }
if (this.saveGeneralInformation(true)) { if (this.saveGeneralInformation(true)) {
this.onNextPage.emit(this.isDirty());
this.stepper.next(); this.stepper.next();
} }
} }
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
"options": { "options": {
"styleClass": "col-md-6", "styleClass": "col-md-6",
"showLength": true, "showLength": true,
"maxLength": 80, "maxLength": 30,
"showStrength": false "showStrength": false
}, },
"validators": [ "validators": [
...@@ -125,9 +125,15 @@ ...@@ -125,9 +125,15 @@
"options": { "options": {
"styleClass": "col-xs-3 col-sm-6 col-md-6", "styleClass": "col-xs-3 col-sm-6 col-md-6",
"showLength": true, "showLength": true,
"maxLength": 80 "maxLength": 30
}, },
"validators": [], "validators": [
"names",
{
"name": "minLength",
"value": 2
}
],
"controlType": "text" "controlType": "text"
} }
}, },
...@@ -138,10 +144,15 @@ ...@@ -138,10 +144,15 @@
"options": { "options": {
"styleClass": "col-xs-3 col-sm-6 col-md-6", "styleClass": "col-xs-3 col-sm-6 col-md-6",
"showLength": true, "showLength": true,
"maxLength": 80 "maxLength": 30
}, },
"validators": [ "validators": [
"required" "names",
"required",
{
"name": "minLength",
"value": 2
}
], ],
"controlType": "text" "controlType": "text"
} }
...@@ -153,10 +164,15 @@ ...@@ -153,10 +164,15 @@
"options": { "options": {
"styleClass": "col-xs-3 col-sm-6 col-md-6", "styleClass": "col-xs-3 col-sm-6 col-md-6",
"showLength": true, "showLength": true,
"maxLength": 80 "maxLength": 30
}, },
"validators": [ "validators": [
"required" "names",
"required",
{
"name": "minLength",
"value": 2
}
], ],
"controlType": "text" "controlType": "text"
} }
......
...@@ -12,16 +12,17 @@ ...@@ -12,16 +12,17 @@
"agent_status": "Estado", "agent_status": "Estado",
"agent_country": "País", "agent_country": "País",
"agent_timezone": "Zona horaria", "agent_timezone": "Zona horaria",
"agent_publish_version": "Versión publicada",
"btn.file.upload": "Cargar", "btn.file.upload": "Cargar",
"btn.accept": "Aceptar", "btn.accept": "Aceptar",
"label.deployment-channels.title": "Canales de despliegue", "label.deployment-channels.title": "Canales de mensajería",
"label.deployment-channels.description": "Configure los canales de mensajería por los cuales interactuará el agente", "label.deployment-channels.description": "Configure los canales de mensajería por los cuales interactuará el agente",
"label.channels": "Canales configurados", "label.channels": "Canales configurados",
"label.active": "Activo", "label.active": "Activo",
"label.inactive": "Inactivo", "label.inactive": "Inactivo",
"label.name": "Nombre", "label.name": "Nombre",
"label.deployment-channels.configuration": "Canales de despliegue", "label.deployment-channels.configuration": "Canales de mensajería",
"label.deployment-channels.configuration.description": "Seleccione un canal de despliegue", "label.deployment-channels.configuration.description": "Seleccione un canal de mensajería",
"label.status.pending": "Pendiente", "label.status.pending": "Pendiente",
"label.status.loaded": "Cargado", "label.status.loaded": "Cargado",
"label.status.off": "En Baja", "label.status.off": "En Baja",
...@@ -69,5 +70,6 @@ ...@@ -69,5 +70,6 @@
"label.file-upload.error.subtitle": "Detalle de error", "label.file-upload.error.subtitle": "Detalle de error",
"label.file-upload.error.description": "Ha ocurrido un error en la validación del archivo.", "label.file-upload.error.description": "Ha ocurrido un error en la validación del archivo.",
"btn.retry": "Cargar otro archivo", "btn.retry": "Cargar otro archivo",
"btn.synchronize": "Sincronizar" "btn.synchronize": "Publicar",
"btn.upload.file": "Subir archivo"
} }
\ No newline at end of file
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