Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
vikm-rserve
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ViKM-Group
vikm-rserve
Commits
cbcae7ef
Commit
cbcae7ef
authored
Dec 22, 2016
by
Fabio Lehmann
Browse files
Options
Downloads
Patches
Plain Diff
add service
parent
fcb0dc65
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
rserve.js
+88
-0
88 additions, 0 deletions
rserve.js
with
88 additions
and
0 deletions
rserve.js
0 → 100644
+
88
−
0
View file @
cbcae7ef
/************************ LICENCE ***************************
* This file is part of <ViKM Vital-IT Knowledge Management web application>
* Copyright (C) <2016> SIB Swiss Institute of Bioinformatics
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*****************************************************************/
/*global angular*/
(
function
(){
'
use strict
'
;
/**
* @ngdoc service
* @name targetomeApp.Rserve
* @description
* # Rserve
* Factory in the targetomeApp.
*/
angular
.
module
(
'
vikmApp
'
)
.
factory
(
'
Rserve
'
,
RserveFactory
);
RserveFactory
.
$inject
=
[
'
$http
'
,
'
ENV
'
,
'
$interval
'
,
'
toastr
'
];
function
RserveFactory
(
$http
,
ENV
,
$interval
,
toastr
){
var
service
=
{
socketeerID
:
''
,
start
:
start
,
keepAlive
:
keepAlive
,
loadData
:
loadData
,
Rdemo
:
Rdemo
};
var
serverRoot
=
ENV
.
serverURL
.
split
(
'
api
'
)[
0
]
+
"
R/
"
;
function
start
(){
return
$http
.
get
(
serverRoot
+
"
newskt
"
).
then
(
function
successCallback
(
data
)
{
service
.
socketeerID
=
data
.
data
;
$interval
(
function
(){
keepAlive
();
},
20000
)
},
function
errorCallback
(
data
,
status
)
{
service
.
socketeerID
=
''
;
toastr
.
error
(
"
No connection to RServe
"
);
});
}
function
keepAlive
(){
if
(
!
service
.
socketeerID
)
start
();
return
$http
.
get
(
serverRoot
+
service
.
socketeerID
);
}
function
loadData
(
dataPath
){
if
(
!
service
.
socketeerID
)
toastr
.
error
(
"
No connection to RServe
"
);
else
{
return
$http
.
get
(
serverRoot
+
"
/
"
+
service
.
socketeerID
+
"
/load_data?file=
"
+
dataPath
).
then
(
function
(
data
){
});
}
}
function
Rdemo
(
samples
){
if
(
!
service
.
socketeerID
)
toastr
.
error
(
"
No connection to RServe
"
);
else
{
var
url
=
serverRoot
+
"
/
"
+
service
.
socketeerID
+
"
/Rdemo
"
;
// if(samples) url += "&samples="+samples
if
(
samples
&&
samples
!=
'
[]
'
)
url
+=
"
?samples=
"
+
samples
;
return
$http
.
get
(
url
);
}
}
return
service
;
}
})();
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment