Toggle navigation
Toggle navigation
This project
Loading...
Sign in
digsig
/
digsig-services
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Stefan Huber
2017-03-27 12:44:29 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
7b6a76da05a3c6d2c4f19f8a52a634170a97a9fd
7b6a76da
1 parent
e04b542b
dist
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
1 deletions
dist/services/repository.d.ts
dist/services/repository.js
src/services/repository.ts
dist/services/repository.d.ts
View file @
7b6a76d
import
{
Rest
}
from
'./rest'
;
import
{
Device
}
from
'./device'
;
import
{
DeviceInfo
}
from
'../api/device-info'
;
import
{
Node
}
from
'../api/node'
;
export
declare
class
Repository
{
protected
rest
:
Rest
;
protected
device
:
Device
;
protected
_db
:
any
;
protected
_params
:
any
;
protected
_node
:
Node
;
db
:
any
;
params
:
any
;
readonly
localNode
:
Node
;
constructor
(
rest
:
Rest
,
device
:
Device
);
findById
(
id
:
string
):
Promise
<
any
>
;
findByIds
(
ids
:
Array
<
string
>
):
Promise
<
Array
<
any
>>
;
...
...
dist/services/repository.js
View file @
7b6a76d
...
...
@@ -15,6 +15,7 @@ var Repository = (function () {
function
Repository
(
rest
,
device
)
{
this
.
rest
=
rest
;
this
.
device
=
device
;
this
.
_node
=
null
;
}
Object
.
defineProperty
(
Repository
.
prototype
,
"db"
,
{
get
:
function
()
{
...
...
@@ -36,6 +37,13 @@ var Repository = (function () {
enumerable
:
true
,
configurable
:
true
});
Object
.
defineProperty
(
Repository
.
prototype
,
"localNode"
,
{
get
:
function
()
{
return
this
.
_node
;
},
enumerable
:
true
,
configurable
:
true
});
Repository
.
prototype
.
findById
=
function
(
id
)
{
return
this
.
db
.
get
(
id
);
};
...
...
@@ -105,6 +113,7 @@ var Repository = (function () {
.
then
(
function
(
node
)
{
var
res
=
_this
.
parseUrl
(
response
.
db_url
);
var
localCouchUrl
=
'http://'
+
node
.
ip
+
':'
+
node
.
couchPort
+
'/'
+
res
.
orig_db_name
;
_this
.
_node
=
node
;
console
.
log
(
"prepare local couch url: "
,
localCouchUrl
);
resolve
(
_this
.
prepare
(
localCouchUrl
));
}).
catch
(
function
()
{
...
...
src/services/repository.ts
View file @
7b6a76d
import
{
Injectable
}
from
'@angular/core'
;
import
{
Rest
}
from
'./rest'
;
import
{
Device
}
from
'./device'
;
import
{
Device
}
from
'./device'
;
import
{
DeviceInfo
}
from
'../api/device-info'
;
import
{
Node
}
from
'../api/node'
;
declare
var
emit
:
any
;
...
...
@@ -10,6 +11,7 @@ export class Repository {
protected
_db
:
any
;
protected
_params
:
any
;
protected
_node
:
Node
=
null
;
get
db
()
{
return
this
.
_db
;
...
...
@@ -27,6 +29,10 @@ export class Repository {
this
.
_params
=
params
;
}
get
localNode
()
{
return
this
.
_node
;
}
constructor
(
protected
rest
:
Rest
,
protected
device
:
Device
...
...
@@ -100,6 +106,7 @@ export class Repository {
.
then
(
node
=>
{
let
res
=
this
.
parseUrl
(
response
.
db_url
);
let
localCouchUrl
=
'http://'
+
node
.
ip
+
':'
+
node
.
couchPort
+
'/'
+
res
.
orig_db_name
;
this
.
_node
=
node
;
console
.
log
(
"prepare local couch url: "
,
localCouchUrl
);
resolve
(
this
.
prepare
(
localCouchUrl
));
}).
catch
(()
=>
{
...
...
Please
register
or
login
to post a comment