Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User management v2 Front End #3795

Merged
merged 31 commits into from
Aug 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
f3f9e4a
feat: Added responsive generic page view layout.
alexgrozav Jul 26, 2022
5999fa3
feat: Added empty state.
alexgrozav Jul 26, 2022
627089b
Merge branch 'user-management-p2' into user-management-p2-frontend
alexgrozav Jul 26, 2022
117dbd9
feat: Added credentials view empty state.
alexgrozav Jul 27, 2022
3985c9c
test: Added unit tests for N8nActionBox
alexgrozav Jul 27, 2022
30fb29e
feat: Added credentials list initial design.
alexgrozav Jul 27, 2022
284ff53
feat: Added credential actions. Started working on filters.
alexgrozav Jul 29, 2022
8433ad7
feat: Updated InfoTip markup, added tests and changed stories to type…
alexgrozav Aug 3, 2022
70e0b4c
feat: Added credentials filtering by type. Added support for apply/re…
alexgrozav Aug 3, 2022
d1e358a
feat: Added credential sharing user select and user list. Added paywa…
alexgrozav Aug 5, 2022
0be3902
feat: Updated credentials view permissions.
alexgrozav Aug 9, 2022
4baf47d
feat: Added support for temporary sharing config for unsaved credenti…
alexgrozav Aug 10, 2022
f3a82eb
test: Fixed broken snapshots.
alexgrozav Aug 19, 2022
15acdb6
chore: Merged user-management-p2 into user-management-p2-frontend.
alexgrozav Aug 22, 2022
b05ba51
feat: Added overflow styles to page-view-layout list.
alexgrozav Aug 22, 2022
003bae7
feat: Handled sharee specific views.
alexgrozav Aug 22, 2022
8e314fb
Merge branch 'user-management-p2' into user-management-p2-frontend
alexgrozav Aug 23, 2022
f8ddc18
feat: Integration between FE and BE to support real-world credential …
alexgrozav Aug 23, 2022
30e3f71
feat: Added front end permissions table.
alexgrozav Aug 25, 2022
9c5cf62
feat: Refactored credential sharing flow. Updated design elements.
alexgrozav Aug 25, 2022
cf7ade6
feat: Added margin and padding auto spacer utilities.
alexgrozav Aug 26, 2022
7ffd4fe
feat: Rehauled permissions to support instanceOwner role and action i…
alexgrozav Aug 26, 2022
97f88a2
chore: Merged user-management-p2 into user-management-p2-frontend.
alexgrozav Aug 26, 2022
bd89ce7
feat: Updated credentials view to apply filters automatically.
alexgrozav Aug 26, 2022
e820b84
feat: Removed apply filters button and added active button state.
alexgrozav Aug 26, 2022
909a0da
test: Updated component snapshots.
alexgrozav Aug 26, 2022
74df9d0
refactor: Renamed ResourceSharee to ResourceReader.
alexgrozav Aug 26, 2022
1e342f0
Merge branch 'user-management-p2' into user-management-p2-frontend
alexgrozav Aug 26, 2022
6f87323
Merge branch 'user-management-p2' into user-management-p2-frontend
alexgrozav Aug 26, 2022
50576bb
feat: Credential sharing error handling, permissions improvement.
alexgrozav Aug 29, 2022
34b9c37
feat: Updated permissions and error handling.
alexgrozav Aug 29, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7,589 changes: 4,194 additions & 3,395 deletions package-lock.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
/* tslint:disable:variable-name */

import N8nActionBox from './ActionBox.vue';
import { action } from '@storybook/addon-actions';
import {StoryFn} from "@storybook/vue";

