Project

General

Profile

« Previous | Next » 

Revision 51771

fixed some bugs

View differences:

modules/uoa-repository-dashboard-gui/trunk/app/pages/sources/sources-forms/datasource-interface-form.component.ts
43 43
    baseUrl: ['', Validators.required],
44 44
    selectValidationSet: [''],
45 45
    customValidationSet: [''],
46
    compatibilityLevel: ['', Validators.required]
46
    compatibilityLevel: ['']
47 47
  };
48 48
  baseUrlDesc: Description = baseUrlDesc;
49 49
  existingValSetDesc: Description = existingValSetDesc;
......
58 58

  
59 59
  ngOnInit() {
60 60
    this.currentRepository = <Repository>this.otherData;
61
    this.getCompatibilityClasses();
62 61
    console.log(`other data is: ${JSON.stringify(this.otherData,null,2)}`);
63 62
    if (this.data && this.data.length) {
64 63
      this.currentInterface = this.data[0];
......
80 79
    /* initializes MyGroup parent component and the FormGroup */
81 80
    super.ngOnInit();
82 81
    console.log(this.group, this.parentGroup);
82
    this.getCompatibilityClasses();
83 83

  
84
    if (this.currentInterface) {
85
      console.log(`accessParams is ${JSON.stringify(this.currentInterface.accessParams)}`);
86
      if ( !this.getMyControl('compatibilityLevel').value || !this.classCodes.filter( x => x == this.currentInterface.desiredCompatibilityLevel).length ) {
87
        this.getMyControl('compatibilityLevel').setValue("");
88
        this.existingCompLevel = this.currentInterface.desiredCompatibilityLevel;
89
      } else {
90
        this.getMyControl('compatibilityLevel').setValue(this.compClasses[this.currentInterface.desiredCompatibilityLevel]);
91
      }
92
      if (this.group.valid ) {
93
        if (this.group.valid && ( this.getMyControl('selectValidationSet').value || this.getMyControl('customValidationSet').value ) ) {
94
          this.exportedData = this.currentInterface;
95
        }
96
      }
97
    }
98

  
99 84
    /*  NOT ANYMORE
100 85
    if (this.currentInterface) {
101 86
      this.getMyControl('baseUrl').disable();
......
115 100
      this.getMyControl('selectValidationSet').disable();
116 101
      this.getMyControl('customValidationSet').enable();
117 102
    }
103
    this.checkIfValid();
118 104
  }
119 105

  
120 106
  getInterfaceInfo(baseUrl: string) {
......
144 130
        },
145 131
        () => {
146 132
          if ( this.currentInterface && this.currentInterface.accessParams && this.currentInterface.accessParams['set'] ) {
147
            if ( this.valsetList.filter( x => x === this.currentInterface.accessParams['set']).length ) {
133
            if ( this.valsetList.some( x => x === this.currentInterface.accessParams['set']) ) {
148 134
              this.patchData.next({selectValidationSet:this.currentInterface.accessParams['set']});
149 135
            } else {
150 136
              this.patchData.next({customValidationSet:this.currentInterface.accessParams['set']});
......
169 155
      error => {
170 156
        this.errorMessage = noServiceMessage;
171 157
        console.log(error);
158
      },
159
      () => {
160
        if (this.currentInterface) {
161
          console.log(`accessParams is ${JSON.stringify(this.currentInterface.accessParams)}`);
162
          if ( !this.currentInterface.desiredCompatibilityLevel || !this.classCodes.some( x => x == this.currentInterface.desiredCompatibilityLevel ) ) {
163
            this.patchData.next({compatibilityLevel:''});
164
            this.existingCompLevel = this.currentInterface.desiredCompatibilityLevel;
165
          } else {
166
            this.existingCompLevel = this.compClasses[this.currentInterface.desiredCompatibilityLevel];
167
          }
168
          if (this.group.valid ) {
169
            if ( this.getMyControl('selectValidationSet').value || this.getMyControl('customValidationSet').value ) {
170
              this.exportedData = this.currentInterface;
171
            }
172
          }
173
        }
174

  
172 175
      }
173 176
    );
174 177
  }
......
177 180
    this.groupErrorMessage = '';
178 181
    this.errorMessage = '';
179 182
    this.successMessage = '';
180
    if (this.group.valid && ( this.getMyControl('selectValidationSet').value || this.getMyControl('customValidationSet').value ) ) {
183
    if (this.group.valid && this.checkIfValsetWasChosen() && this.checkIfCompatibilityLevelWasChosen() ) {
181 184
      if (this.identifiedBaseUrl) {
182 185
        let baseUrl = this.getMyControl('baseUrl').value;
183 186
        let valset: string = '';
......
186 189
        } else {
187 190
          valset = this.getMyControl('customValidationSet').value;
188 191
        }
189
        let compLvl = this.getMyControl('compatibilityLevel').value;
192
        let compLvl: string = '';
193
        if (this.getMyControl('compatibilityLevel').value) {
194
          compLvl = this.getMyControl('compatibilityLevel').value;
195
        } else {
196
          compLvl = this.existingCompLevel;
197
        }
190 198

  
199

  
191 200
        if (this.currentInterface) {
192 201
          this.updateCurrent(baseUrl,valset,compLvl);
193 202
        } else {
......
202 211
    }
203 212
  }
204 213

  
214
  checkIfValsetWasChosen() {
215
    return ( ( this.getMyControl('selectValidationSet').enabled && this.getMyControl('selectValidationSet').value !='' ) || ( this.getMyControl('customValidationSet').enabled && this.getMyControl('customValidationSet').value !='' ) );
216
  }
217

  
218
  checkIfCompatibilityLevelWasChosen() {
219
    return ( this.getMyControl('compatibilityLevel').value != '' || (this.existingCompLevel && this.existingCompLevel != '') );
220
  }
221

  
205 222
  checkIfValid() {
223
    console.log(this.existingCompLevel);
206 224
    if (this.inRegister) {
207
      if (this.group.valid && ( this.getMyControl('selectValidationSet').value || this.getMyControl('customValidationSet').value ) ) {
208
        if (this.identifiedBaseUrl) {
225
      if ( this.group.valid && this.checkIfValsetWasChosen() && this.checkIfCompatibilityLevelWasChosen() ) {
226
        if ( this.identifiedBaseUrl ) {
209 227
          let baseUrl = this.getMyControl('baseUrl').value;
228

  
210 229
          let valset: string = '';
211 230
          if (this.getMyControl('selectValidationSet').enabled) {
212 231
            valset = this.getMyControl('selectValidationSet').value;
213 232
          } else {
214 233
            valset = this.getMyControl('customValidationSet').value;
215 234
          }
216
          let compLvl = this.getMyControl('compatibilityLevel').value;
217 235

  
236
          let compLvl: string = '';
237
          if (this.getMyControl('compatibilityLevel').value) {
238
            compLvl = this.getMyControl('compatibilityLevel').value;
239
          } else {
240
            compLvl = this.existingCompLevel;
241
          }
242

  
218 243
          if (this.currentInterface) {
219 244
            this.updateCurrent(baseUrl,valset,compLvl);
220 245
          } else {
221 246
            this.addCurrent(baseUrl,valset,compLvl);
222 247
          }
223 248
        }
249
      } else {
250
        this.exportedData = null;
251
        this.wasSaved = false;
252
        this.successMessage = '';
224 253
      }
225 254
    }
226 255
  }
modules/uoa-repository-dashboard-gui/trunk/app/pages/sources/sources-forms/datasource-update-form.component.html
100 100
  </div>
101 101
</form>
102 102

  
103
<confirmation-dialog #updateLogoUrlModal [title]="'Update Logo URL'" [isModalShown]="isModalShown"
104
                     [confirmActionButton]="'Update'" (emitObject)="updatedLogoUrl($event)">
105
  <input type="text" #logoURLinput name="logoUrl" placeholder="Logo URL" class="form-control" value="{{ updateGroup.get('logoUrl').value }}" (change)="changeLogoUrl(logoURLinput.value)">
106
</confirmation-dialog>
modules/uoa-repository-dashboard-gui/trunk/app/pages/sources/sources-forms/datasource-update-form.component.ts
48 48
  datasourceClasses: Map<string,string> = new Map<string,string>();
49 49
  classCodes: string[] = [];
50 50

  
51
  isModalShown: boolean;
52
  @ViewChild('updateLogoUrlModal')
53
  public updateLogoUrlModal: ConfirmationDialogComponent;
54

  
55
  /* in sources/update emits the new logoUrl */
56
  @Output() emittedUrl: EventEmitter<string> = new EventEmitter();
57

  
58
  /*  in sources/register (of literature or data repository) emits the updated repository */
51
  /*  in sources/register (in literature or data mode) the updated repository is emitted */
59 52
  @Output() emittedInfo: EventEmitter<Repository> = new EventEmitter();
60 53

  
61 54
  @Input() selectedRepo: Repository;
......
116 109
    if (this.selectedRepo) {
117 110
      this.loadingMessage = loadingRepoMessage;
118 111
      this.updateGroup = this.fb.group(this.updateGroupDefinition, {validator: checkPlatform});
119
      this.setupUpdateForm();
120
      //this.getDatasourceClasses();
121
      //this.getCountries();
122
      this.getTypologies();
123
      this.getTimezones();
112
      this.getDatasourceClasses();
124 113
    } else {
125 114
      this.errorMessage = loadingRepoError;
126 115
    }
127 116
  }
128 117

  
129
  setupUpdateForm(){
118
  setupUpdateForm() {
130 119
    if (this.selectedRepo) {
131 120
      console.log(`my datasource type is: ${this.selectedRepo.datasourceType}`);
132 121
      /*if (this.selectedRepo.datasourceType == 'journal') {
......
155 144
        datasourceType: this.selectedRepo.datasourceClass,
156 145
        adminEmail: this.selectedRepo.contactEmail
157 146
      });
158
      if ( !this.updateGroup.get('softwarePlatform').value || !this.typologies.filter(x=> x.value == this.selectedRepo.typology).length ) {
147

  
148
      if ( this.selectedRepo.typology === '' || !this.typologies.some(x => x.value == this.selectedRepo.typology) ) {
159 149
        this.updateGroup.get('softwarePlatform').setValue('');
160 150
        this.updateGroup.get('platformName').setValue(this.selectedRepo.typology);
161 151
      }
152

  
162 153
      this.updateGroup.get('officialName').disable();
163 154
      this.updateGroup.get('country').disable();
164 155
      this.updateGroup.get('longtitude').disable(); // MAYBE NOT DISABLED
......
184 175
        this.updateGroup.get('eissn').disable();
185 176
        this.updateGroup.get('lissn').disable();
186 177
      }
187
      this.getDatasourceClasses();
178
      /*this.getDatasourceClasses();*/
188 179
    }
189 180
  }
190 181

  
......
233 224
        this.loadingMessage = '';
234 225
        console.log(error);
235 226
      },
236
      () => this.getTimezones()
227
      () => {
228
        this.getTimezones();
229
      }
237 230
    );
