Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
anis
anis-next
Commits
e6e53539
Commit
e6e53539
authored
Apr 14, 2022
by
François Agneray
Browse files
Delete survey entity
parent
5b8358b1
Changes
70
Hide whitespace changes
Inline
Side-by-side
client/src/app/admin/admin-routing.module.ts
View file @
e6e53539
...
...
@@ -18,7 +18,6 @@ const routes: Routes = [
path
:
''
,
component
:
AdminComponent
,
canActivate
:
[
AdminAuthGuard
],
children
:
[
{
path
:
''
,
redirectTo
:
'
instance/instance-list
'
,
pathMatch
:
'
full
'
},
{
path
:
'
instance
'
,
loadChildren
:
()
=>
import
(
'
./instance/instance.module
'
).
then
(
m
=>
m
.
InstanceModule
)
},
{
path
:
'
survey
'
,
loadChildren
:
()
=>
import
(
'
./survey/survey.module
'
).
then
(
m
=>
m
.
SurveyModule
)
},
{
path
:
'
database
'
,
loadChildren
:
()
=>
import
(
'
./database/database.module
'
).
then
(
m
=>
m
.
DatabaseModule
)
},
{
path
:
'
settings
'
,
loadChildren
:
()
=>
import
(
'
./settings/settings.module
'
).
then
(
m
=>
m
.
SettingsModule
)
}
]
...
...
client/src/app/admin/admin.component.ts
View file @
e6e53539
...
...
@@ -16,7 +16,6 @@ import * as fromRouter from '@ngrx/router-store';
import
{
UserProfile
}
from
'
src/app/auth/user-profile.model
'
;
import
*
as
authActions
from
'
src/app/auth/auth.actions
'
;
import
*
as
authSelector
from
'
src/app/auth/auth.selector
'
;
import
*
as
surveyActions
from
'
src/app/metamodel/actions/survey.actions
'
;
import
*
as
databaseActions
from
'
src/app/metamodel/actions/database.actions
'
;
import
*
as
selectActions
from
'
src/app/metamodel/actions/select.actions
'
;
import
*
as
optionActions
from
'
src/app/metamodel/actions/select-option.actions
'
;
...
...
@@ -39,7 +38,6 @@ export class AdminComponent implements OnInit {
public
body
:
HTMLBodyElement
=
document
.
querySelector
(
'
body
'
);
public
links
=
[
{
label
:
'
Instances
'
,
icon
:
'
fas fa-object-group
'
,
routerLink
:
'
instance/instance-list
'
},
{
label
:
'
Surveys
'
,
icon
:
'
fas fa-table
'
,
routerLink
:
'
survey/survey-list
'
},
{
label
:
'
Databases
'
,
icon
:
'
fas fa-database
'
,
routerLink
:
'
database/database-list
'
},
{
label
:
'
Settings
'
,
icon
:
'
fas fa-wrench
'
,
routerLink
:
'
settings
'
}
];
...
...
@@ -59,7 +57,6 @@ export class AdminComponent implements OnInit {
this
.
favIcon
.
href
=
'
favicon.ico
'
;
this
.
title
.
innerHTML
=
'
ANIS - Admin
'
;
this
.
body
.
style
.
backgroundColor
=
'
white
'
;
Promise
.
resolve
(
null
).
then
(()
=>
this
.
store
.
dispatch
(
surveyActions
.
loadSurveyList
()));
Promise
.
resolve
(
null
).
then
(()
=>
this
.
store
.
dispatch
(
databaseActions
.
loadDatabaseList
()));
Promise
.
resolve
(
null
).
then
(()
=>
this
.
store
.
dispatch
(
selectActions
.
loadSelectList
()));
Promise
.
resolve
(
null
).
then
(()
=>
this
.
store
.
dispatch
(
optionActions
.
loadSelectOptionList
()));
...
...
client/src/app/admin/database/components/database-table.component.html
View file @
e6e53539
...
...
@@ -10,7 +10,6 @@
<th
scope=
"col"
>
Port
</th>
<th
scope=
"col"
>
Login
</th>
<th
scope=
"col"
>
Password
</th>
<th
scope=
"col"
>
Nb surveys
</th>
<th
scope=
"col"
>
Edit
</th>
<th
scope=
"col"
>
Delete
</th>
</tr>
...
...
@@ -25,7 +24,6 @@
<td
class=
"align-middle"
>
{{ database.dbport }}
</td>
<td
class=
"align-middle"
>
{{ database.dblogin }}
</td>
<td
class=
"align-middle"
>
*******
</td>
<td
class=
"align-middle"
>
{{ getNbSurveyByDatabase(database.id) }}
</td>
<td
class=
"align-middle"
>
<a
title=
"Edit this database"
routerLink=
"/admin/database/edit-database/{{database.id}}"
class=
"btn btn-outline-primary"
>
<span
class=
"fas fa-edit"
></span>
...
...
@@ -33,7 +31,6 @@
</td>
<td
class=
"align-middle"
>
<app-delete-btn
[disabled]=
"!isNoSurveyAttachedToDatabase(database.id)"
[type]=
"'database'"
[label]=
"database.label"
(confirm)=
"deleteDatabase.emit(database)"
>
...
...
client/src/app/admin/database/components/database-table.component.ts
View file @
e6e53539
...
...
@@ -9,7 +9,7 @@
import
{
Component
,
Input
,
Output
,
ChangeDetectionStrategy
,
EventEmitter
}
from
'
@angular/core
'
;
import
{
Database
,
Survey
}
from
'
src/app/metamodel/models
'
;
import
{
Database
}
from
'
src/app/metamodel/models
'
;
@
Component
({
selector
:
'
app-database-table
'
,
...
...
@@ -18,14 +18,5 @@ import { Database, Survey } from 'src/app/metamodel/models';
})
export
class
DatabaseTableComponent
{
@
Input
()
databaseList
:
Database
[];
@
Input
()
surveyList
:
Survey
[];
@
Output
()
deleteDatabase
:
EventEmitter
<
Database
>
=
new
EventEmitter
();
isNoSurveyAttachedToDatabase
(
idDatabase
:
number
):
boolean
{
return
this
.
getNbSurveyByDatabase
(
idDatabase
)
===
0
;
}
getNbSurveyByDatabase
(
idDatabase
:
number
):
number
{
return
this
.
surveyList
.
filter
(
p
=>
p
.
id_database
===
idDatabase
).
length
}
}
client/src/app/admin/database/containers/database-list.component.html
View file @
e6e53539
...
...
@@ -5,9 +5,9 @@
</ol>
</nav>
<app-spinner
*ngIf=
"
(surveyListIsLoading | async) ||
(databaseListIsLoading | async)"
></app-spinner>
<app-spinner
*ngIf=
"(databaseListIsLoading | async)"
></app-spinner>
<ng-container
*ngIf=
"
(surveyListIsLoaded | async) &&
(databaseListIsLoaded | async)"
>
<ng-container
*ngIf=
"(databaseListIsLoaded | async)"
>
<div
class=
"row"
>
<div
class=
"col-12"
>
<button
title=
"Add a new database"
class=
"btn btn-outline-success float-right"
routerLink=
"/admin/database/new-database"
>
...
...
@@ -19,8 +19,7 @@
<div
class=
"row mt-1"
>
<div
class=
"col-12"
>
<app-database-table
[databaseList]=
"databaseList | async"
[surveyList]=
"surveyList | async"
[databaseList]=
"databaseList | async"
(deleteDatabase)=
"deleteDatabase($event)"
>
</app-database-table>
</div>
...
...
client/src/app/admin/database/containers/database-list.component.ts
View file @
e6e53539
...
...
@@ -11,10 +11,9 @@ import { Component } from '@angular/core';
import
{
Observable
}
from
'
rxjs
'
;
import
{
Store
}
from
'
@ngrx/store
'
;
import
{
Database
,
Survey
}
from
'
src/app/metamodel/models
'
;
import
{
Database
}
from
'
src/app/metamodel/models
'
;
import
*
as
databaseActions
from
'
src/app/metamodel/actions/database.actions
'
;
import
*
as
databaseSelector
from
'
src/app/metamodel/selectors/database.selector
'
;
import
*
as
surveySelector
from
'
src/app/metamodel/selectors/survey.selector
'
;
@
Component
({
selector
:
'
app-database-list
'
,
...
...
@@ -24,17 +23,11 @@ export class DatabaseListComponent {
public
databaseListIsLoading
:
Observable
<
boolean
>
;
public
databaseListIsLoaded
:
Observable
<
boolean
>
;
public
databaseList
:
Observable
<
Database
[]
>
;
public
surveyListIsLoading
:
Observable
<
boolean
>
;
public
surveyListIsLoaded
:
Observable
<
boolean
>
;
public
surveyList
:
Observable
<
Survey
[]
>
;
constructor
(
private
store
:
Store
<
{
}
>
)
{
this
.
databaseListIsLoading
=
store
.
select
(
databaseSelector
.
selectDatabaseListIsLoading
);
this
.
databaseListIsLoaded
=
store
.
select
(
databaseSelector
.
selectDatabaseListIsLoaded
);
this
.
databaseList
=
store
.
select
(
databaseSelector
.
selectAllDatabases
);
this
.
surveyListIsLoading
=
store
.
select
(
surveySelector
.
selectSurveyListIsLoading
);
this
.
surveyListIsLoaded
=
store
.
select
(
surveySelector
.
selectSurveyListIsLoaded
);
this
.
surveyList
=
store
.
select
(
surveySelector
.
selectAllSurveys
);
}
deleteDatabase
(
database
:
Database
)
{
...
...
client/src/app/admin/instance/dataset/components/dataset/dataset-form.component.html
View file @
e6e53539
...
...
@@ -10,10 +10,10 @@
<input
type=
"text"
class=
"form-control"
id=
"label"
name=
"label"
formControlName=
"label"
>
</div>
<div
class=
"form-group"
>
<label
for=
"
survey_name"
>
Survey
</label>
<select
class=
"form-control"
id=
"
survey_name"
name=
"survey_nam
e"
formControlName=
"
survey_nam
e"
(change)=
"onChange
Survey
()"
>
<label
for=
"
id_database"
>
Database
</label>
<select
class=
"form-control"
id=
"
id_database"
name=
"id_databas
e"
formControlName=
"
id_databas
e"
(change)=
"onChange
Database
()"
>
<option></option>
<option
*ngFor=
"let
survey of surveyList"
[ngValue]=
"survey.name"
>
{{ survey
.label }}
</option>
<option
*ngFor=
"let
database of databaseList"
[ngValue]=
"database.id"
>
{{ database
.label }}
</option>
</select>
</div>
<div
class=
"form-group"
>
...
...
client/src/app/admin/instance/dataset/components/dataset/dataset-form.component.ts
View file @
e6e53539
...
...
@@ -10,7 +10,7 @@
import
{
Component
,
Input
,
Output
,
EventEmitter
,
OnInit
,
OnChanges
,
SimpleChanges
}
from
'
@angular/core
'
;
import
{
FormGroup
,
FormControl
,
Validators
}
from
'
@angular/forms
'
;
import
{
Instance
,
Dataset
,
Survey
,
DatasetFamily
,
Attribute
,
Imag
e
}
from
'
src/app/metamodel/models
'
;
import
{
Instance
,
Dataset
,
DatasetFamily
,
Databas
e
}
from
'
src/app/metamodel/models
'
;
import
{
FileInfo
}
from
'
src/app/admin/store/models
'
;
@
Component
({
...
...
@@ -20,7 +20,7 @@ import { FileInfo } from 'src/app/admin/store/models';
export
class
DatasetFormComponent
implements
OnInit
,
OnChanges
{
@
Input
()
instance
:
Instance
;
@
Input
()
dataset
:
Dataset
;
@
Input
()
surveyList
:
Survey
[];
@
Input
()
databaseList
:
Database
[];
@
Input
()
tableListIsLoading
:
boolean
;
@
Input
()
tableListIsLoaded
:
boolean
;
@
Input
()
tableList
:
string
[];
...
...
@@ -29,7 +29,7 @@ export class DatasetFormComponent implements OnInit, OnChanges {
@
Input
()
files
:
FileInfo
[];
@
Input
()
filesIsLoading
:
boolean
;
@
Input
()
filesIsLoaded
:
boolean
;
@
Output
()
change
Survey
:
EventEmitter
<
number
>
=
new
EventEmitter
();
@
Output
()
change
Database
:
EventEmitter
<
number
>
=
new
EventEmitter
();
@
Output
()
loadRootDirectory
:
EventEmitter
<
string
>
=
new
EventEmitter
();
@
Output
()
onSubmit
:
EventEmitter
<
Dataset
>
=
new
EventEmitter
();
...
...
@@ -43,7 +43,7 @@ export class DatasetFormComponent implements OnInit, OnChanges {
display
:
new
FormControl
(
''
,
[
Validators
.
required
]),
data_path
:
new
FormControl
(
''
),
public
:
new
FormControl
(
''
,
[
Validators
.
required
]),
survey_nam
e
:
new
FormControl
(
''
,
[
Validators
.
required
]),
id_databas
e
:
new
FormControl
(
''
,
[
Validators
.
required
]),
id_dataset_family
:
new
FormControl
(
''
,
[
Validators
.
required
]),
download_enabled
:
new
FormControl
(
true
),
download_json
:
new
FormControl
(
true
),
...
...
@@ -88,12 +88,12 @@ export class DatasetFormComponent implements OnInit, OnChanges {
}
}
onChange
Survey
()
{
const
surveyNam
e
=
this
.
form
.
controls
.
survey_nam
e
.
value
;
if
(
!
surveyNam
e
)
{
onChange
Database
()
{
const
idDatabas
e
=
this
.
form
.
controls
.
id_databas
e
.
value
;
if
(
!
idDatabas
e
)
{
this
.
form
.
controls
.
table_ref
.
disable
();
}
else
{
this
.
change
Survey
.
emit
(
this
.
surveyList
.
find
(
survey
=>
survey
.
name
===
surveyName
).
id_d
atabase
);
this
.
change
Database
.
emit
(
idD
atabase
);
}
}
...
...
client/src/app/admin/instance/dataset/containers/edit-dataset.component.html
View file @
e6e53539
...
...
@@ -15,18 +15,18 @@
</div>
<div
class=
"container"
>
<app-spinner
*ngIf=
"(
survey
ListIsLoading | async)
|| (datasetListIsLoading | async)
|| (datase
tFamily
ListIsLoading | async)"
></app-spinner>
<app-spinner
*ngIf=
"(
dataset
ListIsLoading | async)
|| (dataset
Family
ListIsLoading | async)
|| (data
ba
seListIsLoading | async)"
></app-spinner>
<div
*ngIf=
"(
survey
ListIsLoaded | async)
&& (datasetListIsLoaded | async)
&& (datase
tFamily
ListIsLoaded | async)"
class=
"row"
>
<div
*ngIf=
"(
dataset
ListIsLoaded | async)
&& (dataset
Family
ListIsLoaded | async)
&& (data
ba
seListIsLoaded | async)"
class=
"row"
>
<div
class=
"col-12"
>
<app-dataset-form
[instance]=
"instance | async"
[dataset]=
"datasetList | async | datasetByName:(datasetSelected | async)"
[
surveyList]=
"survey
List | async"
[
databaseList]=
"database
List | async"
[tableListIsLoading]=
"tableListIsLoading | async"
[tableListIsLoaded]=
"tableListIsLoaded | async"
[tableList]=
"tableList | async"
...
...
@@ -34,7 +34,7 @@
[files]=
"files | async"
[filesIsLoading]=
"filesIsLoading | async"
[filesIsLoaded]=
"filesIsLoaded | async"
(change
Survey
)=
"loadTableList($event)"
(change
Database
)=
"loadTableList($event)"
(loadRootDirectory)=
"loadRootDirectory($event)"
(onSubmit)=
"editDataset($event)"
#formDataset
>
...
...
client/src/app/admin/instance/dataset/containers/edit-dataset.component.ts
View file @
e6e53539
...
...
@@ -12,12 +12,10 @@ import { Component, OnInit } from '@angular/core';
import
{
Observable
}
from
'
rxjs
'
;
import
{
Store
}
from
'
@ngrx/store
'
;
import
{
Instance
,
Survey
,
DatasetFamily
,
Dataset
}
from
'
src/app/metamodel/models
'
;
import
{
Instance
,
DatasetFamily
,
Dataset
,
Database
}
from
'
src/app/metamodel/models
'
;
import
{
FileInfo
}
from
'
src/app/admin/store/models
'
;
import
*
as
datasetSelector
from
'
src/app/metamodel/selectors/dataset.selector
'
;
import
*
as
datasetActions
from
'
src/app/metamodel/actions/dataset.actions
'
;
import
*
as
attributeActions
from
'
src/app/metamodel/actions/attribute.actions
'
;
import
*
as
surveySelector
from
'
src/app/metamodel/selectors/survey.selector
'
;
import
*
as
tableActions
from
'
src/app/admin/store/actions/table.actions
'
;
import
*
as
tableSelector
from
'
src/app/admin/store/selectors/table.selector
'
;
import
*
as
datasetFamilySelector
from
'
src/app/metamodel/selectors/dataset-family.selector
'
;
...
...
@@ -25,6 +23,7 @@ import * as instanceSelector from 'src/app/metamodel/selectors/instance.selector
import
*
as
adminFileExplorerActions
from
'
src/app/admin/store/actions/admin-file-explorer.actions
'
;
import
*
as
adminFileExplorerSelector
from
'
src/app/admin/store/selectors/admin-file-explorer.selector
'
;
import
*
as
imageActions
from
'
src/app/metamodel/actions/image.actions
'
;
import
*
as
databaseSelector
from
'
src/app/metamodel/selectors/database.selector
'
;
@
Component
({
selector
:
'
app-edit-dataset
'
,
...
...
@@ -36,9 +35,9 @@ export class EditDatasetComponent implements OnInit {
public
datasetList
:
Observable
<
Dataset
[]
>
;
public
datasetListIsLoading
:
Observable
<
boolean
>
;
public
datasetListIsLoaded
:
Observable
<
boolean
>
;
public
surveyListIsLoading
:
Observable
<
boolean
>
;
public
survey
ListIsLoad
ed
:
Observable
<
boolean
>
;
public
surveyList
:
Observable
<
Survey
[]
>
;
public
databaseList
:
Observable
<
Database
[]
>
;
public
database
ListIsLoad
ing
:
Observable
<
boolean
>
;
public
databaseListIsLoaded
:
Observable
<
boolean
>
;
public
tableListIsLoading
:
Observable
<
boolean
>
;
public
tableListIsLoaded
:
Observable
<
boolean
>
;
public
tableList
:
Observable
<
string
[]
>
;
...
...
@@ -55,9 +54,9 @@ export class EditDatasetComponent implements OnInit {
this
.
datasetList
=
store
.
select
(
datasetSelector
.
selectAllDatasets
);
this
.
datasetListIsLoading
=
store
.
select
(
datasetSelector
.
selectDatasetListIsLoading
);
this
.
datasetListIsLoaded
=
store
.
select
(
datasetSelector
.
selectDatasetListIsLoaded
);
this
.
survey
ListIsLoading
=
store
.
select
(
survey
Selector
.
select
Survey
ListIsLoading
);
this
.
survey
ListIsLoaded
=
store
.
select
(
survey
Selector
.
select
Survey
ListIsLoaded
);
this
.
survey
List
=
store
.
select
(
survey
Selector
.
selectAll
Survey
s
);
this
.
database
ListIsLoading
=
store
.
select
(
database
Selector
.
select
Database
ListIsLoading
);
this
.
database
ListIsLoaded
=
store
.
select
(
database
Selector
.
select
Database
ListIsLoaded
);
this
.
database
List
=
store
.
select
(
database
Selector
.
selectAll
Database
s
);
this
.
tableListIsLoading
=
store
.
select
(
tableSelector
.
selectTableListIsLoading
);
this
.
tableListIsLoaded
=
store
.
select
(
tableSelector
.
selectTableListIsLoaded
);
this
.
tableList
=
store
.
select
(
tableSelector
.
selectAllTables
);
...
...
client/src/app/admin/instance/dataset/containers/new-dataset.component.html
View file @
e6e53539
...
...
@@ -15,13 +15,13 @@
</div>
<div
class=
"container"
>
<app-spinner
*ngIf=
"(
surve
yListIsLoading | async) || (datase
tFamily
ListIsLoading | async)"
></app-spinner>
<app-spinner
*ngIf=
"(
datasetFamil
yListIsLoading | async) || (data
ba
seListIsLoading | async)"
></app-spinner>
<div
*ngIf=
"(
surve
yListIsLoaded | async) && (datase
tFamily
ListIsLoaded | async)"
class=
"row"
>
<div
*ngIf=
"(
datasetFamil
yListIsLoaded | async) && (data
ba
seListIsLoaded | async)"
class=
"row"
>
<div
class=
"col-12"
>
<app-dataset-form
[instance]=
"instance | async"
[
surveyList]=
"survey
List | async"
[
databaseList]=
"database
List | async"
[tableListIsLoading]=
"tableListIsLoading | async"
[tableListIsLoaded]=
"tableListIsLoaded | async"
[tableList]=
"tableList | async"
...
...
@@ -30,7 +30,7 @@
[files]=
"files | async"
[filesIsLoading]=
"filesIsLoading | async"
[filesIsLoaded]=
"filesIsLoaded | async"
(change
Survey
)=
"loadTableList($event)"
(change
Database
)=
"loadTableList($event)"
(loadRootDirectory)=
"loadRootDirectory($event)"
(onSubmit)=
"addNewDataset($event)"
#formDataset
>
...
...
client/src/app/admin/instance/dataset/containers/new-dataset.component.ts
View file @
e6e53539
...
...
@@ -14,9 +14,8 @@ import { Observable } from 'rxjs';
import
{
map
}
from
'
rxjs/operators
'
;
import
{
Store
}
from
'
@ngrx/store
'
;
import
{
Instance
,
Survey
,
DatasetFamily
,
Dataset
}
from
'
src/app/metamodel/models
'
;
import
{
Instance
,
DatasetFamily
,
Dataset
,
Database
}
from
'
src/app/metamodel/models
'
;
import
{
FileInfo
}
from
'
src/app/admin/store/models
'
;
import
*
as
surveySelector
from
'
src/app/metamodel/selectors/survey.selector
'
;
import
*
as
tableActions
from
'
src/app/admin/store/actions/table.actions
'
;
import
*
as
tableSelector
from
'
src/app/admin/store/selectors/table.selector
'
;
import
*
as
datasetFamilySelector
from
'
src/app/metamodel/selectors/dataset-family.selector
'
;
...
...
@@ -24,6 +23,7 @@ import * as datasetActions from 'src/app/metamodel/actions/dataset.actions';
import
*
as
instanceSelector
from
'
src/app/metamodel/selectors/instance.selector
'
;
import
*
as
adminFileExplorerActions
from
'
src/app/admin/store/actions/admin-file-explorer.actions
'
;
import
*
as
adminFileExplorerSelector
from
'
src/app/admin/store/selectors/admin-file-explorer.selector
'
;
import
*
as
databaseSelector
from
'
src/app/metamodel/selectors/database.selector
'
;
@
Component
({
selector
:
'
app-new-dataset
'
,
...
...
@@ -31,9 +31,9 @@ import * as adminFileExplorerSelector from 'src/app/admin/store/selectors/admin-
})
export
class
NewDatasetComponent
implements
OnInit
{
public
instance
:
Observable
<
Instance
>
;
public
surveyListIsLoading
:
Observable
<
boolean
>
;
public
survey
ListIsLoad
ed
:
Observable
<
boolean
>
;
public
surveyList
:
Observable
<
Survey
[]
>
;
public
databaseList
:
Observable
<
Database
[]
>
;
public
database
ListIsLoad
ing
:
Observable
<
boolean
>
;
public
databaseListIsLoaded
:
Observable
<
boolean
>
;
public
tableListIsLoading
:
Observable
<
boolean
>
;
public
tableListIsLoaded
:
Observable
<
boolean
>
;
public
tableList
:
Observable
<
string
[]
>
;
...
...
@@ -47,9 +47,9 @@ export class NewDatasetComponent implements OnInit {
constructor
(
private
store
:
Store
<
{
}
>
,
private
route
:
ActivatedRoute
)
{
this
.
instance
=
store
.
select
(
instanceSelector
.
selectInstanceByRouteName
);
this
.
survey
ListIsLoading
=
store
.
select
(
survey
Selector
.
select
Survey
ListIsLoading
);
this
.
survey
ListIsLoaded
=
store
.
select
(
survey
Selector
.
select
Survey
ListIsLoaded
);
this
.
survey
List
=
store
.
select
(
survey
Selector
.
selectAll
Survey
s
);
this
.
database
ListIsLoading
=
store
.
select
(
database
Selector
.
select
Database
ListIsLoading
);
this
.
database
ListIsLoaded
=
store
.
select
(
database
Selector
.
select
Database
ListIsLoaded
);
this
.
database
List
=
store
.
select
(
database
Selector
.
selectAll
Database
s
);
this
.
tableListIsLoading
=
store
.
select
(
tableSelector
.
selectTableListIsLoading
);
this
.
tableListIsLoaded
=
store
.
select
(
tableSelector
.
selectTableListIsLoaded
);
this
.
tableList
=
store
.
select
(
tableSelector
.
selectAllTables
);
...
...
client/src/app/admin/survey/components/index.ts
deleted
100644 → 0
View file @
5b8358b1
/**
* This file is part of Anis Client.
*
* @copyright Laboratoire d'Astrophysique de Marseille / CNRS
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
import
{
SurveyTableComponent
}
from
"
./survey-table.component
"
;
import
{
SurveyFormComponent
}
from
"
./survey-form.component
"
;
export
const
dummiesComponents
=
[
SurveyTableComponent
,
SurveyFormComponent
];
client/src/app/admin/survey/components/survey-form.component.html
deleted
100644 → 0
View file @
5b8358b1
<form
[formGroup]=
"form"
(ngSubmit)=
"submit()"
novalidate
>
<div
class=
"form-group"
>
<label
for=
"name"
>
Name
</label>
<input
type=
"text"
class=
"form-control"
id=
"name"
name=
"name"
formControlName=
"name"
>
</div>
<div
class=
"form-group"
>
<label
for=
"label"
>
Label
</label>
<input
type=
"text"
class=
"form-control"
id=
"label"
name=
"label"
formControlName=
"label"
>
</div>
<div
class=
"form-group"
>
<label
for=
"id_database"
>
Database
</label>
<select
class=
"form-control"
id=
"id_database"
name=
"id_database"
formControlName=
"id_database"
>
<option></option>
<option
*ngFor=
"let database of databaseList"
[ngValue]=
"database.id"
>
{{database.label}}
</option>
</select>
</div>
<div
class=
"form-group"
>
<label
for=
"description"
>
Description
</label>
<textarea
class=
"form-control"
rows=
"5"
id=
"description"
name=
"description"
formControlName=
"description"
></textarea>
</div>
<div
class=
"form-group"
>
<div
class=
"row"
>
<div
class=
"col-md-6"
>
<label
for=
"link"
>
Link
</label>
<input
type=
"text"
class=
"form-control"
id=
"link"
name=
"link"
formControlName=
"link"
>
</div>
<div
class=
"col-md-6"
>
<strong>
Test it
</strong>
<br>
<p
style=
"margin-top: 13px;"
>
<a
[href]=
"form.controls.link.value"
target=
"_blank"
>
<span
class=
"fa fa-link"
></span>
{{ form.controls.link.value }}
</a>
</p>
</div>
</div>
</div>
<div
class=
"form-group"
>
<label
for=
"manager"
>
Manager
</label>
<input
type=
"text"
class=
"form-control"
id=
"manager"
name=
"manager"
formControlName=
"manager"
>
</div>
<div
class=
"form-group"
>
<ng-content></ng-content>
</div>
</form>
client/src/app/admin/survey/components/survey-form.component.ts
deleted
100644 → 0
View file @
5b8358b1
/**
* This file is part of Anis Client.
*
* @copyright Laboratoire d'Astrophysique de Marseille / CNRS
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
import
{
Component
,
Input
,
Output
,
EventEmitter
,
OnInit
}
from
'
@angular/core
'
;
import
{
FormGroup
,
FormControl
,
Validators
}
from
'
@angular/forms
'
;
import
{
Survey
,
Database
}
from
'
src/app/metamodel/models
'
;
@
Component
({
selector
:
'
app-survey-form
'
,
templateUrl
:
'
survey-form.component.html
'
})
export
class
SurveyFormComponent
implements
OnInit
{
@
Input
()
survey
:
Survey
;
@
Input
()
databaseList
:
Database
[];
@
Output
()
onSubmit
:
EventEmitter
<
Survey
>
=
new
EventEmitter
();
public
form
=
new
FormGroup
({
name
:
new
FormControl
(
''
,
[
Validators
.
required
]),
label
:
new
FormControl
(
''
,
[
Validators
.
required
]),
id_database
:
new
FormControl
(
''
,
[
Validators
.
required
]),
description
:
new
FormControl
(
''
,
[
Validators
.
required
]),
link
:
new
FormControl
(
''
,
[
Validators
.
required
]),
manager
:
new
FormControl
(
''
,
[
Validators
.
required
])
});
ngOnInit
()
{
if
(
this
.
survey
)
{
this
.
form
.
patchValue
(
this
.
survey
);
}
}
submit
()
{
if
(
this
.
survey
)
{
this
.
onSubmit
.
emit
({
...
this
.
survey
,
...
this
.
form
.
value
});
}
else
{
this
.
onSubmit
.
emit
(
this
.
form
.
value
);
}
}
}
client/src/app/admin/survey/components/survey-table.component.html
deleted
100644 → 0
View file @
5b8358b1
<div
class=
"table-responsive"
>
<table
class=
"table table-striped"
aria-describedby=
"Survey list"
>
<thead>
<tr>
<th
scope=
"col"
>
Name
</th>
<th
scope=
"col"
>
Label
</th>
<th
scope=
"col"
>
Description
</th>
<th
scope=
"col"
>
Link
</th>
<th
scope=
"col"
>
Manager
</th>
<th
scope=
"col"
>
Database
</th>
<th
scope=
"col"
>
Nb datasets
</th>
<th
scope=
"col"
>
Edit
</th>
<th
scope=
"col"
>
Delete
</th>
</tr>
</thead>
<tbody>
<tr
*ngFor=
"let survey of surveyList"
>
<td
class=
"align-middle"
>
{{ survey.name }}
</td>
<td
class=
"align-middle"
>
{{ survey.label }}
</td>
<td
class=
"align-middle"
>
{{ survey.description }}
</td>
<td
class=
"align-middle"
><a
[href]=
"survey.link"
target=
"_blank"
>
{{ survey.link }}
</a></td>
<td
class=
"align-middle"
>
{{ survey.manager }}
</td>
<td
class=
"align-middle"
>
{{ getDatabaseById(survey.id_database).label }}
</td>
<td
class=
"align-middle"
>
{{ survey.nb_datasets }}
</td>
<td
class=
"align-middle"
>
<a
title=
"Edit this survey"
routerLink=
"/admin/survey/edit-survey/{{survey.name}}"
class=
"btn btn-outline-primary"
>
<span
class=
"fas fa-edit"
></span>
</a>
</td>
<td
class=
"align-middle"
>
<app-delete-btn
[disabled]=
"survey.nb_datasets > 0"
[type]=
"'survey'"
[label]=
"survey.label"
(confirm)=
"deleteSurvey.emit(survey)"
>
</app-delete-btn>
</td>
</tr>
</tbody>
</table>
</div>
client/src/app/admin/survey/components/survey-table.component.ts
deleted
100644 → 0
View file @
5b8358b1
/**
* This file is part of Anis Client.
*
* @copyright Laboratoire d'Astrophysique de Marseille / CNRS
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
import
{
Component
,
Input
,
Output
,
ChangeDetectionStrategy
,
EventEmitter
}
from
'
@angular/core
'
;
import
{
Survey
,
Database
}
from
'
src/app/metamodel/models
'
;
@
Component
({
selector
:
'
app-survey-table
'
,
templateUrl
:
'
survey-table.component.html
'
,
changeDetection
:
ChangeDetectionStrategy
.
OnPush
})
export
class
SurveyTableComponent
{
@
Input
()
surveyList
:
Survey
[];
@
Input
()
databaseList
:
Database
[];
@
Output
()
deleteSurvey
:
EventEmitter
<
Survey
>
=
new
EventEmitter
();
getDatabaseById
(
idDatabase
:
number
):
Database
{
return
this
.
databaseList
.
find
(
database
=>
database
.
id
===
idDatabase
);
}
}
client/src/app/admin/survey/containers/edit-survey.component.html
deleted
100644 → 0
View file @
5b8358b1
<div
class=
"container-fluid"
>
<nav
aria-label=
"breadcrumb"
>
<ol
class=
"breadcrumb"
>
<li
class=
"breadcrumb-item"
><a
routerLink=
"/admin/survey/survey-list"
>
Surveys
</a></li>
<li
*ngIf=
"(surveyListIsLoaded | async)"
class=
"breadcrumb-item active"
aria-current=
"page"
>
Edit survey {{ (survey | async).name }}
</li>
</ol>
</nav>
</div>
<div
class=
"container"
>
<app-spinner
*ngIf=
"(databaseListIsLoading | async) || (surveyListIsLoading | async)"
></app-spinner>
<div
*ngIf=
"(databaseListIsLoaded | async) && (surveyListIsLoaded | async)"
class=
"row"
>
<div
class=
"col-12"
>
<app-survey-form
[survey]=
"survey | async"
[databaseList]=
"databaseList | async"
(onSubmit)=
"editSurvey($event)"
#formSurvey
>
<button
[disabled]=
"!formSurvey.form.valid || formSurvey.form.pristine"
type=
"submit"
class=
"btn btn-primary"
>
<span
class=
"fa fa-database"
></span>
Update survey information
</button>
<a
routerLink=
"/admin/survey/survey-list"
type=
"button"
class=
"btn btn-danger"
>
Cancel
</a>
</app-survey-form>