fixed new user model input and renaming model group
This commit is contained in:
parent
8fd993b362
commit
ea02ba0f09
@ -11,8 +11,8 @@
|
|||||||
https://definma-api.apps.de1.bosch-iot-cloud.com/api-doc/
|
https://definma-api.apps.de1.bosch-iot-cloud.com/api-doc/
|
||||||
</a><br>
|
</a><br>
|
||||||
Admin database management page:
|
Admin database management page:
|
||||||
<a href="https://definma-db.apps.de1.bosch-iot-cloud.com/api-doc/">
|
<a href="https://definma-db.apps.de1.bosch-iot-cloud.com/">
|
||||||
https://definma-db.apps.de1.bosch-iot-cloud.com/api-doc/
|
https://definma-db.apps.de1.bosch-iot-cloud.com/
|
||||||
</a><br>
|
</a><br>
|
||||||
Code repository UI
|
Code repository UI
|
||||||
<a href="https://sourcecode.socialcoding.bosch.com/users/vle2fe/repos/definma-ui">
|
<a href="https://sourcecode.socialcoding.bosch.com/users/vle2fe/repos/definma-ui">
|
||||||
@ -22,6 +22,10 @@
|
|||||||
<a href="https://sourcecode.socialcoding.bosch.com/users/vle2fe/repos/definma-api">
|
<a href="https://sourcecode.socialcoding.bosch.com/users/vle2fe/repos/definma-api">
|
||||||
https://sourcecode.socialcoding.bosch.com/users/vle2fe/repos/definma-api
|
https://sourcecode.socialcoding.bosch.com/users/vle2fe/repos/definma-api
|
||||||
</a><br>
|
</a><br>
|
||||||
|
Code repository Models
|
||||||
|
<a href="https://sourcecode.socialcoding.bosch.com/users/poe2rng/repos/definma-models">
|
||||||
|
https://sourcecode.socialcoding.bosch.com/users/poe2rng/repos/definma-models
|
||||||
|
</a><br>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
@ -30,11 +30,12 @@ Every time:
|
|||||||
<h6>Backup</h6>
|
<h6>Backup</h6>
|
||||||
<p>
|
<p>
|
||||||
For creating a database backup, you must follow the same steps from above (except the last one). Additionally you need
|
For creating a database backup, you must follow the same steps from above (except the last one). Additionally you need
|
||||||
the <a href="https://www.mongodb.com/try/download/community">MongoDB server</a> installed. Open the MongoDB bin folder
|
the <a href="https://docs.mongodb.com/database-tools/installation/#install-tools">mongodump</a> 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,
|
(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: <br><br>
|
adjust parameters and credentials as needed: <br><br>
|
||||||
mongodump.exe /port:1120 /db:"6ebe4c5d-0da3-4347-b484-66894dcf3f27" /username:"<:username>"
|
.\mongodump.exe /port:1120 /db:"6ebe4c5d-0da3-4347-b484-66894dcf3f27" /username:"<username>"
|
||||||
/password:"<:username>" /out:"C:\Path\to\backup\folder"<br><br>
|
/password:"<username>" /out:"C:\Path\to\backup\folder"<br><br>
|
||||||
Restoring the database from a backup is done with mongorestore.exe, more information can be found at the
|
Restoring the database from a backup is done with mongorestore.exe, more information can be found at the
|
||||||
<a href="https://docs.mongodb.com/database-tools/">documentation</a>. <br>
|
<a href="https://docs.mongodb.com/database-tools/">documentation</a>. <br>
|
||||||
The BIC service also creates internal backup, which can be requested to restore, see
|
The BIC service also creates internal backup, which can be requested to restore, see
|
||||||
|
@ -43,7 +43,7 @@ export class ModelTemplatesComponent implements OnInit {
|
|||||||
console.log(this.modelGroup);
|
console.log(this.modelGroup);
|
||||||
console.log(this.oldModelGroup);
|
console.log(this.oldModelGroup);
|
||||||
if (this.oldModelGroup !== '' && this.modelGroup !== this.oldModelGroup) { // group was changed, delete model in old group
|
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.api.post('/model/' + this.modelGroup, omit(this.model, '_id'), () => {
|
||||||
this.newModel = false;
|
this.newModel = false;
|
||||||
|
@ -25,6 +25,8 @@ export class UserModel extends BaseModel{
|
|||||||
if (mode === 'admin') {
|
if (mode === 'admin') {
|
||||||
keys.push('level');
|
keys.push('level');
|
||||||
keys.push('models');
|
keys.push('models');
|
||||||
|
this.devices = this.devices.filter(e => e);
|
||||||
|
this.models = this.models.filter(e => e);
|
||||||
}
|
}
|
||||||
return pick(this, keys);
|
return pick(this, keys);
|
||||||
}
|
}
|
||||||
|
@ -122,16 +122,22 @@ export class RbArrayInputComponent implements ControlValueAccessor, OnInit, Afte
|
|||||||
this.values = [this.values[0]];
|
this.values = [this.values[0]];
|
||||||
res = this.values;
|
res = this.values;
|
||||||
}
|
}
|
||||||
if (!res.length) {
|
// if (!res.length) {
|
||||||
res = [''];
|
// res = [''];
|
||||||
}
|
// }
|
||||||
this.onChange(res); // trigger ngModel with filled elements
|
this.onChange(res); // trigger ngModel with filled elements
|
||||||
}
|
}
|
||||||
|
|
||||||
writeValue(obj: any) { // add empty value on init
|
writeValue(obj: any) { // add empty value on init
|
||||||
|
console.log(obj);
|
||||||
if (obj) {
|
if (obj) {
|
||||||
if (this.pushTemplate !== null) {
|
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 {
|
else {
|
||||||
this.values = obj;
|
this.values = obj;
|
||||||
|
@ -41,7 +41,9 @@ export class UsersComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
saveUser(user: UserModel) {
|
saveUser(user: UserModel) {
|
||||||
|
console.log(user.models);
|
||||||
user.models = user.models.filter(e => e !== '');
|
user.models = user.models.filter(e => e !== '');
|
||||||
|
console.log(user.models);
|
||||||
this.api.put<UserModel>('/user/' + user.origName, user.sendFormat('admin'), data => {
|
this.api.put<UserModel>('/user/' + user.origName, user.sendFormat('admin'), data => {
|
||||||
user.deserialize(data);
|
user.deserialize(data);
|
||||||
user.edit = false;
|
user.edit = false;
|
||||||
@ -49,6 +51,7 @@ export class UsersComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
saveNewUser() {
|
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.api.post('/user/new', {...this.newUser.sendFormat('admin'), pass: this.newUserPass}, data => {
|
||||||
this.newUser = null;
|
this.newUser = null;
|
||||||
this.users.push(new UserModel().deserialize(data));
|
this.users.push(new UserModel().deserialize(data));
|
||||||
|
Loading…
Reference in New Issue
Block a user