238 231
  }
239 232

  
......
246 239
      },
247 240
      () => {
248 241
        this.loadingMessage = '';
242
        this.setupUpdateForm();
249 243
      }
250 244
    );
251 245
  }
......
271 265
              if (response) {
272 266
                this.selectedRepo = response;
273 267
                console.log(`updateRepository responded: ${JSON.stringify(response)}`);
274
                this.emittedInfo.emit(response);
275 268
              }
276 269
            },
277 270
            error => {
......
298 291
  }
299 292

  
300 293
  refreshSelectedRepo() {
301
    if (this.updateGroup.get('platformName').value ) {
294
    if (this.updateGroup.get('softwarePlatform').value ) {
295
      this.selectedRepo.typology = this.updateGroup.get('softwarePlatform').value;
296
    } else if (this.updateGroup.get('platformName').value) {
302 297
      this.selectedRepo.typology = this.updateGroup.get('platformName').value;
303
    } else if (this.updateGroup.get('softwarePlatform').value) {
304
      this.selectedRepo.typology = this.updateGroup.get('softwarePlatform').value;
305 298
    }
306 299
    this.selectedRepo.officialName = this.updateGroup.get('officialName').value;
307 300
    this.selectedRepo.description = this.updateGroup.get('repoDescription').value;
......
339 332
    }
340 333
  }
