Skip to content

Commit

Permalink
Merge branch 'master' into ADO-1061-email-confirmation-banner
Browse files Browse the repository at this point in the history
* master:
  feat(editor): Add Workflow history route and base page (no-changelog) (#7161)
  feat(Microsoft Outlook Node): Node overhaul (#4449)
  ci: Disable intermittently failing MFA e2e tests (no-changelog) (#7106)
  fix(editor): No need to add click emitting click events, VUE delegates the handler to the root element of the component (#7182)
  • Loading branch information
MiloradFilipovic committed Sep 15, 2023
2 parents 4d1546e + 240b2f0 commit 3eec473
Show file tree
Hide file tree
Showing 107 changed files with 11,331 additions and 1,211 deletions.
6 changes: 3 additions & 3 deletions cypress/e2e/27-two-factor-authentication.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe('Two-factor authentication', () => {
});
});

it('Should be able to login with MFA token', () => {
it.skip('Should be able to login with MFA token', () => {
const { email, password } = user;
signinPage.actions.loginWithEmailAndPassword(email, password);
personalSettingsPage.actions.enableMfa();
Expand All @@ -47,7 +47,7 @@ describe('Two-factor authentication', () => {
mainSidebar.actions.signout();
});

it('Should be able to login with recovery code', () => {
it.skip('Should be able to login with recovery code', () => {
const { email, password } = user;
signinPage.actions.loginWithEmailAndPassword(email, password);
personalSettingsPage.actions.enableMfa();
Expand All @@ -56,7 +56,7 @@ describe('Two-factor authentication', () => {
mainSidebar.actions.signout();
});

it('Should be able to disable MFA in account', () => {
it.skip('Should be able to disable MFA in account', () => {
const { email, password } = user;
signinPage.actions.loginWithEmailAndPassword(email, password);
personalSettingsPage.actions.enableMfa();
Expand Down
1 change: 1 addition & 0 deletions packages/cli/src/Server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@ export class Server extends AbstractServer {
externalSecrets: false,
showNonProdBanner: false,
debugInEditor: false,
workflowHistory: false,
},
mfa: {
enabled: false,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
<template>
<div :class="$style.container">
<GoogleAuthButton v-if="isGoogleOAuthType" @click.stop="$emit('click')" />
<GoogleAuthButton v-if="isGoogleOAuthType" />
<n8n-button
v-else
:label="$locale.baseText('credentialEdit.oAuthButton.connectMyAccount')"
size="large"
@click.stop="$emit('click')"
/>
</div>
</template>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import userEvent from '@testing-library/user-event';
import { createTestingPinia } from '@pinia/testing';
import { createComponentRenderer } from '@/__tests__/render';
import OauthButton from '@/components/CredentialEdit/OauthButton.vue';

const renderComponent = createComponentRenderer(OauthButton, {
pinia: createTestingPinia(),
});

describe('OauthButton', () => {
test.each([
['GoogleAuthButton', true],
['n8n-button', false],
])('should emit click event only once when %s is clicked', async (name, isGoogleOAuthType) => {
const { emitted, getByRole } = renderComponent({
props: { isGoogleOAuthType },
});

const button = getByRole('button');
await userEvent.click(button);

expect(emitted().click).toHaveLength(1);
});
});
2 changes: 2 additions & 0 deletions packages/editor-ui/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,7 @@ export const enum VIEWS {
SOURCE_CONTROL = 'SourceControl',
AUDIT_LOGS = 'AuditLogs',
MFA_VIEW = 'MfaView',
WORKFLOW_HISTORY = 'WorkflowHistory',
}

export const enum FAKE_DOOR_FEATURES {
Expand Down Expand Up @@ -454,6 +455,7 @@ export const enum EnterpriseEditionFeature {
ExternalSecrets = 'externalSecrets',
AuditLogs = 'auditLogs',
DebugInEditor = 'debugInEditor',
WorkflowHistory = 'workflowHistory',
}
export const MAIN_NODE_PANEL_WIDTH = 360;

Expand Down
1 change: 1 addition & 0 deletions packages/editor-ui/src/plugins/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1756,6 +1756,7 @@
"workflowSettings.timeoutAfter": "Timeout After",
"workflowSettings.timeoutWorkflow": "Timeout Workflow",
"workflowSettings.timezone": "Timezone",
"workflowHistory.title": "Version History",
"workflows.heading": "Workflows",
"workflows.add": "Add Workflow",
"workflows.menu.my": "My workflows",
Expand Down
31 changes: 27 additions & 4 deletions packages/editor-ui/src/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import SamlOnboarding from '@/views/SamlOnboarding.vue';
import SettingsSourceControl from './views/SettingsSourceControl.vue';
import SettingsExternalSecrets from './views/SettingsExternalSecrets.vue';
import SettingsAuditLogs from './views/SettingsAuditLogs.vue';
import WorkflowHistory from '@/views/WorkflowHistory.vue';
import { EnterpriseEditionFeature, VIEWS } from '@/constants';

interface IRouteConfig {
Expand Down Expand Up @@ -293,6 +294,28 @@ export const routes = [
},
],
},
{
path: '/workflow/:workflowId/history/:historyId?',
name: VIEWS.WORKFLOW_HISTORY,
components: {
default: WorkflowHistory,
sidebar: MainSidebar,
},
meta: {
keepWorkflowAlive: true,
permissions: {
allow: {
loginStatus: [LOGIN_STATUS.LoggedIn],
},
deny: {
shouldDeny: () =>
!useSettingsStore().isEnterpriseFeatureEnabled(
EnterpriseEditionFeature.WorkflowHistory,
),
},
},
},
},
{
path: '/workflows/templates/:id',
name: VIEWS.TEMPLATE_IMPORT,
Expand Down Expand Up @@ -493,7 +516,7 @@ export const routes = [
shouldDeny: () => {
const settingsStore = useSettingsStore();
return (
settingsStore.settings.hideUsagePage === true ||
settingsStore.settings.hideUsagePage ||
settingsStore.settings.deployment?.type === 'cloud'
);
},
Expand Down Expand Up @@ -570,7 +593,7 @@ export const routes = [
deny: {
shouldDeny: () => {
const settingsStore = useSettingsStore();
return settingsStore.isPublicApiEnabled === false;
return !settingsStore.isPublicApiEnabled;
},
},
},
Expand Down Expand Up @@ -685,7 +708,7 @@ export const routes = [
deny: {
shouldDeny: () => {
const settingsStore = useSettingsStore();
return settingsStore.isCommunityNodesFeatureEnabled === false;
return !settingsStore.isCommunityNodesFeatureEnabled;
},
},
},
Expand All @@ -702,7 +725,7 @@ export const routes = [
pageCategory: 'settings',
getProperties(route: RouteLocation) {
return {
feature: route.params['featureId'],
feature: route.params.featureId,
};
},
},
Expand Down
56 changes: 56 additions & 0 deletions packages/editor-ui/src/views/WorkflowHistory.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<script setup lang="ts">
import { useI18n } from '@/composables';
const i18n = useI18n();
</script>
<template>
<div :class="$style.view">
<n8n-heading :class="$style.header" tag="h2" size="medium" bold>Workflow name</n8n-heading>
<div :class="$style.corner">
<n8n-heading tag="h2" size="medium" bold>{{
i18n.baseText('workflowHistory.title')
}}</n8n-heading>
<n8n-button type="tertiary" icon="times" size="small" text square />
</div>
<div :class="$style.content"></div>
<div :class="$style.list"></div>
</div>
</template>
<style module lang="scss">
.view {
display: grid;
width: 100%;
grid-template-areas: 'header corner' 'content list';
grid-template-columns: auto 330px;
grid-template-rows: 65px auto;
background-color: var(--color-background-xlight);
}
.header {
grid-area: header;
display: flex;
align-items: center;
padding: 0 var(--spacing-l);
border-bottom: var(--border-width-base) var(--border-style-base) var(--color-foreground-base);
}
.corner {
grid-area: corner;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 var(--spacing-3xs) 0 var(--spacing-s);
background-color: var(--color-background-lighter);
border-bottom: var(--border-width-base) var(--border-style-base) var(--color-foreground-base);
border-left: var(--border-width-base) var(--border-style-base) var(--color-foreground-base);
}
.content {
grid-area: content;
}
.list {
grid-area: list;
border-left: var(--border-width-base) var(--border-style-base) var(--color-foreground-base);
}
</style>
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
import type { ICredentialType, INodeProperties } from 'n8n-workflow';

const scopes = [
'openid',
'offline_access',
'Contacts.Read',
'Contacts.ReadWrite',
'Calendars.Read',
'Calendars.Read.Shared',
'Calendars.ReadWrite',
'Mail.ReadWrite',
'Mail.ReadWrite.Shared',
'Mail.Send',
'Mail.Send.Shared',
'MailboxSettings.Read',
];

export class MicrosoftOutlookOAuth2Api implements ICredentialType {
name = 'microsoftOutlookOAuth2Api';

Expand All @@ -15,8 +30,7 @@ export class MicrosoftOutlookOAuth2Api implements ICredentialType {
displayName: 'Scope',
name: 'scope',
type: 'hidden',
default:
'openid offline_access Mail.ReadWrite Mail.ReadWrite.Shared Mail.Send Mail.Send.Shared MailboxSettings.Read',
default: scopes.join(' '),
},
{
displayName: 'Use Shared Mailbox',
Expand Down
Loading

0 comments on commit 3eec473

Please sign in to comment.