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

Ability to configure Segmentation #7973

Merged
merged 119 commits into from
May 5, 2020

Conversation

nielslyngsoe
Copy link
Member

@nielslyngsoe nielslyngsoe commented Apr 17, 2020

This PR is for merging the Segments UI into our Dev branch.

Description:

This PR makes Segments available.
When enabled, UI will appear for properties, making it possible to determine whether a property will vary by segments.
The creation of segments is as well done by code.

To enable UI for enabling segmentation for a DocumentType, the server-variable "showAllowSegmentationForDocumentTypes" can be set to true.

But the UI still contains no way to create Segments, to do so read the description about test endpoints.

UI Updates
When segmentation is enabled for a DocumentType, the option to allow a property to vary by segments because available in the DocType Editor:
image

In DocumentType Editor, properties now have a label for Culture varying and Segmentation:
image

Variant selector is updated to show segment variants. If both culture and segment variants are present the segment-variants are placed as children of the culture variants.
image

Save, Publish, Unpublish etc. Dialogs have been updated to only show relevant choices:
image

Test endpoints:
For testing purpose segmentation can be enabled by end-points:

In web.config you should make sure you have the following <add key="Umbraco.TestData.Enabled" value="true"/> in the appSettings.

And you need to check that you have the Umbraco.TestData.dll
Otherwise, you can copy it from src\Umbraco.TestData\bin\Debug

To enable segments for a DocumentType call this endpoint:
http://localhost:8600/umbraco/surface/SegmentTest/EnableDocTypeSegments?alias=umbTestDataContent&propertyTypeAlias=desc

Creation of Segments can be done through this endpoint:
http://localhost:8600/umbraco/surface/SegmentTest/AddSegmentData?contentId=41366&propertyAlias=desc&value=hello%20world&segment=Test1

Test notes:
We need to test almost everything that deals with Variants.
Client-code for variants have been refactored to support an additional property to determine which variant to deal with.

This means that all editor parts dealing with variant content should be tested.

Known parts:
Content Editor
— Property Editors
— Variant Selector
— Save, publish, ... action dialogs

Content Apps

PerplexDaniel and others added 30 commits October 11, 2019 14:18
(cherry picked from commit 43679c0b8a591ee9459b397ceb4ef0f9abcbc604)
(cherry picked from commit a97f8254f550b453ebd1cab91837da4f60f9aff6)
…feature/backoffice-segment-support-client

# Conflicts:
#	src/Umbraco.Web.UI.Client/src/views/content/overlays/publish.html
…t-support-client' into v8/feature/AB4550-segments-ui

# Conflicts:
#	src/Umbraco.Web.UI.Client/src/common/directives/components/editor/umbeditorcontentheader.directive.js
#	src/Umbraco.Web.UI.Client/src/views/components/editor/umb-editor-content-header.html
nielslyngsoe and others added 6 commits May 1, 2020 12:50
…long as a error is present. Plus avoid displaying field-errors, we only want to use property errors for this indication.
…ndication-in-variant-picker

UI: Corrected validation indication in variant-picker
@nielslyngsoe nielslyngsoe marked this pull request as ready for review May 5, 2020 13:52
@warrenbuckley
Copy link
Contributor

Peer reviewed on a very long call with @nielslyngsoe

@nielslyngsoe nielslyngsoe removed the request for review from Shazwazza May 5, 2020 13:52
@warrenbuckley warrenbuckley merged commit 0f4681f into v8/dev May 5, 2020
@nul800sebastiaan nul800sebastiaan changed the title Segment feature Ability to configure Segments Jun 24, 2020
@nul800sebastiaan nul800sebastiaan changed the title Ability to configure Segments Ability to configure Segmentaton Jun 24, 2020
@nul800sebastiaan nul800sebastiaan changed the title Ability to configure Segmentaton Ability to configure Segmentation Jun 24, 2020
@ronaldbarendse
Copy link
Contributor

@nielslyngsoe Just a note on naming: aren't culture variants also part of the segmentation? So instead of 'Allow segmentation', it's actually more accurate (and consistent) to name this checkbox 'Allow vary by segment'?