export default {
title: 'Atoms/ActionBox',
Expand All @@ -21,7 +24,7 @@ const methods = {
onClick: action('click'),
};

const Template = (args, { argTypes }) => ({
const Template: StoryFn = (args, { argTypes }) => ({
props: Object.keys(argTypes),
components: {
N8nActionBox,
Expand Down
29 changes: 25 additions & 4 deletions packages/design-system/src/components/N8nActionBox/ActionBox.vue
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
<template>
<div :class="['n8n-action-box', $style.container]">
<div :class="$style.heading" v-if="heading">
<n8n-heading size="xlarge" align="center">{{ heading }}</n8n-heading>
<div :class="$style.emoji" v-if="emoji">
{{ emoji }}
</div>
<div :class="$style.heading" v-if="heading || $slots.heading">
<n8n-heading size="xlarge" align="center">
<slot name="heading">{{ heading }}</slot>
</n8n-heading>
</div>
<div :class="$style.description" @click="$emit('descriptionClick', $event)">
<n8n-text color="text-base">
<span v-html="description"></span>
<slot name="description">
<span v-html="description"></span>
</slot>
</n8n-text>
</div>
<n8n-button v-if="buttonText" :label="buttonText" size="large"
<n8n-button
v-if="buttonText"
:label="buttonText"
:type="buttonType"
size="large"
@click="$emit('click', $event)"
/>
<n8n-callout
Expand Down Expand Up @@ -42,12 +53,18 @@ export default Vue.extend({
N8nCallout,
},
props: {
emoji: {
type: String,
},
heading: {
type: String,
},
buttonText: {
type: String,
},
buttonType: {
type: String,
},
description: {
type: String,
},
Expand Down Expand Up @@ -76,6 +93,10 @@ export default Vue.extend({

> * {
margin-bottom: var(--spacing-l);

&:last-child {
margin-bottom: 0;
}
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { render } from '@testing-library/vue';
import N8NActionBox from '../ActionBox.vue';

describe('components', () => {
describe('N8NActionBox', () => {
describe('props', () => {
it('should render correctly', () => {
const wrapper = render(N8NActionBox, {
props: {
emoji: "😿",
heading: "Headline you need to know",
description: "Long description that you should know something is the way it is because of how it is. ",
buttonText: "Do something",
},
stubs: [
'n8n-heading',
'n8n-text',
'n8n-button',
'n8n-callout',
],
});
expect(wrapper.html()).toMatchSnapshot();
});
});
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Vitest Snapshot v1

exports[`components > N8NActionBox > props > should render correctly 1`] = `
"<div class=\\"n8n-action-box _container_1ng3s_1\\">
<div class=\\"_emoji_1ng3s_16\\"> 😿 </div>
<div class=\\"_heading_1ng3s_20\\">
<n8n-heading-stub tag=\\"span\\" size=\\"xlarge\\" align=\\"center\\">Headline you need to know</n8n-heading-stub>
</div>
<div class=\\"_description_1ng3s_24\\">
<n8n-text-stub size=\\"medium\\" color=\\"text-base\\" tag=\\"span\\"><span>Long description that you should know something is the way it is because of how it is. </span></n8n-text-stub>
</div>
<n8n-button-stub label=\\"Do something\\" type=\\"primary\\" size=\\"large\\"></n8n-button-stub>
<!---->
</div>"
`;
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
<template>
<span :class="$style.container">
<el-dropdown :placement="placement" :size="size" trigger="click" @command="onCommand" @visible-change="onVisibleChange">
<el-dropdown
:placement="placement"
:size="size"
trigger="click"
@click.native.stop
@command="onCommand"
@visible-change="onVisibleChange"
>
<span :class="{[$style.button]: true, [$style[theme]]: !!theme}">
<component :is="$options.components.N8nIcon"
icon="ellipsis-v"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
argTypes: {
theme: {
type: 'text',
options: ['default', 'secondary'],
options: ['default', 'primary', 'secondary', 'tertiary'],
},
size: {
type: 'select',
Expand Down
19 changes: 18 additions & 1 deletion packages/design-system/src/components/N8nBadge/Badge.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default Vue.extend({
theme: {
type: String,
default: 'default',
validator: (value: string) => ['default', 'secondary'].includes(value),
validator: (value: string) => ['default', 'primary', 'secondary', 'tertiary'].includes(value),
},
size: {
type: String,
Expand Down Expand Up @@ -51,10 +51,27 @@ export default Vue.extend({
border-color: var(--color-text-light);
}

.primary {
composes: badge;
padding: var(--spacing-5xs) var(--spacing-3xs);
border-radius: var(--border-radius-xlarge);
color: var(--color-foreground-xlight);
background-color: var(--color-primary);
border-color: var(--color-primary);
}

.secondary {
composes: badge;
border-radius: var(--border-radius-xlarge);
color: var(--color-secondary);
background-color: var(--color-secondary-tint-1);
}

.tertiary {
composes: badge;
border-radius: var(--border-radius-base);
color: var(--color-text-light);
border-color: var(--color-text-light);
padding: 1px var(--spacing-4xs);
}
</style>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Vitest Snapshot v1

exports[`components > N8nBadge > props > should render default theme correctly 1`] = `"<span class=\\"n8n-badge _default_13dw2_9 _badge_13dw2_1\\"><n8n-text-stub bold=\\"true\\" size=\\"large\\" compact=\\"true\\" tag=\\"span\\"><n8n-text-stub size=\\"medium\\" tag=\\"span\\">Default badge</n8n-text-stub></n8n-text-stub></span>"`;
exports[`components > N8nBadge > props > should render default theme correctly 1`] = `"<span class=\\"n8n-badge _default_1xljn_9 _badge_1xljn_1\\"><n8n-text-stub bold=\\"true\\" size=\\"large\\" compact=\\"true\\" tag=\\"span\\"><n8n-text-stub size=\\"medium\\" tag=\\"span\\">Default badge</n8n-text-stub></n8n-text-stub></span>"`;

exports[`components > N8nBadge > props > should render secondary theme correctly 1`] = `"<span class=\\"n8n-badge _secondary_13dw2_16 _badge_13dw2_1\\"><n8n-text-stub size=\\"medium\\" compact=\\"true\\" tag=\\"span\\"><n8n-text-stub size=\\"medium\\" tag=\\"span\\">Secondary badge</n8n-text-stub></n8n-text-stub></span>"`;
exports[`components > N8nBadge > props > should render secondary theme correctly 1`] = `"<span class=\\"n8n-badge _secondary_1xljn_25 _badge_1xljn_1\\"><n8n-text-stub size=\\"medium\\" compact=\\"true\\" tag=\\"span\\"><n8n-text-stub size=\\"medium\\" tag=\\"span\\">Secondary badge</n8n-text-stub></n8n-text-stub></span>"`;

exports[`components > N8nBadge > props > should render with default values correctly 1`] = `"<span class=\\"n8n-badge _default_13dw2_9 _badge_13dw2_1\\"><n8n-text-stub size=\\"small\\" compact=\\"true\\" tag=\\"span\\"><n8n-text-stub size=\\"medium\\" tag=\\"span\\">A Badge</n8n-text-stub></n8n-text-stub></span>"`;
exports[`components > N8nBadge > props > should render with default values correctly 1`] = `"<span class=\\"n8n-badge _default_1xljn_9 _badge_1xljn_1\\"><n8n-text-stub size=\\"small\\" compact=\\"true\\" tag=\\"span\\"><n8n-text-stub size=\\"medium\\" tag=\\"span\\">A Badge</n8n-text-stub></n8n-text-stub></span>"`;
10 changes: 7 additions & 3 deletions packages/design-system/src/components/N8nButton/Button.vue
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ export default Vue.extend({
type: Boolean,
default: false,
},
active: {
type: Boolean,
default: false,
},
float: {
type: String,
validator: (value: string): boolean =>
Expand All @@ -96,6 +100,7 @@ export default Vue.extend({
`${this.text ? ` ${this.$style['text']}` : ''}` +
`${this.disabled ? ` ${this.$style['disabled']}` : ''}` +
`${this.block ? ` ${this.$style['block']}` : ''}` +
`${this.active ? ` ${this.$style['active']}` : ''}` +
`${this.icon || this.loading ? ` ${this.$style['icon']}` : ''}`;
},
},
Expand Down Expand Up @@ -140,7 +145,7 @@ export default Vue.extend({
outline: $focus-outline-width solid $button-focus-outline-color;
}

&:active {
&:active, &.active {
color: $button-active-color;
border-color: $button-active-border-color;
background-color: $button-active-background-color;
Expand Down Expand Up @@ -389,8 +394,7 @@ $loading-overlay-background-color: rgba(255, 255, 255, 0);
}
}

.loading,
.active {
.loading {
position: relative;
pointer-events: none;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// Vitest Snapshot v1

exports[`components > N8nButton > overrides > should render correctly 1`] = `"<button aria-disabled=\\"false\\" aria-busy=\\"false\\" aria-live=\\"polite\\" class=\\"button _button_cccce_115 _secondary_cccce_170 _medium_cccce_254 _icon_cccce_239\\" icon=\\"plus-circle\\" type=\\"secondary\\"><span class=\\"_icon_cccce_239\\"><n8n-icon-stub icon=\\"plus-circle\\" size=\\"medium\\"></n8n-icon-stub></span><span>Button</span></button>"`;
exports[`components > N8nButton > overrides > should render correctly 1`] = `"<button aria-disabled=\\"false\\" aria-busy=\\"false\\" aria-live=\\"polite\\" class=\\"button _button_dnko0_115 _secondary_dnko0_170 _medium_dnko0_254 _icon_dnko0_239\\" icon=\\"plus-circle\\" type=\\"secondary\\"><span class=\\"_icon_dnko0_239\\"><n8n-icon-stub icon=\\"plus-circle\\" size=\\"medium\\"></n8n-icon-stub></span><span>Button</span></button>"`;

exports[`components > N8nButton > props > icon > should render icon button 1`] = `"<button aria-disabled=\\"false\\" aria-busy=\\"false\\" aria-live=\\"polite\\" class=\\"button _button_cccce_115 _primary_cccce_288 _medium_cccce_254 _icon_cccce_239\\"><span class=\\"_icon_cccce_239\\"><n8n-icon-stub icon=\\"plus-circle\\" size=\\"medium\\"></n8n-icon-stub></span><span>Button</span></button>"`;
exports[`components > N8nButton > props > icon > should render icon button 1`] = `"<button aria-disabled=\\"false\\" aria-busy=\\"false\\" aria-live=\\"polite\\" class=\\"button _button_dnko0_115 _primary_dnko0_288 _medium_dnko0_254 _icon_dnko0_239\\"><span class=\\"_icon_dnko0_239\\"><n8n-icon-stub icon=\\"plus-circle\\" size=\\"medium\\"></n8n-icon-stub></span><span>Button</span></button>"`;

exports[`components > N8nButton > props > loading > should render loading spinner 1`] = `"<button disabled=\\"disabled\\" aria-disabled=\\"false\\" aria-busy=\\"true\\" aria-live=\\"polite\\" class=\\"button _button_cccce_115 _primary_cccce_288 _medium_cccce_254 _loading_cccce_352 _icon_cccce_239\\"><span class=\\"_icon_cccce_239\\"><n8n-spinner-stub size=\\"medium\\" type=\\"dots\\"></n8n-spinner-stub></span><span>Button</span></button>"`;
exports[`components > N8nButton > props > loading > should render loading spinner 1`] = `"<button disabled=\\"disabled\\" aria-disabled=\\"false\\" aria-busy=\\"true\\" aria-live=\\"polite\\" class=\\"button _button_dnko0_115 _primary_dnko0_288 _medium_dnko0_254 _loading_dnko0_352 _icon_dnko0_239\\"><span class=\\"_icon_dnko0_239\\"><n8n-spinner-stub size=\\"medium\\" type=\\"dots\\"></n8n-spinner-stub></span><span>Button</span></button>"`;

exports[`components > N8nButton > should render correctly 1`] = `
"<button aria-disabled=\\"false\\" aria-busy=\\"false\\" aria-live=\\"polite\\" class=\\"button _button_cccce_115 _primary_cccce_288 _medium_cccce_254\\">
"<button aria-disabled=\\"false\\" aria-busy=\\"false\\" aria-live=\\"polite\\" class=\\"button _button_dnko0_115 _primary_dnko0_288 _medium_dnko0_254\\">
<!----><span>Button</span></button>"
`;
29 changes: 25 additions & 4 deletions packages/design-system/src/components/N8nCard/Card.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

import N8nCard from './Card.vue';
import {StoryFn} from "@storybook/vue";
import N8nButton from "../N8nButton/Button.vue";
import N8nIcon from "../N8nIcon/Icon.vue";
import N8nText from "../N8nText/Text.vue";

export default {
title: 'Atoms/Card',
Expand All @@ -16,14 +19,32 @@ export const Default: StoryFn = (args, {argTypes}) => ({
template: `<n8n-card v-bind="$props">This is a card.</n8n-card>`,
});

export const WithHeaderAndFooter: StoryFn = (args, {argTypes}) => ({

export const WithSlots: StoryFn = (args, {argTypes}) => ({
props: Object.keys(argTypes),
components: {
N8nCard,
N8nButton,
N8nIcon,
N8nText,
},
template: `<n8n-card v-bind="$props">
<template #header>Header</template>
This is a card.
<template #footer>Footer</template>
<template slot="prepend">
<n8n-icon icon="check" size="large" />
</template>
<template slot="header">
<strong>Card header</strong>
</template>
<n8n-text color="text-light" size="medium" class="mt-2xs mb-2xs">
This is the card body.
</n8n-text>
<template slot="footer">
<n8n-text size="medium">
Card footer
</n8n-text>
</template>
<template slot="append">
<n8n-button>Click me</n8n-button>
</template>
</n8n-card>`,
});
42 changes: 34 additions & 8 deletions packages/design-system/src/components/N8nCard/Card.vue
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
<template>
<div :class="['card', $style.card]" v-on="$listeners">
<div :class="$style.header" v-if="$slots.header">
<slot name="header" />
<div :class="$style.icon" v-if="$slots.prepend">
<slot name="prepend" />
</div>
<div :class="$style.body" v-if="$slots.default">
<slot />
<div :class="$style.content">
<div :class="$style.header" v-if="$slots.header">
<slot name="header" />
</div>
<div :class="$style.body" v-if="$slots.default">
<slot />
</div>
<div :class="$style.footer" v-if="$slots.footer">
<slot name="footer" />
</div>
</div>
<div :class="$style.footer" v-if="$slots.footer">
<slot name="footer" />
<div :class="$style.actions" v-if="$slots.append">
<slot name="append" />
</div>
</div>
</template>
Expand All @@ -17,6 +25,7 @@ import Vue from 'vue';

export default Vue.extend({
name: 'n8n-card',
inheritAttrs: true,
});
</script>

Expand All @@ -27,8 +36,9 @@ export default Vue.extend({
background-color: var(--color-background-xlight);
padding: var(--spacing-s);
display: flex;
flex-direction: column;
justify-content: space-between;
flex-direction: row;
width: 100%;
align-items: center;
}

.header,
Expand All @@ -39,11 +49,27 @@ export default Vue.extend({
align-items: center;
}

.content {
display: flex;
flex-direction: column;
justify-content: space-between;
flex: 1;
}

.body {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
justify-content: space-between;
}

.icon {
width: 24px;
height: 24px;
display: inline-flex;
justify-content: center;
align-items: center;
margin-right: var(--spacing-s);
}
</style>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Vitest Snapshot v1

exports[`components > N8nCard > should render correctly 1`] = `
"<div class=\\"card _card_1oonz_1\\">
<!---->
<div class=\\"_content_1oonz_20\\">
<!---->
<div class=\\"_body_1oonz_27\\">This is a card.</div>
<!---->
</div>
<!---->
</div>"
`;

exports[`components > N8nCard > should render correctly with header and footer 1`] = `
"<div class=\\"card _card_1oonz_1\\">
<!---->
<div class=\\"_content_1oonz_20\\">
<div class=\\"_header_1oonz_12\\">Header</div>
<div class=\\"_body_1oonz_27\\">This is a card.</div>
<div class=\\"_footer_1oonz_13\\">Footer</div>
</div>
<!---->
</div>"
`;
Loading