OpenIdCreate.vue 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <template>
  2. <base-dialog @cancel="cancelDialog">
  3. <div slot="header">{{this.params.title}}</div>
  4. <div slot="body" v-loading="loading">
  5. <a-form :form="form.fc" v-bind="formItemLayout">
  6. <a-form-item :label="$t('common_633')">
  7. <a-input :placeholder="$t('common_634')" v-decorator="decorators.redirect_uri" />
  8. </a-form-item>
  9. </a-form>
  10. </div>
  11. <div slot="footer">
  12. <a-button type="primary" @click="handleConfirm">{{ $t("dialog.ok") }}</a-button>
  13. <a-button @click="cancelDialog">{{ $t('dialog.cancel') }}</a-button>
  14. </div>
  15. </base-dialog>
  16. </template>
  17. <script>
  18. import DialogMixin from '@/mixins/dialog'
  19. import WindowsMixin from '@/mixins/windows'
  20. export default {
  21. name: 'CredentialOpendIdCreate',
  22. mixins: [DialogMixin, WindowsMixin],
  23. data () {
  24. return {
  25. loading: false,
  26. form: {
  27. fc: this.$form.createForm(this),
  28. },
  29. formItemLayout: {
  30. wrapperCol: {
  31. span: 19,
  32. },
  33. labelCol: {
  34. span: 5,
  35. },
  36. },
  37. decorators: {
  38. redirect_uri: [
  39. 'redirect_uri',
  40. {
  41. validateFirst: true,
  42. rules: [
  43. { required: true, message: this.$t('common_634') },
  44. { validator: this.$validate('url') },
  45. ],
  46. },
  47. ],
  48. },
  49. }
  50. },
  51. destroyed () {
  52. this.manager = null
  53. },
  54. created () {
  55. this.manager = new this.$Manager('rpc/credentials', 'v1')
  56. },
  57. methods: {
  58. async handleConfirm () {
  59. try {
  60. const values = await this.form.fc.validateFields()
  61. await this.manager.performClassAction({
  62. action: 'create-oidc-secret',
  63. data: values,
  64. })
  65. this.params.refresh()
  66. this.cancelDialog()
  67. } catch (err) {
  68. throw err
  69. }
  70. },
  71. },
  72. }
  73. </script>