Skip to content

Commit 4464f99

Browse files
committed
rename attachment id to saved object id
1 parent e3206a5 commit 4464f99

40 files changed

Lines changed: 162 additions & 162 deletions

x-pack/platform/plugins/shared/cases/common/types/api/attachment/v1.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ describe('Attachments', () => {
347347
error: 'error',
348348
message: 'not found',
349349
status: 404,
350-
attachmentId: 'abc',
350+
savedObjectId: 'abc',
351351
},
352352
],
353353
};

x-pack/platform/plugins/shared/cases/common/types/api/attachment/v1.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ export const BulkGetAttachmentsResponseRt = rt.strict({
163163
error: rt.string,
164164
message: rt.string,
165165
status: rt.union([rt.undefined, rt.number]),
166-
attachmentId: rt.string,
166+
savedObjectId: rt.string,
167167
})
168168
),
169169
});

x-pack/platform/plugins/shared/cases/common/types/api/attachment/v2.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export const BulkGetAttachmentsResponseRtV2 = rt.strict({
5757
error: rt.string,
5858
message: rt.string,
5959
status: rt.union([rt.undefined, rt.number]),
60-
attachmentId: rt.string,
60+
savedObjectId: rt.string,
6161
})
6262
),
6363
});

x-pack/platform/plugins/shared/cases/public/client/attachment_framework/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export interface AttachmentViewObject<Props = {}> {
5252
}
5353

5454
export interface CommonAttachmentViewProps {
55-
attachmentId: string;
55+
savedObjectId: string;
5656
caseData: Pick<CaseUI, 'id' | 'title'>;
5757
}
5858

