Revision 55585
Added by Myrto Koukouli about 5 years ago
compatibility-validate-type.component.ts | ||
---|---|---|
1 | 1 |
import { Component, OnInit, ViewChild } from '@angular/core'; |
2 |
import { ActivatedRoute, Params, Router} from '@angular/router';
|
|
2 |
import { ActivatedRoute, Router} from '@angular/router'; |
|
3 | 3 |
import { CompatibilityValidateStep1Component } from './compatibility-validate-forms/compatibility-validate-step1.component'; |
4 | 4 |
import { RepositoryService } from '../../services/repository.service'; |
5 | 5 |
import { JobForValidation, RuleSet } from '../../domain/typeScriptClasses'; |
... | ... | |
69 | 69 |
if (this.route.snapshot.paramMap.has('type')) { |
70 | 70 |
this.type = this.route.snapshot.paramMap.get('type'); |
71 | 71 |
this.getBaseUrlList(); |
72 |
this.getStep(); |
|
72 |
this.route.queryParams.subscribe( |
|
73 |
() => this.getStep() |
|
74 |
); |
|
73 | 75 |
} |
74 | 76 |
} |
75 | 77 |
|
... | ... | |
79 | 81 |
const stepName = this.route.snapshot.queryParamMap.get('step'); |
80 | 82 |
if (stepName === 'guidelines') { |
81 | 83 |
if (!this.identifiedUrl) { |
82 |
this.navigateToStep('baseUrl');
|
|
84 |
this.router.navigateByUrl(`/compatibility/validate/${this.type}?step=baseUrl`);
|
|
83 | 85 |
} else { |
84 | 86 |
this.currentStep = 1; |
85 | 87 |
} |
86 | 88 |
} else if ((stepName === 'parameters') || (stepName === 'crisEntities')) { |
87 | 89 |
if (!this.chosenUrl) { |
88 |
this.navigateToStep('baseUrl');
|
|
90 |
this.router.navigateByUrl(`/compatibility/validate/${this.type}?step=baseUrl`);
|
|
89 | 91 |
} else { |
90 | 92 |
this.currentStep = 2; |
91 | 93 |
} |
... | ... | |
93 | 95 |
this.currentStep = 3; |
94 | 96 |
} |
95 | 97 |
} |
98 |
this.rightHelperContent.ngOnInit(); |
|
99 |
this.topHelperContent.ngOnInit(); |
|
100 |
this.leftHelperContent.ngOnInit(); |
|
101 |
this.bottomHelperContent.ngOnInit(); |
|
96 | 102 |
} |
97 | 103 |
|
98 |
navigateToStep(step: string) { |
|
99 |
this.router.navigateByUrl(`/compatibility/validate/${this.type}?step=${step}`) |
|
100 |
.then( () => { |
|
101 |
this.getStep(); |
|
102 |
this.rightHelperContent.ngOnInit(); |
|
103 |
this.topHelperContent.ngOnInit(); |
|
104 |
this.leftHelperContent.ngOnInit(); |
|
105 |
this.bottomHelperContent.ngOnInit(); |
|
106 |
} |
|
107 |
); |
|
108 |
} |
|
109 |
|
|
110 | 104 |
/* retrieves the baseUrl list for the registered repositories of the user */ |
111 | 105 |
getBaseUrlList() { |
112 | 106 |
this.loadingMessage = loadingReposMessage; |
... | ... | |
142 | 136 |
console.log(this.chosenContentRules); |
143 | 137 |
if (this.chosenContentRules.length || this.chosenUsageRules.length) { |
144 | 138 |
if (this.type === 'cris') { |
145 |
this.navigateToStep('crisEntities');
|
|
139 |
this.router.navigateByUrl(`/compatibility/validate/${this.type}?step=crisEntities`);
|
|
146 | 140 |
} else { |
147 | 141 |
this.getValidationSets(); |
148 |
this.navigateToStep('parameters');
|
|
142 |
this.router.navigateByUrl(`/compatibility/validate/${this.type}?step=parameters`);
|
|
149 | 143 |
} |
150 | 144 |
} else { |
151 | 145 |
this.errorMessage = didntSelectRules; |
... | ... | |
170 | 164 |
moveBackAStep () { |
171 | 165 |
this.errorMessage = ''; |
172 | 166 |
if (this.currentStep === 1) { |
173 |
this.navigateToStep('baseUrl');
|
|
167 |
this.router.navigateByUrl(`/compatibility/validate/${this.type}?step=baseUrl`);
|
|
174 | 168 |
} else if ((this.currentStep === 2) && (this.type !== 'cris')) { |
175 |
this.navigateToStep('guidelines');
|
|
169 |
this.router.navigateByUrl(`/compatibility/validate/${this.type}?step=guidelines`);
|
|
176 | 170 |
} else if ((this.currentStep === 2) && (this.type === 'cris')) { |
177 |
this.navigateToStep('guidelines');
|
|
171 |
this.router.navigateByUrl(`/compatibility/validate/${this.type}?step=guidelines`);
|
|
178 | 172 |
} |
179 | 173 |
} |
180 | 174 |
|
... | ... | |
217 | 211 |
() => { |
218 | 212 |
this.loadingMessage = ''; |
219 | 213 |
if (this.ruleSets && this.ruleSets.length) { |
220 |
this.navigateToStep('guidelines');
|
|
214 |
this.router.navigateByUrl(`/compatibility/validate/${this.type}?step=guidelines`);
|
|
221 | 215 |
} else { |
222 | 216 |
this.errorMessage = noRuleSets; |
223 | 217 |
window.scroll(1, 1); |
... | ... | |
315 | 309 |
window.scroll(1, 1); |
316 | 310 |
}, |
317 | 311 |
() => { |
318 |
this.navigateToStep('finish');
|
|
312 |
this.router.navigateByUrl(`/compatibility/validate/${this.type}?step=finish`);
|
|
319 | 313 |
} |
320 | 314 |
); |
321 | 315 |
} |
Also available in: Unified diff
fixed back-front functionality between steps in validation process