341 334

  
342
  changeLogoUrl(logoUrl: string) {
343
    this.updateGroup.get('logoUrl').setValue(logoUrl);
344
  }
345

  
346
  updateLogoUrl(logoUrl: string){
347
    this.updateLogoUrlModal.ids = [logoUrl];
348
    this.updateLogoUrlModal.showModal();
349
  }
350

  
351
  updatedLogoUrl(event: any) {
352
    this.emittedUrl.emit(this.updateGroup.get('logoUrl').value);
353
  }
354

  
355 335
}
356 336

  
357 337
export function checkPlatform(c: AbstractControl) {
......
359 339
    return null;
360 340
  return 'invalid';
361 341
}
362

  
363
export function markPlatformAsRequired(c: AbstractControl) {
364
  c.get('platformName').setValidators([Validators.required]);
365
}
modules/uoa-repository-dashboard-gui/trunk/app/pages/sources/sources-forms/datasource-interface-form.component.html
46 46
    </div>
47 47
    <div class="form-group">
48 48
      <label class="control-label" for="compLvl" title="{{ compatibilityLevelDesc.desc }}">Desired Compatibility Level (*)</label>
49
      <select class="form-control" #compLvl id="compLvl" formControlName="compatibilityLevel" required (change)="checkIfValid()">
