diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 5bcbf68..3c3ebdd 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -15,6 +15,7 @@ import {ModelTemplatesComponent} from './model-templates/model-templates.compone import {DocumentationArchitectureComponent} from './documentation/documentation-architecture/documentation-architecture.component'; import {MaterialsComponent} from './materials/materials.component'; import {MaterialComponent} from './material/material.component'; +import {DocumentationModelsComponent} from './documentation/documentation-models/documentation-models.component'; const routes: Routes = [ @@ -34,6 +35,7 @@ const routes: Routes = [ {path: 'documentation', component: DocumentationComponent}, {path: 'documentation/architecture', component: DocumentationArchitectureComponent}, {path: 'documentation/database', component: DocumentationDatabaseComponent}, + {path: 'documentation/models', component: DocumentationModelsComponent}, // if not authenticated { path: '**', redirectTo: '' } diff --git a/src/app/app.component.html b/src/app/app.component.html index 75d8741..3310240 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -18,6 +18,7 @@ General Architecture Database + Models diff --git a/src/app/app.module.ts b/src/app/app.module.ts index a2441d2..2d04295 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -34,6 +34,7 @@ import { SizePipe } from './size.pipe'; import { DocumentationArchitectureComponent } from './documentation/documentation-architecture/documentation-architecture.component'; import { MaterialsComponent } from './materials/materials.component'; import { MaterialComponent } from './material/material.component'; +import { DocumentationModelsComponent } from './documentation/documentation-models/documentation-models.component'; @NgModule({ declarations: [ @@ -60,7 +61,8 @@ import { MaterialComponent } from './material/material.component'; SizePipe, DocumentationArchitectureComponent, MaterialsComponent, - MaterialComponent + MaterialComponent, + DocumentationModelsComponent ], imports: [ LocalStorageModule.forRoot({ diff --git a/src/app/changelog/changelog.component.html b/src/app/changelog/changelog.component.html index 8954f31..e237f9a 100644 --- a/src/app/changelog/changelog.component.html +++ b/src/app/changelog/changelog.component.html @@ -1,4 +1,3 @@ -

Changelog

Architecture architecture @@ -12,8 +11,8 @@ https://definma-api.apps.de1.bosch-iot-cloud.com/api-doc/
Admin database management page: - - https://definma-db.apps.de1.bosch-iot-cloud.com/api-doc/ + + https://definma-db.apps.de1.bosch-iot-cloud.com/
Code repository UI @@ -23,6 +22,10 @@ https://sourcecode.socialcoding.bosch.com/users/vle2fe/repos/definma-api
+ Code repository Models + + https://sourcecode.socialcoding.bosch.com/users/poe2rng/repos/definma-models +

diff --git a/src/app/documentation/documentation-database/documentation-database.component.html b/src/app/documentation/documentation-database/documentation-database.component.html index 0f324f9..e2ede6d 100644 --- a/src/app/documentation/documentation-database/documentation-database.component.html +++ b/src/app/documentation/documentation-database/documentation-database.component.html @@ -1,4 +1,3 @@ -

Database

The used database instance is a MongoDB instance running on the BIC, storing all application data. The admin database @@ -31,11 +30,12 @@ Every time:

Backup

For creating a database backup, you must follow the same steps from above (except the last one). Additionally you need - the MongoDB server installed. Open the MongoDB bin folder + the mongodump installed. + Open the MongoDB bin folder (normally at C:\Program Files\MongoDB\Server\4.2\bin) in a PowerShell and execute following command for backup, adjust parameters and credentials as needed:

- mongodump.exe /port:1120 /db:"6ebe4c5d-0da3-4347-b484-66894dcf3f27" /username:"<:username>" - /password:"<:username>" /out:"C:\Path\to\backup\folder"

+ .\mongodump.exe /port:1120 /db:"6ebe4c5d-0da3-4347-b484-66894dcf3f27" /username:"<username>" + /password:"<username>" /out:"C:\Path\to\backup\folder"

Restoring the database from a backup is done with mongorestore.exe, more information can be found at the documentation.
The BIC service also creates internal backup, which can be requested to restore, see diff --git a/src/app/documentation/documentation-models/documentation-models.component.html b/src/app/documentation/documentation-models/documentation-models.component.html new file mode 100644 index 0000000..45f211d --- /dev/null +++ b/src/app/documentation/documentation-models/documentation-models.component.html @@ -0,0 +1,56 @@ +

Model file upload

+ +

+ Model files have to be saved as a .pkl file in 80_Modelle_BIC.
+ For upload the upload script has to be opened (can be in every environment). The name of the model file has to be + entered wih the .pkl ending in the first command and without .pkl in the second. +

+ +

Adding new model scripts

+ +

+ Open Spyder in the base environment and open the model.py within. +

+ + + +

Testing locally

+ +

+ To test the model Python script locally, you need to execute it in the base environment, in which all necessary + packages have to be installed. Note that Spyder also has to be opened in the base environment. +

+ + + +

Model script upload

+ +In the Windows Powershell: + + + +

