Skip to content

Commit

Permalink
Unable to delete visuals and dashboards form savedobjects menu in aptive
Browse files Browse the repository at this point in the history
and Brinks
  • Loading branch information
rbhukya committed Apr 12, 2021
1 parent 02a64b4 commit 6dcb959
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 4 deletions.
7 changes: 6 additions & 1 deletion src/core/server/saved_objects/routes/delete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,18 @@ export const registerDeleteRoute = (router: IRouter) => {
}),
query: schema.object({
force: schema.maybe(schema.boolean()),
accountId: schema.string(),
userId: schema.string()
}),
},
},
router.handleLegacyErrors(async (context, req, res) => {
const { type, id } = req.params;
const { force } = req.query;
const result = await context.core.savedObjects.client.delete(type, id, { force });
const { accountId } = req.query;
const { userId } = req.query;
const options = { force, accountId, userId };
const result = await context.core.savedObjects.client.delete(type, id, options);
return res.ok({ body: result });
})
);
Expand Down
6 changes: 5 additions & 1 deletion src/core/server/saved_objects/routes/import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ export const registerImportRoute = (router: IRouter, config: SavedObjectConfig)
{
overwrite: schema.boolean({ defaultValue: false }),
createNewCopies: schema.boolean({ defaultValue: false }),
accountId: schema.string(),
userId: schema.string()
},
{
validate: (object) => {
Expand All @@ -64,7 +66,7 @@ export const registerImportRoute = (router: IRouter, config: SavedObjectConfig)
},
},
router.handleLegacyErrors(async (context, req, res) => {
const { overwrite, createNewCopies } = req.query;
const { overwrite, createNewCopies, accountId, userId } = req.query;
const file = req.body.file as FileStream;
const fileExtension = extname(file.hapi.filename).toLowerCase();
if (fileExtension !== '.ndjson') {
Expand All @@ -86,6 +88,8 @@ export const registerImportRoute = (router: IRouter, config: SavedObjectConfig)
readStream,
objectLimit: maxImportExportSize,
overwrite,
accountId,
userId,
createNewCopies,
});

Expand Down
4 changes: 4 additions & 0 deletions src/core/server/saved_objects/routes/resolve_import_errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ export const registerResolveImportErrorsRoute = (router: IRouter, config: SavedO
validate: {
query: schema.object({
createNewCopies: schema.boolean({ defaultValue: false }),
accountId: schema.string(),
userId: schema.string()
}),
body: schema.object({
file: schema.stream(),
Expand Down Expand Up @@ -94,6 +96,8 @@ export const registerResolveImportErrorsRoute = (router: IRouter, config: SavedO
retries: req.body.retries,
objectLimit: maxImportExportSize,
createNewCopies: req.query.createNewCopies,
accountId: req.query.accountId,
userId: req.query.userId,
});

return res.ok({ body: result });
Expand Down
5 changes: 5 additions & 0 deletions src/core/server/saved_objects/service/lib/repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,8 @@ export class SavedObjectsRepository {

const { refresh = DEFAULT_REFRESH_SETTING, force } = options;
const namespace = normalizeNamespace(options.namespace);
const accountId=options.accountId, userId=options.userId;


const rawId = this._serializer.generateRawId(namespace, type, id);
let preflightResult: SavedObjectsRawDoc | undefined;
Expand All @@ -610,9 +612,12 @@ export class SavedObjectsRepository {
const { body, statusCode } = await this.client.delete<DeleteDocumentResponse>(
{
id: rawId,

index: this.getIndexForType(type),
...getExpectedVersionProperties(undefined, preflightResult),
refresh,
accountId:accountId,
userId:userId
},
{ ignore: [404] }
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ export class SavedObjectsTable extends Component<SavedObjectsTableProps, SavedOb

if (isDeleting) {
// Block the user from interacting with the table while its contents are being deleted.
modal = <EuiLoadingElastic size="xl" />;
// modal = <EuiLoadingElastic size="xl" />;
} else {
const onCancel = () => {
this.setState({ isShowingDeleteConfirmModal: false });
Expand Down Expand Up @@ -631,7 +631,8 @@ export class SavedObjectsTable extends Component<SavedObjectsTableProps, SavedOb
);
}

return <EuiOverlayMask>{modal}</EuiOverlayMask>;
// return <EuiOverlayMask>{modal}</EuiOverlayMask>;
return modal ;
}

changeIncludeReferencesDeep = () => {
Expand Down

0 comments on commit 6dcb959

Please sign in to comment.