U4-9312 - Store GUIDs instead of Integers on content/media pickers for Data Type Pre Values

Created by Niels Hartvig 22 Dec 2016, 13:07:30 Updated by Claus Jensen 24 Jan 2017, 19:00:38

Tags: PR

Relates to: U4-9435

Relates to: U4-9310

Ensure APIs allow us to use an int based node id or the GUID key for when we set a start node for either the content or media pickers

Comments

Shannon Deminick 28 Dec 2016, 02:53:39

PR: https://github.com/umbraco/Umbraco-CMS/pull/1659


Niels Hartvig 09 Jan 2017, 13:51:23

Done, but required a number of changes:

  1. Content and Media API controllers updated to support both GUIDs and Integer ids
  2. MediaType API controller updated to support GUIDs and Integer Ids when the media upload dialog looks
  3. The Media dialog javascript controllers updated to use our localstorage service instead of cookieService (as the latter doesn't support guids stored in cookies (for some reason))


Niels Hartvig 09 Jan 2017, 13:51:42

PR: https://github.com/umbraco/Umbraco-CMS/pull/1679


Warren Buckley 16 Jan 2017, 13:41:25

@hartvig is there any test notes or anyway for me to verify that GUIDs are now being stored as opposed to int IDs? Seems like this will require U4-9310 to be done as well in order for this to be tested?

As went to test this & realized that after getting a CSV of int IDs that the property editors has not been updated in this PR/task. If I am able to test this @hartvig without the property editors, let me know please so I can verify & close this task off.

Note

--Also a side note the community property value converters project that is due to be merged into the core for 7.6 with U4-7318, will need to be fixed as well as they are depending on the values that are saved & persisted being integers and will need to support a mix of integers and Guids.--


Niels Hartvig 16 Jan 2017, 13:50:39

@warren.buckley this is for prevalues, not the property values! You can test by updating a prevalue in the db to be a guid instead of an int.


Warren Buckley 16 Jan 2017, 15:42:01

OK after grabbing a copy of SQL Toolbox to edit the CE DB & the stored value in the DB for a media folder entity/item int id over to a GUID in the cmsDataTypePreValues DB table

The name of the picked media folder no longer showed when re-visiting the edit datatype & the associated media picker prevalue start node property editor.

Looking at the AJAX request made by the prevalue media picker property editor it makes a call to the following url /umbraco/backoffice/UmbracoApi/Entity/GetByIds?ids=d249e476-00d3-4669-9131-47cebb2d0f22&type=Media

Previously when this was an int it would return the following JSON blob

[
  {
    "name": "Cats",
    "id": 1082,
    "icon": "icon-folder",
    "trashed": false,
    "key": "d249e476-00d3-4669-9131-47cebb2d0f22",
    "parentId": -1,
    "alias": null,
    "path": "-1,1082",
    "metaData": {
      "NodeObjectTypeId": "b796f64c-1f99-4ffb-b886-4bf4bc011a9c",
      "HasChildren": true,
      "ContentTypeAlias": "Folder",
      "ContentTypeIcon": "icon-folder",
      "ContentTypeThumbnail": "icon-folder",
      "IsPublished": false,
      "IsDraft": false,
      "HasPendingChanges": false,
      "NodeUser": 0,
      "UniqueID": "d249e476-00d3-4669-9131-47cebb2d0f22",
      "Text": "Cats",
      "NodeObjectType": "b796f64c-1f99-4ffb-b886-4bf4bc011a9c",
      "Children": 2,
      "PublishedVersion": null,
      "NewestVersion": null,
      "Alias": "Folder",
      "Icon": "icon-folder",
      "Thumbnail": "icon-folder",
      "IsContainer": false,
      "ContentNodeId": 1082,
      "VersionId": "3d729344-8f51-4e8f-b11b-8adfd2b00ea5",
      "contents": {
        "PropertyEditorAlias": "Umbraco.ListView",
        "Value": null
      }
    }
  }
]

This is also the same when a content picker datatype start node (PreValue property editor) uses a GUID as a start node the following API endpoint returns nothing in the request

/umbraco/backoffice/UmbracoApi/Entity/GetByIds?ids=457c176c-88f6-47de-ba37-a0da8977318a&type=Document

I can confirm that when using the Media Picker that has a start node that is a GUID - it loaded the correct folder of images as expected using the following request: /umbraco/backoffice/UmbracoApi/Media/GetChildren?id=d249e476-00d3-4669-9131-47cebb2d0f22&pageNumber=0&pageSize=0&orderBy=SortOrder&orderDirection=Ascending&orderBySystemField=true&filter=

However this did not work for the content picker (The old ugly/current one) where it makes a request to the following url but it does not 500 it simply returns nothing: /umbraco/backoffice/UmbracoTrees/ApplicationTree/GetApplicationTrees?application=content&tree=content&isDialog=true&startNodeId=457c176c-88f6-47de-ba37-a0da8977318a

So based on the above test notes @hartvig I have marked this as re-opened


Niels Hartvig 16 Jan 2017, 18:14:45

Couldn't reproduce the issues with the pickers - see: http://recordit.co/YsclWFEWDr

Fixed the issue with the entity captions in the pre value picker


Warren Buckley 17 Jan 2017, 08:30:29

Thanks for the video @hartvig I will pull it again & re-test (May have been something funky with my machine)


Warren Buckley 17 Jan 2017, 10:40:40

OK @hartvig all tested & works as described & as shown in your video. So I am happy, as this is now due for 7.5.8 I think Mr Release aka @sebastiaan wants a final glance over it, before we mark as fixed & merged.


Priority: Normal

Type: Task

State: Fixed

Assignee:

Difficulty: Normal

Category:

Backwards Compatible: True

Fix Submitted:

Affected versions:

Due in version: 7.5.8

Sprint: Sprint 50

Story Points: 2

Cycle: