mirror of
https://github.com/Unleash/unleash.git
synced 2025-08-04 13:48:56 +02:00
fix: reset stickiness to default on variants modal close (#3455)
<!-- Thanks for creating a PR! To make it easier for reviewers and everyone else to understand what your changes relate to, please add some relevant content to the headings below. Feel free to ignore or delete sections that you don't think are relevant. Thank you! ❤️ --> Expanded the onClose handler to reset stickiness to default for project on modal close ## About the changes <!-- Describe the changes introduced. What are they and why are they being introduced? Feel free to also add screenshots or steps to view the changes if they're visual. --> <!-- Does it close an issue? Multiple? --> Closes # <!-- (For internal contributors): Does it relate to an issue on public roadmap? --> <!-- Relates to [roadmap](https://github.com/orgs/Unleash/projects/10) item: # --> ### Important files <!-- PRs can contain a lot of changes, but not all changes are equally important. Where should a reviewer start looking to get an overview of the changes? Are any files particularly important? --> ## Discussion points <!-- Anything about the PR you'd like to discuss before it gets merged? Got any questions or doubts? --> --------- Signed-off-by: andreas-unleash <andreas@getunleash.ai>
This commit is contained in:
parent
368b066219
commit
c6ba6059cc
2
frontend/cypress/global.d.ts
vendored
2
frontend/cypress/global.d.ts
vendored
@ -75,7 +75,7 @@ declare namespace Cypress {
|
|||||||
): Chainable;
|
): Chainable;
|
||||||
createProject_API(name: string): Chainable;
|
createProject_API(name: string): Chainable;
|
||||||
deleteProject_API(name: string): Chainable;
|
deleteProject_API(name: string): Chainable;
|
||||||
createFeature_API(name: string, projectName: string): Chainable;
|
createFeature_API(name: string, projectName?: string): Chainable;
|
||||||
deleteFeature_API(name: string): Chainable;
|
deleteFeature_API(name: string): Chainable;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
///<reference path="../../global.d.ts" />
|
///<reference path="../../global.d.ts" />
|
||||||
|
|
||||||
const ENTERPRISE = Boolean(Cypress.env('ENTERPRISE'));
|
describe('feature', () => {
|
||||||
const randomId = String(Math.random()).split('.')[1];
|
const randomId = String(Math.random()).split('.')[1];
|
||||||
const featureToggleName = `unleash-e2e-${randomId}`;
|
const featureToggleName = `unleash-e2e-${randomId}`;
|
||||||
|
|
||||||
@ -8,7 +8,6 @@ const variant1 = 'variant1';
|
|||||||
const variant2 = 'variant2';
|
const variant2 = 'variant2';
|
||||||
let strategyId = '';
|
let strategyId = '';
|
||||||
|
|
||||||
describe('feature', () => {
|
|
||||||
before(() => {
|
before(() => {
|
||||||
cy.runBefore();
|
cy.runBefore();
|
||||||
});
|
});
|
||||||
|
@ -1,16 +1,11 @@
|
|||||||
///<reference path="../../global.d.ts" />
|
///<reference path="../../global.d.ts" />
|
||||||
|
|
||||||
|
describe('groups', () => {
|
||||||
const baseUrl = Cypress.config().baseUrl;
|
const baseUrl = Cypress.config().baseUrl;
|
||||||
const randomId = String(Math.random()).split('.')[1];
|
const randomId = String(Math.random()).split('.')[1];
|
||||||
const groupName = `unleash-e2e-${randomId}`;
|
const groupName = `unleash-e2e-${randomId}`;
|
||||||
const userIds: any[] = [];
|
const userIds: any[] = [];
|
||||||
|
|
||||||
// Disable all active splash pages by visiting them.
|
|
||||||
const disableActiveSplashScreens = () => {
|
|
||||||
cy.visit(`/splash/operators`);
|
|
||||||
};
|
|
||||||
|
|
||||||
describe('groups', () => {
|
|
||||||
before(() => {
|
before(() => {
|
||||||
cy.runBefore();
|
cy.runBefore();
|
||||||
cy.login_UI();
|
cy.login_UI();
|
||||||
|
@ -1,18 +1,13 @@
|
|||||||
///<reference path="../../global.d.ts" />
|
///<reference path="../../global.d.ts" />
|
||||||
|
|
||||||
|
describe('imports', () => {
|
||||||
const baseUrl = Cypress.config().baseUrl;
|
const baseUrl = Cypress.config().baseUrl;
|
||||||
const randomSeed = String(Math.random()).split('.')[1];
|
const randomSeed = String(Math.random()).split('.')[1];
|
||||||
const randomFeatureName = `cypress-features${randomSeed}`;
|
const randomFeatureName = `cypress-features${randomSeed}`;
|
||||||
const userIds: any[] = [];
|
const userIds: any[] = [];
|
||||||
|
|
||||||
// Disable all active splash pages by visiting them.
|
|
||||||
const disableActiveSplashScreens = () => {
|
|
||||||
cy.visit(`/splash/operators`);
|
|
||||||
};
|
|
||||||
|
|
||||||
describe('imports', () => {
|
|
||||||
before(() => {
|
before(() => {
|
||||||
disableActiveSplashScreens();
|
cy.runBefore();
|
||||||
cy.login_UI();
|
cy.login_UI();
|
||||||
for (let i = 1; i <= 2; i++) {
|
for (let i = 1; i <= 2; i++) {
|
||||||
cy.request('POST', `${baseUrl}/api/admin/user-admin`, {
|
cy.request('POST', `${baseUrl}/api/admin/user-admin`, {
|
||||||
|
@ -11,6 +11,7 @@ import {
|
|||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
} from '../../../src/utils/testIds';
|
} from '../../../src/utils/testIds';
|
||||||
|
|
||||||
|
describe('project-access', () => {
|
||||||
const baseUrl = Cypress.config().baseUrl;
|
const baseUrl = Cypress.config().baseUrl;
|
||||||
const randomId = String(Math.random()).split('.')[1];
|
const randomId = String(Math.random()).split('.')[1];
|
||||||
const groupAndProjectName = `group-e2e-${randomId}`;
|
const groupAndProjectName = `group-e2e-${randomId}`;
|
||||||
@ -18,14 +19,8 @@ const userName = `user-e2e-${randomId}`;
|
|||||||
const groupIds: any[] = [];
|
const groupIds: any[] = [];
|
||||||
const userIds: any[] = [];
|
const userIds: any[] = [];
|
||||||
|
|
||||||
// Disable all active splash pages by visiting them.
|
|
||||||
const disableActiveSplashScreens = () => {
|
|
||||||
cy.visit(`/splash/operators`);
|
|
||||||
};
|
|
||||||
|
|
||||||
describe('project-access', () => {
|
|
||||||
before(() => {
|
before(() => {
|
||||||
disableActiveSplashScreens();
|
cy.runBefore();
|
||||||
cy.login_UI();
|
cy.login_UI();
|
||||||
for (let i = 1; i <= 2; i++) {
|
for (let i = 1; i <= 2; i++) {
|
||||||
const name = `${i}-${userName}`;
|
const name = `${i}-${userName}`;
|
||||||
|
@ -1,20 +1,16 @@
|
|||||||
///<reference path="../../global.d.ts" />
|
///<reference path="../../global.d.ts" />
|
||||||
|
|
||||||
import UserCredentials = Cypress.UserCredentials;
|
|
||||||
|
|
||||||
const ENTERPRISE = Boolean(Cypress.env('ENTERPRISE'));
|
|
||||||
const randomId = String(Math.random()).split('.')[1];
|
|
||||||
const featureToggleName = `notifications_test-${randomId}`;
|
|
||||||
const baseUrl = Cypress.config().baseUrl;
|
|
||||||
let strategyId = '';
|
|
||||||
let userIds: number[] = [];
|
|
||||||
let userCredentials: UserCredentials[] = [];
|
|
||||||
const userName = `notifications_user-${randomId}`;
|
|
||||||
const projectName = `default`;
|
|
||||||
|
|
||||||
const EDITOR = 2;
|
const EDITOR = 2;
|
||||||
|
|
||||||
describe('notifications', () => {
|
describe('notifications', () => {
|
||||||
|
const randomId = String(Math.random()).split('.')[1];
|
||||||
|
const featureToggleName = `notifications_test-${randomId}`;
|
||||||
|
const baseUrl = Cypress.config().baseUrl;
|
||||||
|
let userIds: number[] = [];
|
||||||
|
let userCredentials: Cypress.UserCredentials[] = [];
|
||||||
|
const userName = `notifications_user-${randomId}`;
|
||||||
|
const projectName = `default`;
|
||||||
|
|
||||||
before(() => {
|
before(() => {
|
||||||
cy.runBefore();
|
cy.runBefore();
|
||||||
});
|
});
|
||||||
@ -45,10 +41,11 @@ describe('notifications', () => {
|
|||||||
cy.get("[data-testid='NOTIFICATIONS_BUTTON']").click();
|
cy.get("[data-testid='NOTIFICATIONS_BUTTON']").click();
|
||||||
|
|
||||||
//then
|
//then
|
||||||
cy.get("[data-testid='UNREAD_NOTIFICATIONS']").should('exist');
|
// cy.get("[data-testid='UNREAD_NOTIFICATIONS']").should('exist');
|
||||||
cy.get("[data-testid='NOTIFICATIONS_LIST']")
|
cy.get("[data-testid='NOTIFICATIONS_LIST']").should(
|
||||||
.eq(0)
|
'contain.text',
|
||||||
.should('contain.text', `New feature ${featureToggleName}`);
|
`New feature ${featureToggleName}`
|
||||||
|
);
|
||||||
|
|
||||||
//clean
|
//clean
|
||||||
// We need to login as admin for cleanup
|
// We need to login as admin for cleanup
|
||||||
|
@ -8,13 +8,14 @@ import {
|
|||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
} from '../../../src/utils/testIds';
|
} from '../../../src/utils/testIds';
|
||||||
|
|
||||||
|
describe('project overview', () => {
|
||||||
const randomId = String(Math.random()).split('.')[1];
|
const randomId = String(Math.random()).split('.')[1];
|
||||||
const featureTogglePrefix = 'unleash-e2e-project-overview';
|
const featureTogglePrefix = 'unleash-e2e-project-overview';
|
||||||
const featureToggleName = `${featureTogglePrefix}-${randomId}`;
|
const featureToggleName = `${featureTogglePrefix}-${randomId}`;
|
||||||
const baseUrl = Cypress.config().baseUrl;
|
const baseUrl = Cypress.config().baseUrl;
|
||||||
const selectAll = '[title="Toggle All Rows Selected"] input[type="checkbox"]';
|
const selectAll =
|
||||||
|
'[title="Toggle All Rows Selected"] input[type="checkbox"]';
|
||||||
|
|
||||||
describe('project overview', () => {
|
|
||||||
before(() => {
|
before(() => {
|
||||||
cy.runBefore();
|
cy.runBefore();
|
||||||
});
|
});
|
||||||
|
@ -1,16 +1,14 @@
|
|||||||
///<reference path="../../global.d.ts" />
|
///<reference path="../../global.d.ts" />
|
||||||
|
|
||||||
|
describe('project settings', () => {
|
||||||
const randomId = String(Math.random()).split('.')[1];
|
const randomId = String(Math.random()).split('.')[1];
|
||||||
const baseUrl = Cypress.config().baseUrl;
|
const baseUrl = Cypress.config().baseUrl;
|
||||||
let strategyId = '';
|
|
||||||
const userName = `settings-user-${randomId}`;
|
|
||||||
const projectName = `stickiness-project-${randomId}`;
|
const projectName = `stickiness-project-${randomId}`;
|
||||||
const TEST_STICKINESS = 'userId';
|
const TEST_STICKINESS = 'userId';
|
||||||
const featureToggleName = `settings-${randomId}`;
|
const featureToggleName = `settings-${randomId}`;
|
||||||
let cleanFeature = false;
|
let cleanFeature = false;
|
||||||
let cleanProject = false;
|
let cleanProject = false;
|
||||||
|
|
||||||
describe('project settings', () => {
|
|
||||||
before(() => {
|
before(() => {
|
||||||
cy.runBefore();
|
cy.runBefore();
|
||||||
});
|
});
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
///<reference path="../../global.d.ts" />
|
///<reference path="../../global.d.ts" />
|
||||||
|
|
||||||
|
describe('segments', () => {
|
||||||
const randomId = String(Math.random()).split('.')[1];
|
const randomId = String(Math.random()).split('.')[1];
|
||||||
const segmentName = `unleash-e2e-${randomId}`;
|
const segmentName = `unleash-e2e-${randomId}`;
|
||||||
let segmentId: string;
|
let segmentId: string;
|
||||||
|
|
||||||
describe('segments', () => {
|
|
||||||
before(() => {
|
before(() => {
|
||||||
cy.runBefore();
|
cy.runBefore();
|
||||||
});
|
});
|
||||||
|
@ -209,7 +209,7 @@ export const EnvironmentVariantsModal = ({
|
|||||||
stickiness:
|
stickiness:
|
||||||
variantsEdit?.length > 0
|
variantsEdit?.length > 0
|
||||||
? variantsEdit[0].stickiness
|
? variantsEdit[0].stickiness
|
||||||
: 'default',
|
: defaultStickiness,
|
||||||
new: true,
|
new: true,
|
||||||
isValid: false,
|
isValid: false,
|
||||||
id,
|
id,
|
||||||
@ -307,18 +307,17 @@ export const EnvironmentVariantsModal = ({
|
|||||||
}
|
}
|
||||||
}, [apiPayload.error]);
|
}, [apiPayload.error]);
|
||||||
|
|
||||||
|
const handleClose = () => {
|
||||||
|
updateStickiness(defaultStickiness).then();
|
||||||
|
setOpen(false);
|
||||||
|
};
|
||||||
|
|
||||||
if (loading || stickiness === '') {
|
if (loading || stickiness === '') {
|
||||||
return <Loader />;
|
return <Loader />;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SidebarModal
|
<SidebarModal open={open} onClose={handleClose} label="">
|
||||||
open={open}
|
|
||||||
onClose={() => {
|
|
||||||
setOpen(false);
|
|
||||||
}}
|
|
||||||
label=""
|
|
||||||
>
|
|
||||||
<FormTemplate
|
<FormTemplate
|
||||||
modal
|
modal
|
||||||
title=""
|
title=""
|
||||||
@ -459,11 +458,7 @@ export const EnvironmentVariantsModal = ({
|
|||||||
? changeRequestButtonText
|
? changeRequestButtonText
|
||||||
: 'Save variants'}
|
: 'Save variants'}
|
||||||
</Button>
|
</Button>
|
||||||
<StyledCancelButton
|
<StyledCancelButton onClick={handleClose}>
|
||||||
onClick={() => {
|
|
||||||
setOpen(false);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
Cancel
|
Cancel
|
||||||
</StyledCancelButton>
|
</StyledCancelButton>
|
||||||
</StyledButtonContainer>
|
</StyledButtonContainer>
|
||||||
|
Loading…
Reference in New Issue
Block a user