diff --git a/superset-frontend/src/views/CRUD/chart/ChartList.test.jsx b/superset-frontend/src/views/CRUD/chart/ChartList.test.jsx
index 894aa4ec61..394c8b6028 100644
--- a/superset-frontend/src/views/CRUD/chart/ChartList.test.jsx
+++ b/superset-frontend/src/views/CRUD/chart/ChartList.test.jsx
@@ -190,7 +190,7 @@ describe('RTL', () => {
});
it('renders an "Import Chart" tooltip under import button', async () => {
- const importButton = screen.getByTestId('import-button');
+ const importButton = await screen.findByTestId('import-button');
userEvent.hover(importButton);
await screen.findByRole('tooltip');
diff --git a/superset-frontend/src/views/CRUD/chart/ChartList.tsx b/superset-frontend/src/views/CRUD/chart/ChartList.tsx
index 547482a7f2..6f3e7b7d5b 100644
--- a/superset-frontend/src/views/CRUD/chart/ChartList.tsx
+++ b/superset-frontend/src/views/CRUD/chart/ChartList.tsx
@@ -586,21 +586,22 @@ function ChartList(props: ChartListProps) {
window.location.assign('/chart/add');
},
});
- }
- if (isFeatureEnabled(FeatureFlag.VERSIONED_EXPORT)) {
- subMenuButtons.push({
- name: (
-
-
-
- ),
- buttonStyle: 'link',
- onClick: openChartImportModal,
- });
+
+ if (isFeatureEnabled(FeatureFlag.VERSIONED_EXPORT)) {
+ subMenuButtons.push({
+ name: (
+
+
+
+ ),
+ buttonStyle: 'link',
+ onClick: openChartImportModal,
+ });
+ }
}
return (
<>
diff --git a/superset-frontend/src/views/CRUD/dashboard/DashboardList.test.jsx b/superset-frontend/src/views/CRUD/dashboard/DashboardList.test.jsx
index 4bb2043bc7..3561cafdbc 100644
--- a/superset-frontend/src/views/CRUD/dashboard/DashboardList.test.jsx
+++ b/superset-frontend/src/views/CRUD/dashboard/DashboardList.test.jsx
@@ -211,7 +211,7 @@ describe('RTL', () => {
});
it('renders an "Import Dashboard" tooltip under import button', async () => {
- const importButton = screen.getByTestId('import-button');
+ const importButton = await screen.findByTestId('import-button');
userEvent.hover(importButton);
await screen.findByRole('tooltip');
diff --git a/superset-frontend/src/views/CRUD/dashboard/DashboardList.tsx b/superset-frontend/src/views/CRUD/dashboard/DashboardList.tsx
index 8d6be338e0..04c0e8c764 100644
--- a/superset-frontend/src/views/CRUD/dashboard/DashboardList.tsx
+++ b/superset-frontend/src/views/CRUD/dashboard/DashboardList.tsx
@@ -553,21 +553,22 @@ function DashboardList(props: DashboardListProps) {
window.location.assign('/dashboard/new');
},
});
- }
- if (isFeatureEnabled(FeatureFlag.VERSIONED_EXPORT)) {
- subMenuButtons.push({
- name: (
-
-
-
- ),
- buttonStyle: 'link',
- onClick: openDashboardImportModal,
- });
+
+ if (isFeatureEnabled(FeatureFlag.VERSIONED_EXPORT)) {
+ subMenuButtons.push({
+ name: (
+
+
+
+ ),
+ buttonStyle: 'link',
+ onClick: openDashboardImportModal,
+ });
+ }
}
return (
<>
diff --git a/superset-frontend/src/views/CRUD/data/database/DatabaseList.test.jsx b/superset-frontend/src/views/CRUD/data/database/DatabaseList.test.jsx
index 3f8e619cb2..815ae628fc 100644
--- a/superset-frontend/src/views/CRUD/data/database/DatabaseList.test.jsx
+++ b/superset-frontend/src/views/CRUD/data/database/DatabaseList.test.jsx
@@ -211,7 +211,7 @@ describe('RTL', () => {
});
it('renders an "Import Database" tooltip under import button', async () => {
- const importButton = screen.getByTestId('import-button');
+ const importButton = await screen.findByTestId('import-button');
userEvent.hover(importButton);
await screen.findByRole('tooltip');
diff --git a/superset-frontend/src/views/CRUD/data/dataset/DatasetList.test.jsx b/superset-frontend/src/views/CRUD/data/dataset/DatasetList.test.jsx
index 11cc3d4033..0854f006de 100644
--- a/superset-frontend/src/views/CRUD/data/dataset/DatasetList.test.jsx
+++ b/superset-frontend/src/views/CRUD/data/dataset/DatasetList.test.jsx
@@ -211,7 +211,7 @@ describe('RTL', () => {
});
it('renders an "Import Dataset" tooltip under import button', async () => {
- const importButton = screen.getByTestId('import-button');
+ const importButton = await screen.findByTestId('import-button');
userEvent.hover(importButton);
await screen.findByRole('tooltip');
diff --git a/superset-frontend/src/views/CRUD/data/dataset/DatasetList.tsx b/superset-frontend/src/views/CRUD/data/dataset/DatasetList.tsx
index 5b73d545b8..e8f05830bb 100644
--- a/superset-frontend/src/views/CRUD/data/dataset/DatasetList.tsx
+++ b/superset-frontend/src/views/CRUD/data/dataset/DatasetList.tsx
@@ -512,22 +512,22 @@ const DatasetList: FunctionComponent = ({
onClick: () => setDatasetAddModalOpen(true),
buttonStyle: 'primary',
});
- }
- if (isFeatureEnabled(FeatureFlag.VERSIONED_EXPORT)) {
- buttonArr.push({
- name: (
-
-
-
- ),
- buttonStyle: 'link',
- onClick: openDatasetImportModal,
- });
+ if (isFeatureEnabled(FeatureFlag.VERSIONED_EXPORT)) {
+ buttonArr.push({
+ name: (
+
+
+
+ ),
+ buttonStyle: 'link',
+ onClick: openDatasetImportModal,
+ });
+ }
}
menuData.buttons = buttonArr;
diff --git a/superset-frontend/src/views/CRUD/data/savedquery/SavedQueryList.test.jsx b/superset-frontend/src/views/CRUD/data/savedquery/SavedQueryList.test.jsx
index 6bbb384111..8e1c60d669 100644
--- a/superset-frontend/src/views/CRUD/data/savedquery/SavedQueryList.test.jsx
+++ b/superset-frontend/src/views/CRUD/data/savedquery/SavedQueryList.test.jsx
@@ -284,14 +284,14 @@ describe('RTL', () => {
expect(exportTooltip).toBeInTheDocument();
});
- it('renders an import button in the submenu', () => {
+ it('renders an import button in the submenu', async () => {
// Grab and assert that import saved query button is visible
- const importButton = screen.getByTestId('import-button');
+ const importButton = await screen.findByTestId('import-button');
expect(importButton).toBeVisible();
});
it('renders an "Import Saved Query" tooltip under import button', async () => {
- const importButton = screen.getByTestId('import-button');
+ const importButton = await screen.findByTestId('import-button');
userEvent.hover(importButton);
waitFor(() => {
expect(importButton).toHaveClass('ant-tooltip-open');
@@ -303,9 +303,9 @@ describe('RTL', () => {
});
});
- it('renders an import model when import button is clicked', async () => {
+ it('renders an import modal when import button is clicked', async () => {
// Grab and click import saved query button to reveal modal
- const importButton = screen.getByTestId('import-button');
+ const importButton = await screen.findByTestId('import-button');
userEvent.click(importButton);
// Grab and assert that saved query import modal's heading is visible
@@ -315,9 +315,9 @@ describe('RTL', () => {
expect(importSavedQueryModalHeading).toBeVisible();
});
- it('imports a saved query', () => {
+ it('imports a saved query', async () => {
// Grab and click import saved query button to reveal modal
- const importButton = screen.getByTestId('import-button');
+ const importButton = await screen.findByTestId('import-button');
userEvent.click(importButton);
// Grab "Choose File" input from import modal
diff --git a/superset-frontend/src/views/CRUD/data/savedquery/SavedQueryList.tsx b/superset-frontend/src/views/CRUD/data/savedquery/SavedQueryList.tsx
index 25eb4933ed..0f6fd5f16b 100644
--- a/superset-frontend/src/views/CRUD/data/savedquery/SavedQueryList.tsx
+++ b/superset-frontend/src/views/CRUD/data/savedquery/SavedQueryList.tsx
@@ -133,6 +133,7 @@ function SavedQueryList({
refreshData();
};
+ const canCreate = hasPerm('can_write');
const canEdit = hasPerm('can_write');
const canDelete = hasPerm('can_write');
const canExport =
@@ -185,7 +186,7 @@ function SavedQueryList({
buttonStyle: 'primary',
});
- if (isFeatureEnabled(FeatureFlag.VERSIONED_EXPORT)) {
+ if (canCreate && isFeatureEnabled(FeatureFlag.VERSIONED_EXPORT)) {
subMenuButtons.push({
name: (