Skip to content

Commit

Permalink
Merge branch 'master' into john-bodley--druid-no-sql-regex
Browse files Browse the repository at this point in the history
  • Loading branch information
john-bodley authored Jun 16, 2023
2 parents ab3e235 + b68de27 commit 499a197
Show file tree
Hide file tree
Showing 22 changed files with 49 additions and 126 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/docker-ephemeral-env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ jobs:
secrets.AWS_SECRET_ACCESS_KEY != '' &&
secrets.AWS_SECRET_ACCESS_KEY != '') || '' }}" ]; then
echo "has-secrets=1" >> "$GITHUB_OUTPUT"
echo "has secrets!"
else
echo "has-secrets=0" >> "$GITHUB_OUTPUT"
echo "no secrets!"
fi
docker_ephemeral_env:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ jobs:
run: |
if [ -n "${{ (secrets.DOCKERHUB_USER != '' && secrets.DOCKERHUB_TOKEN != '') || '' }}" ]; then
echo "has-secrets=1" >> "$GITHUB_OUTPUT"
echo "has secrets!"
else
echo "has-secrets=0" >> "$GITHUB_OUTPUT"
echo "no secrets!"
fi
docker-build:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/superset-frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
if: steps.check.outcome == 'failure'
working-directory: ./superset-frontend
run: |
npm run lint
npm run lint -- --quiet
npm run prettier-check
- name: Build plugins packages
if: steps.check.outcome == 'failure'
Expand All @@ -60,7 +60,7 @@ jobs:
if: steps.check.outcome == 'failure'
working-directory: ./superset-frontend
run: |
npm run test -- --coverage
npm run test -- --coverage --silent
# todo: remove this step when fix generator as a project in root jest.config.js
- name: generator-superset unit tests
if: steps.check.outcome == 'failure'
Expand Down
2 changes: 1 addition & 1 deletion RELEASING/from_tarball_entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ superset db upgrade
superset init

# Loading examples
superset load-examples
superset load-examples --force

FLASK_ENV=development FLASK_APP="superset.app:create_app()" \
flask run -p 8088 --with-threads --reload --debugger --host=0.0.0.0
2 changes: 0 additions & 2 deletions RESOURCES/STANDARD_ROLES.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,10 @@
|can slice on Superset|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|O|
|can sync druid source on Superset|:heavy_check_mark:|O|O|O|
|can explore on Superset|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|O|
|can slice json on Superset|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|O|
|can approve on Superset|:heavy_check_mark:|O|O|O|
|can explore json on Superset|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|O|
|can fetch datasource metadata on Superset|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|O|
|can csrf token on Superset|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|O|
|can annotation json on Superset|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|O|
|can sqllab on Superset|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|
|can select star on Superset|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|O|
|can warm up cache on Superset|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|O|
Expand Down
1 change: 1 addition & 0 deletions UPDATING.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ assists people when migrating to a new version.
### Breaking Changes

