admin icon indicating copy to clipboard operation
admin copied to clipboard

Publish hydra client as a standalone package

Open fzaninotto opened this issue 7 years ago • 9 comments

Hi guys, great package!

Do you think it makes sense to publish the hydraClient as a standalone npm package, and mention it in https://marmelab.com/admin-on-rest/RestClients.html?

fzaninotto avatar Mar 31 '17 17:03 fzaninotto

Hi @fzaninotto,

There just a few files in this repository and the Hydra client has been designed to be usable without other features. Components provided by this package can also be used one by one with an existing admin on rest installation. Is it worth it to split this package in 2?

Regarding the doc, I'll send a PR!

dunglas avatar May 17 '17 07:05 dunglas

It's up to you!

fzaninotto avatar May 17 '17 09:05 fzaninotto

Are there any example docs to use the hydra client standalone? I want more control over all the layouts and would prefer to use react-admin + the hydraClient. I don't like all the magic that the api platform admin performs.

trsteel88 avatar Nov 05 '18 05:11 trsteel88

This is now documented @trsteel88: https://api-platform.com/docs/admin/getting-started#using-the-hydra-data-provider-directly-with-react-admin

dunglas avatar Nov 05 '18 08:11 dunglas

Thanks. I saw this about an hour ago and thought I was losing my mind and missed it today.

trsteel88 avatar Nov 05 '18 10:11 trsteel88

Within my app I have a password reset endpoint. Is there any documentation for how I would load that in as a custom route?

Sorry for all the questions. This is a great library and you've done a great job. I'd be happy to contribute to the docs once I have a better understanding.

trsteel88 avatar Nov 05 '18 10:11 trsteel88

Hey @dunglas, are you able to help me with an issue I'm having with a ReferenceArrayInput?

When creating the form manually, I get the following error:

Uncaught TypeError: Cannot read property 'data' of undefined
    at possibleValues.js:68
    at Array.map (<anonymous>)
    at getPossibleReferences (possibleValues.js:67)
    at ReferenceArrayInputController.js:349
    at index.js:76
    at index.js:37
    at index.js:89
    at Function.mapToProps (index.js:37)
    at mapToPropsProxy (wrapMapToProps.js:41)
    at handleNewState (selectorFactory.js:55)
    at handleSubsequentCalls (selectorFactory.js:69)
    at pureFinalPropsSelector (selectorFactory.js:74)
    at Object.runComponentSelector [as run] (connectAdvanced.js:72)
    at Connect.onStateChange (connectAdvanced.js:239)
    at Object.notify (Subscription.js:29)
    at Subscription.notifyNestedSubs (Subscription.js:66)
    at Connect.onStateChange (connectAdvanced.js:242)
    at Object.notify (Subscription.js:29)
    at Subscription.notifyNestedSubs (Subscription.js:66)
    at Connect.onStateChange (connectAdvanced.js:242)
    at Object.notify (Subscription.js:29)
    at Subscription.notifyNestedSubs (Subscription.js:66)
    at Connect.onStateChange (connectAdvanced.js:242)
    at Object.notify (Subscription.js:29)
    at Subscription.notifyNestedSubs (Subscription.js:66)
    at Connect.notifyNestedSubsOnComponentDidUpdate (connectAdvanced.js:256)
    at commitLifeCycles (react-dom.development.js:16725)
    at commitAllLifeCycles (react-dom.development.js:18146)
    at HTMLUnknownElement.callCallback (react-dom.development.js:147)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:196)
    at invokeGuardedCallback (react-dom.development.js:250)
    at commitRoot (react-dom.development.js:18351)
    at completeRoot (react-dom.development.js:19882)
    at performWorkOnRoot (react-dom.development.js:19805)
    at performWork (react-dom.development.js:19710)
    at performSyncWork (react-dom.development.js:19684)
    at requestWork (react-dom.development.js:19539)
    at scheduleWork (react-dom.development.js:19346)
    at Object.enqueueSetState (react-dom.development.js:12789)
    at Connect.push../node_modules/react/cjs/react.development.js.Component.setState (react.development.js:354)
    at Connect.onStateChange (connectAdvanced.js:245)
    at Object.notify (Subscription.js:29)
    at Subscription.notifyNestedSubs (Subscription.js:66)
    at Connect.onStateChange (connectAdvanced.js:242)
    at Object.notify (Subscription.js:29)
    at Subscription.notifyNestedSubs (Subscription.js:66)
    at Connect.onStateChange (connectAdvanced.js:242)
    at Object.notify (Subscription.js:29)
    at Subscription.notifyNestedSubs (Subscription.js:66)
    at Connect.onStateChange (connectAdvanced.js:242)

Here is my Edit form:

export const TemplateEdit = (props) => {
    return (
        <Edit {...props} title={<TemplateTitle/>}>
            <TabbedForm>

                ...

                <FormTab label="Summary">
                    <TextInput source="name" label="Name" validate={required()}/>

                    <ReferenceArrayInput source="shotTypes" reference="shot-types">
                        <SelectArrayInput optionText="name"/>
                    </ReferenceArrayInput>
                </FormTab>

                ...

            </TabbedForm>
        </Edit>
    );
};

Am I missing something?

ShotTypes is a ManyToMany.

Thank you.

trsteel88 avatar Nov 08 '18 07:11 trsteel88

Any documentation on this?

nckenn avatar Dec 25 '20 17:12 nckenn

@alanpoulain any documentation on this?

nckenn avatar Apr 20 '21 14:04 nckenn