admin-users-edit.vue 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952
  1. <template lang='pug'>
  2. v-container(fluid, grid-list-lg)
  3. v-layout(row, wrap)
  4. v-flex(xs12)
  5. .admin-header
  6. img.animated.fadeInUp(src='/_assets/svg/icon-male-user.svg', :alt='$t(`admin:users.edit`)', style='width: 80px;')
  7. .admin-header-title
  8. .headline.blue--text.text--darken-2.animated.fadeInLeft {{$t('admin:users.edit')}}
  9. .subtitle-1.grey--text.animated.fadeInLeft.wait-p2s {{user.name}}
  10. v-spacer
  11. i18next.pr-4.caption.grey--text.animated.fadeInDown(path='admin:users.id', tag='div')
  12. strong(place='id') {{user.id}}
  13. template(v-if='user.isActive')
  14. status-indicator.mr-3(positive, pulse)
  15. .caption.green--text {{$t('admin:users.active')}}
  16. template(v-else)
  17. status-indicator.mr-3(negative, pulse)
  18. .caption.red--text {{$t('admin:users.inactive')}}
  19. template(v-if='user.isVerified')
  20. status-indicator.mr-3.ml-4(active, pulse)
  21. .caption.blue--text {{$t('admin:users.verified')}}
  22. template(v-else)
  23. status-indicator.mr-3.ml-4(intermediary, pulse)
  24. .caption.deep-orange--text {{$t('admin:users.unverified')}}
  25. v-spacer
  26. v-btn.ml-3.animated.fadeInDown.wait-p3s(color='grey', icon, outlined, to='/users')
  27. v-icon mdi-arrow-left
  28. v-menu(offset-y, origin='top right')
  29. template(v-slot:activator='{ on }')
  30. v-btn.ml-3.animated.fadeInDown.wait-p2s(color='black', v-on='on', depressed, dark)
  31. span Actions
  32. v-icon(right) mdi-chevron-down
  33. v-list(dense, nav)
  34. v-list-item(v-if='!user.isActive', @click='activateUser')
  35. v-list-item-icon
  36. v-icon(color='purple') mdi-account-key
  37. v-list-item-title Activate
  38. v-list-item(v-else, @click='deactivateUser', :disabled='user.id == currentUserId || user.isSystem')
  39. v-list-item-icon
  40. v-icon(color='purple') mdi-account-cancel
  41. v-list-item-title Deactivate
  42. v-list-item(@click='verifyUser', :disabled='user.isVerified')
  43. v-list-item-icon
  44. v-icon(color='blue') mdi-account-check
  45. v-list-item-title Set as Verified
  46. v-list-item(@click='deleteUserDialog = true', :disabled='user.id == currentUserId || user.isSystem')
  47. v-list-item-icon
  48. v-icon(color='red') mdi-trash-can-outline
  49. v-list-item-title Delete
  50. v-btn.ml-3.animated.fadeInDown(color='primary', large, depressed, @click='updateUser')
  51. v-icon(left) mdi-check
  52. span {{$t('admin:users.updateUser')}}
  53. v-flex(xs6)
  54. v-card.animated.fadeInUp
  55. v-toolbar(color='primary', dense, dark, flat)
  56. v-icon.mr-2 mdi-information-variant
  57. span {{$t('admin:users.basicInfo')}}
  58. v-list.py-0(two-line, dense)
  59. v-list-item
  60. v-list-item-avatar(size='32')
  61. v-icon mdi-email-variant
  62. v-list-item-content
  63. v-list-item-title {{$t('admin:users.email')}}
  64. v-list-item-subtitle {{ user.email }}
  65. v-list-item-action(v-if='!user.isSystem && user.providerKey === `local`')
  66. v-menu(
  67. v-model='editPop.email'
  68. :close-on-content-click='false'
  69. min-width='350'
  70. left
  71. )
  72. template(v-slot:activator='{ on }')
  73. v-btn(icon, color='grey', x-small, v-on='on', @click='focusField(`iptEmail`)')
  74. v-icon mdi-pencil
  75. v-card
  76. v-text-field(
  77. ref='iptEmail'
  78. v-model='user.email'
  79. :label='$t(`admin:users.email`)'
  80. solo
  81. hide-details
  82. append-icon='mdi-check'
  83. @click:append='editPop.email = false'
  84. @keydown.enter='editPop.email = false'
  85. @keydown.esc='editPop.email = false'
  86. )
  87. v-divider
  88. v-list-item
  89. v-list-item-avatar(size='32')
  90. v-icon mdi-account
  91. v-list-item-content
  92. v-list-item-title {{$t('admin:users.displayName')}}
  93. v-list-item-subtitle {{ user.name }}
  94. v-list-item-action
  95. v-menu(
  96. v-model='editPop.name'
  97. :close-on-content-click='false'
  98. min-width='350'
  99. left
  100. )
  101. template(v-slot:activator='{ on }')
  102. v-btn(icon, color='grey', x-small, v-on='on', @click='focusField(`iptDisplayName`)')
  103. v-icon mdi-pencil
  104. v-card
  105. v-text-field(
  106. ref='iptDisplayName'
  107. v-model='user.name'
  108. :label='$t(`admin:users.displayName`)'
  109. solo
  110. hide-details
  111. append-icon='mdi-check'
  112. @click:append='editPop.name = false'
  113. @keydown.enter='editPop.name = false'
  114. @keydown.esc='editPop.name = false'
  115. )
  116. v-card.mt-3.animated.fadeInUp.wait-p2s(v-if='!user.isSystem')
  117. v-toolbar(color='primary', dense, dark, flat)
  118. v-icon.mr-2 mdi-lock-outline
  119. span {{$t('admin:users.authentication')}}
  120. v-list.py-0(two-line, dense)
  121. v-list-item
  122. v-list-item-avatar(size='32')
  123. v-icon mdi-domain
  124. v-list-item-content
  125. v-list-item-title {{$t('admin:users.authProvider')}}
  126. v-list-item-subtitle {{ user.providerKey }}
  127. //- v-list-item-action
  128. //- v-img(src='https://static.requarks.io/logo/wikijs.svg', alt='', contain, max-height='32', position='center right')
  129. template(v-if='user.providerKey === `local`')
  130. v-divider
  131. v-list-item
  132. v-list-item-avatar(size='32')
  133. v-icon mdi-form-textbox-password
  134. v-list-item-content
  135. v-list-item-title {{$t('admin:users.password')}}
  136. v-list-item-subtitle &bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;
  137. v-list-item-action
  138. v-menu(
  139. v-model='editPop.newPassword'
  140. :close-on-content-click='false'
  141. min-width='350'
  142. left
  143. )
  144. template(v-slot:activator='{ on: menu }')
  145. v-tooltip(top)
  146. template(v-slot:activator='{ on: tooltip }')
  147. v-btn(icon, color='grey', x-small, v-on='{ ...menu, ...tooltip }', @click='focusField(`iptNewPassword`)')
  148. v-icon mdi-pencil
  149. span {{$t('admin:users.changePassword')}}
  150. v-card
  151. v-text-field(
  152. ref='iptNewPassword'
  153. v-model='newPassword'
  154. :label='$t(`admin:users.newPassword`)'
  155. solo
  156. hide-details
  157. append-icon='mdi-check'
  158. type='password'
  159. @click:append='editPop.newPassword = false'
  160. @keydown.enter='editPop.newPassword = false'
  161. @keydown.esc='editPop.newPassword = false'
  162. )
  163. v-list-item-action
  164. v-tooltip(top)
  165. template(v-slot:activator='{ on }')
  166. v-btn(icon, color='grey', x-small, v-on='on', disabled)
  167. v-icon mdi-email
  168. span Send Password Reset Email
  169. v-divider
  170. v-list-item
  171. v-list-item-avatar(size='32')
  172. v-icon mdi-two-factor-authentication
  173. v-list-item-content
  174. v-list-item-title {{$t('admin:users.tfa')}}
  175. v-list-item-subtitle.red--text Inactive
  176. v-list-item-action
  177. v-tooltip(top)
  178. template(v-slot:activator='{ on }')
  179. v-btn(icon, color='grey', x-small, v-on='on', disabled)
  180. v-icon mdi-power
  181. span {{$t('admin:users.toggle2FA')}}
  182. template(v-if='user.providerId')
  183. v-divider
  184. v-list-item
  185. v-list-item-avatar(size='32')
  186. v-icon mdi-music-accidental-sharp
  187. v-list-item-content
  188. v-list-item-title {{$t('admin:users.authProviderId')}}
  189. v-list-item-subtitle {{ user.providerId }}
  190. v-card.mt-3.animated.fadeInUp.wait-p4s
  191. v-toolbar(color='primary', dense, dark, flat)
  192. v-icon.mr-2 mdi-account-group
  193. span {{$t('admin:users.groups')}}
  194. v-list(dense)
  195. template(v-for='(group, idx) in user.groups')
  196. v-list-item(:key='`group-` + group.id')
  197. v-list-item-avatar(size='32')
  198. v-icon mdi-account-group-outline
  199. v-list-item-content
  200. v-list-item-title {{group.name}}
  201. v-list-item-action(v-if='!user.isSystem')
  202. v-btn(icon, color='red', x-small, @click='unassignGroup(group.id)')
  203. v-icon mdi-close
  204. v-divider(v-if='idx < user.groups.length - 1')
  205. v-alert.mx-3(v-if='user.groups.length < 1', outlined, color='grey darken-1', icon='mdi-alert')
  206. .caption {{$t('admin:users.noGroupAssigned')}}
  207. v-card-chin(v-if='!user.isSystem')
  208. v-spacer
  209. v-select(
  210. ref='iptAssignGroup'
  211. :items='groups'
  212. v-model='newGroup'
  213. :label='$t(`admin:users.selectGroup`)'
  214. item-value='id'
  215. item-text='name'
  216. item-disabled='isSystem'
  217. solo
  218. flat
  219. hide-details
  220. @keydown.esc='editPop.assignGroup = false'
  221. style='max-width: 300px;'
  222. )
  223. v-btn.ml-2.px-4(depressed, color='primary', height='48', @click='assignGroup', :disabled='newGroup === 0')
  224. v-icon(left) mdi-clipboard-account-outline
  225. span {{$t('admin:users.groupAssign')}}
  226. v-system-bar(window, :color='$vuetify.theme.dark ? `grey darken-4-l3` : `grey lighten-3`')
  227. v-spacer
  228. .caption {{$t('admin:users.groupAssignNotice')}}
  229. v-flex(xs6)
  230. v-card.animated.fadeInUp.wait-p2s
  231. v-toolbar(color='primary', dense, dark, flat)
  232. v-icon.mr-2 mdi-account-badge-outline
  233. span {{$t('admin:users.extendedMetadata')}}
  234. v-list.py-0(two-line, dense)
  235. v-list-item
  236. v-list-item-avatar(size='32')
  237. v-icon mdi-map-marker
  238. v-list-item-content
  239. v-list-item-title {{$t('admin:users.location')}}
  240. v-list-item-subtitle {{ user.location }}
  241. v-list-item-action
  242. v-menu(
  243. v-model='editPop.location'
  244. :close-on-content-click='false'
  245. min-width='350'
  246. left
  247. )
  248. template(v-slot:activator='{ on }')
  249. v-btn(icon, color='grey', x-small, v-on='on', @click='focusField(`iptLocation`)')
  250. v-icon mdi-pencil
  251. v-card
  252. v-text-field(
  253. ref='iptLocation'
  254. v-model='user.location'
  255. :label='$t(`admin:users.location`)'
  256. solo
  257. hide-details
  258. append-icon='mdi-check'
  259. @click:append='editPop.location = false'
  260. @keydown.enter='editPop.location = false'
  261. @keydown.esc='editPop.location = false'
  262. )
  263. v-divider
  264. v-list-item
  265. v-list-item-avatar(size='32')
  266. v-icon mdi-briefcase
  267. v-list-item-content
  268. v-list-item-title {{$t('admin:users.jobTitle')}}
  269. v-list-item-subtitle {{ user.jobTitle }}
  270. v-list-item-action
  271. v-menu(
  272. v-model='editPop.jobTitle'
  273. :close-on-content-click='false'
  274. min-width='350'
  275. left
  276. )
  277. template(v-slot:activator='{ on }')
  278. v-btn(icon, color='grey', x-small, v-on='on', @click='focusField(`iptJobTitle`)')
  279. v-icon mdi-pencil
  280. v-card
  281. v-text-field(
  282. ref='iptJobTitle'
  283. v-model='user.jobTitle'
  284. :label='$t(`admin:users.jobTitle`)'
  285. solo
  286. hide-details
  287. append-icon='mdi-check'
  288. @click:append='editPop.jobTitle = false'
  289. @keydown.enter='editPop.jobTitle = false'
  290. @keydown.esc='editPop.jobTitle = false'
  291. )
  292. v-divider
  293. v-list-item
  294. v-list-item-avatar(size='32')
  295. v-icon mdi-map-clock-outline
  296. v-list-item-content
  297. v-list-item-title {{$t('admin:users.timezone')}}
  298. v-list-item-subtitle {{ user.timezone }}
  299. v-list-item-action
  300. v-menu(
  301. v-model='editPop.timezone'
  302. :close-on-content-click='false'
  303. min-width='350'
  304. left
  305. )
  306. template(v-slot:activator='{ on }')
  307. v-btn(icon, color='grey', x-small, v-on='on', @click='focusField(`iptTimezone`)')
  308. v-icon mdi-pencil
  309. v-card
  310. v-select(
  311. ref='iptTimezone'
  312. :items='timezones'
  313. v-model='user.timezone'
  314. :label='$t(`admin:users.timezone`)'
  315. solo
  316. dense
  317. hide-details
  318. append-icon='mdi-check'
  319. @click:append='editPop.timezone = false'
  320. @keydown.enter='editPop.timezone = false'
  321. @keydown.esc='editPop.timezone = false'
  322. )
  323. v-card.mt-3.animated.fadeInUp.wait-p4s
  324. v-toolbar(color='teal', dark, dense, flat)
  325. v-toolbar-title
  326. .subtitle-1 {{$t('profile:activity.title')}}
  327. v-card-text.grey--text.text--darken-2
  328. .caption.grey--text {{$t('profile:activity.joinedOn')}}
  329. .body-2: strong {{ user.createdAt | moment('LLLL') }}
  330. .caption.grey--text.mt-3 {{$t('profile:activity.lastUpdatedOn')}}
  331. .body-2: strong {{ user.updatedAt | moment('LLLL') }}
  332. .caption.grey--text.mt-3 {{$t('profile:activity.lastLoginOn')}}
  333. .body-2: strong {{ user.lastLoginAt | moment('LLLL') }}
  334. v-card.mt-3.animated.fadeInUp.wait-p6s
  335. v-toolbar(color='teal', dense, dark, flat)
  336. v-icon.mr-2 mdi-file-document-box-multiple-outline
  337. span Content
  338. v-card-text
  339. em.caption.grey--text Coming soon
  340. v-dialog(v-model='deleteUserDialog', max-width='500')
  341. v-card
  342. .dialog-header.is-red {{$t('admin:users.deleteConfirmTitle')}}
  343. v-card-text.pt-5
  344. i18next(path='admin:users.deleteConfirmText', tag='span')
  345. strong(place='username') {{ user.email }}
  346. .caption.mt-3 {{$t('admin:users.deleteConfirmForeignNotice')}}
  347. v-card-actions
  348. v-spacer
  349. v-btn(text, @click='deleteUserDialog = false') {{$t('common:actions.cancel')}}
  350. v-btn(color='red', dark, @click='deleteUser') {{$t('common:actions.delete')}}
  351. </template>
  352. <script>
  353. import _ from 'lodash'
  354. import { get } from 'vuex-pathify'
  355. import gql from 'graphql-tag'
  356. import { StatusIndicator } from 'vue-status-indicator'
  357. import groupsQuery from 'gql/admin/users/users-query-groups.gql'
  358. export default {
  359. i18nOptions: {
  360. namespaces: ['admin', 'profile']
  361. },
  362. components: {
  363. StatusIndicator
  364. },
  365. data() {
  366. return {
  367. deleteUserDialog: false,
  368. editPop: {
  369. email: false,
  370. name: false,
  371. pwd: false,
  372. location: false,
  373. jobTitle: false,
  374. timezone: false,
  375. newPassword: false,
  376. assignGroup: false
  377. },
  378. newGroup: 0,
  379. newPassword: '',
  380. user: {
  381. email: '',
  382. name: '',
  383. location: '',
  384. jobTitle: '',
  385. timezone: '',
  386. groups: [],
  387. isActive: false,
  388. isVerified: false
  389. },
  390. timezones: [
  391. { text: '(GMT-11:00) Niue', value: 'Pacific/Niue' },
  392. { text: '(GMT-11:00) Pago Pago', value: 'Pacific/Pago_Pago' },
  393. { text: '(GMT-10:00) Hawaii Time', value: 'Pacific/Honolulu' },
  394. { text: '(GMT-10:00) Rarotonga', value: 'Pacific/Rarotonga' },
  395. { text: '(GMT-10:00) Tahiti', value: 'Pacific/Tahiti' },
  396. { text: '(GMT-09:30) Marquesas', value: 'Pacific/Marquesas' },
  397. { text: '(GMT-09:00) Alaska Time', value: 'America/Anchorage' },
  398. { text: '(GMT-09:00) Gambier', value: 'Pacific/Gambier' },
  399. { text: '(GMT-08:00) Pacific Time', value: 'America/Los_Angeles' },
  400. { text: '(GMT-08:00) Pacific Time - Tijuana', value: 'America/Tijuana' },
  401. { text: '(GMT-08:00) Pacific Time - Vancouver', value: 'America/Vancouver' },
  402. { text: '(GMT-08:00) Pacific Time - Whitehorse', value: 'America/Whitehorse' },
  403. { text: '(GMT-08:00) Pitcairn', value: 'Pacific/Pitcairn' },
  404. { text: '(GMT-07:00) Mountain Time', value: 'America/Denver' },
  405. { text: '(GMT-07:00) Mountain Time - Arizona', value: 'America/Phoenix' },
  406. { text: '(GMT-07:00) Mountain Time - Chihuahua, Mazatlan', value: 'America/Mazatlan' },
  407. { text: '(GMT-07:00) Mountain Time - Dawson Creek', value: 'America/Dawson_Creek' },
  408. { text: '(GMT-07:00) Mountain Time - Edmonton', value: 'America/Edmonton' },
  409. { text: '(GMT-07:00) Mountain Time - Hermosillo', value: 'America/Hermosillo' },
  410. { text: '(GMT-07:00) Mountain Time - Yellowknife', value: 'America/Yellowknife' },
  411. { text: '(GMT-06:00) Belize', value: 'America/Belize' },
  412. { text: '(GMT-06:00) Central Time', value: 'America/Chicago' },
  413. { text: '(GMT-06:00) Central Time - Mexico City', value: 'America/Mexico_City' },
  414. { text: '(GMT-06:00) Central Time - Regina', value: 'America/Regina' },
  415. { text: '(GMT-06:00) Central Time - Tegucigalpa', value: 'America/Tegucigalpa' },
  416. { text: '(GMT-06:00) Central Time - Winnipeg', value: 'America/Winnipeg' },
  417. { text: '(GMT-06:00) Costa Rica', value: 'America/Costa_Rica' },
  418. { text: '(GMT-06:00) El Salvador', value: 'America/El_Salvador' },
  419. { text: '(GMT-06:00) Galapagos', value: 'Pacific/Galapagos' },
  420. { text: '(GMT-06:00) Guatemala', value: 'America/Guatemala' },
  421. { text: '(GMT-06:00) Managua', value: 'America/Managua' },
  422. { text: '(GMT-05:00) America Cancun', value: 'America/Cancun' },
  423. { text: '(GMT-05:00) Bogota', value: 'America/Bogota' },
  424. { text: '(GMT-05:00) Easter Island', value: 'Pacific/Easter' },
  425. { text: '(GMT-05:00) Eastern Time', value: 'America/New_York' },
  426. { text: '(GMT-05:00) Eastern Time - Iqaluit', value: 'America/Iqaluit' },
  427. { text: '(GMT-05:00) Eastern Time - Toronto', value: 'America/Toronto' },
  428. { text: '(GMT-05:00) Guayaquil', value: 'America/Guayaquil' },
  429. { text: '(GMT-05:00) Havana', value: 'America/Havana' },
  430. { text: '(GMT-05:00) Jamaica', value: 'America/Jamaica' },
  431. { text: '(GMT-05:00) Lima', value: 'America/Lima' },
  432. { text: '(GMT-05:00) Nassau', value: 'America/Nassau' },
  433. { text: '(GMT-05:00) Panama', value: 'America/Panama' },
  434. { text: '(GMT-05:00) Port-au-Prince', value: 'America/Port-au-Prince' },
  435. { text: '(GMT-05:00) Rio Branco', value: 'America/Rio_Branco' },
  436. { text: '(GMT-04:00) Atlantic Time - Halifax', value: 'America/Halifax' },
  437. { text: '(GMT-04:00) Barbados', value: 'America/Barbados' },
  438. { text: '(GMT-04:00) Bermuda', value: 'Atlantic/Bermuda' },
  439. { text: '(GMT-04:00) Boa Vista', value: 'America/Boa_Vista' },
  440. { text: '(GMT-04:00) Caracas', value: 'America/Caracas' },
  441. { text: '(GMT-04:00) Curacao', value: 'America/Curacao' },
  442. { text: '(GMT-04:00) Grand Turk', value: 'America/Grand_Turk' },
  443. { text: '(GMT-04:00) Guyana', value: 'America/Guyana' },
  444. { text: '(GMT-04:00) La Paz', value: 'America/La_Paz' },
  445. { text: '(GMT-04:00) Manaus', value: 'America/Manaus' },
  446. { text: '(GMT-04:00) Martinique', value: 'America/Martinique' },
  447. { text: '(GMT-04:00) Port of Spain', value: 'America/Port_of_Spain' },
  448. { text: '(GMT-04:00) Porto Velho', value: 'America/Porto_Velho' },
  449. { text: '(GMT-04:00) Puerto Rico', value: 'America/Puerto_Rico' },
  450. { text: '(GMT-04:00) Santo Domingo', value: 'America/Santo_Domingo' },
  451. { text: '(GMT-04:00) Thule', value: 'America/Thule' },
  452. { text: '(GMT-03:30) Newfoundland Time - St. Johns', value: 'America/St_Johns' },
  453. { text: '(GMT-03:00) Araguaina', value: 'America/Araguaina' },
  454. { text: '(GMT-03:00) Asuncion', value: 'America/Asuncion' },
  455. { text: '(GMT-03:00) Belem', value: 'America/Belem' },
  456. { text: '(GMT-03:00) Buenos Aires', value: 'America/Argentina/Buenos_Aires' },
  457. { text: '(GMT-03:00) Campo Grande', value: 'America/Campo_Grande' },
  458. { text: '(GMT-03:00) Cayenne', value: 'America/Cayenne' },
  459. { text: '(GMT-03:00) Cuiaba', value: 'America/Cuiaba' },
  460. { text: '(GMT-03:00) Fortaleza', value: 'America/Fortaleza' },
  461. { text: '(GMT-03:00) Godthab', value: 'America/Godthab' },
  462. { text: '(GMT-03:00) Maceio', value: 'America/Maceio' },
  463. { text: '(GMT-03:00) Miquelon', value: 'America/Miquelon' },
  464. { text: '(GMT-03:00) Montevideo', value: 'America/Montevideo' },
  465. { text: '(GMT-03:00) Palmer', value: 'Antarctica/Palmer' },
  466. { text: '(GMT-03:00) Paramaribo', value: 'America/Paramaribo' },
  467. { text: '(GMT-03:00) Punta Arenas', value: 'America/Punta_Arenas' },
  468. { text: '(GMT-03:00) Recife', value: 'America/Recife' },
  469. { text: '(GMT-03:00) Rothera', value: 'Antarctica/Rothera' },
  470. { text: '(GMT-03:00) Salvador', value: 'America/Bahia' },
  471. { text: '(GMT-03:00) Santiago', value: 'America/Santiago' },
  472. { text: '(GMT-03:00) Stanley', value: 'Atlantic/Stanley' },
  473. { text: '(GMT-02:00) Noronha', value: 'America/Noronha' },
  474. { text: '(GMT-02:00) Sao Paulo', value: 'America/Sao_Paulo' },
  475. { text: '(GMT-02:00) South Georgia', value: 'Atlantic/South_Georgia' },
  476. { text: '(GMT-01:00) Azores', value: 'Atlantic/Azores' },
  477. { text: '(GMT-01:00) Cape Verde', value: 'Atlantic/Cape_Verde' },
  478. { text: '(GMT-01:00) Scoresbysund', value: 'America/Scoresbysund' },
  479. { text: '(GMT+00:00) Abidjan', value: 'Africa/Abidjan' },
  480. { text: '(GMT+00:00) Accra', value: 'Africa/Accra' },
  481. { text: '(GMT+00:00) Bissau', value: 'Africa/Bissau' },
  482. { text: '(GMT+00:00) Canary Islands', value: 'Atlantic/Canary' },
  483. { text: '(GMT+00:00) Casablanca', value: 'Africa/Casablanca' },
  484. { text: '(GMT+00:00) Danmarkshavn', value: 'America/Danmarkshavn' },
  485. { text: '(GMT+00:00) Dublin', value: 'Europe/Dublin' },
  486. { text: '(GMT+00:00) El Aaiun', value: 'Africa/El_Aaiun' },
  487. { text: '(GMT+00:00) Faeroe', value: 'Atlantic/Faroe' },
  488. { text: '(GMT+00:00) GMT (no daylight saving)', value: 'Etc/GMT' },
  489. { text: '(GMT+00:00) Lisbon', value: 'Europe/Lisbon' },
  490. { text: '(GMT+00:00) London', value: 'Europe/London' },
  491. { text: '(GMT+00:00) Monrovia', value: 'Africa/Monrovia' },
  492. { text: '(GMT+00:00) Reykjavik', value: 'Atlantic/Reykjavik' },
  493. { text: '(GMT+01:00) Algiers', value: 'Africa/Algiers' },
  494. { text: '(GMT+01:00) Amsterdam', value: 'Europe/Amsterdam' },
  495. { text: '(GMT+01:00) Andorra', value: 'Europe/Andorra' },
  496. { text: '(GMT+01:00) Berlin', value: 'Europe/Berlin' },
  497. { text: '(GMT+01:00) Brussels', value: 'Europe/Brussels' },
  498. { text: '(GMT+01:00) Budapest', value: 'Europe/Budapest' },
  499. { text: '(GMT+01:00) Central European Time - Belgrade', value: 'Europe/Belgrade' },
  500. { text: '(GMT+01:00) Central European Time - Prague', value: 'Europe/Prague' },
  501. { text: '(GMT+01:00) Ceuta', value: 'Africa/Ceuta' },
  502. { text: '(GMT+01:00) Copenhagen', value: 'Europe/Copenhagen' },
  503. { text: '(GMT+01:00) Gibraltar', value: 'Europe/Gibraltar' },
  504. { text: '(GMT+01:00) Lagos', value: 'Africa/Lagos' },
  505. { text: '(GMT+01:00) Luxembourg', value: 'Europe/Luxembourg' },
  506. { text: '(GMT+01:00) Madrid', value: 'Europe/Madrid' },
  507. { text: '(GMT+01:00) Malta', value: 'Europe/Malta' },
  508. { text: '(GMT+01:00) Monaco', value: 'Europe/Monaco' },
  509. { text: '(GMT+01:00) Ndjamena', value: 'Africa/Ndjamena' },
  510. { text: '(GMT+01:00) Oslo', value: 'Europe/Oslo' },
  511. { text: '(GMT+01:00) Paris', value: 'Europe/Paris' },
  512. { text: '(GMT+01:00) Rome', value: 'Europe/Rome' },
  513. { text: '(GMT+01:00) Stockholm', value: 'Europe/Stockholm' },
  514. { text: '(GMT+01:00) Tirane', value: 'Europe/Tirane' },
  515. { text: '(GMT+01:00) Tunis', value: 'Africa/Tunis' },
  516. { text: '(GMT+01:00) Vienna', value: 'Europe/Vienna' },
  517. { text: '(GMT+01:00) Warsaw', value: 'Europe/Warsaw' },
  518. { text: '(GMT+01:00) Zurich', value: 'Europe/Zurich' },
  519. { text: '(GMT+02:00) Amman', value: 'Asia/Amman' },
  520. { text: '(GMT+02:00) Athens', value: 'Europe/Athens' },
  521. { text: '(GMT+02:00) Beirut', value: 'Asia/Beirut' },
  522. { text: '(GMT+02:00) Bucharest', value: 'Europe/Bucharest' },
  523. { text: '(GMT+02:00) Cairo', value: 'Africa/Cairo' },
  524. { text: '(GMT+02:00) Chisinau', value: 'Europe/Chisinau' },
  525. { text: '(GMT+02:00) Damascus', value: 'Asia/Damascus' },
  526. { text: '(GMT+02:00) Gaza', value: 'Asia/Gaza' },
  527. { text: '(GMT+02:00) Helsinki', value: 'Europe/Helsinki' },
  528. { text: '(GMT+02:00) Jerusalem', value: 'Asia/Jerusalem' },
  529. { text: '(GMT+02:00) Johannesburg', value: 'Africa/Johannesburg' },
  530. { text: '(GMT+02:00) Khartoum', value: 'Africa/Khartoum' },
  531. { text: '(GMT+02:00) Kiev', value: 'Europe/Kiev' },
  532. { text: '(GMT+02:00) Maputo', value: 'Africa/Maputo' },
  533. { text: '(GMT+02:00) Moscow-01 - Kaliningrad', value: 'Europe/Kaliningrad' },
  534. { text: '(GMT+02:00) Nicosia', value: 'Asia/Nicosia' },
  535. { text: '(GMT+02:00) Riga', value: 'Europe/Riga' },
  536. { text: '(GMT+02:00) Sofia', value: 'Europe/Sofia' },
  537. { text: '(GMT+02:00) Tallinn', value: 'Europe/Tallinn' },
  538. { text: '(GMT+02:00) Tripoli', value: 'Africa/Tripoli' },
  539. { text: '(GMT+02:00) Vilnius', value: 'Europe/Vilnius' },
  540. { text: '(GMT+02:00) Windhoek', value: 'Africa/Windhoek' },
  541. { text: '(GMT+03:00) Baghdad', value: 'Asia/Baghdad' },
  542. { text: '(GMT+03:00) Istanbul', value: 'Europe/Istanbul' },
  543. { text: '(GMT+03:00) Minsk', value: 'Europe/Minsk' },
  544. { text: '(GMT+03:00) Moscow+00 - Moscow', value: 'Europe/Moscow' },
  545. { text: '(GMT+03:00) Nairobi', value: 'Africa/Nairobi' },
  546. { text: '(GMT+03:00) Qatar', value: 'Asia/Qatar' },
  547. { text: '(GMT+03:00) Riyadh', value: 'Asia/Riyadh' },
  548. { text: '(GMT+03:00) Syowa', value: 'Antarctica/Syowa' },
  549. { text: '(GMT+03:30) Tehran', value: 'Asia/Tehran' },
  550. { text: '(GMT+04:00) Baku', value: 'Asia/Baku' },
  551. { text: '(GMT+04:00) Dubai', value: 'Asia/Dubai' },
  552. { text: '(GMT+04:00) Mahe', value: 'Indian/Mahe' },
  553. { text: '(GMT+04:00) Mauritius', value: 'Indian/Mauritius' },
  554. { text: '(GMT+04:00) Moscow+01 - Samara', value: 'Europe/Samara' },
  555. { text: '(GMT+04:00) Reunion', value: 'Indian/Reunion' },
  556. { text: '(GMT+04:00) Tbilisi', value: 'Asia/Tbilisi' },
  557. { text: '(GMT+04:00) Yerevan', value: 'Asia/Yerevan' },
  558. { text: '(GMT+04:30) Kabul', value: 'Asia/Kabul' },
  559. { text: '(GMT+05:00) Aqtau', value: 'Asia/Aqtau' },
  560. { text: '(GMT+05:00) Aqtobe', value: 'Asia/Aqtobe' },
  561. { text: '(GMT+05:00) Ashgabat', value: 'Asia/Ashgabat' },
  562. { text: '(GMT+05:00) Dushanbe', value: 'Asia/Dushanbe' },
  563. { text: '(GMT+05:00) Karachi', value: 'Asia/Karachi' },
  564. { text: '(GMT+05:00) Kerguelen', value: 'Indian/Kerguelen' },
  565. { text: '(GMT+05:00) Maldives', value: 'Indian/Maldives' },
  566. { text: '(GMT+05:00) Mawson', value: 'Antarctica/Mawson' },
  567. { text: '(GMT+05:00) Moscow+02 - Yekaterinburg', value: 'Asia/Yekaterinburg' },
  568. { text: '(GMT+05:00) Tashkent', value: 'Asia/Tashkent' },
  569. { text: '(GMT+05:30) Colombo', value: 'Asia/Colombo' },
  570. { text: '(GMT+05:30) India Standard Time', value: 'Asia/Kolkata' },
  571. { text: '(GMT+05:45) Kathmandu', value: 'Asia/Kathmandu' },
  572. { text: '(GMT+06:00) Almaty', value: 'Asia/Almaty' },
  573. { text: '(GMT+06:00) Bishkek', value: 'Asia/Bishkek' },
  574. { text: '(GMT+06:00) Chagos', value: 'Indian/Chagos' },
  575. { text: '(GMT+06:00) Dhaka', value: 'Asia/Dhaka' },
  576. { text: '(GMT+06:00) Moscow+03 - Omsk', value: 'Asia/Omsk' },
  577. { text: '(GMT+06:00) Thimphu', value: 'Asia/Thimphu' },
  578. { text: '(GMT+06:00) Vostok', value: 'Antarctica/Vostok' },
  579. { text: '(GMT+06:30) Cocos', value: 'Indian/Cocos' },
  580. { text: '(GMT+06:30) Rangoon', value: 'Asia/Yangon' },
  581. { text: '(GMT+07:00) Bangkok', value: 'Asia/Bangkok' },
  582. { text: '(GMT+07:00) Christmas', value: 'Indian/Christmas' },
  583. { text: '(GMT+07:00) Davis', value: 'Antarctica/Davis' },
  584. { text: '(GMT+07:00) Hanoi', value: 'Asia/Saigon' },
  585. { text: '(GMT+07:00) Hovd', value: 'Asia/Hovd' },
  586. { text: '(GMT+07:00) Jakarta', value: 'Asia/Jakarta' },
  587. { text: '(GMT+07:00) Moscow+04 - Krasnoyarsk', value: 'Asia/Krasnoyarsk' },
  588. { text: '(GMT+08:00) Brunei', value: 'Asia/Brunei' },
  589. { text: '(GMT+08:00) China Time - Beijing', value: 'Asia/Shanghai' },
  590. { text: '(GMT+08:00) Choibalsan', value: 'Asia/Choibalsan' },
  591. { text: '(GMT+08:00) Hong Kong', value: 'Asia/Hong_Kong' },
  592. { text: '(GMT+08:00) Kuala Lumpur', value: 'Asia/Kuala_Lumpur' },
  593. { text: '(GMT+08:00) Macau', value: 'Asia/Macau' },
  594. { text: '(GMT+08:00) Makassar', value: 'Asia/Makassar' },
  595. { text: '(GMT+08:00) Manila', value: 'Asia/Manila' },
  596. { text: '(GMT+08:00) Moscow+05 - Irkutsk', value: 'Asia/Irkutsk' },
  597. { text: '(GMT+08:00) Singapore', value: 'Asia/Singapore' },
  598. { text: '(GMT+08:00) Taipei', value: 'Asia/Taipei' },
  599. { text: '(GMT+08:00) Ulaanbaatar', value: 'Asia/Ulaanbaatar' },
  600. { text: '(GMT+08:00) Western Time - Perth', value: 'Australia/Perth' },
  601. { text: '(GMT+08:30) Pyongyang', value: 'Asia/Pyongyang' },
  602. { text: '(GMT+09:00) Dili', value: 'Asia/Dili' },
  603. { text: '(GMT+09:00) Jayapura', value: 'Asia/Jayapura' },
  604. { text: '(GMT+09:00) Moscow+06 - Yakutsk', value: 'Asia/Yakutsk' },
  605. { text: '(GMT+09:00) Palau', value: 'Pacific/Palau' },
  606. { text: '(GMT+09:00) Seoul', value: 'Asia/Seoul' },
  607. { text: '(GMT+09:00) Tokyo', value: 'Asia/Tokyo' },
  608. { text: '(GMT+09:30) Central Time - Darwin', value: 'Australia/Darwin' },
  609. { text: '(GMT+10:00) Dumont D\'Urville', value: 'Antarctica/DumontDUrville' },
  610. { text: '(GMT+10:00) Eastern Time - Brisbane', value: 'Australia/Brisbane' },
  611. { text: '(GMT+10:00) Guam', value: 'Pacific/Guam' },
  612. { text: '(GMT+10:00) Moscow+07 - Vladivostok', value: 'Asia/Vladivostok' },
  613. { text: '(GMT+10:00) Port Moresby', value: 'Pacific/Port_Moresby' },
  614. { text: '(GMT+10:00) Truk', value: 'Pacific/Chuuk' },
  615. { text: '(GMT+10:30) Central Time - Adelaide', value: 'Australia/Adelaide' },
  616. { text: '(GMT+11:00) Casey', value: 'Antarctica/Casey' },
  617. { text: '(GMT+11:00) Eastern Time - Hobart', value: 'Australia/Hobart' },
  618. { text: '(GMT+11:00) Eastern Time - Melbourne, Sydney', value: 'Australia/Sydney' },
  619. { text: '(GMT+11:00) Efate', value: 'Pacific/Efate' },
  620. { text: '(GMT+11:00) Guadalcanal', value: 'Pacific/Guadalcanal' },
  621. { text: '(GMT+11:00) Kosrae', value: 'Pacific/Kosrae' },
  622. { text: '(GMT+11:00) Moscow+08 - Magadan', value: 'Asia/Magadan' },
  623. { text: '(GMT+11:00) Norfolk', value: 'Pacific/Norfolk' },
  624. { text: '(GMT+11:00) Noumea', value: 'Pacific/Noumea' },
  625. { text: '(GMT+11:00) Ponape', value: 'Pacific/Pohnpei' },
  626. { text: '(GMT+12:00) Funafuti', value: 'Pacific/Funafuti' },
  627. { text: '(GMT+12:00) Kwajalein', value: 'Pacific/Kwajalein' },
  628. { text: '(GMT+12:00) Majuro', value: 'Pacific/Majuro' },
  629. { text: '(GMT+12:00) Moscow+09 - Petropavlovsk-Kamchatskiy', value: 'Asia/Kamchatka' },
  630. { text: '(GMT+12:00) Nauru', value: 'Pacific/Nauru' },
  631. { text: '(GMT+12:00) Tarawa', value: 'Pacific/Tarawa' },
  632. { text: '(GMT+12:00) Wake', value: 'Pacific/Wake' },
  633. { text: '(GMT+12:00) Wallis', value: 'Pacific/Wallis' },
  634. { text: '(GMT+13:00) Auckland', value: 'Pacific/Auckland' },
  635. { text: '(GMT+13:00) Enderbury', value: 'Pacific/Enderbury' },
  636. { text: '(GMT+13:00) Fakaofo', value: 'Pacific/Fakaofo' },
  637. { text: '(GMT+13:00) Fiji', value: 'Pacific/Fiji' },
  638. { text: '(GMT+13:00) Tongatapu', value: 'Pacific/Tongatapu' },
  639. { text: '(GMT+14:00) Apia', value: 'Pacific/Apia' },
  640. { text: '(GMT+14:00) Kiritimati', value: 'Pacific/Kiritimati' }
  641. ]
  642. }
  643. },
  644. computed: {
  645. currentUserId: get('user/id')
  646. },
  647. methods: {
  648. /**
  649. * Activate a user (if previously deactivated)
  650. */
  651. async activateUser () {
  652. this.$store.commit(`loadingStart`, 'admin-users-activate')
  653. const resp = await this.$apollo.mutate({
  654. mutation: gql`
  655. mutation ($id: Int!) {
  656. users {
  657. activate(id: $id) {
  658. responseResult {
  659. succeeded
  660. errorCode
  661. slug
  662. message
  663. }
  664. }
  665. }
  666. }
  667. `,
  668. variables: {
  669. id: this.user.id
  670. }
  671. })
  672. if (_.get(resp, 'data.users.activate.responseResult.succeeded', false)) {
  673. this.$store.commit('showNotification', {
  674. style: 'success',
  675. message: this.$t('admin:users.userActivateSuccess'),
  676. icon: 'check'
  677. })
  678. this.user.isActive = true
  679. } else {
  680. this.$store.commit('showNotification', {
  681. style: 'red',
  682. message: _.get(resp, 'data.users.activate.responseResult.message', 'An unexpected error occured.'),
  683. icon: 'warning'
  684. })
  685. }
  686. this.$store.commit(`loadingStop`, 'admin-users-activate')
  687. },
  688. /**
  689. * Deactivate a currently active user
  690. */
  691. async deactivateUser () {
  692. this.$store.commit(`loadingStart`, 'admin-users-deactivate')
  693. const resp = await this.$apollo.mutate({
  694. mutation: gql`
  695. mutation ($id: Int!) {
  696. users {
  697. deactivate(id: $id) {
  698. responseResult {
  699. succeeded
  700. errorCode
  701. slug
  702. message
  703. }
  704. }
  705. }
  706. }
  707. `,
  708. variables: {
  709. id: this.user.id
  710. }
  711. })
  712. if (_.get(resp, 'data.users.deactivate.responseResult.succeeded', false)) {
  713. this.$store.commit('showNotification', {
  714. style: 'success',
  715. message: this.$t('admin:users.userDeactivateSuccess'),
  716. icon: 'check'
  717. })
  718. this.user.isActive = false
  719. } else {
  720. this.$store.commit('showNotification', {
  721. style: 'red',
  722. message: _.get(resp, 'data.users.deactivate.responseResult.message', 'An unexpected error occured.'),
  723. icon: 'warning'
  724. })
  725. }
  726. this.$store.commit(`loadingStop`, 'admin-users-deactivate')
  727. },
  728. /**
  729. * Delete a user
  730. */
  731. async deleteUser () {
  732. this.$store.commit(`loadingStart`, 'admin-users-delete')
  733. const resp = await this.$apollo.mutate({
  734. mutation: gql`
  735. mutation ($id: Int!) {
  736. users {
  737. delete(id: $id) {
  738. responseResult {
  739. succeeded
  740. errorCode
  741. slug
  742. message
  743. }
  744. }
  745. }
  746. }
  747. `,
  748. variables: {
  749. id: this.user.id
  750. }
  751. })
  752. if (_.get(resp, 'data.users.delete.responseResult.succeeded', false)) {
  753. this.$store.commit('showNotification', {
  754. style: 'success',
  755. message: this.$t('admin:users.userDeleteSuccess'),
  756. icon: 'check'
  757. })
  758. this.$router.push('/users')
  759. } else {
  760. this.$store.commit('showNotification', {
  761. style: 'red',
  762. message: _.get(resp, 'data.users.delete.responseResult.message', 'An unexpected error occured.'),
  763. icon: 'warning'
  764. })
  765. }
  766. this.deleteUserDialog = false
  767. this.$store.commit(`loadingStop`, 'admin-users-delete')
  768. },
  769. /**
  770. * Update a user
  771. */
  772. async updateUser() {
  773. this.$store.commit(`loadingStart`, 'admin-users-update')
  774. const resp = await this.$apollo.mutate({
  775. mutation: gql`
  776. mutation ($id: Int!, $email: String, $name: String, $newPassword: String, $groups: [Int], $location: String, $jobTitle: String, $timezone: String) {
  777. users {
  778. update(id: $id, email: $email, name: $name, newPassword: $newPassword, groups: $groups, location: $location, jobTitle: $jobTitle, timezone: $timezone) {
  779. responseResult {
  780. succeeded
  781. errorCode
  782. slug
  783. message
  784. }
  785. }
  786. }
  787. }
  788. `,
  789. variables: {
  790. id: this.user.id,
  791. email: this.user.email,
  792. name: this.user.name,
  793. newPassword: this.newPassword,
  794. groups: _.map(this.user.groups, 'id'),
  795. location: this.user.location,
  796. jobTitle: this.user.jobTitle,
  797. timezone: this.user.timezone
  798. }
  799. })
  800. this.newPassword = ''
  801. if (_.get(resp, 'data.users.update.responseResult.succeeded', false)) {
  802. this.$store.commit('showNotification', {
  803. style: 'success',
  804. message: this.$t('admin:users.userUpdateSuccess'),
  805. icon: 'check'
  806. })
  807. this.$router.push('/users')
  808. } else {
  809. this.$store.commit('showNotification', {
  810. style: 'red',
  811. message: _.get(resp, 'data.users.update.responseResult.message', 'An unexpected error occured.'),
  812. icon: 'warning'
  813. })
  814. }
  815. this.$store.commit(`loadingStop`, 'admin-users-update')
  816. },
  817. /**
  818. * Focus an input after delay
  819. */
  820. focusField (ipt) {
  821. this.$nextTick(() => {
  822. _.delay(() => {
  823. this.$refs[ipt].focus()
  824. }, 200)
  825. })
  826. },
  827. /**
  828. * Assign group to user
  829. */
  830. assignGroup() {
  831. if (_.some(this.user.groups, ['id', this.newGroup])) {
  832. this.$store.commit('showNotification', {
  833. message: this.$t('admin:users.userAlreadyAssignedToGroup'),
  834. style: 'error',
  835. icon: 'alert'
  836. })
  837. } else {
  838. this.user.groups.push(_.find(this.groups, ['id', this.newGroup]))
  839. this.newGroup = 0
  840. }
  841. },
  842. /**
  843. * Unassign group from user
  844. */
  845. unassignGroup(gid) {
  846. this.user.groups = _.reject(this.user.groups, ['id', gid])
  847. },
  848. /**
  849. * Manually set user as verified
  850. */
  851. async verifyUser () {
  852. this.$store.commit(`loadingStart`, 'admin-users-verify')
  853. const resp = await this.$apollo.mutate({
  854. mutation: gql`
  855. mutation ($id: Int!) {
  856. users {
  857. verify(id: $id) {
  858. responseResult {
  859. succeeded
  860. errorCode
  861. slug
  862. message
  863. }
  864. }
  865. }
  866. }
  867. `,
  868. variables: {
  869. id: this.user.id
  870. }
  871. })
  872. if (_.get(resp, 'data.users.verify.responseResult.succeeded', false)) {
  873. this.$store.commit('showNotification', {
  874. style: 'success',
  875. message: this.$t('admin:users.userVerifySuccess'),
  876. icon: 'check'
  877. })
  878. this.user.isVerified = true
  879. } else {
  880. this.$store.commit('showNotification', {
  881. style: 'red',
  882. message: _.get(resp, 'data.users.verify.responseResult.message', 'An unexpected error occured.'),
  883. icon: 'warning'
  884. })
  885. }
  886. this.$store.commit(`loadingStop`, 'admin-users-verify')
  887. }
  888. },
  889. apollo: {
  890. user: {
  891. query: gql`
  892. query ($id: Int!) {
  893. users {
  894. single(id: $id) {
  895. id
  896. name
  897. email
  898. providerKey
  899. providerId
  900. location
  901. jobTitle
  902. timezone
  903. isSystem
  904. isActive
  905. isVerified
  906. createdAt
  907. updatedAt
  908. lastLoginAt
  909. groups {
  910. id
  911. name
  912. }
  913. }
  914. }
  915. }
  916. `,
  917. variables() {
  918. return {
  919. id: _.toSafeInteger(this.$route.params.id)
  920. }
  921. },
  922. fetchPolicy: 'network-only',
  923. update: (data) => data.users.single,
  924. watchLoading (isLoading) {
  925. this.$store.commit(`loading${isLoading ? 'Start' : 'Stop'}`, 'admin-users-refresh')
  926. }
  927. },
  928. groups: {
  929. query: groupsQuery,
  930. fetchPolicy: 'network-only',
  931. update: (data) => data.groups.list,
  932. watchLoading (isLoading) {
  933. this.$store.commit(`loading${isLoading ? 'Start' : 'Stop'}`, 'admin-groups-refresh')
  934. }
  935. }
  936. }
  937. }
  938. </script>
  939. <style lang='scss'>
  940. </style>