admin-users-authorize.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <template lang="pug">
  2. v-dialog(v-model='isShown', max-width='550')
  3. v-card
  4. .dialog-header.is-short Authorize Social User
  5. v-card-text
  6. v-select.md2(
  7. :items='providers'
  8. item-text='title'
  9. item-value='key'
  10. solo
  11. flat
  12. background-color='grey lighten-4'
  13. prepend-icon='business'
  14. v-model='provider'
  15. label='Provider'
  16. )
  17. v-text-field.md2(
  18. solo
  19. flat
  20. background-color='grey lighten-4'
  21. prepend-icon='email'
  22. v-model='email'
  23. label='Email Address'
  24. ref='emailInput'
  25. )
  26. v-text-field.md2(
  27. solo
  28. flat
  29. background-color='grey lighten-4'
  30. prepend-icon='person'
  31. v-model='name'
  32. label='Name'
  33. )
  34. v-text-field.md2(
  35. solo
  36. flat
  37. background-color='grey lighten-4'
  38. prepend-icon='title'
  39. v-model='jobTitle'
  40. label='Job Title'
  41. counter='255'
  42. hint='Optional'
  43. persistent-hint
  44. )
  45. v-text-field.md2(
  46. solo
  47. flat
  48. background-color='grey lighten-4'
  49. prepend-icon='public'
  50. v-model='location'
  51. label='Location'
  52. counter='255'
  53. hint='Optional'
  54. persistent-hint
  55. )
  56. v-card-chin
  57. v-spacer
  58. v-btn(flat, @click='isShown = false') Cancel
  59. v-btn(color='primary', @click='authorizeUser') Authorize
  60. </template>
  61. <script>
  62. import _ from 'lodash'
  63. import providersQuery from 'gql/admin/users/users-query-strategies.gql'
  64. export default {
  65. props: {
  66. value: {
  67. type: Boolean,
  68. default: false
  69. }
  70. },
  71. data() {
  72. return {
  73. providers: [],
  74. provider: '',
  75. email: '',
  76. name: '',
  77. jobTitle: '',
  78. location: ''
  79. }
  80. },
  81. computed: {
  82. isShown: {
  83. get() { return this.value },
  84. set(val) { this.$emit('input', val) }
  85. }
  86. },
  87. watch: {
  88. value(newValue, oldValue) {
  89. if (newValue) {
  90. this.$nextTick(() => {
  91. this.$refs.emailInput.focus()
  92. })
  93. }
  94. }
  95. },
  96. methods: {
  97. async authorizeUser() {
  98. }
  99. },
  100. apollo: {
  101. providers: {
  102. query: providersQuery,
  103. fetchPolicy: 'network-only',
  104. update: (data) => _.reject(data.authentication.strategies, ['key', 'local']),
  105. watchLoading (isLoading) {
  106. this.$store.commit(`loading${isLoading ? 'Start' : 'Stop'}`, 'admin-users-strategies-refresh')
  107. }
  108. }
  109. }
  110. }
  111. </script>