From a6e1ace2b6bdba8c08a4acfa42433f3ac073b747 Mon Sep 17 00:00:00 2001
From: rsanchez <rsanchez@curisit.net>
Date: Tue, 21 Mar 2017 10:16:22 +0000
Subject: [PATCH] #3527 feature - Added all catalogs and working fine
---
securis/src/main/webapp/src/app/forms/user.form.component.ts | 14 +
securis/src/main/webapp/src/app/forms/licensetype.form.component.ts | 59 +++++++--
securis/src/main/webapp/src/app/forms/licensetype.form.html | 28 ++--
securis/src/main/webapp/src/app/forms/organization.form.html | 49 +++-----
securis/src/main/webapp/src/app/listing/user.list.component.html | 16 ++
securis/src/main/webapp/src/app/resources/organizations.ts | 1
securis/src/main/webapp/src/app/forms/base.ts | 8 +
securis/src/main/webapp/src/app/listing/organization.list.component.ts | 20 +--
securis/src/main/webapp/src/app/app.routes.ts | 6
securis/src/main/webapp/src/app/listing/user.list.component.ts | 33 ++---
securis/src/main/webapp/src/app/menu.component.html | 6
securis/src/main/webapp/src/app/forms/organization.form.component.ts | 27 ++++
securis/src/main/webapp/src/app/listing/licensetype.list.component.html | 4
securis/src/main/webapp/src/app/listing/license.list.component.html | 6
securis/src/main/webapp/src/app/listing/licensetype.list.component.ts | 23 +--
securis/src/main/webapp/src/app/forms/license.form.html | 2
securis/src/main/webapp/src/app/listing/organization.list.component.html | 2
securis/src/main/webapp/src/lang/messages_en.json | 2
18 files changed, 179 insertions(+), 127 deletions(-)
diff --git a/securis/src/main/webapp/src/app/app.routes.ts b/securis/src/main/webapp/src/app/app.routes.ts
index e6ef16e..60ed31b 100644
--- a/securis/src/main/webapp/src/app/app.routes.ts
+++ b/securis/src/main/webapp/src/app/app.routes.ts
@@ -41,15 +41,15 @@
{path: 'licensetypes', component: LicenseTypeListComponent},
{path: 'licensetypes/create', component: LicenseTypeFormComponent},
- {path: 'licensetypes/edit/:applicationId', component: LicenseTypeFormComponent},
+ {path: 'licensetypes/edit/:licensetypeId', component: LicenseTypeFormComponent},
{path: 'organizations', component: OrganizationListComponent},
{path: 'organizations/create', component: OrganizationFormComponent},
- {path: 'organizations/edit/:applicationId', component: OrganizationFormComponent},
+ {path: 'organizations/edit/:organizationId', component: OrganizationFormComponent},
{path: 'users', component: UserListComponent},
{path: 'users/create', component: UserFormComponent},
- {path: 'users/edit/:applicationId', component: UserFormComponent}
+ {path: 'users/edit/:username', component: UserFormComponent}
]
},
diff --git a/securis/src/main/webapp/src/app/forms/base.ts b/securis/src/main/webapp/src/app/forms/base.ts
index 67bf752..b29548d 100644
--- a/securis/src/main/webapp/src/app/forms/base.ts
+++ b/securis/src/main/webapp/src/app/forms/base.ts
@@ -90,7 +90,7 @@
});
}
- protected prepareInitialData(idparam: string, default_values: any = {}) : void {
+ protected prepareInitialData(idparam: string, default_values: any = {}, callback?: (data: any) => void) : void {
this.form_title = this.$L.get('{} data', this.resourceName.capitalize());
this.isNew = true;
!!this.route && this.route.params.subscribe(params => {
@@ -101,7 +101,11 @@
this.form_subtitle = this.$L.get('Create a new {}', this.resourceName) ;
} else {
this.isNew = false;
- this.resourceServices.get(eleId).subscribe(eleData => this.data = eleData);
+ this.resourceServices.get(eleId).subscribe(eleData => {
+ this.data = eleData;
+ Object.keys(default_values).forEach((k : string) => (this.data[k] === undefined) && (this.data[k] = default_values[k]));
+ callback && callback(this.data);
+ });
this.form_subtitle = this.$L.get('Modify the {} data', this.resourceName) ;
}
});
diff --git a/securis/src/main/webapp/src/app/forms/license.form.html b/securis/src/main/webapp/src/app/forms/license.form.html
index bb559f3..083adcf 100644
--- a/securis/src/main/webapp/src/app/forms/license.form.html
+++ b/securis/src/main/webapp/src/app/forms/license.form.html
@@ -45,7 +45,7 @@
<div layout="row" layout-fill layout-padding>
<div layout="column" layout-fill flex>
<md-input-container flex>
- <input mdInput type="text" [(ngModel)]="data.full_name" name="full_name" required maxlength="200" />
+ <input #firstField mdInput type="text" [(ngModel)]="data.full_name" name="full_name" required maxlength="200" />
<md-placeholder>
<span i18n="field.full_name"></span>
</md-placeholder>
diff --git a/securis/src/main/webapp/src/app/forms/licensetype.form.component.ts b/securis/src/main/webapp/src/app/forms/licensetype.form.component.ts
index 03d66e2..2a459cd 100644
--- a/securis/src/main/webapp/src/app/forms/licensetype.form.component.ts
+++ b/securis/src/main/webapp/src/app/forms/licensetype.form.component.ts
@@ -10,26 +10,25 @@
import { FormBase, IComboOption } from './base';
import { ActivatedRoute, Router } from '@angular/router';
-var app_example = {
- code: 'CICS',
- creation_timestamp: 1418384439000,
- description: 'Wellbore integrity analysis software',
+var lt_example = {
id: 1,
- license_filename: 'config_server.lic',
- name: 'CurisIntegrity',
- metadata:
- [ { key: 'max_docs',
- value: '250000',
- readonly: true,
- mandatory: true } ]
+ code: 'CI01',
+ name: 'CI ConfigServer ext',
+ application_id: 1,
+ application_name: 'CurisIntegrity',
+ creation_timestamp: 1418384535000,
+ description: 'CI ConfigServer with extended mode and 50 lines',
+ metadata: [ { key: 'max_docs', value: '250000', mandatory: true } ]
}
+
@Component({
selector: 'licensetype-form',
templateUrl: 'src/app/forms/licensetype.form.html'
})
export class LicenseTypeFormComponent extends FormBase {
-
+
+ allApplications: IComboOption[];
constructor(private http: Http,
private licenseTypes: LicenseTypesService,
private applications: ApplicationsService,
@@ -41,17 +40,47 @@
super($L, router, route, toaster, licenseTypes, $L.get('license type'), dialogs);
}
-
+ private _prepareMetadata(metadata : any[]) : any[] {
+ metadata.forEach((md : any) => {
+ if (md.value !== null && md.value !== '') {
+ md.readonly = true;
+ }
+ });
+ return metadata;
+ }
+
+ changeApplication(event: any) : void{
+ console.log(event);
+ this.applications.get(this.data.application_id)
+ .map(app_data => this._prepareMetadata(app_data.metadata))
+ .subscribe(
+ metadata => this.data.metadata = metadata,
+ err => console.error('Error loading application metadata')
+ );
+ }
+
+
+
+ loadCombos() : void {
+ this.applications.get()
+ .map(list => list.map((app : any) => <IComboOption>{id: app.id, label: `(${app.code}) ${app.name}`}))
+ .subscribe(
+ data => this.allApplications = (<IComboOption[]>data).sort((e1, e2) => e1.label.localeCompare(e2.label)),
+ err => console.error('Error loading applications')
+ );
+ }
+
goBack(): void {
this.router.navigate([`licensetypes`]);
}
init() : void {
+ this.loadCombos();
super.setFirstFocus();
super.reset();
- super.prepareInitialData('licenseTypeId', {
+ super.prepareInitialData('licensetypeId', {
metadata: []
- });
+ }, (data) => this._prepareMetadata(data.metadata));
}
ngAfterViewInit(): void {
diff --git a/securis/src/main/webapp/src/app/forms/licensetype.form.html b/securis/src/main/webapp/src/app/forms/licensetype.form.html
index 6299a7c..1e64b6f 100644
--- a/securis/src/main/webapp/src/app/forms/licensetype.form.html
+++ b/securis/src/main/webapp/src/app/forms/licensetype.form.html
@@ -31,8 +31,8 @@
<form #form="ngForm" class="inset">
<div layout="column" layout-align="start center">
<div layout="row" layout-fill layout-padding>
- <field-readonly [value]="data.id" label="field.id" flex="15" *ngIf="!isNew"></field-readonly>
- <div layout="column" layout-fill flex>
+ <field-readonly [value]="data.id" label="field.id" flex="10" *ngIf="!isNew"></field-readonly>
+ <div layout="column" layout-fill flex="30">
<md-input-container>
<input #firstField mdInput maxLength="50" type="text" [(ngModel)]="data.code" name="code" required [readonly]="!isNew" />
<md-placeholder>
@@ -41,8 +41,6 @@
</md-input-container>
<error-checker [fieldName]="getFieldName('code')" [formField]="form.controls.code"></error-checker>
</div>
- </div>
- <div layout="row" layout-fill layout-padding>
<div layout="column" layout-fill flex>
<md-input-container flex>
<input mdInput type="text" [(ngModel)]="data.name" name="name" required />
@@ -51,15 +49,6 @@
</md-placeholder>
</md-input-container>
<error-checker [fieldName]="getFieldName('name')" [formField]="form.controls.name"></error-checker>
- </div>
- <div layout="column" layout-fill flex>
- <md-input-container flex>
- <input mdInput type="text" [(ngModel)]="data.license_filename" name="license_filename" required />
- <md-placeholder>
- <span i18n="field.license_filename"></span>
- </md-placeholder>
- </md-input-container>
- <error-checker [fieldName]="getFieldName('license_filename')" [formField]="form.controls.license_filename"></error-checker>
</div>
</div>
<div layout="row" layout-fill layout-padding>
@@ -73,10 +62,21 @@
</md-input-container>
</div>
</div>
+ <div layout="row" layout-fill layout-padding >
+ <div layout="column" layout-fill flex>
+ <md-select [placeholder]="getFieldName('application_id')" flex [(ngModel)]="data.application_id" name="application_id"
+ (change)="changeApplication($event)">
+ <md-option *ngFor="let org of allApplications" [value]="org.id">
+ {{org.label}}
+ </md-option>
+ </md-select>
+ <error-checker [fieldName]="getFieldName('application_id')" [formField]="form.controls.application_id"></error-checker>
+ </div>
+ </div>
<div layout="row" layout-fill layout-padding *ngIf="!isNew">
<field-readonly [value]="data.creation_timestamp | date: 'medium'" label="field.creation_timestamp" flex></field-readonly>
</div>
- <metadata-manager addOrDelete="true" editKeys="true" [metadata]="data.metadata" ></metadata-manager>
+ <metadata-manager [addOrDelete]="false" [editKeys]="false" [metadata]="data.metadata" ></metadata-manager>
</div>
</form>
</md-card-content>
diff --git a/securis/src/main/webapp/src/app/forms/organization.form.component.ts b/securis/src/main/webapp/src/app/forms/organization.form.component.ts
index 4d2caec..d5b4708 100644
--- a/securis/src/main/webapp/src/app/forms/organization.form.component.ts
+++ b/securis/src/main/webapp/src/app/forms/organization.form.component.ts
@@ -9,6 +9,7 @@
import { TdMediaService } from '@covalent/core';
import { FormBase, IComboOption } from './base';
import { ActivatedRoute, Router } from '@angular/router';
+import { UsersService } from "../resources/users";
var app_example = {
code: 'CICS',
@@ -30,9 +31,13 @@
})
export class OrganizationFormComponent extends FormBase {
+ parentOrganizations: any[];
+ usernames: string[] = [];
+
constructor(private http: Http,
private licenseTypes: LicenseTypesService,
private organizations: OrganizationsService,
+ private users: UsersService,
router: Router,
toaster: ToastsManager,
route: ActivatedRoute,
@@ -41,15 +46,33 @@
super($L, router, route, toaster, organizations, $L.get('organization'), dialogs);
}
-
+ loadCombos() : void {
+ this.organizations.get()
+ .map(list => list.map((org : any) => <IComboOption>{id: org.id, label: `(${org.code}) ${org.name}`}))
+ .subscribe(
+ data => this.parentOrganizations = (<IComboOption[]>data).sort((e1, e2) => e1.label.localeCompare(e2.label)),
+ err => console.error('Error loading organizations')
+ );
+ this.users.get()
+ .map(list => list
+ .filter((user : any) => user.username !== '_client')
+ .map((u : any) => u.username))
+ .subscribe(
+ data => this.usernames = (<string[]>data).sort((u1, u2) => u1.localeCompare(u2)),
+ err => console.error('Error loading users')
+ );
+ }
+
+
goBack(): void {
this.router.navigate([`organizations`]);
}
init() : void {
+ this.loadCombos();
super.setFirstFocus();
super.reset();
- super.prepareInitialData('organizationId');
+ super.prepareInitialData('organizationId', {users_ids: []});
}
ngAfterViewInit(): void {
diff --git a/securis/src/main/webapp/src/app/forms/organization.form.html b/securis/src/main/webapp/src/app/forms/organization.form.html
index 6299a7c..41d02bc 100644
--- a/securis/src/main/webapp/src/app/forms/organization.form.html
+++ b/securis/src/main/webapp/src/app/forms/organization.form.html
@@ -3,24 +3,11 @@
<button md-icon-button (click)="goBack()" color="accent">
<md-icon>arrow_back</md-icon>
</button>
- <span class="md-title" [innerText]="form_title"></span>
+ <span [innerText]="form_title"></span>
<span flex></span>
<button md-icon-button (click)="save()"><md-icon>save</md-icon></button>
</md-toolbar>
- <!--
- code: 'CICS',
- creation_timestamp: 1418384439000,
- description: 'Wellbore integrity analysis software',
- id: 1,
- license_filename: 'config_server.lic',
- name: 'CurisIntegrity',
- metadata:
- [ { key: 'max_docs',
- value: '250000',
- readonly: true,
- mandatory: true } ]
-}
- -->
+
<div class="margin" layout-align-gt-xs="center start" layout-fill="" layout-gt-xs="row">
<md-card flex="70">
<md-card-title>
@@ -31,8 +18,8 @@
<form #form="ngForm" class="inset">
<div layout="column" layout-align="start center">
<div layout="row" layout-fill layout-padding>
- <field-readonly [value]="data.id" label="field.id" flex="15" *ngIf="!isNew"></field-readonly>
- <div layout="column" layout-fill flex>
+ <field-readonly [value]="data.id" label="field.id" flex="10" *ngIf="!isNew"></field-readonly>
+ <div layout="column" layout-fill flex="30">
<md-input-container>
<input #firstField mdInput maxLength="50" type="text" [(ngModel)]="data.code" name="code" required [readonly]="!isNew" />
<md-placeholder>
@@ -41,8 +28,6 @@
</md-input-container>
<error-checker [fieldName]="getFieldName('code')" [formField]="form.controls.code"></error-checker>
</div>
- </div>
- <div layout="row" layout-fill layout-padding>
<div layout="column" layout-fill flex>
<md-input-container flex>
<input mdInput type="text" [(ngModel)]="data.name" name="name" required />
@@ -51,15 +36,6 @@
</md-placeholder>
</md-input-container>
<error-checker [fieldName]="getFieldName('name')" [formField]="form.controls.name"></error-checker>
- </div>
- <div layout="column" layout-fill flex>
- <md-input-container flex>
- <input mdInput type="text" [(ngModel)]="data.license_filename" name="license_filename" required />
- <md-placeholder>
- <span i18n="field.license_filename"></span>
- </md-placeholder>
- </md-input-container>
- <error-checker [fieldName]="getFieldName('license_filename')" [formField]="form.controls.license_filename"></error-checker>
</div>
</div>
<div layout="row" layout-fill layout-padding>
@@ -73,10 +49,21 @@
</md-input-container>
</div>
</div>
- <div layout="row" layout-fill layout-padding *ngIf="!isNew">
- <field-readonly [value]="data.creation_timestamp | date: 'medium'" label="field.creation_timestamp" flex></field-readonly>
+ <div layout="row" layout-fill layout-padding >
+ <div layout="column" layout-fill flex>
+ <md-select [placeholder]="getFieldName('org_parent_id')" flex [(ngModel)]="data.org_parent_id" name="org_parent_id">
+ <md-option *ngFor="let org of parentOrganizations" [value]="org.id">
+ {{org.label}}
+ </md-option>
+ </md-select>
+ <error-checker [fieldName]="getFieldName('org_parent_id')" [formField]="form.controls.org_parent_id"></error-checker>
+ </div>
</div>
- <metadata-manager addOrDelete="true" editKeys="true" [metadata]="data.metadata" ></metadata-manager>
+ <div layout="row" layout-fill layout-padding >
+ <td-chips flex [mdTooltip]="$L.get('Users with access to this organization')" [placeholder]="$L.get('Select users')"
+ [items]="usernames" [(ngModel)]="data.users_ids" name="users_ids" requireMatch>
+ </td-chips>
+ </div>
</div>
</form>
</md-card-content>
diff --git a/securis/src/main/webapp/src/app/forms/user.form.component.ts b/securis/src/main/webapp/src/app/forms/user.form.component.ts
index 6584c7d..a709db6 100644
--- a/securis/src/main/webapp/src/app/forms/user.form.component.ts
+++ b/securis/src/main/webapp/src/app/forms/user.form.component.ts
@@ -10,8 +10,16 @@
import { FormBase, IComboOption } from './base';
import { ActivatedRoute, Router } from '@angular/router';
-var app_example = {
-
+var user_example = {
+ username: 'rym',
+ roles: [ 1 ],
+ lastLogin: 1488885433000,
+ modificationTimestamp: 1479898458000,
+ email: 'rbouchair@curistec.com',
+ first_name: 'Rym',
+ last_name: 'Bouchair',
+ creation_timestamp: 1479898458000,
+ organizations_ids: [ 1, 2, 5, 6, 7, 8 ]
}
@Component({
@@ -39,7 +47,7 @@
init() : void {
super.setFirstFocus();
super.reset();
- super.prepareInitialData('userId', {
+ super.prepareInitialData('username', {
metadata: []
});
}
diff --git a/securis/src/main/webapp/src/app/listing/license.list.component.html b/securis/src/main/webapp/src/app/listing/license.list.component.html
index 70f72d1..1a6ad85 100644
--- a/securis/src/main/webapp/src/app/listing/license.list.component.html
+++ b/securis/src/main/webapp/src/app/listing/license.list.component.html
@@ -45,9 +45,9 @@
<md-icon [style.color]="licenses.getStatusColor(row.status)">brightness_1</md-icon> <span>{{licenses.getStatusName(row.status)}}</span>
</div>
</template>
- <template tdDataTableTemplate="email" let-row="row">
- <div layout="row">
- <a md-button color="primary" [href]="'mailto:' + row.email + '?subject=SeCuris'">{{row.email}}</a>
+ <template tdDataTableTemplate="email" let-row="row" let-value="value">
+ <div layout="row" *ngIf="value">
+ <a md-button color="primary" [href]="'mailto:' + value + '?subject=SeCuris'">{{value}}</a>
</div>
</template>
<template tdDataTableTemplate="expiration_date" let-row="row">
diff --git a/securis/src/main/webapp/src/app/listing/licensetype.list.component.html b/securis/src/main/webapp/src/app/listing/licensetype.list.component.html
index 522e7b7..76d960d 100644
--- a/securis/src/main/webapp/src/app/listing/licensetype.list.component.html
+++ b/securis/src/main/webapp/src/app/listing/licensetype.list.component.html
@@ -1,10 +1,10 @@
<td-layout-card-over cardWidth="70">
<md-toolbar role="toolbar" class="mat-secondary">
<span class="push-left-sm">
- <span class="md-title" i18n>Applications</span>
+ <span class="md-title" i18n>License types</span>
</span>
<span class="push-left-sm" *ngIf="filteredItems < data.length">
- <span class="md-body-1">{{filteredItems}} of {{data.length}} applications filtered</span>
+ <span class="md-body-1">{{filteredItems}} of {{data.length}} license types filtered</span>
</span>
<td-search-box #searchBox class="push-right-sm" placeholder="Search here" (searchDebounce)="search($event)" flex>
</td-search-box>
diff --git a/securis/src/main/webapp/src/app/listing/licensetype.list.component.ts b/securis/src/main/webapp/src/app/listing/licensetype.list.component.ts
index ee22d6a..1240b98 100644
--- a/securis/src/main/webapp/src/app/listing/licensetype.list.component.ts
+++ b/securis/src/main/webapp/src/app/listing/licensetype.list.component.ts
@@ -16,18 +16,15 @@
import { ListingBase } from './base';
-var app_example = {
- code: 'CICS',
- creation_timestamp: 1418384439000,
- description: 'Wellbore integrity analysis software',
+var lt_example = {
id: 1,
- license_filename: 'config_server.lic',
- name: 'CurisIntegrity',
- metadata:
- [ { key: 'max_docs',
- value: '250000',
- readonly: true,
- mandatory: true } ]
+ code: 'CI01',
+ name: 'CI ConfigServer ext',
+ application_id: 1,
+ application_name: 'CurisIntegrity',
+ creation_timestamp: 1418384535000,
+ description: 'CI ConfigServer with extended mode and 50 lines',
+ metadata: [ { key: 'max_docs', value: '250000', mandatory: true } ]
}
@Component({
@@ -38,8 +35,8 @@
columns: ITdDataTableColumn[] = [
{ name: 'code', label: 'Code', tooltip: 'License type code' },
- { name: 'name', label: 'Application name' },
- { name: 'creation_timestamp', label: 'Creation date' },
+ { name: 'name', label: 'License type name' },
+ { name: 'application_name', label: 'Application' },
{ name: 'menu', label: '' }
];
diff --git a/securis/src/main/webapp/src/app/listing/organization.list.component.html b/securis/src/main/webapp/src/app/listing/organization.list.component.html
index 522e7b7..56c4147 100644
--- a/securis/src/main/webapp/src/app/listing/organization.list.component.html
+++ b/securis/src/main/webapp/src/app/listing/organization.list.component.html
@@ -1,7 +1,7 @@
<td-layout-card-over cardWidth="70">
<md-toolbar role="toolbar" class="mat-secondary">
<span class="push-left-sm">
- <span class="md-title" i18n>Applications</span>
+ <span class="md-title" i18n>Organizations</span>
</span>
<span class="push-left-sm" *ngIf="filteredItems < data.length">
<span class="md-body-1">{{filteredItems}} of {{data.length}} applications filtered</span>
diff --git a/securis/src/main/webapp/src/app/listing/organization.list.component.ts b/securis/src/main/webapp/src/app/listing/organization.list.component.ts
index c2d43fb..3d8e74d 100644
--- a/securis/src/main/webapp/src/app/listing/organization.list.component.ts
+++ b/securis/src/main/webapp/src/app/listing/organization.list.component.ts
@@ -16,18 +16,14 @@
import { ListingBase } from './base';
-var app_example = {
- code: 'CICS',
- creation_timestamp: 1418384439000,
- description: 'Wellbore integrity analysis software',
+var org_example = {
id: 1,
- license_filename: 'config_server.lic',
- name: 'CurisIntegrity',
- metadata:
- [ { key: 'max_docs',
- value: '250000',
- readonly: true,
- mandatory: true } ]
+ code: 'BP01',
+ creation_timestamp: 1418384454000,
+ name: 'British Petroleum',
+ org_parent_id:2,
+ org_parent_name:"CurisTec",
+ users_ids: [ 'rym' ]
}
@Component({
@@ -38,7 +34,7 @@
columns: ITdDataTableColumn[] = [
{ name: 'code', label: 'Code', tooltip: 'Organization code' },
- { name: 'name', label: 'Application name' },
+ { name: 'name', label: 'Organization name' },
{ name: 'creation_timestamp', label: 'Creation date' },
{ name: 'menu', label: '' }
];
diff --git a/securis/src/main/webapp/src/app/listing/user.list.component.html b/securis/src/main/webapp/src/app/listing/user.list.component.html
index 522e7b7..44cc658 100644
--- a/securis/src/main/webapp/src/app/listing/user.list.component.html
+++ b/securis/src/main/webapp/src/app/listing/user.list.component.html
@@ -1,7 +1,7 @@
<td-layout-card-over cardWidth="70">
<md-toolbar role="toolbar" class="mat-secondary">
<span class="push-left-sm">
- <span class="md-title" i18n>Applications</span>
+ <span class="md-title" i18n>Users</span>
</span>
<span class="push-left-sm" *ngIf="filteredItems < data.length">
<span class="md-body-1">{{filteredItems}} of {{data.length}} applications filtered</span>
@@ -20,12 +20,20 @@
[sortBy]="sortBy"
(sortChange)="sort($event)"
style="width: 100%">
- <template tdDataTableTemplate="creation_timestamp" let-row="row" let-value="value">
- <span>{{value | date: 'medium'}}</span>
+ <template tdDataTableTemplate="fullname" let-row="row" let-value="value">
+ <span>{{row.first_name}} {{row.last_name || ''}}</span>
+ </template>
+ <template tdDataTableTemplate="email" let-row="row" let-value="value">
+ <div layout="row" *ngIf="value">
+ <a md-button color="primary" [href]="'mailto:' + value + '?subject=SeCuris'">{{value}}</a>
+ </div>
+ </template>
+ <template tdDataTableTemplate="lastLogin" let-row="row" let-value="value">
+ <span *ngIf="value">{{value | timeAgo }}</span>
</template>
<template tdDataTableTemplate="menu" let-row="row" let-index="index">
<div layout="row" layout-align="end center">
- <button md-icon-button (click)="edit(row.id)" color="primary"><md-icon>edit</md-icon></button>
+ <button md-icon-button (click)="edit(row.username)" color="primary"><md-icon>edit</md-icon></button>
</div>
</template>
</td-data-table>
diff --git a/securis/src/main/webapp/src/app/listing/user.list.component.ts b/securis/src/main/webapp/src/app/listing/user.list.component.ts
index 7772a11..cd26bf6 100644
--- a/securis/src/main/webapp/src/app/listing/user.list.component.ts
+++ b/securis/src/main/webapp/src/app/listing/user.list.component.ts
@@ -16,19 +16,15 @@
import { ListingBase } from './base';
-var app_example = {
- code: 'CICS',
- creation_timestamp: 1418384439000,
- description: 'Wellbore integrity analysis software',
- id: 1,
- license_filename: 'config_server.lic',
- name: 'CurisIntegrity',
- metadata:
- [ { key: 'max_docs',
- value: '250000',
- readonly: true,
- mandatory: true } ]
-}
+var user_example = { username: 'rym',
+ roles: [ 1 ],
+ lastLogin: 1488885433000,
+ modificationTimestamp: 1479898458000,
+ email: 'rbouchair@curistec.com',
+ first_name: 'Rym',
+ last_name: 'Bouchair',
+ creation_timestamp: 1479898458000,
+ organizations_ids: [ 1, 2, 5, 6, 7, 8 ] }
@Component({
selector: 'user-list',
@@ -37,9 +33,10 @@
export class UserListComponent extends ListingBase implements AfterViewInit {
columns: ITdDataTableColumn[] = [
- { name: 'code', label: 'Code', tooltip: 'Application code' },
- { name: 'name', label: 'Application name' },
- { name: 'creation_timestamp', label: 'Creation date' },
+ { name: 'username', label: 'Username', tooltip: 'Username to access app' },
+ { name: 'fullname', label: 'Fullname' },
+ { name: 'email', label: 'User email' },
+ { name: 'lastLogin', label: 'Last login date' },
{ name: 'menu', label: '' }
];
@@ -81,8 +78,8 @@
this.router.navigate(['users/create']);
}
- edit(eleId: number | string) : void {
- this.router.navigate([`users/edit/${eleId}`]);
+ edit(username: number | string) : void {
+ this.router.navigate([`users/edit/${username}`]);
}
}
diff --git a/securis/src/main/webapp/src/app/menu.component.html b/securis/src/main/webapp/src/app/menu.component.html
index d367da1..0688468 100644
--- a/securis/src/main/webapp/src/app/menu.component.html
+++ b/securis/src/main/webapp/src/app/menu.component.html
@@ -13,17 +13,17 @@
<h3 md-line i18n="menu.applications"> </h3>
<p md-line i18n="menu.applications.description"> </p>
</a>
- <a routerLink="licesetypes" md-list-item (click)="closeMenu()">
+ <a routerLink="/licensetypes" md-list-item (click)="closeMenu()">
<md-icon md-list-avatar>class</md-icon>
<h3 md-line i18n="menu.license_types"> </h3>
<p md-line i18n="menu.license_types.description"> </p>
</a>
- <a routerLink="organizations" md-list-item (click)="closeMenu()">
+ <a routerLink="/organizations" md-list-item (click)="closeMenu()">
<md-icon md-list-avatar>business</md-icon>
<h3 md-line i18n="menu.organizations"> </h3>
<p md-line i18n="menu.organizations.description"> </p>
</a>
- <a routerLink="users" md-list-item (click)="closeMenu()">
+ <a routerLink="/users" md-list-item (click)="closeMenu()">
<md-icon md-list-avatar>account_circle</md-icon>
<h3 md-line i18n="menu.users"> </h3>
<p md-line i18n="menu.users.description"> </p>
diff --git a/securis/src/main/webapp/src/app/resources/organizations.ts b/securis/src/main/webapp/src/app/resources/organizations.ts
index 286428d..27568b5 100644
--- a/securis/src/main/webapp/src/app/resources/organizations.ts
+++ b/securis/src/main/webapp/src/app/resources/organizations.ts
@@ -12,6 +12,7 @@
@Injectable()
export class OrganizationsService extends SeCurisResourceServices {
+
constructor(http: Http, $L: LocaleService) {
super($L, http, 'organization');
}
diff --git a/securis/src/main/webapp/src/lang/messages_en.json b/securis/src/main/webapp/src/lang/messages_en.json
index ca6244b..1147470 100644
--- a/securis/src/main/webapp/src/lang/messages_en.json
+++ b/securis/src/main/webapp/src/lang/messages_en.json
@@ -9,6 +9,7 @@
"field.license_preactivation": "License preactivation",
"field.license_type_id": "License type",
"field.organization_id": "Organization",
+ "field.application_id": "Application",
"field.licensetype_code": "License type",
"field.organization_name": "Organization",
"field.preactivation_valid_period": "Preactivation valid period",
@@ -27,6 +28,7 @@
"field.creation_timestamp": "Creation timestamp",
"field.comments": "Comments",
"field.mandatory": "Required",
+ "field.org_parent_id": "Parent organization",
"field.name": "Name",
"field.license_filename": "License filename",
"field.description": "Description",
--
Gitblit v1.3.2