Commit 388cbe14 authored by Sebastian Chicoma's avatar Sebastian Chicoma

Primera integración del wizard de agentes

parent 9207856a
...@@ -22,14 +22,9 @@ const routes: Routes = [ ...@@ -22,14 +22,9 @@ const routes: Routes = [
loadChildren: () => import('./modules/settings/settings.module').then(m => m.SettingsModule) loadChildren: () => import('./modules/settings/settings.module').then(m => m.SettingsModule)
}, },
{ {
path: 'config', data: { breadcrumb: 'Agentes' }, canLoad: [AuthGuard], path: 'configuration', data: { breadcrumb: 'Agentes' }, canLoad: [AuthGuard],
loadChildren: () => import('./modules/agent/agent.module').then(m => m.AgentModule) loadChildren: () => import('./modules/agent/agent.module').then(m => m.AgentModule)
}, },
{
path: 'configuration', canLoad: [AuthGuard],
loadChildren: () => import('./modules/configuration/configuration.module').then(m => m.ConfigurationModule)
}
], ],
canActivate: [AuthGuard] canActivate: [AuthGuard]
}, },
...@@ -38,3 +33,14 @@ const routes: Routes = [ ...@@ -38,3 +33,14 @@ const routes: Routes = [
// Handle all other routes // Handle all other routes
{ path: '**', component: NotFoundComponent} { path: '**', component: NotFoundComponent}
]; ];
@NgModule({
imports: [RouterModule.forRoot(routes, {
scrollPositionRestoration: 'enabled',
anchorScrolling: 'enabled',
onSameUrlNavigation: 'ignore'
})],
exports: [RouterModule]
})
export class AppRoutingModule { }
...@@ -36,6 +36,7 @@ import { ...@@ -36,6 +36,7 @@ import {
MAT_MOMENT_DATE_ADAPTER_OPTIONS, MAT_MOMENT_DATE_ADAPTER_OPTIONS,
} from '@angular/material-moment-adapter'; } from '@angular/material-moment-adapter';
import { CustomProgramsFakeBackendInterceptor } from './interceptors/custom-programs-fake-backend.interceptor'; import { CustomProgramsFakeBackendInterceptor } from './interceptors/custom-programs-fake-backend.interceptor';
import { AgentFakeBackendInterceptor } from './interceptors/agent-fake-backend.interceptor';
const INITIAL_LANGUAGE = 'es'; const INITIAL_LANGUAGE = 'es';
...@@ -110,19 +111,19 @@ export function createTranslateLoader(http: HttpClient) { ...@@ -110,19 +111,19 @@ export function createTranslateLoader(http: HttpClient) {
{ provide: ResourceAuthGuard, useClass: ResourceAuthGuard}, { provide: ResourceAuthGuard, useClass: ResourceAuthGuard},
// descomentar estas lineas para OAUTH // descomentar estas lineas para OAUTH
{ provide: AuthGuard, useClass: OAuthGuard}, //{ provide: AuthGuard, useClass: OAuthGuard},
{ provide: AuthenticationService, useClass: OAuthAuthenticationService }, //{ provide: AuthenticationService, useClass: OAuthAuthenticationService },
{ provide: APP_INITIALIZER, useFactory: loginLoaderFactory, deps: [AuthenticationService], multi: true }, //{ provide: APP_INITIALIZER, useFactory: loginLoaderFactory, deps: [AuthenticationService], multi: true },
// Para probar mantenimientos // Para probar mantenimientos
// comentar estas lineas para OAUTH // comentar estas lineas para OAUTH
// { 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: EntidadFakeFakeBackendInterceptor, multi: true}, { provide: HTTP_INTERCEPTORS, useClass: AgentFakeBackendInterceptor, multi: true},
......
...@@ -47,6 +47,17 @@ const tableData: Array<any> = [ ...@@ -47,6 +47,17 @@ const tableData: Array<any> = [
} }
]; ];
const data: Array<any> = [
{
id: 361,
name: 'BANCO DE CREDITO DEL PERU',
version: '0.0.1',
status: 'Activo',
country: 'Perú',
timezone: 'GMT-5',
avatar: 'https://www.w3schools.com/howto/img_avatar.png'
}
];
@Injectable() @Injectable()
export class AgentFakeBackendInterceptor implements HttpInterceptor { export class AgentFakeBackendInterceptor implements HttpInterceptor {
...@@ -64,6 +75,10 @@ export class AgentFakeBackendInterceptor implements HttpInterceptor { ...@@ -64,6 +75,10 @@ export class AgentFakeBackendInterceptor implements HttpInterceptor {
switch (true) { switch (true) {
case url.endsWith(basePath + '/page') && method === 'POST': case url.endsWith(basePath + '/page') && method === 'POST':
return pagination(body); return pagination(body);
case url.indexOf(basePath + '/connection/data') !== -1 && method === 'GET ':
return ok({});
case url.indexOf(basePath + '/') !== -1 && method === 'GET':
return ok(data);
default: default:
// pass through any requests not handled above // pass through any requests not handled above
return next.handle(request); return next.handle(request);
......
...@@ -6,22 +6,21 @@ import { AgentComponent } from './view/agent/agent.component'; ...@@ -6,22 +6,21 @@ import { AgentComponent } from './view/agent/agent.component';
import { AgentDetailComponent } from './view/agent-detail/agent-detail.component'; import { AgentDetailComponent } from './view/agent-detail/agent-detail.component';
import { AgentDataForWizardResolver } from './resolver/agent-data-wizard.resolver'; import { AgentDataForWizardResolver } from './resolver/agent-data-wizard.resolver';
import { AgentDetailResolver } from './resolver/agent-detail.resolver'; import { AgentDetailResolver } from './resolver/agent-detail.resolver';
import { AgentListComponent } from './view/agent-list/agent.component';
const routes: Routes = [ const routes: Routes = [
{ {
path: 'agent', path: 'agent', component: AgentListComponent, canActivate: [AuthGuard, ResourceAuthGuard],
component: AgentComponent, data: {
canActivate: [AuthGuard, ResourceAuthGuard],
data:
{
program: 'CONVERSATIONAL_AGENT', program: 'CONVERSATIONAL_AGENT',
breadcrumb: 'Agentes' breadcrumb: 'breadcrumb.agent'
} }
}, },
{ {
path: 'agent/detail/new', path: 'agent/detail/new',
component: AgentDetailComponent, //component: AgentDetailComponent,
component: AgentComponent,
resolve: { resolve: {
dataForWizard: AgentDataForWizardResolver dataForWizard: AgentDataForWizardResolver
}, },
...@@ -36,7 +35,8 @@ const routes: Routes = [ ...@@ -36,7 +35,8 @@ const routes: Routes = [
}, },
{ {
path: 'agent/detail/edit/:code', path: 'agent/detail/edit/:code',
component: AgentDetailComponent, //component: AgentDetailComponent,
component: AgentComponent,
resolve: { resolve: {
externalSystemDetail: AgentDetailResolver, externalSystemDetail: AgentDetailResolver,
dataForWizard: AgentDataForWizardResolver dataForWizard: AgentDataForWizardResolver
...@@ -51,7 +51,8 @@ const routes: Routes = [ ...@@ -51,7 +51,8 @@ const routes: Routes = [
} }
},{ },{
path: 'agent/detail/view/:code', path: 'agent/detail/view/:code',
component: AgentDetailComponent, //component: AgentDetailComponent,
component: AgentComponent,
resolve: { resolve: {
externalSystemDetail: AgentDetailResolver, externalSystemDetail: AgentDetailResolver,
dataForWizard: AgentDataForWizardResolver dataForWizard: AgentDataForWizardResolver
......
...@@ -16,6 +16,8 @@ import { AgentDetailComponent } from './view/agent-detail/agent-detail.component ...@@ -16,6 +16,8 @@ import { AgentDetailComponent } from './view/agent-detail/agent-detail.component
import { EsStepsProcessorsModalComponent } from './view/components/es-steps-processors-modal/es-steps-processors-modal.component'; import { EsStepsProcessorsModalComponent } from './view/components/es-steps-processors-modal/es-steps-processors-modal.component';
import { DynamicTranslatePipe } from './pipe/dynamic-translate.pipe'; import { DynamicTranslatePipe } from './pipe/dynamic-translate.pipe';
import { CaGeneralInformationComponent } from './view/components/ca-general-information/ca-general-information.component'; import { CaGeneralInformationComponent } from './view/components/ca-general-information/ca-general-information.component';
import { AgentListComponent } from './view/agent-list/agent.component';
import { CaDeploymentChannelsComponent } from './view/components/ca-deployment-channels/ca-deployment-channels.component';
@NgModule({ @NgModule({
...@@ -24,10 +26,12 @@ import { CaGeneralInformationComponent } from './view/components/ca-general-info ...@@ -24,10 +26,12 @@ import { CaGeneralInformationComponent } from './view/components/ca-general-info
], ],
declarations: [ declarations: [
AgentComponent, AgentComponent,
AgentListComponent,
AgentDetailComponent, AgentDetailComponent,
EsStepsProcessorsModalComponent, EsStepsProcessorsModalComponent,
DynamicTranslatePipe, DynamicTranslatePipe,
CaGeneralInformationComponent], CaGeneralInformationComponent,
CaDeploymentChannelsComponent],
imports: [ imports: [
FormsModule, FormsModule,
ReactiveFormsModule, ReactiveFormsModule,
......
...@@ -12,19 +12,6 @@ export class AgentService extends DynaDataService { ...@@ -12,19 +12,6 @@ export class AgentService extends DynaDataService {
constructor(private httpClient: HttpClient) { constructor(private httpClient: HttpClient) {
super(httpClient); super(httpClient);
} }
isExternalSystemWithDeliverableConnection() {
return this.httpClient.get(this.serviceURL + '/isExternalSystemWithDeliverableConnection');
}
existEntityTableWithTableName(tablename: string) {
return this.httpClient.get(this.serviceURL + '/existEntityTableWithTableName', {
params: {
tablename: tablename
}
});
}
getDataForWizard(agentId: number) { getDataForWizard(agentId: number) {
let params = {}; let params = {};
...@@ -38,8 +25,4 @@ export class AgentService extends DynaDataService { ...@@ -38,8 +25,4 @@ export class AgentService extends DynaDataService {
}); });
} }
validateQuartz(value: string) {
return this.httpClient.get(this.serviceURL + '/connection/validate/quartz?param=' + value);
}
} }
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { AgentComponent } from './agent.component'; import { AgentListComponent } from './agent.component';
describe('AgentComponent', () => { describe('AgentComponent', () => {
let component: AgentComponent; let component: AgentListComponent;
let fixture: ComponentFixture<AgentComponent>; let fixture: ComponentFixture<AgentListComponent>;
beforeEach(async(() => { beforeEach(async(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
declarations: [ AgentComponent ] declarations: [ AgentListComponent ]
}) })
.compileComponents(); .compileComponents();
})); }));
beforeEach(() => { beforeEach(() => {
fixture = TestBed.createComponent(AgentComponent); fixture = TestBed.createComponent(AgentListComponent);
component = fixture.componentInstance; component = fixture.componentInstance;
fixture.detectChanges(); fixture.detectChanges();
}); });
......
...@@ -6,7 +6,7 @@ import { Router, ActivatedRoute } from '@angular/router'; ...@@ -6,7 +6,7 @@ import { Router, ActivatedRoute } from '@angular/router';
import { tap } from 'rxjs/operators'; import { tap } from 'rxjs/operators';
import { TagFilter } from '@xdf/gallery/lib/views/gallery/ngx-tags-input/model/tag-filter'; import { TagFilter } from '@xdf/gallery/lib/views/gallery/ngx-tags-input/model/tag-filter';
import { TranslateService } from '@ngx-translate/core'; import { TranslateService } from '@ngx-translate/core';
import { AgentService } from '../../services/agent.service'; import { AgentService } from '../../service/agent.service';
...@@ -144,7 +144,7 @@ const fieldFilters = [ ...@@ -144,7 +144,7 @@ const fieldFilters = [
templateUrl: './agent.component.html', templateUrl: './agent.component.html',
styleUrls: ['./agent.component.scss'] styleUrls: ['./agent.component.scss']
}) })
export class AgentComponent implements OnInit { export class AgentListComponent implements OnInit {
@ViewChild(MatPaginator, { static: false }) paginator: MatPaginator; @ViewChild(MatPaginator, { static: false }) paginator: MatPaginator;
@ViewChild(MatSort, { static: false }) sort: MatSort; @ViewChild(MatSort, { static: false }) sort: MatSort;
...@@ -304,14 +304,14 @@ export class AgentComponent implements OnInit { ...@@ -304,14 +304,14 @@ export class AgentComponent implements OnInit {
} }
edit(item) { edit(item) {
this.router.navigate(['/etl/external-system/detail/edit/' + item.id]); this.router.navigate(['/configuration/agent/detail/edit/' + item.id]);
} }
view(item) { view(item) {
this.router.navigate(['/etl/external-system/detail/view/' + item.id]); this.router.navigate(['/configuration/agent/detail/view/' + item.id]);
} }
create() { create() {
this.router.navigate(['/etl/external-system/detail/new']); this.router.navigate(['/configuration/agent/detail/new']);
} }
} }
...@@ -27,17 +27,18 @@ ...@@ -27,17 +27,18 @@
</ng-template> </ng-template>
<byte-es-connections [stepper]="stepper" (onDeleteConnection)="onDeleteConnection($event)"></byte-es-connections> <byte-es-connections [stepper]="stepper" (onDeleteConnection)="onDeleteConnection($event)"></byte-es-connections>
</mat-step> </mat-step>
-->
<mat-step state="steps"> <mat-step state="deployment-channels">
<ng-template matStepLabel> <ng-template matStepLabel>
<span class="font-bold">{{'label.steps.title' | translate}}</span> <span class="font-bold">{{'label.deployment-channels.title' | translate}}</span>
<div class="font-size-description" [title]="'label.steps.description' | translate"> <div class="font-size-description" [title]="'label.deployment-channels.description' | translate">
{{'label.steps.description' | translate}} {{'label.deployment-channels.description' | translate}}
</div> </div>
</ng-template> </ng-template>
<byte-es-steps [stepper]="stepper"></byte-es-steps> <byte-ca-deployment-channels [stepper]="stepper"></byte-ca-deployment-channels>
</mat-step> </mat-step>
<!--
<mat-step state="summary"> <mat-step state="summary">
<ng-template matStepLabel> <ng-template matStepLabel>
<span class="font-bold">{{'label.summary.title' | translate}}</span> <span class="font-bold">{{'label.summary.title' | translate}}</span>
...@@ -56,9 +57,11 @@ ...@@ -56,9 +57,11 @@
<ng-template matStepperIcon="connections"> <ng-template matStepperIcon="connections">
<mat-icon>dns</mat-icon> <mat-icon>dns</mat-icon>
</ng-template> </ng-template>
<ng-template matStepperIcon="steps"> -->
<mat-icon>device_hub</mat-icon> <ng-template matStepperIcon="deployment-channels">
<mat-icon>mediation</mat-icon>
</ng-template> </ng-template>
<!--
<ng-template matStepperIcon="summary"> <ng-template matStepperIcon="summary">
<mat-icon>done_all</mat-icon> <mat-icon>done_all</mat-icon>
</ng-template> </ng-template>
......
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { CaDeploymentChannelsComponent } from './ca-deployment-channels.component';
describe('CaDeploymentChannelsComponent', () => {
let component: CaDeploymentChannelsComponent;
let fixture: ComponentFixture<CaDeploymentChannelsComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ CaDeploymentChannelsComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(CaDeploymentChannelsComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit, Input } from '@angular/core';
import { MatStepper } from '@angular/material';
@Component({
selector: 'byte-ca-deployment-channels',
templateUrl: './ca-deployment-channels.component.html',
styleUrls: ['./ca-deployment-channels.component.scss']
})
export class CaDeploymentChannelsComponent implements OnInit {
@Input() stepper: MatStepper;
constructor() { }
ngOnInit() {
}
}
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { AuthGuard } from '@xdf/security';
import { TemplateResolver, CrudDetailComponent, DirtyGuard, GridViewComponent, CrudGridComponent, RecordResolver } from '@xdf/gallery';
import { ResourceAuthGuard } from '@xdf/security';
import { UserRoleFormComponent, AccessDetailResolver } from '@xdf/settings';
import { AgentComponent } from './view/agent/agent.component';
const routes: Routes = [
{
path: 'agent', component: AgentComponent, canActivate: [AuthGuard, ResourceAuthGuard],
data: {
program: 'agent',
breadcrumb: 'breadcrumb.agent'
}
},
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
export class ConfigurationRoutingModule { }
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { TranslateModule } from '@ngx-translate/core';
import { ConfigurationRoutingModule } from './configuration-routing.module';
import { AgentComponent } from './view/agent/agent.component';
import { XdfGalleryModule } from '@xdf/gallery';
import { MatProgressSpinnerModule, MatTableModule, MatSortModule, MatIconModule, MatTooltipModule, MatPaginatorModule, MatButtonModule } from '@angular/material';
@NgModule({
declarations: [
AgentComponent
],
imports: [
CommonModule,
ConfigurationRoutingModule,
FormsModule,
MatButtonModule,
MatIconModule,
MatPaginatorModule,
MatProgressSpinnerModule,
MatSortModule,
MatTableModule,
MatTooltipModule,
ReactiveFormsModule,
TranslateModule,
XdfGalleryModule
]
})
export class ConfigurationModule { }
import { TestBed } from '@angular/core/testing';
import { AgentService } from './agent.service';
describe('AgentService', () => {
beforeEach(() => TestBed.configureTestingModule({}));
it('should be created', () => {
const service: AgentService = TestBed.get(AgentService);
expect(service).toBeTruthy();
});
});
import { Injectable } from '@angular/core';
import { DynaDataService } from '@xdf/gallery';
import { HttpClient } from '@angular/common/http';
@Injectable({
providedIn: 'root'
})
export class AgentService extends DynaDataService {
serviceURL = './service/agent';
constructor(private httpClient: HttpClient) {
super(httpClient);
}
}
...@@ -32,11 +32,11 @@ ...@@ -32,11 +32,11 @@
}, },
{ {
"id": 37, "id": 37,
"name": "agent", "name": "CONVERSATIONAL_AGENT",
"label": "menu.parent.agent", "label": "menu.parent.agent",
"icon": "<i class=\"fa fa-cog\"></i>", "icon": "<i class=\"fa fa-cog\"></i>",
"fullPath": "/config/agent", "fullPath": "/configuration/agent",
"singlePath": "config", "singlePath": "configuration",
"isProgram": true, "isProgram": true,
"children": [] "children": []
} }
......
...@@ -7,5 +7,5 @@ ...@@ -7,5 +7,5 @@
"estados", "estados",
"motivos", "motivos",
"categoria_motivo", "categoria_motivo",
"agent" "CONVERSATIONAL_AGENT"
] ]
\ 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