mirror of
https://github.com/baserow/baserow.git
synced 2026-12-04 16:28:31 +00:00
* Add ADR-013 for workspace level integrations * Add implementation * Improve context section and remove technical points * Move bulk replacement point to v2 * Remove workspace-level ownership on import since manual promotion should handle this. * Add a glossary section * Do Lazy creation + Celery migration * Remove demotion * Tighten the Options considered section * Add Decision describing where the integrations are managed * Update implementation plan after changes to ADR * Sync plan and adr * Rename adr and implementation * Add the shared application that owns workspace integrations * Create the shared application of every workspace * Let only workspace admins manage workspace integrations * Let applications use the integrations of their workspace. * Trash workspace integrations in their workspace. * Copy workspace integrations into exports and keep them in duplicates. * Workspace admins can share integrations with every application in the workspace. * Load the shared application of each workspace in the frontend and keep it out of application lists. * Manage workspace integrations from an Integrations page in workspace settings. * Offer workspace integrations in the integration dropdowns of every application. * Move promoted integrations to the workspace list in other open tabs. * Let admins make an app's integration available to the whole workspace from its integration settings. * Preselect a workspace integration for new nodes and data sources when the app has none of its own. * fix tests * Delete implementation file * More fixes after rebase * Fix tests * Let builders of an application see and use the workspace integrations from it. * Show the workspace integrations, read-only, in the integration settings of applications. * Keep a dashboard's integration out of promotion to the workspace. * Leave the shared applications out of the admin dashboard's application count. * Create the shared application of the workspaces made by the fill commands. * Say in the promotion modal that an integration nobody authorized will run as the promoting admin. * Say in the promotion modal that undoing it won't make the integration run as the previous person again. * Ignore integration ids in sample data when publishing copies the workspace integrations an app uses. * Let only undoing a promotion move an integration out of the workspace. * Let the shared application backfill stop itself after 5 minutes and skip workspaces another transaction has locked. * Say in the workspace integrations settings that published applications and workflows keep their own copy until they're published again. * Leave the shared application out of the assistant evals' application counts. * Refresh the workspace integrations when the Builder's data, events, users and integrations panels open. * Say that anything new using a promoted integration blocks undoing the promotion, even from its own application. * Warn when a database button sends through a workspace integration with no host or token. * Refuse roles and invitations on the shared application. * Fix tests * Show an application only the workspace integrations of types it can use. * Say in the promotion modal what builders of other applications can do as the integration. * Leave the shared application type out of the API docs for creating and updating applications. * Check who receives a workspace integration event in one permission call. * Say which workspaces have a shared application and who creates it. * Let a redone promotion record what uses the integration again. * Update docstrings * Stop template visitors from listing the integrations of the template's workspace. * Let database buttons find their own copy of a workspace integration after an import. * Say what holds the workspace row lock while a shared application is created. * Fix tests * Stop the workspace integration form component from being made reactive. * Make test runs use a new copy of the workflow after an integration it uses changes. * Hide the Members settings tab from members who can't list the workspace members. * Add changelog * Fix migration conflict * Fix migration conflict * Fix test * Update comments and ADR number * Link to the workspace integrations from the sidebar's Settings menu. * fix: refresh agent action errors when workspace integrations change * fix: move workspace integrations into workspace settings * fix: use share icon for workspace integration promotion * refactor: use explicit shared application relations * feat: centralize default integration selection * refactor: share integration change notifications * refactor: prepare integration mappings before import * refactor: collect integration references during export * refactor: prepare integration ownership changes without a new hook * test: restore registered service model after mocking * test: cover shared integration defaults in Builder * test: include Slack in Agent workspace integration choices * Fix migrations * Stop template visitors from listing the workspace integrations through an application of the template. * Only offer integrations of the user source's integration type when updating a user source. * Say the workspace integration copy means published Application Builder apps and automation workflows. * Use the same spacing under both integration settings sections and enlarge their headings. * Keep the shared application out of automatic snapshot schedules. * Fix test after rebase --------- Co-authored-by: Jeremie Pardou <571533+jrmi@users.noreply.github.com>
242 lines
7.2 KiB
Vue
242 lines
7.2 KiB
Vue
<template>
|
|
<!-- Show user source list -->
|
|
<div
|
|
v-if="!showForm && editedUserSource === null"
|
|
class="user-sources-settings"
|
|
>
|
|
<h2 class="box__title">{{ $t('userSourceSettings.titleOverview') }}</h2>
|
|
<Error :error="error"></Error>
|
|
<div v-if="!error.visible" class="actions actions--right">
|
|
<Button icon="iconoir-plus" @click="displayForm()">
|
|
{{ $t('userSourceSettings.addUserSource') }}
|
|
</Button>
|
|
</div>
|
|
<div
|
|
v-for="userSource in userSources"
|
|
:key="userSource.id"
|
|
class="user-source-settings__user-source"
|
|
@delete="deleteUserSource(userSource)"
|
|
>
|
|
<Presentation
|
|
:image="getUserSourceType(userSource).image"
|
|
:title="userSource.name"
|
|
:subtitle="getUserSourceType(userSource).getSummary(userSource)"
|
|
:rounded-icon="false"
|
|
avatar-color="transparent"
|
|
style="flex: 1"
|
|
/>
|
|
<div class="user-source-settings__user-source-actions">
|
|
<ButtonIcon icon="iconoir-edit" @click="displayForm(userSource)" />
|
|
<ButtonIcon icon="iconoir-bin" @click="deleteUserSource(userSource)" />
|
|
</div>
|
|
</div>
|
|
<p v-if="!error.visible && userSources.length === 0" class="margin-top-3">
|
|
{{ $t('userSourceSettings.noUserSourceMessage') }}
|
|
</p>
|
|
</div>
|
|
<!-- Edit user source -->
|
|
<div v-else-if="editedUserSource">
|
|
<h2 class="box__title">
|
|
{{ $t('userSourceSettings.titleUpdateUserSource') }}
|
|
</h2>
|
|
<Error :error="error"></Error>
|
|
|
|
<Presentation
|
|
:image="getUserSourceType(editedUserSource).image"
|
|
:title="getUserSourceType(editedUserSource).name"
|
|
:rounded-icon="false"
|
|
avatar-color="transparent"
|
|
style="flex: 1; margin-bottom: 18px"
|
|
icon-size="medium"
|
|
/>
|
|
<UpdateUserSourceForm
|
|
ref="userSourceForm"
|
|
:builder="builder"
|
|
:user-source-type="getUserSourceType(editedUserSource)"
|
|
:default-values="editedUserSource"
|
|
@submitted="updateUserSource"
|
|
@values-changed="onValueChange"
|
|
/>
|
|
|
|
<div class="actions">
|
|
<ButtonText
|
|
type="secondary"
|
|
icon="iconoir-nav-arrow-left"
|
|
@click="editedUserSource = null"
|
|
>
|
|
{{ $t('action.back') }}
|
|
</ButtonText>
|
|
<Button
|
|
:disabled="actionInProgress || invalidForm"
|
|
:loading="actionInProgress"
|
|
size="large"
|
|
@click="$refs.userSourceForm.submit(true)"
|
|
>
|
|
{{ $t('action.save') }}
|
|
</Button>
|
|
</div>
|
|
</div>
|
|
<!-- Create user source -->
|
|
<div v-else>
|
|
<h2 class="box__title">
|
|
{{ $t('userSourceSettings.titleAddUserSource') }}
|
|
</h2>
|
|
<Error :error="error"></Error>
|
|
<CreateUserSourceForm
|
|
ref="userSourceForm"
|
|
:builder="builder"
|
|
@submitted="createUserSource"
|
|
@values-changed="onValueChange"
|
|
/>
|
|
<div class="actions">
|
|
<ButtonText
|
|
type="secondary"
|
|
icon="iconoir-nav-arrow-left"
|
|
@click="hideForm"
|
|
>
|
|
{{ $t('action.back') }}
|
|
</ButtonText>
|
|
|
|
<Button
|
|
:disabled="actionInProgress || invalidForm"
|
|
:loading="actionInProgress"
|
|
size="large"
|
|
@click="$refs.userSourceForm.submit()"
|
|
>
|
|
{{ $t('action.create') }}
|
|
</Button>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import { mapActions } from 'vuex'
|
|
import error from '@baserow/modules/core/mixins/error'
|
|
import { clone } from '@baserow/modules/core/utils/object'
|
|
import { notifyIf } from '@baserow/modules/core/utils/error'
|
|
import CreateUserSourceForm from '@baserow/modules/builder/components/userSource/CreateUserSourceForm'
|
|
import UpdateUserSourceForm from '@baserow/modules/builder/components/userSource/UpdateUserSourceForm'
|
|
import builderSetting from '@baserow/modules/builder/components/settings/mixins/builderSetting'
|
|
|
|
export default {
|
|
name: 'UserSourceSettings',
|
|
components: { CreateUserSourceForm, UpdateUserSourceForm },
|
|
mixins: [error, builderSetting],
|
|
provide() {
|
|
return { builder: this.builder }
|
|
},
|
|
data() {
|
|
return {
|
|
showForm: false,
|
|
editedUserSource: null,
|
|
actionInProgress: false,
|
|
invalidForm: true,
|
|
}
|
|
},
|
|
computed: {
|
|
integrations() {
|
|
return this.$store.getters['integration/getIntegrations'](this.builder)
|
|
},
|
|
userSources() {
|
|
return this.$store.getters['userSource/getUserSources'](this.builder)
|
|
},
|
|
},
|
|
async mounted() {
|
|
try {
|
|
await this.actionFetchIntegrations({
|
|
application: this.builder,
|
|
})
|
|
// We load the domains here because some providers might use them
|
|
await this.actionFetchDomains({ builderId: this.builder.id })
|
|
} catch (error) {
|
|
notifyIf(error)
|
|
}
|
|
},
|
|
methods: {
|
|
...mapActions({
|
|
actionFetchIntegrations: 'integration/fetchUsable',
|
|
actionCreateUserSource: 'userSource/create',
|
|
actionUpdateUserSource: 'userSource/update',
|
|
actionDeleteUserSource: 'userSource/delete',
|
|
actionFetchDomains: 'domain/fetch',
|
|
}),
|
|
getUserSourceType(userSource) {
|
|
return this.$registry.get('userSource', userSource.type)
|
|
},
|
|
onValueChange() {
|
|
this.invalidForm = !this.$refs.userSourceForm?.isFormValid()
|
|
},
|
|
async displayForm(userSourceToEdit) {
|
|
if (userSourceToEdit) {
|
|
this.editedUserSource = userSourceToEdit
|
|
} else {
|
|
this.showForm = true
|
|
}
|
|
await this.$nextTick()
|
|
this.onValueChange()
|
|
},
|
|
hideForm() {
|
|
this.showForm = false
|
|
this.editedUserSource = null
|
|
this.hideError()
|
|
this.invalidForm = true
|
|
},
|
|
async createUserSource(values) {
|
|
this.actionInProgress = true
|
|
const { type, ...rest } = values
|
|
try {
|
|
const createdUserSource = await this.actionCreateUserSource({
|
|
application: this.builder,
|
|
userSourceType: type,
|
|
values: rest,
|
|
})
|
|
|
|
this.hideForm()
|
|
// immediately select this user source to edit it.
|
|
this.editedUserSource = createdUserSource
|
|
} catch (error) {
|
|
this.handleError(error)
|
|
}
|
|
this.actionInProgress = false
|
|
},
|
|
async updateUserSource(newValues) {
|
|
if (!this.$refs.userSourceForm.isFormValid(true)) {
|
|
return
|
|
}
|
|
|
|
this.actionInProgress = true
|
|
try {
|
|
await this.actionUpdateUserSource({
|
|
application: this.builder,
|
|
userSourceId: this.editedUserSource.id,
|
|
values: clone(newValues),
|
|
})
|
|
// If the builder settings modal is set to hide after create, normally
|
|
// we would have hidden the modal and shared the record ID after the user
|
|
// source was created, but in this settings component we'll share the ID
|
|
// after the update, when there's a better change of having a configure source.
|
|
this.hideModalIfRequired(this.editedUserSource.id)
|
|
this.hideForm()
|
|
} catch (error) {
|
|
// Restore the previously saved values from the store
|
|
if (!this.$refs.userSourceForm.handleServerError(error)) {
|
|
this.$refs.userSourceForm.reset()
|
|
this.handleError(error)
|
|
}
|
|
}
|
|
this.actionInProgress = false
|
|
},
|
|
async deleteUserSource(userSource) {
|
|
try {
|
|
await this.actionDeleteUserSource({
|
|
application: this.builder,
|
|
userSourceId: userSource.id,
|
|
})
|
|
} catch (error) {
|
|
notifyIf(error)
|
|
}
|
|
},
|
|
},
|
|
}
|
|
</script>
|