client/src/constants/index.js
author ymh <ymh.work@gmail.com>
Fri, 30 Nov 2018 10:53:15 +0100
changeset 183 f8f3af9e5c83
parent 138 a1fb2ced3049
child 193 99e342f9fb0c
permissions -rw-r--r--
Change the settings to avoid using Session authentication for rest framework as it raise exceptions in case client and backend are on the same domain On the filter, adapt to take into account new version of django_filters

export const ActionEnum = {
  NONE: 0,
  CREATED: 1,
  UPDATED: 2,
  DELETED: 3
}

export const defaultAnnotationsCategories = [
  { key: 'important', name: 'Important',    color: '#F1C40F' },
  { key: 'keyword',   name: 'Mot-clé',      color: '#2ECC71' },
  { key: 'comment',   name: 'Commentaire',  color: '#3498DB', hasComment: true }
];


export const extractAnnotationCategories = (protocol) => {
  const metacategories = (protocol)?protocol['metacategories']:null;
  if(!metacategories) {
    return defaultAnnotationsCategories;
  }
  return metacategories.map((m) => {
    return {
      key: m.id,
      name: m.name,
      description: m.description,
      color: m.color,
      hasComment: m.has_comment
    }
  })
}