Revision 58412
Added by Andreas Mantas about 4 years ago
modules/uoa-repository-dashboard-gui/branches/new-ui/src/app/pages/repository/update/sources-update-repo.component.html | ||
---|---|---|
41 | 41 |
<div class="md-card-content uk-row-first"> |
42 | 42 |
<ul class="uk-tab" data-uk-tab="{connect:'#tabs_anim4', animation:'slide-left'}"> |
43 | 43 |
<li class="uk-active" aria-expanded="true"><a href="#">Update Information</a></li> |
44 |
<li aria-expanded="false" class=""><a href="#">Update Interfaces</a></li> |
|
44 |
<!-- <li aria-expanded="false" class=""><a href="#">Update Interfaces</a></li>--> |
|
45 |
<li aria-expanded="false" class=""><a href="#">Update Terms of Agreement</a></li> |
|
45 | 46 |
</ul> |
46 | 47 |
<ul id="tabs_anim4" class="uk-switcher uk-margin"> |
47 | 48 |
<li aria-hidden="false" class="uk-active" style="animation-duration: 200ms;"> |
... | ... | |
81 | 82 |
</div> |
82 | 83 |
</div> |
83 | 84 |
</li> |
85 |
<li class="el-item"> |
|
86 |
<div> |
|
87 |
<datasource-update-terms-form #updateTermsForm |
|
88 |
[selectedRepo]="repo" |
|
89 |
[showButton]=true |
|
90 |
(emittedUrl)="getNewLogoUrl($event)"></datasource-update-terms-form> |
|
91 |
</div> |
|
92 |
</li> |
|
84 | 93 |
</ul> |
85 | 94 |
</div> |
86 | 95 |
</div> |
modules/uoa-repository-dashboard-gui/branches/new-ui/src/app/pages/repository/update/sources-update-repo.component.ts | ||
---|---|---|
42 | 42 |
private sharedService: SharedService, |
43 | 43 |
private router: Router) { } |
44 | 44 |
|
45 |
@ViewChild('updateTermsForm') |
|
45 | 46 |
|
46 | 47 |
ngOnInit() { |
47 | 48 |
|
modules/uoa-repository-dashboard-gui/branches/new-ui/src/app/pages/repository/repository.module.ts | ||
---|---|---|
19 | 19 |
import {DashboardService} from "../../services/dashboard.service"; |
20 | 20 |
import { SharedService } from "../../services/shared.service"; |
21 | 21 |
import { SourcesUpdateRepoComponent } from "./update/sources-update-repo.component"; |
22 |
import {SourcesModule} from '../sources/sources.module'; |
|
22 | 23 |
|
23 | 24 |
@NgModule ({ |
24 |
imports: [ |
|
25 |
CommonModule, |
|
26 |
TabsModule.forRoot(), |
|
27 |
FormsModule, |
|
28 |
ReactiveFormsModule, |
|
29 |
// SourcesRouting, |
|
30 |
RepositoryRoutingModule, |
|
31 |
ReusableComponentsModule |
|
32 |
], |
|
25 |
imports: [ |
|
26 |
CommonModule, |
|
27 |
TabsModule.forRoot(), |
|
28 |
FormsModule, |
|
29 |
ReactiveFormsModule, |
|
30 |
// SourcesRouting, |
|
31 |
RepositoryRoutingModule, |
|
32 |
ReusableComponentsModule, |
|
33 |
SourcesModule |
|
34 |
], |
|
33 | 35 |
declarations: [ |
34 | 36 |
RepositoryComponent, |
35 | 37 |
DashboardComponent, |
modules/uoa-repository-dashboard-gui/branches/new-ui/src/app/pages/sources/sources-register/register-new-datasource.component.html | ||
---|---|---|
38 | 38 |
<li role="tab" class=" {{ (currentStep < 3) ? 'disabled' : '' }} {{ (currentStep == 3) ? 'current' : '' }}" aria-disabled="true"> |
39 | 39 |
<a id="wizard_advanced-t-2" href="#wizard_advanced-h-2" aria-controls="wizard_advanced-p-2"> |
40 | 40 |
<span class="number">3</span> |
41 |
<!-- ToU: uncomment this section --> |
|
42 |
<!--<span class="title">Terms of Use</span> |
|
43 |
</a> |
|
44 |
</li> |
|
45 |
<li role="tab" class=" {{ (currentStep < 4) ? 'disabled' : '' }} {{ (currentStep == 4) ? 'current' : '' }}" aria-disabled="true"> |
|
46 |
<a id="wizard_advanced-t-3" href="#wizard_advanced-h-3" aria-controls="wizard_advanced-p-2"> |
|
47 |
<span class="number">4</span>--> |
|
41 | 48 |
<span class="title">Finish</span> |
42 | 49 |
</a> |
43 | 50 |
</li> |
... | ... | |
54 | 61 |
<div *ngIf="errorMessage" class="uk-alert uk-alert-danger uk-margin-top">{{ errorMessage }}</div> |
55 | 62 |
|
56 | 63 |
<!-- first section --> |
57 |
<h3 id="wizard_advanced-h-0" tabindex="-1" class="title {{ (currentStep == 1) ? 'current' : '' }}">Select Repository</h3>
|
|
64 |
<h3 id="wizard_advanced-h-0" tabindex="-1" class="title {{ (currentStep == 1) ? 'current' : '' }}">Enter Information</h3>
|
|
58 | 65 |
<section id="wizard_advanced-p-0" role="tabpanel" aria-labelledby="wizard_advanced-h-0" |
59 | 66 |
class="body step-0 {{ (currentStep == 1) ? 'current' : '' }}" data-step="0" aria-hidden="false"> |
60 | 67 |
<!--<h2 class="heading_a">--> |
... | ... | |
70 | 77 |
</section> |
71 | 78 |
|
72 | 79 |
<!-- second section --> |
73 |
<h3 id="wizard_advanced-h-1" tabindex="-1" class="title {{ (currentStep == 2) ? 'current' : '' }}">Enter Information</h3>
|
|
80 |
<h3 id="wizard_advanced-h-1" tabindex="-1" class="title {{ (currentStep == 2) ? 'current' : '' }}">Add Interfaces</h3>
|
|
74 | 81 |
<section id="wizard_advanced-p-1" role="tabpanel" aria-labelledby="wizard_advanced-h-1" |
75 | 82 |
class="body step-1 {{ (currentStep == 2) ? 'current' : '' }}" data-step="1" aria-hidden="true"> |
76 | 83 |
<!--<h2 class="heading_a">--> |
... | ... | |
115 | 122 |
</section> |
116 | 123 |
|
117 | 124 |
<!-- third section --> |
118 |
<h3 id="wizard_advanced-h-2" tabindex="-1" class="title {{ (currentStep == 3) ? 'current' : '' }}">Add Interfaces</h3> |
|
125 |
<h3 id="wizard_advanced-h-2" tabindex="-1" class="title {{ (currentStep == 3) ? 'current' : '' }}">Finish</h3> |
|
126 |
<!-- ToU: replace line above with line below --> |
|
127 |
<!-- <h3 id="wizard_advanced-h-2" tabindex="-1" class="title {{ (currentStep == 3) ? 'current' : '' }}">Terms of Use</h3>--> |
|
119 | 128 |
<section id="wizard_advanced-p-2" role="tabpanel" aria-labelledby="wizard_advanced-h-2" |
120 | 129 |
class="body step-2 {{ (currentStep == 3) ? 'current' : '' }}" data-step="2" aria-hidden="true"> |
121 | 130 |
<div *ngIf="(currentStep === 3) && !loadingMessage" class="row openAIRECompliantLogoDownload"> |
131 |
<!-- ToU: delete line above and uncomment section below --> |
|
132 |
<!--<div *ngIf="(currentStep === 3) && !loadingMessage" class="uk-grid"> |
|
133 |
<datasource-update-terms-form #updateTermsForm |
|
134 |
[selectedRepo]="repo" |
|
135 |
[showButton]=false></datasource-update-terms-form> |
|
136 |
</div> |
|
137 |
</section> |
|
138 |
|
|
139 |
<!– fourth section –> |
|
140 |
<h3 id="wizard_advanced-h-3" tabindex="-1" class="title {{ (currentStep == 4) ? 'current' : '' }}">Finish</h3> |
|
141 |
<section id="wizard_advanced-p-3" role="tabpanel" aria-labelledby="wizard_advanced-h-3" |
|
142 |
class="body step-3 {{ (currentStep == 4) ? 'current' : '' }}" data-step="3" aria-hidden="true"> |
|
143 |
<div *ngIf="(currentStep === 4) && !loadingMessage" class="row openAIRECompliantLogoDownload">--> |
|
122 | 144 |
<div class="col-lg-12"> |
123 | 145 |
<div class="col-md-12"> |
124 | 146 |
<div> |
... | ... | |
155 | 177 |
</li> |
156 | 178 |
</ul> |
157 | 179 |
</div> |
180 |
<!-- ToU: replace above <div> with commented section below --> |
|
181 |
<!--<div *ngIf="currentStep != 4" class="actions clearfix"> |
|
182 |
<ul role="menu" aria-label="Pagination"> |
|
183 |
<li class="button_previous {{ (currentStep <= 1) ? 'disabled' : '' }}" aria-disabled="true"> |
|
184 |
<a (click)="moveBackAStep()" role="menuitem"><i class="material-icons"></i> Previous</a> |
|
185 |
</li> |
|
186 |
<li *ngIf="currentStep < 3" class="button_next" aria-hidden="false" aria-disabled="false"> |
|
187 |
<a (click)="moveAStep()" role="menuitem">Next<i class="material-icons"></i></a> |
|
188 |
</li> |
|
189 |
<li *ngIf="currentStep == 3" class="button_finish" aria-hidden="true"> |
|
190 |
<a (click)="moveAStep()" role="menuitem">Finish</a> |
|
191 |
</li> |
|
192 |
</ul> |
|
193 |
</div>--> |
|
158 | 194 |
</div> |
159 | 195 |
</form> |
160 | 196 |
</div> |
modules/uoa-repository-dashboard-gui/branches/new-ui/src/app/pages/sources/sources-register/register-existing-datasource.component.html | ||
---|---|---|
42 | 42 |
</a> |
43 | 43 |
</li> |
44 | 44 |
<li role="tab" class="last {{ (currentStep < 3) ? 'disabled' : '' }} {{ (currentStep == 3) ? 'current' : '' }}" aria-disabled="true"> |
45 |
<!-- ToU: replace above line with below line --> |
|
46 |
<!--<li role="tab" class=" {{ (currentStep < 3) ? 'disabled' : '' }} {{ (currentStep == 3) ? 'current' : '' }}" aria-disabled="true">--> |
|
45 | 47 |
<a id="wizard_advanced-t-3" href="#wizard_advanced-h-3" aria-controls="wizard_advanced-p-3"> |
46 | 48 |
<span class="number">4</span> |
49 |
<!-- ToU: uncomment this section --> |
|
50 |
<!--<span class="title">Terms of Use</span> |
|
51 |
</a> |
|
52 |
</li> |
|
53 |
<li role="tab" class="last {{ (currentStep < 4) ? 'disabled' : '' }} {{ (currentStep == 4) ? 'current' : '' }}" aria-disabled="true"> |
|
54 |
<a id="wizard_advanced-t-4" href="#wizard_advanced-h-4" aria-controls="wizard_advanced-p-4"> |
|
55 |
<span class="number">5</span>--> |
|
47 | 56 |
<span class="title">Finish</span> |
48 | 57 |
</a> |
49 | 58 |
</li> |
... | ... | |
123 | 132 |
|
124 | 133 |
<!-- fourth section --> |
125 | 134 |
<h3 id="wizard_advanced-h-3" tabindex="-1" class="title {{ (currentStep == 3) ? 'current' : '' }}">Finish</h3> |
135 |
<!-- ToU: replace line above with line below --> |
|
136 |
<!--<h3 id="wizard_advanced-h-3" tabindex="-1" class="title {{ (currentStep == 3) ? 'current' : '' }}">Terms of Use</h3>--> |
|
126 | 137 |
<section id="wizard_advanced-p-3" role="tabpanel" aria-labelledby="wizard_advanced-h-3" |
127 | 138 |
class="body step-3 {{ (currentStep == 3) ? 'current' : '' }}" data-step="2" aria-hidden="true"> |
128 | 139 |
|
129 | 140 |
<div *ngIf="(currentStep === 3) && !loadingMessage" class="row openAIRECompliantLogoDownload"> |
141 |
<!-- ToU: replace above 3 lines (starting at class="body step-3) with commented section below --> |
|
142 |
<!--class="body step-3 {{ (currentStep == 3) ? 'current' : '' }}" data-step="3" aria-hidden="true"> |
|
143 |
<div *ngIf="(currentStep === 3) && !loadingMessage" class="uk-grid uk-grid-match"> |
|
144 |
<datasource-update-terms-form #updateTermsForm |
|
145 |
[selectedRepo]="repo" |
|
146 |
[showButton]=false></datasource-update-terms-form> |
|
147 |
</div> |
|
148 |
</section> |
|
149 |
|
|
150 |
<!– fifth section –> |
|
151 |
<h3 id="wizard_advanced-h-4" tabindex="-1" class="title {{ (currentStep == 4) ? 'current' : '' }}">Finish</h3> |
|
152 |
<section id="wizard_advanced-p-4" role="tabpanel" aria-labelledby="wizard_advanced-h-4" |
|
153 |
class="body step-4 {{ (currentStep == 4) ? 'current' : '' }}" data-step="3" aria-hidden="true"> |
|
154 |
|
|
155 |
<div *ngIf="(currentStep === 4) && !loadingMessage" class="row openAIRECompliantLogoDownload">--> |
|
130 | 156 |
<div class="col-lg-12"> |
131 | 157 |
<div class="col-md-12"> |
132 | 158 |
<div> |
... | ... | |
158 | 184 |
</li> |
159 | 185 |
</ul> |
160 | 186 |
</div> |
187 |
<!-- ToU: replace above <div> with commented section below --> |
|
188 |
<!--<div *ngIf="currentStep != 4" class="actions clearfix"> |
|
189 |
<ul role="menu" aria-label="Pagination"> |
|
190 |
<li class="button_previous {{ (currentStep < 1) ? 'disabled' : '' }}" aria-disabled="true"> |
|
191 |
<a (click)="moveBackAStep()" role="menuitem"><i class="material-icons"></i> Previous</a> |
|
192 |
</li> |
|
193 |
<li *ngIf="currentStep < 3" class="button_next" aria-hidden="false" aria-disabled="false"> |
|
194 |
<a (click)="moveAStep()" role="menuitem">Next<i class="material-icons"></i></a> |
|
195 |
</li> |
|
196 |
<li *ngIf="currentStep == 3" class="button_finish" aria-hidden="true"> |
|
197 |
<a (click)="moveAStep()" role="menuitem">Finish</a> |
|
198 |
</li> |
|
199 |
</ul> |
|
200 |
</div>--> |
|
161 | 201 |
</div> |
162 | 202 |
</form> |
163 | 203 |
</div> |
modules/uoa-repository-dashboard-gui/branches/new-ui/src/app/pages/sources/sources-register/register-new-datasource.component.ts | ||
---|---|---|
49 | 49 |
private router: Router, |
50 | 50 |
private repoService: RepositoryService) {} |
51 | 51 |
|
52 |
// @ViewChild('updateTermsForm') |
|
53 |
|
|
52 | 54 |
ngOnInit() { |
53 | 55 |
if (this.datasourceType) { |
54 | 56 |
|
... | ... | |
76 | 78 |
} |
77 | 79 |
} else if (stepName === 'finish') { |
78 | 80 |
this.currentStep = 3; |
81 |
// ToU: to enable ToU delete the 2 lines above and uncomment the section below |
|
82 |
/*} else if (stepName === 'termsOfUse') { |
|
83 |
if (this.interfacesArray && this.interfacesArray.length === 0) { |
|
84 |
this.router.navigateByUrl(`/sources/register/${this.datasourceType}?step=basicInformation`); |
|
85 |
} else { |
|
86 |
this.currentStep = 3; |
|
87 |
} |
|
88 |
} else if (stepName === 'finish') { |
|
89 |
this.currentStep = 4;*/ |
|
79 | 90 |
} |
80 | 91 |
} |
81 | 92 |
this.rightHelperContent.ngOnInit(); |
... | ... | |
97 | 108 |
} else { |
98 | 109 |
if (this.repoInterfaces.length > 0) { |
99 | 110 |
this.addRepository(); |
111 |
// ToU: replace above line with the comment below |
|
112 |
// this.router.navigateByUrl(`/sources/register/${this.datasourceType}?step=termsOfUse`); |
|
100 | 113 |
} else { |
101 | 114 |
this.errorMessage = noInterfacesSaved; |
102 | 115 |
window.scrollTo(1, 1); |
... | ... | |
104 | 117 |
} |
105 | 118 |
} |
106 | 119 |
); |
120 |
// ToU: uncomment these lines |
|
121 |
// } else if ( this.currentStep === 3 ) { |
|
122 |
// this.addRepository(); |
|
107 | 123 |
} |
108 | 124 |
} |
109 | 125 |
|
... | ... | |
113 | 129 |
of(this.getInterfaces()).subscribe( |
114 | 130 |
() => this.router.navigateByUrl(`/sources/register/${this.datasourceType}?step=basicInformation`) |
115 | 131 |
); |
132 |
// ToU: uncomment these lines |
|
133 |
// } else if (this.currentStep === 3) { |
|
134 |
// this.router.navigateByUrl(`/sources/register/${this.datasourceType}?step=interfaces`); |
|
116 | 135 |
} |
117 | 136 |
} |
118 | 137 |
|
... | ... | |
207 | 226 |
}, |
208 | 227 |
() => { |
209 | 228 |
this.saveNewInterfaces(); |
229 |
// TODO: update terms when backend is ready, maybe POST with updateRepository |
|
210 | 230 |
} |
211 | 231 |
); |
212 | 232 |
} |
modules/uoa-repository-dashboard-gui/branches/new-ui/src/app/pages/sources/sources-register/register-existing-datasource.component.ts | ||
---|---|---|
64 | 64 |
private router: Router, |
65 | 65 |
private repoService: RepositoryService) {} |
66 | 66 |
|
67 |
// @ViewChild('updateTermsForm') |
|
68 |
|
|
67 | 69 |
ngOnInit() { |
68 | 70 |
if (this.datasourceType && this.currentMode) { |
69 | 71 |
// will execute getStep() every time there is a change in query params |
... | ... | |
94 | 96 |
} |
95 | 97 |
} else if (stepName === 'finish') { |
96 | 98 |
this.currentStep = 3; |
99 |
// ToU: to enable ToU delete the 2 lines above and uncomment the section below |
|
100 |
/*} else if (stepName === 'termsOfUse') { |
|
101 |
if (!this.interfacesArray) { |
|
102 |
this.router.navigateByUrl(`/sources/register/${this.datasourceType}?step=selectDatasource`); |
|
103 |
} else { |
|
104 |
this.currentStep = 3; |
|
105 |
} |
|
106 |
} else if (stepName === 'finish') { |
|
107 |
this.currentStep = 4;*/ |
|
97 | 108 |
} |
98 | 109 |
} |
99 | 110 |
this.rightHelperContent.ngOnInit(); |
... | ... | |
121 | 132 |
} else { |
122 | 133 |
if (this.repoInterfaces.length > 0) { |
123 | 134 |
this.registerRepository(); |
135 |
// ToU: replace above line with the comment below |
|
136 |
// this.router.navigateByUrl(`/sources/register/${this.datasourceType}?step=termsOfUse`); |
|
124 | 137 |
} else { |
125 | 138 |
this.errorMessage = noInterfacesSaved; |
126 | 139 |
window.scrollTo(1, 1); |
... | ... | |
128 | 141 |
} |
129 | 142 |
} |
130 | 143 |
); |
144 |
// ToU: uncomment these lines |
|
145 |
// } else if (this.currentStep === 3) { |
|
146 |
// this.registerRepository(); |
|
131 | 147 |
} |
132 | 148 |
} |
133 | 149 |
|
... | ... | |
142 | 158 |
of(this.getInterfaces()).subscribe( |
143 | 159 |
() => this.router.navigateByUrl(`/sources/register/${this.datasourceType}?step=basicInformation`) |
144 | 160 |
); |
161 |
// ToU: uncomment these lines |
|
162 |
// } else if (this.currentStep === 3) { |
|
163 |
// this.router.navigateByUrl(`/sources/register/${this.datasourceType}?step=interfaces`); |
|
145 | 164 |
} |
146 | 165 |
} |
147 | 166 |
|
... | ... | |
318 | 337 |
}, |
319 | 338 |
() => { |
320 | 339 |
this.saveNewInterfaces(); |
340 |
// TODO: update terms when backend is ready, maybe POST with updateRepository |
|
321 | 341 |
} |
322 | 342 |
); |
323 | 343 |
} |
modules/uoa-repository-dashboard-gui/branches/new-ui/src/app/pages/sources/sources.module.ts | ||
---|---|---|
14 | 14 |
import { SrAggregatorComponent } from './sources-register/sr-aggregator.component'; |
15 | 15 |
import { RegisterNewDatasourceComponent } from './sources-register/register-new-datasource.component'; |
16 | 16 |
import { RegisterExistingDatasourceComponent } from './sources-register/register-existing-datasource.component'; |
17 |
import { DatasourceUpdateTermsFormComponent } from '../../shared/reusablecomponents/sources-forms/datasource-update-terms-form.component'; |
|
17 | 18 |
|
18 | 19 |
@NgModule ({ |
19 | 20 |
imports: [ |
... | ... | |
24 | 25 |
SourcesRouting, |
25 | 26 |
ReusableComponentsModule |
26 | 27 |
], |
28 |
exports: [ |
|
29 |
DatasourceUpdateTermsFormComponent |
|
30 |
], |
|
27 | 31 |
declarations: [ |
28 | 32 |
SourcesComponent, |
29 | 33 |
SourcesRegisterComponent, |
... | ... | |
34 | 38 |
SrJournalComponent, |
35 | 39 |
SrAggregatorComponent, |
36 | 40 |
RegisterDatasourceSelectExistingComponent, |
41 |
DatasourceUpdateTermsFormComponent, |
|
37 | 42 |
RepoFilter // a pipe that searches for string in repository name |
38 | 43 |
] |
39 | 44 |
}) |
modules/uoa-repository-dashboard-gui/branches/new-ui/src/app/app.component.html | ||
---|---|---|
48 | 48 |
})(); |
49 | 49 |
</script>--> |
50 | 50 |
<!-- End Matomo Code --> |
51 |
|
|
52 |
|
|
53 |
<!--<!– Terms of Use (modal) –>--> |
|
54 |
<!--<confirmation-dialog #subscribeToTermsModal [title]=modalTitle [isModalShown]=isModalShown--> |
|
55 |
<!-- [confirmActionButton]=modalButton (emitObject)="updateTerms()">--> |
|
56 |
<!-- <form class="" [formGroup]="agreementForm">--> |
|
57 |
<!-- <div formArrayName="terms">--> |
|
58 |
<!-- <table class="table">--> |
|
59 |
<!-- <tr class="uk-text-nowrap">Do you agree with the <a href="https://zenodo.org/record/1446384#.XiGIAdmxU5n" target="_blank">terms of use</a>?</tr>--> |
|
60 |
<!-- <tbody>--> |
|
61 |
<!-- <tr class="el-item" *ngFor="let term of terms.controls; let i=index">--> |
|
62 |
<!--<!– {{term.get('accept').value}}–>--> |
|
63 |
<!-- <br> {{term.get('name').value}} <br>--> |
|
64 |
<!-- <div [formGroupName]="i">--> |
|
65 |
<!-- <label>--> |
|
66 |
<!-- <input id="i" type="checkbox" formControlName="accept"> Yes, I agree to the terms of use.--> |
|
67 |
<!-- </label>--> |
|
68 |
<!-- </div>--> |
|
69 |
<!-- </tr>--> |
|
70 |
<!-- </tbody>--> |
|
71 |
<!-- </table>--> |
|
72 |
<!-- </div>--> |
|
73 |
<!-- </form>--> |
|
74 |
<!-- <!– <pre>{{this.agreementForm.value | json}}</pre>–>--> |
|
75 |
<!--</confirmation-dialog>--> |
modules/uoa-repository-dashboard-gui/branches/new-ui/src/app/app.component.ts | ||
---|---|---|
1 |
import { Component, OnInit } from '@angular/core';
|
|
1 |
import {Component, OnInit, ViewChild} from '@angular/core';
|
|
2 | 2 |
import { NavigationEnd, Router, RoutesRecognized } from '@angular/router'; |
3 | 3 |
import { AuthenticationService } from './services/authentication.service'; |
4 | 4 |
import { environment } from '../environments/environment'; |
5 | 5 |
import { MatomoInjector, MatomoTracker } from 'ngx-matomo'; |
6 |
import { ConfirmationDialogComponent } from './shared/reusablecomponents/confirmation-dialog.component'; |
|
7 |
import { RepositoryService } from './services/repository.service'; |
|
8 |
import { RepositorySnippet } from './domain/typeScriptClasses'; |
|
9 |
import {FormBuilder, FormGroup, FormControl, FormArray} from '@angular/forms'; |
|
10 |
import {element} from 'protractor'; |
|
11 |
import {timestamp} from 'rxjs/operators'; |
|
6 | 12 |
|
7 | 13 |
@Component({ |
8 | 14 |
selector: 'oa-repo-manager', |
... | ... | |
10 | 16 |
styleUrls: ['./app.component.css'], |
11 | 17 |
}) |
12 | 18 |
export class AppComponent implements OnInit { |
19 |
reposOfUser: RepositorySnippet[] = []; |
|
20 |
modalTitle = 'Terms of Use'; |
|
21 |
isModalShown: boolean; |
|
22 |
modalButton = 'OK'; |
|
13 | 23 |
|
24 |
agreementForm = this.fb.group({ |
|
25 |
terms: this.fb.array([]) |
|
26 |
}); |
|
27 |
|
|
28 |
consentTermsOfUseDate: Date; |
|
29 |
|
|
30 |
@ViewChild('subscribeToTermsModal') |
|
31 |
public subscribeToTermsModal: ConfirmationDialogComponent; |
|
32 |
|
|
14 | 33 |
open: boolean = true; |
15 | 34 |
|
16 | 35 |
constructor(private router: Router, |
17 | 36 |
private authService: AuthenticationService, |
18 | 37 |
private matomoInjector: MatomoInjector, |
19 |
private matomoTracker: MatomoTracker) { |
|
38 |
private matomoTracker: MatomoTracker, |
|
39 |
private repositoryService: RepositoryService, |
|
40 |
private fb: FormBuilder) { |
|
20 | 41 |
|
21 | 42 |
console.log('21-06-2019. Fixed matomo to log userIds?'); |
22 | 43 |
|
... | ... | |
50 | 71 |
this.authService.tryLogin(); |
51 | 72 |
} |
52 | 73 |
|
74 |
getReposOfUser(): void { |
|
75 |
this.repositoryService.getRepositoriesOfUser() |
|
76 |
.subscribe( |
|
77 |
repos => { this.reposOfUser = repos; }, |
|
78 |
error => { console.log(error); }, |
|
79 |
() => { |
|
80 |
console.log(this.reposOfUser); |
|
81 |
this.reposOfUser.forEach( repo => { |
|
82 |
// TODO: change !repo.consentTermsOfUse check when it gets a non-null value |
|
83 |
if (this.authService.isLoggedIn && !repo.consentTermsOfUse) { |
|
84 |
this.addTerm(repo.officialname, repo.id, repo.consentTermsOfUse); |
|
85 |
this.isModalShown = true; |
|
86 |
} |
|
87 |
}); |
|
88 |
} |
|
89 |
); |
|
90 |
} |
|
91 |
|
|
92 |
updateTerms() { |
|
93 |
/* update consentTermsOfUse, consentTermsOfUseDate(?) |
|
94 |
depending on what value will consentTermsOfUse hold |
|
95 |
Also what type of consentTermsOfUse will be? boolean or string */ |
|
96 |
for (let i = 0; i < this.terms.length; i++) { |
|
97 |
const id = this.terms.controls[i].get('id').value; |
|
98 |
if (this.terms.controls[i].get('accept').value === true) { |
|
99 |
console.log(`Agreed to the Terms of Use for: `, id); |
|
100 |
} |
|
101 |
} |
|
102 |
this.consentTermsOfUseDate = new Date(Date.now()); |
|
103 |
console.log(this.consentTermsOfUseDate); |
|
104 |
console.log('will POST when backend is ready'); |
|
105 |
} |
|
106 |
|
|
53 | 107 |
ngOnInit() { |
54 | 108 |
this.router.events.subscribe((evt) => { |
55 | 109 |
if (!(evt instanceof NavigationEnd)) { |
... | ... | |
60 | 114 |
} |
61 | 115 |
window.scrollTo(0, 0); |
62 | 116 |
}); |
117 |
|
|
118 |
// this.getReposOfUser(); |
|
119 |
|
|
63 | 120 |
} |
64 | 121 |
|
122 |
addTerm(name: string, id: string, consent: string) { |
|
123 |
this.terms.push(this.newTerm(name, id, consent)); |
|
124 |
} |
|
125 |
|
|
126 |
newTerm(name: string, id: string, consent: string): FormGroup { |
|
127 |
return this.fb.group({ |
|
128 |
id: [id], |
|
129 |
name: [name], |
|
130 |
accept: [(consent ? consent : true)] |
|
131 |
}); |
|
132 |
} |
|
133 |
|
|
134 |
get terms() { |
|
135 |
return this.agreementForm.get('terms') as FormArray; |
|
136 |
} |
|
137 |
|
|
65 | 138 |
isLandingRoute() { |
66 | 139 |
// console.log('Is home route? Route is: ' + this.router.url); |
67 | 140 |
return (this.router.url === '/') || (this.router.url === '/home') || (this.router.url === '/about'); |
modules/uoa-repository-dashboard-gui/branches/new-ui/src/app/shared/reusablecomponents/forms/my-group.interface.ts | ||
---|---|---|
120 | 120 |
selector : 'form-inline', |
121 | 121 |
template : ` |
122 | 122 |
<div class=""> |
123 |
<label class="" *ngIf="description.label != ''" |
|
123 |
<label class="" *ngIf="description.label !== null && description.label !== ''"
|
|
124 | 124 |
[ngClass]="{'required' : description.mandatory==true}" title="{{ description.desc }}"> |
125 | 125 |
{{ description.label }} |
126 | 126 |
</label> |
modules/uoa-repository-dashboard-gui/branches/new-ui/src/app/shared/reusablecomponents/sources-forms/datasource-update-terms-form.component.html | ||
---|---|---|
1 |
<div *ngIf="loadingMessage" class="loading-big"> |
|
2 |
<div class="loader-big" style="text-align: center; padding-top: 170px; color: rgb(47, 64, 80); font-weight: bold;"> |
|
3 |
{{ loadingMessage }} |
|
4 |
</div> |
|
5 |
<div class="whiteFilm"></div> |
|
6 |
</div> |
|
7 |
<div *ngIf="errorMessage" class="uk-alert uk-alert-danger">{{ errorMessage }}</div> |
|
8 |
<div *ngIf="successMessage" class="uk-alert uk-alert-success">{{ successMessage }}</div> |
|
9 |
|
|
10 |
<form *ngIf="selectedRepo && !loadingMessage" [formGroup]="agreementForm"> |
|
11 |
<br> |
|
12 |
<!-- {{agreementForm.get('acceptTerms').value}}--> |
|
13 |
<form-inline> |
|
14 |
<label><input formControlName="acceptTerms" class="uk-checkbox" type="checkbox" checked> I Agree with the </label> |
|
15 |
<a href="https://zenodo.org/record/1446384#.XiGIAdmxU5n" target="_blank">OpenAIRE's Terms of Agreement for Content Providers</a> |
|
16 |
</form-inline> |
|
17 |
<!-- {{agreementForm.get('optOut').value}}--> |
|
18 |
<form-inline> |
|
19 |
<label><input formControlName="optOut" class="uk-checkbox" type="checkbox"> I would like to opt out from "data mining of Open Access publications in my repository"</label> |
|
20 |
</form-inline> |
|
21 |
<br> |
|
22 |
<div *ngIf="showButton" class="form-group"> |
|
23 |
<button class="uk-button uk-button-primary updateRepoInfoButton" type="button" (click)="updateRepo()">Update Information</button> |
|
24 |
</div> |
|
25 |
</form> |
modules/uoa-repository-dashboard-gui/branches/new-ui/src/app/shared/reusablecomponents/sources-forms/datasource-update-terms-form.component.ts | ||
---|---|---|
1 |
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; |
|
2 |
import { formErrorRequiredFields, formErrorWasntSaved, formSubmitting, formSuccessUpdatedRepo, loadingRepoError, |
|
3 |
loadingRepoMessage, noServiceMessage } from '../../../domain/shared-messages'; |
|
4 |
import { RepositoryService } from '../../../services/repository.service'; |
|
5 |
import {AbstractControl, FormArray, FormBuilder, FormGroup, Validators} from '@angular/forms'; |
|
6 |
import { Country, Repository, RepositorySnippet, Timezone, Typology } from '../../../domain/typeScriptClasses'; |
|
7 |
import { Description, softwarePlatformDesc, platformNameDesc, officialNameDesc, repoDescriptionDesc, countryDesc, |
|
8 |
longtitudeDesc, latitudeDesc, websiteUrlDesc, institutionNameDesc, englishNameDesc, logoUrlDesc, timezoneDesc, |
|
9 |
datasourceTypeDesc, adminEmailDesc, lissnDesc, eissnDesc, issnDesc } from '../../../domain/oa-description'; |
|
10 |
import { AuthenticationService } from '../../../services/authentication.service'; |
|
11 |
import {Router} from '@angular/router'; |
|
12 |
|
|
13 |
@Component ({ |
|
14 |
selector: 'datasource-update-terms-form', |
|
15 |
templateUrl: './datasource-update-terms-form.component.html' |
|
16 |
}) |
|
17 |
|
|
18 |
export class DatasourceUpdateTermsFormComponent implements OnInit { |
|
19 |
|
|
20 |
agreementForm = this.fb.group({ |
|
21 |
acceptTerms: '', |
|
22 |
optOut: '' |
|
23 |
}); |
|
24 |
|
|
25 |
consentTermsOfUseDate: Date; |
|
26 |
|
|
27 |
errorMessage: string; |
|
28 |
successMessage: string; |
|
29 |
loadingMessage: string; |
|
30 |
|
|
31 |
/* in sources/register (in literature or data mode) the updated repository is emitted */ |
|
32 |
@Output() emittedInfo: EventEmitter<Repository> = new EventEmitter(); |
|
33 |
|
|
34 |
@Input() selectedRepo: Repository; |
|
35 |
|
|
36 |
@Input() showButton: boolean; |
|
37 |
|
|
38 |
repoId: string; |
|
39 |
formSubmitted = false; |
|
40 |
// updateGroup: FormGroup; |
|
41 |
termsTick: boolean; |
|
42 |
dataMiningTick: boolean; |
|
43 |
readonly updateGroupDefinition = { |
|
44 |
softwarePlatform : '' |
|
45 |
}; |
|
46 |
|
|
47 |
constructor( |
|
48 |
private fb: FormBuilder, |
|
49 |
private repoService: RepositoryService, |
|
50 |
private authService: AuthenticationService, |
|
51 |
private router: Router |
|
52 |
) {} |
|
53 |
|
|
54 |
ngOnInit() { |
|
55 |
console.log(this.selectedRepo); |
|
56 |
// this.dataMiningTick = false; // until we have an actual value |
|
57 |
if (this.router.url.indexOf('/sources/update') > -1) { |
|
58 |
console.log('up'); |
|
59 |
this.termsTick = (this.selectedRepo.consentTermsOfUse ? (this.selectedRepo.consentTermsOfUse === 'true') : true); |
|
60 |
// this.addTerm(this.selectedRepo.consentTermsOfUse, this.dataMiningTick); |
|
61 |
|
|
62 |
} else if (this.router.url.indexOf('/sources/register') > -1) { |
|
63 |
console.log('reg'); |
|
64 |
this.termsTick = true; |
|
65 |
} |
|
66 |
} |
|
67 |
|
|
68 |
// TODO: review updateRepo when backend is ready to POST terms |
|
69 |
updateRepo() { |
|
70 |
this.formSubmitted = true; |
|
71 |
this.errorMessage = ''; |
|
72 |
this.successMessage = ''; |
|
73 |
window.scroll(1, 1); |
|
74 |
|
|
75 |
if (this.agreementForm.valid) { |
|
76 |
if (this.showButton) { |
|
77 |
this.loadingMessage = formSubmitting; |
|
78 |
this.errorMessage = ''; |
|
79 |
this.repoService.updateRepository(this.selectedRepo).subscribe( |
|
80 |
response => { |
|
81 |
if (response) { |
|
82 |
this.selectedRepo = response; |
|
83 |
console.log(`updateRepository responded: ${JSON.stringify(response)}`); |
|
84 |
} |
|
85 |
}, |
|
86 |
error => { |
|
87 |
console.log(error); |
|
88 |
this.loadingMessage = ''; |
|
89 |
this.errorMessage = formErrorWasntSaved; |
|
90 |
}, |
|
91 |
() => { |
|
92 |
this.loadingMessage = ''; |
|
93 |
if (!this.selectedRepo) { |
|
94 |
this.errorMessage = formErrorWasntSaved; |
|
95 |
} else { |
|
96 |
this.successMessage = formSuccessUpdatedRepo; |
|
97 |
} |
|
98 |
} |
|
99 |
); |
|
100 |
} |
|
101 |
} else { |
|
102 |
this.errorMessage = formErrorRequiredFields; |
|
103 |
} |
|
104 |
} |
|
105 |
|
|
106 |
} |
|
107 |
|
|
108 |
|
modules/uoa-repository-dashboard-gui/branches/new-ui/src/app/shared/reusablecomponents/confirmation-dialog.component.html | ||
---|---|---|
34 | 34 |
</div> |
35 | 35 |
</div> |
36 | 36 |
</div> |
37 |
|
|
38 |
|
|
39 |
<!-- old-ui shelved Terms of Use modal version --> |
|
40 |
|
|
41 |
<!--<div *ngIf="isModalShown" [config]="{ show: true }" (onHidden)="onHidden()" bsModal #autoShownModal="bs-modal"--> |
|
42 |
<!-- class="modal in fade" tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="static">--> |
|
43 |
<!-- <div class="modal-dialog">--> |
|
44 |
<!-- <h2 class="uk-modal-title uk-margin-top uk-margin-left">{{title}}</h2>--> |
|
45 |
<!-- <div class="modal-content">--> |
|
46 |
<!-- <div class="modal-body">--> |
|
47 |
<!-- <div>--> |
|
48 |
<!-- <ng-content></ng-content>--> |
|
49 |
<!-- </div>--> |
|
50 |
<!-- </div>--> |
|
51 |
<!-- <div class="uk-text-right uk-margin-bottom uk-margin-right">--> |
|
52 |
<!-- <button (click)="hideModal()" class="uk-button uk-button-default uk-margin-small-right" type="button">{{hideModalButton}}</button>--> |
|
53 |
<!-- <button *ngIf="confirmActionButton" (click)="confirmedAction()" class="uk-button uk-button-primary" type="button">{{confirmActionButton}}</button>--> |
|
54 |
<!-- </div>--> |
|
55 |
<!-- </div>--> |
|
56 |
<!-- </div>--> |
|
57 |
<!--</div>--> |
modules/uoa-repository-dashboard-gui/branches/new-ui/src/app/domain/typeScriptClasses.ts | ||
---|---|---|
151 | 151 |
registrationDate: Date; |
152 | 152 |
verified: boolean; |
153 | 153 |
dataCollectionTypes: DataCollectionType[]; |
154 |
consentTermsOfUse: string; |
|
155 |
consentTermsOfUseDate: Date; |
|
156 |
fullTextDownload: string; |
|
154 | 157 |
} |
155 | 158 |
|
156 | 159 |
export class RepositorySnippet { |
Also available in: Unified diff
added Terms of Use functionality - follow 'ToU' comments to enable