diff --git a/src/app/sample/sample.component.html b/src/app/sample/sample.component.html index 6b25d1f..aae27cd 100644 --- a/src/app/sample/sample.component.html +++ b/src/app/sample/sample.component.html @@ -42,7 +42,7 @@ label="material number" appValidate="string" [name]="'materialNumber-' + item.i" [ngModel]="item.value"> - @@ -247,7 +247,7 @@ Delete sample - + Do you really want to delete {{sample.number}}? diff --git a/src/app/samples/samples.component.html b/src/app/samples/samples.component.html index 3666bf9..224fc8c 100644 --- a/src/app/samples/samples.component.html +++ b/src/app/samples/samples.component.html @@ -104,13 +104,18 @@ JSON download link - - - - add spectra - - Copy to clipboard + diff --git a/src/app/samples/samples.component.scss b/src/app/samples/samples.component.scss index decf552..16c4ce3 100644 --- a/src/app/samples/samples.component.scss +++ b/src/app/samples/samples.component.scss @@ -210,3 +210,13 @@ textarea.linkmodal { padding-top: 0; margin-top: -4.5px; } + +.link-dialog { + rb-form-checkbox { + display: inline-block; + } + + rb-icon-button { + float: right; + } +} diff --git a/src/app/samples/samples.component.ts b/src/app/samples/samples.component.ts index 4425339..51382ab 100644 --- a/src/app/samples/samples.component.ts +++ b/src/app/samples/samples.component.ts @@ -34,7 +34,8 @@ export class SamplesComponent implements OnInit { @ViewChild('pageSizeSelection') pageSizeSelection: ElementRef; @ViewChild('linkarea') linkarea: ElementRef; - downloadCsv = false; + downloadSpectra = false; + downloadFlatten = true; samples: SampleModel[] = []; totalSamples = 0; // total number of samples csvUrl = ''; // store url separate so it only has to be generated when clicking the download button @@ -94,8 +95,6 @@ export class SamplesComponent implements OnInit { this.calcFieldSelectKeys(); this.d.load('materials', () => { this.filters.filters.find(e => e.field === 'material.name').autocomplete = this.d.arr.materials.map(e => e.name); - this.filters.filters.find(e => e.field === 'color').autocomplete = - [...new Set(this.d.arr.materials.reduce((s, e) => {s.push(...e.numbers.map(el => el.color)); return s; }, []))]; this.loadSamples(); }); this.d.load('materialSuppliers', () => { @@ -200,7 +199,7 @@ export class SamplesComponent implements OnInit { } query.push('sort=' + this.filters.sort); if (options.csv) { - query.push('csv=true'); + query.push('output=csv'); } if (options.export) { query.push('key=' + this.d.d.userKey.key); @@ -230,8 +229,13 @@ export class SamplesComponent implements OnInit { } }); } - else if (this.downloadCsv) { - query.push('fields[]=measurements.spectrum.dpt'); + else { + if (this.downloadFlatten) { + query.push('output=flatten'); + } + if (this.downloadSpectra) { + query.push('fields[]=measurements.spectrum.dpt'); + } } return (options.host && isDevMode() ? window.location.host : '') + (options.export ? this.api.hostName : '') + diff --git a/src/app/users/users.component.html b/src/app/users/users.component.html index fbff322..c4d8b83 100644 --- a/src/app/users/users.component.html +++ b/src/app/users/users.component.html @@ -94,6 +94,15 @@ + + Delete + + + + Do you really want to delete this user? + + Save diff --git a/src/app/users/users.component.scss b/src/app/users/users.component.scss index 9ba4fcf..37893f7 100644 --- a/src/app/users/users.component.scss +++ b/src/app/users/users.component.scss @@ -1,3 +1,12 @@ ::ng-deep td .error-messages { position: absolute; } + +td:last-child rb-icon-button { + width: 100px; + float: left; + + ::ng-deep button { + width: 100%; + } +} diff --git a/src/app/users/users.component.ts b/src/app/users/users.component.ts index 58e77bf..54a8680 100644 --- a/src/app/users/users.component.ts +++ b/src/app/users/users.component.ts @@ -2,6 +2,7 @@ import { Component, OnInit } from '@angular/core'; import {ApiService} from '../services/api.service'; import {UserModel} from '../models/user.model'; import {LoginService} from '../services/login.service'; +import {ModalService} from '@inst-iot/bosch-angular-ui-components'; @Component({ @@ -17,7 +18,8 @@ export class UsersComponent implements OnInit { constructor( private api: ApiService, - public login: LoginService + public login: LoginService, + private modal: ModalService ) { } ngOnInit(): void { @@ -45,4 +47,14 @@ export class UsersComponent implements OnInit { this.newUser = this.newUser ? null : new UserModel(); } + deleteConfirm(modal, username) { + this.modal.open(modal).then(result => { + if (result) { + this.api.delete('/user/' + username, () => { + this.users.splice(this.users.findIndex(e => e.name === username), 1); + }); + } + }); + } + }