One utility panel is available in the aiWARE SDK:
Local machine importer panel
Local machine importer uploads files from your local machine to aiWARE. With local machine importer, you can upload up to 1000 files at a time.
Panel format
The local machine importer has 2 objects. They use this format:
const microFrontend = {
name: 'DATA_CENTER_IMPORTER',
config: {
fileLimit: 50
},
};
const panelConfig = {
type: 'APP_BAR_PANEL_TEMPLATE',
marginTop: 55,
marginStart: 80,
size: 'large',
zIndex: 1000,
dimmed: 0,
};
Properties
The Local machine importer panel has these properties:
microFrontend
| Name | Required | Type | Description |
|---|
| name | True | String | The name of the component. Must be 'DATA_CENTER_IMPORTER'. |
| config | True | Object (config) | The properties of the panel that handle or interact with data. |
config
| Name | Required | Type | Description |
|---|
| fileLimit | False | Number | The number of files a user can upload at once. Min is 1, max is 1000. Defaults to 100. |
| fileEditMetadata | False | Boolean | Can the user modify the metadata once uploaded. Default: true |
| panelTitle | False | String | The title of the panel. Default: Local Machine Importer |
| title | False | String | The title below the panel title. Default: Local Machine |
| titleSubText | False | String | The text right below the title. Default: Choose files from your computer to import into your account. |
| locationFolderTitle | False | String | The location folder title Default: Location Folder |
| locationFolderSubText | False | String | The location subtitle right below the location title. Default: Choose the Data Center folder location where this content will be stored. |
| locationFolderInputLabel | False | String | The input label for Folder. Default: Folder |
panelConfig
| Name | Required | Type | Description |
|---|
| type | True | String | The panel type. Must be 'APP_BAR_PANEL_TEMPLATE'. |
| marginTop | False | Number | The top margin of the panel. |
| marginStart | False | Number | The right margin of the panel. |
| size | False | String | The width of the panel in pixels. Can be small, medium, large, xlarge, or xxlarge. Each value is defined in getWidth(). |
| zIndex | False | Number | The z-index of the panel. |
| dimmed | False | Number | The number of panels that slide over this panel in the UI. The number affects how much this panel is dimmed. |
Events
Local machine importer has these events:
fileUpload
fileUpload runs when a file is uploaded.
aiware.on("fileUpload", function(error, data) {
});
fileUpload returns either a data object or an error object.
Response
data: {
expiresInSeconds: number,
file: file,
getUrl: string,
id: string,
key: string,
unsignedUrl: string,
url: string
}
The data object has these properties:
| Name | Type | Description |
|---|
| expiresInSeconds | number | The number of seconds until the file expires. |
| file | File | A File object. |
| getUrl | string | A signed URL that can be used with HTTP GET to retrieve the new resource. |
| id | string | The unique ID of the file. |
| key | string | The storage object key. |
| unsignedUrl | string | The unsigned, base URL to the object, which can be safely persisted and re-signed later by a client with the necessary storage credentials. |
| url | string | The signed URL, which you can upload to with HTTP PUT. HTTP POST won't work. |
fileUploadProgress
fileUploadProgress runs while a file is uploading.
aiware.on("fileUploadProgress", function(error, file) {
});
fileUploadProgress returns either a data object or an error object.
Response
data: {
fileId: number,
progress: number
}
The data object has these properties.
| Name | Type | Description |
|---|
| fileId | number | The ID of the file that's uploading. |
| progress | number | The percentage of the file that has been uploaded. |
tdoCreated
tdoCreated runs when the Import button is clicked.
aiware.on("tdoCreated", function(error, tdo) {
});
tdoCreated returns either a data object or an error object.
Response
data: {
fileId: number,
tdoId: number
}
The data object has these properties:
| Name | Type | Description |
|---|
| fileId | number | The ID of the file that's uploading. |
| tdoId | number | The ID of the TDO created for this file. |