* Integrate PostHog - Part 1: Groundwork (#3753) * Integrate PostHog - Part 2: Event capture (#3779) * Integrate PostHog - Part 3: Session recordings (#3789) * Integrate PostHog - Part 4: Experiments (#3825) * Finalize PostHog integration (#3866) * 📦 Update `package-lock.json` * 🐛 Account for absent PH hooks file * ✨ Create new env `EXTERNAL_FRONTEND_HOOKS_FILES` * ⚡ Adjust env used for injecting PostHog * 🐛 Switch to semicolon delimiter * ⚡ Simplify to `externalFrontendHookPath` * Refactor FE hooks flow (#3884) * Add env var for session recordings * inject frontend hooks even when telemetry is off * allow multiple hooks files * cr * 🐛 Handle missing ref errors * 🔥 Remove outdated `continue` * 🎨 Change one-liners to blocks * 📦 Update `package-lock.json` Co-authored-by: Ahsan Virani <ahsan.virani@gmail.com>
124 lines
2.9 KiB
Vue
124 lines
2.9 KiB
Vue
<template>
|
|
<Modal
|
|
:name="CREDENTIAL_SELECT_MODAL_KEY"
|
|
:eventBus="modalBus"
|
|
width="50%"
|
|
:center="true"
|
|
:loading="loading"
|
|
maxWidth="460px"
|
|
minHeight="250px"
|
|
>
|
|
<template slot="header">
|
|
<h2 :class="$style.title">{{ $locale.baseText('credentialSelectModal.addNewCredential') }}</h2>
|
|
</template>
|
|
<template slot="content">
|
|
<div>
|
|
<div :class="$style.subtitle">{{ $locale.baseText('credentialSelectModal.selectAnAppOrServiceToConnectTo') }}</div>
|
|
<n8n-select
|
|
filterable
|
|
defaultFirstOption
|
|
:placeholder="$locale.baseText('credentialSelectModal.searchForApp')"
|
|
size="xlarge"
|
|
ref="select"
|
|
:value="selected"
|
|
@change="onSelect"
|
|
>
|
|
<font-awesome-icon icon="search" slot="prefix" />
|
|
<n8n-option
|
|
v-for="credential in allCredentialTypes"
|
|
:value="credential.name"
|
|
:key="credential.name"
|
|
:label="credential.displayName"
|
|
filterable
|
|
/>
|
|
</n8n-select>
|
|
</div>
|
|
</template>
|
|
<template slot="footer">
|
|
<div :class="$style.footer">
|
|
<n8n-button
|
|
:label="$locale.baseText('credentialSelectModal.continue')"
|
|
float="right"
|
|
size="large"
|
|
:disabled="!selected"
|
|
@click="openCredentialType"
|
|
/>
|
|
</div>
|
|
</template>
|
|
</Modal>
|
|
</template>
|
|
|
|
<script lang="ts">
|
|
import Vue from 'vue';
|
|
import { mapGetters } from "vuex";
|
|
import mixins from 'vue-typed-mixins';
|
|
|
|
import Modal from './Modal.vue';
|
|
import { CREDENTIAL_SELECT_MODAL_KEY } from '../constants';
|
|
import { externalHooks } from '@/components/mixins/externalHooks';
|
|
|
|
export default mixins(externalHooks).extend({
|
|
name: 'CredentialsSelectModal',
|
|
components: {
|
|
Modal,
|
|
},
|
|
async mounted() {
|
|
try {
|
|
await this.$store.dispatch('credentials/fetchCredentialTypes');
|
|
} catch (e) {
|
|
}
|
|
this.loading = false;
|
|
|
|
setTimeout(() => {
|
|
const element = this.$refs.select as HTMLSelectElement;
|
|
if (element) {
|
|
element.focus();
|
|
}
|
|
}, 0);
|
|
},
|
|
data() {
|
|
return {
|
|
modalBus: new Vue(),
|
|
selected: '',
|
|
loading: true,
|
|
CREDENTIAL_SELECT_MODAL_KEY,
|
|
};
|
|
},
|
|
computed: {
|
|
...mapGetters('credentials', ['allCredentialTypes']),
|
|
},
|
|
methods: {
|
|
onSelect(type: string) {
|
|
this.selected = type;
|
|
},
|
|
openCredentialType () {
|
|
this.modalBus.$emit('close');
|
|
this.$store.dispatch('ui/openNewCredential', { type: this.selected });
|
|
|
|
const telemetryPayload = {
|
|
credential_type: this.selected,
|
|
source: 'primary_menu',
|
|
new_credential: true,
|
|
workflow_id: this.$store.getters.workflowId,
|
|
};
|
|
|
|
this.$telemetry.track('User opened Credential modal', telemetryPayload);
|
|
this.$externalHooks().run('credentialsSelectModal.openCredentialType', telemetryPayload);
|
|
},
|
|
},
|
|
});
|
|
</script>
|
|
|
|
<style module lang="scss">
|
|
.title {
|
|
font-size: var(--font-size-xl);
|
|
line-height: var(--font-line-height-regular);
|
|
}
|
|
|
|
.subtitle {
|
|
margin-bottom: var(--spacing-s);
|
|
font-size: var(--font-size-m);
|
|
line-height: var(--font-line-height-xloose);
|
|
}
|
|
</style>
|