From 32bcd94e544f8ed02eed20e7cb2afb9df459917b Mon Sep 17 00:00:00 2001
From: Parthvi12 <80334441+Parthvi12@users.noreply.github.com>
Date: Wed, 18 May 2022 10:15:32 +0530
Subject: [PATCH 1/6] Add tests for git discard changes (#13866)
---
.../GitDiscardChange/DiscardChanges_spec.js | 228 ++++++++++++++++++
.../cypress/locators/gitSyncLocators.js | 1 +
app/client/cypress/support/gitSync.js | 34 +++
app/client/cypress/support/widgetCommands.js | 11 +-
4 files changed, 273 insertions(+), 1 deletion(-)
create mode 100644 app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/GitDiscardChange/DiscardChanges_spec.js
diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/GitDiscardChange/DiscardChanges_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/GitDiscardChange/DiscardChanges_spec.js
new file mode 100644
index 0000000000..b5cae1240c
--- /dev/null
+++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/GitDiscardChange/DiscardChanges_spec.js
@@ -0,0 +1,228 @@
+const datasource = require("../../../../locators/DatasourcesEditor.json");
+const queryLocators = require("../../../../locators/QueryEditor.json");
+const dynamicInputLocators = require("../../../../locators/DynamicInput.json");
+const explorer = require("../../../../locators/explorerlocators.json");
+
+describe("Git discard changes:", function() {
+ let datasourceName;
+ let repoName;
+ const query1 = "get_users";
+ const query2 = "get_allusers";
+ const jsObject = "JSObject1";
+ const page2 = "Page_2";
+ const page3 = "Page_3";
+
+ it("1. Create an app with Query1 and JSObject1, connect it to git", () => {
+ // Create new postgres datasource
+ cy.NavigateToDatasourceEditor();
+ cy.get(datasource.PostgreSQL).click();
+
+ cy.getPluginFormsAndCreateDatasource();
+
+ cy.fillPostgresDatasourceForm();
+
+ cy.testSaveDatasource();
+
+ cy.get("@createDatasource").then((httpResponse) => {
+ datasourceName = httpResponse.response.body.data.name;
+
+ cy.get(datasource.datasourceCard)
+ .contains(datasourceName)
+ .scrollIntoView()
+ .should("be.visible")
+ .closest(datasource.datasourceCard)
+ .within(() => {
+ cy.get(datasource.createQuerty).click();
+ });
+ });
+ // Create new postgres query
+ cy.get(queryLocators.queryNameField).type(`${query1}`);
+ cy.get(queryLocators.switch)
+ .last()
+ .click({ force: true });
+ cy.get(queryLocators.templateMenu).click();
+ cy.get(queryLocators.query).click({ force: true });
+ cy.get(".CodeMirror textarea")
+ .first()
+ .focus()
+ .type("SELECT * FROM users ORDER BY id LIMIT 10;", {
+ force: true,
+ parseSpecialCharSequences: false,
+ });
+ cy.WaitAutoSave();
+ cy.runQuery();
+
+ cy.CheckAndUnfoldEntityItem("PAGES");
+ cy.wait(1000);
+ cy.get(".t--entity-item:contains(Page1)")
+ .first()
+ .click();
+ cy.wait("@getPage");
+ // bind input widget to postgres query on page1
+ cy.get(explorer.addWidget).click();
+ cy.dragAndDropToCanvas("inputwidgetv2", { x: 300, y: 300 });
+ cy.get(".t--widget-inputwidgetv2").should("exist");
+ cy.get(dynamicInputLocators.input)
+ .eq(1)
+ .click({ force: true })
+ .type(`{{${query1}.data[0].name}}`, {
+ parseSpecialCharSequences: false,
+ });
+ cy.wait(2000);
+ cy.CheckAndUnfoldEntityItem("PAGES");
+ cy.Createpage(page2);
+ cy.wait(1000);
+ cy.get(`.t--entity-item:contains(${page2})`)
+ .first()
+ .click();
+ cy.wait("@getPage");
+ cy.createJSObject('return "Success";');
+ cy.get(explorer.addWidget).click();
+ // bind input widget to JSObject response on page2
+ cy.dragAndDropToCanvas("inputwidgetv2", { x: 300, y: 300 });
+ cy.get(".t--widget-inputwidgetv2").should("exist");
+ cy.get(dynamicInputLocators.input)
+ .eq(1)
+ .click({ force: true })
+ .type("{{JSObject1.myFun1()}}", { parseSpecialCharSequences: false });
+ cy.get("#switcher--explorer").click({ force: true });
+ // connect app to git
+ cy.generateUUID().then((uid) => {
+ repoName = uid;
+
+ cy.createTestGithubRepo(repoName);
+ cy.connectToGitRepo(repoName);
+ });
+ });
+
+ it("2. Add new datasource query, discard changes, verify query is deleted", () => {
+ cy.get(`.t--entity-item:contains("Page1")`)
+ .first()
+ .click();
+ cy.wait("@getPage");
+ // create new postgres query
+ cy.NavigateToQueryEditor();
+ cy.NavigateToActiveTab();
+ cy.get(datasource.datasourceCard)
+ .contains(datasourceName)
+ .scrollIntoView()
+ .should("be.visible")
+ .closest(datasource.datasourceCard)
+ .within(() => {
+ cy.get(datasource.createQuerty).click();
+ });
+ cy.get(queryLocators.queryNameField).type(`${query2}`);
+ cy.get(queryLocators.switch)
+ .last()
+ .click({ force: true });
+ cy.get(queryLocators.templateMenu).click();
+ cy.get(queryLocators.query).click({ force: true });
+ cy.get(".CodeMirror textarea")
+ .first()
+ .focus()
+ .type("SELECT * FROM users;", {
+ force: true,
+ parseSpecialCharSequences: false,
+ });
+ cy.WaitAutoSave();
+ cy.runQuery();
+ // navoigate to Page1
+ cy.get(`.t--entity-item:contains(Page1)`)
+ .first()
+ .click();
+ cy.wait("@getPage");
+ // discard changes
+ cy.gitDiscardChanges();
+ cy.CheckAndUnfoldEntityItem("QUERIES/JS");
+ // verify query2 is not present
+ cy.get(`.t--entity-name:contains(${query2})`).should("not.exist");
+ });
+
+ it("3. Add new JSObject , discard changes verify JSObject is deleted", () => {
+ cy.createJSObject('return "Success";');
+ cy.CheckAndUnfoldEntityItem("QUERIES/JS");
+ // verify jsObject is not duplicated
+ cy.get(`.t--entity-name:contains(${jsObject})`).should("have.length", 1);
+ cy.gitDiscardChanges();
+ cy.CheckAndUnfoldEntityItem("QUERIES/JS");
+ // verify jsObject2 is deleted after discarding changes
+ cy.get(`.t--entity-name:contains(${jsObject})`).should("not.exist");
+ });
+
+ it("4. Delete page2 and trigger discard flow, page2 should be available again", () => {
+ cy.Deletepage(page2);
+ // verify page is deleted
+ cy.CheckAndUnfoldEntityItem("PAGES");
+ cy.get(`.t--entity-name:contains(${page2})`).should("not.exist");
+ cy.gitDiscardChanges();
+ // verify page2 is recovered back
+ cy.get(`.t--entity-name:contains(${page2})`).should("be.visible");
+ cy.get(`.t--entity-item:contains(${page2})`)
+ .first()
+ .click();
+ cy.wait("@getPage");
+ // verify data binding on page2
+ cy.get(".bp3-input").should("have.value", "Success");
+ });
+
+ it("5. Delete Query1 and trigger discard flow, Query1 will be recovered", () => {
+ // navigate to Page1
+ cy.CheckAndUnfoldEntityItem("PAGES");
+ cy.get(`.t--entity-item:contains("Page1")`)
+ .first()
+ .click();
+ cy.wait("@getPage");
+ // delete query1
+ cy.deleteQueryOrJS(query1);
+ // verify Query1 is deleted
+ cy.get(`.t--entity-name:contains(${query1})`).should("not.exist");
+ // discard changes
+ cy.gitDiscardChanges();
+ //verify query1 is recovered
+ cy.get(`.t--entity-name:contains(${query1})`).should("be.visible");
+
+ cy.get(".bp3-input").should("have.value", "Test user 7");
+ });
+
+ it("6. Delete JSObject1 and trigger discard flow, JSObject1 should be active again", () => {
+ // navigate to page2
+ cy.CheckAndUnfoldEntityItem("PAGES");
+ cy.get(`.t--entity-item:contains(${page2})`)
+ .first()
+ .click();
+ cy.wait("@getPage");
+ // delete jsObject1
+ cy.CheckAndUnfoldEntityItem("QUERIES/JS");
+ cy.get(`.t--entity-item:contains(${jsObject})`).within(() => {
+ cy.get(".t--context-menu").click({ force: true });
+ });
+ cy.selectAction("Delete");
+ cy.selectAction("Are you sure?");
+ cy.get(`.t--entity-name:contains(${jsObject})`).should("not.exist");
+ // discard changes
+ cy.gitDiscardChanges();
+ //verify JSObject is recovered
+ cy.get(`.t--entity-name:contains(${jsObject})`).should("be.visible");
+ cy.get(".bp3-input").should("have.value", "Success");
+ });
+
+ it("7. Add new page i.e page3, go to page2 & discard changes, verify page3 is removed", () => {
+ // create new page page3 and move to page1
+ cy.Createpage(page3);
+ cy.get(`.t--entity-item:contains(${page2})`)
+ .first()
+ .click();
+ // discard changes
+ cy.gitDiscardChanges();
+ // verify page3 is removed
+ cy.CheckAndUnfoldEntityItem("PAGES");
+ cy.get(`.t--entity-name:contains("${page3}")`).should("not.exist");
+ });
+
+ it("8. Add new page i.e page3, discard changes should give error resource not found", () => {
+ cy.Createpage(page3);
+ cy.gitDiscardChanges(false);
+ cy.go("back");
+ cy.reload();
+ });
+});
diff --git a/app/client/cypress/locators/gitSyncLocators.js b/app/client/cypress/locators/gitSyncLocators.js
index 9f0b480c63..91964ee618 100644
--- a/app/client/cypress/locators/gitSyncLocators.js
+++ b/app/client/cypress/locators/gitSyncLocators.js
@@ -51,4 +51,5 @@ export default {
gitPullCount: ".t--bottom-bar-pull .count",
gitConnectionContainer: "[data-test=t--git-connection-container]",
gitRemoteURLContainer: "[data-test=t--remote-url-container]",
+ discardChanges: ".t--discard-button",
};
diff --git a/app/client/cypress/support/gitSync.js b/app/client/cypress/support/gitSync.js
index 95f605264f..c2772250fa 100644
--- a/app/client/cypress/support/gitSync.js
+++ b/app/client/cypress/support/gitSync.js
@@ -363,3 +363,37 @@ Cypress.Commands.add(
});
},
);
+
+Cypress.Commands.add("gitDiscardChanges", (assertResourceFound = true) => {
+ cy.get(gitSyncLocators.bottomBarCommitButton).click();
+ //cy.intercept("GET", "/api/v1/git/status/*").as("gitStatus");
+ // cy.wait("@gitStatus").should(
+ // "have.nested.property",
+ // "response.body.responseMeta.status",
+ // 200,
+ // );
+ cy.get(gitSyncLocators.discardChanges)
+ .children()
+ .should("have.text", "Discard changes");
+
+ cy.get(gitSyncLocators.discardChanges).click();
+ cy.contains(Cypress.env("MESSAGES").DISCARD_CHANGES_WARNING());
+
+ cy.get(gitSyncLocators.discardChanges)
+ .children()
+ .should("have.text", "Are you sure?");
+ cy.get(gitSyncLocators.discardChanges).click();
+ cy.contains(Cypress.env("MESSAGES").DISCARDING_AND_PULLING_CHANGES());
+ if (assertResourceFound) {
+ cy.wait("@applications").should(
+ "have.nested.property",
+ "response.body.responseMeta.status",
+ 200,
+ );
+ cy.validateToastMessage("Discarded changes successfully.");
+ } else {
+ cy.get(".bold-text").should(($x) => {
+ expect($x).contain("Page not found");
+ });
+ }
+});
diff --git a/app/client/cypress/support/widgetCommands.js b/app/client/cypress/support/widgetCommands.js
index 532c0a3565..1d93f05f5b 100644
--- a/app/client/cypress/support/widgetCommands.js
+++ b/app/client/cypress/support/widgetCommands.js
@@ -1109,7 +1109,16 @@ Cypress.Commands.add("clearPropertyValue", (value) => {
// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(1000);
});
-
+Cypress.Commands.add("deleteQueryOrJS", (Action) => {
+ cy.CheckAndUnfoldEntityItem("QUERIES/JS");
+ cy.get(`.t--entity-item:contains(${Action})`).within(() => {
+ cy.get(".t--context-menu").click({ force: true });
+ });
+ cy.selectAction("Delete");
+ cy.selectAction("Are you sure?");
+ cy.wait("@deleteAction");
+ cy.get("@deleteAction").should("have.property", "status", 200);
+});
Cypress.Commands.add(
"validateNSelectDropdown",
(ddTitle, currentValue, newValue) => {
From 94b93a657ba5152f69189addb936287b1a3c9362 Mon Sep 17 00:00:00 2001
From: Bhavin K <58818598+techbhavin@users.noreply.github.com>
Date: Wed, 18 May 2022 10:16:25 +0530
Subject: [PATCH 2/6] fix: remove cell background from empty rows (#13257)
---
.../Table_EmptyRow_Color_spec.js | 52 +++++++++++++++++++
app/client/cypress/support/widgetCommands.js | 4 +-
.../TableWidget/component/TableUtilities.tsx | 24 ++++++---
3 files changed, 72 insertions(+), 8 deletions(-)
create mode 100644 app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/DisplayWidgets/Table_EmptyRow_Color_spec.js
diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/DisplayWidgets/Table_EmptyRow_Color_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/DisplayWidgets/Table_EmptyRow_Color_spec.js
new file mode 100644
index 0000000000..fa8a8f8652
--- /dev/null
+++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/DisplayWidgets/Table_EmptyRow_Color_spec.js
@@ -0,0 +1,52 @@
+const widgetsPage = require("../../../../locators/Widgets.json");
+const dsl = require("../../../../fixtures/tableNewDsl.json");
+const commonlocators = require("../../../../locators/commonlocators.json");
+
+describe("Table Widget empty row color validation", function() {
+ before(() => {
+ cy.addDsl(dsl);
+ });
+
+ it("1. Validate cell background of columns", function() {
+ // Open property pane
+ cy.openPropertyPane("tablewidget");
+ // give general color to all table row
+ cy.selectColor("cellbackgroundcolor", -17);
+
+ cy.editColumn("id");
+ // Click on cell background color
+ cy.selectColor("cellbackground", -27);
+ cy.wait("@updateLayout");
+ cy.get(commonlocators.editPropBackButton).click({ force: true });
+
+ cy.editColumn("email");
+ cy.selectColor("cellbackground", -33);
+ cy.wait("@updateLayout");
+ cy.get(commonlocators.editPropBackButton).click({ force: true });
+
+ // Verify the cell background color of first column
+ cy.readTabledataValidateCSS(
+ "1",
+ "0",
+ "background-color",
+ "rgb(99, 102, 241)",
+ );
+ // Verify the cell background color of second column
+ cy.readTabledataValidateCSS(
+ "1",
+ "1",
+ "background-color",
+ "rgb(30, 58, 138)",
+ );
+ });
+ it("2. Validate empty row background", function() {
+ // first cell of first row should be transparent
+ cy.get(
+ ".t--widget-tablewidget .tbody div[data-cy='empty-row-0-cell-0']",
+ ).should("have.css", "background-color", "rgb(99, 102, 241)");
+ // second cell of first row should be transparent
+ cy.get(
+ ".t--widget-tablewidget .tbody div[data-cy='empty-row-0-cell-1']",
+ ).should("have.css", "background-color", "rgb(30, 58, 138)");
+ });
+});
diff --git a/app/client/cypress/support/widgetCommands.js b/app/client/cypress/support/widgetCommands.js
index 1d93f05f5b..8b322c0d84 100644
--- a/app/client/cypress/support/widgetCommands.js
+++ b/app/client/cypress/support/widgetCommands.js
@@ -424,7 +424,7 @@ Cypress.Commands.add("updateCodeInput", ($selector, value) => {
});
});
-Cypress.Commands.add("selectColor", (GivenProperty) => {
+Cypress.Commands.add("selectColor", (GivenProperty, colorOffset = -15) => {
// Property pane of the widget is opened, and click given property.
cy.get(
".t--property-control-" + GivenProperty + " .bp3-input-group input",
@@ -433,7 +433,7 @@ Cypress.Commands.add("selectColor", (GivenProperty) => {
});
cy.get(widgetsPage.colorPickerV2Color)
- .eq(-15)
+ .eq(colorOffset)
.then(($elem) => {
cy.get($elem).click({ force: true });
});
diff --git a/app/client/src/widgets/TableWidget/component/TableUtilities.tsx b/app/client/src/widgets/TableWidget/component/TableUtilities.tsx
index 34cb1e0a21..1f341de23b 100644
--- a/app/client/src/widgets/TableWidget/component/TableUtilities.tsx
+++ b/app/client/src/widgets/TableWidget/component/TableUtilities.tsx
@@ -24,7 +24,7 @@ import {
TableStyles,
MenuItems,
} from "./Constants";
-import { isString, isEmpty, findIndex, isNil, isNaN } from "lodash";
+import { isString, isEmpty, findIndex, isNil, isNaN, get, set } from "lodash";
import PopoverVideo from "widgets/VideoWidget/component/PopoverVideo";
import AutoToolTipComponent from "widgets/TableWidget/component/AutoToolTipComponent";
import { ControlIcons } from "icons/ControlIcons";
@@ -532,11 +532,19 @@ export const renderEmptyRows = (
renderCheckBoxCell(false, accentColor, borderRadius)}
{row.cells.map((cell: any, cellIndex: number) => {
const cellProps = cell.getCellProps();
- if (columns[0]?.columnProperties?.cellBackground) {
- cellProps.style.background =
- columns[0].columnProperties.cellBackground;
- }
- return
;
+ set(
+ cellProps,
+ "style.backgroundColor",
+ get(cell, "column.columnProperties.cellBackground"),
+ );
+ return (
+
+ );
})}
);
@@ -568,6 +576,10 @@ export const renderEmptyRows = (
width: column.width + "px",
boxSizing: "border-box",
flex: `${column.width} 0 auto`,
+ backgroundColor: get(
+ column,
+ "columnProperties.cellBackground",
+ ),
}}
/>
);
From 1396141af47f40abdb432a04949ed5caf0e0a469 Mon Sep 17 00:00:00 2001
From: Ankita Kinger
Date: Wed, 18 May 2022 10:23:08 +0530
Subject: [PATCH 3/6] chore: optimize naming conventions for variables and
functions (#13858)
* optimize naming conventions for variables and functions
* update import statement
* minor css change
---
.../src/ce/pages/AdminSettings/LeftPane.tsx | 4 +--
.../src/ce/pages/AdminSettings/Main.tsx | 2 +-
.../config/authentication/index.tsx | 28 +++++++++----------
.../form/fields/DropdownWrapper.tsx | 4 ++-
.../form/fields/SelectField.tsx | 4 ++-
.../src/pages/Settings/FormGroup/Dropdown.tsx | 2 +-
.../src/pages/Settings/SettingsForm.tsx | 4 +--
app/client/src/pages/Settings/components.ts | 4 +--
8 files changed, 28 insertions(+), 24 deletions(-)
diff --git a/app/client/src/ce/pages/AdminSettings/LeftPane.tsx b/app/client/src/ce/pages/AdminSettings/LeftPane.tsx
index dae1d94640..9446fea0d2 100644
--- a/app/client/src/ce/pages/AdminSettings/LeftPane.tsx
+++ b/app/client/src/ce/pages/AdminSettings/LeftPane.tsx
@@ -55,7 +55,7 @@ export const StyledLink = styled(Link)<{ $active: boolean }>`
}
`;
-export function useSettingsCategory() {
+export function getSettingsCategory() {
return Array.from(AdminConfig.categories);
}
@@ -109,7 +109,7 @@ export function Categories({
}
export default function LeftPane() {
- const categories = useSettingsCategory();
+ const categories = getSettingsCategory();
const { category, subCategory } = useParams() as any;
return (
diff --git a/app/client/src/ce/pages/AdminSettings/Main.tsx b/app/client/src/ce/pages/AdminSettings/Main.tsx
index 2f3e59207a..b5591b667b 100644
--- a/app/client/src/ce/pages/AdminSettings/Main.tsx
+++ b/app/client/src/ce/pages/AdminSettings/Main.tsx
@@ -11,7 +11,7 @@ const Main = () => {
const wrapperCategory =
AdminConfig.wrapperCategories[subCategory ?? category];
- if (!!wrapperCategory && !!wrapperCategory.component) {
+ if (!!wrapperCategory?.component) {
const { component: WrapperCategoryComponent } = wrapperCategory;
return ;
} else if (
diff --git a/app/client/src/ce/pages/AdminSettings/config/authentication/index.tsx b/app/client/src/ce/pages/AdminSettings/config/authentication/index.tsx
index 6549643031..cab5a2c906 100644
--- a/app/client/src/ce/pages/AdminSettings/config/authentication/index.tsx
+++ b/app/client/src/ce/pages/AdminSettings/config/authentication/index.tsx
@@ -25,7 +25,7 @@ const {
enableGoogleOAuth,
} = getAppsmithConfigs();
-const Form_Auth: AdminConfigType = {
+const FormAuth: AdminConfigType = {
type: SettingCategories.FORM_AUTH,
controlType: SettingTypes.GROUP,
title: "Form Login",
@@ -65,7 +65,7 @@ const Form_Auth: AdminConfigType = {
],
};
-const Google_Auth: AdminConfigType = {
+const GoogleAuth: AdminConfigType = {
type: SettingCategories.GOOGLE_AUTH,
controlType: SettingTypes.GROUP,
title: "Google Authentication",
@@ -111,7 +111,7 @@ const Google_Auth: AdminConfigType = {
],
};
-const Github_Auth: AdminConfigType = {
+const GithubAuth: AdminConfigType = {
type: SettingCategories.GITHUB_AUTH,
controlType: SettingTypes.GROUP,
title: "Github Authentication",
@@ -149,7 +149,7 @@ const Github_Auth: AdminConfigType = {
],
};
-export const Form_Auth_Callout: AuthMethodType = {
+export const FormAuthCallout: AuthMethodType = {
id: "APPSMITH_FORM_LOGIN_AUTH",
category: SettingCategories.FORM_AUTH,
label: "Form Login",
@@ -159,7 +159,7 @@ export const Form_Auth_Callout: AuthMethodType = {
isConnected: !disableLoginForm,
};
-export const Google_Auth_Callout: AuthMethodType = {
+export const GoogleAuthCallout: AuthMethodType = {
id: "APPSMITH_GOOGLE_AUTH",
category: SettingCategories.GOOGLE_AUTH,
label: "Google",
@@ -170,7 +170,7 @@ export const Google_Auth_Callout: AuthMethodType = {
isConnected: enableGoogleOAuth,
};
-export const Github_Auth_Callout: AuthMethodType = {
+export const GithubAuthCallout: AuthMethodType = {
id: "APPSMITH_GITHUB_AUTH",
category: SettingCategories.GITHUB_AUTH,
label: "Github",
@@ -181,7 +181,7 @@ export const Github_Auth_Callout: AuthMethodType = {
isConnected: enableGithubOAuth,
};
-export const Saml_Auth_Callout: AuthMethodType = {
+export const SamlAuthCallout: AuthMethodType = {
id: "APPSMITH_SAML_AUTH",
category: "saml",
label: "SAML 2.0",
@@ -191,7 +191,7 @@ export const Saml_Auth_Callout: AuthMethodType = {
type: "OTHER",
};
-export const Oidc_Auth_Callout: AuthMethodType = {
+export const OidcAuthCallout: AuthMethodType = {
id: "APPSMITH_OIDC_AUTH",
category: "oidc",
label: "OIDC",
@@ -202,11 +202,11 @@ export const Oidc_Auth_Callout: AuthMethodType = {
};
const AuthMethods = [
- Oidc_Auth_Callout,
- Saml_Auth_Callout,
- Google_Auth_Callout,
- Github_Auth_Callout,
- Form_Auth_Callout,
+ OidcAuthCallout,
+ SamlAuthCallout,
+ GoogleAuthCallout,
+ GithubAuthCallout,
+ FormAuthCallout,
];
function AuthMain() {
@@ -218,6 +218,6 @@ export const config: AdminConfigType = {
controlType: SettingTypes.PAGE,
title: "Authentication",
canSave: false,
- children: [Form_Auth, Google_Auth, Github_Auth],
+ children: [FormAuth, GoogleAuth, GithubAuth],
component: AuthMain,
};
diff --git a/app/client/src/components/editorComponents/form/fields/DropdownWrapper.tsx b/app/client/src/components/editorComponents/form/fields/DropdownWrapper.tsx
index 704db3bfdc..2ff5d34a24 100644
--- a/app/client/src/components/editorComponents/form/fields/DropdownWrapper.tsx
+++ b/app/client/src/components/editorComponents/form/fields/DropdownWrapper.tsx
@@ -7,7 +7,8 @@ type DropdownWrapperProps = {
value?: string;
onChange?: (value?: string) => void;
};
- options: Array<{ id: string; value: string; label: string }>;
+ options: Array<{ id: string; value: string; label?: string }>;
+ fillOptions?: boolean;
};
function DropdownWrapper(props: DropdownWrapperProps) {
@@ -28,6 +29,7 @@ function DropdownWrapper(props: DropdownWrapperProps) {
return (
;
+ options: Array<{ id: string; value: string; label?: string }>;
size?: "large" | "small";
outline?: boolean;
+ fillOptions?: boolean;
};
export function SelectField(props: SelectFieldProps) {
return (
`
+ margin-bottom: ${(props) => props.margin ?? `16px`};
`;
export const SettingsHeader = styled.h2`
From 33c78e93ef4b4d365e396df5c6f978730aee2792 Mon Sep 17 00:00:00 2001
From: Nayan
Date: Wed, 18 May 2022 11:08:13 +0600
Subject: [PATCH 4/6] feat: Update organization slug (#13791)
When organization name is updated, the slug is not updated. This generates a outdated URL when user clicks on a organization name from the left panel. This PR changes the following behaviors
The Organization slug will be no more unique
Link to organization applications will be based on organization id instead of slug
Organization slug will be updated whenever there is a change in organization name
All the existing organization slugs will be updated
---
app/client/src/pages/Applications/index.tsx | 14 ++--
app/client/src/sagas/OrgSagas.ts | 4 +-
.../appsmith/server/domains/Organization.java | 8 --
.../server/migrations/DatabaseChangelog.java | 28 ++-----
.../server/migrations/DatabaseChangelog2.java | 27 +++++++
.../ce/CustomOrganizationRepositoryCE.java | 2 -
.../CustomOrganizationRepositoryCEImpl.java | 25 -------
.../services/ce/OrganizationServiceCE.java | 4 -
.../ce/OrganizationServiceCEImpl.java | 33 +++------
.../server/services/ce/UserServiceCEImpl.java | 2 +-
.../services/OrganizationServiceTest.java | 74 +++++++++++++------
.../server/services/UserServiceTest.java | 10 +--
.../UserServiceWithDisabledSignupTest.java | 23 +-----
13 files changed, 111 insertions(+), 143 deletions(-)
diff --git a/app/client/src/pages/Applications/index.tsx b/app/client/src/pages/Applications/index.tsx
index 2cd13f0bb3..ad36911bae 100644
--- a/app/client/src/pages/Applications/index.tsx
+++ b/app/client/src/pages/Applications/index.tsx
@@ -357,9 +357,9 @@ function OrgMenuItem({ isFetchingApplications, org, selected }: any) {
isFetchingApplications ? BlueprintClasses.SKELETON : ""
}
ellipsize={20}
- href={`${window.location.pathname}#${org.organization.slug}`}
+ href={`${window.location.pathname}#${org.organization.id}`}
icon="workspace"
- key={org.organization.slug}
+ key={org.organization.id}
ref={menuRef}
selected={selected}
text={org.organization.name}
@@ -419,9 +419,9 @@ function LeftPane() {
userOrgs.map((org: any) => (
))}
@@ -652,7 +652,7 @@ function ApplicationsSection(props: any) {
{(currentUser || isFetchingApplications) &&
OrgMenuTarget({
orgName: organization.name,
- orgSlug: organization.slug,
+ orgSlug: organization.id,
})}
{hasManageOrgPermissions && (