1
0
Fork 0
mirror of https://gitlab.com/bramw/baserow.git synced 2025-04-14 00:59:06 +00:00

Resolve "Charge for user source users: display the count in the application settings user sources panel."

This commit is contained in:
Peter Evans 2024-12-10 15:53:07 +00:00
parent a1b7ee4790
commit c1940ad656
5 changed files with 39 additions and 22 deletions
changelog/entries/unreleased/feature
enterprise/web-frontend/modules/baserow_enterprise/integrations
web-frontend/modules
builder/locales
core/locales

View file

@ -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"
}

View file

@ -107,12 +107,6 @@ export default {
this.handleError(error) this.handleError(error)
} }
}, },
watch: {
'$v.$anyDirty'() {
// Force validity refresh on child touch
this.checkValidity()
},
},
computed: { computed: {
...mapGetters({ domains: 'domain/getDomains' }), ...mapGetters({ domains: 'domain/getDomains' }),
config() { config() {
@ -134,6 +128,12 @@ export default {
return [...preview, ...others] return [...preview, ...others]
}, },
}, },
watch: {
'$v.$anyDirty'() {
// Force validity refresh on child touch
this.checkValidity()
},
},
methods: { methods: {
...mapActions({ ...mapActions({
actionFetchDomains: 'domain/fetch', actionFetchDomains: 'domain/fetch',

View file

@ -2,6 +2,7 @@ import { UserSourceType } from '@baserow/modules/core/userSourceTypes'
import { LocalBaserowIntegrationType } from '@baserow/modules/integrations/integrationTypes' import { LocalBaserowIntegrationType } from '@baserow/modules/integrations/integrationTypes'
import LocalBaserowUserSourceForm from '@baserow_enterprise/integrations/localBaserow/components/userSources/LocalBaserowUserSourceForm' import LocalBaserowUserSourceForm from '@baserow_enterprise/integrations/localBaserow/components/userSources/LocalBaserowUserSourceForm'
import localBaserowIntegration from '@baserow/modules/integrations/localBaserow/assets/images/localBaserowIntegration.svg' import localBaserowIntegration from '@baserow/modules/integrations/localBaserow/assets/images/localBaserowIntegration.svg'
import moment from '@baserow/modules/core/moment'
import { import {
FormulaFieldType, FormulaFieldType,
@ -86,27 +87,33 @@ export class LocalBaserowUserSourceType extends UserSourceType {
return this.app.i18n.t('localBaserowUserSourceType.notConfigured') 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( return `${integration.name} - ${this.app.i18n.t(
'localBaserowUserSourceType.notConfigured' 'localBaserowUserSourceType.notConfigured'
)}` )}`
} }
for (const database of integration.context_data.databases) { const summaryParts = [integration.name, tableSelected.name]
for (const table of database.tables) { if (!userSource.email_field_id || !userSource.name_field_id) {
if (table.id === userSource.table_id) { summaryParts.push(
const summaryParts = [integration.name, table.name] this.app.i18n.t('localBaserowUserSourceType.notConfigured')
if (!userSource.email_field_id || !userSource.name_field_id) { )
summaryParts.push( } else if (userSource.user_count_updated_at !== null) {
this.app.i18n.t('localBaserowUserSourceType.notConfigured') summaryParts.push(
) this.app.i18n.t('userSourceType.userCountSummary', {
} count: userSource.user_count,
return summaryParts.join(' - ') lastUpdated: moment.utc(userSource.user_count_updated_at).fromNow(),
} })
} )
} }
return summaryParts.join(' - ')
return ''
} }
get formComponent() { get formComponent() {

View file

@ -257,7 +257,7 @@
"userSourceSettings": { "userSourceSettings": {
"titleAddUserSource": "New user source", "titleAddUserSource": "New user source",
"titleUpdateUserSource": "Edit 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", "titleOverview": "User sources",
"addUserSource": "Add user source" "addUserSource": "Add user source"
}, },

View file

@ -806,5 +806,8 @@
"formGroup": { "formGroup": {
"protectedField": "This field is protected. Click to change.", "protectedField": "This field is protected. Click to change.",
"cancelProtectedField": "Cancel change" "cancelProtectedField": "Cancel change"
},
"userSourceType": {
"userCountSummary": "{count} users ({lastUpdated})"
} }
} }