flattened result
This commit is contained in:
parent
2f129ea508
commit
1dc67ffc9d
@ -247,7 +247,7 @@
|
|||||||
Delete sample
|
Delete sample
|
||||||
</rb-icon-button>
|
</rb-icon-button>
|
||||||
<ng-template #modalDeleteConfirm>
|
<ng-template #modalDeleteConfirm>
|
||||||
<rb-alert alertTitle="Are you sure" type="danger" okBtnLabel="Delete sample" cancelBtnLabel="Cancel">
|
<rb-alert alertTitle="Are you sure?" type="danger" okBtnLabel="Delete sample" cancelBtnLabel="Cancel">
|
||||||
Do you really want to delete {{sample.number}}?
|
Do you really want to delete {{sample.number}}?
|
||||||
</rb-alert>
|
</rb-alert>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
|
@ -104,13 +104,18 @@
|
|||||||
JSON download link
|
JSON download link
|
||||||
</rb-icon-button>
|
</rb-icon-button>
|
||||||
<ng-template #linkModal>
|
<ng-template #linkModal>
|
||||||
<label for="jsonUrl">URL for JSON download</label>
|
<div class="link-dialog">
|
||||||
<textarea class="linkmodal" id="jsonUrl" #linkarea [value]="sampleUrl({export: true, host: true})"
|
<label for="jsonUrl">URL for JSON download</label>
|
||||||
(keydown)="preventDefault($event)"></textarea>
|
<textarea class="linkmodal" id="jsonUrl" #linkarea [value]="sampleUrl({export: true, host: true})"
|
||||||
<rb-form-checkbox class="space-below" name="download-csv" [(ngModel)]="downloadCsv">
|
(keydown)="preventDefault($event)"></textarea>
|
||||||
add spectra
|
<rb-form-checkbox class="space-right" name="download-spectra" [(ngModel)]="downloadSpectra">
|
||||||
</rb-form-checkbox>
|
add spectra
|
||||||
<rb-icon-button icon="clipboard" mode="secondary" (click)="clipboard()">Copy to clipboard</rb-icon-button>
|
</rb-form-checkbox>
|
||||||
|
<rb-form-checkbox name="download-flatten" [(ngModel)]="downloadFlatten">
|
||||||
|
flatten object
|
||||||
|
</rb-form-checkbox>
|
||||||
|
<rb-icon-button icon="clipboard" mode="secondary" (click)="clipboard()">Copy to clipboard</rb-icon-button>
|
||||||
|
</div>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
<a [href]="csvUrl" download="samples.csv">
|
<a [href]="csvUrl" download="samples.csv">
|
||||||
<rb-icon-button icon="download" mode="secondary" (mousedown)="csvUrl = sampleUrl({csv: true, export: true})">
|
<rb-icon-button icon="download" mode="secondary" (mousedown)="csvUrl = sampleUrl({csv: true, export: true})">
|
||||||
|
@ -210,3 +210,13 @@ textarea.linkmodal {
|
|||||||
padding-top: 0;
|
padding-top: 0;
|
||||||
margin-top: -4.5px;
|
margin-top: -4.5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.link-dialog {
|
||||||
|
rb-form-checkbox {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
rb-icon-button {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -34,7 +34,8 @@ export class SamplesComponent implements OnInit {
|
|||||||
@ViewChild('pageSizeSelection') pageSizeSelection: ElementRef<HTMLElement>;
|
@ViewChild('pageSizeSelection') pageSizeSelection: ElementRef<HTMLElement>;
|
||||||
@ViewChild('linkarea') linkarea: ElementRef<HTMLTextAreaElement>;
|
@ViewChild('linkarea') linkarea: ElementRef<HTMLTextAreaElement>;
|
||||||
|
|
||||||
downloadCsv = false;
|
downloadSpectra = false;
|
||||||
|
downloadFlatten = true;
|
||||||
samples: SampleModel[] = [];
|
samples: SampleModel[] = [];
|
||||||
totalSamples = 0; // total number of samples
|
totalSamples = 0; // total number of samples
|
||||||
csvUrl = ''; // store url separate so it only has to be generated when clicking the download button
|
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.calcFieldSelectKeys();
|
||||||
this.d.load('materials', () => {
|
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 === '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.loadSamples();
|
||||||
});
|
});
|
||||||
this.d.load('materialSuppliers', () => {
|
this.d.load('materialSuppliers', () => {
|
||||||
@ -200,7 +199,7 @@ export class SamplesComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
query.push('sort=' + this.filters.sort);
|
query.push('sort=' + this.filters.sort);
|
||||||
if (options.csv) {
|
if (options.csv) {
|
||||||
query.push('csv=true');
|
query.push('output=csv');
|
||||||
}
|
}
|
||||||
if (options.export) {
|
if (options.export) {
|
||||||
query.push('key=' + this.d.d.userKey.key);
|
query.push('key=' + this.d.d.userKey.key);
|
||||||
@ -230,8 +229,13 @@ export class SamplesComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else if (this.downloadCsv) {
|
else {
|
||||||
query.push('fields[]=measurements.spectrum.dpt');
|
if (this.downloadFlatten) {
|
||||||
|
query.push('output=flatten');
|
||||||
|
}
|
||||||
|
if (this.downloadSpectra) {
|
||||||
|
query.push('fields[]=measurements.spectrum.dpt');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return (options.host && isDevMode() ? window.location.host : '') +
|
return (options.host && isDevMode() ? window.location.host : '') +
|
||||||
(options.export ? this.api.hostName : '') +
|
(options.export ? this.api.hostName : '') +
|
||||||
|
@ -94,6 +94,15 @@
|
|||||||
</rb-array-input>
|
</rb-array-input>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
<rb-icon-button icon="delete" mode="danger" class="space-below"
|
||||||
|
(click)="deleteConfirm(modalDeleteConfirm, user.name)">
|
||||||
|
Delete
|
||||||
|
</rb-icon-button>
|
||||||
|
<ng-template #modalDeleteConfirm>
|
||||||
|
<rb-alert alertTitle="Are you sure?" type="danger" okBtnLabel="Delete user" cancelBtnLabel="Cancel">
|
||||||
|
Do you really want to delete this user?
|
||||||
|
</rb-alert>
|
||||||
|
</ng-template>
|
||||||
<rb-icon-button icon="save" mode="primary" (click)="saveUser(user)"
|
<rb-icon-button icon="save" mode="primary" (click)="saveUser(user)"
|
||||||
[disabled]="nameInput.invalid || emailInput.invalid || locationInput.invalid">
|
[disabled]="nameInput.invalid || emailInput.invalid || locationInput.invalid">
|
||||||
Save
|
Save
|
||||||
|
@ -1,3 +1,12 @@
|
|||||||
::ng-deep td .error-messages {
|
::ng-deep td .error-messages {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
td:last-child rb-icon-button {
|
||||||
|
width: 100px;
|
||||||
|
float: left;
|
||||||
|
|
||||||
|
::ng-deep button {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -2,6 +2,7 @@ import { Component, OnInit } from '@angular/core';
|
|||||||
import {ApiService} from '../services/api.service';
|
import {ApiService} from '../services/api.service';
|
||||||
import {UserModel} from '../models/user.model';
|
import {UserModel} from '../models/user.model';
|
||||||
import {LoginService} from '../services/login.service';
|
import {LoginService} from '../services/login.service';
|
||||||
|
import {ModalService} from '@inst-iot/bosch-angular-ui-components';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@ -17,7 +18,8 @@ export class UsersComponent implements OnInit {
|
|||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private api: ApiService,
|
private api: ApiService,
|
||||||
public login: LoginService
|
public login: LoginService,
|
||||||
|
private modal: ModalService
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
@ -45,4 +47,14 @@ export class UsersComponent implements OnInit {
|
|||||||
this.newUser = this.newUser ? null : new UserModel();
|
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);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user