aboutsummaryrefslogtreecommitdiffstats
path: root/src/models/Settings.js
blob: 0e4c59057a12c0ba251e5b15c86860f3ee9bb5ce (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
import { observable, extendObservable } from 'mobx';
import { DEFAULT_APP_SETTINGS } from '../config';

export default class Settings {
  @observable app = DEFAULT_APP_SETTINGS

  @observable service = {
    activeService: '',
  }

  @observable group = {
    collapsed: [],
    disabled: [],
  }

  @observable stats = {
    appStarts: 0,
  }

  @observable migration = {}

  constructor({ app, service, group, stats, migration }) {
    Object.assign(this.app, app);
    Object.assign(this.service, service);
    Object.assign(this.group, group);
    Object.assign(this.stats, stats);
    Object.assign(this.migration, migration);
  }

  update(data) {
    extendObservable(this, data);
  }
}