refactor(editor): Remove legacy audit logs view (no-changelog) (#9053)

This commit is contained in:
Iván Ovejero
2024-04-05 10:23:27 +02:00
committed by GitHub
parent 637b6c4d3e
commit ba986fb018
6 changed files with 1 additions and 147 deletions

View File

@@ -1,43 +0,0 @@
<script lang="ts" setup>
import { useI18n } from '@/composables/useI18n';
import { useAuditLogsStore } from '@/stores/auditLogs.store';
import { useUIStore } from '@/stores/ui.store';
const locale = useI18n();
const uiStore = useUIStore();
const auditLogsStore = useAuditLogsStore();
const goToUpgrade = () => {
void uiStore.goToUpgrade('audit-logs', 'upgrade-audit-logs');
};
</script>
<template>
<div>
<n8n-heading size="2xlarge" tag="h1">{{
locale.baseText('settings.auditLogs.title')
}}</n8n-heading>
<div
v-if="auditLogsStore.isEnterpriseAuditLogsFeatureEnabled"
data-test-id="audit-logs-content-licensed"
></div>
<n8n-action-box
v-else
data-test-id="audit-logs-content-unlicensed"
:class="$style.actionBox"
:description="locale.baseText('settings.auditLogs.actionBox.description')"
:button-text="locale.baseText('settings.auditLogs.actionBox.buttonText')"
@click:button="goToUpgrade"
>
<template #heading>
<span>{{ locale.baseText('settings.auditLogs.actionBox.title') }}</span>
</template>
</n8n-action-box>
</div>
</template>
<style lang="scss" module>
.actionBox {
margin: var(--spacing-2xl) 0 0;
}
</style>

View File

@@ -1,59 +0,0 @@
import { vi } from 'vitest';
import { createPinia, setActivePinia } from 'pinia';
import { useAuditLogsStore } from '@/stores/auditLogs.store';
import { useSettingsStore } from '@/stores/settings.store';
import SettingsAuditLogs from '@/views/SettingsAuditLogs.vue';
import { createComponentRenderer } from '@/__tests__/render';
import { EnterpriseEditionFeature } from '@/constants';
import { nextTick } from 'vue';
import { setupServer } from '@/__tests__/server';
let pinia: ReturnType<typeof createPinia>;
let settingsStore: ReturnType<typeof useSettingsStore>;
let auditLogsStore: ReturnType<typeof useAuditLogsStore>;
let server: ReturnType<typeof setupServer>;
const renderComponent = createComponentRenderer(SettingsAuditLogs);
describe('SettingsAuditLogs', () => {
beforeAll(() => {
server = setupServer();
});
beforeEach(async () => {
pinia = createPinia();
setActivePinia(pinia);
settingsStore = useSettingsStore();
auditLogsStore = useAuditLogsStore();
await settingsStore.getSettings();
});
afterEach(() => {
vi.clearAllMocks();
});
afterAll(() => {
server.shutdown();
});
it('should render paywall state when there is no license', async () => {
settingsStore.settings.enterprise[EnterpriseEditionFeature.AuditLogs] = false;
await nextTick();
const { getByTestId, queryByTestId } = renderComponent({ pinia });
expect(queryByTestId('audit-logs-content-licensed')).not.toBeInTheDocument();
expect(getByTestId('audit-logs-content-unlicensed')).toBeInTheDocument();
});
it('should render licensed content', async () => {
settingsStore.settings.enterprise[EnterpriseEditionFeature.AuditLogs] = true;
await nextTick();
const { getByTestId, queryByTestId } = renderComponent({ pinia });
expect(getByTestId('audit-logs-content-licensed')).toBeInTheDocument();
expect(queryByTestId('audit-logs-content-unlicensed')).not.toBeInTheDocument();
});
});