x-pack/platform/plugins/shared/cases/public/components/attachments/comment/index.tsx

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@ const CommentAttachmentChildrenLazy = React.lazy(async () => {
2727

2828
const CommentAttachmentChildren: React.FC<UnifiedValueAttachmentViewProps> = (props) => (
2929
<CommentChildren
30-
// TODO: attachmentId here means saved object id
31-
// it's a legacy term that should be renamed to savedObjectId
32-
commentId={props.attachmentId}
30+
commentId={props.savedObjectId}
3331
content={props.data.content as string}
3432
caseId={props.caseData.id}
3533
version={props.version}
@@ -55,15 +53,15 @@ const CommentActionsLazy = React.lazy(() =>
5553
const getCommentClassName = (props: UnifiedCommentViewProps): string | undefined => {
5654
if (!props.rowContext) return undefined;
5755

58-
const { attachmentId, caseData } = props;
56+
const { savedObjectId, caseData } = props;
5957
const { selectedOutlineCommentId, manageMarkdownEditIds, loadingCommentIds, appId } =
6058
props.rowContext;
6159

62-
const outlined = attachmentId === selectedOutlineCommentId;
63-
const isEdit = manageMarkdownEditIds.includes(attachmentId);
64-
const isLoading = loadingCommentIds.includes(attachmentId);
60+
const outlined = savedObjectId === selectedOutlineCommentId;
61+
const isEdit = manageMarkdownEditIds.includes(savedObjectId);
62+
const isLoading = loadingCommentIds.includes(savedObjectId);
6563
const draftFooter =
66-
!isEdit && !isLoading && hasDraftComment(appId, caseData.id, attachmentId, props.data.content);
64+
!isEdit && !isLoading && hasDraftComment(appId, caseData.id, savedObjectId, props.data.content);
6765

6866
return classNames('userAction__comment', {
6967
outlined,
@@ -94,9 +92,7 @@ const getCommentAttachmentViewObject = (props: UnifiedValueAttachmentViewProps)
9492
return (
9593
<React.Suspense fallback={null}>
9694
<CommentActionsLazy
97-
// TODO: attachmentId here meant saved object id
98-
// it's a legacy term that should be renamed to savedObjectId
99-
commentId={viewProps.attachmentId}
95+
commentId={viewProps.savedObjectId}
10096
content={viewProps.data.content as string}
10197
/>
10298
</React.Suspense>

x-pack/platform/plugins/shared/cases/public/components/attachments/file/file_type.test.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ describe('getFileType', () => {
3131

3232
describe('getFileAttachmentViewObject', () => {
3333
const attachmentViewProps: ExternalReferenceAttachmentViewProps = {
34+
savedObjectId: 'test-so-id',
3435
externalReferenceId: basicFileMock.id,
3536
// @ts-expect-error: files is a proper JSON
3637
externalReferenceMetadata: { files: [basicFileMock] },

x-pack/platform/plugins/shared/cases/public/components/attachments/lens/attachment.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ describe('getVisualizationAttachmentType', () => {
2727
attributes: { state: { query: {} } },
2828
timeRange: {},
2929
},
30-
attachmentId: 'test',
30+
savedObjectId: 'test',
3131
caseData: { title: basicCase.title, id: basicCase.id },
3232
};
3333

x-pack/platform/plugins/shared/cases/public/components/attachments/lens/attachment.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,21 @@ import type { LensProps } from './types';
2020
import { OpenLensButton } from './open_lens_button';
2121
import { LensRenderer } from './lens_renderer';
2222

23-
function getOpenLensButton(attachmentId: string, props: LensProps) {
23+
function getOpenLensButton(savedObjectId: string, props: LensProps) {
2424
return (
2525
<OpenLensButton
26-
attachmentId={attachmentId}
26+
savedObjectId={savedObjectId}
2727
attributes={props.attributes}
2828
timeRange={props.timeRange}
2929
metadata={props.metadata}
3030
/>
3131
);
3232
}
3333

34-
const getVisualizationAttachmentActions = (attachmentId: string, props: LensProps) => [
34+
const getVisualizationAttachmentActions = (savedObjectId: string, props: LensProps) => [
3535
{
3636
type: AttachmentActionType.CUSTOM as const,
37-
render: () => getOpenLensButton(attachmentId, props),
37+
render: () => getOpenLensButton(savedObjectId, props),
3838
isPrimary: false,
3939
},
4040
];
@@ -59,7 +59,7 @@ const LensAttachmentRendererLazyComponent = React.lazy(async () => {
5959
});
6060

6161
const getVisualizationAttachmentViewObject = ({
62-
attachmentId,
62+
savedObjectId,
6363
persistableStateAttachmentState,
6464
}: PersistableStateAttachmentViewProps) => {
6565
const { attributes: lensAttributes, timeRange: lensTimeRange } =
@@ -69,7 +69,7 @@ const getVisualizationAttachmentViewObject = ({
6969
event: i18n.ADDED_VISUALIZATION,
7070
timelineAvatar: 'lensApp',
7171
getActions: () =>
72-
getVisualizationAttachmentActions(attachmentId, {
72+
getVisualizationAttachmentActions(savedObjectId, {
7373
attributes: lensAttributes,
7474
timeRange: lensTimeRange,
7575
}),

x-pack/platform/plugins/shared/cases/public/components/attachments/lens/open_lens_button.test.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import { renderWithTestingProviders } from '../../../common/mock';
1717

1818
describe('OpenLensButton', () => {
1919
const props = {
20-
attachmentId: 'test',
20+
savedObjectId: 'test',
2121
...lensVisualization,
2222
};
2323

@@ -58,7 +58,7 @@ describe('OpenLensButton', () => {
5858

5959
expect(navigateToPrefilledEditor).toBeCalledWith(
6060
{
61-
id: props.attachmentId,
61+
id: props.savedObjectId,
6262
...rest,
6363
time_range: timeRange,
6464
},
@@ -80,7 +80,7 @@ describe('OpenLensButton', () => {
8080

8181
it('does not show the button if the query is an ESQL', () => {
8282
const esqlProps = {
83-
attachmentId: 'test',
83+
savedObjectId: 'test',
8484
...lensVisualization,
8585
};
8686

x-pack/platform/plugins/shared/cases/public/components/attachments/lens/open_lens_button.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,25 @@ import { useKibana } from '../../../common/lib/kibana';
1212
import { OPEN_IN_VISUALIZATION } from './translations';
1313
import type { LensProps } from './types';
1414

15-
type Props = LensProps & { attachmentId: string };
15+
type Props = LensProps & { savedObjectId: string };
1616

17-
const OpenLensButtonComponent: React.FC<Props> = ({ attachmentId, attributes, timeRange }) => {
17+
const OpenLensButtonComponent: React.FC<Props> = ({ savedObjectId, attributes, timeRange }) => {
1818
const {
1919
lens: { navigateToPrefilledEditor, canUseEditor },
2020
} = useKibana().services;
2121

2222
const onClick = useCallback(() => {
2323
navigateToPrefilledEditor(
2424
{
25-
id: attachmentId,
25+
id: savedObjectId,
2626
time_range: timeRange,
2727
attributes,
2828
},
2929
{
3030
openInNewTab: true,
3131
}
3232
);
33-
}, [attachmentId, attributes, navigateToPrefilledEditor, timeRange]);
33+
}, [savedObjectId, attributes, navigateToPrefilledEditor, timeRange]);
3434

3535
const hasLensPermissions = canUseEditor();
3636
const isESQLQuery = isOfAggregateQueryType(attributes.state.query);

0 commit comments

Comments
 (0)