blob: 11ee377cd20c76bb621a02d5bca1d1c2bba9c1bb (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
import { observable } from 'mobx';
import { KEEP_WS_LOADED_USID } from '../../../config';
export default class Workspace {
id = null;
@observable name = null;
@observable order = null;
@observable services = [];
@observable userId = null;
constructor(data) {
if (!data.id) {
throw Error('Workspace requires Id');
}
this.id = data.id;
this.name = data.name;
this.order = data.order;
let { services } = data;
if (data.saving && data.keepLoaded) {
// Keep workspaces loaded
services.push(KEEP_WS_LOADED_USID);
} else if (data.saving && data.services.includes(KEEP_WS_LOADED_USID)) {
// Don't keep loaded
services = services.filter((e) => e !== KEEP_WS_LOADED_USID);
}
this.services.replace(services);
this.userId = data.userId;
}
}
|