-
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 #1462 from finos/array-datasource-fix
Array datasource fix
- Loading branch information
Showing
12 changed files
with
156 additions
and
31 deletions.
There are no files selected for viewing
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
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,61 @@ | ||
import { uuid } from "@finos/vuu-utils"; | ||
import { VuuTable } from "@finos/vuu-protocol-types"; | ||
import { | ||
RpcService, | ||
RpcServiceRequest, | ||
VuuModule, | ||
VuuModuleConstructorProps, | ||
withParams, | ||
} from "../VuuModule"; | ||
import { SimulTableName } from "./simul-schemas"; | ||
|
||
/** | ||
* This is an example of how we might extend the built-in VuuModule to | ||
* implement a module-specific service in such a way that it can invoke | ||
* methods on the VuuModule. | ||
*/ | ||
export class SimulModule extends VuuModule<SimulTableName> { | ||
constructor(props: VuuModuleConstructorProps) { | ||
super(props); | ||
} | ||
|
||
getServices(tableName: SimulTableName) { | ||
return this.#services.concat(super.getServices(tableName)); | ||
} | ||
|
||
private openEditSession = async (rpcRequest: RpcServiceRequest) => { | ||
if (withParams(rpcRequest)) { | ||
const { namedParams, selectedRowIds } = rpcRequest; | ||
if (selectedRowIds && namedParams.table) { | ||
const table = namedParams.table as VuuTable; | ||
const dataTable = this.tables[table.table as SimulTableName]; | ||
|
||
const sessionTable = this.createSessionTableFromSelectedRows( | ||
dataTable, | ||
selectedRowIds | ||
); | ||
|
||
const sessionTableName = `${table.table}-${uuid()}`; | ||
this.sessionTableMap[sessionTableName] = sessionTable; | ||
|
||
return { | ||
table: { | ||
module: "SIMUL", | ||
table: sessionTableName, | ||
}, | ||
tableSchema: dataTable.schema, | ||
type: "VIEW_PORT_RPC_REPONSE", | ||
requestId: "request_id", | ||
rpcName: "openEditSession", | ||
}; | ||
} | ||
} | ||
}; | ||
|
||
#services: RpcService[] = [ | ||
{ | ||
rpcName: "openEditSession", | ||
service: this.openEditSession, | ||
}, | ||
]; | ||
} |
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
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
Oops, something went wrong.