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

fix(editor): Vue3 - Fix modal positioning and multi-select tag sizing #6783

Merged
merged 6 commits into from
Jul 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 3 additions & 2 deletions cypress/e2e/11-inline-expression-editor.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ describe('Inline expression editor', () => {
it('should resolve array resolvables', () => {
WorkflowPage.getters.inlineExpressionEditorInput().clear();
WorkflowPage.getters.inlineExpressionEditorInput().type('{{');
WorkflowPage.getters.inlineExpressionEditorInput().type('[1, 2, 3]');
WorkflowPage.getters.inlineExpressionEditorInput().type('[1, 2, 3]', { timeout: 20000 });
WorkflowPage.getters.inlineExpressionEditorOutput().contains(/^\[Array: \[1,2,3\]\]$/);

WorkflowPage.getters.inlineExpressionEditorInput().clear();
Expand All @@ -65,7 +65,8 @@ describe('Inline expression editor', () => {
it('should resolve $parameter[]', () => {
WorkflowPage.getters.inlineExpressionEditorInput().clear();
WorkflowPage.getters.inlineExpressionEditorInput().type('{{');
WorkflowPage.getters.inlineExpressionEditorInput().type('$parameter["operation"]');
// Resolving $parameter is slow, especially on CI runner
WorkflowPage.getters.inlineExpressionEditorInput().type('$parameter["operation"]', { timeout: 35000 });
WorkflowPage.getters.inlineExpressionEditorOutput().contains(/^get$/);
});
});
3 changes: 3 additions & 0 deletions cypress/e2e/18-user-management.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,15 @@ describe('User Management', { disableAutoLogin: true }, () => {

it(`shouldn't allow user to set weak password`, () => {
personalSettingsPage.actions.loginAndVisit(INSTANCE_OWNER.email, INSTANCE_OWNER.password);
personalSettingsPage.getters.changePasswordLink().click();
for (let weakPass of updatedPersonalData.invalidPasswords) {
personalSettingsPage.actions.tryToSetWeakPassword(INSTANCE_OWNER.password, weakPass);
}
});

it(`shouldn't allow user to change password if old password is wrong`, () => {
personalSettingsPage.actions.loginAndVisit(INSTANCE_OWNER.email, INSTANCE_OWNER.password);
personalSettingsPage.getters.changePasswordLink().click();
personalSettingsPage.actions.updatePassword('iCannotRemember', updatedPersonalData.newPassword);
workflowPage.getters
.errorToast()
Expand All @@ -104,6 +106,7 @@ describe('User Management', { disableAutoLogin: true }, () => {

it(`should change current user password`, () => {
personalSettingsPage.actions.loginAndVisit(INSTANCE_OWNER.email, INSTANCE_OWNER.password);
personalSettingsPage.getters.changePasswordLink().click();
personalSettingsPage.actions.updatePassword(
INSTANCE_OWNER.password,
updatedPersonalData.newPassword,
Expand Down
1 change: 0 additions & 1 deletion cypress/pages/settings-personal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ export class PersonalSettingsPage extends BasePage {
this.getters.saveSettingsButton().realClick();
},
updatePassword: (oldPassword: string, newPassword: string) => {
this.getters.changePasswordLink().realClick();
changePasswordModal.getters.modalContainer().should('be.visible');
changePasswordModal.getters.currentPasswordInput().type('{selectall}').type(oldPassword);
changePasswordModal.getters.newPasswordInput().type('{selectall}').type(newPassword);
Expand Down
12 changes: 12 additions & 0 deletions packages/design-system/src/components/N8nFormInput/FormInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
<div :class="showErrors ? $style.errorInput : ''" @keydown.stop @keydown.enter="onEnter">
<slot v-if="hasDefaultSlot" />
<n8n-select
:class="{ [$style.multiSelectSmallTags]: tagSize === 'small' }"
v-else-if="type === 'select' || type === 'multi-select'"
:modelValue="modelValue"
:placeholder="placeholder"
Expand All @@ -50,6 +51,7 @@
:key="option.value"
:value="option.value"
:label="option.label"
size="small"
/>
</n8n-select>
<n8n-input
Expand Down Expand Up @@ -127,6 +129,7 @@ export interface Props {
inactiveLabel?: string;
inactiveColor?: string;
teleported?: boolean;
tagSize?: 'small' | 'medium';
}

const props = withDefaults(defineProps<Props>(), {
Expand All @@ -136,6 +139,7 @@ const props = withDefaults(defineProps<Props>(), {
showRequiredAsterisk: true,
validateOnBlur: true,
teleported: true,
tagSize: 'small',
});

const emit = defineEmits<{
Expand Down Expand Up @@ -268,4 +272,12 @@ defineExpose({ inputRef });
.errorInput {
--input-border-color: var(--color-danger);
}

.multiSelectSmallTags {
:global(.el-tag) {
height: 24px;
padding: 0 8px;
line-height: 22px;
}
}
</style>
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
:data-test-id="input.name"
:showValidationWarnings="showValidationWarnings"
:teleported="teleported"
:tagSize="tagSize"
@update:modelValue="(value) => onUpdateModelValue(input.name, value)"
@validate="(value) => onValidate(input.name, value)"
@enter="onSubmit"
Expand Down Expand Up @@ -73,6 +74,11 @@ export default defineComponent({
type: Boolean,
default: true,
},
tagSize: {
type: String,
default: 'small',
validator: (value: string): boolean => ['small', 'medium'].includes(value),
},
},
data() {
return {
Expand Down
6 changes: 2 additions & 4 deletions packages/editor-ui/src/components/NodeDetailsView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -694,12 +694,10 @@ export default defineComponent({
</script>

<style lang="scss">
.el-overlay-dialog {
padding-top: var(--spacing-2xs);
}

.ndv-wrapper {
overflow: visible;
padding-top: var(--spacing-2xs);
margin-top: 0;
}

.data-display-wrapper {
Expand Down
1 change: 1 addition & 0 deletions packages/editor-ui/src/components/PersonalizationModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
:columnView="true"
:eventBus="formBus"
:teleported="teleported"
tagSize="small"
@submit="onSubmit"
/>
</div>
Expand Down
5 changes: 5 additions & 0 deletions packages/editor-ui/src/n8n-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,15 @@
font-weight: 400;
}

.el-overlay-dialog {
justify-content: unset;
}

.el-dialog {
border: var(--border-base);
box-shadow: 0px 6px 16px rgb(68 28 23 / 6%);
border-radius: 8px;
margin-top: 15vh;

@media (max-height: 1050px) {
margin: 4em auto !important;
Expand Down
Loading