Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EZP-28841: Content On the Fly v2 #366

Merged
merged 1 commit into from
Mar 12, 2018
Merged

EZP-28841: Content On the Fly v2 #366

merged 1 commit into from
Mar 12, 2018

Conversation

dew326
Copy link
Member

@dew326 dew326 commented Mar 2, 2018

Question Answer
Tickets https://jira.ez.no/browse/EZP-28841
Requires ezsystems/ezplatform-admin-ui-modules#55
Bug fix? no
New feature? yes
BC breaks? no
Tests pass? yes
Doc needed? no
License GPL-2.0

Checklist:

@dew326 dew326 changed the title [WIP] EZP-28841: Content On the Fly v2 EZP-28841: Content On the Fly v2 Mar 7, 2018
@ezsystems ezsystems deleted a comment from ezrobot Mar 7, 2018
@ezsystems ezsystems deleted a comment from ezrobot Mar 7, 2018
@ezsystems ezsystems deleted a comment from ezrobot Mar 7, 2018
@ezsystems ezsystems deleted a comment from ezrobot Mar 7, 2018
@ezsystems ezsystems deleted a comment from ezrobot Mar 7, 2018
Copy link
Contributor

@ViniTou ViniTou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just some phpdocs nitpicks on my part

/** @var LocationService */
private $locationService;

private $contentActionDispatcher;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing phpdoc here and in constructor

* @param ContentType $contentType
* @param Location $parentLocation
*
* @return ContentCreateView
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ContentCreateView | Response
?

{
private $contentService;

private $twig;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

phpdocs


/**
* @var string
*/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/** @var string */

}

/**
* @return int
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

int|null according to typehint

@mnocon
Copy link
Member

mnocon commented Mar 7, 2018

@Nattfarinn have you seen the PHPUnit failure?

@Nattfarinn Nattfarinn force-pushed the coft branch 2 times, most recently from 47070f8 to 80c792e Compare March 7, 2018 16:36
@Nattfarinn
Copy link
Contributor

@ViniTou Fixed.
@mnocon Fixed.

@mnocon
Copy link
Member

mnocon commented Mar 8, 2018

Three things so far:

  1. we do not check if the user has content/publish permission, so it's possible to receive a 403 inside UDW
  2. it looks like there are infinite permission checking requests in the Network tab
  3. In RichText's embed image the language is restricted to the current one, but in ezimage field type it does not happen (all languages are available). Ezimage field type should also have restricted languages available.

@bdunogier
Copy link
Member

Is there anything as for developer documentation ? I'm mostly thinking about how you integrate COTF in your custom code and how you may customize the locations/content types that are liste.

From the code's perspective, I think that a ContentOnTheFlyController would help keep ContentController thinner.

@Nattfarinn
Copy link
Contributor

@mnocon

we do not check if the user has content/publish permission, so it's possible to receive a 403 inside UDW

Fixed.

@Nattfarinn
Copy link
Contributor

Nattfarinn commented Mar 8, 2018

@bdunogier

From the code's perspective, I think that a ContentOnTheFlyController would help keep ContentController thinner.

True. Now it has its own controller.

@dew326 Route names changed. I guess you have to update ezplatform-admin-ui-modules repository. It's WIP till fixed there.

-ezplatform.content.create.on_the_fly:
+ezplatform.content_on_the_fly.create:
-ezplatform.content.create.on_the_fly.has_access:
+ezplatform.content_on_the_fly.has_access:

@ezsystems ezsystems deleted a comment from ezrobot Mar 8, 2018
@Nattfarinn Nattfarinn changed the title EZP-28841: Content On the Fly v2 (WIP) EZP-28841: Content On the Fly v2 Mar 8, 2018
@ezsystems ezsystems deleted a comment from ezrobot Mar 8, 2018
@lserwatka
Copy link
Member

@dew326 could you address this change so we can unblock QA here?

@dew326
Copy link
Member Author

dew326 commented Mar 8, 2018

@mnocon done, please update branch in ezplatform-admin-ui-modules.

@lserwatka lserwatka changed the title (WIP) EZP-28841: Content On the Fly v2 EZP-28841: Content On the Fly v2 Mar 8, 2018
@mnocon
Copy link
Member

mnocon commented Mar 8, 2018

I cannot create anything now, the "Create content" button is disabled all the time. In Network tab, the request: http://v2eedemo.prod/admin/content/create/onthefly/article/eng-GB/43/hasaccess ends with 500 Internal Server Error 😞 :

Class "EzPlatformAdminUiBundle" does not exist. [in vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Controller/ControllerResolver.php:180]

@Nattfarinn
Copy link
Contributor

@mnocon Fixed

@lserwatka
Copy link
Member

@Nattfarinn we need a rebase here too.

* @return ContentCreateOnTheFlyView|Response
*
* @throws ApiException\NotFoundException
* @throws \eZ\Publish\Core\Base\Exceptions\InvalidArgumentType
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are using short class names instead of FQCN in doc block.

* @throws ApiException\NotFoundException
* @throws \eZ\Publish\Core\Base\Exceptions\InvalidArgumentType
*/
public function createContentAction(Request $request, string $languageCode, ContentType $contentType, Location $parentLocation)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Split into multiple lines.

