Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
jio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Yaxel Perez
jio
Commits
4763d057
Commit
4763d057
authored
Feb 24, 2014
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ERP5 now returns jIO URN instead of HTTP URL.
parent
5901753b
Changes
2
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
87 additions
and
26 deletions
+87
-26
src/URI.js
src/URI.js
+77
-0
src/jio.storage/erp5storage.js
src/jio.storage/erp5storage.js
+10
-26
No files found.
src/URI.js
0 → 100644
View file @
4763d057
This diff is collapsed.
Click to expand it.
src/jio.storage/erp5storage.js
View file @
4763d057
...
...
@@ -10,9 +10,9 @@
// }
/*jslint indent: 2, nomen: true, unparam: true */
/*global jIO, complex_queries, console, UriTemplate, FormData, RSVP */
/*global jIO, complex_queries, console, UriTemplate, FormData, RSVP
, URI
*/
(
function
(
jIO
,
complex_queries
)
{
(
function
(
jIO
,
complex_queries
,
URI
)
{
"
use strict
"
;
function
ERP5Storage
(
spec
)
{
...
...
@@ -96,26 +96,9 @@
});
}).
then
(
function
(
doc
)
{
// XXX Really depend on server response...
var
new_document_url
=
doc
.
target
.
getResponseHeader
(
"
Location
"
);
return
jIO
.
util
.
ajax
({
"
type
"
:
"
GET
"
,
"
url
"
:
new_document_url
,
"
xhrFields
"
:
{
withCredentials
:
true
}
});
}).
then
(
function
(
response
)
{
var
doc_hal
=
JSON
.
parse
(
response
.
target
.
responseText
);
if
(
doc_hal
!==
null
)
{
command
.
success
({
"
id
"
:
doc_hal
.
_relative_url
});
}
else
{
command
.
error
(
"
not_found
"
,
"
missing
"
,
"
Cannot find document
"
);
}
},
function
(
error
)
{
var
uri
=
new
URI
(
doc
.
target
.
getResponseHeader
(
"
X-Location
"
));
command
.
success
({
"
id
"
:
uri
.
segment
(
2
)});
}).
fail
(
function
(
error
)
{
console
.
error
(
error
);
command
.
error
(
500
,
...
...
@@ -193,15 +176,16 @@
var
data
=
catalog_json
.
_embedded
.
contents
,
count
=
data
.
length
,
i
,
uri
,
item
,
result
=
[],
promise_list
=
[
result
];
for
(
i
=
0
;
i
<
count
;
i
+=
1
)
{
item
=
data
[
i
];
item
.
_id
=
item
.
_relative_url
;
uri
=
new
URI
(
item
.
_links
.
self
.
href
)
;
result
.
push
({
id
:
item
.
_relative_url
,
key
:
item
.
_relative_url
,
id
:
uri
.
segment
(
2
)
,
key
:
uri
.
segment
(
2
)
,
doc
:
{},
value
:
item
});
...
...
@@ -231,4 +215,4 @@
jIO
.
addStorage
(
"
erp5
"
,
ERP5Storage
);
}(
jIO
,
complex_queries
));
}(
jIO
,
complex_queries
,
URI
));
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment