DataLoaderPlugin
This interface defines the methods of a data loader:
interface DataLoaderPlugin {
static isMatch(context: FileContext): boolean;
canSave?: boolean;
init?(context: FileContext): void;
readFiles?(): void;
getResult(): Dataset;
optionsView?(): string;
entitiesView?(): string;
}
Example
See the data loader plugin page for an example.
API
isMatch(context:
FileContext
): boolean
isMatch(context:
This method implements logic for deciding whether this data loader matches the uploaded file(s) or not.
Parameters
context: FileContext
an object implementing theFileContext
interface.
Returns
True if the data loader should be used.
canSave: boolean
canSave: boolean
Set this to control whether the "Upload" or "OK" button should be enabled. If not set at all, the buttons are always enabled.
init(context:
FileContext
): void
init(context:
This method is used for initialization of the plugin in the given context.
Parameters
context: FileContext
an object implementing theFileContext
interface.
readFiles(): void
readFiles(): void
This method is called initially, but after init()
. Use this e.g. for reading the files, to update the options view.
getResult():
Dataset
getResult():
This method returns the final dataset for upload.
Returns
Final dataset.
optionsView(): string
optionsView(): string
Returns
An HTML view for the options of a data loader.
entitiesView(): string
entitiesView(): string
Returns
An HTML view for the resulting entities.