added db field documentation
This commit is contained in:
parent
60be224c79
commit
74766e1ae6
@ -9,6 +9,7 @@ import {TemplatesComponent} from './templates/templates.component';
|
||||
import {SettingsComponent} from './settings/settings.component';
|
||||
import {UsersComponent} from './users/users.component';
|
||||
import {ChangelogComponent} from './changelog/changelog.component';
|
||||
import {DocumentationDatabaseComponent} from './documentation-database/documentation-database.component';
|
||||
|
||||
|
||||
const routes: Routes = [
|
||||
@ -22,6 +23,7 @@ const routes: Routes = [
|
||||
{path: 'users', component: UsersComponent, canActivate: [LoginService]},
|
||||
{path: 'settings', component: SettingsComponent, canActivate: [LoginService]},
|
||||
{path: 'documentation', component: DocumentationComponent},
|
||||
{path: 'documentation/database', component: DocumentationDatabaseComponent},
|
||||
|
||||
// if not authenticated
|
||||
{ path: '**', redirectTo: '' }
|
||||
|
@ -10,6 +10,13 @@
|
||||
<a routerLink="/documentation" routerLinkActive="active" rbLoadingLink>Documentation</a>
|
||||
</nav>
|
||||
|
||||
<ng-container *ngIf="isDocumentation">
|
||||
<nav *rbSubNavItems>
|
||||
<a routerLink="/documentation" routerLinkActive="active" [routerLinkActiveOptions]="{exact: true}">General</a>
|
||||
<a routerLink="/documentation/database" routerLinkActive="active">Database</a>
|
||||
</nav>
|
||||
</ng-container>
|
||||
|
||||
<ng-container *ngIf="login.isLoggedIn">
|
||||
<nav *rbActionNavItems>
|
||||
<a href="javascript:" [rbPopover]="userPopover" [anchor]="popoverAnchor">
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { Component, isDevMode} from '@angular/core';
|
||||
import {LoginService} from './services/login.service';
|
||||
import {Router} from '@angular/router';
|
||||
import {NavigationStart, Router} from '@angular/router';
|
||||
|
||||
// TODO: add multiple samples at once
|
||||
// TODO: validation: DPT: filename
|
||||
@ -19,15 +19,19 @@ import {Router} from '@angular/router';
|
||||
export class AppComponent {
|
||||
|
||||
bugReport = {do: '', work: ''};
|
||||
isDocumentation = false;
|
||||
devMode = false;
|
||||
|
||||
constructor(
|
||||
public login: LoginService,
|
||||
private router: Router
|
||||
public router: Router
|
||||
) {
|
||||
this.devMode = isDevMode();
|
||||
this.router.events.subscribe(event => {
|
||||
if (event instanceof NavigationStart) {
|
||||
this.isDocumentation = /\/documentation/.test(event.url);
|
||||
}
|
||||
|
||||
get devMode() {
|
||||
return isDevMode();
|
||||
});
|
||||
}
|
||||
|
||||
logout() {
|
||||
|
@ -26,6 +26,7 @@ import { ParametersPipe } from './parameters.pipe';
|
||||
import { SettingsComponent } from './settings/settings.component';
|
||||
import { UsersComponent } from './users/users.component';
|
||||
import { ChangelogComponent } from './changelog/changelog.component';
|
||||
import { DocumentationDatabaseComponent } from './documentation-database/documentation-database.component';
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
@ -44,7 +45,8 @@ import { ChangelogComponent } from './changelog/changelog.component';
|
||||
ParametersPipe,
|
||||
SettingsComponent,
|
||||
UsersComponent,
|
||||
ChangelogComponent
|
||||
ChangelogComponent,
|
||||
DocumentationDatabaseComponent
|
||||
],
|
||||
imports: [
|
||||
LocalStorageModule.forRoot({
|
||||
|
@ -0,0 +1,303 @@
|
||||
<h2>Database</h2>
|
||||
|
||||
<p class="space-below">
|
||||
Structure of the MongoDB instance running on the BIC, storing all application data.
|
||||
</p>
|
||||
|
||||
<h4>Database model</h4>
|
||||
|
||||
<app-img-magnifier src="assets/imgs/db_structure_latest.svg" zoom="2" [magnifierSize]="{width: 400, height: 300}"
|
||||
id="db-structure"></app-img-magnifier>
|
||||
|
||||
<h4>Field reference</h4>
|
||||
|
||||
<rb-table class="field-reference">
|
||||
<tr><th>samples</th><th></th><th>Example</th></tr>
|
||||
<tr>
|
||||
<td>_id</td>
|
||||
<td>Automatically generated unique id</td>
|
||||
<td>'5f2e63c98d1c020f8cda6e06'</td>
|
||||
</tr>
|
||||
<!-- TODO: new names-->
|
||||
<tr>
|
||||
<td>type</td>
|
||||
<td>
|
||||
The material status of the sample, can be either <span class="name">granulate</span>, <span class="name">part
|
||||
</span> or <span class="name">tension rod</span>.
|
||||
</td>
|
||||
<td>'granulate'</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>number</td>
|
||||
<td>The sample number, generated by the server for new samples</td>
|
||||
<td>'An31'</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>color</td>
|
||||
<td>Sample color</td>
|
||||
<td>'black'</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>batch</td>
|
||||
<td>Batch number the sample was from</td>
|
||||
<td>'2264486614'</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>status</td>
|
||||
<td>Status of the document, can be either <span class="name">new</span>, <span class="name">validated</span> or
|
||||
<span class="name">deleted</span>.</td>
|
||||
<td>'new'</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>condition</td>
|
||||
<td>sample condition with <span class="name">condition_template</span> reference and all fields defined by the
|
||||
template</td>
|
||||
<td>{{'{'}}condition_template: '5f3151b5b8a886007d2de9ed', time in minutes: 30{{'}'}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>material_id</td>
|
||||
<td>Reference to the sample material</td>
|
||||
<td>'5f2e63118d1c020f8cda6a0a'</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>note_id</td>
|
||||
<td>Reference to the sample note</td>
|
||||
<td>'5f2e63c98d1c020f8cda6e08'</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>user_id</td>
|
||||
<td>Reference to the user who created the sample</td>
|
||||
<td>'5f294dd4aa9ea5085c7d7315'</td>
|
||||
</tr>
|
||||
|
||||
<tr><th>notes</th><th></th><th></th></tr>
|
||||
<tr>
|
||||
<td>_id</td>
|
||||
<td>Automatically generated unique id</td>
|
||||
<td>'5f2e63e98d1c020f8cda70cc'</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>comment</td>
|
||||
<td>General remarks</td>
|
||||
<td>'stabilized'</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>sample_references</td>
|
||||
<td>Array of references to other samples, each reference containing the referenced <span class="name">sample_id
|
||||
</span> as well as a <span class="name">relation</span> field describing the relationship</td>
|
||||
<td>{{'{'}}sample_id: '5f2e63d68d1c020f8cda701c', relation: 'belongs to'{{'}'}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>custom_fields</td>
|
||||
<td>Additional information as key value pairs for the sample, making it easier to process this information</td>
|
||||
<td>{{'{'}}vwz: '0 min'{{'}'}}</td>
|
||||
</tr>
|
||||
|
||||
<tr><th>note_fields</th><th></th><th></th></tr>
|
||||
<tr>
|
||||
<td>_id</td>
|
||||
<td>Automatically generated unique id</td>
|
||||
<td>'5f2e63e98d1c020f8cda70ce'</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>name</td>
|
||||
<td>name of the <span class="name">custom_fields</span> key</td>
|
||||
<td>'test series'</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>qty</td>
|
||||
<td>number of notes with this key</td>
|
||||
<td>24</td>
|
||||
</tr>
|
||||
|
||||
<tr><th>materials</th><th></th><th></th></tr>
|
||||
<tr>
|
||||
<td>_id</td>
|
||||
<td>Automatically generated unique id</td>
|
||||
<td>'5f2e63e98d1c020f8cda70d0'</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>name</td>
|
||||
<td></td>
|
||||
<td>'Ultradur B4300 G6'</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>numbers</td>
|
||||
<td>Trade name of the material</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>properties</td>
|
||||
<td>material class specific properties with <span class="name">material_template</span> reference and all fields
|
||||
defined by the template</td>
|
||||
<td>{{'{'}}material_template: '5f2e89874ac96c007fb06e83', mineral: 0, glass_fiber: 30, carbon_fiber: 0{{'}'}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>group_id</td>
|
||||
<td>Reference to the material group</td>
|
||||
<td>'5f2e631191c5d68f8a0708c4'</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>supplier_id</td>
|
||||
<td>Reference to the material supplier</td>
|
||||
<td>'5f2e631191c5d68f8a0708c7'</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>status</td>
|
||||
<td>Status of the document, can be either <span class="name">new</span>, <span class="name">validated</span> or
|
||||
<span class="name">deleted</span>.</td>
|
||||
<td>'new'</td>
|
||||
</tr>
|
||||
|
||||
<tr><th>measurements</th><th></th><th></th></tr>
|
||||
<tr>
|
||||
<td>_id</td>
|
||||
<td>Automatically generated unique id</td>
|
||||
<td>'5f294d25aa9ea5085c7d7305'</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>sample_id</td>
|
||||
<td>Reference to the sample this measurement belongs to</td>
|
||||
<td>'5f2e63c98d1c020f8cda6e06'</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>measurement_template</td>
|
||||
<td>Reference to the Template defining the structure of the measurement values</td>
|
||||
<td>'5f294d25aa9ea5085c7d7305'</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>values</td>
|
||||
<td>Measurement values in defined format</td>
|
||||
<td>{{'{'}}vn: 100.4{{'}'}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>status</td>
|
||||
<td>Status of the document, can be either <span class="name">new</span>, <span class="name">validated</span> or
|
||||
<span class="name">deleted</span>.</td>
|
||||
<td>'new'</td>
|
||||
</tr>
|
||||
|
||||
<tr><th><collection>_templates</th><th></th><th></th></tr>
|
||||
<tr>
|
||||
<td>_id</td>
|
||||
<td>Automatically generated unique id</td>
|
||||
<td>'5f2e63ee8d1c020f8cda7128'</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>name</td>
|
||||
<td>Display name of the template</td>
|
||||
<td>'spectrum'</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>version</td>
|
||||
<td>Version number of the template</td>
|
||||
<td>2</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>first_id</td>
|
||||
<td>Reference to the first instance of this template with <span class="name">version</span> number 1</td>
|
||||
<td>'5f2e89bb4ac96c007fb06e86'</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>parameters</td>
|
||||
<td>Specified parameters of this template. The <span class="name">name</span> property is used as the key in the
|
||||
document using this template, the range can have the following properties: <span class="name">min</span> specifies
|
||||
the minimum numeric value, <span class="name">max</span> specifies the maximum numeric value, <span class="name">
|
||||
values</span> specifies an array of allowed values of this parameter and <span class="name">type: 'array'</span>
|
||||
specifies that this parameter must be an array</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
|
||||
<tr><th>users</th><th></th><th></th></tr>
|
||||
<tr>
|
||||
<td>_id</td>
|
||||
<td>Automatically generated unique id</td>
|
||||
<td>'5f2e63cc8d1c020f8cda6e6a'</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>name</td>
|
||||
<td>The username</td>
|
||||
<td>'admin'</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>email</td>
|
||||
<td>The user's email address used for password reset</td>
|
||||
<td>'test@bosch.com'</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>location</td>
|
||||
<td>The abbreviation of the Bosch site of the user</td>
|
||||
<td>'Rng'</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>level</td>
|
||||
<td>The permission level, can be either <span class="name">read</span>, <span class="name">write</span>,
|
||||
<span class="name">dev</span> or <span class="name">admin</span>. The exact level permissions can be found at the
|
||||
<a routerLink="/documentation">general documentation</a></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>devices</td>
|
||||
<td>Array of all spectrum measurement devices the user has access to</td>
|
||||
<td>['Rng01', 'Rng02']</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>pass</td>
|
||||
<td>The user's password in hashed form using bcrypt</td>
|
||||
<td>'$2a$10$m8DqvZR3plZEv8EPwPo7Luvyrm/ZQDiPzfBh6bpU/1XFWOGONkJyG'</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>key</td>
|
||||
<td>The API key, generated when the user is created</td>
|
||||
<td>'5f294dd4aa9ea5085c7d7314'</td>
|
||||
</tr>
|
||||
|
||||
<tr><th>models</th><th></th><th></th></tr>
|
||||
<tr>
|
||||
<td>_id</td>
|
||||
<td>Automatically generated unique id</td>
|
||||
<td>'5f294d47aa9ea5085c7d7308'</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>name</td>
|
||||
<td>The name of the model</td>
|
||||
<td>'humidity-1'</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>data</td>
|
||||
<td>The Python model data in binary format</td>
|
||||
<td><binary data></td>
|
||||
</tr>
|
||||
|
||||
<tr><th>changelogs</th><th></th><th></th></tr>
|
||||
<tr>
|
||||
<td>_id</td>
|
||||
<td>Automatically generated unique id</td>
|
||||
<td>'5f2e63cc8d1c020f8cda6e6e'</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>action</td>
|
||||
<td>The URL which invoked the database write access</td>
|
||||
<td>'POST /material/new'</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>collection_name</td>
|
||||
<td>Collection that was written to</td>
|
||||
<td>'material_groups'</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>conditions</td>
|
||||
<td>Condition arguments used when accessing the database</td>
|
||||
<td>{{'{'}}id: '5f2e63118d1c020f8cda6a0a'{{'}'}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>data</td>
|
||||
<td>data which was written to the database</td>
|
||||
<td>{{'{'}}name: 'PBT'{{'}'}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>user_id</td>
|
||||
<td>The user that executed this command</td>
|
||||
<td>'5f2e63118d1c020f8cda6a09'</td>
|
||||
</tr>
|
||||
</rb-table>
|
@ -0,0 +1,13 @@
|
||||
.field-reference td {
|
||||
white-space: normal;
|
||||
text-overflow: initial;
|
||||
max-width: none;
|
||||
|
||||
&:nth-child(3) {
|
||||
font-family: boschmono, monospace;
|
||||
}
|
||||
}
|
||||
|
||||
span.name {
|
||||
font-style: italic;
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { DocumentationDatabaseComponent } from './documentation-database.component';
|
||||
|
||||
describe('DocumentationDatabaseComponent', () => {
|
||||
let component: DocumentationDatabaseComponent;
|
||||
let fixture: ComponentFixture<DocumentationDatabaseComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ DocumentationDatabaseComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(DocumentationDatabaseComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
@ -0,0 +1,15 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-documentation-database',
|
||||
templateUrl: './documentation-database.component.html',
|
||||
styleUrls: ['./documentation-database.component.scss']
|
||||
})
|
||||
export class DocumentationDatabaseComponent implements OnInit {
|
||||
|
||||
constructor() { }
|
||||
|
||||
ngOnInit(): void {
|
||||
}
|
||||
|
||||
}
|
@ -77,7 +77,4 @@
|
||||
</tr>
|
||||
</rb-table>
|
||||
|
||||
<h4>Database model</h4>
|
||||
|
||||
<app-img-magnifier src="assets/imgs/db_structure_latest.svg" zoom="2" [magnifierSize]="{width: 400, height: 300}"
|
||||
id="db-structure"></app-img-magnifier>
|
||||
|
BIN
src/assets/fonts/BoschMono.ttf
Normal file
BIN
src/assets/fonts/BoschMono.ttf
Normal file
Binary file not shown.
File diff suppressed because one or more lines are too long
Before Width: | Height: | Size: 129 KiB After Width: | Height: | Size: 129 KiB |
@ -2,6 +2,11 @@ $font-path: "../node_modules/@inst-iot/bosch-angular-ui-components/assets/";
|
||||
$rb-extended-breakpoints: false; // whether to use extended breakpoints xxl and xxxl
|
||||
@import "~@inst-iot/bosch-angular-ui-components/styles/global.scss";
|
||||
|
||||
@font-face{
|
||||
font-family: 'boschmono';
|
||||
src: url(/assets/fonts/BoschMono.ttf);
|
||||
}
|
||||
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
|
Loading…
Reference in New Issue
Block a user