Passed
Push — develop ( 1bd307...8449a9 )
by
unknown
01:42
created

frontend_app_admin_workspace_user/src/helper.js   A

Complexity

Total Complexity 3
Complexity/F 1

Size

Lines of Code 110
Function Count 3

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 0
eloc 89
nc 1
dl 0
loc 110
rs 10
c 0
b 0
f 0
wmc 3
mnd 0
bc 0
fnc 3
bpm 0
cpm 1
noi 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A helper.js ➔ ??? 0 1 1
1
import i18n from './i18n.js'
2
3
export const FETCH_CONFIG = {
4
  headers: {
5
    'Accept': 'application/json',
6
    'Content-Type': 'application/json'
7
  }
8
}
9
10
export const ROLE = [{
11
  id: 8,
12
  slug: 'workspace-manager',
13
  faIcon: 'gavel',
14
  hexcolor: '#ed0007',
15
  label: i18n.t('Shared space manager')
16
}, {
17
  id: 4,
18
  slug: 'content-manager',
19
  faIcon: 'graduation-cap',
20
  hexcolor: '#f2af2d',
21
  label: i18n.t('Content manager')
22
}, {
23
  id: 2,
24
  slug: 'contributor',
25
  faIcon: 'pencil',
26
  hexcolor: '#3145f7',
27
  label: i18n.t('Contributor')
28
}, {
29
  id: 1,
30
  slug: 'reader',
31
  faIcon: 'eye',
32
  hexcolor: '#15d948',
33
  label: i18n.t('Reader')
34
}]
35
36
export const PROFILE = {
37
  ADMINISTRATOR: {
38
    id: 1,
39
    slug: 'administrators',
40
    faIcon: 'shield',
41
    hexcolor: '#ed0007',
42
    label: i18n.t('Administrator')
43
  },
44
  MANAGER: {
45
    id: 2,
46
    slug: 'trusted-users',
47
    faIcon: 'graduation-cap',
48
    hexcolor: '#f2af2d',
49
    label: i18n.t('Trusted user')
50
  },
51
  USER: {
52
    id: 4,
53
    slug: 'users',
54
    faIcon: 'user',
55
    hexcolor: '#3145f7',
56
    label: i18n.t('User')
57
  }
58
}
59
60
export const getUserProfile = (profileObj, slug) => Object.keys(profileObj).map(p => profileObj[p]).find(p => slug === p.slug) || {}
61
62
export const debug = {
63
  config: {
64
    label: 'Admin workspace user',
65
    slug: 'admin_workspace_user',
66
    faIcon: 'file-text-o',
67
    hexcolor: '#7d4e24',
68
    type: 'user', // 'user' or 'workspace'
69
    translation: {en: {}, fr: {}},
70
    apiUrl: 'http://localhost:6543/api/v2',
71
    apiHeader: {
72
      'Accept': 'application/json',
73
      'Content-Type': 'application/json'
74
    }
75
  },
76
  loggedUser: {
77
    user_id: 1,
78
    public_name: 'Global Manager',
79
    email: '[email protected]',
80
    lang: 'en',
81
    avatar_url: 'https://avatars3.githubusercontent.com/u/11177014?s=460&v=4'
82
  },
83
  content: {
84
    profile: {
85
      ADMINISTRATOR: {
86
        id: 1,
87
        slug: 'administrators',
88
        faIcon: 'shield',
89
        hexcolor: '#ed0007',
90
        label: i18n.t('Administrator')
91
      },
92
      MANAGER: {
93
        id: 2,
94
        slug: 'trusted-users',
95
        faIcon: 'graduation-cap',
96
        hexcolor: '#f2af2d',
97
        label: i18n.t('Trusted user')
98
      },
99
      USER: {
100
        id: 4,
101
        slug: 'users',
102
        faIcon: 'user',
103
        hexcolor: '#3145f7',
104
        label: i18n.t('User')
105
      }
106
    },
107
    workspaceList: [],
108
    userList: []
109
  }
110
}
111