-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1463 from finos/shell-layout-left-tabs
refactor feature and datasource provider useFullHeightLeftPanel
- Loading branch information
Showing
42 changed files
with
709 additions
and
457 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
vuu-ui/packages/vuu-data-react/src/datasource-provider/VuuDataSourceProvider.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { VuuDataSource, getServerAPI } from "@finos/vuu-data-remote"; | ||
import { DataSourceProvider } from "@finos/vuu-utils"; | ||
import { ReactNode } from "react"; | ||
|
||
export const VuuDataSourceProvider = ({ | ||
children, | ||
}: { | ||
children: ReactNode; | ||
}) => ( | ||
<DataSourceProvider | ||
VuuDataSource={VuuDataSource} | ||
getServerAPI={getServerAPI} | ||
isLocalData={false} | ||
> | ||
{children} | ||
</DataSourceProvider> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
export { | ||
type BasketsTableName, | ||
schemas as basketSchemas, | ||
isBasketTable, | ||
} from "./basket-schemas"; | ||
export * from "./basket-module"; |
67 changes: 67 additions & 0 deletions
67
vuu-ui/packages/vuu-data-test/src/local-datasource-provider/LocalDatasourceProvider.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import type { | ||
DataSourceConstructorProps, | ||
TableSchema, | ||
} from "@finos/vuu-data-types"; | ||
import type { VuuTable, VuuTableList } from "@finos/vuu-protocol-types"; | ||
import { basketModule, basketSchemas, isBasketTable } from "../basket"; | ||
import { isSimulTable, simulModule, simulSchemas } from "../simul"; | ||
import { ReactNode } from "react"; | ||
import { DataSourceProvider } from "@finos/vuu-utils"; | ||
|
||
interface ServerAPI { | ||
getTableList: () => Promise<VuuTableList>; | ||
getTableSchema: (table: VuuTable) => Promise<TableSchema>; | ||
} | ||
|
||
const serverAPI: ServerAPI = { | ||
getTableList: async () => { | ||
return { | ||
tables: Object.values(simulSchemas) | ||
.concat(Object.values(basketSchemas)) | ||
.map((schema) => schema.table), | ||
}; | ||
}, | ||
getTableSchema: async (vuuTable: VuuTable) => { | ||
if (isSimulTable(vuuTable)) { | ||
return simulSchemas[vuuTable.table]; | ||
} else if (isBasketTable(vuuTable)) { | ||
return basketSchemas[vuuTable.table]; | ||
} else { | ||
throw Error( | ||
`unsupported module/table ${vuuTable.module}/${vuuTable.table}`, | ||
); | ||
} | ||
}, | ||
}; | ||
|
||
const getServerAPI = async () => serverAPI; | ||
|
||
class VuuDataSource { | ||
constructor({ table }: DataSourceConstructorProps) { | ||
if (isSimulTable(table)) { | ||
return simulModule.createDataSource(table.table); | ||
} else if (isBasketTable(table)) { | ||
return basketModule.createDataSource(table.table); | ||
} else { | ||
throw Error(`unsupported module/table ${table.module}/${table.table}`); | ||
} | ||
} | ||
} | ||
|
||
export const LocalDataSourceProvider = ({ | ||
children, | ||
modules, | ||
}: { | ||
children: ReactNode; | ||
modules: string[]; | ||
}) => { | ||
return ( | ||
<DataSourceProvider | ||
VuuDataSource={VuuDataSource as any} | ||
vuuModuleNames={modules} | ||
getServerAPI={getServerAPI} | ||
> | ||
{children} | ||
</DataSourceProvider> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,6 @@ | ||
export { type SimulTableName, schemas as simulSchemas } from "./simul-schemas"; | ||
export { | ||
type SimulTableName, | ||
isSimulTable, | ||
schemas as simulSchemas, | ||
} from "./simul-schemas"; | ||
export * from "./simul-module"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 0 additions & 47 deletions
47
vuu-ui/packages/vuu-shell/src/datasource-provider/DataSourceProvider.tsx
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.