* Load a datasheet in the database. * * **NOTE**: A data storage provider and a store provider must be set before loading datasheets.
(dstId: string, options: IDatasheetOptions)
| 58 | * **NOTE**: A data storage provider and a store provider must be set before loading datasheets. |
| 59 | */ |
| 60 | async getDatasheet(dstId: string, options: IDatasheetOptions): Promise<Datasheet | null> { |
| 61 | const { loadOptions } = options; |
| 62 | const datasheetPack = await this.storageProvider.loadDatasheetPack(dstId, loadOptions); |
| 63 | if (datasheetPack === null) { |
| 64 | return null; |
| 65 | } |
| 66 | const store = |
| 67 | 'createStore' in options |
| 68 | ? await options.createStore(datasheetPack) |
| 69 | : await this.storeProvider.createDatasheetStore(datasheetPack, options.storeOptions); |
| 70 | const datasheet = new Datasheet(dstId, { |
| 71 | store, |
| 72 | saver: this.storageProvider, |
| 73 | commandManager: this.getCommandManager(store), |
| 74 | }); |
| 75 | return datasheet; |
| 76 | } |
| 77 | |
| 78 | async getDashboard(dsbId: string, options: IDashboardOptions): Promise<Dashboard | null> { |
| 79 | const { loadOptions } = options; |
no test coverage detected