toConfig()

in src/app/work-items-filter.js [47:72]


  toConfig() {
    const context = this.folder;

    function formatDate(date) {
      return date ? format(date, FORMAT) : null;
    }

    const hasId = it => it.id;

    return {
      folder: context ? {id: context.id, name: context.name, $type: context.$type} : null,
      query: this.query,
      workTypes: (this.workTypes || []).map(type => type && {id: type.id, name: type.name}),
      withoutWorkType: this.withoutWorkType,

      startDate: formatDate(this.startDate),
      endDate: formatDate(this.endDate),

      authors: (this.authors || []).filter(hasId).map(user => user && {id: user.id, name: user.name, avatarURL: user.avatarURL}),
      authorGroups: (this.authorGroups || []).filter(hasId).map(group => group && {id: group.id, name: group.name}),

      youTrack: {
        id: this.youTrackId
      }
    };
  }