expose: true

ezplatform.content_on_the_fly.has_access:
path: /content/create/onthefly/{contentTypeIdentifier}/{languageCode}/{locationId}/hasaccess
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Idon'tlikeseeingstufflikethis 😅Can we use path: /content/create/onthefly/{contentTypeIdentifier}/{languageCode}/{locationId}/has-access ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So... onthefly is fine, but hasaccess is not? :P

* @throws \Twig_Error_Runtime
* @throws \Twig_Error_Syntax
* @throws \eZ\Publish\API\Repository\Exceptions\BadStateException
* @throws \eZ\Publish\API\Repository\Exceptions\ContentFieldValidationException
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Short name instead of FQCN

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We agreed to keep FQCN

*/
public function processPublish(FormActionEvent $event)
{
/** @var \EzSystems\RepositoryForms\Data\Content\ContentCreateData|\EzSystems\RepositoryForms\Data\Content\ContentUpdateData $data */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Short name

use eZ\Publish\Core\MVC\Symfony\MVCEvents;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

class ViewTemplatesListener implements EventSubscriberInterface
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As we discussed you can set default templates on View object creation. That will make this listener no longer needed.

@Nattfarinn Nattfarinn force-pushed the coft branch 2 times, most recently from 40863eb to 5d16387 Compare March 12, 2018 11:17
@bdunogier
Copy link
Member

I've been through the code, and I'd like to know how flexible we are on the starting location / content type / language options. This includes existing inclusions of COTF, like Relation or RichText. For those, I'd like to keep the system flexible enough so that:

  • an integrator can hook into the business logic and adapt the choices to the customer
  • we can develop configurable mechanisms, such as "Create images in the Media/Images directory when creating content for the image field of the article type".

@dew326
Copy link
Member Author

dew326 commented Mar 12, 2018

@bdunogier Starting location and content type are not developed. The only configuration option is forced language, this is an option per usage in button config.

@bdunogier
Copy link
Member

bdunogier commented Mar 12, 2018

What about this ?

startingLocationId: window.eZ.adminUiConfig.universalDiscoveryWidget.startingLocationId

As far as I could see, the value comes from the Config Resolver.

My concern is that we limit our options in terms of BC. Without thinking it very far, ideally, there would be some kind of event, when COTF is loaded, that can be hooked into and lets you decide of those options. Our own subscriber would set it to the globally configured value for the first iteration. The two options I have described above would still be open for implementation / integration.

@lserwatka
Copy link
Member

@Nattfarinn rebase is needed

@Nattfarinn
Copy link
Contributor

@bdunogier I agree, but as far as I know, it was more like "Nice to have." instead of requirement. The scope of this was discussed on preplanning and planning, and turned out that we won't be able to deliver everything within one sprint. We can make improvements for next version I guess and I don't think refining a way how the values for a new UDW options/flags is picked will be a BC break.

@bdunogier
Copy link
Member

bdunogier commented Mar 12, 2018

To be honest, I'd like it to become a requirement. Do you think that a dedicated story, with detailed expectations, makes sense for this ?

As long as it can be done, I don't require it for that particular pull-request. On the other hand, having such an event from the start would also help us keep the doors open for any change we would have in mind.

The way I see it, the event would contain:

  • The "source" of the COTF request (content_edit, dashboard_block...)
  • Extra data related to each event:
    • The content type being edited
    • The content id for the current draft
    • The location it is edited for
    • ... (maybe this should be open)

That way, we can go as much in detail as we want, without requiring anything complex. Where would you see this happening ? I was thinking that one REST call, that would resolve the options, when clicking the COTF button, could work.

@lserwatka lserwatka merged commit cb56e99 into ezsystems:master Mar 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

7 participants