Closed ssured closed 7 years ago
Ok, works now, I got the controller wrong. The schema object should contain keys ['schema', 'options', ...]
// controllers/index.js
import Ember from 'ember';
export default Ember.Controller.extend({
formOptions: {
schema: {
"title":"User Feedback",
"description":"What do you think about Alpaca?",
"type":"object",
"properties": {
"name": {
"type":"string",
"title":"Name"
},
"feedback": {
"type":"string",
"title":"Feedback"
},
"ranking": {
"type":"string",
"title":"Ranking",
"enum":['excellent','ok','so so']
}
}
}
},
});
// templates/index.hbs
INDEX
{{dynamic-form schema=formOptions}}
What is the reasoning for using the schema
attribute name on the dynamic-form
component? I misunderstood it's usage...
Hi @ssured, sorry for the confusion. ember-cli-dynamic-forms was originally constructed as a wrapper to alpacajs, which in its form implementation provides an additional options object to provide annotations onto the json-schema, such as label values, event handling, field length, etc.
see http://www.alpacajs.org/tutorial.html for a basic example.
Given some good use cases for it we could split these into 2 attributes. My assumption thus far is that these objects stay together.
Thanks for the info, to me it seemed there's more passed in the schema argument than just a schema. I was thinking about a more generic name, like config
. I should have read the documentation in more detail.
What is still open is that the plugin doesn't install comfortably in cli 2.8 + ember 2.8, which is what this issue was originally about.
Thanks for reporting. I'll look into it. The alpaca plugin has a hard jquery dependency which has caused issue in the past, but I've been able to specify a resolution for it. Maybe something changed recently. I'll have a look.
@ssured see if version 0.2.3 gets you a full install. There was a left-pad type issue with one of alpaca's dependencies, causing the bower install process to fail.
@toddjordan thanks for your input so far, I'm experiencing the exact same issue with version 0.2.3 and ember-cli 2.8.0. Any suggestions for debugging I could perform? In addition, apparently Alpaca requires jQuery >2.1.0 in it's bower.json specification. Why is the jQuery 1.11.3 requirement still an issue for ember-cli-dynamic-forms?
Hi @hcderaad I will check on it today, and let you know what I find. maybe/hopefully we can axe that dependency 👍
yeah, there seems to be a problem again with dependencies :-( I'm working on it today and will let you know when there's a new release to try.
Quick update:
Looked at this a little yesterday.
There seems to be an issue with the latest ember cli where a dependency conflict prevents the default blueprint from running.
jquery is still an issue (the combination of bower packages we use (alpaca, bootstrap, etc) use conflicting versions. I'm going to try out some things today to see if I can find a workaround.
@hcderaad I'm at a slight impass here. This is what I've discovered
There's a guaranteed jquery conflict in newer versions of ember with newer versions of alpaca. This is causing the default blueprint to halt execution and require the user to enter a preferred jquery version. The problem is that once the user selects a version, the default blueprint does not finish running, and thus no bower dependencies are added to your project. The workaround for now is manually add the necessary packages to bower which is what the default blueprint should do). You'll want your bower.json to look something like this.
{
"name": "my-proj",
"dependencies": {
"ember": "~2.8.0",
"ember-cli-shims": "0.1.1",
"jquery": "~3.1.1",
"bootstrap": "3.3.2",
"lodash": "~4.6.1",
"alpaca": "1.5.22"
},
"resolutions": {
"jquery": "~3.1.1",
"tinycolor": "1.3.0",
"bootstrap": "3.3.2"
}
}
ember and ember-cli-shims are on every ember project. The rest of the above packages are required to run ember-cli-dynamic forms.
Its the need for the resolutions section is what's choking the ember install atm. I'm going to pursue a solution with the ember-cli team.
Thanks, and sorry about the inconvenience.
@toddjordan Thanks for following this up, if there is anything to test/debug please let me know!
@toddjordan Would perhaps this pull request provide some insight into the issue? https://github.com/ember-cli/ember-cli/pull/6319
@toddjordan sorry to bother you again, but has there been any update on this? As this issue is preventing me to use ember-cli-dynamic-forms at all, using alpacajs with a native bower install seems to work well enough. The workaround of manually setting the required bower.json resolutions does not result in a working installation. The installation breaks when choosing the appropriate jquery version in the ember-cli-dynamic-forms installation and this results in a corrupted broccoli build attempt. Any other avenues to pursue here perhaps? Thanks for your efforts!
@hcderaad It doesn't seem like 6319 is the same thing. that is addAddonToPackage. This one is bower and only happens when there is some version conflict.
I'm really sorry for your struggles here. I'm surprised you can't get working by installing the required bower libraries. When I do it myself with a new project things seem to work. I'll record the steps I use... maybe that would help.
ember new test-proj
cd test-proj
ember install ember-cli-dynamic-forms
now pick jquery >= 2.1.0 then go to bower.json and set the following (sorry I put the wrong resolutions when I posted this earlier)
{
"name": "my-proj",
"dependencies": {
"ember": "~2.8.0",
"ember-cli-shims": "0.1.1",
"jquery": "~3.1.1",
"bootstrap": "3.3.2",
"lodash": "~4.6.1",
"alpaca": "1.5.22"
},
"resolutions": {
"jquery": "~3.1.1",
"tinycolor": "1.3.0",
"bootstrap": "3.3.2"
}
}
then bower install
Things should work from there I think. (if not you may have to nombom: npm cache clear && bower cache clean && rm -rf node_modules bower_components && npm install && bower install
)
As far as the issue goes I'm at a sort of impasse. I've gotten no response on the issue I created with ember-cli. The only 2 options I see are as follows: 1) remove the alpaca dependency 2) fork alpaca and give it more flexible versioning
1 has started and its the most work, but its where I'd like to see the project go long term, I have just been consumed with other things and haven't given it proper time. 2 seems simpler as a short term fix, but I'm unsure what impact it will have on runtime execution until I try it out.
in thinking about it a little more, it might work to specify the bower resolutions before installing the addon (maybe with >='s). I might try that later. Again, that's just another workaround until we get something fixed.
Installing manually works up to a certain extent, but I'm afraid the Alpaca dependency on older versions of (this time) bootstrap is creating other conflict issues (e.g. not being able to run ember-bootstrap). I'm afraid I don't see many options left but to look for another form generator. Which is a pity, as I really liked working with alpacajs in the past, especially because of the json schema driven form creation (combined with server side json schema driven validation a breeze).... Anyway, many thanks for your efforts! If you have any other ideas, please do let me know, I'd be very happy to test them!
ok, really sorry. I'll be looking at it some in the coming weeks. If I get a response/help from the ember-cli team or come up with a solution on this side for the versioning issues, I will update this issue and cc you.
Thanks for the feedback and I appreciate you trying it out.
Small update... working with ember-cli team to get a fix for this in the coming week or so.
Any update we have stuck on the same issue as well.
@kprasad73 I've created a PR to ember-cli here: https://github.com/ember-cli/console-ui/pull/7 see the issue for history: https://github.com/ember-cli/ember-cli/issues/6334
It got push back a couple of months (sorry), as I got wrapped up in other stuff. I will hopefully show up with an upcoming release of ember-cli. Until then and for past (current) versions of cli, there is a workaround (see my comment on Oct 20). Essentially its manually adding the bower packages to bower.json and running bower install.
Thanks @toddjordan, followed the steps outlined in your comments. However i am now getting Uncaught Error: Could not find module ember
imported from .....
Googling to find a solution to the above error. Any pointers will help
@kprasad73 What version of npm are you using, and what version of ember-cli?
npm version 3.10.8 ember-cli version 2.7.0 node version 6.9.1 OS is win32 x64
Appreciate all the help.
Good news. Fix got merged into console-ui@1.0.3 (a dependency of ember-cli) upcoming ember-cli should have the fix.
Fix coming in ember cli 2.11. trying out the beta...
Verified fixed on 2.11 beta 1. For 2.10 and below, will need to use the workaround above.
Just a side note: You will get prompted for conflicts, since alpaca and ember use different versions of dependencies, and alpaca seems to like to pin versions :-( Just take the last option of each list when prompted and things should work out.
lol, one last thing to mention (maybe)... you'll need the latest version of this addon (0.4.0) to work with 2.11, because of some removed apis
I have a hard time starting a clean ember app just to test the library. Ember CLI 2.8 and Ember 2.8beta1
ember new dynform
ember install ember-cli-dynamic-forms
Installation fails, it seems the script stops after specifying Jquery 1.13. Doing a manual
bower install --save jquery alpaca handlebars bootstrap lodash
seems to get me goingember g route index
ember g controller index
The above code fails with an error from Alpaca:
{"message":"A view was not specified and could not be automatically determined."}
I'd love to work with this plugin, but for now I'm stuck...