Adds a secondary form to project:create for template, catalog, and initialize options#831
Adds a secondary form to project:create for template, catalog, and initialize options#831shawnawsu wants to merge 17 commits intoplatformsh:developmentfrom
Conversation
…l requested change
|
If I'm reading this properly, the If so, then IMO it should be split. Have a |
We're skipping the "catalog definition" step, that's provided by Accounts based on any of your vendor/organization[NYI]/user-level catalog files, or falling back to the default if none of those are found. The Console is going to support a |
…essaging around an empty catalog
…d and automatically initializing projects that allow for it
| $regions[$region->id] = $region->label; | ||
| // First look to the setup/options API for a region list. | ||
| $account = $this->api()->getMyAccount(true); | ||
| $setupOptions = $this->api()->getClient()->getSetupOptions(NULL, NULL, NULL, $account['username'], NULL); |
There was a problem hiding this comment.
Wasn't the setup options API supposed to fall back to all the available regions automatically, thus making the subsequent $this->api()->getClient()->getRegions() unnecessary?
| } | ||
|
|
||
| if (empty($catalog)) { | ||
| // Should we throw an error here? Do we want to kill the process? |
There was a problem hiding this comment.
What happens if the getTemplateFields() receives an empty catalog array? If nothing significant -- I'd remove this condition. If something unexpected -- I'd throw an Exception and bail out.
I don't have a clue what am I writing about, right here, so please be free to ignore me if I make no sense at all.
There was a problem hiding this comment.
If $catalog comes back as empty it will cause a logic exception since it's an asChoice field. So, do we want it to fail and skip to the next step and just now allow a template choice or stop the process? I'm not sure what the preference is.
There was a problem hiding this comment.
Hm, I'd personally fail it. What do you think @pjcdawkins?
There was a problem hiding this comment.
I'd return [] here, and let Symfony throw the LogicException
| if ($runtime) { | ||
| $catalog = []; | ||
| $catalog_items = $this->api()->getClient()->getCatalog()->getData(); | ||
| if (!empty($catalog_items)) { |
There was a problem hiding this comment.
the if isn't needed - if it's always an array, the foreach won't mind if it's empty
A new form will be built and served if the
--templateflag is passed. The fields aretemplate_urlwhich allows for the passing of a url,catalog_urlwhich will list all options from the catalog, andinitializewhich will initialize the project after creation if selected.