Skip to content

Commit ff973c5

Browse files
committed
Fix comments
1 parent a86d821 commit ff973c5

File tree

7 files changed

+26
-17
lines changed

7 files changed

+26
-17
lines changed

src/plugins/discover/kibana.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"indexPatternFieldEditor"
1717
],
1818
"optionalPlugins": ["home", "share", "usageCollection", "spaces"],
19-
"requiredBundles": ["kibanaUtils", "home", "kibanaReact", "fieldFormats"],
19+
"requiredBundles": ["kibanaUtils", "home", "kibanaReact", "fieldFormats", "dataViews"],
2020
"extraPublicDirs": ["common"],
2121
"owner": {
2222
"name": "Data Discovery",

src/plugins/discover/public/application/apps/main/components/top_nav/on_save_search.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ export async function onSaveSearch({
111111
const saveOptions: SaveSavedSearchOptions = {
112112
onTitleDuplicate,
113113
copyOnSave: newCopyOnSave,
114+
isTitleDuplicateConfirmed,
114115
};
115116
const response = await saveDataSource({
116117
indexPattern,

src/plugins/discover/public/application/apps/main/discover_main_route.tsx

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { loadIndexPattern, resolveIndexPattern } from './utils/resolve_index_pat
1919
import { DiscoverMainApp } from './discover_main_app';
2020
import { getRootBreadcrumbs, getSavedSearchBreadcrumbs } from '../../helpers/breadcrumbs';
2121
import { redirectWhenMissing } from '../../../../../kibana_utils/public';
22+
import { DataViewSavedObjectConflictError } from '../../../../../data_views/common';
2223
import { getUrlTracker } from '../../../kibana_services';
2324
import { LoadingIndicator } from '../../components/common/loading_indicator';
2425

@@ -119,22 +120,26 @@ export function DiscoverMainRoute({ services, history }: DiscoverMainProps) {
119120
);
120121
}
121122
} catch (e) {
122-
redirectWhenMissing({
123-
history,
124-
navigateToApp: core.application.navigateToApp,
125-
basePath,
126-
mapping: {
127-
search: '/',
128-
'index-pattern': {
129-
app: 'management',
130-
path: `kibana/objects/savedSearches/${id}`,
123+
if (e instanceof DataViewSavedObjectConflictError) {
124+
setError(e);
125+
} else {
126+
redirectWhenMissing({
127+
history,
128+
navigateToApp: core.application.navigateToApp,
129+
basePath,
130+
mapping: {
131+
search: '/',
132+
'index-pattern': {
133+
app: 'management',
134+
path: `kibana/objects/savedSearches/${id}`,
135+
},
131136
},
132-
},
133-
toastNotifications,
134-
onBeforeRedirect() {
135-
getUrlTracker().setTrackedUrl('/');
136-
},
137-
})(e);
137+
toastNotifications,
138+
onBeforeRedirect() {
139+
getUrlTracker().setTrackedUrl('/');
140+
},
141+
})(e);
142+
}
138143
}
139144
}
140145

src/plugins/discover/public/saved_searches/save_saved_searches.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { toSavedSearchAttributes } from './saved_searches_utils';
1313

1414
export interface SaveSavedSearchOptions {
1515
onTitleDuplicate?: () => void;
16+
isTitleDuplicateConfirmed?: boolean;
1617
copyOnSave?: boolean;
1718
}
1819

@@ -48,6 +49,7 @@ export const saveSavedSearch = async (
4849
if (savedSearch.title) {
4950
if (
5051
isNew &&
52+
!options.isTitleDuplicateConfirmed &&
5153
options.onTitleDuplicate &&
5254
(await hasDuplicatedTitle(savedSearch.title, savedObjectsClient))
5355
) {

src/plugins/discover/public/saved_searches/saved_search_url_conflict_callout.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export const SavedSearchURLConflictCallout = ({
2424
spaces,
2525
history,
2626
}: SavedSearchURLConflictCalloutProps) => {
27+
console.log('SavedSearchURLConflictCallout', savedSearch)
2728
if (spaces && savedSearch?.id && savedSearch?.sharingSavedObjectProps?.outcome === 'conflict') {
2829
const otherObjectId = savedSearch.sharingSavedObjectProps?.aliasTargetId;
2930

src/plugins/discover/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
{ "path": "../kibana_legacy/tsconfig.json" },
2626
{ "path": "../index_pattern_field_editor/tsconfig.json"},
2727
{ "path": "../field_formats/tsconfig.json" },
28+
{ "path": "../data_views/tsconfig.json" },
2829
{ "path": "../../../x-pack/plugins/spaces/tsconfig.json" }
2930
]
3031
}

src/plugins/visualize/public/application/types.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ import type { DashboardStart } from '../../../dashboard/public';
4646
import type { SavedObjectsTaggingApi } from '../../../saved_objects_tagging_oss/public';
4747
import type { UsageCollectionStart } from '../../../usage_collection/public';
4848
import type { SavedSearch } from '../../../discover/public';
49-
import type { SpacesPluginStart } from '../../../../../x-pack/plugins/spaces/public';
5049

5150
import { PureVisState } from '../../common/types';
5251

0 commit comments

Comments
 (0)