From 78093ce2fff968ede231e8a6acd08920530e92f7 Mon Sep 17 00:00:00 2001 From: VLE2FE Date: Wed, 2 Sep 2020 14:11:00 +0200 Subject: [PATCH 1/2] small fixes --- src/app/app.component.ts | 3 ++- src/app/material/material.component.ts | 2 ++ .../rb-array-input.component.ts | 7 +++--- src/app/samples/samples.component.ts | 1 + src/app/templates/templates.component.ts | 25 +++++++++---------- src/app/users/users.component.html | 4 +-- src/app/users/users.component.scss | 4 +++ 7 files changed, 26 insertions(+), 20 deletions(-) diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 538305f..25d053b 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -53,7 +53,8 @@ export class AppComponent implements OnInit{ } bugReportContent() { - return `mailto:lukas.veit@de.bosch.com?subject=Bug report&body=Thanks for sending the report! Your bug will be (hopefully) fixed soon. + return `mailto:${this.d.contact.mail}?subject=Bug report&body=Thanks for sending the report! Your bug will be +(hopefully) fixed soon. %0D%0A%0D%0A--- REPORT DATA --- %0D%0A%0D%0ATime: ${new Date().toString()}%0D%0A URL: ${this.window.location}%0D%0A%0D%0AWhat did you do?%0D%0A${encodeURIComponent(this.bugReport.do)} diff --git a/src/app/material/material.component.ts b/src/app/material/material.component.ts index 586ff28..c9a4342 100644 --- a/src/app/material/material.component.ts +++ b/src/app/material/material.component.ts @@ -97,6 +97,8 @@ export class MaterialComponent implements OnInit, AfterContentChecked { materialSave() { this.api.put('/material/' + this.material._id, this.material.sendFormat(), () => { + delete this.d.arr.materials; + this.d.load('materials'); this.router.navigate(['/materials']); }); } diff --git a/src/app/rb-custom-inputs/rb-array-input/rb-array-input.component.ts b/src/app/rb-custom-inputs/rb-array-input/rb-array-input.component.ts index 4e48ee0..90c79b7 100644 --- a/src/app/rb-custom-inputs/rb-array-input/rb-array-input.component.ts +++ b/src/app/rb-custom-inputs/rb-array-input/rb-array-input.component.ts @@ -122,14 +122,13 @@ export class RbArrayInputComponent implements ControlValueAccessor, OnInit, Afte this.values = [this.values[0]]; res = this.values; } - // if (!res.length) { - // res = ['']; - // } + if (!res.length) { + res = ['']; + } this.onChange(res); // trigger ngModel with filled elements } writeValue(obj: any) { // add empty value on init - console.log(obj); if (obj) { if (this.pushTemplate !== null) { if (this.pushPath) { diff --git a/src/app/samples/samples.component.ts b/src/app/samples/samples.component.ts index 1569347..331d0b8 100644 --- a/src/app/samples/samples.component.ts +++ b/src/app/samples/samples.component.ts @@ -339,6 +339,7 @@ export class SamplesComponent implements OnInit { updateFilterFields(field) { const filter = this.filters.filters.find(e => e.field === field); + console.log(filter); filter.active = !(filter.values.length === 1 && filter.values[0] === ''); } diff --git a/src/app/templates/templates.component.ts b/src/app/templates/templates.component.ts index 5782be6..fa56f36 100644 --- a/src/app/templates/templates.component.ts +++ b/src/app/templates/templates.component.ts @@ -93,24 +93,23 @@ export class TemplatesComponent implements OnInit { } }); if (valid) { - console.log('valid', template); const sendData = {name: template.name, parameters: template.parameters.map(e => omit(e, ['rangeString']))}; if (first_id === 'null') { - this.api.post(`/template/${this.collection}/new`, sendData, data => { - if (data.version > template.version) { // there were actual changes and a new version was created - this.templates.push(data); - } - this.templateFormat(); - this.d.idReload(this.collection + 'Templates'); + this.api.post(`/template/${this.collection}/new`, sendData, () => { + delete this.d.arr[this.collection + 'Templates']; + this.d.load(this.collection + 'Templates', () => { + this.templates = this.d.arr[this.collection + 'Templates']; + this.templateFormat(); + }); }); } else { - this.api.put(`/template/${this.collection}/${template.first_id}`, sendData, data => { - if (data.version > template.version) { // there were actual changes and a new version was created - this.templates.push(data); - } - this.templateFormat(); - this.d.idReload(this.collection + 'Templates'); + this.api.put(`/template/${this.collection}/${template.first_id}`, sendData, () => { + delete this.d.arr[this.collection + 'Templates']; + this.d.load(this.collection + 'Templates', () => { + this.templates = this.d.arr[this.collection + 'Templates']; + this.templateFormat(); + }); }); } } diff --git a/src/app/users/users.component.html b/src/app/users/users.component.html index 6c297ec..9c095e2 100644 --- a/src/app/users/users.component.html +++ b/src/app/users/users.component.html @@ -1,7 +1,7 @@ -New user +New user -
+ {{nameInput.errors.failure}} diff --git a/src/app/users/users.component.scss b/src/app/users/users.component.scss index 37893f7..6a6e5b8 100644 --- a/src/app/users/users.component.scss +++ b/src/app/users/users.component.scss @@ -10,3 +10,7 @@ td:last-child rb-icon-button { width: 100%; } } + +rb-form-select { + min-width: 150px; +} From 1460b5c1e65dead975954ed0b384a395e8c3af45 Mon Sep 17 00:00:00 2001 From: VLE2FE Date: Wed, 2 Sep 2020 15:06:30 +0200 Subject: [PATCH 2/2] string validation fix for true and false --- src/app/services/validation.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/services/validation.service.ts b/src/app/services/validation.service.ts index bcefafa..3031ea8 100644 --- a/src/app/services/validation.service.ts +++ b/src/app/services/validation.service.ts @@ -50,7 +50,7 @@ export class ValidationService { } string(data, option = null) { - let validator = Joi.string().max(128).allow(''); + let validator = Joi.string().max(128).allow('', true, false); let errorMsg = 'must contain max 128 characters'; if (option === 'alphanum') { validator = validator.alphanum();