-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
# Conflicts: # docs/development/core/public/kibana-plugin-core-public.doclinksstart.md Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
- Loading branch information
1 parent
7f70d40
commit 7053f5b
Showing
42 changed files
with
364 additions
and
372 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
docs/development/core/public/kibana-plugin-core-public.doclinksstart.md
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
x-pack/plugins/spaces/public/legacy_urls/components/embeddable_legacy_url_conflict.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import React from 'react'; | ||
|
||
import type { EmbeddableLegacyUrlConflictProps } from '../types'; | ||
import type { InternalProps } from './embeddable_legacy_url_conflict_internal'; | ||
|
||
export const getEmbeddableLegacyUrlConflict = async ( | ||
internalProps: InternalProps | ||
): Promise<React.FC<EmbeddableLegacyUrlConflictProps>> => { | ||
const { EmbeddableLegacyUrlConflictInternal } = await import( | ||
'./embeddable_legacy_url_conflict_internal' | ||
); | ||
return (props: EmbeddableLegacyUrlConflictProps) => { | ||
return <EmbeddableLegacyUrlConflictInternal {...{ ...internalProps, ...props }} />; | ||
}; | ||
}; |
92 changes: 92 additions & 0 deletions
92
.../plugins/spaces/public/legacy_urls/components/embeddable_legacy_url_conflict_internal.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { | ||
EuiButtonEmpty, | ||
EuiCallOut, | ||
EuiCodeBlock, | ||
EuiLink, | ||
EuiSpacer, | ||
EuiTextAlign, | ||
} from '@elastic/eui'; | ||
import React, { useState } from 'react'; | ||
import useAsync from 'react-use/lib/useAsync'; | ||
|
||
import { i18n } from '@kbn/i18n'; | ||
import { FormattedMessage } from '@kbn/i18n/react'; | ||
import type { StartServicesAccessor } from 'src/core/public'; | ||
|
||
import type { PluginsStart } from '../../plugin'; | ||
import type { SpacesManager } from '../../spaces_manager'; | ||
import type { EmbeddableLegacyUrlConflictProps } from '../types'; | ||
|
||
export interface InternalProps { | ||
spacesManager: SpacesManager; | ||
getStartServices: StartServicesAccessor<PluginsStart>; | ||
} | ||
|
||
export const EmbeddableLegacyUrlConflictInternal = ( | ||
props: InternalProps & EmbeddableLegacyUrlConflictProps | ||
) => { | ||
const { spacesManager, getStartServices, targetType, sourceId } = props; | ||
|
||
const [expandError, setExpandError] = useState(false); | ||
|
||
const { value: asyncParams } = useAsync(async () => { | ||
const [{ docLinks }] = await getStartServices(); | ||
const { id: targetSpace } = await spacesManager.getActiveSpace(); | ||
const docLink = docLinks.links.spaces.kibanaDisableLegacyUrlAliasesApi; | ||
const aliasJsonString = JSON.stringify({ targetSpace, targetType, sourceId }, null, 2); | ||
return { docLink, aliasJsonString }; | ||
}, [getStartServices, spacesManager]); | ||
const { docLink, aliasJsonString } = asyncParams ?? {}; | ||
|
||
if (!aliasJsonString || !docLink) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<> | ||
<FormattedMessage | ||
id="xpack.spaces.embeddableLegacyUrlConflict.messageText" | ||
defaultMessage="We found 2 saved objects for this panel. Disable the legacy URL alias to fix this error." | ||
/> | ||
<EuiSpacer /> | ||
{expandError ? ( | ||
<EuiTextAlign textAlign="left"> | ||
<EuiCallOut | ||
title={ | ||
<FormattedMessage | ||
id="xpack.spaces.embeddableLegacyUrlConflict.calloutTitle" | ||
defaultMessage="Copy this JSON and use it with the {documentationLink}" | ||
values={{ | ||
documentationLink: ( | ||
<EuiLink external href={docLink} target="_blank"> | ||
{'_disable_legacy_url_aliases API'} | ||
</EuiLink> | ||
), | ||
}} | ||
/> | ||
} | ||
color="danger" | ||
iconType="alert" | ||
> | ||
<EuiCodeBlock fontSize="s" language="json" isCopyable={true} paddingSize="none"> | ||
{aliasJsonString} | ||
</EuiCodeBlock> | ||
</EuiCallOut> | ||
</EuiTextAlign> | ||
) : ( | ||
<EuiButtonEmpty onClick={() => setExpandError(true)}> | ||
{i18n.translate('xpack.spaces.embeddableLegacyUrlConflict.detailsButton', { | ||
defaultMessage: `View details`, | ||
})} | ||
</EuiButtonEmpty> | ||
)} | ||
</> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
Oops, something went wrong.