feat: Rewrite accountMixin to a composable (#9914)
This commit is contained in:
@@ -1,8 +1,8 @@
|
|||||||
<script>
|
<script>
|
||||||
import { mapGetters } from 'vuex';
|
import { mapGetters } from 'vuex';
|
||||||
import { useAdmin } from 'dashboard/composables/useAdmin';
|
import { useAdmin } from 'dashboard/composables/useAdmin';
|
||||||
|
import { useAccount } from 'dashboard/composables/useAccount';
|
||||||
import Banner from 'dashboard/components/ui/Banner.vue';
|
import Banner from 'dashboard/components/ui/Banner.vue';
|
||||||
import accountMixin from 'dashboard/mixins/account';
|
|
||||||
|
|
||||||
const EMPTY_SUBSCRIPTION_INFO = {
|
const EMPTY_SUBSCRIPTION_INFO = {
|
||||||
status: null,
|
status: null,
|
||||||
@@ -11,10 +11,13 @@ const EMPTY_SUBSCRIPTION_INFO = {
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: { Banner },
|
components: { Banner },
|
||||||
mixins: [accountMixin],
|
|
||||||
setup() {
|
setup() {
|
||||||
const { isAdmin } = useAdmin();
|
const { isAdmin } = useAdmin();
|
||||||
|
|
||||||
|
const { accountId } = useAccount();
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
accountId,
|
||||||
isAdmin,
|
isAdmin,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,12 +1,10 @@
|
|||||||
<script>
|
<script>
|
||||||
import Banner from 'dashboard/components/ui/Banner.vue';
|
import Banner from 'dashboard/components/ui/Banner.vue';
|
||||||
import { mapGetters } from 'vuex';
|
import { mapGetters } from 'vuex';
|
||||||
import accountMixin from 'dashboard/mixins/account';
|
|
||||||
import { useAlert } from 'dashboard/composables';
|
import { useAlert } from 'dashboard/composables';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: { Banner },
|
components: { Banner },
|
||||||
mixins: [accountMixin],
|
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters({
|
...mapGetters({
|
||||||
currentUser: 'getCurrentUser',
|
currentUser: 'getCurrentUser',
|
||||||
|
|||||||
@@ -1,12 +1,17 @@
|
|||||||
<script>
|
<script>
|
||||||
import Banner from 'dashboard/components/ui/Banner.vue';
|
import Banner from 'dashboard/components/ui/Banner.vue';
|
||||||
import { mapGetters } from 'vuex';
|
import { mapGetters } from 'vuex';
|
||||||
import accountMixin from 'dashboard/mixins/account';
|
import { useAccount } from 'dashboard/composables/useAccount';
|
||||||
import { differenceInDays } from 'date-fns';
|
import { differenceInDays } from 'date-fns';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: { Banner },
|
components: { Banner },
|
||||||
mixins: [accountMixin],
|
setup() {
|
||||||
|
const { accountId } = useAccount();
|
||||||
|
return {
|
||||||
|
accountId,
|
||||||
|
};
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return { conversationMeta: {} };
|
return { conversationMeta: {} };
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import { mapGetters } from 'vuex';
|
import { mapGetters } from 'vuex';
|
||||||
import { useAdmin } from 'dashboard/composables/useAdmin';
|
import { useAdmin } from 'dashboard/composables/useAdmin';
|
||||||
import accountMixin from 'dashboard/mixins/account';
|
import { useAccount } from 'dashboard/composables/useAccount';
|
||||||
import OnboardingView from '../OnboardingView.vue';
|
import OnboardingView from '../OnboardingView.vue';
|
||||||
import EmptyStateMessage from './EmptyStateMessage.vue';
|
import EmptyStateMessage from './EmptyStateMessage.vue';
|
||||||
|
|
||||||
@@ -10,7 +10,6 @@ export default {
|
|||||||
OnboardingView,
|
OnboardingView,
|
||||||
EmptyStateMessage,
|
EmptyStateMessage,
|
||||||
},
|
},
|
||||||
mixins: [accountMixin],
|
|
||||||
props: {
|
props: {
|
||||||
isOnExpandedLayout: {
|
isOnExpandedLayout: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
@@ -19,8 +18,12 @@ export default {
|
|||||||
},
|
},
|
||||||
setup() {
|
setup() {
|
||||||
const { isAdmin } = useAdmin();
|
const { isAdmin } = useAdmin();
|
||||||
|
|
||||||
|
const { accountScopedUrl } = useAccount();
|
||||||
|
|
||||||
return {
|
return {
|
||||||
isAdmin,
|
isAdmin,
|
||||||
|
accountScopedUrl,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -44,7 +47,7 @@ export default {
|
|||||||
return this.$t('CONVERSATION.404');
|
return this.$t('CONVERSATION.404');
|
||||||
},
|
},
|
||||||
newInboxURL() {
|
newInboxURL() {
|
||||||
return this.addAccountScoping('settings/inboxes/new');
|
return this.accountScopedUrl('settings/inboxes/new');
|
||||||
},
|
},
|
||||||
emptyClassName() {
|
emptyClassName() {
|
||||||
if (
|
if (
|
||||||
|
|||||||
@@ -1,19 +1,24 @@
|
|||||||
<script>
|
<script>
|
||||||
import { mapGetters } from 'vuex';
|
import { mapGetters } from 'vuex';
|
||||||
import accountMixin from '../../../mixins/account';
|
import { useAccount } from 'dashboard/composables/useAccount';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
mixins: [accountMixin],
|
setup() {
|
||||||
|
const { accountScopedUrl } = useAccount();
|
||||||
|
return {
|
||||||
|
accountScopedUrl,
|
||||||
|
};
|
||||||
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters({ globalConfig: 'globalConfig/get' }),
|
...mapGetters({ globalConfig: 'globalConfig/get' }),
|
||||||
newInboxURL() {
|
newInboxURL() {
|
||||||
return this.addAccountScoping('settings/inboxes/new');
|
return this.accountScopedUrl('settings/inboxes/new');
|
||||||
},
|
},
|
||||||
newAgentURL() {
|
newAgentURL() {
|
||||||
return this.addAccountScoping('settings/agents/list');
|
return this.accountScopedUrl('settings/agents/list');
|
||||||
},
|
},
|
||||||
newLabelsURL() {
|
newLabelsURL() {
|
||||||
return this.addAccountScoping('settings/labels/list');
|
return this.accountScopedUrl('settings/labels/list');
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
37
app/javascript/dashboard/composables/spec/useAccount.spec.js
Normal file
37
app/javascript/dashboard/composables/spec/useAccount.spec.js
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
import { ref } from 'vue';
|
||||||
|
import { describe, it, expect, vi } from 'vitest';
|
||||||
|
import { useAccount } from '../useAccount';
|
||||||
|
import { useStoreGetters } from 'dashboard/composables/store';
|
||||||
|
|
||||||
|
vi.mock('dashboard/composables/store');
|
||||||
|
|
||||||
|
describe('useAccount', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
useStoreGetters.mockReturnValue({
|
||||||
|
getCurrentAccountId: ref(123),
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('returns accountId as a computed property', () => {
|
||||||
|
const { accountId } = useAccount();
|
||||||
|
expect(accountId.value).toBe(123);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('generates account-scoped URLs correctly', () => {
|
||||||
|
const { accountScopedUrl } = useAccount();
|
||||||
|
const result = accountScopedUrl('settings/inbox/new');
|
||||||
|
expect(result).toBe('/app/accounts/123/settings/inbox/new');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('handles URLs with leading slash', () => {
|
||||||
|
const { accountScopedUrl } = useAccount();
|
||||||
|
const result = accountScopedUrl('users');
|
||||||
|
expect(result).toBe('/app/accounts/123/users');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('handles empty URL', () => {
|
||||||
|
const { accountScopedUrl } = useAccount();
|
||||||
|
const result = accountScopedUrl('');
|
||||||
|
expect(result).toBe('/app/accounts/123/');
|
||||||
|
});
|
||||||
|
});
|
||||||
30
app/javascript/dashboard/composables/useAccount.js
Normal file
30
app/javascript/dashboard/composables/useAccount.js
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
import { computed } from 'vue';
|
||||||
|
import { useStoreGetters } from 'dashboard/composables/store';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Composable for account-related operations.
|
||||||
|
* @returns {Object} An object containing account-related properties and methods.
|
||||||
|
*/
|
||||||
|
export function useAccount() {
|
||||||
|
const getters = useStoreGetters();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Computed property for the current account ID.
|
||||||
|
* @type {import('vue').ComputedRef<number>}
|
||||||
|
*/
|
||||||
|
const accountId = computed(() => getters.getCurrentAccountId.value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates an account-scoped URL.
|
||||||
|
* @param {string} url - The URL to be scoped to the account.
|
||||||
|
* @returns {string} The account-scoped URL.
|
||||||
|
*/
|
||||||
|
const accountScopedUrl = url => {
|
||||||
|
return `/app/accounts/${accountId.value}/${url}`;
|
||||||
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
accountId,
|
||||||
|
accountScopedUrl,
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
import { mapGetters } from 'vuex';
|
|
||||||
|
|
||||||
export default {
|
|
||||||
computed: {
|
|
||||||
...mapGetters({
|
|
||||||
accountId: 'getCurrentAccountId',
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
addAccountScoping(url) {
|
|
||||||
return `/app/accounts/${this.accountId}/${url}`;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
import { shallowMount, createLocalVue } from '@vue/test-utils';
|
|
||||||
import accountMixin from '../account';
|
|
||||||
import Vuex from 'vuex';
|
|
||||||
|
|
||||||
const localVue = createLocalVue();
|
|
||||||
localVue.use(Vuex);
|
|
||||||
|
|
||||||
describe('accountMixin', () => {
|
|
||||||
let getters;
|
|
||||||
let store;
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
getters = {
|
|
||||||
getCurrentAccountId: () => 1,
|
|
||||||
};
|
|
||||||
|
|
||||||
store = new Vuex.Store({ getters });
|
|
||||||
});
|
|
||||||
|
|
||||||
it('set accountId properly', () => {
|
|
||||||
const Component = {
|
|
||||||
render() {},
|
|
||||||
title: 'TestComponent',
|
|
||||||
mixins: [accountMixin],
|
|
||||||
};
|
|
||||||
const wrapper = shallowMount(Component, { store, localVue });
|
|
||||||
expect(wrapper.vm.accountId).toBe(1);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('returns current url', () => {
|
|
||||||
const Component = {
|
|
||||||
render() {},
|
|
||||||
title: 'TestComponent',
|
|
||||||
mixins: [accountMixin],
|
|
||||||
};
|
|
||||||
|
|
||||||
const wrapper = shallowMount(Component, { store, localVue });
|
|
||||||
expect(wrapper.vm.addAccountScoping('settings/inboxes/new')).toBe(
|
|
||||||
'/app/accounts/1/settings/inboxes/new'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -1,19 +1,25 @@
|
|||||||
<script>
|
<script>
|
||||||
import { mapGetters } from 'vuex';
|
import { mapGetters } from 'vuex';
|
||||||
|
import { useAccount } from 'dashboard/composables/useAccount';
|
||||||
import MacroItem from './MacroItem.vue';
|
import MacroItem from './MacroItem.vue';
|
||||||
import accountMixin from 'dashboard/mixins/account.js';
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
MacroItem,
|
MacroItem,
|
||||||
},
|
},
|
||||||
mixins: [accountMixin],
|
|
||||||
props: {
|
props: {
|
||||||
conversationId: {
|
conversationId: {
|
||||||
type: [Number, String],
|
type: [Number, String],
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
setup() {
|
||||||
|
const { accountScopedUrl } = useAccount();
|
||||||
|
|
||||||
|
return {
|
||||||
|
accountScopedUrl,
|
||||||
|
};
|
||||||
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters({
|
...mapGetters({
|
||||||
macros: ['macros/getMacros'],
|
macros: ['macros/getMacros'],
|
||||||
@@ -32,10 +38,10 @@ export default {
|
|||||||
v-if="!uiFlags.isFetching && !macros.length"
|
v-if="!uiFlags.isFetching && !macros.length"
|
||||||
class="macros_list--empty-state"
|
class="macros_list--empty-state"
|
||||||
>
|
>
|
||||||
<p class="flex h-full items-center flex-col justify-center">
|
<p class="flex flex-col items-center justify-center h-full">
|
||||||
{{ $t('MACROS.LIST.404') }}
|
{{ $t('MACROS.LIST.404') }}
|
||||||
</p>
|
</p>
|
||||||
<router-link :to="addAccountScoping('settings/macros')">
|
<router-link :to="accountScopedUrl('settings/macros')">
|
||||||
<woot-button
|
<woot-button
|
||||||
variant="smooth"
|
variant="smooth"
|
||||||
icon="add"
|
icon="add"
|
||||||
|
|||||||
@@ -5,13 +5,12 @@ import { mapGetters } from 'vuex';
|
|||||||
import { useAlert } from 'dashboard/composables';
|
import { useAlert } from 'dashboard/composables';
|
||||||
import { useUISettings } from 'dashboard/composables/useUISettings';
|
import { useUISettings } from 'dashboard/composables/useUISettings';
|
||||||
import configMixin from 'shared/mixins/configMixin';
|
import configMixin from 'shared/mixins/configMixin';
|
||||||
import accountMixin from '../../../../mixins/account';
|
|
||||||
import { FEATURE_FLAGS } from '../../../../featureFlags';
|
import { FEATURE_FLAGS } from '../../../../featureFlags';
|
||||||
import semver from 'semver';
|
import semver from 'semver';
|
||||||
import { getLanguageDirection } from 'dashboard/components/widgets/conversation/advancedFilterItems/languages';
|
import { getLanguageDirection } from 'dashboard/components/widgets/conversation/advancedFilterItems/languages';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
mixins: [accountMixin, configMixin],
|
mixins: [configMixin],
|
||||||
setup() {
|
setup() {
|
||||||
const { updateUISettings } = useUISettings();
|
const { updateUISettings } = useUISettings();
|
||||||
const v$ = useVuelidate();
|
const v$ = useVuelidate();
|
||||||
|
|||||||
@@ -2,12 +2,19 @@
|
|||||||
import messageFormatterMixin from 'shared/mixins/messageFormatterMixin';
|
import messageFormatterMixin from 'shared/mixins/messageFormatterMixin';
|
||||||
|
|
||||||
import { mapGetters } from 'vuex';
|
import { mapGetters } from 'vuex';
|
||||||
import accountMixin from '../../../../mixins/account';
|
import { useAccount } from 'dashboard/composables/useAccount';
|
||||||
import BillingItem from './components/BillingItem.vue';
|
import BillingItem from './components/BillingItem.vue';
|
||||||
// sdds
|
|
||||||
export default {
|
export default {
|
||||||
components: { BillingItem },
|
components: { BillingItem },
|
||||||
mixins: [accountMixin, messageFormatterMixin],
|
mixins: [messageFormatterMixin],
|
||||||
|
setup() {
|
||||||
|
const { accountId } = useAccount();
|
||||||
|
|
||||||
|
return {
|
||||||
|
accountId,
|
||||||
|
};
|
||||||
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters({
|
...mapGetters({
|
||||||
getAccount: 'accounts/getAccount',
|
getAccount: 'accounts/getAccount',
|
||||||
|
|||||||
@@ -2,19 +2,21 @@
|
|||||||
import { mapGetters } from 'vuex';
|
import { mapGetters } from 'vuex';
|
||||||
import { useAlert } from 'dashboard/composables';
|
import { useAlert } from 'dashboard/composables';
|
||||||
import { useAdmin } from 'dashboard/composables/useAdmin';
|
import { useAdmin } from 'dashboard/composables/useAdmin';
|
||||||
|
import { useAccount } from 'dashboard/composables/useAccount';
|
||||||
import Settings from './Settings.vue';
|
import Settings from './Settings.vue';
|
||||||
import accountMixin from '../../../../mixins/account';
|
|
||||||
import globalConfigMixin from 'shared/mixins/globalConfigMixin';
|
import globalConfigMixin from 'shared/mixins/globalConfigMixin';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
Settings,
|
Settings,
|
||||||
},
|
},
|
||||||
mixins: [accountMixin, globalConfigMixin],
|
mixins: [globalConfigMixin],
|
||||||
setup() {
|
setup() {
|
||||||
const { isAdmin } = useAdmin();
|
const { isAdmin } = useAdmin();
|
||||||
|
const { accountScopedUrl } = useAccount();
|
||||||
return {
|
return {
|
||||||
isAdmin,
|
isAdmin,
|
||||||
|
accountScopedUrl,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
@@ -102,7 +104,7 @@ export default {
|
|||||||
{{ $t('INBOX_MGMT.LIST.404') }}
|
{{ $t('INBOX_MGMT.LIST.404') }}
|
||||||
<router-link
|
<router-link
|
||||||
v-if="isAdmin"
|
v-if="isAdmin"
|
||||||
:to="addAccountScoping('settings/inboxes/new')"
|
:to="accountScopedUrl('settings/inboxes/new')"
|
||||||
>
|
>
|
||||||
{{ $t('SETTINGS.INBOXES.NEW_INBOX') }}
|
{{ $t('SETTINGS.INBOXES.NEW_INBOX') }}
|
||||||
</router-link>
|
</router-link>
|
||||||
@@ -164,7 +166,7 @@ export default {
|
|||||||
<td>
|
<td>
|
||||||
<div class="button-wrapper">
|
<div class="button-wrapper">
|
||||||
<router-link
|
<router-link
|
||||||
:to="addAccountScoping(`settings/inboxes/${item.id}`)"
|
:to="accountScopedUrl(`settings/inboxes/${item.id}`)"
|
||||||
>
|
>
|
||||||
<woot-button
|
<woot-button
|
||||||
v-if="isAdmin"
|
v-if="isAdmin"
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
/* global FB */
|
/* global FB */
|
||||||
import { useVuelidate } from '@vuelidate/core';
|
import { useVuelidate } from '@vuelidate/core';
|
||||||
import { useAlert } from 'dashboard/composables';
|
import { useAlert } from 'dashboard/composables';
|
||||||
|
import { useAccount } from 'dashboard/composables/useAccount';
|
||||||
import { required } from '@vuelidate/validators';
|
import { required } from '@vuelidate/validators';
|
||||||
import LoadingState from 'dashboard/components/widgets/LoadingState.vue';
|
import LoadingState from 'dashboard/components/widgets/LoadingState.vue';
|
||||||
import { mapGetters } from 'vuex';
|
import { mapGetters } from 'vuex';
|
||||||
@@ -10,7 +11,6 @@ import ChannelApi from '../../../../../api/channels';
|
|||||||
import PageHeader from '../../SettingsSubPageHeader.vue';
|
import PageHeader from '../../SettingsSubPageHeader.vue';
|
||||||
import router from '../../../../index';
|
import router from '../../../../index';
|
||||||
import globalConfigMixin from 'shared/mixins/globalConfigMixin';
|
import globalConfigMixin from 'shared/mixins/globalConfigMixin';
|
||||||
import accountMixin from '../../../../../mixins/account';
|
|
||||||
|
|
||||||
import { loadScript } from 'dashboard/helper/DOMHelpers';
|
import { loadScript } from 'dashboard/helper/DOMHelpers';
|
||||||
import * as Sentry from '@sentry/browser';
|
import * as Sentry from '@sentry/browser';
|
||||||
@@ -20,9 +20,13 @@ export default {
|
|||||||
LoadingState,
|
LoadingState,
|
||||||
PageHeader,
|
PageHeader,
|
||||||
},
|
},
|
||||||
mixins: [globalConfigMixin, accountMixin],
|
mixins: [globalConfigMixin],
|
||||||
setup() {
|
setup() {
|
||||||
return { v$: useVuelidate() };
|
const { accountId } = useAccount();
|
||||||
|
return {
|
||||||
|
accountId,
|
||||||
|
v$: useVuelidate(),
|
||||||
|
};
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -1,13 +1,18 @@
|
|||||||
<script>
|
<script>
|
||||||
import { mapGetters } from 'vuex';
|
import { mapGetters } from 'vuex';
|
||||||
import { useAlert } from 'dashboard/composables';
|
import { useAlert } from 'dashboard/composables';
|
||||||
import accountMixin from 'dashboard/mixins/account.js';
|
import { useAccount } from 'dashboard/composables/useAccount';
|
||||||
import MacrosTableRow from './MacrosTableRow.vue';
|
import MacrosTableRow from './MacrosTableRow.vue';
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
MacrosTableRow,
|
MacrosTableRow,
|
||||||
},
|
},
|
||||||
mixins: [accountMixin],
|
setup() {
|
||||||
|
const { accountScopedUrl } = useAccount();
|
||||||
|
return {
|
||||||
|
accountScopedUrl,
|
||||||
|
};
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
showDeleteConfirmationPopup: false,
|
showDeleteConfirmationPopup: false,
|
||||||
@@ -56,7 +61,7 @@ export default {
|
|||||||
<template>
|
<template>
|
||||||
<div class="flex-1 overflow-auto">
|
<div class="flex-1 overflow-auto">
|
||||||
<router-link
|
<router-link
|
||||||
:to="addAccountScoping('settings/macros/new')"
|
:to="accountScopedUrl('settings/macros/new')"
|
||||||
class="button success button--fixed-top button success button--fixed-top px-3.5 py-1 rounded-[5px] flex gap-2"
|
class="button success button--fixed-top button success button--fixed-top px-3.5 py-1 rounded-[5px] flex gap-2"
|
||||||
>
|
>
|
||||||
<fluent-icon icon="add-circle" />
|
<fluent-icon icon="add-circle" />
|
||||||
@@ -67,7 +72,7 @@ export default {
|
|||||||
<div class="flex flex-row gap-4 p-8">
|
<div class="flex flex-row gap-4 p-8">
|
||||||
<div class="w-full lg:w-3/5">
|
<div class="w-full lg:w-3/5">
|
||||||
<div v-if="!uiFlags.isFetching && !records.length" class="p-3">
|
<div v-if="!uiFlags.isFetching && !records.length" class="p-3">
|
||||||
<p class="flex h-full items-center flex-col justify-center">
|
<p class="flex flex-col items-center justify-center h-full">
|
||||||
{{ $t('MACROS.LIST.404') }}
|
{{ $t('MACROS.LIST.404') }}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
@@ -94,7 +99,7 @@ export default {
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div class="hidden lg:block w-1/3">
|
<div class="hidden w-1/3 lg:block">
|
||||||
<span v-dompurify-html="$t('MACROS.SIDEBAR_TXT')" />
|
<span v-dompurify-html="$t('MACROS.SIDEBAR_TXT')" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,17 +1,23 @@
|
|||||||
<script>
|
<script>
|
||||||
|
import { useAccount } from 'dashboard/composables/useAccount';
|
||||||
import Thumbnail from 'dashboard/components/widgets/Thumbnail.vue';
|
import Thumbnail from 'dashboard/components/widgets/Thumbnail.vue';
|
||||||
import accountMixin from 'dashboard/mixins/account.js';
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
Thumbnail,
|
Thumbnail,
|
||||||
},
|
},
|
||||||
mixins: [accountMixin],
|
|
||||||
props: {
|
props: {
|
||||||
macro: {
|
macro: {
|
||||||
type: Object,
|
type: Object,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
setup() {
|
||||||
|
const { accountScopedUrl } = useAccount();
|
||||||
|
|
||||||
|
return {
|
||||||
|
accountScopedUrl,
|
||||||
|
};
|
||||||
|
},
|
||||||
computed: {
|
computed: {
|
||||||
createdByName() {
|
createdByName() {
|
||||||
const createdBy = this.macro.created_by;
|
const createdBy = this.macro.created_by;
|
||||||
@@ -47,7 +53,7 @@ export default {
|
|||||||
</td>
|
</td>
|
||||||
<td>{{ visibilityLabel }}</td>
|
<td>{{ visibilityLabel }}</td>
|
||||||
<td class="button-wrapper">
|
<td class="button-wrapper">
|
||||||
<router-link :to="addAccountScoping(`settings/macros/${macro.id}/edit`)">
|
<router-link :to="accountScopedUrl(`settings/macros/${macro.id}/edit`)">
|
||||||
<woot-button
|
<woot-button
|
||||||
v-tooltip.top="$t('MACROS.EDIT.TOOLTIP')"
|
v-tooltip.top="$t('MACROS.EDIT.TOOLTIP')"
|
||||||
variant="smooth"
|
variant="smooth"
|
||||||
|
|||||||
Reference in New Issue
Block a user