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 = [
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)
},
{
path: 'configuration', canLoad: [AuthGuard],
loadChildren: () => import('./modules/configuration/configuration.module').then(m => m.ConfigurationModule)
}
],
canActivate: [AuthGuard]
},
......@@ -37,4 +32,15 @@ const routes: Routes = [
// Handle all other routes
{ path: '**', component: NotFoundComponent}
];
\ No newline at end of file
];
@NgModule({
imports: [RouterModule.forRoot(routes, {
scrollPositionRestoration: 'enabled',
anchorScrolling: 'enabled',
onSameUrlNavigation: 'ignore'
})],
exports: [RouterModule]
})
export class AppRoutingModule { }
......@@ -36,6 +36,7 @@ import {
MAT_MOMENT_DATE_ADAPTER_OPTIONS,
} from '@angular/material-moment-adapter';
import { CustomProgramsFakeBackendInterceptor } from './interceptors/custom-programs-fake-backend.interceptor';
import { AgentFakeBackendInterceptor } from './interceptors/agent-fake-backend.interceptor';
const INITIAL_LANGUAGE = 'es';
......@@ -110,19 +111,19 @@ export function createTranslateLoader(http: HttpClient) {
{ provide: ResourceAuthGuard, useClass: ResourceAuthGuard},
// descomentar estas lineas para OAUTH
{ provide: AuthGuard, useClass: OAuthGuard},
{ provide: AuthenticationService, useClass: OAuthAuthenticationService },
{ provide: APP_INITIALIZER, useFactory: loginLoaderFactory, deps: [AuthenticationService], multi: true },
//{ provide: AuthGuard, useClass: OAuthGuard},
//{ provide: AuthenticationService, useClass: OAuthAuthenticationService },
//{ provide: APP_INITIALIZER, useFactory: loginLoaderFactory, deps: [AuthenticationService], multi: true },
// Para probar mantenimientos
// comentar estas lineas para OAUTH
// { provide: AuthGuard, useClass: AuthGuard},
// { provide: AuthenticationService, useClass: ByteAuthenticationService },
// { provide: HTTP_INTERCEPTORS, useClass: AuthenticationFakeBackendInterceptor, multi: true},
// { provide: HTTP_INTERCEPTORS, useClass: SettingsFakeBackendInterceptor, multi: true},
{ provide: AuthGuard, useClass: AuthGuard},
{ provide: AuthenticationService, useClass: ByteAuthenticationService },
{ provide: HTTP_INTERCEPTORS, useClass: AuthenticationFakeBackendInterceptor, multi: true},
{ provide: HTTP_INTERCEPTORS, useClass: SettingsFakeBackendInterceptor, 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> = [
}
];
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()
export class AgentFakeBackendInterceptor implements HttpInterceptor {
......@@ -64,6 +75,10 @@ export class AgentFakeBackendInterceptor implements HttpInterceptor {
switch (true) {
case url.endsWith(basePath + '/page') && method === 'POST':
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:
// pass through any requests not handled above
return next.handle(request);
......
......@@ -6,22 +6,21 @@ import { AgentComponent } from './view/agent/agent.component';
import { AgentDetailComponent } from './view/agent-detail/agent-detail.component';
import { AgentDataForWizardResolver } from './resolver/agent-data-wizard.resolver';
import { AgentDetailResolver } from './resolver/agent-detail.resolver';
import { AgentListComponent } from './view/agent-list/agent.component';
const routes: Routes = [
{
path: 'agent',
component: AgentComponent,
canActivate: [AuthGuard, ResourceAuthGuard],
data:
{
path: 'agent', component: AgentListComponent, canActivate: [AuthGuard, ResourceAuthGuard],
data: {
program: 'CONVERSATIONAL_AGENT',
breadcrumb: 'Agentes'
breadcrumb: 'breadcrumb.agent'
}
},
{
path: 'agent/detail/new',
component: AgentDetailComponent,
//component: AgentDetailComponent,
component: AgentComponent,
resolve: {
dataForWizard: AgentDataForWizardResolver
},
......@@ -36,7 +35,8 @@ const routes: Routes = [
},
{
path: 'agent/detail/edit/:code',
component: AgentDetailComponent,
//component: AgentDetailComponent,
component: AgentComponent,
resolve: {
externalSystemDetail: AgentDetailResolver,
dataForWizard: AgentDataForWizardResolver
......@@ -51,7 +51,8 @@ const routes: Routes = [
}
},{
path: 'agent/detail/view/:code',
component: AgentDetailComponent,
//component: AgentDetailComponent,
component: AgentComponent,
resolve: {
externalSystemDetail: AgentDetailResolver,
dataForWizard: AgentDataForWizardResolver
......
......@@ -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 { DynamicTranslatePipe } from './pipe/dynamic-translate.pipe';
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({
......@@ -24,10 +26,12 @@ import { CaGeneralInformationComponent } from './view/components/ca-general-info
],
declarations: [
AgentComponent,
AgentListComponent,
AgentDetailComponent,
EsStepsProcessorsModalComponent,
DynamicTranslatePipe,
CaGeneralInformationComponent],
CaGeneralInformationComponent,
CaDeploymentChannelsComponent],
imports: [
FormsModule,
ReactiveFormsModule,
......
......@@ -12,19 +12,6 @@ export class AgentService extends DynaDataService {
constructor(private httpClient: 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) {
let params = {};
......@@ -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 { AgentComponent } from './agent.component';
import { AgentListComponent } from './agent.component';
describe('AgentComponent', () => {
let component: AgentComponent;
let fixture: ComponentFixture<AgentComponent>;
let component: AgentListComponent;
let fixture: ComponentFixture<AgentListComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ AgentComponent ]
declarations: [ AgentListComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(AgentComponent);
fixture = TestBed.createComponent(AgentListComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
......
......@@ -6,7 +6,7 @@ import { Router, ActivatedRoute } from '@angular/router';
import { tap } from 'rxjs/operators';
import { TagFilter } from '@xdf/gallery/lib/views/gallery/ngx-tags-input/model/tag-filter';
import { TranslateService } from '@ngx-translate/core';
import { AgentService } from '../../services/agent.service';
import { AgentService } from '../../service/agent.service';
......@@ -144,7 +144,7 @@ const fieldFilters = [
templateUrl: './agent.component.html',
styleUrls: ['./agent.component.scss']
})
export class AgentComponent implements OnInit {
export class AgentListComponent implements OnInit {
@ViewChild(MatPaginator, { static: false }) paginator: MatPaginator;
@ViewChild(MatSort, { static: false }) sort: MatSort;
......@@ -304,14 +304,14 @@ export class AgentComponent implements OnInit {
}
edit(item) {
this.router.navigate(['/etl/external-system/detail/edit/' + item.id]);
this.router.navigate(['/configuration/agent/detail/edit/' + item.id]);
}
view(item) {
this.router.navigate(['/etl/external-system/detail/view/' + item.id]);
this.router.navigate(['/configuration/agent/detail/view/' + item.id]);
}
create() {
this.router.navigate(['/etl/external-system/detail/new']);
this.router.navigate(['/configuration/agent/detail/new']);
}
}
......@@ -27,17 +27,18 @@
</ng-template>
<byte-es-connections [stepper]="stepper" (onDeleteConnection)="onDeleteConnection($event)"></byte-es-connections>
</mat-step>
-->
<mat-step state="steps">
<mat-step state="deployment-channels">
<ng-template matStepLabel>
<span class="font-bold">{{'label.steps.title' | translate}}</span>
<div class="font-size-description" [title]="'label.steps.description' | translate">
{{'label.steps.description' | translate}}
<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-es-steps [stepper]="stepper"></byte-es-steps>
<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>
......@@ -56,9 +57,11 @@
<ng-template matStepperIcon="connections">
<mat-icon>dns</mat-icon>
</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 matStepperIcon="summary">
<mat-icon>done_all</mat-icon>
</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 @@
},
{
"id": 37,
"name": "agent",
"name": "CONVERSATIONAL_AGENT",
"label": "menu.parent.agent",
"icon": "<i class=\"fa fa-cog\"></i>",
"fullPath": "/config/agent",
"singlePath": "config",
"fullPath": "/configuration/agent",
"singlePath": "configuration",
"isProgram": true,
"children": []
}
......
......@@ -7,5 +7,5 @@
"estados",
"motivos",
"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