Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
vidjil
vidjil
Commits
b3a1b4be
Commit
b3a1b4be
authored
Nov 17, 2017
by
Ryan Herbert
Committed by
marc duez
Jun 15, 2020
Browse files
url.js parse positionnal args from url.
See
#2792
parent
dd92fbb3
Changes
3
Hide whitespace changes
Inline
Side-by-side
browser/js/url.js
View file @
b3a1b4be
...
...
@@ -5,7 +5,7 @@ function Url(model, win) {
this
.
window
=
(
typeof
win
!=
"
undefined
"
)
?
win
:
window
this
.
encoder
=
new
UrlEncoder
();
this
.
url_dict
=
this
.
parseUrlParams
(
this
.
window
.
location
.
search
.
toString
()
)
this
.
url_dict
=
this
.
parseUrlParams
()
;
this
.
sp
=
this
.
m
.
sp
this
.
m
.
start
(
this
.
url_dict
);
...
...
@@ -33,9 +33,9 @@ Url.prototype= {
}
// get sample_set/patient/run, config...
var
straight
_params
=
this
.
get
Straight
Params
();
for
(
var
i
=
0
;
i
<
straight
_params
.
length
;
i
++
)
{
var
p
=
straight
_params
[
i
];
var
positionnal
_params
=
this
.
get
Positionnal
Params
();
for
(
var
i
=
0
;
i
<
positionnal
_params
.
length
;
i
++
)
{
var
p
=
positionnal
_params
[
i
];
if
(
typeof
this
.
m
[
p
]
!==
"
undefined
"
)
{
params_dict
[
p
]
=
this
.
m
[
p
];
}
...
...
@@ -79,10 +79,10 @@ Url.prototype= {
applyURL
:
function
()
{
var
straight
_params
=
this
.
get
Straight
Params
();
for
(
var
i
=
0
;
i
<
straight
_params
.
length
;
i
++
)
{
if
(
typeof
this
.
url_dict
[
straight
_params
[
i
]]
!==
"
undefined
"
)
{
this
.
m
[
straight
_params
[
i
]]
=
this
.
url_dict
[
straight
_params
[
i
]];
var
positionnal
_params
=
this
.
get
Positionnal
Params
();
for
(
var
i
=
0
;
i
<
positionnal
_params
.
length
;
i
++
)
{
if
(
typeof
this
.
url_dict
[
positionnal
_params
[
i
]]
!==
"
undefined
"
)
{
this
.
m
[
positionnal
_params
[
i
]]
=
this
.
url_dict
[
positionnal
_params
[
i
]];
}
}
...
...
@@ -106,12 +106,10 @@ Url.prototype= {
}
},
parseUrlParams
:
function
(
urlparams
)
{
parseUrlParams
:
function
()
{
params
=
{}
if
(
urlparams
.
length
===
0
)
{
return
params
;
}
url_param
=
urlparams
.
substr
(
1
).
split
(
"
&
"
);
var
url
=
window
.
location
;
var
url_param
=
url
.
search
.
substr
(
1
).
split
(
"
&
"
);
for
(
var
i
=
0
;
i
<
url_param
.
length
;
i
++
)
{
var
tmparr
=
url_param
[
i
].
split
(
"
=
"
);
var
p
=
params
[
tmparr
[
0
]];
...
...
@@ -127,24 +125,37 @@ Url.prototype= {
params
[
key
].
push
(
val
);
}
}
var
positionnal_params
=
url
.
pathname
.
substr
(
1
).
split
(
'
-
'
);
var
pos_param_keys
=
this
.
getPositionnalParams
();
for
(
var
j
=
0
;
j
<
positionnal_params
.
length
;
j
++
)
{
params
[
pos_param_keys
[
j
]]
=
positionnal_params
[
j
];
}
return
params
},
generateParamsString
:
function
(
params_dict
)
{
var
params_list
=
[];
var
positionnal_params
=
[];
for
(
var
key
in
params_dict
){
if
((
typeof
key
!=
"
undefined
"
&&
key
!==
""
)
&&
(
typeof
params_dict
[
key
]
!=
"
undefined
"
))
{
var
encoded
=
this
.
encoder
.
encode
(
key
);
if
(
params_dict
[
key
].
constructor
!==
Array
&&
params_dict
[
key
]
!==
''
)
{
params_list
.
push
(
encoded
+
"
=
"
+
params_dict
[
key
])
}
else
if
(
params_dict
[
key
].
constructor
===
Array
)
{
for
(
var
i
=
0
;
i
<
params_dict
[
key
].
length
;
i
++
)
{
params_list
.
push
(
encoded
+
"
=
"
+
params_dict
[
key
][
i
]);
var
val
=
params_dict
[
key
];
if
((
typeof
key
!=
"
undefined
"
&&
key
!==
""
)
&&
(
typeof
val
!=
"
undefined
"
))
{
var
pos
=
this
.
getPosition
(
key
);
if
(
pos
>=
0
)
{
positionnal_params
[
pos
]
=
val
;
}
else
{
var
encoded
=
this
.
encoder
.
encode
(
key
);
if
(
val
.
constructor
!==
Array
&&
val
!==
''
)
{
params_list
.
push
(
encoded
+
"
=
"
+
val
)
}
else
if
(
val
.
constructor
===
Array
)
{
for
(
var
i
=
0
;
i
<
val
.
length
;
i
++
)
{
params_list
.
push
(
encoded
+
"
=
"
+
val
[
i
]);
}
}
}
}
}
return
params_list
.
join
(
"
&
"
);
return
positionnal_params
.
join
(
'
-
'
)
+
'
?
'
+
params_list
.
join
(
"
&
"
);
},
pushUrl
:
function
(
params
)
{
...
...
@@ -156,10 +167,14 @@ Url.prototype= {
}
},
get
Straight
Params
:
function
()
{
get
Positionnal
Params
:
function
()
{
return
[
"
sample_set_id
"
,
"
config
"
];
},
getPosition
:
function
(
param
)
{
return
this
.
getPositionnalParams
().
indexOf
(
param
);
},
loadUrl
:
function
(
db
,
args
,
filename
)
{
this
.
url_dict
=
args
;
var
newParams
=
this
.
generateParamsString
(
args
);
...
...
docker/vidjil-client/conf/nginx_web2py
View file @
b3a1b4be
...
...
@@ -26,6 +26,16 @@ server {
uwsgi_max_temp_file_size 20480m;
location / {
rewrite /([0-9]+)-([0-9]+) /?set=$1&conf=$2 break;
root /usr/share/vidjil;
expires 1h;
add_header Cache-Control must-revalidate;
error_page 405 = $uri;
}
location /vidjil {
include /etc/nginx/conf.d/web2py/uwsgi.conf;
proxy_read_timeout 600;
client_max_body_size 20G;
...
...
@@ -35,15 +45,6 @@ server {
## if you serve static files through https, copy here the section
## from the previous server instance to manage static files
location /browser {
root /usr/share/vidjil;
expires 1h;
add_header Cache-Control must-revalidate;
error_page 405 = $uri;
}
location /germline {
root /usr/share/vidjil/;
expires 1h;
...
...
server/nginx_install.sh
View file @
b3a1b4be
...
...
@@ -96,6 +96,14 @@ server {
uwsgi_temp_path /mnt/data/tmp;
location / {
rewrite /([0-9]+)/([0-9]+) /?set=
$1
&conf=
$2
break;
root
$CWD
/../browser;
expires 1h;
error_page 405 =
$uri
;
}
location /vidjil {
include /etc/nginx/conf.d/web2py/uwsgi.conf
proxy_read_timeout 600;
client_max_body_size 20G;
...
...
@@ -104,14 +112,6 @@ server {
## if you serve static files through https, copy here the section
## from the previous server instance to manage static files
location /browser {
root
$CWD
/../;
expires 1h;
add_header Cache-Control must-revalidate;
error_page 405 =
$uri
;
}
location /germline {
root
$CWD
/../;
expires 1h;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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