49
      <select class="form-control" #compLvl id="compLvl" formControlName="compatibilityLevel" (change)="checkIfValid()">
50 50
        <option value="">-- none selected --</option>
51 51
        <option *ngFor="let key of classCodes" value="{{key}}">{{compClasses[key]}}</option>
52 52
      </select>
modules/uoa-repository-dashboard-gui/trunk/app/pages/sources/sources-update-repo.component.html
26 26
              <div *ngIf="errorMessage" class="uk-alert uk-alert-danger">{{ errorMessage }}</div>
27 27
              <div *ngIf="repo" class="uk-margin-medium-bottom">
28 28
                <h1 class="uk-article-title">
29
                  <a id="updateLogoURL" (click)="datasourceUpdateForm.updateLogoUrl(repo.logoUrl)">
29
                  <a id="updateLogoURL" (click)="updateLogoUrl(repo.logoUrl)">
30 30
                    <img *ngIf="!logoURL" src="/assets/imgs/yourLogoHere.jpg" style="margin-right: 15px; margin-top:-8px" width="60">
31 31
                    <img *ngIf="logoURL" src="{{ logoURL }}" style="margin-right: 15px; margin-top:-8px" width="60">
32 32
                  </a>
......
89 89
      </div>
90 90
    </div>
91 91

  
92

  
93
    <confirmation-dialog #updateLogoUrlModal [title]="'Update Logo URL'" [isModalShown]="isModalShown"
94
                         [confirmActionButton]="'Update'" (emitObject)="updatedLogoUrl($event)">
95
      <input type="text" name="logoUrl" placeholder="Logo URL" class="form-control" value="{{ logoURL }}" (change)="getNewLogoUrl($event)" >
96
    </confirmation-dialog>
97

  
98

  
modules/uoa-repository-dashboard-gui/trunk/app/pages/sources/sources-update-repo.component.ts
10 10
} from '../../domain/oa-description';
11 11
import { formInfoLoading, loadingRepoError } from '../../domain/shared-messages';
12 12
import { DatasourceUpdateFormComponent } from './sources-forms/datasource-update-form.component';
13
import {ConfirmationDialogComponent} from "../../shared/reusablecomponents/confirmation-dialog.component";
13 14

  
14 15

  
15 16

  
......
33 34
  interfaceFormDesc: Description = interfaceFormDesc;
34 35
  updateDatasourceInterfaces: Type<any> = DatasourceInterfaceFormComponent;
35 36

  
37
  isModalShown: boolean;
38
  @ViewChild('updateLogoUrlModal')
39
  public updateLogoUrlModal: ConfirmationDialogComponent;
40

  
36 41
  constructor (
37 42
    private fb: FormBuilder,
38 43
    private repoService: RepositoryService,
......
94 99
    );
95 100
  }
96 101

  
97
  getNewLogoUrl(newURL: string) {
98
    this.logoURL = newURL;
102
  updateLogoUrl(logoUrl: string){
103
    this.updateLogoUrlModal.ids = [logoUrl];
104
    this.updateLogoUrlModal.showModal();
99 105
  }
100 106

  
107
  updatedLogoUrl(event: any) {
108
    this.repo.logoUrl = this.logoURL;
109
    this.datasourceUpdateForm.updateGroup.get('logoUrl').setValue(this.logoURL);
110
    this.datasourceUpdateForm.updateRepo();
111

  
112
  }
113

  
114
  getNewLogoUrl( event: any ) {
115
    this.logoURL = event.target.value;
116

  
117
  }
118

  
101 119
}
modules/uoa-repository-dashboard-gui/trunk/app/services/repository.service.ts
193 193
        console.log(`responded ${res.statusText}`);
194 194
        return res.status.toString();
195 195
      })
196
      .catch(this.handleError).share();
196
      .catch(this.handleError);
197 197
  }
