mirror of
https://github.com/apache/superset.git
synced 2026-04-23 10:04:45 +00:00
feat(style): hide dashboard header by url parameter (#12918)
* feat(native-filters): hide dashboard header bu url parameter * lint: fix lint * test: add tests * test: fix test * refactor: upgrade standalone param * fix: pre-commit and extract to method is_standalone_mode * test: fix tests * test: fix tests * fix: fix standalone statement * refactor: fix CR notes * chore: pre-commit * fix: fix sticky tabs + update CR notes * lint: fix lint * lint: fix lint * fix: fix CR notes * fix: fix CR notes * lint: fix lint * refactor: fix cr notes Co-authored-by: amitmiran137 <amit.miran@nielsen.com>
This commit is contained in:
@@ -26,7 +26,8 @@ import configureStore from 'redux-mock-store';
|
||||
import fetchMock from 'fetch-mock';
|
||||
import EmbedCodeButton from 'src/explore/components/EmbedCodeButton';
|
||||
import * as exploreUtils from 'src/explore/exploreUtils';
|
||||
import * as common from 'src/utils/common';
|
||||
import * as urlUtils from 'src/utils/urlUtils';
|
||||
import { DashboardStandaloneMode } from 'src/dashboard/util/constants';
|
||||
|
||||
const ENDPOINT = 'glob:*/r/shortner/';
|
||||
|
||||
@@ -53,7 +54,7 @@ describe('EmbedCodeButton', () => {
|
||||
|
||||
it('should create a short, standalone, explore url', () => {
|
||||
const spy1 = sinon.spy(exploreUtils, 'getExploreLongUrl');
|
||||
const spy2 = sinon.spy(common, 'getShortUrl');
|
||||
const spy2 = sinon.spy(urlUtils, 'getShortUrl');
|
||||
|
||||
const wrapper = mount(
|
||||
<ThemeProvider theme={supersetTheme}>
|
||||
@@ -92,15 +93,17 @@ describe('EmbedCodeButton', () => {
|
||||
shortUrlId: 100,
|
||||
});
|
||||
const embedHTML =
|
||||
'<iframe\n' +
|
||||
' width="2000"\n' +
|
||||
' height="1000"\n' +
|
||||
' seamless\n' +
|
||||
' frameBorder="0"\n' +
|
||||
' scrolling="no"\n' +
|
||||
' src="http://localhostendpoint_url?r=100&standalone=true&height=1000"\n' +
|
||||
'>\n' +
|
||||
'</iframe>';
|
||||
`${
|
||||
'<iframe\n' +
|
||||
' width="2000"\n' +
|
||||
' height="1000"\n' +
|
||||
' seamless\n' +
|
||||
' frameBorder="0"\n' +
|
||||
' scrolling="no"\n' +
|
||||
' src="http://localhostendpoint_url?r=100&standalone='
|
||||
}${DashboardStandaloneMode.HIDE_NAV}&height=1000"\n` +
|
||||
`>\n` +
|
||||
`</iframe>`;
|
||||
expect(wrapper.instance().generateEmbedHTML()).toBe(embedHTML);
|
||||
stub.restore();
|
||||
});
|
||||
|
||||
@@ -30,6 +30,7 @@ import {
|
||||
buildTimeRangeString,
|
||||
formatTimeRange,
|
||||
} from 'src/explore/dateFilterUtils';
|
||||
import { DashboardStandaloneMode } from 'src/dashboard/util/constants';
|
||||
import * as hostNamesConfig from 'src/utils/hostNamesConfig';
|
||||
import { getChartMetadataRegistry } from '@superset-ui/core';
|
||||
|
||||
@@ -99,7 +100,9 @@ describe('exploreUtils', () => {
|
||||
});
|
||||
compareURI(
|
||||
URI(url),
|
||||
URI('/superset/explore/').search({ standalone: 'true' }),
|
||||
URI('/superset/explore/').search({
|
||||
standalone: DashboardStandaloneMode.HIDE_NAV,
|
||||
}),
|
||||
);
|
||||
});
|
||||
it('preserves main URLs params', () => {
|
||||
@@ -205,7 +208,7 @@ describe('exploreUtils', () => {
|
||||
URI(getExploreLongUrl(formData, 'standalone')),
|
||||
URI('/superset/explore/').search({
|
||||
form_data: sFormData,
|
||||
standalone: 'true',
|
||||
standalone: DashboardStandaloneMode.HIDE_NAV,
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user