<key alias="variantsHeading">Allow variations</key>
<key alias="cultureVariantHeading">Allow vary by culture</key>
<key alias="segmentVariantHeading">Allow segmentation</key>
<key alias="cultureVariantLabel">Vary by culture</key>
<key alias="segmentVariantLabel">Vary by segments</key>
<key alias="variantsDescription">Allow editors to create content of this type in different languages.</key>
<key alias="cultureVariantDescription">Allow editors to create content of different languages.</key>
<key alias="segmentVariantDescription">Allow editors to create segments of this content.</key>
<key alias="allowVaryByCulture">Allow varying by culture</key>
<key alias="allowVaryBySegment">Allow segmentation</key>

@Zweben
Copy link
Contributor

Zweben commented Aug 13, 2020

Question for those involved with the segmentation feature: once this PR makes its way into a release, would you consider the underlying segmentation feature safe to use in production? I have a project that is ideally suited for segments (content localization), so I'm considering setting up a simple project-specific UI to enable their use, backed by code based off of SegmentTestController.cs. It would sure be a lot cleaner than the alternative I would have to use.

@nielslyngsoe
Copy link
Member Author

@Zweben there are parts of the content workflow that aren't fully working with segments. Meaning that if you want to use the Umbraco UI for publishing your segments etc. you will be experiencing weirdness.

@Chris-N1
Copy link

Chris-N1 commented Sep 2, 2020

Just a note based on my experience trying to get this to work as this seems to be missing from the PR above - you need the following 2 settings in web.config in appSettings section for this to work:

<add key="Umbraco.TestData.Enabled" value ="true" />
<add key="showAllowSegmentationForDocumentTypes" value="true" />

@ronaldbarendse
Copy link
Contributor

@Chris-N1 The Umbraco.TestData.Enabled setting is only required to be able to generate test content and is documented alongside the code.

The showAllowSegmentationForDocumentTypes setting does not seem to be honored, as it's fetched from the ServerVariables in the document type permissions AngularJS controller and that's always set to false.

@Chris-N1
Copy link

Chris-N1 commented Sep 2, 2020

@ronaldbarendse OK - not sure what was happening then as I could not turn segmentation on at all for any document type/alias without that setting present. Possibly a bug? There's also this code in the SegmentTestController:

if (ConfigurationManager.AppSettings["Umbraco.TestData.Enabled"] != "true") return HttpNotFound();

@ronaldbarendse
Copy link
Contributor

You can't enable segmentation from the UI yet (that's still experimental and behind a fixed flag in code), but only from the ContentTypeService API. This is what the controllers in Umbraco.TestData do and they only work when you enable them using that application setting.

@nul800sebastiaan nul800sebastiaan deleted the v8/feature/AB6057-segment-feature branch September 14, 2020 13:36
@michaelchart
Copy link

Is there a plan for when the rest of the UI for working with segmented content might be implemented? i.e. when this feature is no longer experimental but fully available. We're trying to determine whether to wait for this or to implement a different approach for now.

@nielslyngsoe
Copy link
Member Author

Is there a plan for when the rest of the UI for working with segmented content might be implemented? i.e. when this feature is no longer experimental but fully available. We're trying to determine whether to wait for this or to implement a different approach for now.

There is no current plan to develop this into a full feature. It only here to enables packages to make segmented data.

@ronaldbarendse
Copy link
Contributor

@nielslyngsoe Creating the segment names/content variants would indeed be something packages could enable, as segments could be different between nodes (e.g. for A/B testing, you can have different variants per node).

However, the document type configuration UI is already available within Umbraco, just hidden behind a flag. This flag currently can't be changed, as it's retrieved from the following server variable:

vm.showAllowSegmentationOption = Umbraco.Sys.ServerVariables.umbracoSettings.showAllowSegmentationForDocumentTypes || false;

But that's always set to false:

{"showAllowSegmentationForDocumentTypes", false},

It would make sense to remove this flag (and always show the Allow segmentation checkbox (which should be updated to Allow vary by segment to be consistent with cultures IMHO) or actually make it configurable by editing the UmbracoSettings.config file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants