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
dad
FFDS-register-front
Commits
2f77630a
Commit
2f77630a
authored
Sep 14, 2020
by
Administrator
Browse files
api dataveerse
parent
1bd050c4
Changes
6
Hide whitespace changes
Inline
Side-by-side
dist/gitlab.yaml
0 → 100644
View file @
2f77630a
apiVersion
:
v1
kind
:
Service
metadata
:
labels
:
app
:
gitlab
tier
:
gitlab
name
:
gitlab
spec
:
type
:
LoadBalancer
ports
:
-
name
:
"
80"
port
:
80
targetPort
:
80
-
name
:
"
22"
port
:
22
targetPort
:
22
-
name
:
"
443"
port
:
443
targetPort
:
443
selector
:
app
:
gitlab
tier
:
gitlab
---
apiVersion
:
v1
kind
:
PersistentVolumeClaim
metadata
:
labels
:
app
:
gitlab
tier
:
gitlab
name
:
gitlab-claim4
spec
:
storageClassName
:
standard
accessModes
:
-
ReadWriteOnce
resources
:
requests
:
storage
:
100Mi
---
apiVersion
:
apps/v1
kind
:
Deployment
metadata
:
labels
:
app
:
gitlab
tier
:
gitlab
name
:
gitlab
spec
:
replicas
:
1
selector
:
matchLabels
:
app
:
gitlab
tier
:
gitlab
template
:
metadata
:
annotations
:
labels
:
app
:
gitlab
tier
:
gitlab
spec
:
containers
:
-
image
:
gitlab/gitlab-ee:latest
name
:
gitlab
ports
:
-
containerPort
:
27017
volumeMounts
:
-
mountPath
:
/data/gitlab
name
:
gitlab-claim4
restartPolicy
:
Always
volumes
:
-
name
:
gitlab-claim4
persistentVolumeClaim
:
claimName
:
gitlab-claim4
src/app/datasets/datasets.component.html
View file @
2f77630a
<h3>
Here list of datasets directly from the openapi GET
</h3>
<h3>
where you can choose what to publish in FDP
</h3>
<form>
<div>
<button
type=
"submit"
(click)=
"listdatasets()"
class=
"btn btn-primary"
>
List datasets
</button>
</div>
<p>
{{result}}
</p>
</form>
src/app/datasets/datasets.component.ts
View file @
2f77630a
import
{
Component
,
OnInit
}
from
'
@angular/core
'
;
import
{
HttpClient
,
HttpHeaders
}
from
'
@angular/common/http
'
;
import
{
AppConfiguration
}
from
'
../AppConfiguration
'
;
import
{
FileSaverService
}
from
'
ngx-filesaver
'
;
import
{
resolve
}
from
'
url
'
;
import
{
Observable
}
from
'
rxjs
'
;
@
Component
({
selector
:
'
app-datasets
'
,
...
...
@@ -6,10 +11,65 @@ import { Component, OnInit } from '@angular/core';
styleUrls
:
[
'
./datasets.component.scss
'
]
})
export
class
DatasetsComponent
implements
OnInit
{
result
:
Promise
<
any
>
;
dataresult
:
any
;
constructor
()
{
}
constructor
(
private
appConfig
:
AppConfiguration
,
private
http
:
HttpClient
,
private
_FileSaverService
:
FileSaverService
,
)
{
}
ngOnInit
()
{
}
listdatasets
()
{
const
httpOptions
=
{
headers
:
new
HttpHeaders
({
'
Content-Type
'
:
'
Application/json
'
})
};
const
getCircularReplacer
=
()
=>
{
const
seen
=
new
WeakSet
();
return
(
key
,
value
)
=>
{
if
(
typeof
value
===
"
object
"
&&
value
!==
null
)
{
if
(
seen
.
has
(
value
))
{
return
;
}
seen
.
add
(
value
);
}
return
value
;
};
};
// remplacer l'url api dataverse avec l'enpoint du smart harvester "datasetslist"
this
.
result
=
new
Promise
((
r
,
e
)
=>
{
r
(
this
.
http
.
get
(
"
https://data.inra.fr/api/search?q=*&type=dataset
"
,
httpOptions
).
subscribe
(
r
=>
console
.
log
(
r
)));
})
this
.
result
.
then
(
(
res
)
=>
{
console
.
log
(
"
res =
"
+
JSON
.
stringify
(
res
,
getCircularReplacer
()));
this
.
dataresult
=
res
;
console
.
log
(
"
this.dataresult =
"
+
JSON
.
stringify
(
this
.
dataresult
,
getCircularReplacer
()));
return
this
.
dataresult
;
});
console
.
log
(
JSON
.
stringify
(
this
.
dataresult
,
getCircularReplacer
()));
return
JSON
.
stringify
(
this
.
dataresult
,
getCircularReplacer
());
}
}
src/app/repository/repository.component.html
View file @
2f77630a
...
...
@@ -5,12 +5,21 @@
<input
type=
"file"
id=
"repofile"
name=
"repofile "
class=
"btn btn-primary"
(change)=
"repositorytoyaml('fill')"
><br>
<label>
Or describe your repository and save a new file for publishing in the FDP database:
</label><br>
<div>
<label>
Repository Type
<select
class=
"form-control"
formControlName=
"repotype"
required
>
<option
value=
"Dataverse"
>
Dataverse
</option>
>
<option
value=
"Custom"
>
Custom
</option>
>
</select>
</label>
</div>
<div
class=
"form-group"
>
<label>
Repository Name
<input
type=
"text"
class=
"form-control"
formControlName=
"reponame"
required
>
</label>
</div>
<div
class=
"form-group"
>
<div
class=
"form-group"
>
<label>
Description
<textarea
class=
"form-control"
formControlName=
"repodescription"
></textarea>
</label>
...
...
src/app/repository/repository.component.ts
View file @
2f77630a
...
...
@@ -20,6 +20,7 @@ export class RepositoryComponent implements OnInit {
public
importFile
:
File
;
Form
=
new
FormGroup
({
repotype
:
new
FormControl
(),
reponame
:
new
FormControl
(
''
,
Validators
.
required
),
repodescription
:
new
FormControl
(),
repourl
:
new
FormControl
(),
...
...
@@ -43,8 +44,10 @@ export class RepositoryComponent implements OnInit {
if
(
buttonType
==
'
submit
'
)
{
let
data
:
string
;
data
=
'
\
repository:
\n\
type:
'
+
this
.
Form
.
value
.
repotype
+
'
\n\
title:
'
+
this
.
Form
.
value
.
reponame
+
'
\n\
description:
'
+
this
.
Form
.
value
.
repodescription
+
'
\n\
url:
'
+
this
.
Form
.
value
.
repourl
+
'
\n\
...
...
@@ -69,6 +72,7 @@ repository:\n\
let
line
=
""
;
let
map
=
new
Map
();
let
fileReader
=
new
FileReader
();
fileReader
.
onload
=
(
event
)
=>
{
text
=
fileReader
.
result
as
string
;
...
...
@@ -79,6 +83,7 @@ repository:\n\
}
this
.
Form
.
setValue
({
repotype
:
map
.
get
(
'
type
'
)
,
reponame
:
map
.
get
(
'
title
'
)
,
repodescription
:
map
.
get
(
'
description
'
),
repourl
:
map
.
get
(
'
url
'
),
...
...
@@ -104,6 +109,7 @@ repository:\n\
dct:description "
'
+
this
.
Form
.
value
.
repodescription
+
'
";
\n\
dct:hasVersion "
'
+
this
.
Form
.
value
.
repoversion
+
'
";
\n\
dct:isPartOf <http://
'
+
environment
.
apiurl
+
'
>;
\n\
dcat:keyword "
'
+
this
.
Form
.
value
.
repotype
+
'
";
\n\
dct:title "
'
+
this
.
Form
.
value
.
reponame
+
'
".
\n
'
const
httpOptions
=
{
...
...
@@ -114,10 +120,12 @@ repository:\n\
})
};
return
this
.
http
return
this
.
http
.
post
(
this
.
appConfig
.
fdpurl
+
"
/catalog
"
,
data
,
httpOptions
)
.
subscribe
(
(
r
)
=>
{
console
.
log
(
'
got r
'
,
r
)})
;
}
...
...
src/environments/environment.prod.ts
View file @
2f77630a
...
...
@@ -3,5 +3,5 @@ import { ApiService } from 'src/app/api.service';
export
const
environment
=
{
production
:
true
,
apiurl
:
'
sandbox9.cines.fr
'
,
token
:
'
eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOi
I5Y2IzMzgyMi0wYWNkLTRhYTQtYTUzZS1kMDU0Mzg3ZGJjMjQiLCJpYXQiOjE1OTk1Njc0MTYsImV4cCI6MTYwMDc3NzAxNn0.4r7076f5S7ABVVLGyzaxytt7o9bdQfNhkheF-zvJaTE
'
token
:
'
eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOi
JhN2FkZDNkOS1mZTUwLTQ4ZGEtYTNmNC0zY2I1NjljM2Y5YmEiLCJpYXQiOjE2MDAwNzUxMzEsImV4cCI6MTYwMTI4NDczMX0.gRLsRdoEeIoqPNSZfegKIzdK1bfF16ALJ6xJPOAkVOA
'
};
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