mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[Cases] Disable deletion of cases files in stack mgmt. (#155683)
## Summary Since https://github.com/elastic/kibana/pull/155179 was merged we can now disable the deletion of Cases files in the Files page in Stack management. https://user-images.githubusercontent.com/1533137/234191683-8f768520-f842-413e-b922-200d01e2df28.mov --------- Co-authored-by: Jonathan Buttner <jonathan.buttner@elastic.co>
This commit is contained in:
parent
ccd9d1484b
commit
933bca2537
3 changed files with 43 additions and 2 deletions
|
@ -7,7 +7,7 @@ pageLoadAssetSize:
|
|||
banners: 17946
|
||||
bfetch: 22837
|
||||
canvas: 1066647
|
||||
cases: 170000
|
||||
cases: 175000
|
||||
charts: 55000
|
||||
cloud: 21076
|
||||
cloudChat: 19894
|
||||
|
|
|
@ -7,16 +7,42 @@
|
|||
|
||||
import type { FilesSetup } from '@kbn/files-plugin/public';
|
||||
import type { FileKindBrowser } from '@kbn/shared-ux-file-types';
|
||||
import { MAX_FILE_SIZE, OWNERS } from '../../common/constants';
|
||||
import {
|
||||
GENERAL_CASES_OWNER,
|
||||
MAX_FILE_SIZE,
|
||||
OBSERVABILITY_OWNER,
|
||||
OWNERS,
|
||||
SECURITY_SOLUTION_OWNER,
|
||||
} from '../../common/constants';
|
||||
import type { Owner } from '../../common/constants/types';
|
||||
import { constructFileKindIdByOwner } from '../../common/files';
|
||||
import type { CaseFileKinds, FilesConfig } from './types';
|
||||
import * as i18n from './translations';
|
||||
|
||||
const getOwnerUIName = (owner: Owner) => {
|
||||
switch (owner) {
|
||||
case SECURITY_SOLUTION_OWNER:
|
||||
return 'Security';
|
||||
case OBSERVABILITY_OWNER:
|
||||
return 'Observability';
|
||||
case GENERAL_CASES_OWNER:
|
||||
return 'Stack Management';
|
||||
default:
|
||||
return owner;
|
||||
}
|
||||
};
|
||||
|
||||
const buildFileKind = (config: FilesConfig, owner: Owner): FileKindBrowser => {
|
||||
return {
|
||||
id: constructFileKindIdByOwner(owner),
|
||||
allowedMimeTypes: config.allowedMimeTypes,
|
||||
maxSizeBytes: config.maxSize ?? MAX_FILE_SIZE,
|
||||
managementUiActions: {
|
||||
delete: {
|
||||
enabled: false,
|
||||
reason: i18n.FILE_DELETE_REASON(getOwnerUIName(owner)),
|
||||
},
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
|
|
15
x-pack/plugins/cases/public/files/translations.ts
Normal file
15
x-pack/plugins/cases/public/files/translations.ts
Normal file
|
@ -0,0 +1,15 @@
|
|||
/*
|
||||
* 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 { i18n } from '@kbn/i18n';
|
||||
|
||||
export const FILE_DELETE_REASON = (owner: string) =>
|
||||
i18n.translate('xpack.cases.files.deleteReason', {
|
||||
values: { owner },
|
||||
defaultMessage:
|
||||
'This file is managed by Cases. Navigate to the Cases page under {owner} to delete it.',
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue