Project

General

Profile

« Previous | Next » 

Revision 55585

fixed back-front functionality between steps in validation process

View differences:

modules/uoa-repository-dashboard-gui/trunk/src/app/pages/sources/sources-register/register-new-datasource.component.ts
69 69
        this.currentStep = 1;
70 70
      } else if (stepName === 'interfaces') {
71 71
        if (!this.repo) {
72
          this.navigateToStep('basicInformation');
72
          this.router.navigateByUrl(`/sources/register/${this.datasourceType}?step=basicInformation`);
73 73
        } else {
74 74
          this.currentStep = 2;
75 75
        }
......
77 77
        this.currentStep = 3;
78 78
      }
79 79
    }
80
    this.rightHelperContent.ngOnInit();
81
    this.topHelperContent.ngOnInit();
82
    this.leftHelperContent.ngOnInit();
83
    this.bottomHelperContent.ngOnInit();
80 84
  }
81 85

  
82
  navigateToStep(step: string) {
83
    this.router.navigateByUrl(`/sources/register/${this.datasourceType}?step=${step}`)
84
      .then( () => {
85
          this.getStep();
86
          this.rightHelperContent.ngOnInit();
87
          this.topHelperContent.ngOnInit();
88
          this.leftHelperContent.ngOnInit();
89
          this.bottomHelperContent.ngOnInit();
90
        }
91
      );
92
  }
93

  
94 86
  moveAStep() {
95 87
    this.errorMessage = '';
96 88
    if (this.currentStep === 1) {
......
112 104
    this.errorMessage = '';
113 105
    if (this.currentStep === 2) {
114 106
      of(this.getInterfaces()).subscribe(
115
        () => this.navigateToStep('basicInformation')
107
        () => this.router.navigateByUrl(`/sources/register/${this.datasourceType}?step=basicInformation`)
116 108
      );
117 109
    }
118 110
  }
......
176 168
  getCurrentRepo(repo: Repository) {
177 169
    this.repo = repo;
178 170
    of (this.fillInterfacesForms()).subscribe(
179
      () => this.navigateToStep('interfaces')
171
      () => this.router.navigateByUrl(`/sources/register/${this.datasourceType}?step=interfaces`)
180 172
    );
181 173
  }
182 174

  
......
226 218
          this.loadingMessage = '';
227 219
          this.repo = null;
228 220
          this.repoInterfaces = [];
229
          this.navigateToStep('finish');
221
          this.router.navigateByUrl(`/sources/register/${this.datasourceType}?step=finish`);
230 222
        }
231 223
      );
232 224
    }
modules/uoa-repository-dashboard-gui/trunk/src/app/pages/sources/sources-register/register-existing-datasource.component.ts
80 80
      const stepName = this.route.snapshot.queryParamMap.get('step');
81 81
      if (stepName === 'basicInformation') {
82 82
        if (!this.datasourceId) {
83
          this.navigateToStep('selectDatasource');
83
          this.router.navigateByUrl(`/sources/register/${this.datasourceType}?step=selectDatasource`);
84 84
        } else {
85 85
          this.currentStep = 1;
86 86
        }
87 87
      } else if (stepName === 'interfaces') {
88 88
        if (!this.repo) {
89
          this.navigateToStep('selectDatasource');
89
          this.router.navigateByUrl(`/sources/register/${this.datasourceType}?step=selectDatasource`);
90 90
        } else {
91 91
          this.currentStep = 2;
92 92
        }
......
94 94
        this.currentStep = 3;
95 95
      }
96 96
    }
97
    this.rightHelperContent.ngOnInit();
98
    this.topHelperContent.ngOnInit();
99
    this.leftHelperContent.ngOnInit();
100
    this.bottomHelperContent.ngOnInit();
97 101
  }
98 102

  
99 103
  navigateToStep(step: string) {
100
    this.router.navigateByUrl(`/sources/register/${this.datasourceType}?step=${step}`)
101
      .then( () => {
102
          this.getStep();
104
    this.router.navigateByUrl(`/sources/register/${this.datasourceType}?step=${step}`);
105
      /*.then( () => {
106
          // this.getStep();
103 107
          this.rightHelperContent.ngOnInit();
104 108
          this.topHelperContent.ngOnInit();
105 109
          this.leftHelperContent.ngOnInit();
106 110
          this.bottomHelperContent.ngOnInit();
107 111
        }
108
      );
112
      );*/
109 113
  }
110 114

  
111 115
  moveAStep() {
......
113 117
    if (this.currentStep === 0) {
114 118
      if (this.datasourcesByCountry.goToNextStep()) {
115 119
        console.log(`got datasource with id ${this.datasourceId}`);
116
        this.navigateToStep('basicInformation');
120
        this.router.navigateByUrl(`/sources/register/${this.datasourceType}?step=basicInformation`);
117 121
      }
118 122
    } else if (this.currentStep === 1) {
119 123
      this.registerDatasource.updateRepo();
......
135 139
    if (this.currentStep === 1) {
136 140
      this.repoInterfaces = [];
137 141
      this.repo = null;
138
      this.navigateToStep('selectDatasource');
142
      this.router.navigateByUrl(`/sources/register/${this.datasourceType}?step=selectDatasource`);
139 143
    } else if (this.currentStep === 2) {
140 144
      of(this.getInterfaces()).subscribe(
141
        () => this.navigateToStep('basicInformation')
145
        () => this.router.navigateByUrl(`/sources/register/${this.datasourceType}?step=basicInformation`)
142 146
      );
143 147
    }
144 148
  }
......
236 240
      this.getRepoInterfaces();
237 241
    } else {
238 242
      of(this.fillInterfacesForms()).subscribe(
239
        () => this.navigateToStep('interfaces')
243
        () => this.router.navigateByUrl(`/sources/register/${this.datasourceType}?step=interfaces`)
240 244
      );
241 245
    }
242 246
  }
......
265 269
      () => {
266 270
        this.loadingMessage = '';
267 271
        of(this.fillInterfacesForms()).subscribe(
268
          () => this.navigateToStep('interfaces')
272
          () => this.router.navigateByUrl(`/sources/register/${this.datasourceType}?step=interfaces`)
269 273
        );
270 274
      }
271 275
    );
......
339 343
          this.datasourceId = null;
340 344
          this.repo = null;
341 345
          this.repoInterfaces = [];
342
          this.navigateToStep('finish');
346
          this.router.navigateByUrl(`/sources/register/${this.datasourceType}?step=finish`);
343 347
        }
344 348
      );
345 349
    }
modules/uoa-repository-dashboard-gui/trunk/src/app/pages/compatibility/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