Commit 950ee64f authored by Alejandro Sarmiento's avatar Alejandro Sarmiento

AS template 2

parent 7008964e
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { CustomLayoutComponent, NotFoundComponent } from '@xdf/layouts';
import { BaseLayoutComponent, CustomLayoutComponent, NotFoundComponent } from '@xdf/layouts';
import { AuthGuard, LoginComponent } from '@xdf/security';
import { BytebotLayoutComponent } from './modules/bytebot-layout/bytebot-layout/bytebot-layout.component';
import { HomeComponent } from './views/home/home.component';
......@@ -11,7 +11,7 @@ const routes: Routes = [
// Main redirect
{ path: '', redirectTo: 'home', pathMatch: 'full', canActivate: [AuthGuard] },
{
path: '', component: CustomLayoutComponent,
path: '', component: BaseLayoutComponent,
children: [
{ path: 'home', component: HomeComponent, data: { breadcrumb: 'Home' } },
{
......@@ -25,6 +25,14 @@ const routes: Routes = [
{
path: 'configuration', data: { breadcrumb: 'Agentes' }, canLoad: [AuthGuard],
loadChildren: () => import('./modules/agent/agent.module').then(m => m.AgentModule)
},
{
path: 'mantenimiento', data: { breadcrumb: 'Mantenimiento'}, canLoad: [AuthGuard],
loadChildren: () => import('./modules/mantenimiento/matenimiento.module').then(m => m.MantenimientoModule)
},
{
path: 'prueba', canLoad: [AuthGuard],
loadChildren: () => import('./modules/prueba/prueba.module').then(m => m.PruebaModule)
}
],
canActivate: [AuthGuard]
......
......@@ -43,6 +43,7 @@ import { CustomProgramsFakeBackendInterceptor } from './interceptors/custom-prog
import { AgentFakeBackendInterceptor } from './interceptors/agent-fake-backend.interceptor';
import { OperativeDashboardFakeBackendInterceptor } from './interceptors/operative-dashboard-fake-backend.interceptor';
import { CustomErrorHandlerInterceptor } from './interceptors/custom-error-handler.interceptor';
import { PruebaFakeBackendInterceptor } from './interceptors/prueba-fake-backend.interceptor';
const INITIAL_LANGUAGE = 'es';
......@@ -131,6 +132,7 @@ export function createTranslateLoader(http: HttpClient) {
{ 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: PruebaFakeBackendInterceptor, multi: true},
{ provide: APP_INITIALIZER, useFactory: init_app, deps: [InitCommonsService, TranslateService], multi: true }
......
import { HttpResponse } from '@angular/common/http';
import { of, throwError } from "rxjs";
export function ok(bodyContent?) {
return of(new HttpResponse({ status: 200, body: bodyContent }));
}
export function error(message: string) {
return throwError({ error: { message } });
}
\ No newline at end of file
import { HttpInterceptor, HttpRequest, HttpHandler, HttpEvent, HttpResponse } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable, of, throwError } from 'rxjs';
import { delay, mergeMap, materialize, dematerialize } from 'rxjs/operators';
import { ok, error } from './functions-utils.interceptor';
import { SortField, DIRECTION } from '@xdf/commons';
import * as source from '../../assets/fake-data/prueba-data.json';
const basePath = './service/settings/prueba';
@Injectable()
export class PruebaFakeBackendInterceptor implements HttpInterceptor {
intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
const { url, method, headers, body } = request;
const data = (source as any).default;
// const dataEquivalences = (sourceEquivalences as any).default;
//const initialData = (InitialDataServiceProvider as any).default;
return of(null)
.pipe(mergeMap(handleRoute))
.pipe(materialize())
.pipe(delay(50))
.pipe(dematerialize());
function handleRoute() {
switch (true) {
case url.endsWith(basePath + '/page') && method === 'POST':
return pagination(body);
// case url.match('.*' + basePath + '/equivalences') && method === 'GET':
// return ok(dataEquivalences);
case url.match('.*' + basePath) && method === 'GET':
return getOne(url);
case url.match('.*' + basePath + '/\\d+$') && method === 'DELETE':
return deleteOperation(url);
case url.match('.*' + basePath) && method === 'GET':
return ok(data.data[0]);
default:
// pass through any requests not handled above
return next.handle(request);
}
}
function pagination(body) {
body.totalPages = 1;
body.totalItems = 2;
const page_number = body.currentPage;
const page_size = body.itemsPerPage ? body.itemsPerPage : 5;
if (body.sortFields.length > 0) {
const sortField: SortField = body.sortFields[0];
const sign = sortField.direction === DIRECTION.asc ? 1 : -1;
data.sort(function (a, b) {
if ((typeof a[sortField.field] === 'number') && (typeof b[sortField.field] === 'number')) {
if (a[sortField.field] > b[sortField.field]) {
return 1 * sign;
} else if (a[sortField.field] < b[sortField.field]) {
return -1 * sign;
}
return 0;
} else {
return a[sortField.field].localeCompare(b[sortField.field]) * sign;
}
});
}
body.data = data.slice(page_number * page_size, (page_number + 1) * page_size);
return ok(body);
}
function getOne(url) {
const n = url.lastIndexOf("/") + 1;
const id: Number = Number(url.substring(n));
return ok(data.filter(x => x.id === id)[0]);
}
function deleteOperation(url) {
const n = url.lastIndexOf("/") + 1;
const id: Number = Number(url.substring(n));
(source as any).default = data.filter(item => item.id !== id);
return ok();
}
}
}
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { PruebaComponent } from './prueba.component';
describe('PruebaComponent', () => {
let component: PruebaComponent;
let fixture: ComponentFixture<PruebaComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ PruebaComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(PruebaComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'byte-prueba',
templateUrl: './prueba.component.html',
styleUrls: ['./prueba.component.scss']
})
export class PruebaComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { AuthGuard } from '@xdf/security';
import { TemplateResolver, DirtyGuard, CrudGridComponent, RecordResolver } from '@xdf/gallery';
import { ResourceAuthGuard } from '@xdf/security';
import { PruebaComponent } from './components/prueba/prueba.component';
const routes: Routes = [
{
path: '', component: PruebaComponent, canActivate: [AuthGuard, ResourceAuthGuard],
data: {
innerTemplate: 'none',
program: 'mantenimiento',
breadcrumb: 'breadcrumb.mantenimiento'
}
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
export class MantenimientoRoutingModule { }
import { NgModule } from '@angular/core';
import { XdfGalleryModule } from '@xdf/gallery';
import { CommonModule } from '@angular/common';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { TranslateModule } from '@ngx-translate/core';
import { XdfSettingsModule } from '@xdf/settings';
import { MantenimientoRoutingModule } from './mantenimiento-routing.module';
import { PruebaComponent } from './components/prueba/prueba.component';
@NgModule({
declarations: [
PruebaComponent
],
imports: [
CommonModule,
FormsModule,
ReactiveFormsModule,
TranslateModule,
XdfGalleryModule,
XdfSettingsModule,
MantenimientoRoutingModule
],
entryComponents:[
],
providers: [
]
})
export class MantenimientoModule { }
\ No newline at end of file
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { AuthGuard } from '@xdf/security';
import { TemplateResolver, DirtyGuard, CrudGridComponent, RecordResolver } from '@xdf/gallery';
import { ResourceAuthGuard } from '@xdf/security';
const routes: Routes = [
{
path: '', component: CrudGridComponent, canActivate: [AuthGuard, ResourceAuthGuard],
resolve: { template: TemplateResolver },
data: {
innerTemplate: 'none',
program: 'prueba',
breadcrumb: 'breadcrumb.prueba'
}
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
export class PruebaRoutingModule { }
import { NgModule } from '@angular/core';
import { XdfGalleryModule } from '@xdf/gallery';
import { CommonModule } from '@angular/common';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { TranslateModule } from '@ngx-translate/core';
import { XdfSettingsModule } from '@xdf/settings';
import { PruebaRoutingModule } from './prueba-routing.module';
import { MatPaginatorModule, MatTableModule } from '@angular/material';
@NgModule({
declarations: [
],
imports: [
CommonModule,
FormsModule,
ReactiveFormsModule,
TranslateModule,
XdfGalleryModule,
XdfSettingsModule,
TranslateModule,
MatTableModule,
MatPaginatorModule,
PruebaRoutingModule
],
entryComponents:[
],
providers: [
]
})
export class PruebaModule { }
\ No newline at end of file
......@@ -70,5 +70,25 @@
"children": []
}
]
}
},
{
"id": 39,
"name": "Mantenimiento",
"label": "menu.parent.mantenimiento",
"icon": "<i class=\"fa fa-cog\"></i>",
"fullPath": "/mantenimiento",
"singlePath": "mantenimiento",
"isProgram": true,
"children": []
},
{
"id": 40,
"name": "prueba",
"label": "prueba.parent.mantenimiento",
"icon": "<i class=\"fa fa-cog\"></i>",
"fullPath": "/prueba",
"singlePath": "prueba",
"isProgram": true,
"children": []
}
]
......@@ -5,5 +5,6 @@
{ "system_settings_password": "./assets/definitions/setting-definitions/system-settings-password.json" },
{ "system_settings_userpolicy": "./assets/definitions/setting-definitions/system-settings-userpolicy.json" },
{ "application": "./assets/definitions/setting-definitions/application.json" },
{ "valpos": "./assets/definitions/setting-definitions/valpos.json"}
{ "valpos": "./assets/definitions/setting-definitions/valpos.json"},
{ "prueba": "./assets/definitions/prueba-definition/prueba.json" }
]
\ No newline at end of file
{
"name": "prueba",
"title": "prueba_info",
"fieldToShowInActon": "id",
"titleDesc": "prueba_group_info",
"icon": "<i class=\"material-icons\">business_center</i>",
"service": "./service/settings/prueba",
"recordId": "id",
"showFormIn": "standard",
"attributes": [
{
"name": "id",
"type": "number",
"formOptions": {
"options": {
"readonly": true,
"hideInNew": false
},
"validators": [
],
"controlType": "number"
}
},
{
"name": "date",
"type": "string",
"formOptions": {
"options": {
},
"validators": [
"required"
],
"controlType": "text"
}
},
{
"name": "description",
"type": "string",
"formOptions": {
"options": {
},
"validators": [
"required"
],
"controlType": "text"
}
},
{
"name": "trigger",
"type": "string",
"formOptions": {
"options": {
"styleClass": "col-xl-4"
},
"validators": [
"required"
],
"controlType": "text"
}
},
{
"name": "event",
"type": "string",
"formOptions": {
"options": {
"styleClass": "col-xl-3"
},
"validators": [
],
"controlType": "text"
}
},
{
"name": "status",
"type": "valpos",
"formOptions": {
"values": {
"G": "prueba.created",
"C": "prueba.false"
},
"options": {
"hideInNew": false,
"styleClass": "col-md-6",
"styles": {
"G": "label label-success pr-3",
"C": "label label-danger"
}
},
"controlType": "checkbox"
}
}
],
"groups": [
],
"grid": [
{
"sortColumnDefault": "id",
"sortColumnDirection": "asc",
"pagingSize": 5,
"expandRow": false,
"columns": [
{
"name": "id",
"sortable": true,
"style": {
"width": "50px"
},
"optional": false,
"filter": true
},
{
"name": "description",
"sortable": true,
"style": {
"width": "200px"
},
"optional": false,
"filter": true
},
{
"name": "status",
"sortable": true,
"style": {
"width": "50px"
},
"optional": false,
"filter": true
}
]
}
]
}
\ No newline at end of file
......@@ -9,5 +9,7 @@
"categoria_motivo",
"CONVERSATIONAL_AGENT",
"OPERATIVE_DASHBOARD",
"customer_interaction_dashboard"
"customer_interaction_dashboard",
"Mantenimiento",
"Prueba"
]
\ No newline at end of file
[
{
"id": 1,
"date": "2021-04-10",
"description": "Descripcion caso 1",
"trigger": "US-0004",
"event": "No existe fichero del ABD",
"status": "G"
},
{
"id": 2,
"date": "2021-08-01",
"description": "Descripcion caso 2",
"trigger": "US-0004",
"event": "No existe fichero del ABD",
"status": "C"
},
{
"id": 3,
"date": "2021-01-05",
"description": "Descripcion caso 3",
"trigger": "US-0004",
"event": "No existe fichero del ABD",
"status": "G"
},
{
"id": 4,
"date": "2021-06-16",
"description": "Descripcion caso 3",
"trigger": "US-0004",
"event": "No existe fichero del ABD",
"status": "G"
},
{
"id": 5,
"date": "2021-03-03",
"description": "Descripcion caso 3",
"trigger": "US-0004",
"event": "No existe fichero del ABD",
"status": "C"
},
{
"id": 6,
"date": "2021-07-06",
"description": "Descripcion caso 3",
"trigger": "US-0004",
"event": "No existe fichero del ABD",
"status": "G"
},
{
"id": 7,
"date": "2021-01-22",
"description": "Descripcion caso 3",
"trigger": "US-0004",
"event": "No existe fichero del ABD",
"status": "C"
},
{
"id": 8,
"date": "2021-07-03",
"description": "Descripcion caso 3",
"trigger": "US-0004",
"event": "No existe fichero del ABD",
"status": "C"
},
{
"id": 9,
"date": "2021-05-24",
"description": "Descripcion caso 3",
"trigger": "US-0004",
"event": "No existe fichero del ABD",
"status": "G"
},
{
"id": 10,
"date": "2021-06-18",
"description": "Descripcion caso 3",
"trigger": "US-0004",
"event": "No existe fichero del ABD",
"status": "C"
}
]
\ No newline at end of file
......@@ -99,5 +99,7 @@
"dashboards.customer.interaction.sentences": "Frases no identificadas",
"dashboards.customer.interaction.intents": "Intenciones más utilizadas",
"security.password.error.passwordMinLength": "La contraseña no cumple con el mínimo de caracteres configurado.",
"message.error.duplicated": "Registro duplicado"
"message.error.duplicated": "Registro duplicado",
"prueba_info":"PRUEBA 1"
}
\ 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