mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-11 12:57:29 -08:00
refactor(editor): Remove legacy audit logs view (no-changelog) (#9053)
This commit is contained in:
parent
637b6c4d3e
commit
ba986fb018
|
@ -83,14 +83,7 @@ export default defineComponent({
|
|||
available: this.canAccessExternalSecrets(),
|
||||
route: { to: { name: VIEWS.EXTERNAL_SECRETS_SETTINGS } },
|
||||
},
|
||||
{
|
||||
id: 'settings-audit-logs',
|
||||
icon: 'clipboard-list',
|
||||
label: this.$locale.baseText('settings.auditLogs.title'),
|
||||
position: 'top',
|
||||
available: this.canAccessAuditLogs(),
|
||||
route: { to: { name: VIEWS.AUDIT_LOGS } },
|
||||
},
|
||||
|
||||
{
|
||||
id: 'settings-source-control',
|
||||
icon: 'code-branch',
|
||||
|
@ -189,9 +182,6 @@ export default defineComponent({
|
|||
canAccessSourceControl(): boolean {
|
||||
return this.canUserAccessRouteByName(VIEWS.SOURCE_CONTROL);
|
||||
},
|
||||
canAccessAuditLogs(): boolean {
|
||||
return this.canUserAccessRouteByName(VIEWS.AUDIT_LOGS);
|
||||
},
|
||||
canAccessSso(): boolean {
|
||||
return this.canUserAccessRouteByName(VIEWS.SSO_SETTINGS);
|
||||
},
|
||||
|
|
|
@ -466,7 +466,6 @@ export const enum VIEWS {
|
|||
EXTERNAL_SECRETS_SETTINGS = 'ExternalSecretsSettings',
|
||||
SAML_ONBOARDING = 'SamlOnboarding',
|
||||
SOURCE_CONTROL = 'SourceControl',
|
||||
AUDIT_LOGS = 'AuditLogs',
|
||||
MFA_VIEW = 'MfaView',
|
||||
WORKFLOW_HISTORY = 'WorkflowHistory',
|
||||
WORKER_VIEW = 'WorkerView',
|
||||
|
|
|
@ -1783,10 +1783,6 @@
|
|||
"settings.sourceControl.error.not.connected.title": "Environments have not been enabled",
|
||||
"settings.sourceControl.error.not.connected.message": "Please head over to <a href='/settings/environments'>environment settings</a> to connect a git repository first to activate this functionality.",
|
||||
"showMessage.cancel": "@:_reusableBaseText.cancel",
|
||||
"settings.auditLogs.title": "Audit Logs",
|
||||
"settings.auditLogs.actionBox.title": "Available on the Enterprise plan",
|
||||
"settings.auditLogs.actionBox.description": "Upgrade to see the audit logs of your n8n instance.",
|
||||
"settings.auditLogs.actionBox.buttonText": "See plans",
|
||||
"showMessage.ok": "OK",
|
||||
"showMessage.showDetails": "Show Details",
|
||||
"startupError": "Error connecting to n8n",
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
import { useStorage } from '@/composables/useStorage';
|
||||
|
||||
import type {
|
||||
NavigationGuardNext,
|
||||
RouteLocation,
|
||||
|
@ -59,7 +57,6 @@ const SignoutView = async () => await import('@/views/SignoutView.vue');
|
|||
const SamlOnboarding = async () => await import('@/views/SamlOnboarding.vue');
|
||||
const SettingsSourceControl = async () => await import('./views/SettingsSourceControl.vue');
|
||||
const SettingsExternalSecrets = async () => await import('./views/SettingsExternalSecrets.vue');
|
||||
const SettingsAuditLogs = async () => await import('./views/SettingsAuditLogs.vue');
|
||||
const WorkerView = async () => await import('./views/WorkerView.vue');
|
||||
const WorkflowHistory = async () => await import('@/views/WorkflowHistory.vue');
|
||||
const WorkflowOnboardingView = async () => await import('@/views/WorkflowOnboardingView.vue');
|
||||
|
@ -712,32 +709,6 @@ export const routes = [
|
|||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'audit-logs',
|
||||
name: VIEWS.AUDIT_LOGS,
|
||||
components: {
|
||||
settingsView: SettingsAuditLogs,
|
||||
},
|
||||
meta: {
|
||||
middleware: ['authenticated', 'rbac', 'custom'],
|
||||
middlewareOptions: {
|
||||
custom: () => {
|
||||
return !!useStorage('audit-logs').value;
|
||||
},
|
||||
rbac: {
|
||||
scope: 'auditLogs:manage',
|
||||
},
|
||||
},
|
||||
telemetry: {
|
||||
pageCategory: 'settings',
|
||||
getProperties(route: RouteLocation) {
|
||||
return {
|
||||
feature: 'audit-logs',
|
||||
};
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
|
|
@ -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>
|
|
@ -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();
|
||||
});
|
||||
});
|
Loading…
Reference in a new issue