198 198

  
199 199
  updateLongtitude(id: string, longtitude: string): Observable<string>{
......
208 208

  
209 209
    return this.http.post(url,body,httpOptions)
210 210
      .map( res => <string>res.json())
211
      .catch(this.handleError).share();
211
      .catch(this.handleError);
212 212
  }
213 213

  
214 214
  updateLatitude(id: string, latitude: string): Observable<string>{
......
223 223

  
224 224
    return this.http.post(url,body,httpOptions)
225 225
      .map( res => <string>res.json())
226
      .catch(this.handleError).share();
226
      .catch(this.handleError);
227 227
  }
228 228

  
229
  updateLogoUrl(id: string, logoUrl: string): Observable<string>{
229
  updateLogoUrl(id: string, logoUrl: string): Observable<any>{
230 230
    let url = `${this.apiUrl}updateLogoUrl`;
231 231
    console.log(`knocking on: ${url}`);
232 232
    let body = JSON.stringify({
......
237 237
    httpOptions.withCredentials = true;
238 238

  
239 239
    return this.http.post(url, body, httpOptions)
240
      .map( res => <string>res.json())
241
      .catch(this.handleError).share();
240
      .map( res => <any>res.json())
241
      .catch(this.handleError);
242 242
  }
243 243

  
244 244
  updateTimezone(id: string, timezone: string): Observable<string>{
......
253 253

  
254 254
    return this.http.post(url, body, httpOptions)
255 255
      .map( res => <string>res.json())
256
      .catch(this.handleError).share();
256
      .catch(this.handleError);
257 257
  }
258 258

  
259 259
  getListLatestUpdate(mode: string): Observable<string> {
modules/uoa-repository-dashboard-gui/trunk/app/app.component.html
1 1
<div class="uk-offcanvas-content">
2 2
  <top-menu></top-menu>
3 3
  <router-outlet></router-outlet>
4

  
5
  <!-- Piwik -->
6
  <script type="text/javascript">
7
    var _paq = _paq || [];
8
    /* tracker methods like "setCustomDimension" should be called before "trackPageView" */
9
    _paq.push(['trackPageView']);
10
    _paq.push(['enableLinkTracking']);
11
    (function() {
12
      var u="//analytics.openaire.eu/";
13
      _paq.push(['setTrackerUrl', u+'piwik.php']);
14
      _paq.push(['setSiteId', '92']);
15
      var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
16
      g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
17
    })();
18
  </script>
19
  <!-- End Piwik Code -->
20

  
21
  <div>
22
    <!-- Piwik Image Tracker-->
23
    <img src="https://analytics.openaire.eu/piwik.php?idsite=92&rec=1" style="border:0" alt="" />
24
    <!-- End Piwik -->
25
  </div>
26

  
27

  
4 28
  <footer></footer>
5 29
</div>
modules/uoa-repository-dashboard-gui/trunk/app/shared/topmenu/topmenu.component.html
151 151

  
152 152
              <ul class="uk-navbar-nav">
153 153
                <li class="uk-parent" [routerLinkActive]="['uk-active']">
154
                  <a [routerLink]="['dashboard']" [routerLinkActive]="['active']">
154
                  <a [routerLink]="['dashboard']" [routerLinkActive]="['uk-active']">
155 155
                    Dashboard
156 156
                  </a>
157 157
                </li>
modules/uoa-repository-dashboard-gui/trunk/app/shared/reusablecomponents/forms/my-array.interface.ts
97 97
        ((this.parentGroup as FormArray).controls[this.name].at(0).corpus((<MyGroup>componentView.instance).generate().value));
98 98
      } else {
99 99
        if (index>0){
100
          if (this.registerMode ) {
101
            if(!<MyGroup>componentView.instance.exportedData) {
102
              this.remove(index);
103
              (this.parentGroup as FormArray).controls[this.name].removeAt(index - 1);
104
              this.components.splice(index, 1);
105
              this.arrayData_.splice(index - 1, 1);
106
            }
100
          if (this.registerMode || !(<MyGroup>componentView.instance).wasSaved ) {
101
            this.remove(index);
102
            (this.parentGroup as FormArray).controls[this.name].removeAt(index - 1);
103
            this.components.splice(index, 1);
104
            this.arrayData_.splice(index - 1, 1);
107 105
          } else {
108 106
            this.curIntrf = <MyGroup>componentView.instance;
109 107
            this.curIndex = index;
110
            this.components.splice(index,1);
108
            this.components.splice(index, 1);
111 109
            this.confirmRemoveInterface();
112 110
          }
113 111
        } else {

Also available in: Unified diff