Merge pull request #36 in ~VLE2FE/definma-ui from development to master
* commit '1460b5c1e65dead975954ed0b384a395e8c3af45': string validation fix for true and false small fixes
This commit is contained in:
		@@ -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)}
 | 
			
		||||
 
 | 
			
		||||
@@ -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']);
 | 
			
		||||
    });
 | 
			
		||||
  }
 | 
			
		||||
 
 | 
			
		||||
@@ -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) {
 | 
			
		||||
 
 | 
			
		||||
@@ -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] === '');
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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();
 | 
			
		||||
 
 | 
			
		||||
@@ -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<TemplateModel>(`/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.api.post<TemplateModel>(`/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();
 | 
			
		||||
          this.d.idReload(this.collection + 'Templates');
 | 
			
		||||
          });
 | 
			
		||||
        });
 | 
			
		||||
      }
 | 
			
		||||
      else {
 | 
			
		||||
        this.api.put<TemplateModel>(`/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.api.put<TemplateModel>(`/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();
 | 
			
		||||
          this.d.idReload(this.collection + 'Templates');
 | 
			
		||||
          });
 | 
			
		||||
        });
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
 | 
			
		||||
<rb-icon-button icon="add" mode="primary" (click)="addNewUser()">New user</rb-icon-button>
 | 
			
		||||
<rb-icon-button icon="add" mode="primary" (click)="addNewUser()" class="space-below">New user</rb-icon-button>
 | 
			
		||||
 | 
			
		||||
<form *ngIf="newUser" #userForm="ngForm">
 | 
			
		||||
<form *ngIf="newUser" #userForm="ngForm" class="space-below">
 | 
			
		||||
  <rb-form-input name="name" label="user name" appValidate="username" required [(ngModel)]="newUser.name"
 | 
			
		||||
                 #nameInput="ngModel">
 | 
			
		||||
    <ng-template rbFormValidationMessage="failure">{{nameInput.errors.failure}}</ng-template>
 | 
			
		||||
 
 | 
			
		||||
@@ -10,3 +10,7 @@ td:last-child rb-icon-button {
 | 
			
		||||
    width: 100%;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
rb-form-select {
 | 
			
		||||
  min-width: 150px;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user