Skip to content

Commit

Permalink
Merge pull request #36742 from appsmithorg/release
Browse files Browse the repository at this point in the history
08/10 Daily Promotion
  • Loading branch information
btsgh authored Oct 8, 2024
2 parents 462db00 + 22ccab0 commit 524d400
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,22 @@ export class OneClickBinding {
column: Record<string, string> = {},
) {
agHelper.GetNClick(oneClickBindingLocator.datasourceDropdownSelector);

agHelper.GetElement("[role='menu']").then(($menu) => {
if (
$menu.find(oneClickBindingLocator.datasourceQuerySelector()).length > 0
) {
cy.wrap($menu)
.find(oneClickBindingLocator.datasourceQuerySelector())
.should("have.length.greaterThan", 0)
.each(($item) => {
cy.wrap($item)
.find("img")
.should(($img) => {
expect($img).to.have.attr("src").and.not.be.empty;
});
});
}
});
expandLoadMoreOptions();

agHelper.AssertElementAbsence(oneClickBindingLocator.connectData);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,9 @@ function useConnectToOptions(props: ConnectToOptionsProps) {
// This is the path we bind to the sourceData field Ex: `{{Table1.selectedRow}}`
const { widgetBindPath } =
getOneClickBindingConnectableWidgetConfig(currWidget);
const iconSVG =
WidgetFactory.getConfig(currWidget.type)?.iconSVG ||
currWidget.iconSVG;

return {
id: widgetId,
Expand All @@ -237,7 +240,7 @@ function useConnectToOptions(props: ConnectToOptionsProps) {
<DatasourceImage
alt="widget-icon"
className="dataSourceImage"
src={currWidget.iconSVG}
src={iconSVG}
/>
</ImageWrapper>
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,15 @@ export function useDropdown(props: OneClickDropdownFieldProps) {
if (getOneClickBindingConnectableWidgetConfig) {
const { message, widgetBindPath } =
getOneClickBindingConnectableWidgetConfig(currWidget);
const iconSVG =
WidgetFactory.getConfig(currWidget.type)?.iconSVG ||
currWidget.iconSVG;

return {
id: currWidgetId,
value: widgetBindPath,
label: currWidget.widgetName,
icon: <StyledImage alt="widget-icon" src={currWidget.iconSVG} />,
icon: <StyledImage alt="widget-icon" src={iconSVG} />,
data: {
widgetType: currWidget.type,
widgetName: currWidget.widgetName,
Expand Down
29 changes: 29 additions & 0 deletions deploy/docker/fs/opt/appsmith/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ tlog "Running as: $(id)"

stacks_path=/appsmith-stacks

export APPSMITH_PG_DATABASE="appsmith"
export SUPERVISORD_CONF_TARGET="$TMP/supervisor-conf.d/" # export for use in supervisord.conf
export MONGODB_TMP_KEY_PATH="$TMP/mongodb-key" # export for use in supervisor process mongodb.conf

Expand Down Expand Up @@ -432,6 +433,7 @@ init_postgres() {
tlog "Initializing local Postgres data folder"
su postgres -c "env PATH='$PATH' initdb -D $POSTGRES_DB_PATH"
fi
create_appsmith_pg_db "$POSTGRES_DB_PATH"
else
runEmbeddedPostgres=0
fi
Expand All @@ -453,6 +455,33 @@ safe_init_postgres() {
fi
}

# Method to create a appsmith database in the postgres
# Args:
# POSTGRES_DB_PATH (string): Path to the postgres data directory
# Returns:
# None
# Example:
# create_appsmith_pg_db "/appsmith-stacks/data/postgres/main"
create_appsmith_pg_db() {
POSTGRES_DB_PATH=$1
# Start the postgres , wait for it to be ready and create a appsmith db
su postgres -c "env PATH='$PATH' pg_ctl -D $POSTGRES_DB_PATH -l $POSTGRES_DB_PATH/logfile start"
echo "Waiting for Postgres to start"
until su postgres -c "env PATH='$PATH' pg_isready -d postgres"; do
tlog "Waiting for Postgres to be ready..."
sleep 1
done
# Check if the appsmith DB is present
DB_EXISTS=$(su postgres -c "env PATH='$PATH' psql -tAc \"SELECT 1 FROM pg_database WHERE datname='${APPSMITH_PG_DATABASE}'\"")

if [[ "$DB_EXISTS" != "1" ]]; then
su postgres -c "env PATH='$PATH' psql -c \"CREATE DATABASE ${APPSMITH_PG_DATABASE}\""
else
echo "Database ${APPSMITH_PG_DATABASE} already exists."
fi
su postgres -c "env PATH='$PATH' pg_ctl -D $POSTGRES_DB_PATH stop"
}

setup_caddy() {
if [[ "$APPSMITH_RATE_LIMIT" == "disabled" ]]; then
export _APPSMITH_CADDY="/opt/caddy/caddy_vanilla"
Expand Down
7 changes: 6 additions & 1 deletion deploy/docker/fs/opt/appsmith/pg-utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,16 @@ init_pg_db() {
echo "Schema 'appsmith' does not exist. Creating schema..."
psql -h "$PG_DB_HOST" -p "$PG_DB_PORT" -U postgres -d "$PG_DB_NAME" -c "CREATE SCHEMA appsmith;"
fi
USER=$PG_DB_USER SCHEMA="appsmith" DB=$PG_DB_NAME HOST=$PG_DB_HOST PORT=$PG_DB_PORT grant_permissions_for_schema
echo "Creating pg_trgm extension..."
psql -h "$PG_DB_HOST" -p "$PG_DB_PORT" -U postgres -d "$PG_DB_NAME" -c "CREATE EXTENSION IF NOT EXISTS pg_trgm;"
else
echo "Remote PostgreSQL detected, running as current user."
PGPASSWORD=$PG_DB_PASSWORD psql -h "$PG_DB_HOST" -p "$PG_DB_PORT" -U "$PG_DB_USER" -d "$PG_DB_NAME" -c "CREATE SCHEMA IF NOT EXISTS appsmith;"
echo "Creating pg_trgm extension..."
psql -h "$PG_DB_HOST" -p "$PG_DB_PORT" -U "$PG_DB_USER" -d "$PG_DB_NAME" -c "CREATE EXTENSION IF NOT EXISTS pg_trgm;"
fi
# Check if the schema creation was successful
Expand Down

0 comments on commit 524d400

Please sign in to comment.