Skip to content

Commit

Permalink
Merge branch 'master' into luotao
Browse files Browse the repository at this point in the history
* master:
  Increased waiting time to avoid flakiness (getredash#5370)
  Updated axios (getredash#5371)
  Bump axios from 0.19.0 to 0.21.1 (getredash#5366)
  Bump bl from 1.2.2 to 1.2.3 in /viz-lib (getredash#5257)
  Bump dompurify from 2.0.8 to 2.0.17 in /viz-lib (getredash#5326)
  Fix for Cypress flakiness generated by param_spec (getredash#5349)
  Fix: add a merge migration to solve multi head issue (getredash#5364)
  Remove unnecessary space in rq log (getredash#5345)
  Encrypt alert notification destinations (getredash#5317)
  Use legacy resolver in pip to fix broken build (getredash#5309)
  • Loading branch information
lotreal committed Feb 2, 2021
2 parents 9449829 + 535ea8e commit cfe2b67
Show file tree
Hide file tree
Showing 11 changed files with 234 additions and 129 deletions.
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ WORKDIR /app
ENV PIP_DISABLE_PIP_VERSION_CHECK=1
ENV PIP_NO_CACHE_DIR=1

# Use legacy resolver to work around broken build due to resolver changes in pip
ENV PIP_USE_DEPRECATED=legacy-resolver

# We first copy only the requirements file, to avoid rebuilding on every file
# change.
COPY requirements.txt requirements_bundles.txt requirements_dev.txt requirements_all_ds.txt ./
Expand Down
26 changes: 15 additions & 11 deletions client/cypress/integration/dashboard/parameter_spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { each } from "lodash";
import { createQueryAndAddWidget, editDashboard } from "../../support/dashboard";
import { dragParam, expectParamOrder } from "../../support/parameters";

Expand Down Expand Up @@ -41,27 +40,32 @@ describe("Dashboard Parameters", () => {
.click();
};

const saveMappingOptions = (close = true) => {
cy.getByTestId("EditParamMappingPopover")
const saveMappingOptions = (closeMappingMenu = false) => {
return cy
.getByTestId("EditParamMappingPopover")
.filter(":visible")
.as("Popover")
.within(() => {
// This is needed to grant the element will have finished loading
// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(500);
cy.contains("button", "OK").click();
})
.then(() => {
if (closeMappingMenu) {
cy.contains("button", "OK").click();
}
return cy.get("@Popover").should("not.be.visible");
});

cy.getByTestId("EditParamMappingPopover").should("not.be.visible");

if (close) {
cy.contains("button", "OK").click();
}
};

const setWidgetParametersToDashboard = parameters => {
each(parameters, ({ name: paramName }, i) => {
cy.wrap(parameters).each(({ name: paramName }, i) => {
cy.getByTestId(`EditParamMappingButton-${paramName}`).click();
cy.getByTestId("NewDashboardParameterOption")
.filter(":visible")
.click();
saveMappingOptions(i === parameters.length - 1);
return saveMappingOptions(i === parameters.length - 1);
});
};

Expand Down
24 changes: 24 additions & 0 deletions migrations/versions/89bc7873a3e0_fix_multiple_heads.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
"""fix_multiple_heads
Revision ID: 89bc7873a3e0
Revises: 0ec979123ba4, d7d747033183
Create Date: 2021-01-21 18:11:04.312259
"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '89bc7873a3e0'
down_revision = ('0ec979123ba4', 'd7d747033183')
branch_labels = None
depends_on = None


def upgrade():
pass


def downgrade():
pass
64 changes: 64 additions & 0 deletions migrations/versions/d7d747033183_encrypt_alert_destinations.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
"""encrypt alert destinations
Revision ID: d7d747033183
Revises: e5c7a4e2df4d
Create Date: 2020-12-14 21:42:48.661684
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
from sqlalchemy.sql import table
from sqlalchemy_utils.types.encrypted.encrypted_type import FernetEngine

from redash import settings
from redash.utils.configuration import ConfigurationContainer
from redash.models.base import key_type
from redash.models.types import (
EncryptedConfiguration,
Configuration,
)


# revision identifiers, used by Alembic.
revision = 'd7d747033183'
down_revision = 'e5c7a4e2df4d'
branch_labels = None
depends_on = None


def upgrade():
op.add_column(
"notification_destinations",
sa.Column("encrypted_options", postgresql.BYTEA(), nullable=True)
)

# copy values
notification_destinations = table(
"notification_destinations",
sa.Column("id", key_type("NotificationDestination"), primary_key=True),
sa.Column(
"encrypted_options",
ConfigurationContainer.as_mutable(
EncryptedConfiguration(
sa.Text, settings.DATASOURCE_SECRET_KEY, FernetEngine
)
),
),
sa.Column("options", ConfigurationContainer.as_mutable(Configuration)),
)

conn = op.get_bind()
for dest in conn.execute(notification_destinations.select()):
conn.execute(
notification_destinations.update()
.where(notification_destinations.c.id == dest.id)
.values(encrypted_options=dest.options)
)

op.drop_column("notification_destinations", "options")
op.alter_column("notification_destinations", "encrypted_options", nullable=False)


def downgrade():
pass
Loading

0 comments on commit cfe2b67

Please sign in to comment.