BigW Consortium Gitlab

pipelines_store.js 660 Bytes
Newer Older
1
export default class PipelinesStore {
Filipa Lacerda committed
2 3
  constructor() {
    this.state = {};
4

Filipa Lacerda committed
5
    this.state.pipelines = [];
6 7
    this.state.count = {};
    this.state.pageInfo = {};
Filipa Lacerda committed
8 9 10 11
  }

  storePipelines(pipelines = []) {
    this.state.pipelines = pipelines;
12
  }
Filipa Lacerda committed
13

14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
  storeCount(count = {}) {
    this.state.count = count;
  }

  storePagination(pagination = {}) {
    let paginationInfo;

    if (Object.keys(pagination).length) {
      const normalizedHeaders = gl.utils.normalizeHeaders(pagination);
      paginationInfo = gl.utils.parseIntPagination(normalizedHeaders);
    } else {
      paginationInfo = pagination;
    }

    this.state.pageInfo = paginationInfo;
Filipa Lacerda committed
29 30
  }
}