Skip to content

Commit

Permalink
Merge branch 'release' of github.com:Namatek/appsmith into release
Browse files Browse the repository at this point in the history
  • Loading branch information
hajrezvan committed Dec 10, 2024
2 parents 6762fa0 + d35cab3 commit ef2196e
Show file tree
Hide file tree
Showing 59 changed files with 833 additions and 101 deletions.
5 changes: 0 additions & 5 deletions .github/workflows/ci-test-limited.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,20 +41,15 @@ jobs:

# Service containers to run with this job. Required for running tests
services:
# Label used to access the service container
redis:
# Docker Hub image for Redis
image: redis
ports:
# Opens tcp port 6379 on the host and service container
- 6379:6379
postgres:
if: github.base_ref == 'pg' || github.ref_name == 'pg'
image: postgres:14
ports:
- 5432:5432
mongo:
if: github.base_ref == 'release' || github.ref_name == 'release'
image: mongo
ports:
- 27017:27017
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ describe(
dataSources.FillAuthAPIUrl();
dataSources.SaveDatasource();
apiPage.CreateApi("API" + uid, "GET", true);
agHelper.AssertElementAbsence(apiPage._saveAsDS);
apiPage.SelectPaneTab("Authentication");
agHelper.AssertElementEnabledDisabled(apiPage._saveAsDS, 0, false);
// Last one if present on the authentication tab.
agHelper.AssertElementEnabledDisabled(apiPage._saveAsDS, 1, false);
agHelper.AssertElementEnabledDisabled(apiPage._saveAsDS, 0, false);
});
});
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe(
it("1. Checking whether the appropriate error is displayed even after the removal of invalid chars in header key.", function () {
const randomApi = `${
dataManager.dsValues[dataManager.defaultEnviorment].mockApiUrl
}123`;
}`;
apiPage.CreateAndFillApi(randomApi);
apiPage.RunAPI(false, 2000, {
expectedPath: "response.body.data.body.data.isExecutionSuccess",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,15 @@ describe(
propPane.ToggleJSMode("Table data", false);

oneClickBinding.ChooseAndAssertForm("Users", "Users", "public.users", {
searchableColumn: "gender",
searchableColumn: "email",
});

propPane.MoveToTab("Style");

propPane.MoveToTab("Content");

oneClickBinding.ChooseAndAssertForm("sample Movies", "movies", "movies", {
searchableColumn: "status",
searchableColumn: "imdb_id",
});
dataSources.NavigateToDSCreateNew();
dataSources.CreatePlugIn("Mongo");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ describe(
//Create and run query.

_.dataSources.EnterQuery(
"SELECT * FROM users ORDER BY id LIMIT 10;",
"SELECT * FROM users ORDER BY username LIMIT 10;",
1000,
);
_.dataSources.RunQuery();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@ describe(

// User interaction - Click
getIframeBody(1).find(locators._pageHeaderToggle).click({ force: true });
getIframeBody(1).find(locators._pageHeaderMenuList).should("be.visible");
agHelper.WaitForCondition(() => {
return getIframeBody(1)
.find(locators._pageHeaderMenuList)
.then(($el: JQuery<HTMLElement>) => $el.length > 0);
});
});

it("2. Verify colors, borders and shadows", () => {
Expand Down Expand Up @@ -81,7 +85,7 @@ describe(
propPane.UpdatePropertyFieldValue("URL", " ");
agHelper.ValidateToastMessage("url updated");

agHelper.ClickButton("Submit");
agHelper.ClickButton("Submit", { force: true });
getIframeBody(0)
.find("input")
.should("be.visible")
Expand All @@ -90,6 +94,7 @@ describe(
expect(inputValue).to.equal("submitclicked");
});

EditorNavigation.SelectEntityByName("Iframe1", EntityType.Widget);
propPane.UpdatePropertyFieldValue(
"srcDoc",
`<!DOCTYPE html>
Expand Down
1 change: 1 addition & 0 deletions app/client/cypress/e2e/Sanity/Datasources/GraphQL_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ describe(
variable: GRAPHQL_VARIABLES,
});
apiPage.RunAPI();
apiPage.SelectPaneTab("Authentication");
agHelper.GetNClick(locators._saveDatasource);
dataSources.AssertDataSourceInfo([
dataManager.dsValues[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import {
apiPage,
} from "../../../support/Objects/ObjectsCore";

describe(
//Skip test case due to : https://github.com/appsmithorg/appsmith/issues/37353
describe.skip(
"Create a rest datasource",
{
tags: ["@tag.Datasource", "@tag.Sanity", "@tag.Git", "@tag.AccessControl"],
Expand Down
2 changes: 1 addition & 1 deletion app/client/cypress/support/Objects/CommonLocators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ export class CommonLocators {
_treeSelectedContent = ".rc-tree-select-selection-item-content";
_switcherIcon = ".switcher-icon";
_root = "#root";
_pageHeaderToggle = ".navbar__items>button";
_pageHeaderToggle = ".navbar__items > button";
_pageHeaderMenuList = ".navbar-sidebar__backdrop";
_enterFullScreen = ".application-demo-new-dashboard-control-enter-fullscreen";
_dashboardContainer = ".application-demo-new-dashboard-container";
Expand Down
6 changes: 4 additions & 2 deletions app/client/cypress/support/Pages/DataSources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ export class DataSources {
".t--datasource-name:contains('" + dsName + "')";
_mandatoryMark = "//span[text()='*']";
_deleteDSHostPort = ".t--delete-field";
_dsTabSchema = "[data-testid='t--tab-SCHEMA_TAB']";
_dsTabSchema = "[data-testid='t--tab-DATASOURCE_TAB']";
private _pageSelectionMenu = "[data-testid='t--page-selection']";

private _pageSelectMenuItem = ".ads-v2-menu__menu-item";
Expand Down Expand Up @@ -1891,7 +1891,9 @@ export class DataSources {
cy.intercept("GET", "/api/v1/datasources/*/structure?ignoreCache=*").as(
`getDatasourceStructureUpdated_${ds_entity_name}`,
);
cy.get("[data-testid=t--tab-SCHEMA_TAB]").first().click({ force: true });
cy.get("[data-testid=t--tab-DATASOURCE_TAB]")
.first()
.click({ force: true });
this.RefreshDatasourceSchema();
this.assertHelper
.WaitForNetworkCall(`@getDatasourceStructureUpdated_${ds_entity_name}`)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1033,6 +1033,10 @@ const DashboardLineIcon = importSvg(
async () => import("../__assets__/icons/ads/dashboard-line.svg"),
);

const DatasourceConfigIcon = importSvg(
async () => import("../__assets__/icons/ads/datasource-config.svg"),
);

// v3 icons
const JsSquareV3Icon = importSvg(
async () => import("../__assets__/icons/ads/js-square-v3-icon.svg"),
Expand Down Expand Up @@ -1173,6 +1177,7 @@ const ICON_LOOKUP = {
"cut-control": CutIcon,
"dashboard-line": DashboardLineIcon,
"database-2-line": Database2Line,
"datasource-config": DatasourceConfigIcon,
"datasource-v3": DatasourceV3Icon,
"datasources-2": Datasources2,
"decrease-control": DecreaseIcon,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export const StyledSwitchLabel = styled(Text)<{
justify-content: space-between;
min-width: 9rem;
cursor: pointer;
word-break: break-all;
${({ isDisabled }) =>
isDisabled &&
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ class EmbeddedDatasourcePathComponent extends React.Component<
</Text>
</StyledTooltip>
)}
{displayValue && (
{displayValue && shouldSave && (
<StoreAsDatasource
datasourceId={
datasourceObject && "id" in datasourceObject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function PluginActionResponse() {
dispatch(
setPluginActionEditorDebuggerState({
open: true,
selectedTab: DEBUGGER_TAB_KEYS.SCHEMA_TAB,
selectedTab: DEBUGGER_TAB_KEYS.DATASOURCE_TAB,
}),
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,24 @@ import { datasourcesEditorIdURL } from "ee/RouteBuilder";
import { DatasourceComponentTypes } from "api/PluginApi";
import { getPluginActionDebuggerState } from "PluginActionEditor/store";
import { SchemaDisplayStatus, StatusDisplay } from "./StatusDisplay";
import DatasourceSelector from "./DatasourceSelector";
import { SchemaTables } from "./SchemaTables";
import { DatasourceTables } from "./DatasourceTables";
import { DatasourceEditEntryPoints } from "constants/Datasource";
import AnalyticsUtil from "ee/utils/AnalyticsUtil";
import { isEmpty, omit } from "lodash";
import { getQueryParams } from "utils/URLUtils";
import { getCurrentPageId } from "selectors/editorSelectors";
import { TableColumns } from "./TableColumns";
import { BOTTOMBAR_HEIGHT } from "./constants";
import { useEditorType } from "ee/hooks";
import { useParentEntityInfo } from "ee/hooks/datasourceEditorHooks";
import DatasourceInfo from "./DatasourceInfo";

interface Props {
datasourceId: string;
datasourceName: string;
currentActionId: string;
}

const Schema = (props: Props) => {
const Datasource = (props: Props) => {
const dispatch = useDispatch();

const datasourceStructure = useSelector((state) =>
Expand All @@ -44,7 +45,8 @@ const Schema = (props: Props) => {
getPluginIdFromDatasourceId(state, props.datasourceId),
);

const currentPageId = useSelector(getCurrentPageId);
const editorType = useEditorType(location.pathname);
const { parentEntityId } = useParentEntityInfo(editorType);

const [selectedTable, setSelectedTable] = useState<string>();

Expand Down Expand Up @@ -107,7 +109,7 @@ const Schema = (props: Props) => {
});

const url = datasourcesEditorIdURL({
basePageId: currentPageId,
baseParentEntityId: parentEntityId,
datasourceId: props.datasourceId,
params: { ...omit(getQueryParams(), "viewMode"), viewMode: false },
generateEditorPath: true,
Expand Down Expand Up @@ -137,13 +139,12 @@ const Schema = (props: Props) => {
}

return (
<>
<Flex padding="spaces-3">
<DatasourceSelector
datasourceId={props.datasourceId}
datasourceName={props.datasourceName}
/>
</Flex>
<Flex flexDirection="column" padding="spaces-3">
<DatasourceInfo
datasourceId={props.datasourceId}
datasourceName={props.datasourceName}
showEditButton={!isLoading}
/>
<StatusDisplay
editDatasource={editDatasource}
errorMessage={
Expand All @@ -153,7 +154,7 @@ const Schema = (props: Props) => {
}
state={statusState}
/>
</>
</Flex>
);
};

Expand All @@ -164,7 +165,7 @@ const Schema = (props: Props) => {

return (
<Flex h="100%">
<SchemaTables
<DatasourceTables
currentActionId={props.currentActionId}
datasourceId={props.datasourceId}
datasourceName={props.datasourceName}
Expand Down Expand Up @@ -194,4 +195,4 @@ const Schema = (props: Props) => {
);
};

export { Schema };
export { Datasource };
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import React from "react";
import { Button, Flex, Tooltip } from "@appsmith/ads";
import DatasourceSelector from "./DatasourceSelector";
import { createMessage, EDIT_DS_CONFIG } from "ee/constants/messages";
import { DatasourceEditEntryPoints } from "constants/Datasource";
import AnalyticsUtil from "ee/utils/AnalyticsUtil";
import { datasourcesEditorIdURL } from "ee/RouteBuilder";
import { omit } from "lodash";
import { getQueryParams } from "utils/URLUtils";
import history from "utils/history";
import { useEditorType } from "ee/hooks";
import { useParentEntityInfo } from "ee/hooks/datasourceEditorHooks";

interface Props {
datasourceId: string;
datasourceName: string;
showEditButton: boolean;
}

const DatasourceInfo = ({
datasourceId,
datasourceName,
showEditButton,
}: Props) => {
const editorType = useEditorType(location.pathname);
const { parentEntityId } = useParentEntityInfo(editorType);

// eslint-disable-next-line react-perf/jsx-no-new-function-as-prop
const editDatasource = () => {
const entryPoint = DatasourceEditEntryPoints.QUERY_EDITOR_DATASOURCE_SCHEMA;

AnalyticsUtil.logEvent("EDIT_DATASOURCE_CLICK", {
datasourceId: datasourceId,
pluginName: "",
entryPoint: entryPoint,
});

const url = datasourcesEditorIdURL({
baseParentEntityId: parentEntityId,
datasourceId: datasourceId,
params: { ...omit(getQueryParams(), "viewMode"), viewMode: false },
generateEditorPath: true,
});

history.push(url);
};

return (
<Flex alignItems={"center"} gap="spaces-2">
<DatasourceSelector
datasourceId={datasourceId}
datasourceName={datasourceName}
/>
{showEditButton && (
<Tooltip content={createMessage(EDIT_DS_CONFIG)} placement="top">
<Button
isIconButton
kind="tertiary"
onClick={editDatasource}
size="sm"
startIcon="datasource-config"
/>
</Tooltip>
)}
</Flex>
);
};

export default DatasourceInfo;
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { API_EDITOR_FORM_NAME } from "ee/constants/forms";
import { type Action } from "entities/Action";
import { reduxForm } from "redux-form";
import {
PluginDatasourceSelector,
type CustomProps,
} from "./PluginDatasourceSelector";

export default reduxForm<Action, CustomProps>({
form: API_EDITOR_FORM_NAME,
destroyOnUnmount: false,
enableReinitialize: true,
})(PluginDatasourceSelector);
Loading

0 comments on commit ef2196e

Please sign in to comment.