mirror of
https://github.com/apache/superset.git
synced 2026-05-10 02:15:50 +00:00
Details/links on Database deletion
This commit is contained in:
@@ -65,8 +65,8 @@ const dbConfigExtraExtension = extensionsRegistry.get(
|
||||
const PAGE_SIZE = 25;
|
||||
|
||||
interface DatabaseDeleteObject extends DatabaseObject {
|
||||
chart_count: number;
|
||||
dashboard_count: number;
|
||||
charts: any;
|
||||
dashboards: any;
|
||||
sqllab_tab_count: number;
|
||||
}
|
||||
interface DatabaseListProps {
|
||||
@@ -170,8 +170,8 @@ function DatabaseList({
|
||||
.then(({ json = {} }) => {
|
||||
setDatabaseCurrentlyDeleting({
|
||||
...database,
|
||||
chart_count: json.charts.count,
|
||||
dashboard_count: json.dashboards.count,
|
||||
charts: json.charts,
|
||||
dashboards: json.dashboards,
|
||||
sqllab_tab_count: json.sqllab_tab_states.count,
|
||||
});
|
||||
})
|
||||
@@ -609,14 +609,62 @@ function DatabaseList({
|
||||
description={
|
||||
<>
|
||||
<p>
|
||||
{t('The database')}
|
||||
<b> {databaseCurrentlyDeleting.database_name} </b>
|
||||
{t(
|
||||
'The database %s is linked to %s charts that appear on %s dashboards and users have %s SQL Lab tabs using this database open. Are you sure you want to continue? Deleting the database will break those objects.',
|
||||
databaseCurrentlyDeleting.database_name,
|
||||
databaseCurrentlyDeleting.chart_count,
|
||||
databaseCurrentlyDeleting.dashboard_count,
|
||||
'is linked to %s charts that appear on %s dashboards and users have %s SQL Lab tabs using this database open. Are you sure you want to continue? Deleting the database will break those objects.',
|
||||
databaseCurrentlyDeleting.charts.count,
|
||||
databaseCurrentlyDeleting.dashboards.count,
|
||||
databaseCurrentlyDeleting.sqllab_tab_count,
|
||||
)}
|
||||
</p>
|
||||
{databaseCurrentlyDeleting.dashboards.count >= 1 && (
|
||||
<>
|
||||
<h4>{t('Affected Dashboards')}</h4>
|
||||
<ul>
|
||||
{databaseCurrentlyDeleting.dashboards.result.map(
|
||||
(
|
||||
result: { id: Key | null | undefined; title: string },
|
||||
index: number,
|
||||
) => (
|
||||
<li key={result.id}>
|
||||
<a
|
||||
href={`/superset/dashboard/${result.id}`}
|
||||
target="_atRiskItem"
|
||||
>
|
||||
{result.title}
|
||||
</a>
|
||||
</li>
|
||||
),
|
||||
)}
|
||||
</ul>
|
||||
</>
|
||||
)}
|
||||
{databaseCurrentlyDeleting.charts.count >= 1 && (
|
||||
<>
|
||||
<h4>{t('Affected Charts')}</h4>
|
||||
<ul>
|
||||
{databaseCurrentlyDeleting.charts.result.map(
|
||||
(
|
||||
result: {
|
||||
id: Key | null | undefined;
|
||||
slice_name: string;
|
||||
},
|
||||
index: number,
|
||||
) => (
|
||||
<li key={result.id}>
|
||||
<a
|
||||
href={`/explore/?slice_id=${result.id}`}
|
||||
target="_atRiskItem"
|
||||
>
|
||||
{result.slice_name}
|
||||
</a>
|
||||
</li>
|
||||
),
|
||||
)}
|
||||
</ul>
|
||||
</>
|
||||
)}
|
||||
{DatabaseDeleteRelatedExtension && (
|
||||
<DatabaseDeleteRelatedExtension
|
||||
database={databaseCurrentlyDeleting}
|
||||
|
||||
Reference in New Issue
Block a user