+ After upload the new model details have to be entered in the UI. +

+ + diff --git a/src/app/documentation/documentation-models/documentation-models.component.scss b/src/app/documentation/documentation-models/documentation-models.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/documentation/documentation-models/documentation-models.component.spec.ts b/src/app/documentation/documentation-models/documentation-models.component.spec.ts new file mode 100644 index 0000000..d1adf71 --- /dev/null +++ b/src/app/documentation/documentation-models/documentation-models.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { DocumentationModelsComponent } from './documentation-models.component'; + +describe('DocumentationModelsComponent', () => { + let component: DocumentationModelsComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ DocumentationModelsComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(DocumentationModelsComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/documentation/documentation-models/documentation-models.component.ts b/src/app/documentation/documentation-models/documentation-models.component.ts new file mode 100644 index 0000000..b7f7b30 --- /dev/null +++ b/src/app/documentation/documentation-models/documentation-models.component.ts @@ -0,0 +1,15 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-documentation-models', + templateUrl: './documentation-models.component.html', + styleUrls: ['./documentation-models.component.scss'] +}) +export class DocumentationModelsComponent implements OnInit { + + constructor() { } + + ngOnInit(): void { + } + +} diff --git a/src/app/documentation/documentation.component.html b/src/app/documentation/documentation.component.html index 0596bb3..1eb1257 100644 --- a/src/app/documentation/documentation.component.html +++ b/src/app/documentation/documentation.component.html @@ -1,4 +1,3 @@ -

Documentation

diff --git a/src/app/material/material.component.html b/src/app/material/material.component.html index 9c195ff..6338780 100644 --- a/src/app/material/material.component.html +++ b/src/app/material/material.component.html @@ -1,7 +1,7 @@ -

Edit material

+

{{material.name | exists}}

- {{materialnameInput.errors.failure}} diff --git a/src/app/materials/materials.component.html b/src/app/materials/materials.component.html index d4ee65e..0aa854f 100644 --- a/src/app/materials/materials.component.html +++ b/src/app/materials/materials.component.html @@ -1,5 +1,4 @@
-

Materials

+ + @@ -41,7 +45,8 @@ Numbers - + diff --git a/src/app/materials/materials.component.scss b/src/app/materials/materials.component.scss index 021af3b..ceec451 100644 --- a/src/app/materials/materials.component.scss +++ b/src/app/materials/materials.component.scss @@ -40,8 +40,6 @@ } .header-addnew { - margin-bottom: 40px; - & > * { display: inline; margin-bottom: 10px; @@ -51,3 +49,15 @@ float: right; } } + +.material-search { + width: 300px; + float: left; + position: relative; + + span { + position: absolute; + right: 5px; + top: 24px; + } +} diff --git a/src/app/materials/materials.component.ts b/src/app/materials/materials.component.ts index c6e692b..c7a331a 100644 --- a/src/app/materials/materials.component.ts +++ b/src/app/materials/materials.component.ts @@ -15,6 +15,7 @@ export class MaterialsComponent implements OnInit { materials: MaterialModel[] = []; templateKeys: {key: string, label: string}[] = []; materialStatus = {validated: true, new: true, deleted: false}; + materialSearch = ''; sampleSelect = false; page = 1; @@ -89,4 +90,8 @@ export class MaterialsComponent implements OnInit { return string[0].toUpperCase() + string.slice(1); } + materialFilter(ms) { + return e => e.name.indexOf(ms) >= 0; + } + } diff --git a/src/app/model-templates/model-templates.component.html b/src/app/model-templates/model-templates.component.html index 6fb2fac..fd62fcf 100644 --- a/src/app/model-templates/model-templates.component.html +++ b/src/app/model-templates/model-templates.component.html @@ -1,4 +1,3 @@ -

Models

New model diff --git a/src/app/model-templates/model-templates.component.ts b/src/app/model-templates/model-templates.component.ts index 17e2fdb..849592d 100644 --- a/src/app/model-templates/model-templates.component.ts +++ b/src/app/model-templates/model-templates.component.ts @@ -43,7 +43,7 @@ export class ModelTemplatesComponent implements OnInit { console.log(this.modelGroup); console.log(this.oldModelGroup); if (this.oldModelGroup !== '' && this.modelGroup !== this.oldModelGroup) { // group was changed, delete model in old group - this.delete(null, this.oldModelGroup, this.oldModelName); + this.delete(null, this.oldModelName, this.oldModelGroup); } this.api.post('/model/' + this.modelGroup, omit(this.model, '_id'), () => { this.newModel = false; diff --git a/src/app/models/user.model.ts b/src/app/models/user.model.ts index d98e40d..172008d 100644 --- a/src/app/models/user.model.ts +++ b/src/app/models/user.model.ts @@ -25,6 +25,8 @@ export class UserModel extends BaseModel{ if (mode === 'admin') { keys.push('level'); keys.push('models'); + this.devices = this.devices.filter(e => e); + this.models = this.models.filter(e => e); } return pick(this, keys); } diff --git a/src/app/prediction/prediction.component.html b/src/app/prediction/prediction.component.html index b8bd37b..b503af5 100644 --- a/src/app/prediction/prediction.component.html +++ b/src/app/prediction/prediction.component.html @@ -1,4 +1,3 @@ -

Prediction

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 e27d579..4e48ee0 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,16 +122,22 @@ 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) { - this.values = [...obj.filter(e => e[this.pushPath] !== ''), cloneDeep(this.pushTemplate)]; + if (this.pushPath) { + this.values = [...obj.filter(e => e[this.pushPath] !== ''), cloneDeep(this.pushTemplate)]; + } + else { + this.values = [...obj.filter(e => e !== ''), cloneDeep(this.pushTemplate)]; + } } else { this.values = obj; diff --git a/src/app/sample/sample.component.html b/src/app/sample/sample.component.html index 119f1f2..3f25923 100644 --- a/src/app/sample/sample.component.html +++ b/src/app/sample/sample.component.html @@ -9,7 +9,7 @@
- -

Samples

New sample diff --git a/src/app/samples/samples.component.scss b/src/app/samples/samples.component.scss index 2505628..8f7e06d 100644 --- a/src/app/samples/samples.component.scss +++ b/src/app/samples/samples.component.scss @@ -2,6 +2,7 @@ .header-addnew { margin-bottom: 40px; + height: 42px; & > * { display: inline; diff --git a/src/app/samples/samples.component.ts b/src/app/samples/samples.component.ts index 4cdf0f3..1569347 100644 --- a/src/app/samples/samples.component.ts +++ b/src/app/samples/samples.component.ts @@ -13,7 +13,6 @@ import {Router} from '@angular/router'; // TODO: turn off sort field // TODO reset sort when field is excluded -// TODO: material name to product // TODO: Eh DPT // TODO: filter button // TODO: check if connect-src to model works @@ -55,7 +54,7 @@ export class SamplesComponent implements OnInit { sort: 'added-asc', filters: [ {field: 'number', label: 'Number', active: false, autocomplete: [], mode: 'eq', values: ['']}, - {field: 'material.name', label: 'Material name', active: false, autocomplete: [], mode: 'eq', values: ['']}, + {field: 'material.name', label: 'Product name', active: false, autocomplete: [], mode: 'eq', values: ['']}, {field: 'material.supplier', label: 'Supplier', active: false, autocomplete: [], mode: 'eq', values: ['']}, {field: 'material.group', label: 'Material', active: false, autocomplete: [], mode: 'eq', values: ['']}, {field: 'material.glass_fiber', label: 'GF', active: false, autocomplete: [], mode: 'eq', values: ['']}, @@ -74,7 +73,7 @@ export class SamplesComponent implements OnInit { keys: KeyInterface[] = [ {id: 'number', label: 'Number', active: true, sortable: true}, {id: 'material.numbers', label: 'Material numbers', active: false, sortable: false}, - {id: 'material.name', label: 'Material name', active: true, sortable: true}, + {id: 'material.name', label: 'Product name', active: true, sortable: true}, {id: 'material.supplier', label: 'Supplier', active: false, sortable: true}, {id: 'material.group', label: 'Material', active: true, sortable: true}, {id: 'type', label: 'Type', active: true, sortable: true}, diff --git a/src/app/settings/settings.component.html b/src/app/settings/settings.component.html index 2b5b9b4..4c3ae5e 100644 --- a/src/app/settings/settings.component.html +++ b/src/app/settings/settings.component.html @@ -1,4 +1,3 @@ -

Settings

Templates diff --git a/src/app/users/users.component.html b/src/app/users/users.component.html index 16c5fb9..6c297ec 100644 --- a/src/app/users/users.component.html +++ b/src/app/users/users.component.html @@ -1,4 +1,3 @@ -

Users

New user diff --git a/src/app/users/users.component.ts b/src/app/users/users.component.ts index fad50dd..7ae4c85 100644 --- a/src/app/users/users.component.ts +++ b/src/app/users/users.component.ts @@ -41,6 +41,9 @@ export class UsersComponent implements OnInit { } saveUser(user: UserModel) { + console.log(user.models); + user.models = user.models.filter(e => e !== ''); + console.log(user.models); this.api.put('/user/' + user.origName, user.sendFormat('admin'), data => { user.deserialize(data); user.edit = false; @@ -48,6 +51,7 @@ export class UsersComponent implements OnInit { } saveNewUser() { + // this.newUser.models = this.newUser.models.filter(e => e !== '' || e !== undefined); this.api.post('/user/new', {...this.newUser.sendFormat('admin'), pass: this.newUserPass}, data => { this.newUser = null; this.users.push(new UserModel().deserialize(data)); diff --git a/src/styles.scss b/src/styles.scss index b3fd216..b57aeff 100644 --- a/src/styles.scss +++ b/src/styles.scss @@ -69,3 +69,7 @@ ul { } } } + +.nav-main a.active { + font-weight: bold; +}