diff --git a/client/web/admin/src/components/Authclient/CAuthclientEditorInfo.vue b/client/web/admin/src/components/Authclient/CAuthclientEditorInfo.vue index 7dc8562193..7d98c588d1 100644 --- a/client/web/admin/src/components/Authclient/CAuthclientEditorInfo.vue +++ b/client/web/admin/src/components/Authclient/CAuthclientEditorInfo.vue @@ -147,25 +147,19 @@ label-cols="3" :description="$t('validFrom.description')" > - - - - - + @@ -173,7 +167,7 @@ :icon="['fas', 'sync']" /> - + - - - - - + @@ -208,7 +196,7 @@ :icon="['fas', 'sync']" /> - + import { NoID } from '@cortezaproject/corteza-js' -import { handle } from '@cortezaproject/corteza-vue' +import { handle, components } from '@cortezaproject/corteza-vue' import ConfirmationToggle from 'corteza-webapp-admin/src/components/ConfirmationToggle' import CSubmitButton from 'corteza-webapp-admin/src/components/CSubmitButton' import CRolePicker from 'corteza-webapp-admin/src/components/CRolePicker' @@ -518,6 +506,8 @@ import CSelectUser from 'corteza-webapp-admin/src/components/Authclient/CSelectU import copy from 'copy-to-clipboard' import axios from 'axios' +const { CInputDateTime } = components + export default { name: 'CAuthclientEditorInfo', @@ -531,6 +521,7 @@ export default { CSubmitButton, CRolePicker, CSelectUser, + CInputDateTime, }, props: { @@ -579,60 +570,6 @@ export default { }, computed: { - validFromDate: { - get () { - return this.resource.validFrom - ? new Date(this.resource.validFrom).toISOString().split('T')[0] - : null - }, - - set (validFromDate) { - this.resource.validFrom = validFromDate - }, - }, - - validFromTime: { - get () { - return this.resource.validFrom - ? new Date(this.resource.validFrom).toTimeString().split(' ')[0] - : null - }, - - set (validFromTime) { - const date = this.validFromDate || this.resource.validFrom.toISOString().split('T')[0] - this.resource.validFrom = this.resource.validFrom - ? new Date(`${date} ${this.validFromTime}`).toISOString() - : null - }, - }, - - expiresAtDate: { - get () { - return this.resource.expiresAt - ? new Date(this.resource.expiresAt).toISOString().split('T')[0] - : null - }, - - set (expiresAtDate) { - this.resource.expiresAt = expiresAtDate - }, - }, - - expiresAtTime: { - get () { - return this.resource.expiresAt - ? new Date(this.resource.expiresAt).toTimeString().split(' ')[0] - : null - }, - - set (expiresAtTime) { - const date = this.expiresAtDate || this.resource.validFrom.toISOString().split('T')[0] - this.resource.expiresAt = this.resource.expiresAt - ? new Date(`${date} ${this.expiresAtTime}`).toISOString() - : null - }, - }, - fresh () { return !this.resource.authClientID || this.resource.authClientID === NoID }, @@ -714,22 +651,10 @@ export default { }, submit () { - if (this.validFromDate && this.validFromTime) { - this.resource.validFrom = new Date(`${this.validFromDate} ${this.validFromTime}`).toISOString() - } else { - this.resource.validFrom = undefined - } - if (!this.isClientCredentialsGrant || !this.resource.security.impersonateUser) { this.resource.security.impersonateUser = '0' } - if (this.expiresAtDate && this.expiresAtTime) { - this.resource.expiresAt = new Date(`${this.expiresAtDate} ${this.expiresAtTime}`).toISOString() - } else { - this.resource.expiresAt = undefined - } - this.$emit('submit', this.resource) }, diff --git a/lib/vue/src/components/input/CInputDateTime/index.vue b/lib/vue/src/components/input/CInputDateTime/index.vue index 45ce69b2e6..e4479d9fd9 100644 --- a/lib/vue/src/components/input/CInputDateTime/index.vue +++ b/lib/vue/src/components/input/CInputDateTime/index.vue @@ -32,6 +32,8 @@ now-button class="h-100 overflow-hidden" /> + +