laminas-api-tools / api-tools-admin

Laminas API Tools Admin module
https://api-tools.getlaminas.org/documentation
BSD 3-Clause "New" or "Revised" License
13 stars 21 forks source link

TypeError: Cannot read property 'table_name' of undefined #29

Open weierophinney opened 4 years ago

weierophinney commented 4 years ago

I am creating REST API using Database Connected and Select table from given DB Adapter. When I click on button. It will throws following JS Error.

table_name property is not found in javascript so, My Service is not generated based on selected Table.

TypeError: Cannot read property 'table_name' of undefined
    at a.e.ok (c22d22af.apigility.js:1)
    at 6a8334db.vendor.js:6
    at c.on.e (6a8334db.vendor.js:6)
    at k.$eval (6a8334db.vendor.js:5)
    at k.$apply (6a8334db.vendor.js:5)
    at HTMLButtonElement.<anonymous> (6a8334db.vendor.js:6)
    at HTMLButtonElement._.event.dispatch (6a8334db.vendor.js:2)
    at HTMLButtonElement.q.handle (6a8334db.vendor.js:2)(anonymous function) @ 6a8334db.vendor.js:5(anonymous function) @ 6a8334db.vendor.js:4k.$apply @ 6a8334db.vendor.js:5(anonymous function) @ 6a8334db.vendor.js:6_.event.dispatch @ 6a8334db.vendor.js:2q.handle @ 6a8334db.vendor.js:2

Originally posted by @AshwinParmar at https://github.com/zfcampus/zf-apigility-admin/issues/313

weierophinney commented 4 years ago

I have tried to resolve this issue, And, I found issue is here: e.rest.table_name is return undefined not getting actual selected table name in this variable. So, I have tried to use e.dbServices[0].table_name

//console.info(e.dbServices[0].table_name);
                if (e.dbServices[0].table_name && (e.dbServices = [{
                                table_name : e.dbServices[0].table_name, //e.rest.table_name,
                                columns : []
                            }
                        ]), 0 == e.dbServices.length)

After doing above changes in vendor\zfcampus\zf-apigility-admin-ui\dist\apigility-ui\c22d22af.apigility.js file Rest service Collection and Entity file are generated.

But, get new error fields not generated. Error: savings field.

PUT http://localhost:8888/apigility/api/module/MyDbAPI/rest/MyDbAPI-V1-Rest-User_login-Controller/input-filter 404 (Not Found)


Originally posted by @AshwinParmar at https://github.com/zfcampus/zf-apigility-admin/issues/313#issuecomment-131143003

weierophinney commented 4 years ago

I think this is a duplicate to https://github.com/zfcampus/zf-apigility-admin-ui/issues/74


Originally posted by @anli-xsigns at https://github.com/zfcampus/zf-apigility-admin/issues/313#issuecomment-142413283

weierophinney commented 4 years ago

I can confirm this is STILL and issue and has broken Apigility Admin UI for creating DB-Connected REST services at this time. Completely fresh installs using:

git clone https://github.com/zfcampus/zf-apigility-skeleton.git

or

curl -s https://getcomposer.org/installer | php --

or

download zip/tar from https://github.com/zfcampus/zf-apigility-skeleton/releases

followed by (command) if needed

composer install

ALL of the above yield:

TypeError: Cannot read property 'table_name' of undefined
at a.e.ok (http://localhost/myapp/public/apigility-ui/c22d22af.apigility.js:1:6663)
*snip*

in javascript console. This is installing per instructions in zf-apigility-skeleton and/or installing the skeleton instead.


Originally posted by @PipStyles at https://github.com/zfcampus/zf-apigility-admin/issues/313#issuecomment-145015850