Bulk Operations With Records

The basic tool to implement bulk operations BulkOperationStore is located in the unidata-platform-ui repository.

Main tasks of the store:

  • Get a list of operation descriptors (for user to select an operation)

  • Initiate the selected operation for configuration create a store for it. The store of a particular operation is a user exit by its identifier of the UEBulkOperationSettingsStore type.

  • Start the execution of the operation with the context obtained from the store.

An example of working with this store: the Operations component in the “Data” section - a drop-down list of actions when selecting multiple records (Figure 1).

UEBulkOperationSettingsStore type

import {UeModuleBase} from '../../userexit/type/UeModuleBase';
import {IBulkOperationSettings} from '../IBulkOperationSettings';
import {ClassCtor} from '@unidata/core';

export type UEBulkOperationSettingsStore = UeModuleBase & {
    'default': {
        fn: () => ClassCtor<IBulkOperationSettings>;
    };
}

Bulk Operation to Delete Records

The “Remove Records” button appears when you select necessary records in the search results table (Figure 1).

The DeleteRecordsStore is responsible for bulk operation of deleting records - the user exit of UEBulkOperationSettingsStore type (see above).

Drop-down list of actions when selecting several records and "Remove Records" button

Figure 1. Drop-down list of actions when selecting several records and “Remove Records” button

Implementation example:

import {Res, ResourceManager, Right, UEBulkOperationSettingsStore} from '@unidata/core-app';
import {DeleteRecordsStore} from './DeleteRecordsStore';
import {UEList} from '@unidata/types';

export const UEDeleteRecordBulkOpStore: UEBulkOperationSettingsStore = {
    'default': {
        type: UEList.BulkOperationSettingsStore,
        moduleId: 'com.unidata.mdm.bulk.remove.records[operation]',
        active: true,
        system: false,
        meta: {},
        resolver: () => {
            return ResourceManager.userHasRight(Res.DATA_OPERATIONS_MANAGEMENT, Right.DELETE);
        },
        fn: () => {
            return DeleteRecordsStore;
        }
    }
};