-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Add a Segment Management Page #23885
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
base: 5.x-dev
Are you sure you want to change the base?
Conversation
13932db to
597f770
Compare
adcf8af to
6fb66bd
Compare
fc0cb9b to
e353f4f
Compare
| tr:nth-last-child(1 of .dataTable_row-group) td { | ||
| border-bottom: 3px solid @theme-color-background-tinyContrast !important; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| interface PiwikHelperGlobal { | ||
| escape(text: string): string; | ||
| redirect(params?: any); | ||
| getCurrentQueryStringWithParametersModified(newparams: string); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ℹ️ This function already exists (and is useful!) but it is now available outside of the piwikHelper.
| public function addMeasurableItem($menuName, $url, $order = 50, $tooltip = false, $icon = false) | ||
| { | ||
| $this->addItem('CoreAdminHome_MenuMeasurables', $menuName, $url, $order, $tooltip); | ||
| $this->addItem('CoreAdminHome_MenuMeasurables', $menuName, $url, $order, $tooltip, $icon); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ℹ️ This argument already exists and it is false by default. I only made it available in a higher level.
| .sparklineEvolution { | ||
| color: black; | ||
| font-size: 12px; | ||
| white-space: nowrap; | ||
| } | ||
|
|
||
| .sparklineEvolution-positive { | ||
| color: green; | ||
| } | ||
|
|
||
| .sparklineEvolution-negative { | ||
| color: red; | ||
| } | ||
|
|
||
| .sparklineEvolution_icon { | ||
| margin-right: 1em; | ||
| vertical-align: middle; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
|
||
| if (Piwik::isUserHasWriteAccess($idSite)) { | ||
| $menu->addMeasurableItem('Goals_Goals', $this->urlForAction('manage', array('idSite' => $idSite)), 40); | ||
| $menu->addMeasurableItem('Goals_Goals', $this->urlForAction('manage', array('idSite' => $idSite)), 15); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ℹ️ Goals item should be higher in the Administration Menu. It is more obvious now that we add a "Segments" item.
| } | ||
|
|
||
| function addTooltip(element, title) { | ||
| $('.ui-tooltip').remove(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ℹ️ Avoid bug, when several tooltips are stack. It happens when DOM that trigger the tooltip is destroyed, for example when clicking on a star, the star is rebuild.
| updateStarSegmentTooltip($segment, segment); | ||
| function updateStarredSegment(segment, isError = false) { | ||
| starCallbackList.forEach(function(callback) { | ||
| callback(segment, isError); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ℹ️ When the state of a segment change, it changes automatically for the segmentEditor and the segmentPage in the same time.
| window.SegmentEditorPanel = { | ||
| addTooltip, | ||
| askToDeleteSegment, | ||
| closePanel, | ||
| getDeleteSegmentTitle, | ||
| getEditSegmentTitle, | ||
| getIsUserCanEditSegment, | ||
| getSegmentFromId, | ||
| normalizeSearchString, | ||
| onSegmentsStarChange, | ||
| openPanel, | ||
| openEditFormGivenIdSegment, | ||
| togglePanel, | ||
| toggleStarredSegment, | ||
| triggerStarAnimation, | ||
| updateStarSegmentTooltip, | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ℹ️ Theses functions are also useful for the SegmentPage and the SegmentPanel, so we make it public to avoid duplication and inconsistency.
| "AddANDorORCondition": "Add %s condition", | ||
| "AddNewSegment": "Add new segment", | ||
| "AreYouSureDeleteSegment": "Are you sure you want to delete this segment?", | ||
| "AddNewSegment": "Create new segment", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ℹ️ For consistency with Form / Funnels / Reports, we changed the label from "Add" to "Create" and displayed a "+" icon.
| display: flex; | ||
| width: 16px; | ||
| height: 16px; | ||
| .segmentAction { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ℹ️ Reduce selector complexity to improve reusability
| </ul> | ||
|
|
||
| {% if authorizedToCreateSegments %} | ||
| <a tabindex="4" class="add_new_segment btn">{{ 'SegmentEditor_AddNewSegment'|translate }}</a> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ℹ️ <a> tag without href attribute is an anchor and is not accessible.
| <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24"> | ||
| <path stroke="black" stroke-width="3" fill="none" d="M9.153 5.408C10.42 3.136 11.053 2 12 2c.947 0 1.58 1.136 2.847 3.408l.328.588c.36.646.54.969.82 1.182.28.213.63.292 1.33.45l.636.144c2.46.557 3.689.835 3.982 1.776.292.94-.546 1.921-2.223 3.882l-.434.507c-.476.557-.715.836-.822 1.18-.107.345-.071.717.001 1.46l.066.677c.253 2.617.38 3.925-.386 4.506-.766.582-1.918.051-4.22-1.009l-.597-.274c-.654-.302-.981-.452-1.328-.452-.347 0-.674.15-1.329.452l-.595.274c-2.303 1.06-3.455 1.59-4.22 1.01-.767-.582-.64-1.89-.387-4.507l.066-.676c.072-.744.108-1.116 0-1.46-.106-.345-.345-.624-.821-1.18l-.434-.508c-1.677-1.96-2.515-2.941-2.223-3.882.293-.941 1.523-1.22 3.983-1.776l.636-.144c.699-.158 1.048-.237 1.329-.45.28-.213.46-.536.82-1.182l.328-.588Z"/> | ||
| </svg> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ℹ️ Star, in a future PR, will be handled with a background image to reduce the page weight and improve reusability
58c8392 to
ff37dbc
Compare
9b0745b to
6939639
Compare
| var tooltip = $(root).parents('.matomo-widget').tooltip('instance'); | ||
| if (tooltip) { | ||
| tooltip.disable(); | ||
| } | ||
| window.SegmentEditorPanel.updateStarSegmentTitle($starButton, segment); | ||
| if (tooltip) { | ||
| tooltip.enable(); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add 'All Visits at the top' Reorder segments: fixed > selected > starred > others Add highlighted styles to fixed and selected segments Allow star/unstar segments Reorder data Add view, edit, and delete actions Synchronize UI between the editor panel and the management page Align number to the right Add right management Use translation for the page description Implement the search segment Add tooltip on view action Add a create segment button Add sparkline UX Meeting feedback Add a menu entry into the Administration menu + colored evolution Fix range selection Update evolution tooltip Add manage segment button Remove tooltip on sparkline when using a custom range Reorder administration menu and add an outlink icon Use generic table tooltip instead of custom ones Fix PHPCS Fix PHP errors Update the Scheduled Reports help box about segment Move JavaScript in a separate file and fix a bug when we unstar selected segment Bugfix: not all users are allowed to create segments




Description
UX-326
We propose the introduction of a new page in Matomo, titled "Segments."
This page will serve as a combined reporting and management tool to make it easy to view (and edit) all segments for a website, and also provide a clean dashboard to view All segment data at once.
Features
If needed, a tooltip explain why we cannot do an action. If it is a global segment, the tooltip precise that starring/unstarring it will affect all websites.
If we choose to edit a segment, it opens the segmentEditorPanel
If we choose to delete a segment, it opens the segmentEditorPanel and trigger a new modal that ask confirmation before deleting it.
Data Synchronization with the Panel
Starring/Unstarring will reorder segments without reload. The Page and the Panel are always synchronized.
Menus
We added an
outlinkicon to the administration because this link goes back to the Dashboard. We choose this behaviour because the website / date / segment selector are needed and not available in the administration layout.Plugins
This PR will have impact on plugins UI screenshots:
Checklist
Review