-
Notifications
You must be signed in to change notification settings - Fork 62
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
Use site for loading of actions via Xhr and allow client specifying view #1169
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -184,21 +184,10 @@ define(["dojo/_base/declare", | |
var nodeRef = NodeUtils.processNodeRef(payload.nodeRef), | ||
targetNodeUri = nodeRef.uri; | ||
|
||
// Construct the URI for the request... | ||
var uriPart = payload.site ? "{type}/site/{site}/{container}" : "{type}/node/" + targetNodeUri; | ||
if (payload.filter && payload.filter.filterId === "path") | ||
{ | ||
// If a path has been provided in the filter then it is necessary to perform some special | ||
// encoding. We need to ensure that the data is URI encoded, but we want to preserve the | ||
// forward slashes. We also need to "double encode" all % characters because FireFox has | ||
// a nasty habit of decoding them *before* they've actually been posted back... this | ||
// guarantees that the user will be able to bookmark valid URLs... | ||
var encodedPath = encodeURIComponent(payload.filter.filterData).replace(/%2F/g, "/").replace(/%25/g,"%2525"); | ||
uriPart += this.combinePaths("/", encodedPath) + "/"; | ||
} | ||
|
||
// View mode and No-cache | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This code part was a remnant from a copy&paste from onRetrieveDocumentsRequest, but the calculated uriPart was not used at all. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for highlighting this and removing it - I'd not spotted it was not being used. |
||
var params = "?view=browse&noCache=" + new Date().getTime() + "&includeThumbnails=true"; | ||
var params = "?view="; | ||
params += encodeURIComponent(payload.view || "browse"); | ||
params += "&noCache=" + new Date().getTime() + "&includeThumbnails=true"; | ||
|
||
var alfTopic = payload.alfResponseTopic || topics.GET_DOCUMENT; | ||
var url; | ||
|
@@ -208,7 +197,12 @@ define(["dojo/_base/declare", | |
} | ||
else | ||
{ | ||
url = AlfConstants.URL_SERVICECONTEXT + "components/documentlibrary/data/node/" + targetNodeUri + params; | ||
url = AlfConstants.URL_SERVICECONTEXT + "components/documentlibrary/data/"; | ||
if (payload.site) | ||
{ | ||
url += "site/" + encodeURIComponent(payload.site) + "/"; | ||
} | ||
url += "node/" + targetNodeUri + params; | ||
} | ||
var config = { | ||
alfTopic: alfTopic, | ||
|
@@ -318,7 +312,9 @@ define(["dojo/_base/declare", | |
} | ||
|
||
// View mode and No-cache | ||
params += "&view=browse&noCache=" + new Date().getTime(); | ||
params += "&view="; | ||
params += encodeURIComponent(payload.view || "browse"); | ||
params += "&noCache=" + new Date().getTime(); | ||
|
||
var alfTopic = payload.alfResponseTopic || topics.GET_DOCUMENT_LIST; | ||
|
||
|
@@ -329,7 +325,12 @@ define(["dojo/_base/declare", | |
} | ||
else | ||
{ | ||
url = AlfConstants.URL_SERVICECONTEXT + "components/documentlibrary/data/doclist/" + params; | ||
url = AlfConstants.URL_SERVICECONTEXT + "components/documentlibrary/data/"; | ||
if (payload.site) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks like this
...but on your branch we see this:
Note the additional "site/site1" after "data" and before "doclist". Any thoughts on this? I'll continue to test my update against Share to see if it causes any issues. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The fragment until (and including) data/site/site1 is consumed by the Share data web script surf-doclist.get (URL pattern /components/documentlibrary/data/site/{site}/{webscript}/{params}) while the remainder is captured as the repository web script to call. As a result, the site is contained twice if both tiers are to function correctly. Otherwise the Share-tier won't capture the site token for use in any evaluators (e.g. Surf extension modules). The if block is the integral point of this PR. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK... I hadn't realised that. Well, it was working in Share, so I guess that makes sense... in which case, it will be necessary to push some changes to the mocking service (aikau/src/test/resources/testApp/js/aikau/testing/mockservices/FullDocLibMockXhr.j). In the So... /\/aikau\/service\/components\/documentlibrary\/data\/doclist\/all\/site\/site1\/documentlibrary\?filter=path(.*)/, ...needs to become... /\/aikau\/service\/components\/documentlibrary\/data\/site\/site1\/doclist\/all\/site\/site1\/documentlibrary\?filter=path(.*)/, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The last call (for favourites) will also need updating! |
||
{ | ||
url += "site/" + encodeURIComponent(payload.site) + "/"; | ||
} | ||
url += "doclist/" + params; | ||
} | ||
var config = { | ||
requestId: payload.requestId, | ||
|
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 configuration option was put in place to allow short-circuit of the "default lookup chain" if a developer is sure enough about how site can be extracted from the current item.