https://metaplay.io logo
Additional info on Generated UI components
# questions-and-feedback
d
Hi, I'm working on adding a simple leaderboard feature to Metaplay and would like a UI to view the entries of the leaderboard and remove entries. I have been exploring the generated ui components which seem really powerfull to autogenerate a UI based on a some c# model but I have some things i can't quite understand. 1. Do all c# classes get converted to a Typescript interface automatically? I see all classes in the /test/generatedUi page. 2. When rendering a list in the test page in the form I see it automatically generates the remove and AddNew buttons. What I don't understand is how I can hook into these events and generate a server side call to update the list on the server. I'm not a web dev so i've search the metaplay codebase for usage of the forms but still can't work it out. What I am thinking is: 1. create an Admin Controller which proxies calls to the leaderboard entity (list, add, remove, update) 2. load the data in the page via a useSubscription or just a one off request 3. bind the data to the generatedUI via the value field 4. handle the add/remove/update action that happen in the generated ui and update the server. Not sure how to do this part. Thanks Andre
j
Hey, All meta serializable types are able to be rendered using the generated ui forms, the test page indeed lists all types that we can theoretically render (some might be broken due to unsupported cases or bugs, some of these exist on purpose on the test page). Currently, most (all?) uses of generated forms get a blob of data from the server, make some changes, and upload it back. Rather than doing incremental changes, the places we do incremental changes, the UI is custom. If data you're sending back isn't that big, I'd suggest doing the same, i.e. just send the blob back and let the server handle the changes. If you have too much data for that, I'd imagine that generated ui is not a great solution either way, with large amounts of components it does not scale that well (and does not do pagination). I don't think we have many examples like that on our docs but you can take a look at
LeagueSeasonRankDivisionParticipantsCard.vue
which is probably the closest to what you want. It still fetches the data in one blob but has custom UI and actions to remove/add players