- [24415](https://github.com/apache/superset/pull/24415): Removed the obsolete Druid NoSQL REGEX operator.
- [24423](https://github.com/apache/superset/pull/24423): Removed deprecated APIs `/superset/slice_json/...`, `/superset/annotation_json/...`
- [24400](https://github.com/apache/superset/pull/24400): Removed deprecated APIs `/superset/recent_activity/...`, `/superset/fave_dashboards_by_username/...`, `/superset/fave_dashboards/...`, `/superset/created_dashboards/...`, `/superset/user_slices/`, `/superset/created_slices/...`, `/superset/fave_slices/...`, `/superset/favstar/...`,
- [24401](https://github.com/apache/superset/pull/24401): Removes the deprecated `metrics` column (which was blossomed in [20732](https://github.com/apache/superset/pull/20732)) from the `/api/v1/dataset/` API.
- [24375](https://github.com/apache/superset/pull/24375): Removed deprecated API `/superset/get_or_create_table/...`, `/superset/sqllab_viz`
Expand Down
2 changes: 1 addition & 1 deletion docker/docker-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ if [ "$SUPERSET_LOAD_EXAMPLES" = "yes" ]; then
superset load_test_users
superset load_examples --load-test-data
else
superset load_examples
superset load_examples --force
fi
echo_step "4" "Complete" "Loading examples"
fi
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,15 @@ export function getLayer(formData, payload, onAddFilter, setTooltip) {

return new GeoJsonLayer({
id: `geojson-layer-${fd.slice_id}`,
filled: fd.filled,
data: features,
stroked: fd.stroked,
extruded: fd.extruded,
pointRadiusScale: fd.point_radius_scale,
filled: fd.filled,
stroked: fd.stroked,
getFillColor,
getLineWidth: fd.line_width || 1,
getLineColor,
getLineWidth: fd.line_width || 1,
pointRadiusScale: fd.point_radius_scale,
lineWidthUnits: fd.line_width_unit,
...commonLayerProps(fd, setTooltip, setTooltipContent),
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,23 @@ const config: ControlPanelConfig = {
controlSetRows: [
[fillColorPicker, strokeColorPicker],
[filled, stroked],
[extruded, null],
[lineWidth, null],
[extruded],
[lineWidth],
[
{
name: 'line_width_unit',
config: {
type: 'SelectControl',
label: t('Line width unit'),
default: 'meters',
choices: [
['meters', t('meters')],
['pixels', t('pixels')],
],
renderTrigger: true,
},
},
],
[
{
name: 'point_radius_scale',
Expand All @@ -83,7 +98,6 @@ const config: ControlPanelConfig = {
choices: formatSelectOptions([0, 100, 200, 300, 500]),
},
},
null,
],
],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const store = mockStore({
queries: {
LCly_kkIN: {
cached: false,
changedOn: Date.now(),
changed_on: new Date().toISOString(),
db: 'main',
dbId: 1,
id: 'LCly_kkIN',
Expand All @@ -71,7 +71,7 @@ const store = mockStore({
},
lXJa7F9_r: {
cached: false,
changedOn: 1559238500401,
changed_on: new Date(1559238500401).toISOString(),
db: 'main',
dbId: 1,
id: 'lXJa7F9_r',
Expand All @@ -80,7 +80,7 @@ const store = mockStore({
},
'2g2_iRFMl': {
cached: false,
changedOn: 1559238506925,
changed_on: new Date(1559238506925).toISOString(),
db: 'main',
dbId: 1,
id: '2g2_iRFMl',
Expand All @@ -89,7 +89,7 @@ const store = mockStore({
},
erWdqEWPm: {
cached: false,
changedOn: 1559238516395,
changed_on: new Date(1559238516395).toISOString(),
db: 'main',
dbId: 1,
id: 'erWdqEWPm',
Expand Down
3 changes: 0 additions & 3 deletions superset-frontend/src/SqlLab/fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,6 @@ export const queries = [
progress: 100,
startDttm: 1476910566092.96,
state: QueryState.SUCCESS,
changedOn: 1476910566000,
tempTable: null,
userId: 1,
executedSql: null,
Expand Down Expand Up @@ -276,7 +275,6 @@ export const queries = [
progress: 100,
startDttm: 1476910570802.2,
state: QueryState.SUCCESS,
changedOn: 1476910572000,
tempTable: null,
userId: 1,
executedSql:
Expand Down Expand Up @@ -310,7 +308,6 @@ export const queryWithNoQueryLimit = {
progress: 100,
startDttm: 1476910566092.96,
state: QueryState.SUCCESS,
changedOn: 1476910566000,
tempTable: null,
userId: 1,
executedSql: null,
Expand Down
5 changes: 3 additions & 2 deletions superset-frontend/src/SqlLab/reducers/sqlLab.js
Original file line number Diff line number Diff line change
Expand Up @@ -614,8 +614,9 @@ export default function sqlLabReducer(state = {}, action) {
(state.queries[id].state !== QueryState.STOPPED &&
state.queries[id].state !== QueryState.FAILED)
) {
if (changedQuery.changedOn > queriesLastUpdate) {
queriesLastUpdate = changedQuery.changedOn;
const changedOn = Date.parse(changedQuery.changed_on);
if (changedOn > queriesLastUpdate) {
queriesLastUpdate = changedOn;
}
const prevState = state.queries[id]?.state;
const currentState = changedQuery.state;
Expand Down
2 changes: 1 addition & 1 deletion superset-frontend/src/features/home/ActivityTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import EmptyState from './EmptyState';
import { WelcomeTable } from './types';

/**
* Return result from /api/v1/log/recent_activity/{user_id}/
* Return result from /api/v1/log/recent_activity/
*/
interface RecentActivity {
action: string;
Expand Down
2 changes: 1 addition & 1 deletion superset-frontend/src/pages/Home/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ function Welcome({ user, addDangerToast }: WelcomeProps) {
const userid = user.userId;
const id = userid!.toString(); // confident that user is not a guest user
const params = rison.encode({ page_size: 6 });
const recent = `/api/v1/log/recent_activity/${user.userId}/?q=${params}`;
const recent = `/api/v1/log/recent_activity/?q=${params}`;
const [activeChild, setActiveChild] = useState('Loading');
const userKey = dangerouslyGetItemDoNotUse(id, null);
let defaultChecked = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export default function RecentActivity({ user }: RecentActivityProps) {
className="table-condensed"
mutator={mutator}
sortable
dataEndpoint={`/api/v1/log/recent_activity/${user?.userId}/?q=${params}`}
dataEndpoint={`/api/v1/log/recent_activity/?q=${params}`}
noDataText={t('No Data')}
/>
</div>
Expand Down
2 changes: 1 addition & 1 deletion superset/charts/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ class ChartEntityResponseSchema(Schema):
id = fields.Integer(metadata={"description": id_description})
slice_name = fields.String(metadata={"description": slice_name_description})
cache_timeout = fields.Integer(metadata={"description": cache_timeout_description})
changed_on = fields.String(metadata={"description": changed_on_description})
changed_on = fields.DateTime(metadata={"description": changed_on_description})
description = fields.String(metadata={"description": description_description})
description_markeddown = fields.String(
metadata={"description": description_markeddown_description}
Expand Down
2 changes: 1 addition & 1 deletion superset/explore/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class SliceSchema(Schema):
certified_by = fields.String(
metadata={"description": "Person or group that has certified this dashboard."}
)
changed_on = fields.String(
changed_on = fields.DateTime(
metadata={"description": "Timestamp of the last modification."}
)
changed_on_humanized = fields.String(
Expand Down
1 change: 0 additions & 1 deletion superset/models/sql_lab.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ def get_template_processor(self, **kwargs: Any) -> BaseTemplateProcessor:

def to_dict(self) -> dict[str, Any]:
return {
"changedOn": self.changed_on,
"changed_on": self.changed_on.isoformat(),
"dbId": self.database_id,
"db": self.database.database_name if self.database else None,
Expand Down
3 changes: 1 addition & 2 deletions superset/sqllab/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ class ExecutePayloadSchema(Schema):


class QueryResultSchema(Schema):
changedOn = fields.DateTime()
changed_on = fields.String()
changed_on = fields.DateTime()
dbId = fields.Integer()
db = fields.String() # pylint: disable=invalid-name
endDttm = fields.Float()
Expand Down
63 changes: 1 addition & 62 deletions superset/views/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,12 @@
event_logger,
is_feature_enabled,
security_manager,
viz,
)
from superset.charts.commands.exceptions import ChartNotFoundError
from superset.charts.dao import ChartDAO
from superset.common.chart_data import ChartDataResultFormat, ChartDataResultType
from superset.connectors.base.models import BaseDatasource
from superset.connectors.sqla.models import AnnotationDatasource, SqlaTable
from superset.connectors.sqla.models import SqlaTable
from superset.dashboards.commands.exceptions import DashboardAccessDeniedError
from superset.dashboards.commands.importers.v0 import ImportDashboardsCommand
from superset.dashboards.permalink.commands.get import GetDashboardPermalinkCommand
Expand Down Expand Up @@ -96,7 +95,6 @@
check_datasource_perms,
check_explore_cache_perms,
check_resource_permissions,
check_slice_perms,
get_dashboard_extra_filters,
get_datasource_info,
get_form_data,
Expand Down Expand Up @@ -216,65 +214,6 @@ def generate_json(
payload = viz_obj.get_payload()
return self.send_data_payload_response(viz_obj, payload)

@event_logger.log_this
@api
@has_access_api
@expose("/slice_json/<int:slice_id>")
@etag_cache()
@check_resource_permissions(check_slice_perms)
@deprecated(new_target="/api/v1/chart/<int:id>/data/")
def slice_json(self, slice_id: int) -> FlaskResponse:
form_data, slc = get_form_data(slice_id, use_slice_data=True)
if not slc:
return json_error_response("The slice does not exist")

if not slc.datasource:
return json_error_response("The slice's datasource does not exist")

try:
viz_obj = get_viz(
datasource_type=slc.datasource.type,
datasource_id=slc.datasource.id,
form_data=form_data,
force=False,
)
return self.generate_json(viz_obj)
except SupersetException as ex:
return json_error_response(utils.error_msg_from_exception(ex))

@api
@has_access_api
@event_logger.log_this
@expose("/annotation_json/<int:layer_id>")
@deprecated(new_target="/api/v1/chart/<int:id>/data/")
def annotation_json( # pylint: disable=no-self-use
self, layer_id: int
) -> FlaskResponse:
form_data = get_form_data()[0]
force = utils.parse_boolean_string(request.args.get("force"))

form_data["layer_id"] = layer_id
form_data["filters"] = [{"col": "layer_id", "op": "==", "val": layer_id}]
# Set all_columns to ensure the TableViz returns the necessary columns to the
# frontend.
form_data["all_columns"] = [
"created_on",
"changed_on",
"id",
"start_dttm",
"end_dttm",
"layer_id",
"short_descr",
"long_descr",
"json_metadata",
"created_by_fk",
"changed_by_fk",
]
datasource = AnnotationDatasource()
viz_obj = viz.viz_types["table"](datasource, form_data=form_data, force=force)
payload = viz_obj.get_payload()
return data_payload_response(*viz_obj.payload_json_and_has_error(payload))

@event_logger.log_this
@api
@has_access_api
Expand Down
33 changes: 0 additions & 33 deletions superset/views/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -516,39 +516,6 @@ def check_datasource_perms(
viz_obj.raise_for_access()


def check_slice_perms(_self: Any, slice_id: int) -> None:
"""
Check if user can access a cached response from slice_json.
This function takes `self` since it must have the same signature as the
the decorated method.
:param slice_id: The slice ID
:raises SupersetSecurityException: If the user cannot access the resource
"""

form_data, slc = get_form_data(slice_id, use_slice_data=True)

if slc and slc.datasource:
try:
viz_obj = get_viz(
datasource_type=slc.datasource.type,
datasource_id=slc.datasource.id,
form_data=form_data,
force=False,
)
except NoResultFound as ex:
raise SupersetSecurityException(
SupersetError(
error_type=SupersetErrorType.UNKNOWN_DATASOURCE_TYPE_ERROR,
level=ErrorLevel.ERROR,
message="Could not find viz object",
)
) from ex

viz_obj.raise_for_access()


def _deserialize_results_payload(
payload: Union[bytes, str], query: Query, use_msgpack: Optional[bool] = False
) -> dict[str, Any]:
Expand Down
Loading

0 comments on commit 499a197

Please sign in to comment.