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
Section titled “Example”See the data loader plugin page for an example.
isMatch(context: FileContext): boolean
Section titled “isMatch(context: FileContext): boolean”This method implements logic for deciding whether this data loader matches the uploaded file(s) or not.
Parameters
context: FileContextan object implementing theFileContextinterface.
Returns
True if the data loader should be used.
canSave: boolean
Section titled “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
Section titled “init(context: FileContext): void”This method is used for initialization of the plugin in the given context.
Parameters
context: FileContextan object implementing theFileContextinterface.
readFiles(): void
Section titled “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
Section titled “getResult(): Dataset”This method returns the final dataset for upload.
Returns
Final dataset.
optionsView(): string
Section titled “optionsView(): string”Returns
An HTML view for the options of a data loader.
entitiesView(): string
Section titled “entitiesView(): string”Returns
An HTML view for the resulting entities.