Revision 54932
Added by Panagiotis Kanakakis over 5 years ago
modules/uoa-repository-dashboard-gui/tags/release-1.0/src/app/pages/sources/sources-register.component.html | ||
---|---|---|
1 |
<div class="uk-grid-margin uk-grid uk-grid-stack" uk-grid=""> |
|
2 |
<div class="uk-width-1-1@m uk-first-column"> |
|
3 |
|
|
4 |
<h1 class="uk-h2">Register your datasource</h1> |
|
5 |
|
|
6 |
<!-- TOP HELP CONTENT --> |
|
7 |
<help-content #topHelperContent [position]="'top'" |
|
8 |
[ngClass]="topHelperContent.isPresent()?'uk-margin-medium-top uk-margin-medium-bottom':'clear-style'"> |
|
9 |
</help-content> |
|
10 |
|
|
11 |
<div class="uk-container uk-container-large uk-margin-medium-top uk-margin-medium-bottom"> |
|
12 |
<div class="uk-grid"> |
|
13 |
|
|
14 |
<!-- LEFT HELP CONTENT --> |
|
15 |
<aside-help-content #leftHelperContent [position]="'left'" |
|
16 |
[ngClass]="leftHelperContent.isPresent()?'tm-sidebar uk-width-1-4@m uk-first-column':'clear-style'"> |
|
17 |
</aside-help-content> |
|
18 |
|
|
19 |
<!-- MIDDLE --> |
|
20 |
<div class=" uk-width-expand@m"> |
|
21 |
|
|
22 |
<div> |
|
23 |
<div class="uk-margin uk-grid repositoryTypeSelection" uk-grid=""> |
|
24 |
<div class="uk-width-expand@m uk-width-1-2@s uk-grid-item-match uk-first-column"> |
|
25 |
<div class="uk-text-center uk-card uk-card-default uk-card-hover uk-scrollspy-inview uk-animation-slide-top-medium" uk-scrollspy-class=""> |
|
26 |
<a [routerLink]="['literature']" [queryParams]="{ step: 'selectDatasource' }" class="el-link uk-position-cover uk-margin-remove-adjacent"></a> |
|
27 |
<div class="uk-card-media-top"> |
|
28 |
<img class="el-image" src="../../../assets/imgs/Literature_repos_square.png" alt="" style="width: 100%;"> |
|
29 |
</div> |
|
30 |
<div class="uk-card-body"> |
|
31 |
<h3 class="el-title uk-margin uk-card-title uk-margin-remove-adjacent uk-margin-small-bottom"> |
|
32 |
Make sure your repository is already registered in OpenDOAR, the authoritative directory of institutional and thematic OA repositories. |
|
33 |
</h3> |
|
34 |
<div class="el-meta uk-margin uk-text-meta" style="z-index:9999; position:relative;"> |
|
35 |
<a href="http://v2.sherpa.ac.uk/opendoar/" target="_blank"> |
|
36 |
List provided by |
|
37 |
<br> |
|
38 |
OpenDOAR<i class="fa fa-external-link" style="margin-left: 3px !important;"></i> |
|
39 |
</a> |
|
40 |
</div> |
|
41 |
</div> |
|
42 |
</div> |
|
43 |
</div> |
|
44 |
<div class="uk-width-expand@m uk-width-1-2@s uk-grid-item-match"> |
|
45 |
<div class="uk-margin uk-text-center uk-card uk-card-default uk-card-hover uk-scrollspy-inview uk-animation-slide-top-medium" uk-scrollspy-class="" data-id="" style=""> |
|
46 |
<a [routerLink]="['data']" [queryParams]="{ step: 'selectDatasource' }" class="el-link uk-position-cover uk-margin-remove-adjacent" href=""></a> |
|
47 |
<div class="uk-card-media-top"> |
|
48 |
<img class="el-image" src="../../../assets/imgs/Data_repos_sqare.png" alt="" style="width:100%;"> |
|
49 |
</div> |
|
50 |
<div class="uk-card-body"> |
|
51 |
<h3 class="el-title uk-margin uk-card-title uk-margin-remove-adjacent uk-margin-small-bottom" > |
|
52 |
Make sure your data repository is registered in Re3Data, the global registry of research data repositories from different academic disciplines. |
|
53 |
</h3> |
|
54 |
<div class="el-meta uk-margin uk-text-meta" style="z-index:9999; position:relative;"> |
|
55 |
<a href="http://www.re3data.org" target="_blank"> |
|
56 |
List provided by |
|
57 |
<br> |
|
58 |
Re3data<i class="fa fa-external-link" style="margin-left: 3px !important;"></i> |
|
59 |
</a> |
|
60 |
</div> |
|
61 |
</div> |
|
62 |
</div> |
|
63 |
</div> |
|
64 |
<div class="uk-width-expand@m uk-width-1-2@s uk-grid-item-match"> |
|
65 |
<div class="uk-margin uk-text-center uk-card uk-card-default uk-card-hover uk-scrollspy-inview uk-animation-slide-top-medium" uk-scrollspy-class="" data-id="" style=""> |
|
66 |
<a [routerLink]="['journal']" [queryParams]="{ step: 'basicInformation' }" class="el-link uk-position-cover uk-margin-remove-adjacent"></a> |
|
67 |
<div class="uk-card-media-top"> |
|
68 |
<img class="el-image" src="../../../assets/imgs/OAJournals_square.png" alt="" style="width:100%;"> |
|
69 |
</div> |
|
70 |
<div class="uk-card-body"> |
|
71 |
<h3 class="el-title uk-margin uk-card-title uk-margin-remove-adjacent uk-margin-small-bottom"> |
|
72 |
Make sure that your Open Access Journal is compatible with the OpenAIRE literature Guidelines. |
|
73 |
</h3> |
|
74 |
<div class="el-meta uk-margin uk-text-meta" style="z-index:9999; position:relative;"> |
|
75 |
<a href="https://www.openaire.eu/helpdesk/" target="_blank"> |
|
76 |
For any questions please contact the OpenAIRE helpdesk. |
|
77 |
<i class="fa fa-external-link" style="margin-left: 3px !important;"></i> |
|
78 |
</a> |
|
79 |
</div> |
|
80 |
</div> |
|
81 |
</div> |
|
82 |
</div> |
|
83 |
<div class="uk-width-expand@m uk-width-1-2@s uk-grid-item-match"> |
|
84 |
<div class="uk-margin uk-text-center uk-card uk-card-default uk-card-hover uk-scrollspy-inview uk-animation-slide-top-medium" uk-scrollspy-class="" data-id="" style=""> |
|
85 |
<a [routerLink]="['aggregator']" [queryParams]="{ step: 'basicInformation' }" class="el-link uk-position-cover uk-margin-remove-adjacent"></a> |
|
86 |
<div class="uk-card-media-top"> |
|
87 |
<img class="el-image" src="../../../assets/imgs/Icons_Aggregators_square.png" alt="" style="width:100%;"> |
|
88 |
</div> |
|
89 |
<div class="uk-card-body"> |
|
90 |
<h3 class="el-title uk-margin uk-card-title uk-margin-remove-adjacent uk-margin-small-bottom"> |
|
91 |
Make sure that your publications aggregator is compatible with the OpenAIRE literature Guidelines. |
|
92 |
</h3> |
|
93 |
<div class="el-meta uk-margin uk-text-meta" style="z-index:9999; position:relative;"> |
|
94 |
<a href="http://www.openaire.eu/helpdesk/" target="_blank"> |
|
95 |
For any questions please contact the OpenAIRE helpdesk. |
|
96 |
<i class="fa fa-external-link" style="margin-left: 3px !important;"></i> |
|
97 |
</a> |
|
98 |
</div> |
|
99 |
</div> |
|
100 |
</div> |
|
101 |
</div> |
|
102 |
</div> |
|
103 |
<div class="uk-margin uk-grid repositoryTypeSelection" uk-grid=""> |
|
104 |
<div class="uk-width-expand@m uk-width-1-2@s uk-grid-item-match"> |
|
105 |
<div class="uk-margin uk-text-center uk-card uk-card-default uk-card-hover uk-scrollspy-inview uk-animation-slide-top-medium" uk-scrollspy-class="" data-id="" style=""> |
|
106 |
<a class="el-link uk-position-cover uk-margin-remove-adjacent"></a> |
|
107 |
<div class="uk-card-media-top"> |
|
108 |
<img class="el-image" src="../../../assets/imgs/CRIS_square_grey.png" alt="" style="width:100%;"> |
|
109 |
</div> |
|
110 |
<div class="uk-card-body"> |
|
111 |
<!--<h3 class="el-title uk-margin uk-card-title uk-margin-remove-adjacent uk-margin-small-bottom" > |
|
112 |
Make sure your data repository is registered in Re3Data, the global registry of research data repositories from different academic disciplines. |
|
113 |
</h3>--> |
|
114 |
<div class="el-meta uk-margin uk-text-meta" style="z-index:9999; position:relative;"> |
|
115 |
<a> |
|
116 |
Stay tuned |
|
117 |
</a> |
|
118 |
</div> |
|
119 |
</div> |
|
120 |
</div> |
|
121 |
</div> |
|
122 |
<div class="uk-width-expand@m uk-width-1-2@s uk-grid-item-match"> |
|
123 |
<div class="uk-margin uk-text-center uk-card uk-card-default uk-card-hover uk-scrollspy-inview uk-animation-slide-top-medium" uk-scrollspy-class="" data-id="" style=""> |
|
124 |
<a class="el-link uk-position-cover uk-margin-remove-adjacent"></a> |
|
125 |
<div class="uk-card-media-top"> |
|
126 |
<img class="el-image" src="../../../assets/imgs/Software_repos_square.png" alt="" style="width:100%;"> |
|
127 |
</div> |
|
128 |
<div class="uk-card-body"> |
|
129 |
<!--<h3 class="el-title uk-margin uk-card-title uk-margin-remove-adjacent uk-margin-small-bottom" > |
|
130 |
Catch-all repository registration |
|
131 |
</h3>--> |
|
132 |
<div class="el-meta uk-margin uk-text-meta" style="z-index:9999; position:relative;"> |
|
133 |
<a> |
|
134 |
Stay tuned |
|
135 |
</a> |
|
136 |
</div> |
|
137 |
</div> |
|
138 |
</div> |
|
139 |
</div> |
|
140 |
<div class="uk-width-expand@m uk-width-1-2@s uk-grid-item-match"> |
|
141 |
<div class="uk-margin uk-text-center uk-card uk-card-default uk-card-hover uk-scrollspy-inview uk-animation-slide-top-medium" uk-scrollspy-class="" data-id="" style=""> |
|
142 |
<a class="el-link uk-position-cover uk-margin-remove-adjacent"></a> |
|
143 |
<div class="uk-card-media-top"> |
|
144 |
<img class="el-image" src="../../../assets/imgs/Catch-all_repos_sqare.png" alt="" style="width:100%;"> |
|
145 |
</div> |
|
146 |
<div class="uk-card-body"> |
|
147 |
<!--<h3 class="el-title uk-margin uk-card-title uk-margin-remove-adjacent uk-margin-small-bottom" > |
|
148 |
Make sure your data repository is registered in Re3Data, the global registry of research data repositories from different academic disciplines. |
|
149 |
</h3>--> |
|
150 |
<div class="el-meta uk-margin uk-text-meta" style="z-index:9999; position:relative;"> |
|
151 |
<a> |
|
152 |
Stay tuned |
|
153 |
</a> |
|
154 |
</div> |
|
155 |
</div> |
|
156 |
</div> |
|
157 |
</div> |
|
158 |
<div class="uk-width-expand@m uk-width-1-2@s uk-grid-item-match"> |
|
159 |
<div class="uk-margin uk-text-center uk-card uk-card-default uk-card-hover uk-scrollspy-inview uk-animation-slide-top-medium" uk-scrollspy-class="" data-id="" style=""> |
|
160 |
<a class="el-link uk-position-cover uk-margin-remove-adjacent"></a> |
|
161 |
<div class="uk-card-media-top"> |
|
162 |
<img class="el-image" src="../../../assets/imgs/Other_Sources_square.png" alt="" style="width:100%;"> |
|
163 |
</div> |
|
164 |
<div class="uk-card-body uk-text-meta"> |
|
165 |
<!--<h3 class="el-title uk-margin uk-card-title uk-margin-remove-adjacent uk-margin-small-bottom" > |
|
166 |
Catch-all repository registration |
|
167 |
</h3>--> |
|
168 |
<div class="el-meta uk-margin uk-text-meta" style="z-index:9999; position:relative;"> |
|
169 |
<a> |
|
170 |
Stay tuned |
|
171 |
</a> |
|
172 |
</div> |
|
173 |
</div> |
|
174 |
</div> |
|
175 |
</div> |
|
176 |
</div> |
|
177 |
</div> |
|
178 |
|
|
179 |
</div> |
|
180 |
|
|
181 |
<!-- RIGHT HELP CONTENT --> |
|
182 |
<aside-help-content #rightHelperContent [position]="'right'" |
|
183 |
[ngClass]="rightHelperContent.isPresent()?'tm-sidebar uk-width-1-4@m uk-first-column':'clear-style'"> |
|
184 |
</aside-help-content> |
|
185 |
|
|
186 |
</div> |
|
187 |
</div> |
|
188 |
|
|
189 |
|
|
190 |
<!-- BOTTOM HELP CONTENT --> |
|
191 |
<help-content #bottomHelperContent [position]="'bottom'" |
|
192 |
[ngClass]="bottomHelperContent.isPresent()?'uk-margin-medium-top uk-margin-medium-bottom':'clear-style'"> |
|
193 |
</help-content> |
|
194 |
|
|
195 |
|
|
196 |
</div> |
|
197 |
</div> |
|
198 |
|
|
0 | 199 |
modules/uoa-repository-dashboard-gui/tags/release-1.0/src/app/pages/sources/sources.module.ts | ||
---|---|---|
1 |
/* |
|
2 |
* created by myrto |
|
3 |
*/ |
|
4 |
|
|
5 |
import { NgModule } from '@angular/core'; |
|
6 |
import { SourcesRouting } from './sources.routing'; |
|
7 |
import { SourcesComponent } from './sources.component'; |
|
8 |
import { SourcesRegisterComponent } from './sources-register.component'; |
|
9 |
import { CommonModule } from '@angular/common'; |
|
10 |
import { TabsModule } from 'ngx-bootstrap'; |
|
11 |
import { SourcesUpdateComponent } from './sources-update.component'; |
|
12 |
import { SrLiteratureComponent } from './sources-register/sr-literature.component'; |
|
13 |
import { ReusableComponentsModule } from '../../shared/reusablecomponents/reusable-components.module'; |
|
14 |
import { SourcesUpdateRepoComponent } from './sources-update-repo.component'; |
|
15 |
import { FormsModule, ReactiveFormsModule } from '@angular/forms'; |
|
16 |
import { RepoFilter } from './sourcesPipes'; |
|
17 |
import { DatasourceInterfaceFormComponent } from './sources-forms/datasource-interface-form.component'; |
|
18 |
import { DatasourceNewInterfaceFormComponent } from './sources-forms/datasource-new-interface-form.component'; |
|
19 |
import { SrDataComponent } from './sources-register/sr-data.component'; |
|
20 |
import { RegisterDatasourceSelectExistingComponent } from './sources-register/register-datasource-select-existing.component'; |
|
21 |
import { DatasourceUpdateFormComponent } from './sources-forms/datasource-update-form.component'; |
|
22 |
import { SrJournalComponent } from './sources-register/sr-journal.component'; |
|
23 |
import { SrAggregatorComponent } from './sources-register/sr-aggregator.component'; |
|
24 |
import { DatasourceCreateFormComponent } from './sources-forms/datasource-create-form.component'; |
|
25 |
import { RegisterNewDatasourceComponent } from './sources-register/register-new-datasource.component'; |
|
26 |
import { RegisterExistingDatasourceComponent } from './sources-register/register-existing-datasource.component'; |
|
27 |
|
|
28 |
@NgModule ({ |
|
29 |
imports: [ |
|
30 |
CommonModule, |
|
31 |
TabsModule.forRoot(), |
|
32 |
FormsModule, |
|
33 |
ReactiveFormsModule, |
|
34 |
SourcesRouting, |
|
35 |
ReusableComponentsModule |
|
36 |
], |
|
37 |
entryComponents : [ |
|
38 |
DatasourceInterfaceFormComponent |
|
39 |
], |
|
40 |
declarations: [ |
|
41 |
SourcesComponent, |
|
42 |
SourcesRegisterComponent, |
|
43 |
SourcesUpdateComponent, |
|
44 |
RegisterNewDatasourceComponent, |
|
45 |
RegisterExistingDatasourceComponent, |
|
46 |
SrLiteratureComponent, |
|
47 |
SrDataComponent, |
|
48 |
SrJournalComponent, |
|
49 |
SrAggregatorComponent, |
|
50 |
SourcesUpdateRepoComponent, |
|
51 |
RegisterDatasourceSelectExistingComponent, |
|
52 |
DatasourceUpdateFormComponent, |
|
53 |
DatasourceCreateFormComponent, |
|
54 |
DatasourceInterfaceFormComponent, |
|
55 |
DatasourceNewInterfaceFormComponent, |
|
56 |
RepoFilter // a pipe that searches for string in repository name |
|
57 |
] |
|
58 |
}) |
|
59 |
|
|
60 |
export class SourcesModule {} |
|
0 | 61 |
modules/uoa-repository-dashboard-gui/tags/release-1.0/src/app/pages/sources/sources-forms/datasource-interface-form.component.ts | ||
---|---|---|
1 |
import { Component, Injector, OnDestroy, OnInit } from '@angular/core'; |
|
2 |
import { MyGroup } from '../../../shared/reusablecomponents/forms/my-group.interface'; |
|
3 |
import { Validators } from '@angular/forms'; |
|
4 |
import { formErrorRequiredFields, formErrorWasntSaved, formInfoLoading, formSubmitting, formSuccessAddedInterface, |
|
5 |
formSuccessUpdatedInterface, invalidCustomBaseUrl, noServiceMessage } from '../../../domain/shared-messages'; |
|
6 |
import { ValidatorService } from '../../../services/validator.service'; |
|
7 |
import { RepositoryService } from '../../../services/repository.service'; |
|
8 |
import { InterfaceInformation, Repository, RepositoryInterface } from '../../../domain/typeScriptClasses'; |
|
9 |
import { baseUrlDesc, compatibilityLevelDesc, customValSetDesc, Description, existingValSetDesc } from '../../../domain/oa-description'; |
|
10 |
|
|
11 |
@Component ({ |
|
12 |
selector: 'datasource-interface-form', |
|
13 |
templateUrl: './datasource-interface-form.component.html' |
|
14 |
}) |
|
15 |
|
|
16 |
export class DatasourceInterfaceFormComponent extends MyGroup implements OnDestroy, OnInit { |
|
17 |
|
|
18 |
loadingMessage: string; |
|
19 |
successMessage: string; |
|
20 |
errorMessage: string; |
|
21 |
|
|
22 |
currentRepository: Repository; |
|
23 |
oldInterface: boolean; |
|
24 |
|
|
25 |
identifiedBaseUrl: boolean; |
|
26 |
existingValSet: boolean; |
|
27 |
interfaceInfo: InterfaceInformation; |
|
28 |
currentInterface: RepositoryInterface; |
|
29 |
valsetList: string[] = []; |
|
30 |
|
|
31 |
existingCompLevel: string; |
|
32 |
compClasses: Map<string, string> = new Map<string, string>(); |
|
33 |
classCodes: string[] = []; |
|
34 |
|
|
35 |
readonly groupDefinition = { |
|
36 |
baseUrl: ['', Validators.required], |
|
37 |
selectValidationSet: [''], |
|
38 |
customValidationSet: [''], |
|
39 |
compatibilityLevel: [''] |
|
40 |
}; |
|
41 |
baseUrlDesc: Description = baseUrlDesc; |
|
42 |
existingValSetDesc: Description = existingValSetDesc; |
|
43 |
customValSetDesc: Description = customValSetDesc; |
|
44 |
compatibilityLevelDesc: Description = compatibilityLevelDesc; |
|
45 |
|
|
46 |
constructor(injector: Injector, |
|
47 |
private valService: ValidatorService, |
|
48 |
private repoService: RepositoryService){ |
|
49 |
super(injector); |
|
50 |
} |
|
51 |
|
|
52 |
ngOnInit() { |
|
53 |
this.currentRepository = <Repository>this.otherData; |
|
54 |
console.log(`other data is: ${JSON.stringify(this.otherData, null, 2)}`); |
|
55 |
if (this.data && this.data.length) { |
|
56 |
this.currentInterface = this.data[0]; |
|
57 |
this.patchData.next({ |
|
58 |
baseUrl: this.data[0].baseUrl, |
|
59 |
selectValidationSet: '', |
|
60 |
customValidationSet: '', |
|
61 |
compatibilityLevel: this.data[0].desiredCompatibilityLevel |
|
62 |
}); |
|
63 |
this.getInterfaceInfo(this.data[0].baseUrl); |
|
64 |
this.data.splice(0, 1); |
|
65 |
this.oldInterface = true; |
|
66 |
console.log(`received an interface!`); |
|
67 |
/*if (this.interfaceInfo && this.interfaceInfo.identified && |
|
68 |
this.currentInterface.desiredCompatibilityLevel) { |
|
69 |
this.wasSaved = true; |
|
70 |
}*/ |
|
71 |
} |
|
72 |
|
|
73 |
/* initializes MyGroup parent component and the FormGroup */ |
|
74 |
super.ngOnInit(); |
|
75 |
console.log(this.group, this.parentGroup); |
|
76 |
this.getCompatibilityClasses(); |
|
77 |
|
|
78 |
/* NOT ANYMORE |
|
79 |
if (this.currentInterface) { |
|
80 |
this.getMyControl('baseUrl').disable(); |
|
81 |
} |
|
82 |
*/ |
|
83 |
this.existingValSet = true; |
|
84 |
this.getMyControl('customValidationSet').disable(); |
|
85 |
} |
|
86 |
|
|
87 |
chooseValSet(existingValSet: boolean) { |
|
88 |
if (existingValSet) { |
|
89 |
this.existingValSet = true; |
|
90 |
this.getMyControl('selectValidationSet').enable(); |
|
91 |
this.getMyControl('customValidationSet').disable(); |
|
92 |
} else { |
|
93 |
this.existingValSet = false; |
|
94 |
this.getMyControl('selectValidationSet').disable(); |
|
95 |
this.getMyControl('customValidationSet').enable(); |
|
96 |
} |
|
97 |
this.checkIfValid(); |
|
98 |
} |
|
99 |
|
|
100 |
getInterfaceInfo(baseUrl: string) { |
|
101 |
this.successMessage = ''; |
|
102 |
this.errorMessage = ''; |
|
103 |
this.groupErrorMessage = ''; |
|
104 |
if (baseUrl) { |
|
105 |
this.loadingMessage = formInfoLoading; |
|
106 |
this.valService.getInterfaceInformation(baseUrl).subscribe( |
|
107 |
info => { |
|
108 |
this.interfaceInfo = info; |
|
109 |
if (this.interfaceInfo.identified) { |
|
110 |
this.identifiedBaseUrl = true; |
|
111 |
} else { |
|
112 |
this.errorMessage = invalidCustomBaseUrl; |
|
113 |
} |
|
114 |
if (this.interfaceInfo.sets) { |
|
115 |
this.valsetList = this.interfaceInfo.sets; |
|
116 |
console.log(this.valsetList); |
|
117 |
} |
|
118 |
}, |
|
119 |
error => { |
|
120 |
console.log(error); |
|
121 |
this.loadingMessage = ''; |
|
122 |
this.identifiedBaseUrl = false; |
|
123 |
this.errorMessage = noServiceMessage; |
|
124 |
}, |
|
125 |
() => { |
|
126 |
if (this.interfaceInfo && this.interfaceInfo.identified && |
|
127 |
this.currentInterface && this.currentInterface.desiredCompatibilityLevel) { |
|
128 |
this.wasSaved = true; |
|
129 |
} |
|
130 |
if ( this.currentInterface && this.currentInterface.accessParams && this.currentInterface.accessParams['set'] ) { |
|
131 |
if ( this.valsetList.some( x => x === this.currentInterface.accessParams['set']) ) { |
|
132 |
this.patchData.next({selectValidationSet: this.currentInterface.accessParams['set']}); |
|
133 |
} else { |
|
134 |
this.patchData.next({customValidationSet: this.currentInterface.accessParams['set']}); |
|
135 |
this.getMyControl('selectValidationSet').enable(); |
|
136 |
this.getMyControl('customValidationSet').disable(); |
|
137 |
} |
|
138 |
} |
|
139 |
this.loadingMessage = ''; |
|
140 |
} |
|
141 |
); |
|
142 |
} |
|
143 |
} |
|
144 |
|
|
145 |
getCompatibilityClasses() { |
|
146 |
this.repoService.getCompatibilityClasses(this.currentRepository.datasourceType).subscribe( |
|
147 |
classes => { |
|
148 |
this.compClasses = classes; |
|
149 |
for (const key in this.compClasses) { |
|
150 |
this.classCodes.push(key); |
|
151 |
} |
|
152 |
}, |
|
153 |
error => { |
|
154 |
this.errorMessage = noServiceMessage; |
|
155 |
console.log(error); |
|
156 |
}, |
|
157 |
() => { |
|
158 |
if (this.currentInterface) { |
|
159 |
console.log(`accessParams is ${JSON.stringify(this.currentInterface.accessParams)}`); |
|
160 |
if ( !this.currentInterface.desiredCompatibilityLevel || |
|
161 |
!this.classCodes.some( x => x === this.currentInterface.desiredCompatibilityLevel ) ) { |
|
162 |
this.patchData.next({compatibilityLevel: ''}); |
|
163 |
this.existingCompLevel = this.currentInterface.desiredCompatibilityLevel; |
|
164 |
} else { |
|
165 |
this.existingCompLevel = this.compClasses[this.currentInterface.desiredCompatibilityLevel]; |
|
166 |
} |
|
167 |
if (this.group.valid ) { |
|
168 |
this.exportedData = this.currentInterface; |
|
169 |
} |
|
170 |
} |
|
171 |
|
|
172 |
} |
|
173 |
); |
|
174 |
} |
|
175 |
|
|
176 |
saveInterface() { |
|
177 |
this.groupErrorMessage = ''; |
|
178 |
this.errorMessage = ''; |
|
179 |
this.successMessage = ''; |
|
180 |
|
|
181 |
// if decided that valset is required add && this.checkIfValsetWasChosen() to the condition |
|
182 |
if (this.group.valid && this.checkIfCompatibilityLevelWasChosen() ) { |
|
183 |
if (this.identifiedBaseUrl) { |
|
184 |
const baseUrl = this.getMyControl('baseUrl').value; |
|
185 |
let valset = ''; |
|
186 |
if (this.getMyControl('selectValidationSet').enabled) { |
|
187 |
valset = this.getMyControl('selectValidationSet').value; |
|
188 |
} else { |
|
189 |
valset = this.getMyControl('customValidationSet').value; |
|
190 |
} |
|
191 |
let compLvl = ''; |
|
192 |
if (this.getMyControl('compatibilityLevel').value) { |
|
193 |
compLvl = this.getMyControl('compatibilityLevel').value; |
|
194 |
} else { |
|
195 |
compLvl = this.existingCompLevel; |
|
196 |
} |
|
197 |
|
|
198 |
|
|
199 |
if (this.currentInterface) { |
|
200 |
this.updateCurrent(baseUrl, valset, compLvl); |
|
201 |
} else { |
|
202 |
this.addCurrent(baseUrl, valset, compLvl); |
|
203 |
} |
|
204 |
} else { |
|
205 |
this.errorMessage = invalidCustomBaseUrl; |
|
206 |
} |
|
207 |
} else { |
|
208 |
this.errorMessage = formErrorRequiredFields; |
|
209 |
this.successMessage = ''; |
|
210 |
} |
|
211 |
} |
|
212 |
|
|
213 |
checkIfValsetWasChosen() { |
|
214 |
return ( ( this.getMyControl('selectValidationSet').enabled && |
|
215 |
this.getMyControl('selectValidationSet').value !== '' ) || |
|
216 |
( this.getMyControl('customValidationSet').enabled && |
|
217 |
this.getMyControl('customValidationSet').value !== '' ) ); |
|
218 |
} |
|
219 |
|
|
220 |
checkIfCompatibilityLevelWasChosen() { |
|
221 |
return ( (this.getMyControl('compatibilityLevel').value !== '') || |
|
222 |
(this.existingCompLevel && (this.existingCompLevel !== '')) ); |
|
223 |
} |
|
224 |
|
|
225 |
checkIfValid() { |
|
226 |
if (this.inRegister) { |
|
227 |
// if decided that valset is required add && this.checkIfValsetWasChosen() to the condition |
|
228 |
if ( this.group.valid && this.checkIfCompatibilityLevelWasChosen() ) { |
|
229 |
if ( this.identifiedBaseUrl ) { |
|
230 |
const baseUrl = this.getMyControl('baseUrl').value; |
|
231 |
|
|
232 |
let valset = ''; |
|
233 |
if (this.getMyControl('selectValidationSet').enabled) { |
|
234 |
valset = this.getMyControl('selectValidationSet').value; |
|
235 |
} else { |
|
236 |
valset = this.getMyControl('customValidationSet').value; |
|
237 |
} |
|
238 |
|
|
239 |
let compLvl = ''; |
|
240 |
if (this.getMyControl('compatibilityLevel').value) { |
|
241 |
this.existingCompLevel = this.compClasses[this.getMyControl('compatibilityLevel').value]; |
|
242 |
console.log('this.existingCompLevel is', this.existingCompLevel); |
|
243 |
compLvl = this.getMyControl('compatibilityLevel').value; |
|
244 |
} else { |
|
245 |
compLvl = this.existingCompLevel; |
|
246 |
} |
|
247 |
|
|
248 |
if (this.currentInterface) { |
|
249 |
this.updateCurrent(baseUrl, valset, compLvl); |
|
250 |
} else { |
|
251 |
this.addCurrent(baseUrl, valset, compLvl); |
|
252 |
} |
|
253 |
} |
|
254 |
} else { |
|
255 |
this.exportedData = null; |
|
256 |
this.wasSaved = false; |
|
257 |
this.successMessage = ''; |
|
258 |
} |
|
259 |
} |
|
260 |
} |
|
261 |
|
|
262 |
updateCurrent (baseUrl: string, valset: string, compLvl: string) { |
|
263 |
this.successMessage = ''; |
|
264 |
this.errorMessage = ''; |
|
265 |
this.currentInterface.baseUrl = baseUrl; |
|
266 |
this.currentInterface.accessSet = valset; |
|
267 |
this.currentInterface.accessParams['set'] = valset; |
|
268 |
this.currentInterface.desiredCompatibilityLevel = compLvl; |
|
269 |
this.currentInterface.compliance = compLvl; |
|
270 |
this.currentInterface.typology = this.currentRepository.datasourceClass; |
|
271 |
this.exportedData = this.currentInterface; |
|
272 |
if (!this.inRegister) { |
|
273 |
this.loadingMessage = formSubmitting; |
|
274 |
this.updateInterface(); |
|
275 |
} else { |
|
276 |
this.loadingMessage = ''; |
|
277 |
this.wasSaved = true; |
|
278 |
this.successMessage = 'The interface will be stored when the registration procedure is completed'; |
|
279 |
} |
|
280 |
} |
|
281 |
|
|
282 |
addCurrent (baseUrl: string, valset: string, compLvl: string) { |
|
283 |
this.errorMessage = ''; |
|
284 |
this.successMessage = ''; |
|
285 |
this.currentInterface = new RepositoryInterface(); |
|
286 |
this.currentInterface.baseUrl = baseUrl; |
|
287 |
this.currentInterface.accessSet = valset; |
|
288 |
this.currentInterface.accessParams = {'set': valset}; |
|
289 |
this.currentInterface.desiredCompatibilityLevel = compLvl; |
|
290 |
this.currentInterface.compliance = compLvl; |
|
291 |
this.currentInterface.typology = this.currentRepository.datasourceClass; |
|
292 |
this.exportedData = this.currentInterface; |
|
293 |
if (!this.inRegister) { |
|
294 |
this.loadingMessage = formSubmitting; |
|
295 |
this.addInterface(); |
|
296 |
} else { |
|
297 |
this.loadingMessage = ''; |
|
298 |
this.wasSaved = true; |
|
299 |
this.successMessage = 'The interface will be stored when the registration procedure is completed'; |
|
300 |
} |
|
301 |
} |
|
302 |
|
|
303 |
addInterface() { |
|
304 |
this.repoService.addInterface(this.currentRepository.datasourceType, |
|
305 |
this.currentRepository.id, |
|
306 |
this.currentRepository.registeredBy, |
|
307 |
this.currentInterface).subscribe( |
|
308 |
addedInterface => { |
|
309 |
console.log(`addInterface responded ${JSON.stringify(addedInterface)}`); |
|
310 |
this.currentInterface = addedInterface; |
|
311 |
}, |
|
312 |
error => { |
|
313 |
console.log(error); |
|
314 |
this.loadingMessage = ''; |
|
315 |
this.errorMessage = formErrorWasntSaved; |
|
316 |
this.currentInterface = null; |
|
317 |
}, |
|
318 |
() => { |
|
319 |
this.loadingMessage = ''; |
|
320 |
if (this.currentInterface.id) { |
|
321 |
this.successMessage = formSuccessAddedInterface; |
|
322 |
this.wasSaved = true; |
|
323 |
if ( !this.currentInterface.desiredCompatibilityLevel || |
|
324 |
!this.classCodes.some( x => x === this.currentInterface.desiredCompatibilityLevel ) ) { |
|
325 |
this.patchData.next({compatibilityLevel: ''}); |
|
326 |
this.existingCompLevel = this.currentInterface.desiredCompatibilityLevel; |
|
327 |
} else { |
|
328 |
this.existingCompLevel = this.compClasses[this.currentInterface.desiredCompatibilityLevel]; |
|
329 |
} |
|
330 |
} else { |
|
331 |
this.errorMessage = formErrorWasntSaved; |
|
332 |
} |
|
333 |
} |
|
334 |
); |
|
335 |
|
|
336 |
} |
|
337 |
|
|
338 |
updateInterface() { |
|
339 |
this.repoService.updateInterface(this.currentRepository.id, this.currentRepository.registeredBy, this.currentInterface).subscribe( |
|
340 |
response => { |
|
341 |
console.log(`updateRepository responded ${JSON.stringify(response)}`); |
|
342 |
if (response) { |
|
343 |
this.successMessage = formSuccessUpdatedInterface; |
|
344 |
this.wasSaved = true; |
|
345 |
} else { |
|
346 |
this.errorMessage = formErrorWasntSaved; |
|
347 |
} |
|
348 |
}, |
|
349 |
error => { |
|
350 |
console.log(error); |
|
351 |
this.loadingMessage = ''; |
|
352 |
this.errorMessage = formErrorWasntSaved; |
|
353 |
}, |
|
354 |
() => { |
|
355 |
this.loadingMessage = ''; |
|
356 |
if ( !this.currentInterface.desiredCompatibilityLevel || |
|
357 |
!this.classCodes.some( x => x === this.currentInterface.desiredCompatibilityLevel ) ) { |
|
358 |
this.patchData.next({compatibilityLevel: ''}); |
|
359 |
this.existingCompLevel = this.currentInterface.desiredCompatibilityLevel; |
|
360 |
} else { |
|
361 |
this.existingCompLevel = this.compClasses[this.currentInterface.desiredCompatibilityLevel]; |
|
362 |
} |
|
363 |
} |
|
364 |
); |
|
365 |
} |
|
366 |
|
|
367 |
ngOnDestroy() { |
|
368 |
if (this.currentInterface && this.currentInterface.id && this.toBeDeleted) { |
|
369 |
this.repoService.deleteInterface(this.currentInterface.id, this.currentRepository.registeredBy).subscribe( |
|
370 |
response => console.log(`deleteInterface responded: ${JSON.stringify(response)}`), |
|
371 |
error => console.log(error), |
|
372 |
() => console.log(`deleted ${this.currentInterface.id}`) |
|
373 |
); |
|
374 |
} else { |
|
375 |
console.log(`deleting empty interface form`); |
|
376 |
} |
|
377 |
} |
|
378 |
|
|
379 |
} |
|
0 | 380 |
modules/uoa-repository-dashboard-gui/tags/release-1.0/src/app/pages/compatibility/compatibility-validate-forms/compatibility-validate-step2.component.html | ||
---|---|---|
1 |
<div *ngIf="ruleSets" [formGroup]="group" class="form-group"> |
|
2 |
<div *ngFor="let set of ruleSets; let set_index = index"> |
|
3 |
<label class="btn btn-link" for="ruleSet_{{ set_index }}"> |
|
4 |
<input id="ruleSet_{{ set_index }}" |
|
5 |
value="{{ set.id }}" |
|
6 |
formControlName="ruleSet" |
|
7 |
name="ruleSet" |
|
8 |
type="radio" |
|
9 |
(change)="refreshLists()" |
|
10 |
[checked]="set_index == 0"> |
|
11 |
<span class="uk-margin-small-left">{{ set.name }}</span> |
|
12 |
</label> |
|
13 |
</div> |
|
14 |
<button class="uk-button uk-button-link" (click)="toggleShowRules()"> |
|
15 |
<span *ngIf="showRules"> |
|
16 |
<i class="fa fa-angle-up"></i> |
|
17 |
Hide Content and Usage Rules</span> |
|
18 |
<span *ngIf="!showRules"> |
|
19 |
<i class="fa fa-angle-down"></i> |
|
20 |
Show Content and Usage Rules</span> |
|
21 |
</button> |
|
22 |
<div *ngIf="showRules" class="uk-grid uk-animation-fade"> |
|
23 |
<div class="uk-width-expand@m uk-width-1-2@s uk-grid-item-match uk-first-column" formArrayName="contentRules"> |
|
24 |
<div class="margin10"> |
|
25 |
<div class="checkbox selectAll"> |
|
26 |
<label> |
|
27 |
<input type="checkbox" [checked]="selectedAllContentRules" (change)="toggleSelectAllContentRules()"> |
|
28 |
<span>Select / Deselect All Content Rules</span> |
|
29 |
</label> |
|
30 |
</div> |
|
31 |
<div *ngFor="let content of group.controls['contentRules'].controls; let content_index = index" class="checkbox"> |
|
32 |
<div [formGroupName]="content_index"> |
|
33 |
<label class="uk-link-muted small" for="contentRules_{{ content_index }}"> |
|
34 |
<input id="contentRules_{{ content_index }}" |
|
35 |
title="{{ currentContentRules[content_index].description }}" |
|
36 |
formControlName="rule" |
|
37 |
type="checkbox" |
|
38 |
(change)="onToggleCheckRule($event,'content')"> |
|
39 |
<span class="uk-margin-small-left">{{ currentContentRules[content_index].name }}</span> |
|
40 |
</label> |
|
41 |
</div> |
|
42 |
</div> |
|
43 |
</div> |
|
44 |
</div> |
|
45 |
<div class="uk-width-expand@m uk-width-1-2@s uk-grid-item-match uk-first-column" formArrayName="usageRules"> |
|
46 |
<div class="margin10"> |
|
47 |
<div class="checkbox selectAll"> |
|
48 |
<label> |
|
49 |
<input type="checkbox" [checked]="selectedAllUsageRules" (change)="toggleSelectAllUsageRules()"> |
|
50 |
<span>Select / Deselect All Usage Rules</span> |
|
51 |
</label> |
|
52 |
</div> |
|
53 |
<div *ngFor="let usage of group.controls['usageRules'].controls; let usage_index = index" class="checkbox"> |
|
54 |
<div [formGroupName]="usage_index"> |
|
55 |
<label class="uk-link-muted small" for="usageRules_{{ usage_index }}"> |
|
56 |
<input id="usageRules_{{ usage_index }}" |
|
57 |
value="{{ currentUsageRules[usage_index].id }}" |
|
58 |
title="{{ currentUsageRules[usage_index].description }}" |
|
59 |
formControlName="rule" |
|
60 |
type="checkbox" |
|
61 |
(change)="onToggleCheckRule($event,'usage')"> |
|
62 |
<span class="uk-margin-small-left">{{ currentUsageRules[usage_index].name }}</span> |
|
63 |
</label> |
|
64 |
</div> |
|
65 |
</div> |
|
66 |
</div> |
|
67 |
</div> |
|
68 |
</div> |
|
69 |
</div> |
|
0 | 70 |
modules/uoa-repository-dashboard-gui/tags/release-1.0/src/app/pages/sources/sources-forms/datasource-new-interface-form.component.ts | ||
---|---|---|
1 |
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; |
|
2 |
import { FormBuilder, FormGroup, Validators } from '@angular/forms'; |
|
3 |
import { baseUrlDesc, compatibilityLevelDesc, customValSetDesc, Description, existingValSetDesc } from '../../../domain/oa-description'; |
|
4 |
import { InterfaceInformation, RepositoryInterface } from '../../../domain/typeScriptClasses'; |
|
5 |
import { ValidatorService } from '../../../services/validator.service'; |
|
6 |
import { RepositoryService } from '../../../services/repository.service'; |
|
7 |
import { |
|
8 |
formErrorWasntSaved, |
|
9 |
formInfoLoading, formSubmitting, formSuccessAddedInterface, formSuccessUpdatedInterface, invalidCustomBaseUrl, |
|
10 |
nonRemovableInterface, |
|
11 |
noServiceMessage |
|
12 |
} from '../../../domain/shared-messages'; |
|
13 |
|
|
14 |
export class RepoFields { |
|
15 |
id: string; |
|
16 |
datasourceType: string; |
|
17 |
datasourceClass: string; |
|
18 |
registeredBy: string; |
|
19 |
} |
|
20 |
|
|
21 |
@Component({ |
|
22 |
selector: 'app-repository-interface-form', |
|
23 |
templateUrl: './datasource-new-interface-form.component.html' |
|
24 |
}) |
|
25 |
export class DatasourceNewInterfaceFormComponent implements OnInit { |
|
26 |
loadingMessage: string; |
|
27 |
successMessage: string; |
|
28 |
errorMessage: string; |
|
29 |
|
|
30 |
@Input() data: any[] = []; // expects an array containing at least 3 of the 4 below fields in this order |
|
31 |
inRegister: boolean; |
|
32 |
interfaceID: number; // holds the interface index in the interfaces array as displayed |
|
33 |
currentRepo: RepoFields; // a fraction of the Repository class |
|
34 |
currentInterface: RepositoryInterface; |
|
35 |
|
|
36 |
@Output() emitDeleteInterface: EventEmitter<number> = new EventEmitter<number>(); |
|
37 |
interfaceToExport: RepositoryInterface; |
|
38 |
|
|
39 |
repoInterfaceForm: FormGroup; |
|
40 |
readonly repoInterfaceFormDef = { |
|
41 |
baseUrl: ['', Validators.required], |
|
42 |
selectValidationSet: [''], |
|
43 |
customValidationSet: [''], |
|
44 |
compatibilityLevel: [''] |
|
45 |
}; |
|
46 |
baseUrlDesc: Description = baseUrlDesc; |
|
47 |
existingValSetDesc: Description = existingValSetDesc; |
|
48 |
customValSetDesc: Description = customValSetDesc; |
|
49 |
compatibilityLevelDesc: Description = compatibilityLevelDesc; |
|
50 |
|
|
51 |
identifiedBaseUrl: boolean; |
|
52 |
valsetList: string[] = []; |
|
53 |
existingCompLevel: string; |
|
54 |
classCodes: string[] = []; |
|
55 |
compClasses: Map<string, string> = new Map<string, string>(); |
|
56 |
existingValSet: boolean; |
|
57 |
interfaceInfo: InterfaceInformation; |
|
58 |
|
|
59 |
constructor(private fb: FormBuilder, |
|
60 |
private valService: ValidatorService, |
|
61 |
private repoService: RepositoryService) {} |
|
62 |
|
|
63 |
ngOnInit() { |
|
64 |
if (this.data && (this.data.length >= 3)) { |
|
65 |
this.inRegister = this.data[0]; |
|
66 |
this.interfaceID = this.data[1]; |
|
67 |
this.currentRepo = this.data[2]; |
|
68 |
this.repoInterfaceForm = this.fb.group(this.repoInterfaceFormDef); |
|
69 |
this.chooseValSet(true); |
|
70 |
if (this.data[3]) { |
|
71 |
this.currentInterface = this.data[3]; |
|
72 |
this.repoInterfaceForm.get('baseUrl').setValue(this.currentInterface.baseUrl); |
|
73 |
this.repoInterfaceForm.get('compatibilityLevel').setValue(this.currentInterface.desiredCompatibilityLevel); |
|
74 |
} |
|
75 |
this.getInterfaceInfo(); |
|
76 |
this.getCompatibilityClasses(); |
|
77 |
} |
|
78 |
} |
|
79 |
|
|
80 |
|
|
81 |
getInterfaceInfo() { |
|
82 |
this.successMessage = ''; |
|
83 |
this.errorMessage = ''; |
|
84 |
|
|
85 |
const baseUrl = this.repoInterfaceForm.get('baseUrl').value; |
|
86 |
if (baseUrl) { |
|
87 |
this.loadingMessage = formInfoLoading; |
|
88 |
this.valService.getInterfaceInformation(baseUrl).subscribe( |
|
89 |
info => { |
|
90 |
this.interfaceInfo = info; |
|
91 |
if (this.interfaceInfo.identified) { |
|
92 |
this.identifiedBaseUrl = true; |
|
93 |
} else { |
|
94 |
this.errorMessage = invalidCustomBaseUrl; |
|
95 |
} |
|
96 |
if (this.interfaceInfo.sets) { |
|
97 |
this.valsetList = this.interfaceInfo.sets; |
|
98 |
console.log(this.valsetList); |
|
99 |
} |
|
100 |
}, |
|
101 |
error => { |
|
102 |
console.log(error); |
|
103 |
this.loadingMessage = ''; |
|
104 |
this.identifiedBaseUrl = false; |
|
105 |
this.errorMessage = noServiceMessage; |
|
106 |
}, |
|
107 |
() => { |
|
108 |
if ( this.currentInterface && this.currentInterface.accessParams && this.currentInterface.accessParams['set'] ) { |
|
109 |
if ( this.valsetList.some( x => x === this.currentInterface.accessParams['set']) ) { |
|
110 |
this.repoInterfaceForm.get('selectValidationSet').setValue(this.currentInterface.accessParams['set']); |
|
111 |
} else { |
|
112 |
this.repoInterfaceForm.get('customValidationSet').setValue(this.currentInterface.accessParams['set']); |
|
113 |
} |
|
114 |
} |
|
115 |
this.loadingMessage = ''; |
|
116 |
this.repoInterfaceForm.updateValueAndValidity(); |
|
117 |
this.checkIfValid(); |
|
118 |
} |
|
119 |
); |
|
120 |
} |
|
121 |
} |
|
122 |
|
|
123 |
getCompatibilityClasses() { |
|
124 |
this.repoService.getCompatibilityClasses(this.currentRepo.datasourceType).subscribe( |
|
125 |
classes => { |
|
126 |
this.compClasses = classes; |
|
127 |
this.classCodes = Object.keys(this.compClasses); |
|
128 |
}, |
|
129 |
error => { |
|
130 |
this.errorMessage = noServiceMessage; |
|
131 |
console.log(error); |
|
132 |
}, |
|
133 |
() => { |
|
134 |
this.getExistingCompatibilityLevel(); |
|
135 |
this.repoInterfaceForm.updateValueAndValidity(); |
|
136 |
} |
|
137 |
); |
|
138 |
} |
|
139 |
|
|
140 |
getExistingCompatibilityLevel() { |
|
141 |
if (this.currentInterface) { |
|
142 |
if (this.currentInterface.desiredCompatibilityLevel && |
|
143 |
this.classCodes.some( x => x === this.currentInterface.desiredCompatibilityLevel ) ) { |
|
144 |
this.existingCompLevel = this.compClasses[this.currentInterface.desiredCompatibilityLevel]; |
|
145 |
} else { |
|
146 |
this.repoInterfaceForm.get('compatibilityLevel').setValue(''); |
|
147 |
this.existingCompLevel = this.currentInterface.desiredCompatibilityLevel; |
|
148 |
} |
|
149 |
} |
|
150 |
} |
|
151 |
|
|
152 |
chooseValSet(fromList: boolean) { |
|
153 |
this.existingValSet = fromList; |
|
154 |
if (this.existingValSet) { |
|
155 |
this.repoInterfaceForm.get('selectValidationSet').enable(); |
|
156 |
this.repoInterfaceForm.get('customValidationSet').disable(); |
|
157 |
} else { |
|
158 |
this.repoInterfaceForm.get('selectValidationSet').disable(); |
|
159 |
this.repoInterfaceForm.get('customValidationSet').enable(); |
|
160 |
} |
|
161 |
this.checkIfValid(); |
|
162 |
} |
|
163 |
|
|
164 |
checkIfCompatibilityLevelWasChosen() { |
|
165 |
return ( (this.repoInterfaceForm.get('compatibilityLevel').value !== '') || |
|
166 |
(this.existingCompLevel && (this.existingCompLevel !== '')) ); |
|
167 |
} |
|
168 |
|
|
169 |
formIsValid() { |
|
170 |
return (this.repoInterfaceForm.valid && |
|
171 |
this.identifiedBaseUrl && |
|
172 |
this.checkIfCompatibilityLevelWasChosen()); |
|
173 |
} |
|
174 |
|
|
175 |
checkIfValid() { |
|
176 |
if (this.formIsValid()) { |
|
177 |
if (this.inRegister) { |
|
178 |
this.successMessage = 'The interface will be stored when the registration procedure is completed'; |
|
179 |
this.saveInterface(); |
|
180 |
} |
|
181 |
} else { |
|
182 |
this.successMessage = ''; |
|
183 |
this.interfaceToExport = null; |
|
184 |
} |
|
185 |
|
|
186 |
} |
|
187 |
|
|
188 |
saveInterface() { |
|
189 |
this.errorMessage = ''; |
|
190 |
this.successMessage = ''; |
|
191 |
if (this.formIsValid()) { |
|
192 |
const baseUrl = this.repoInterfaceForm.get('baseUrl').value; |
|
193 |
let valset = ''; |
|
194 |
if (this.existingValSet) { |
|
195 |
valset = this.repoInterfaceForm.get('selectValidationSet').value; |
|
196 |
} else { |
|
197 |
valset = this.repoInterfaceForm.get('customValidationSet').value; |
|
198 |
} |
|
199 |
let compLvl = ''; |
|
200 |
if (this.repoInterfaceForm.get('compatibilityLevel').value) { |
|
201 |
this.existingCompLevel = this.compClasses[this.repoInterfaceForm.get('compatibilityLevel').value]; |
|
202 |
console.log('this.existingCompLevel is', this.existingCompLevel); |
|
203 |
compLvl = this.repoInterfaceForm.get('compatibilityLevel').value; |
|
204 |
} else { |
|
205 |
compLvl = this.existingCompLevel; |
|
206 |
} |
|
207 |
|
|
208 |
if (this.currentInterface) { |
|
209 |
this.updateCurrent(baseUrl, valset, compLvl); |
|
210 |
} else { |
|
211 |
this.addCurrent(baseUrl, valset, compLvl); |
|
212 |
} |
|
213 |
} else { |
|
214 |
this.interfaceToExport = null; |
|
215 |
} |
|
216 |
} |
|
217 |
|
|
218 |
addCurrent (baseUrl: string, valset: string, compLvl: string) { |
|
219 |
const currentInterface = new RepositoryInterface(); |
|
220 |
currentInterface.baseUrl = baseUrl; |
|
221 |
currentInterface.accessSet = valset; |
|
222 |
currentInterface.accessParams = {'set': valset}; |
|
223 |
currentInterface.desiredCompatibilityLevel = compLvl; |
|
224 |
currentInterface.compliance = compLvl; |
|
225 |
currentInterface.typology = this.currentRepo.datasourceClass; |
|
226 |
if (!this.inRegister) { |
|
227 |
this.addInterface(currentInterface); |
|
228 |
} else { |
|
229 |
this.successMessage = 'The interface will be stored when the registration procedure is completed'; |
|
230 |
console.log('SAVED !'); |
|
231 |
this.interfaceToExport = currentInterface; |
|
232 |
} |
|
233 |
} |
|
234 |
|
|
235 |
addInterface(newInterface: RepositoryInterface) { |
|
236 |
this.loadingMessage = formSubmitting; |
|
237 |
this.repoService.addInterface(this.currentRepo.datasourceType, |
|
238 |
this.currentRepo.id, |
|
239 |
this.currentRepo.registeredBy, |
|
240 |
newInterface).subscribe( |
|
241 |
addedInterface => { |
|
242 |
console.log(`addInterface responded ${JSON.stringify(addedInterface)}`); |
|
243 |
this.currentInterface = addedInterface; |
|
244 |
}, |
|
245 |
error => { |
|
246 |
console.log(error); |
|
247 |
this.loadingMessage = ''; |
|
248 |
this.errorMessage = formErrorWasntSaved; |
|
249 |
this.currentInterface = null; |
|
250 |
}, |
|
251 |
() => { |
|
252 |
this.loadingMessage = ''; |
|
253 |
if (this.currentInterface.id) { |
|
254 |
this.successMessage = formSuccessAddedInterface; |
|
255 |
this.getExistingCompatibilityLevel(); |
|
256 |
} else { |
|
257 |
this.errorMessage = formErrorWasntSaved; |
|
258 |
} |
|
259 |
} |
|
260 |
); |
|
261 |
|
|
262 |
} |
|
263 |
|
|
264 |
|
|
265 |
updateCurrent (baseUrl: string, valset: string, compLvl: string) { |
|
266 |
this.currentInterface.baseUrl = baseUrl; |
|
267 |
this.currentInterface.accessSet = valset; |
|
268 |
this.currentInterface.accessParams['set'] = valset; |
|
269 |
this.currentInterface.desiredCompatibilityLevel = compLvl; |
|
270 |
this.currentInterface.compliance = compLvl; |
|
271 |
this.currentInterface.typology = this.currentRepo.datasourceClass; |
|
272 |
|
|
273 |
if (!this.inRegister) { |
|
274 |
this.updateInterface(); |
|
275 |
} else { |
|
276 |
this.successMessage = 'The interface will be stored when the registration procedure is completed'; |
|
277 |
console.log('SAVED !'); |
|
278 |
this.interfaceToExport = this.currentInterface; |
|
279 |
} |
|
280 |
} |
|
281 |
|
|
282 |
updateInterface() { |
|
283 |
this.loadingMessage = formSubmitting; |
|
284 |
this.repoService.updateInterface(this.currentRepo.id, |
|
285 |
this.currentRepo.registeredBy, |
|
286 |
this.currentInterface).subscribe( |
|
287 |
response => { |
|
288 |
console.log(`updateRepository responded ${JSON.stringify(response)}`); |
|
289 |
if (response) { |
|
290 |
this.currentInterface = response; |
|
291 |
this.successMessage = formSuccessUpdatedInterface; |
|
292 |
} else { |
|
293 |
this.errorMessage = formErrorWasntSaved; |
|
294 |
} |
|
295 |
}, |
|
296 |
error => { |
|
297 |
console.log(error); |
|
298 |
this.loadingMessage = ''; |
|
299 |
this.errorMessage = formErrorWasntSaved; |
|
300 |
}, |
|
301 |
() => { |
|
302 |
this.loadingMessage = ''; |
|
303 |
this.getExistingCompatibilityLevel(); |
|
304 |
} |
|
305 |
); |
|
306 |
} |
|
307 |
|
|
308 |
removeInterface() { |
|
309 |
this.errorMessage = ''; |
|
310 |
this.successMessage = ''; |
|
311 |
if (this.interfaceID > 0) { |
|
312 |
if (this.currentInterface && (this.currentInterface.id !== null)) { |
|
313 |
this.repoService.deleteInterface(this.currentInterface.id, this.currentRepo.registeredBy).subscribe( |
|
314 |
res => console.log(`deleteInterface responded: ${JSON.stringify(res)}`), |
|
315 |
er => console.log(er), |
|
316 |
() => this.emitDeleteInterface.emit(this.interfaceID) |
|
317 |
); |
|
318 |
} else { |
|
319 |
this.emitDeleteInterface.emit(this.interfaceID); |
|
320 |
} |
|
321 |
} else { |
|
322 |
this.errorMessage = nonRemovableInterface; |
|
323 |
} |
|
324 |
} |
|
325 |
|
|
326 |
getInterface() { |
|
327 |
return this.interfaceToExport; |
|
328 |
} |
|
329 |
|
|
330 |
} |
modules/uoa-repository-dashboard-gui/tags/release-1.0/src/app/pages/sources/sources-update-repo.component.ts | ||
---|---|---|
1 |
import { Component, OnInit, QueryList, Type, ViewChild, ViewChildren } from '@angular/core'; |
|
2 |
import { FormBuilder, FormGroup } from '@angular/forms'; |
|
3 |
import { DatasourceInterfaceFormComponent } from './sources-forms/datasource-interface-form.component'; |
|
4 |
import { Repository, RepositoryInterface } from '../../domain/typeScriptClasses'; |
|
5 |
import { RepositoryService } from '../../services/repository.service'; |
|
6 |
import { ActivatedRoute, Router } from '@angular/router'; |
|
7 |
import { Description, interfaceFormDesc, } from '../../domain/oa-description'; |
|
8 |
import { formInfoLoading, loadingRepoError } from '../../domain/shared-messages'; |
|
9 |
import { DatasourceUpdateFormComponent } from './sources-forms/datasource-update-form.component'; |
|
10 |
import { ConfirmationDialogComponent } from '../../shared/reusablecomponents/confirmation-dialog.component'; |
|
11 |
import { AuthenticationService } from '../../services/authentication.service'; |
|
12 |
import { DatasourceNewInterfaceFormComponent } from './sources-forms/datasource-new-interface-form.component'; |
|
13 |
|
|
14 |
@Component ({ |
|
15 |
selector: 'sources-update-repo', |
|
16 |
templateUrl: 'sources-update-repo.component.html' |
|
17 |
}) |
|
18 |
|
|
19 |
export class SourcesUpdateRepoComponent implements OnInit { |
|
20 |
loadingMessage: string; |
|
21 |
errorMessage: string; |
|
22 |
|
|
23 |
repoId: string; |
|
24 |
logoURL: string; |
|
25 |
repo: Repository; |
|
26 |
repoInterfaces: RepositoryInterface[] = []; |
|
27 |
|
|
28 |
@ViewChild('datasourceUpdateForm') datasourceUpdateForm: DatasourceUpdateFormComponent; |
|
29 |
|
|
30 |
group: FormGroup; |
|
31 |
interfaceFormDesc: Description = interfaceFormDesc; |
|
32 |
updateDatasourceInterfaces: Type<any> = DatasourceInterfaceFormComponent; |
|
33 |
|
|
34 |
@ViewChildren('interfacesArray') interfacesArray: QueryList<DatasourceNewInterfaceFormComponent>; |
|
35 |
dataForInterfaceComp: any[] = []; |
|
36 |
|
|
37 |
isModalShown: boolean; |
|
38 |
@ViewChild('updateLogoUrlModal') |
|
39 |
public updateLogoUrlModal: ConfirmationDialogComponent; |
|
40 |
|
|
41 |
constructor ( private fb: FormBuilder, |
|
42 |
private repoService: RepositoryService, |
|
43 |
private authService: AuthenticationService, |
|
44 |
private route: ActivatedRoute, |
|
45 |
private router: Router) { } |
|
46 |
|
|
47 |
|
|
48 |
ngOnInit() { |
|
49 |
this.readRepoId(); |
|
50 |
} |
|
51 |
|
|
52 |
readRepoId() { |
|
53 |
this.repoId = this.route.snapshot.paramMap.get('id'); |
|
54 |
console.log(`repoId is ${this.repoId}`); |
|
55 |
this.getRepo(); |
|
56 |
} |
|
57 |
|
|
58 |
getRepo() { |
|
59 |
if (this.repoId) { |
|
60 |
this.loadingMessage = formInfoLoading; |
|
61 |
this.repoService.getRepositoryById(this.repoId).subscribe( |
|
62 |
repo => { |
|
63 |
this.repo = repo; |
|
64 |
}, |
|
65 |
error => { |
|
66 |
console.log(error); |
|
67 |
this.loadingMessage = ''; |
|
68 |
this.errorMessage = loadingRepoError; |
|
69 |
}, |
|
70 |
() => { |
|
71 |
if ( this.authService.activateFrontAuthorization && (this.authService.getUserEmail() !== this.repo.registeredBy.trim()) ) { |
|
72 |
this.router.navigateByUrl('/403-forbidden', { skipLocationChange: true }); |
|
73 |
} else { |
|
74 |
this.logoURL = this.repo.logoUrl; |
|
75 |
this.getRepoInterfaces(); |
|
76 |
} |
|
77 |
} |
|
78 |
); |
|
79 |
} |
|
80 |
} |
|
81 |
|
|
82 |
getRepoInterfaces() { |
|
83 |
this.group = this.fb.group({}); |
|
84 |
this.repoService.getRepositoryInterface(this.repoId).subscribe( |
|
85 |
interfaces => { |
|
86 |
this.repoInterfaces = interfaces.sort( function(a, b) { |
|
87 |
if (a.id < b.id) { |
|
88 |
return -1; |
|
89 |
} else if (a.id > b.id) { |
|
90 |
return 1; |
|
91 |
} else { |
|
92 |
return 0; |
|
93 |
} |
|
94 |
}); |
|
95 |
console.log(`the number of interfaces for ${this.repoId} is ${this.repoInterfaces.length}`); |
|
96 |
}, |
|
97 |
error => { |
|
98 |
console.log(error); |
|
99 |
this.loadingMessage = ''; |
|
100 |
this.errorMessage = loadingRepoError; |
|
101 |
}, |
|
102 |
() => { |
|
103 |
this.loadingMessage = ''; |
|
104 |
this.fillInterfacesForms(); |
|
105 |
} |
|
106 |
); |
|
107 |
} |
|
108 |
|
|
109 |
|
|
110 |
fillInterfacesForms() { |
|
111 |
this.dataForInterfaceComp = []; |
|
112 |
if (this.repoInterfaces && (this.repoInterfaces.length > 0)) { |
|
113 |
for (let i = 0; i < this.repoInterfaces.length; i++) { |
|
114 |
this.dataForInterfaceComp.push([ |
|
115 |
false, i, |
|
116 |
{ id: this.repo.id, |
|
117 |
datasourceType: this.repo.datasourceType, |
|
118 |
datasourceClass: this.repo.datasourceClass, |
|
119 |
registeredBy: this.repo.registeredBy |
|
120 |
}, |
|
121 |
this.repoInterfaces[i] |
|
122 |
]); |
|
123 |
} |
|
124 |
} else { |
|
125 |
this.dataForInterfaceComp.push([ |
|
126 |
false, 0, |
|
127 |
{ id: this.repo.id, |
|
128 |
datasourceType: this.repo.datasourceType, |
|
129 |
datasourceClass: this.repo.datasourceClass, |
|
130 |
registeredBy: this.repo.registeredBy |
|
131 |
} |
|
132 |
]); |
|
133 |
} |
|
134 |
} |
|
135 |
|
|
136 |
addInterfaceToList(intrf?: RepositoryInterface) { |
|
137 |
const curIndex = this.dataForInterfaceComp.length; |
|
138 |
const curRepoInfo = { id: this.repo.id, datasourceType: this.repo.datasourceType, |
|
139 |
datasourceClass: this.repo.datasourceClass, registeredBy: this.repo.registeredBy }; |
|
140 |
if (intrf) { |
|
141 |
this.dataForInterfaceComp.push([false, curIndex, curRepoInfo, intrf]); |
|
142 |
} else { |
|
143 |
this.dataForInterfaceComp.push([false, curIndex, curRepoInfo]); |
|
144 |
} |
|
145 |
} |
|
146 |
|
|
147 |
removeInterfaceFromList(i: number) { |
|
148 |
const tempArray = this.dataForInterfaceComp; |
|
149 |
this.dataForInterfaceComp = []; |
|
150 |
tempArray.splice(i, 1); |
|
151 |
this.dataForInterfaceComp = tempArray; |
|
152 |
console.log(JSON.stringify(this.dataForInterfaceComp)); |
|
153 |
} |
|
154 |
|
|
155 |
getInterfaces() { |
|
156 |
this.repoInterfaces = []; |
|
157 |
for (const el of this.interfacesArray.toArray()) { |
|
158 |
const intrf = el.getInterface(); |
|
159 |
if (intrf) { |
|
160 |
this.repoInterfaces.push(intrf); |
|
161 |
console.log(JSON.stringify(intrf)); |
|
162 |
} |
|
163 |
} |
|
164 |
console.log('new interfaces is ', this.repoInterfaces); |
|
165 |
} |
|
166 |
|
|
167 |
updateLogoUrl(logoUrl: string) { |
|
168 |
this.updateLogoUrlModal.ids = [logoUrl]; |
|
169 |
this.updateLogoUrlModal.showModal(); |
|
170 |
} |
|
171 |
|
|
172 |
updatedLogoUrl(event: any) { |
|
173 |
this.repo.logoUrl = this.logoURL; |
|
174 |
this.datasourceUpdateForm.updateGroup.get('logoUrl').setValue(this.logoURL); |
|
175 |
this.datasourceUpdateForm.updateRepo(); |
|
176 |
|
|
177 |
} |
|
178 |
|
|
179 |
getNewLogoUrl( event: any ) { |
|
180 |
this.logoURL = event.target.value; |
|
181 |
|
|
182 |
} |
|
183 |
|
|
184 |
} |
|
0 | 185 |
modules/uoa-repository-dashboard-gui/tags/release-1.0/src/app/pages/sources/sourcesPipes.ts | ||
---|---|---|
1 |
import { Pipe, PipeTransform } from '@angular/core'; |
|
2 |
import { RepositorySnippet } from '../../domain/typeScriptClasses'; |
|
3 |
|
|
4 |
@Pipe ({ |
|
5 |
name: 'repoFilter' |
|
6 |
}) |
|
7 |
|
|
8 |
export class RepoFilter implements PipeTransform { |
|
9 |
transform (items: RepositorySnippet[], searchTerm: string): any[] { |
|
10 |
if (!items) { return []; } |
|
11 |
if (!searchTerm) { return items; } |
|
12 |
|
|
13 |
searchTerm = searchTerm.trim(); |
|
14 |
searchTerm = searchTerm.toLowerCase(); |
|
15 |
|
|
16 |
return items.filter( |
|
17 |
repo => { |
|
18 |
return repo.officialname.toLowerCase().includes(searchTerm); |
|
19 |
} |
|
20 |
); |
|
21 |
} |
|
22 |
} |
|
23 |
|
|
0 | 24 |
modules/uoa-repository-dashboard-gui/tags/release-1.0/src/app/pages/sources/sources-update.component.ts | ||
---|---|---|
1 |
import { Component, OnInit } from '@angular/core'; |
|
2 |
|
|
3 |
@Component ({ |
|
4 |
selector: 'app-sources-update', |
|
5 |
templateUrl: 'sources-update.component.html' |
|
6 |
}) |
|
7 |
|
|
8 |
export class SourcesUpdateComponent implements OnInit { |
|
9 |
|
|
10 |
constructor() {} |
|
11 |
|
|
12 |
ngOnInit() {} |
|
13 |
|
|
14 |
downloadLogo() { |
|
15 |
window.open('../../../assets/imgs/OpenAIRE_validated_icon_medium.png', '_blank', 'enabledstatus=0,toolbar=0,menubar=0,location=0'); |
|
16 |
} |
|
17 |
} |
|
0 | 18 |
modules/uoa-repository-dashboard-gui/tags/release-1.0/src/app/pages/sources/sources-register.component.ts | ||
---|---|---|
1 |
/* |
|
2 |
* created by myrto |
|
3 |
*/ |
|
4 |
|
|
5 |
|
|
6 |
import { Component, OnInit } from '@angular/core'; |
|
7 |
|
|
8 |
@Component({ |
|
9 |
selector: 'app-sources-register', |
|
10 |
templateUrl: 'sources-register.component.html' |
|
11 |
}) |
|
12 |
|
|
13 |
export class SourcesRegisterComponent implements OnInit { |
|
14 |
|
|
15 |
constructor() { |
|
16 |
} |
|
17 |
|
|
18 |
ngOnInit() { |
|
19 |
} |
|
20 |
} |
|
0 | 21 |
modules/uoa-repository-dashboard-gui/tags/release-1.0/src/environments/environment.prod.ts | ||
---|---|---|
1 |
export const environment = { |
|
2 |
production: true, |
|
3 |
API_ENDPOINT: '/uoa-repository-manager-service', |
|
4 |
FAQ_ENDPOINT: '/api', |
|
5 |
FAQ_HOMEPAGE: '/uoa-admin-tools/' |
|
6 |
}; |
|
0 | 7 |
modules/uoa-repository-dashboard-gui/tags/release-1.0/src/environments/environment.ts | ||
---|---|---|
1 |
// This file can be replaced during build by using the `fileReplacements` array. |
|
2 |
// `ng build ---prod` replaces `environment.ts` with `environment.prod.ts`. |
|
3 |
// The list of file replacements can be found in `angular.json`. |
|
4 |
|
|
5 |
export const environment = { |
|
6 |
production: false, |
|
7 |
API_ENDPOINT: '/uoa-repository-manager-service', |
|
8 |
FAQ_ENDPOINT: 'http://audrey.athenarc.gr:5555/api', |
|
9 |
FAQ_HOMEPAGE: 'http://audrey.athenarc.gr:5555' |
|
10 |
}; |
|
11 |
|
|
12 |
/* |
|
13 |
* In development mode, to ignore zone related error stack frames such as |
|
14 |
* `zone.run`, `zoneDelegate.invokeTask` for easier debugging, you can |
|
15 |
* import the following file, but please comment it out in production mode |
|
16 |
* because it will have performance impact when throw error |
|
17 |
*/ |
|
18 |
// import 'zone.js/dist/zone-error'; // Included with Angular CLI. |
|
0 | 19 |
modules/uoa-repository-dashboard-gui/tags/release-1.0/src/app/pages/compatibility/compatibility-validate-forms/compatibility-validate-step3-cris.component.html | ||
---|---|---|
1 |
<div *ngIf="entitiesList" [formGroup]="group"> |
|
2 |
<div class="marginBottom20 uk-margin-top"> |
|
3 |
<div> |
|
4 |
<label>Cris Entities</label> |
|
5 |
</div> |
|
6 |
<div> |
|
7 |
<div class="margin10" formArrayName="entities"> |
|
8 |
<div class="checkbox selectAll"> |
|
9 |
<label> |
|
10 |
<input type="checkbox" [checked]="selectedAllEntities" (change)="toggleSelectAllContentRules()"> |
|
11 |
<span>Select / Deselect All Entities</span> |
|
12 |
</label> |
|
13 |
</div> |
|
14 |
<div *ngFor="let content of group.controls['entities'].controls; let i = index" class="checkbox"> |
|
15 |
<div [formGroupName]="i"> |
|
16 |
<label for="entity_{{ i }}"> |
|
17 |
<input id="entity_{{ i }}" |
|
18 |
formControlName="entity" |
|
19 |
type="checkbox" |
|
20 |
(change)="onToggleCheckEntity($event)"> |
|
21 |
<span class="uk-margin-small-left">{{ entitiesList[i] }}</span> |
|
22 |
</label> |
|
23 |
</div> |
|
24 |
</div> |
|
25 |
</div> |
|
26 |
</div> |
|
27 |
</div> |
|
28 |
<div class="marginBottom20"> |
|
29 |
<div> |
|
30 |
<label>Check Referential Integrity</label> |
|
31 |
</div> |
|
32 |
<div class="uk-grid form-inline"> |
|
33 |
<div class="uk-width-1-1"> |
|
34 |
<label class="btn btn-link" for="yes"> |
|
35 |
<input id="yes" |
|
36 |
name="referentialIntegrity" |
|
37 |
value="yes" |
|
38 |
checked |
|
39 |
type="radio"> <span class="uk-margin-small-left">Yes</span> |
|
40 |
</label> |
|
41 |
<label class="btn btn-link" for="no"> |
|
42 |
<input id="no" |
|
43 |
name="referentialIntegrity" |
|
44 |
value="no" |
|
45 |
type="radio"> <span class="uk-margin-small-left">No</span> |
|
46 |
</label> |
|
47 |
</div> |
|
48 |
</div> |
|
49 |
</div> |
|
50 |
</div> |
|
0 | 51 |
modules/uoa-repository-dashboard-gui/tags/release-1.0/src/polyfills.ts | ||
---|---|---|
1 |
/** |
|
2 |
* This file includes polyfills needed by Angular and is loaded before the app. |
|
3 |
* You can add your own extra polyfills to this file. |
|
4 |
* |
|
5 |
* This file is divided into 2 sections: |
Also available in: Unified diff
Release 1.0 of uoa-repository-manager dashboard