#3527 feature - Added all catalogs and working fine
| .. | .. |
|---|
| 41 | 41 | |
|---|
| 42 | 42 | {path: 'licensetypes', component: LicenseTypeListComponent}, |
|---|
| 43 | 43 | {path: 'licensetypes/create', component: LicenseTypeFormComponent}, |
|---|
| 44 | | - {path: 'licensetypes/edit/:applicationId', component: LicenseTypeFormComponent}, |
|---|
| 44 | + {path: 'licensetypes/edit/:licensetypeId', component: LicenseTypeFormComponent}, |
|---|
| 45 | 45 | |
|---|
| 46 | 46 | {path: 'organizations', component: OrganizationListComponent}, |
|---|
| 47 | 47 | {path: 'organizations/create', component: OrganizationFormComponent}, |
|---|
| 48 | | - {path: 'organizations/edit/:applicationId', component: OrganizationFormComponent}, |
|---|
| 48 | + {path: 'organizations/edit/:organizationId', component: OrganizationFormComponent}, |
|---|
| 49 | 49 | |
|---|
| 50 | 50 | {path: 'users', component: UserListComponent}, |
|---|
| 51 | 51 | {path: 'users/create', component: UserFormComponent}, |
|---|
| 52 | | - {path: 'users/edit/:applicationId', component: UserFormComponent} |
|---|
| 52 | + {path: 'users/edit/:username', component: UserFormComponent} |
|---|
| 53 | 53 | |
|---|
| 54 | 54 | ] |
|---|
| 55 | 55 | }, |
|---|
| .. | .. |
|---|
| 90 | 90 | }); |
|---|
| 91 | 91 | } |
|---|
| 92 | 92 | |
|---|
| 93 | | - protected prepareInitialData(idparam: string, default_values: any = {}) : void { |
|---|
| 93 | + protected prepareInitialData(idparam: string, default_values: any = {}, callback?: (data: any) => void) : void { |
|---|
| 94 | 94 | this.form_title = this.$L.get('{} data', this.resourceName.capitalize()); |
|---|
| 95 | 95 | this.isNew = true; |
|---|
| 96 | 96 | !!this.route && this.route.params.subscribe(params => { |
|---|
| .. | .. |
|---|
| 101 | 101 | this.form_subtitle = this.$L.get('Create a new {}', this.resourceName) ; |
|---|
| 102 | 102 | } else { |
|---|
| 103 | 103 | this.isNew = false; |
|---|
| 104 | | - this.resourceServices.get(eleId).subscribe(eleData => this.data = eleData); |
|---|
| 104 | + this.resourceServices.get(eleId).subscribe(eleData => { |
|---|
| 105 | + this.data = eleData; |
|---|
| 106 | + Object.keys(default_values).forEach((k : string) => (this.data[k] === undefined) && (this.data[k] = default_values[k])); |
|---|
| 107 | + callback && callback(this.data); |
|---|
| 108 | + }); |
|---|
| 105 | 109 | this.form_subtitle = this.$L.get('Modify the {} data', this.resourceName) ; |
|---|
| 106 | 110 | } |
|---|
| 107 | 111 | }); |
|---|
| .. | .. |
|---|
| 45 | 45 | <div layout="row" layout-fill layout-padding> |
|---|
| 46 | 46 | <div layout="column" layout-fill flex> |
|---|
| 47 | 47 | <md-input-container flex> |
|---|
| 48 | | - <input mdInput type="text" [(ngModel)]="data.full_name" name="full_name" required maxlength="200" /> |
|---|
| 48 | + <input #firstField mdInput type="text" [(ngModel)]="data.full_name" name="full_name" required maxlength="200" /> |
|---|
| 49 | 49 | <md-placeholder> |
|---|
| 50 | 50 | <span i18n="field.full_name"></span> |
|---|
| 51 | 51 | </md-placeholder> |
|---|
| .. | .. |
|---|
| 10 | 10 | import { FormBase, IComboOption } from './base'; |
|---|
| 11 | 11 | import { ActivatedRoute, Router } from '@angular/router'; |
|---|
| 12 | 12 | |
|---|
| 13 | | -var app_example = { |
|---|
| 14 | | - code: 'CICS', |
|---|
| 15 | | - creation_timestamp: 1418384439000, |
|---|
| 16 | | - description: 'Wellbore integrity analysis software', |
|---|
| 13 | +var lt_example = { |
|---|
| 17 | 14 | id: 1, |
|---|
| 18 | | - license_filename: 'config_server.lic', |
|---|
| 19 | | - name: 'CurisIntegrity', |
|---|
| 20 | | - metadata: |
|---|
| 21 | | - [ { key: 'max_docs', |
|---|
| 22 | | - value: '250000', |
|---|
| 23 | | - readonly: true, |
|---|
| 24 | | - mandatory: true } ] |
|---|
| 15 | + code: 'CI01', |
|---|
| 16 | + name: 'CI ConfigServer ext', |
|---|
| 17 | + application_id: 1, |
|---|
| 18 | + application_name: 'CurisIntegrity', |
|---|
| 19 | + creation_timestamp: 1418384535000, |
|---|
| 20 | + description: 'CI ConfigServer with extended mode and 50 lines', |
|---|
| 21 | + metadata: [ { key: 'max_docs', value: '250000', mandatory: true } ] |
|---|
| 25 | 22 | } |
|---|
| 23 | + |
|---|
| 26 | 24 | |
|---|
| 27 | 25 | @Component({ |
|---|
| 28 | 26 | selector: 'licensetype-form', |
|---|
| 29 | 27 | templateUrl: 'src/app/forms/licensetype.form.html' |
|---|
| 30 | 28 | }) |
|---|
| 31 | 29 | export class LicenseTypeFormComponent extends FormBase { |
|---|
| 32 | | - |
|---|
| 30 | + |
|---|
| 31 | + allApplications: IComboOption[]; |
|---|
| 33 | 32 | constructor(private http: Http, |
|---|
| 34 | 33 | private licenseTypes: LicenseTypesService, |
|---|
| 35 | 34 | private applications: ApplicationsService, |
|---|
| .. | .. |
|---|
| 41 | 40 | super($L, router, route, toaster, licenseTypes, $L.get('license type'), dialogs); |
|---|
| 42 | 41 | } |
|---|
| 43 | 42 | |
|---|
| 44 | | - |
|---|
| 43 | + private _prepareMetadata(metadata : any[]) : any[] { |
|---|
| 44 | + metadata.forEach((md : any) => { |
|---|
| 45 | + if (md.value !== null && md.value !== '') { |
|---|
| 46 | + md.readonly = true; |
|---|
| 47 | + } |
|---|
| 48 | + }); |
|---|
| 49 | + return metadata; |
|---|
| 50 | + } |
|---|
| 51 | + |
|---|
| 52 | + changeApplication(event: any) : void{ |
|---|
| 53 | + console.log(event); |
|---|
| 54 | + this.applications.get(this.data.application_id) |
|---|
| 55 | + .map(app_data => this._prepareMetadata(app_data.metadata)) |
|---|
| 56 | + .subscribe( |
|---|
| 57 | + metadata => this.data.metadata = metadata, |
|---|
| 58 | + err => console.error('Error loading application metadata') |
|---|
| 59 | + ); |
|---|
| 60 | + } |
|---|
| 61 | + |
|---|
| 62 | + |
|---|
| 63 | + |
|---|
| 64 | + loadCombos() : void { |
|---|
| 65 | + this.applications.get() |
|---|
| 66 | + .map(list => list.map((app : any) => <IComboOption>{id: app.id, label: `(${app.code}) ${app.name}`})) |
|---|
| 67 | + .subscribe( |
|---|
| 68 | + data => this.allApplications = (<IComboOption[]>data).sort((e1, e2) => e1.label.localeCompare(e2.label)), |
|---|
| 69 | + err => console.error('Error loading applications') |
|---|
| 70 | + ); |
|---|
| 71 | + } |
|---|
| 72 | + |
|---|
| 45 | 73 | goBack(): void { |
|---|
| 46 | 74 | this.router.navigate([`licensetypes`]); |
|---|
| 47 | 75 | } |
|---|
| 48 | 76 | |
|---|
| 49 | 77 | init() : void { |
|---|
| 78 | + this.loadCombos(); |
|---|
| 50 | 79 | super.setFirstFocus(); |
|---|
| 51 | 80 | super.reset(); |
|---|
| 52 | | - super.prepareInitialData('licenseTypeId', { |
|---|
| 81 | + super.prepareInitialData('licensetypeId', { |
|---|
| 53 | 82 | metadata: [] |
|---|
| 54 | | - }); |
|---|
| 83 | + }, (data) => this._prepareMetadata(data.metadata)); |
|---|
| 55 | 84 | } |
|---|
| 56 | 85 | |
|---|
| 57 | 86 | ngAfterViewInit(): void { |
|---|
| .. | .. |
|---|
| 31 | 31 | <form #form="ngForm" class="inset"> |
|---|
| 32 | 32 | <div layout="column" layout-align="start center"> |
|---|
| 33 | 33 | <div layout="row" layout-fill layout-padding> |
|---|
| 34 | | - <field-readonly [value]="data.id" label="field.id" flex="15" *ngIf="!isNew"></field-readonly> |
|---|
| 35 | | - <div layout="column" layout-fill flex> |
|---|
| 34 | + <field-readonly [value]="data.id" label="field.id" flex="10" *ngIf="!isNew"></field-readonly> |
|---|
| 35 | + <div layout="column" layout-fill flex="30"> |
|---|
| 36 | 36 | <md-input-container> |
|---|
| 37 | 37 | <input #firstField mdInput maxLength="50" type="text" [(ngModel)]="data.code" name="code" required [readonly]="!isNew" /> |
|---|
| 38 | 38 | <md-placeholder> |
|---|
| .. | .. |
|---|
| 41 | 41 | </md-input-container> |
|---|
| 42 | 42 | <error-checker [fieldName]="getFieldName('code')" [formField]="form.controls.code"></error-checker> |
|---|
| 43 | 43 | </div> |
|---|
| 44 | | - </div> |
|---|
| 45 | | - <div layout="row" layout-fill layout-padding> |
|---|
| 46 | 44 | <div layout="column" layout-fill flex> |
|---|
| 47 | 45 | <md-input-container flex> |
|---|
| 48 | 46 | <input mdInput type="text" [(ngModel)]="data.name" name="name" required /> |
|---|
| .. | .. |
|---|
| 51 | 49 | </md-placeholder> |
|---|
| 52 | 50 | </md-input-container> |
|---|
| 53 | 51 | <error-checker [fieldName]="getFieldName('name')" [formField]="form.controls.name"></error-checker> |
|---|
| 54 | | - </div> |
|---|
| 55 | | - <div layout="column" layout-fill flex> |
|---|
| 56 | | - <md-input-container flex> |
|---|
| 57 | | - <input mdInput type="text" [(ngModel)]="data.license_filename" name="license_filename" required /> |
|---|
| 58 | | - <md-placeholder> |
|---|
| 59 | | - <span i18n="field.license_filename"></span> |
|---|
| 60 | | - </md-placeholder> |
|---|
| 61 | | - </md-input-container> |
|---|
| 62 | | - <error-checker [fieldName]="getFieldName('license_filename')" [formField]="form.controls.license_filename"></error-checker> |
|---|
| 63 | 52 | </div> |
|---|
| 64 | 53 | </div> |
|---|
| 65 | 54 | <div layout="row" layout-fill layout-padding> |
|---|
| .. | .. |
|---|
| 73 | 62 | </md-input-container> |
|---|
| 74 | 63 | </div> |
|---|
| 75 | 64 | </div> |
|---|
| 65 | + <div layout="row" layout-fill layout-padding > |
|---|
| 66 | + <div layout="column" layout-fill flex> |
|---|
| 67 | + <md-select [placeholder]="getFieldName('application_id')" flex [(ngModel)]="data.application_id" name="application_id" |
|---|
| 68 | + (change)="changeApplication($event)"> |
|---|
| 69 | + <md-option *ngFor="let org of allApplications" [value]="org.id"> |
|---|
| 70 | + {{org.label}} |
|---|
| 71 | + </md-option> |
|---|
| 72 | + </md-select> |
|---|
| 73 | + <error-checker [fieldName]="getFieldName('application_id')" [formField]="form.controls.application_id"></error-checker> |
|---|
| 74 | + </div> |
|---|
| 75 | + </div> |
|---|
| 76 | 76 | <div layout="row" layout-fill layout-padding *ngIf="!isNew"> |
|---|
| 77 | 77 | <field-readonly [value]="data.creation_timestamp | date: 'medium'" label="field.creation_timestamp" flex></field-readonly> |
|---|
| 78 | 78 | </div> |
|---|
| 79 | | - <metadata-manager addOrDelete="true" editKeys="true" [metadata]="data.metadata" ></metadata-manager> |
|---|
| 79 | + <metadata-manager [addOrDelete]="false" [editKeys]="false" [metadata]="data.metadata" ></metadata-manager> |
|---|
| 80 | 80 | </div> |
|---|
| 81 | 81 | </form> |
|---|
| 82 | 82 | </md-card-content> |
|---|
| .. | .. |
|---|
| 9 | 9 | import { TdMediaService } from '@covalent/core'; |
|---|
| 10 | 10 | import { FormBase, IComboOption } from './base'; |
|---|
| 11 | 11 | import { ActivatedRoute, Router } from '@angular/router'; |
|---|
| 12 | +import { UsersService } from "../resources/users"; |
|---|
| 12 | 13 | |
|---|
| 13 | 14 | var app_example = { |
|---|
| 14 | 15 | code: 'CICS', |
|---|
| .. | .. |
|---|
| 30 | 31 | }) |
|---|
| 31 | 32 | export class OrganizationFormComponent extends FormBase { |
|---|
| 32 | 33 | |
|---|
| 34 | + parentOrganizations: any[]; |
|---|
| 35 | + usernames: string[] = []; |
|---|
| 36 | + |
|---|
| 33 | 37 | constructor(private http: Http, |
|---|
| 34 | 38 | private licenseTypes: LicenseTypesService, |
|---|
| 35 | 39 | private organizations: OrganizationsService, |
|---|
| 40 | + private users: UsersService, |
|---|
| 36 | 41 | router: Router, |
|---|
| 37 | 42 | toaster: ToastsManager, |
|---|
| 38 | 43 | route: ActivatedRoute, |
|---|
| .. | .. |
|---|
| 41 | 46 | super($L, router, route, toaster, organizations, $L.get('organization'), dialogs); |
|---|
| 42 | 47 | } |
|---|
| 43 | 48 | |
|---|
| 44 | | - |
|---|
| 49 | + loadCombos() : void { |
|---|
| 50 | + this.organizations.get() |
|---|
| 51 | + .map(list => list.map((org : any) => <IComboOption>{id: org.id, label: `(${org.code}) ${org.name}`})) |
|---|
| 52 | + .subscribe( |
|---|
| 53 | + data => this.parentOrganizations = (<IComboOption[]>data).sort((e1, e2) => e1.label.localeCompare(e2.label)), |
|---|
| 54 | + err => console.error('Error loading organizations') |
|---|
| 55 | + ); |
|---|
| 56 | + this.users.get() |
|---|
| 57 | + .map(list => list |
|---|
| 58 | + .filter((user : any) => user.username !== '_client') |
|---|
| 59 | + .map((u : any) => u.username)) |
|---|
| 60 | + .subscribe( |
|---|
| 61 | + data => this.usernames = (<string[]>data).sort((u1, u2) => u1.localeCompare(u2)), |
|---|
| 62 | + err => console.error('Error loading users') |
|---|
| 63 | + ); |
|---|
| 64 | + } |
|---|
| 65 | + |
|---|
| 66 | + |
|---|
| 45 | 67 | goBack(): void { |
|---|
| 46 | 68 | this.router.navigate([`organizations`]); |
|---|
| 47 | 69 | } |
|---|
| 48 | 70 | |
|---|
| 49 | 71 | init() : void { |
|---|
| 72 | + this.loadCombos(); |
|---|
| 50 | 73 | super.setFirstFocus(); |
|---|
| 51 | 74 | super.reset(); |
|---|
| 52 | | - super.prepareInitialData('organizationId'); |
|---|
| 75 | + super.prepareInitialData('organizationId', {users_ids: []}); |
|---|
| 53 | 76 | } |
|---|
| 54 | 77 | |
|---|
| 55 | 78 | ngAfterViewInit(): void { |
|---|
| .. | .. |
|---|
| 3 | 3 | <button md-icon-button (click)="goBack()" color="accent"> |
|---|
| 4 | 4 | <md-icon>arrow_back</md-icon> |
|---|
| 5 | 5 | </button> |
|---|
| 6 | | - <span class="md-title" [innerText]="form_title"></span> |
|---|
| 6 | + <span [innerText]="form_title"></span> |
|---|
| 7 | 7 | <span flex></span> |
|---|
| 8 | 8 | <button md-icon-button (click)="save()"><md-icon>save</md-icon></button> |
|---|
| 9 | 9 | </md-toolbar> |
|---|
| 10 | | - <!-- |
|---|
| 11 | | - code: 'CICS', |
|---|
| 12 | | - creation_timestamp: 1418384439000, |
|---|
| 13 | | - description: 'Wellbore integrity analysis software', |
|---|
| 14 | | - id: 1, |
|---|
| 15 | | - license_filename: 'config_server.lic', |
|---|
| 16 | | - name: 'CurisIntegrity', |
|---|
| 17 | | - metadata: |
|---|
| 18 | | - [ { key: 'max_docs', |
|---|
| 19 | | - value: '250000', |
|---|
| 20 | | - readonly: true, |
|---|
| 21 | | - mandatory: true } ] |
|---|
| 22 | | -} |
|---|
| 23 | | - --> |
|---|
| 10 | + |
|---|
| 24 | 11 | <div class="margin" layout-align-gt-xs="center start" layout-fill="" layout-gt-xs="row"> |
|---|
| 25 | 12 | <md-card flex="70"> |
|---|
| 26 | 13 | <md-card-title> |
|---|
| .. | .. |
|---|
| 31 | 18 | <form #form="ngForm" class="inset"> |
|---|
| 32 | 19 | <div layout="column" layout-align="start center"> |
|---|
| 33 | 20 | <div layout="row" layout-fill layout-padding> |
|---|
| 34 | | - <field-readonly [value]="data.id" label="field.id" flex="15" *ngIf="!isNew"></field-readonly> |
|---|
| 35 | | - <div layout="column" layout-fill flex> |
|---|
| 21 | + <field-readonly [value]="data.id" label="field.id" flex="10" *ngIf="!isNew"></field-readonly> |
|---|
| 22 | + <div layout="column" layout-fill flex="30"> |
|---|
| 36 | 23 | <md-input-container> |
|---|
| 37 | 24 | <input #firstField mdInput maxLength="50" type="text" [(ngModel)]="data.code" name="code" required [readonly]="!isNew" /> |
|---|
| 38 | 25 | <md-placeholder> |
|---|
| .. | .. |
|---|
| 41 | 28 | </md-input-container> |
|---|
| 42 | 29 | <error-checker [fieldName]="getFieldName('code')" [formField]="form.controls.code"></error-checker> |
|---|
| 43 | 30 | </div> |
|---|
| 44 | | - </div> |
|---|
| 45 | | - <div layout="row" layout-fill layout-padding> |
|---|
| 46 | 31 | <div layout="column" layout-fill flex> |
|---|
| 47 | 32 | <md-input-container flex> |
|---|
| 48 | 33 | <input mdInput type="text" [(ngModel)]="data.name" name="name" required /> |
|---|
| .. | .. |
|---|
| 51 | 36 | </md-placeholder> |
|---|
| 52 | 37 | </md-input-container> |
|---|
| 53 | 38 | <error-checker [fieldName]="getFieldName('name')" [formField]="form.controls.name"></error-checker> |
|---|
| 54 | | - </div> |
|---|
| 55 | | - <div layout="column" layout-fill flex> |
|---|
| 56 | | - <md-input-container flex> |
|---|
| 57 | | - <input mdInput type="text" [(ngModel)]="data.license_filename" name="license_filename" required /> |
|---|
| 58 | | - <md-placeholder> |
|---|
| 59 | | - <span i18n="field.license_filename"></span> |
|---|
| 60 | | - </md-placeholder> |
|---|
| 61 | | - </md-input-container> |
|---|
| 62 | | - <error-checker [fieldName]="getFieldName('license_filename')" [formField]="form.controls.license_filename"></error-checker> |
|---|
| 63 | 39 | </div> |
|---|
| 64 | 40 | </div> |
|---|
| 65 | 41 | <div layout="row" layout-fill layout-padding> |
|---|
| .. | .. |
|---|
| 73 | 49 | </md-input-container> |
|---|
| 74 | 50 | </div> |
|---|
| 75 | 51 | </div> |
|---|
| 76 | | - <div layout="row" layout-fill layout-padding *ngIf="!isNew"> |
|---|
| 77 | | - <field-readonly [value]="data.creation_timestamp | date: 'medium'" label="field.creation_timestamp" flex></field-readonly> |
|---|
| 52 | + <div layout="row" layout-fill layout-padding > |
|---|
| 53 | + <div layout="column" layout-fill flex> |
|---|
| 54 | + <md-select [placeholder]="getFieldName('org_parent_id')" flex [(ngModel)]="data.org_parent_id" name="org_parent_id"> |
|---|
| 55 | + <md-option *ngFor="let org of parentOrganizations" [value]="org.id"> |
|---|
| 56 | + {{org.label}} |
|---|
| 57 | + </md-option> |
|---|
| 58 | + </md-select> |
|---|
| 59 | + <error-checker [fieldName]="getFieldName('org_parent_id')" [formField]="form.controls.org_parent_id"></error-checker> |
|---|
| 60 | + </div> |
|---|
| 78 | 61 | </div> |
|---|
| 79 | | - <metadata-manager addOrDelete="true" editKeys="true" [metadata]="data.metadata" ></metadata-manager> |
|---|
| 62 | + <div layout="row" layout-fill layout-padding > |
|---|
| 63 | + <td-chips flex [mdTooltip]="$L.get('Users with access to this organization')" [placeholder]="$L.get('Select users')" |
|---|
| 64 | + [items]="usernames" [(ngModel)]="data.users_ids" name="users_ids" requireMatch> |
|---|
| 65 | + </td-chips> |
|---|
| 66 | + </div> |
|---|
| 80 | 67 | </div> |
|---|
| 81 | 68 | </form> |
|---|
| 82 | 69 | </md-card-content> |
|---|
| .. | .. |
|---|
| 10 | 10 | import { FormBase, IComboOption } from './base'; |
|---|
| 11 | 11 | import { ActivatedRoute, Router } from '@angular/router'; |
|---|
| 12 | 12 | |
|---|
| 13 | | -var app_example = { |
|---|
| 14 | | - |
|---|
| 13 | +var user_example = { |
|---|
| 14 | + username: 'rym', |
|---|
| 15 | + roles: [ 1 ], |
|---|
| 16 | + lastLogin: 1488885433000, |
|---|
| 17 | + modificationTimestamp: 1479898458000, |
|---|
| 18 | + email: 'rbouchair@curistec.com', |
|---|
| 19 | + first_name: 'Rym', |
|---|
| 20 | + last_name: 'Bouchair', |
|---|
| 21 | + creation_timestamp: 1479898458000, |
|---|
| 22 | + organizations_ids: [ 1, 2, 5, 6, 7, 8 ] |
|---|
| 15 | 23 | } |
|---|
| 16 | 24 | |
|---|
| 17 | 25 | @Component({ |
|---|
| .. | .. |
|---|
| 39 | 47 | init() : void { |
|---|
| 40 | 48 | super.setFirstFocus(); |
|---|
| 41 | 49 | super.reset(); |
|---|
| 42 | | - super.prepareInitialData('userId', { |
|---|
| 50 | + super.prepareInitialData('username', { |
|---|
| 43 | 51 | metadata: [] |
|---|
| 44 | 52 | }); |
|---|
| 45 | 53 | } |
|---|
| .. | .. |
|---|
| 45 | 45 | <md-icon [style.color]="licenses.getStatusColor(row.status)">brightness_1</md-icon> <span>{{licenses.getStatusName(row.status)}}</span> |
|---|
| 46 | 46 | </div> |
|---|
| 47 | 47 | </template> |
|---|
| 48 | | - <template tdDataTableTemplate="email" let-row="row"> |
|---|
| 49 | | - <div layout="row"> |
|---|
| 50 | | - <a md-button color="primary" [href]="'mailto:' + row.email + '?subject=SeCuris'">{{row.email}}</a> |
|---|
| 48 | + <template tdDataTableTemplate="email" let-row="row" let-value="value"> |
|---|
| 49 | + <div layout="row" *ngIf="value"> |
|---|
| 50 | + <a md-button color="primary" [href]="'mailto:' + value + '?subject=SeCuris'">{{value}}</a> |
|---|
| 51 | 51 | </div> |
|---|
| 52 | 52 | </template> |
|---|
| 53 | 53 | <template tdDataTableTemplate="expiration_date" let-row="row"> |
|---|
| .. | .. |
|---|
| 1 | 1 | <td-layout-card-over cardWidth="70"> |
|---|
| 2 | 2 | <md-toolbar role="toolbar" class="mat-secondary"> |
|---|
| 3 | 3 | <span class="push-left-sm"> |
|---|
| 4 | | - <span class="md-title" i18n>Applications</span> |
|---|
| 4 | + <span class="md-title" i18n>License types</span> |
|---|
| 5 | 5 | </span> |
|---|
| 6 | 6 | <span class="push-left-sm" *ngIf="filteredItems < data.length"> |
|---|
| 7 | | - <span class="md-body-1">{{filteredItems}} of {{data.length}} applications filtered</span> |
|---|
| 7 | + <span class="md-body-1">{{filteredItems}} of {{data.length}} license types filtered</span> |
|---|
| 8 | 8 | </span> |
|---|
| 9 | 9 | <td-search-box #searchBox class="push-right-sm" placeholder="Search here" (searchDebounce)="search($event)" flex> |
|---|
| 10 | 10 | </td-search-box> |
|---|
| .. | .. |
|---|
| 16 | 16 | import { ListingBase } from './base'; |
|---|
| 17 | 17 | |
|---|
| 18 | 18 | |
|---|
| 19 | | -var app_example = { |
|---|
| 20 | | - code: 'CICS', |
|---|
| 21 | | - creation_timestamp: 1418384439000, |
|---|
| 22 | | - description: 'Wellbore integrity analysis software', |
|---|
| 19 | +var lt_example = { |
|---|
| 23 | 20 | id: 1, |
|---|
| 24 | | - license_filename: 'config_server.lic', |
|---|
| 25 | | - name: 'CurisIntegrity', |
|---|
| 26 | | - metadata: |
|---|
| 27 | | - [ { key: 'max_docs', |
|---|
| 28 | | - value: '250000', |
|---|
| 29 | | - readonly: true, |
|---|
| 30 | | - mandatory: true } ] |
|---|
| 21 | + code: 'CI01', |
|---|
| 22 | + name: 'CI ConfigServer ext', |
|---|
| 23 | + application_id: 1, |
|---|
| 24 | + application_name: 'CurisIntegrity', |
|---|
| 25 | + creation_timestamp: 1418384535000, |
|---|
| 26 | + description: 'CI ConfigServer with extended mode and 50 lines', |
|---|
| 27 | + metadata: [ { key: 'max_docs', value: '250000', mandatory: true } ] |
|---|
| 31 | 28 | } |
|---|
| 32 | 29 | |
|---|
| 33 | 30 | @Component({ |
|---|
| .. | .. |
|---|
| 38 | 35 | |
|---|
| 39 | 36 | columns: ITdDataTableColumn[] = [ |
|---|
| 40 | 37 | { name: 'code', label: 'Code', tooltip: 'License type code' }, |
|---|
| 41 | | - { name: 'name', label: 'Application name' }, |
|---|
| 42 | | - { name: 'creation_timestamp', label: 'Creation date' }, |
|---|
| 38 | + { name: 'name', label: 'License type name' }, |
|---|
| 39 | + { name: 'application_name', label: 'Application' }, |
|---|
| 43 | 40 | { name: 'menu', label: '' } |
|---|
| 44 | 41 | ]; |
|---|
| 45 | 42 | |
|---|
| .. | .. |
|---|
| 1 | 1 | <td-layout-card-over cardWidth="70"> |
|---|
| 2 | 2 | <md-toolbar role="toolbar" class="mat-secondary"> |
|---|
| 3 | 3 | <span class="push-left-sm"> |
|---|
| 4 | | - <span class="md-title" i18n>Applications</span> |
|---|
| 4 | + <span class="md-title" i18n>Organizations</span> |
|---|
| 5 | 5 | </span> |
|---|
| 6 | 6 | <span class="push-left-sm" *ngIf="filteredItems < data.length"> |
|---|
| 7 | 7 | <span class="md-body-1">{{filteredItems}} of {{data.length}} applications filtered</span> |
|---|
| .. | .. |
|---|
| 16 | 16 | import { ListingBase } from './base'; |
|---|
| 17 | 17 | |
|---|
| 18 | 18 | |
|---|
| 19 | | -var app_example = { |
|---|
| 20 | | - code: 'CICS', |
|---|
| 21 | | - creation_timestamp: 1418384439000, |
|---|
| 22 | | - description: 'Wellbore integrity analysis software', |
|---|
| 19 | +var org_example = { |
|---|
| 23 | 20 | id: 1, |
|---|
| 24 | | - license_filename: 'config_server.lic', |
|---|
| 25 | | - name: 'CurisIntegrity', |
|---|
| 26 | | - metadata: |
|---|
| 27 | | - [ { key: 'max_docs', |
|---|
| 28 | | - value: '250000', |
|---|
| 29 | | - readonly: true, |
|---|
| 30 | | - mandatory: true } ] |
|---|
| 21 | + code: 'BP01', |
|---|
| 22 | + creation_timestamp: 1418384454000, |
|---|
| 23 | + name: 'British Petroleum', |
|---|
| 24 | + org_parent_id:2, |
|---|
| 25 | + org_parent_name:"CurisTec", |
|---|
| 26 | + users_ids: [ 'rym' ] |
|---|
| 31 | 27 | } |
|---|
| 32 | 28 | |
|---|
| 33 | 29 | @Component({ |
|---|
| .. | .. |
|---|
| 38 | 34 | |
|---|
| 39 | 35 | columns: ITdDataTableColumn[] = [ |
|---|
| 40 | 36 | { name: 'code', label: 'Code', tooltip: 'Organization code' }, |
|---|
| 41 | | - { name: 'name', label: 'Application name' }, |
|---|
| 37 | + { name: 'name', label: 'Organization name' }, |
|---|
| 42 | 38 | { name: 'creation_timestamp', label: 'Creation date' }, |
|---|
| 43 | 39 | { name: 'menu', label: '' } |
|---|
| 44 | 40 | ]; |
|---|
| .. | .. |
|---|
| 1 | 1 | <td-layout-card-over cardWidth="70"> |
|---|
| 2 | 2 | <md-toolbar role="toolbar" class="mat-secondary"> |
|---|
| 3 | 3 | <span class="push-left-sm"> |
|---|
| 4 | | - <span class="md-title" i18n>Applications</span> |
|---|
| 4 | + <span class="md-title" i18n>Users</span> |
|---|
| 5 | 5 | </span> |
|---|
| 6 | 6 | <span class="push-left-sm" *ngIf="filteredItems < data.length"> |
|---|
| 7 | 7 | <span class="md-body-1">{{filteredItems}} of {{data.length}} applications filtered</span> |
|---|
| .. | .. |
|---|
| 20 | 20 | [sortBy]="sortBy" |
|---|
| 21 | 21 | (sortChange)="sort($event)" |
|---|
| 22 | 22 | style="width: 100%"> |
|---|
| 23 | | - <template tdDataTableTemplate="creation_timestamp" let-row="row" let-value="value"> |
|---|
| 24 | | - <span>{{value | date: 'medium'}}</span> |
|---|
| 23 | + <template tdDataTableTemplate="fullname" let-row="row" let-value="value"> |
|---|
| 24 | + <span>{{row.first_name}} {{row.last_name || ''}}</span> |
|---|
| 25 | + </template> |
|---|
| 26 | + <template tdDataTableTemplate="email" let-row="row" let-value="value"> |
|---|
| 27 | + <div layout="row" *ngIf="value"> |
|---|
| 28 | + <a md-button color="primary" [href]="'mailto:' + value + '?subject=SeCuris'">{{value}}</a> |
|---|
| 29 | + </div> |
|---|
| 30 | + </template> |
|---|
| 31 | + <template tdDataTableTemplate="lastLogin" let-row="row" let-value="value"> |
|---|
| 32 | + <span *ngIf="value">{{value | timeAgo }}</span> |
|---|
| 25 | 33 | </template> |
|---|
| 26 | 34 | <template tdDataTableTemplate="menu" let-row="row" let-index="index"> |
|---|
| 27 | 35 | <div layout="row" layout-align="end center"> |
|---|
| 28 | | - <button md-icon-button (click)="edit(row.id)" color="primary"><md-icon>edit</md-icon></button> |
|---|
| 36 | + <button md-icon-button (click)="edit(row.username)" color="primary"><md-icon>edit</md-icon></button> |
|---|
| 29 | 37 | </div> |
|---|
| 30 | 38 | </template> |
|---|
| 31 | 39 | </td-data-table> |
|---|
| .. | .. |
|---|
| 16 | 16 | import { ListingBase } from './base'; |
|---|
| 17 | 17 | |
|---|
| 18 | 18 | |
|---|
| 19 | | -var app_example = { |
|---|
| 20 | | - code: 'CICS', |
|---|
| 21 | | - creation_timestamp: 1418384439000, |
|---|
| 22 | | - description: 'Wellbore integrity analysis software', |
|---|
| 23 | | - id: 1, |
|---|
| 24 | | - license_filename: 'config_server.lic', |
|---|
| 25 | | - name: 'CurisIntegrity', |
|---|
| 26 | | - metadata: |
|---|
| 27 | | - [ { key: 'max_docs', |
|---|
| 28 | | - value: '250000', |
|---|
| 29 | | - readonly: true, |
|---|
| 30 | | - mandatory: true } ] |
|---|
| 31 | | -} |
|---|
| 19 | +var user_example = { username: 'rym', |
|---|
| 20 | + roles: [ 1 ], |
|---|
| 21 | + lastLogin: 1488885433000, |
|---|
| 22 | + modificationTimestamp: 1479898458000, |
|---|
| 23 | + email: 'rbouchair@curistec.com', |
|---|
| 24 | + first_name: 'Rym', |
|---|
| 25 | + last_name: 'Bouchair', |
|---|
| 26 | + creation_timestamp: 1479898458000, |
|---|
| 27 | + organizations_ids: [ 1, 2, 5, 6, 7, 8 ] } |
|---|
| 32 | 28 | |
|---|
| 33 | 29 | @Component({ |
|---|
| 34 | 30 | selector: 'user-list', |
|---|
| .. | .. |
|---|
| 37 | 33 | export class UserListComponent extends ListingBase implements AfterViewInit { |
|---|
| 38 | 34 | |
|---|
| 39 | 35 | columns: ITdDataTableColumn[] = [ |
|---|
| 40 | | - { name: 'code', label: 'Code', tooltip: 'Application code' }, |
|---|
| 41 | | - { name: 'name', label: 'Application name' }, |
|---|
| 42 | | - { name: 'creation_timestamp', label: 'Creation date' }, |
|---|
| 36 | + { name: 'username', label: 'Username', tooltip: 'Username to access app' }, |
|---|
| 37 | + { name: 'fullname', label: 'Fullname' }, |
|---|
| 38 | + { name: 'email', label: 'User email' }, |
|---|
| 39 | + { name: 'lastLogin', label: 'Last login date' }, |
|---|
| 43 | 40 | { name: 'menu', label: '' } |
|---|
| 44 | 41 | ]; |
|---|
| 45 | 42 | |
|---|
| .. | .. |
|---|
| 81 | 78 | this.router.navigate(['users/create']); |
|---|
| 82 | 79 | } |
|---|
| 83 | 80 | |
|---|
| 84 | | - edit(eleId: number | string) : void { |
|---|
| 85 | | - this.router.navigate([`users/edit/${eleId}`]); |
|---|
| 81 | + edit(username: number | string) : void { |
|---|
| 82 | + this.router.navigate([`users/edit/${username}`]); |
|---|
| 86 | 83 | } |
|---|
| 87 | 84 | |
|---|
| 88 | 85 | } |
|---|
| .. | .. |
|---|
| 13 | 13 | <h3 md-line i18n="menu.applications"> </h3> |
|---|
| 14 | 14 | <p md-line i18n="menu.applications.description"> </p> |
|---|
| 15 | 15 | </a> |
|---|
| 16 | | - <a routerLink="licesetypes" md-list-item (click)="closeMenu()"> |
|---|
| 16 | + <a routerLink="/licensetypes" md-list-item (click)="closeMenu()"> |
|---|
| 17 | 17 | <md-icon md-list-avatar>class</md-icon> |
|---|
| 18 | 18 | <h3 md-line i18n="menu.license_types"> </h3> |
|---|
| 19 | 19 | <p md-line i18n="menu.license_types.description"> </p> |
|---|
| 20 | 20 | </a> |
|---|
| 21 | | - <a routerLink="organizations" md-list-item (click)="closeMenu()"> |
|---|
| 21 | + <a routerLink="/organizations" md-list-item (click)="closeMenu()"> |
|---|
| 22 | 22 | <md-icon md-list-avatar>business</md-icon> |
|---|
| 23 | 23 | <h3 md-line i18n="menu.organizations"> </h3> |
|---|
| 24 | 24 | <p md-line i18n="menu.organizations.description"> </p> |
|---|
| 25 | 25 | </a> |
|---|
| 26 | | - <a routerLink="users" md-list-item (click)="closeMenu()"> |
|---|
| 26 | + <a routerLink="/users" md-list-item (click)="closeMenu()"> |
|---|
| 27 | 27 | <md-icon md-list-avatar>account_circle</md-icon> |
|---|
| 28 | 28 | <h3 md-line i18n="menu.users"> </h3> |
|---|
| 29 | 29 | <p md-line i18n="menu.users.description"> </p> |
|---|
| .. | .. |
|---|
| 12 | 12 | |
|---|
| 13 | 13 | @Injectable() |
|---|
| 14 | 14 | export class OrganizationsService extends SeCurisResourceServices { |
|---|
| 15 | + |
|---|
| 15 | 16 | constructor(http: Http, $L: LocaleService) { |
|---|
| 16 | 17 | super($L, http, 'organization'); |
|---|
| 17 | 18 | } |
|---|
| .. | .. |
|---|
| 9 | 9 | "field.license_preactivation": "License preactivation", |
|---|
| 10 | 10 | "field.license_type_id": "License type", |
|---|
| 11 | 11 | "field.organization_id": "Organization", |
|---|
| 12 | + "field.application_id": "Application", |
|---|
| 12 | 13 | "field.licensetype_code": "License type", |
|---|
| 13 | 14 | "field.organization_name": "Organization", |
|---|
| 14 | 15 | "field.preactivation_valid_period": "Preactivation valid period", |
|---|
| .. | .. |
|---|
| 27 | 28 | "field.creation_timestamp": "Creation timestamp", |
|---|
| 28 | 29 | "field.comments": "Comments", |
|---|
| 29 | 30 | "field.mandatory": "Required", |
|---|
| 31 | + "field.org_parent_id": "Parent organization", |
|---|
| 30 | 32 | "field.name": "Name", |
|---|
| 31 | 33 | "field.license_filename": "License filename", |
|---|
| 32 | 34 | "field.description": "Description", |
|---|