diff --git a/changelog/entries/unreleased/feature/3251_builder_display_a_count_of_user_source_users_in_the_applicat.json b/changelog/entries/unreleased/feature/3251_builder_display_a_count_of_user_source_users_in_the_applicat.json new file mode 100644 index 000000000..33e357b9a --- /dev/null +++ b/changelog/entries/unreleased/feature/3251_builder_display_a_count_of_user_source_users_in_the_applicat.json @@ -0,0 +1,7 @@ +{ + "type": "feature", + "message": "[Builder] Display a count of user source users in the application settings panel.", + "issue_number": 3251, + "bullet_points": [], + "created_at": "2024-12-10" +} \ No newline at end of file diff --git a/enterprise/web-frontend/modules/baserow_enterprise/integrations/common/components/CommonSamlSettingModal.vue b/enterprise/web-frontend/modules/baserow_enterprise/integrations/common/components/CommonSamlSettingModal.vue index 6d56d95d4..d945ecf41 100644 --- a/enterprise/web-frontend/modules/baserow_enterprise/integrations/common/components/CommonSamlSettingModal.vue +++ b/enterprise/web-frontend/modules/baserow_enterprise/integrations/common/components/CommonSamlSettingModal.vue @@ -107,12 +107,6 @@ export default { this.handleError(error) } }, - watch: { - '$v.$anyDirty'() { - // Force validity refresh on child touch - this.checkValidity() - }, - }, computed: { ...mapGetters({ domains: 'domain/getDomains' }), config() { @@ -134,6 +128,12 @@ export default { return [...preview, ...others] }, }, + watch: { + '$v.$anyDirty'() { + // Force validity refresh on child touch + this.checkValidity() + }, + }, methods: { ...mapActions({ actionFetchDomains: 'domain/fetch', diff --git a/enterprise/web-frontend/modules/baserow_enterprise/integrations/userSourceTypes.js b/enterprise/web-frontend/modules/baserow_enterprise/integrations/userSourceTypes.js index 2f35e2ba4..7784acd44 100644 --- a/enterprise/web-frontend/modules/baserow_enterprise/integrations/userSourceTypes.js +++ b/enterprise/web-frontend/modules/baserow_enterprise/integrations/userSourceTypes.js @@ -2,6 +2,7 @@ import { UserSourceType } from '@baserow/modules/core/userSourceTypes' import { LocalBaserowIntegrationType } from '@baserow/modules/integrations/integrationTypes' import LocalBaserowUserSourceForm from '@baserow_enterprise/integrations/localBaserow/components/userSources/LocalBaserowUserSourceForm' import localBaserowIntegration from '@baserow/modules/integrations/localBaserow/assets/images/localBaserowIntegration.svg' +import moment from '@baserow/modules/core/moment' import { FormulaFieldType, @@ -86,27 +87,33 @@ export class LocalBaserowUserSourceType extends UserSourceType { return this.app.i18n.t('localBaserowUserSourceType.notConfigured') } - if (!userSource.table_id) { + const databases = integration.context_data?.databases + + const tableSelected = databases + .map((database) => database.tables) + .flat() + .find(({ id }) => id === userSource.table_id) + + if (!tableSelected) { return `${integration.name} - ${this.app.i18n.t( 'localBaserowUserSourceType.notConfigured' )}` } - for (const database of integration.context_data.databases) { - for (const table of database.tables) { - if (table.id === userSource.table_id) { - const summaryParts = [integration.name, table.name] - if (!userSource.email_field_id || !userSource.name_field_id) { - summaryParts.push( - this.app.i18n.t('localBaserowUserSourceType.notConfigured') - ) - } - return summaryParts.join(' - ') - } - } + const summaryParts = [integration.name, tableSelected.name] + if (!userSource.email_field_id || !userSource.name_field_id) { + summaryParts.push( + this.app.i18n.t('localBaserowUserSourceType.notConfigured') + ) + } else if (userSource.user_count_updated_at !== null) { + summaryParts.push( + this.app.i18n.t('userSourceType.userCountSummary', { + count: userSource.user_count, + lastUpdated: moment.utc(userSource.user_count_updated_at).fromNow(), + }) + ) } - - return '' + return summaryParts.join(' - ') } get formComponent() { diff --git a/web-frontend/modules/builder/locales/en.json b/web-frontend/modules/builder/locales/en.json index b83a4e05c..3bb56d6bc 100644 --- a/web-frontend/modules/builder/locales/en.json +++ b/web-frontend/modules/builder/locales/en.json @@ -257,7 +257,7 @@ "userSourceSettings": { "titleAddUserSource": "New user source", "titleUpdateUserSource": "Edit user source", - "noUserSourceMessage": "You have not yet add a user source to this application. You must add a user source if you want users being able to authenticate your application.", + "noUserSourceMessage": "You have not yet added a user source to this application. You must add a user source if you want users being able to authenticate your application.", "titleOverview": "User sources", "addUserSource": "Add user source" }, diff --git a/web-frontend/modules/core/locales/en.json b/web-frontend/modules/core/locales/en.json index bfcb44e0c..5ab500a4f 100644 --- a/web-frontend/modules/core/locales/en.json +++ b/web-frontend/modules/core/locales/en.json @@ -806,5 +806,8 @@ "formGroup": { "protectedField": "This field is protected. Click to change.", "cancelProtectedField": "Cancel change" + }, + "userSourceType": { + "userCountSummary": "{count} users ({lastUpdated})" } }