Project

General

Profile

« Previous | Next » 

Revision 50977

finalized sources register and update

View differences:

modules/uoa-repository-dashboard-gui/trunk/app/pages/sources/sources-register/sr-data.component.html
38 38
            <div>
39 39
              <register-datasource-shareable *ngIf="showRepositories"
40 40
                                         #datasourcesByCountry
41
                                         [mode]="'re3data'"></register-datasource-shareable>
41
                                         [mode]="'re3data'"
42
                                         (emitRepoId)="getRepoId($event)"></register-datasource-shareable>
42 43

  
43 44
              <datasource-info-form *ngIf="showForm"
44 45
                                    #updateDatasource
45
                                    [datasourceId]="datasourceId"></datasource-info-form>
46
                                    [datasourceId]="datasourceId"
47
                                    (emittedInfo)="getCurrentRepo($event)"></datasource-info-form>
46 48

  
47
              <div *ngIf="showInterfaces">
49
              <div *ngIf="showInterfaces && repo && repoInterfaces">
48 50
                <form [formGroup]="group">
49 51
                  <form-repeat [component]="updateDatasourceInterfaces"
50 52
                               [parentGroup]="group"
51 53
                               [description]="interfaceFormDesc"
52 54
                               [name]="'repository-interfaces'"
53
                               [data]="repoInterfaces">
55
                               [data]="repoInterfaces"
56
                               [otherData]="repo">
54 57
                  </form-repeat>
55 58
                </form>
56 59
              </div>
modules/uoa-repository-dashboard-gui/trunk/app/pages/sources/sources-register/sr-journal.component.html
31 31
          <div class="animated fadeInRight stepContent">
32 32
            <div>
33 33
              <journal-info-form *ngIf="showForm"
34
                                    #registerJournal></journal-info-form>
34
                                 #registerJournal
35
                                 (emittedInfo)="getCurrentRepo($event)"></journal-info-form>
35 36

  
36
              <div *ngIf="showInterfaces">
37
              <div *ngIf="showInterfaces && repo">
37 38
                <form [formGroup]="group">
38 39
                  <form-repeat [component]="addDatasourceInterfaces"
39 40
                               [parentGroup]="group"
40 41
                               [description]="interfaceFormDesc"
41
                               [name]="'repository-interfaces'">
42
                               [name]="'repository-interfaces'"
43
                               [otherData]="repo">
42 44
                  </form-repeat>
43 45
                </form>
44 46
              </div>
modules/uoa-repository-dashboard-gui/trunk/app/pages/sources/sources-register/sr-data.component.ts
1 1
import { Component, OnInit, Type, ViewChild } from '@angular/core';
2 2
import { RegisterDatasourceShareableComponent } from './register-datasource-shareable.component';
3 3
import { DatasourceInfoFormComponent } from '../sources-forms/datasource-info-form.component';
4
import { RepositoryInterface } from '../../../domain/typeScriptClasses';
4
import { Repository, RepositoryInterface } from '../../../domain/typeScriptClasses';
5 5
import { DatasourceInterfaceFormComponent } from '../sources-forms/datasource-interface-form.component';
6 6
import { Description, interfaceFormDesc } from '../../../domain/oa-description';
7 7
import { FormBuilder, FormGroup } from '@angular/forms';
......
23 23
  step4: string = '';
24 24

  
25 25
  datasourceId: string;
26
  repo: Repository;
26 27

  
27 28
  @ViewChild('datasourcesByCountry')
28 29
  public datasourcesByCountry: RegisterDatasourceShareableComponent;
......
46 47
  moveAStep(){
47 48
    if(this.showRepositories) {
48 49
      if (this.datasourcesByCountry.goToNextStep()) {
49
        this.datasourceId = this.datasourcesByCountry.repoId;
50 50
        this.showRepositories = false;
51 51
        this.showForm = true;
52 52
        this.step2 = 'active';
......
84 84
  }
85 85

  
86 86

  
87
  getRepoId(emitedId: string) {
88
    this.datasourceId = emitedId;
89
  }
90

  
91
  getCurrentRepo(repo: Repository) {
92
    this.repo = repo;
93
  }
94

  
87 95
  getRepoInterfaces() {
88 96
    this.repoService.getRepositoryInterface(this.datasourceId).subscribe(
89 97
      interfaces => { this.repoInterfaces = interfaces; console.log(this.repoInterfaces.length)},
modules/uoa-repository-dashboard-gui/trunk/app/pages/sources/sources-register/sr-journal.component.ts
4 4
import { Description, interfaceFormDesc } from '../../../domain/oa-description';
5 5
import { DatasourceInterfaceFormComponent } from '../sources-forms/datasource-interface-form.component';
6 6
import { RepositoryService } from '../../../services/repository.service';
7
import { Repository } from '../../../domain/typeScriptClasses';
7 8

  
8 9
@Component ({
9 10
  selector: 'app-sr-journal',
......
17 18
  step2: string = '';
18 19
  step3: string = '';
19 20

  
20
  datasourceId: string;
21

  
22 21
  @ViewChild ('registerJournal')
23 22
  registerJournal: JournalInfoFormComponent;
24 23

  
......
26 25
  interfaceFormDesc: Description = interfaceFormDesc;
27 26
  addDatasourceInterfaces: Type<any> = DatasourceInterfaceFormComponent;
28 27

  
28
  repo: Repository;
29 29

  
30 30
  constructor(
31
    private fb: FormBuilder,
32
    private repoService: RepositoryService) {}
31
    private fb: FormBuilder) {}
33 32

  
34 33
  ngOnInit() {
35 34
    this.showForm = true;
......
62 61
    }
63 62
  }
64 63

  
64
  getCurrentRepo(repo: Repository) {
65
    this.repo = repo;
66
  }
67

  
65 68
}
modules/uoa-repository-dashboard-gui/trunk/app/pages/sources/sources-register/sr-literature.component.html
43 43

  
44 44
              <datasource-info-form *ngIf="showForm"
45 45
                                    #updateDatasource
46
                                    [datasourceId]="datasourceId"></datasource-info-form>
46
                                    [datasourceId]="datasourceId"
47
                                    (emittedInfo)="getCurrentRepo($event)"></datasource-info-form>
47 48

  
48
              <div *ngIf="showInterfaces">
49
              <div *ngIf="showInterfaces && repoInterfaces && repo">
49 50
                <form [formGroup]="group">
50 51
                  <form-repeat [component]="updateDatasourceInterfaces"
51 52
                               [parentGroup]="group"
52 53
                               [description]="interfaceFormDesc"
53 54
                               [name]="'repository-interfaces'"
54 55
                               [data]="repoInterfaces"
55
                               [otherData]="exportedData">
56
                               [otherData]="repo">
56 57
                  </form-repeat>
57 58
                </form>
58 59
              </div>
modules/uoa-repository-dashboard-gui/trunk/app/pages/sources/sources-register/sr-aggregator.component.html
31 31
          <div class="animated fadeInRight stepContent">
32 32
            <div>
33 33
              <aggregator-info-form *ngIf="showForm"
34
                                    #registerAggregator></aggregator-info-form>
34
                                    #registerAggregator
35
                                    (emittedInfo)="getCurrentRepo($event)"></aggregator-info-form>
35 36

  
36
              <div *ngIf="showInterfaces">
37
              <div *ngIf="showInterfaces && repo">
37 38
                <form [formGroup]="group">
38 39
                  <form-repeat [component]="addDatasourceInterfaces"
39 40
                               [parentGroup]="group"
40 41
                               [description]="interfaceFormDesc"
41
                               [name]="'repository-interfaces'">
42
                               [name]="'repository-interfaces'"
43
                               [otherData]="repo">
42 44
                  </form-repeat>
43 45
                </form>
44 46
              </div>
modules/uoa-repository-dashboard-gui/trunk/app/pages/sources/sources-register/sr-literature.component.ts
3 3
*/
4 4

  
5 5
import { Component, OnInit, Type, ViewChild } from '@angular/core';
6
import { RepositoryInterface } from '../../../domain/typeScriptClasses';
6
import { Repository, RepositoryInterface } from '../../../domain/typeScriptClasses';
7 7
import { DatasourceInfoFormComponent } from '../sources-forms/datasource-info-form.component';
8 8
import { RegisterDatasourceShareableComponent } from './register-datasource-shareable.component';
9 9
import { DatasourceInterfaceFormComponent } from '../sources-forms/datasource-interface-form.component';
......
26 26
  step4: string = '';
27 27

  
28 28
  datasourceId: string;
29
  repo: Repository;
29 30

  
30 31
  @ViewChild('datasourcesByCountry')
31 32
  public datasourcesByCountry: RegisterDatasourceShareableComponent;
......
37 38
  interfaceFormDesc: Description = interfaceFormDesc;
38 39
  updateDatasourceInterfaces: Type<any> = DatasourceInterfaceFormComponent;
39 40
  repoInterfaces: RepositoryInterface[] = [];
40
  exportedData: string[] = [];
41 41

  
42 42

  
43 43
  constructor(
......
60 60
    } else if(this.showForm) {
61 61
      if (this.updateDatasource.updateRepo()){
62 62
        setTimeout( () => {
63
          this.exportedData.push(this.datasourceId);
64
          this.exportedData.push('opendoar');
65 63
          this.getRepoInterfaces();
66 64
          this.group = this.fb.group({});
67 65
        }, 500 );
......
93 91
    this.datasourceId = emitedId;
94 92
  }
95 93

  
94
  getCurrentRepo(repo: Repository) {
95
    this.repo = repo;
96
  }
97

  
96 98
  getRepoInterfaces() {
97 99
    this.repoService.getRepositoryInterface(this.datasourceId).subscribe(
98 100
      interfaces => {
modules/uoa-repository-dashboard-gui/trunk/app/pages/sources/sources-register/sr-aggregator.component.ts
3 3
import { Description, interfaceFormDesc } from '../../../domain/oa-description';
4 4
import { FormBuilder, FormGroup } from '@angular/forms';
5 5
import { AggregatorInfoFormComponent } from '../sources-forms/aggregator-info-form.component';
6
import { RepositoryService } from '../../../services/repository.service';
6
import { Repository } from '../../../domain/typeScriptClasses';
7 7

  
8 8
@Component ({
9 9
  selector: 'sr-aggregator',
......
17 17
  step2: string = '';
18 18
  step3: string = '';
19 19

  
20
  datasourceId: string;
20
  repo: Repository;
21 21

  
22 22
  @ViewChild ('registerAggregator')
23 23
  registerAggregator: AggregatorInfoFormComponent;
......
27 27
  addDatasourceInterfaces: Type<any> = DatasourceInterfaceFormComponent;
28 28

  
29 29
  constructor(
30
    private fb: FormBuilder,
31
    private repoService: RepositoryService) {}
30
    private fb: FormBuilder) {}
32 31

  
33 32
  ngOnInit() {
34 33
    this.showForm = true;
......
61 60
    }
62 61
  }
63 62

  
63
  getCurrentRepo(repo: Repository) {
64
    this.repo = repo;
65
  }
64 66
}
modules/uoa-repository-dashboard-gui/trunk/app/pages/sources/sources-forms/datasource-interface-form.component.ts
2 2
import { MyGroup } from '../../../shared/reusablecomponents/forms/my-group.interface';
3 3
import { FormBuilder, Validators } from '@angular/forms';
4 4
import {
5
  formErrorRequiredFields, formSuccessAddedInterface,
5
  formErrorRequiredFields, formErrorWasntSaved, formSubmitting, formSuccessAddedInterface, formSuccessUpdatedInterface,
6 6
  invalidCustomBaseUrl, noServiceMessage
7 7
} from '../../../domain/shared-messages';
8 8
import { ValidatorService } from '../../../services/validator.service';
9 9
import { ActivatedRoute } from '@angular/router';
10 10
import { RepositoryService } from '../../../services/repository.service';
11
import { InterfaceInformation, RepositoryInterface } from '../../../domain/typeScriptClasses';
11
import { InterfaceInformation, Repository, RepositoryInterface } from '../../../domain/typeScriptClasses';
12 12

  
13 13
@Component ({
14 14
  selector: 'datasource-interface-form',
......
17 17

  
18 18
export class DatasourceInterfaceFormComponent extends MyGroup implements OnDestroy {
19 19

  
20
  loadingMessage: string;
20 21
  successMessage: string;
21 22
  errorMessage: string;
22 23

  
23
  mode: string;
24
  currentRepository: Repository;
24 25

  
25 26
  identifiedBaseUrl: boolean;
26 27
  existingValSet: boolean;
27 28
  interfaceInfo: InterfaceInformation;
28 29
  currentInterface: RepositoryInterface;
29
  valset: string[] = [];
30
  valsetList: string[] = [];
30 31

  
31 32
  compClasses: Map<string,string> = new Map<string,string>();
32 33
  classCodes: string[] = [];
......
40 41

  
41 42
  constructor(injector: Injector,
42 43
              private valService: ValidatorService,
43
              private repoService: RepositoryService,
44
              private route: ActivatedRoute){
44
              private repoService: RepositoryService){
45 45
    super(injector);
46 46
  }
47 47

  
48 48
  ngOnInit() {
49
      this.currentRepository = <Repository>this.otherData;
49 50
      this.getCompatibilityClasses();
50 51
      console.log(`other data is: ${JSON.stringify(this.otherData)}`);
51 52
      if (this.data && this.data.length) {
......
79 80
  }
80 81

  
81 82
  saveInterface() {
83
    this.errorMessage = '';
84
    this.successMessage = '';
82 85
    if (this.group.valid) {
83 86
      if (this.identifiedBaseUrl) {
84 87
        let baseUrl = this.getMyControl('baseUrl').value;
85
        let valset: string;
86
        if (this.getMyControl('selectValidationSet').enabled ) {
88
        let valset: string = '';
89
        if (this.getMyControl('selectValidationSet').enabled) {
87 90
          valset = this.getMyControl('selectValidationSet').value;
88 91
        } else {
89 92
          valset = this.getMyControl('customValidationSet').value;
......
91 94
        let compLvl = this.getMyControl('compatibilityLevel').value;
92 95

  
93 96
        if (this.currentInterface) {
94
          this.currentInterface.baseUrl = baseUrl;
95
          //this.currentInterface.accessSet = this.valset; CHECK IF THIS IS THE CORRECT FIELD
96
          this.currentInterface.desiredCompatibilityLevel = compLvl;
97
          /*update Interface*/
98

  
97
          this.updateCurrent(baseUrl,valset,compLvl);
99 98
        } else {
100
          let currentInterface: RepositoryInterface = {
101
            desiredCompatibilityLevel: compLvl,
102
            complianceName: 'UNKNOWN',
103
            upgradeToV3: '',
104
            deleteApi: false,
105
            accessSet: valset,
106
            accessFormat: '',
107
            metadataIdentifierPath: '',
108
            lastCollectionDate: '',
109
            nextScheduledExecution: '',
110
            status: '',
111
            collectedFrom: '',
112
            id: '',
113
            typology: '',
114
            compliance: '',
115
            contentDescription: '',
116
            accessProtocol: '',
117
            baseUrl: '',
118
            active: false,
119
            removable: false,
120
            accessParams: {},
121
            extraFields: {}
122
          };
123
          this.repoService.addInterface(this.otherData[1], this.otherData[0], currentInterface).subscribe(
124
            addedInterface => {
125
              console.log(`addInterface responded ${addedInterface}`);
126
              this.currentInterface = addedInterface;
127
            },
128
            error => console.log(error),
129
            () => {
130
              this.successMessage = formSuccessAddedInterface;
131
              this.errorMessage = '';
132
            }
133
          );
99
          this.addCurrent(baseUrl,valset,compLvl);
134 100
        }
135 101
      } else {
136 102
        this.errorMessage = invalidCustomBaseUrl;
......
153 119
            this.errorMessage = invalidCustomBaseUrl;
154 120
          }
155 121
          if (this.interfaceInfo.sets) {
156
            this.valset = this.interfaceInfo.sets;
157
            console.log(this.valset);
122
            this.valsetList = this.interfaceInfo.sets;
123
            console.log(this.valsetList);
158 124
          }
159 125
        },
160 126
        error => {
......
166 132
    }
167 133
  }
168 134

  
169
  getMode() {
170
    if (this.route.snapshot.paramMap.get('id')) {
171
      this.mode = this.route.snapshot.paramMap.get('id').split("_")[0];
172
    } else {
173
      this.mode = this.route.snapshot.url[0].path;
174
    }
175
  }
176

  
177 135
  getCompatibilityClasses() {
178
    this.getMode();
179
    this.repoService.getCompatibilityClasses(this.mode).subscribe(
136
    this.repoService.getCompatibilityClasses(this.currentRepository.datasourceType).subscribe(
180 137
      classes => {
181 138
        this.compClasses = classes;
182 139
        for (let key in this.compClasses){
......
190 147
    );
191 148
  }
192 149

  
150
  updateCurrent (baseUrl: string, valset: string, compLvl: string) {
151
    this.successMessage = '';
152
    this.errorMessage = '';
153
    this.loadingMessage = formSubmitting;
154
    this.currentInterface.baseUrl = baseUrl;
155
    this.currentInterface.accessSet = valset;
156
    this.currentInterface.desiredCompatibilityLevel = compLvl;
157
    this.currentInterface.typology = this.currentRepository.datasourceClass;
158
    this.repoService.updateInterface(this.currentInterface).subscribe(
159
      response => {
160
        console.log(`updateRepository responded ${response}`);
161
        this.loadingMessage = '';
162
        if (response == '200') {
163
          this.successMessage = formSuccessUpdatedInterface;
164
        } else {
165
          this.errorMessage = formErrorWasntSaved;
166
        }
167
      },
168
      error => {
169
        console.log(error);
170
        this.loadingMessage = '';
171
        this.errorMessage = formErrorWasntSaved;
172
      }
173
    );
174
  }
175

  
176
  addCurrent (baseUrl: string, valset: string, compLvl: string) {
177
    this.errorMessage = '';
178
    this.successMessage = '';
179
    this.loadingMessage = formSubmitting;
180
    this.currentInterface = new RepositoryInterface();
181
    this.currentInterface.baseUrl = baseUrl;
182
    this.currentInterface.accessSet = valset;
183
    this.currentInterface.desiredCompatibilityLevel = compLvl;
184
    this.currentInterface.typology = this.currentRepository.datasourceClass;
185
    this.repoService.addInterface(this.currentRepository.datasourceType, this.currentRepository.id, this.currentInterface).subscribe(
186
      addedInterface => {
187
        console.log(`addInterface responded ${addedInterface}`);
188
        this.currentInterface = addedInterface;
189
      },
190
      error => {
191
        console.log(error);
192
        this.loadingMessage = '';
193
        this.errorMessage = formErrorWasntSaved;
194
      },
195
      () => {
196
        this.loadingMessage = '';
197
        if (this.currentInterface.id) {
198
          this.successMessage = formSuccessAddedInterface;
199
        } else {
200
          this.errorMessage = formErrorWasntSaved;
201
        }
202
      }
203
    );
204
  }
205

  
193 206
  ngOnDestroy() {
194 207
    if (this.currentInterface) {
195
/*      this.repoService.deleteInterface(this.currentInterface.id).subscribe(
208
      this.repoService.deleteInterface(this.currentInterface.id).subscribe(
196 209
        response => console.log(`deleteInterface responded: ${response}`),
197 210
        error => console.log(error)
198
      );*/
211
      );
199 212
      console.log(`deleting ${this.currentInterface.id}`);
200 213
    } else {
201 214
      console.log(`deleting empty interface form`);
modules/uoa-repository-dashboard-gui/trunk/app/pages/sources/sources-forms/aggregator-info-form.component.ts
2 2
*  created by myrto on 1/22/2018
3 3
*/
4 4

  
5
import { Component, OnInit } from '@angular/core';
5
import { Component, EventEmitter, OnInit, Output } from '@angular/core';
6 6
import { formErrorRequiredFields, formSuccessRegisteredDatasource, noServiceMessage } from '../../../domain/shared-messages';
7 7
import { RepositoryService } from "../../../services/repository.service";
8 8
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
......
26 26
  aggregatorTypeDesc,
27 27
  adminEmailDesc
28 28
} from '../../../domain/oa-description';
29
import { AuthenticationService } from '../../../services/authentication.service';
29 30

  
30 31
@Component ({
31 32
  selector: 'aggregator-info-form',
......
43 44
  datasourceClasses: Map<string,string> = new Map<string,string>();
44 45
  classCodes: string[] = [];
45 46

  
46
  newDatasource: Repository;
47
  @Output() emittedInfo: EventEmitter<Repository> = new EventEmitter();
47 48

  
48 49
  group: FormGroup;
49 50
  readonly groupDefinition = {
50 51
    softwarePlatform : '',
51
    platformName : '',
52 52
    officialName : ['', Validators.required],
53 53
    repoDescription : ['', Validators.required],
54 54
    country : ['', Validators.required],
......
64 64
  };
65 65

  
66 66
  softwarePlatformDesc : Description = softwarePlatformDesc;
67
  platformNameDesc : Description = platformNameDesc;
68 67
  officialNameDesc : Description = officialNameDesc;
69 68
  repoDescriptionDesc : Description = repoDescriptionDesc;
70 69
  countryDesc : Description = countryDesc;
......
81 80

  
82 81
  constructor(
83 82
    private fb: FormBuilder,
84
    private repoService: RepositoryService
83
    private repoService: RepositoryService,
84
    private authService: AuthenticationService
85 85
  ) {}
86 86

  
87 87
  ngOnInit() {
......
129 129

  
130 130
  registerDatasource(): boolean {
131 131
    if(this.group.valid){
132
      let newRepo = this.createNewRepository();
133
      this.repoService.addRepository('aggregator', newRepo).subscribe(
134
        response => console.log(`${JSON.stringify(response)}`),
135
        error => console.log(error)
136
      );
132 137
      this.successMessage = formSuccessRegisteredDatasource;
133 138
      this.errorMessage = '';
134 139
      return true;
135 140
    } else {
136 141
      this.errorMessage = formErrorRequiredFields;
137
      this.successMessage = '';
138 142
      return false;
139 143
    }
140 144
  }
145

  
146
  createNewRepository(): Repository {
147
    let newRepo: Repository = new Repository();
148
    newRepo.dateOfCreation = new Date(Date.now());
149
    newRepo.officialName = this.group.get('officialName').value;
150
    newRepo.englishName = this.group.get('englishName').value;
151
    newRepo.websiteUrl = this.group.get('websiteUrl').value;
152
    newRepo.logoUrl = this.group.get('logoUrl').value;
153
    newRepo.contactEmail = this.group.get('adminEmail').value;
154
    newRepo.countryName = this.countries.filter(x => x.code == this.group.get('country').value)[0].name;
155
    newRepo.countryCode = this.group.get('country').value;
156
    newRepo.organization = this.group.get('institutionName').value;
157
    newRepo.latitude = this.group.get('latitude').value;
158
    newRepo.longitude = this.group.get('longtitude').value;
159
    newRepo.timezone = this.group.get('timezone').value;
160
    newRepo.datasourceClass = this.group.get('journalType').value;
161
    newRepo.typology = this.group.get('softwarePlatform').value;
162
    newRepo.description = this.group.get('repoDescription').value;
163
    newRepo.registeredBy = this.authService.userEmail;
164
    newRepo.datasourceType = 'aggregator';
165
    newRepo.registered = true;
166

  
167
    this.emittedInfo.emit(newRepo);
168

  
169
    return newRepo;
170
  }
171

  
141 172
}
modules/uoa-repository-dashboard-gui/trunk/app/pages/sources/sources-forms/datasource-info-form.component.html
4 4
  </div>
5 5
  <div class="whiteFilm"></div>
6 6
</div>
7
<form [formGroup]="updateGroup" *ngIf="selectedRepo">
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
<form *ngIf="selectedRepo" [formGroup]="updateGroup">
8 10
  <div>
9 11
    <h4 class="uk-h4 uk-text-primary uk-scrollspy-inview uk-animation-slide-top-medium" uk-scrollspy-class="">
10 12
      Basic information
11 13
    </h4>
12 14
  </div>
13
  <div *ngIf="errorMessage" class="uk-alert uk-alert-danger">{{ errorMessage }}</div>
14
  <div *ngIf="successMessage" class="uk-alert uk-alert-success">{{ successMessage }}</div>
15
  <div class="uk-alert uk-alert-warning">
16
    The following fields are completed by {{ sourceTitle }}.<br>
17
    If you want to edit them, you can do it by using this
18
    <a href="{{ sourceLinkToRepo }}" target="_blank">{{ sourceTitle }} link</a>
19
  </div>
20 15
  <form-inline [description]="softwarePlatformDesc">
21 16
    <select formControlName="softwarePlatform" class="form-control">
22
<!--      <option value="" selected>[Other] (enter name below)</option>-->
17
<!--      <option value="" selected>[Other] (enter name below)</option> RESTORE AFTER getTypologies begins to work-->
23 18
      <option *ngFor="let platform of typologies" value="{{ platform.value }}">{{ platform.name }}</option>
24 19
    </select>
25 20
  </form-inline>
26 21
  <form-inline [description]="platformNameDesc">
22
    <span *ngIf="group.get('platformName').touched && group.get('platformName').value"
23
          class="help-block inline"
24
          style="margin-top: 0px; margin-bottom: 0px; padding-left: 10px;">This value will be used as the platform for your repository</span>
27 25
    <input formControlName="platformName" class="form-control" style="" type="text">
28 26
  </form-inline>
29 27
  <form-inline [description]="officialNameDesc" >
30 28
    <input formControlName="officialName" class="form-control" style="" type="text">
31 29
  </form-inline>
32
  <div *ngIf="isJournal">
30
  <div *ngIf="selectedRepo.datasourceType == 'journal'">
33 31
    <form-inline [description]="issnDesc" [valid]="group.get('issn').valid">
34 32
      <span *ngIf="group.get('issn').invalid && group.get('issn').touched && group.get('issn').dirty"
35 33
            class="help-block inline"
......
55 53
  <form-inline [description]="countryDesc">
56 54
    <select formControlName="country" class="form-control">
57 55
      <option value="">-- none selected --</option>
58
      <option *ngFor="let country of countries" value="{{country.code}}">{{ country.name }}</option>
56
      <option *ngFor="let country of countries" value="{{country.code}}" title="{{country.name}}">{{ country.name }}</option>
59 57
    </select>
60 58
  </form-inline>
61 59
  <form-inline [description]="longtitudeDesc" [valid]="updateGroup.get('longtitude').valid">
modules/uoa-repository-dashboard-gui/trunk/app/pages/sources/sources-forms/journal-info-form.component.html
11 11
      <option *ngFor="let platform of typologies" value="{{ platform.value }}">{{ platform.name }}</option>
12 12
    </select>
13 13
  </form-inline>
14
  <form-inline [description]="platformNameDesc" [valid]="group.get('platformName').valid">
15
    <input formControlName="platformName" class="form-control" type="text">
16
  </form-inline>
17 14
  <form-inline [description]="officialNameDesc"  [valid]="group.get('officialName').valid">
18 15
    <input formControlName="officialName" class="form-control" type="text">
19 16
  </form-inline>
modules/uoa-repository-dashboard-gui/trunk/app/pages/sources/sources-forms/datasource-info-form.component.ts
2 2
import {
3 3
  formErrorRequiredFields,
4 4
  formErrorWasntSaved,
5
  formInfoLoading,
6
  formSuccessUpdatedRepo,
5
  formInfoLoading, formSubmitting,
6
  formSuccessUpdatedRepo, loadingRepoError,
7 7
  noServiceMessage
8 8
} from '../../../domain/shared-messages';
9 9
import { RepositoryService } from "../../../services/repository.service";
10
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
10
import { AbstractControl, FormBuilder, FormGroup, Validators } from '@angular/forms';
11 11
import { Country, Repository } from '../../../domain/typeScriptClasses';
12 12
import { typologies } from '../../../domain/typologies';
13 13
import { timezones } from '../../../domain/timezones';
......
26 26
  logoUrlDesc,
27 27
  timezoneDesc,
28 28
  datasourceTypeDesc,
29
  adminEmailDesc
29
  adminEmailDesc, lissnDesc, eissnDesc, issnDesc
30 30
} from '../../../domain/oa-description';
31 31

  
32 32
@Component ({
......
39 39
  errorMessage: string;
40 40
  successMessage: string;
41 41
  loadingMessage: string;
42
  sourceTitle: string;
43
  sourceLinkToRepo: string;
44 42

  
45 43
  typologies = typologies;
46 44
  timezones = timezones;
......
50 48

  
51 49
  selectedRepo: Repository;
52 50
  id: string;
53
  source: string;
54 51

  
55 52

  
56 53
  @Input() datasourceId: string;
57 54

  
58 55
  @Input() showButton: boolean;
59 56

  
60
  @Output() emittedInfo: EventEmitter<string[]> = new EventEmitter();
57
  @Output() emittedInfo: EventEmitter<Repository> = new EventEmitter();
61 58

  
62 59
  updateGroup: FormGroup;
63 60
  readonly updateGroupDefinition = {
64 61
    softwarePlatform : '',
65 62
    platformName : '',
66 63
    officialName : ['', Validators.required],
64
    issn : ['', [Validators.minLength(8), Validators.maxLength(8)]],
65
    eissn : ['', [Validators.minLength(8), Validators.maxLength(8)]],
66
    lissn : ['', [Validators.minLength(8), Validators.maxLength(8)]],
67 67
    repoDescription : ['', Validators.required],
68 68
    country : ['', Validators.required],
69 69
    longtitude : ['', [Validators.required, Validators.maxLength(9), Validators.min(-180), Validators.max(180)] ],
......
80 80
  softwarePlatformDesc : Description = softwarePlatformDesc;
81 81
  platformNameDesc : Description = platformNameDesc;
82 82
  officialNameDesc : Description = officialNameDesc;
83
  issnDesc : Description = issnDesc;
84
  eissnDesc : Description = eissnDesc;
85
  lissnDesc : Description = lissnDesc;
83 86
  repoDescriptionDesc : Description = repoDescriptionDesc;
84 87
  countryDesc : Description = countryDesc;
85 88
  longtitudeDesc : Description = longtitudeDesc;
......
101 104
    this.loadForm();
102 105
  }
103 106

  
107
  loadForm() {
108
    this.updateGroup = this.fb.group(this.updateGroupDefinition, {validator: checkPlatform});
109
    this.getRepo();
110
  }
111

  
104 112
  getRepo() {
105 113
    this.loadingMessage = formInfoLoading;
106 114
    if (this.datasourceId) {
107 115
      this.repoService.getRepositoryById(this.datasourceId).subscribe(
108 116
        repo => {
109 117
          this.selectedRepo = repo;
110
          if (this.selectedRepo) {
111
            this.updateGroup.setValue({
112
              softwarePlatform: this.selectedRepo.typology,
113
              platformName: '',
114
              officialName: this.selectedRepo.officialName,
115
              repoDescription: this.selectedRepo.description,
116
              country: this.selectedRepo.countryCode,
117
              longtitude: this.selectedRepo.longitude,
118
              latitude: this.selectedRepo.latitude,
119
              websiteUrl: this.selectedRepo.websiteUrl,
120
              institutionName: this.selectedRepo.organization,
121
              englishName: this.selectedRepo.englishName,
122
              logoUrl: this.selectedRepo.logoUrl,
123
              timezone: this.selectedRepo.timezone,
124
              datasourceType: this.selectedRepo.datasourceClass,
125
              adminEmail: this.selectedRepo.contactEmail
126
            });
127
            if (this.updateGroup.get('softwarePlatform').value == '') {
128
              this.updateGroup.setValue({platformName: this.selectedRepo.typology});
129
            }
130
          }
131

  
132
          this.setUpSourceInfo();
133
          this.getDatasourceClasses();
134 118
        },
135 119
        error => {
136 120
          console.log(error);
137 121
          this.loadingMessage = '';
122
          this.errorMessage = loadingRepoError;
138 123
        },
139 124
        () => {
125
          this.setupUpdateForm();
126
          this.getDatasourceClasses();
140 127
          this.getCountries();
128
          this.emittedInfo.emit(this.selectedRepo);
141 129
          this.loadingMessage = '';
142
          this.emittedInfo.emit([this.selectedRepo.id,this.selectedRepo.datasourceType]);
143 130
        }
144 131
      );
145 132
    }
146 133
  }
147 134

  
148
  setUpSourceInfo() {
149
    this.source = this.selectedRepo.datasourceType;
150
  }
151

  
152

  
153
  loadForm() {
154
    this.updateGroup = this.fb.group(this.updateGroupDefinition);
155
    this.getRepo();
156
  }
157

  
158

  
159
  updateRepo(): boolean {
160
    if(this.updateGroup.valid){
161
/*
162
        if (!this.updateEnglishName()) {
163
          return false;
164
        }
165
*/
166
        this.successMessage = formSuccessUpdatedRepo;
167
        this.errorMessage = '';
168
        return true;
169
    } else {
170
      this.errorMessage = formErrorRequiredFields;
171
      this.successMessage = '';
172
      return false;
135
  setupUpdateForm(){
136
    if (this.selectedRepo) {
137
      this.updateGroup.setValue({
138
        softwarePlatform: this.selectedRepo.typology,
139
        platformName: '',
140
        officialName: this.selectedRepo.officialName,
141
        repoDescription: this.selectedRepo.description,
142
        country: this.selectedRepo.countryCode,
143
        longtitude: this.selectedRepo.longitude,
144
        latitude: this.selectedRepo.latitude,
145
        websiteUrl: this.selectedRepo.websiteUrl,
146
        institutionName: this.selectedRepo.organization,
147
        englishName: this.selectedRepo.englishName,
148
        logoUrl: this.selectedRepo.logoUrl,
149
        timezone: this.selectedRepo.timezone,
150
        datasourceType: this.selectedRepo.datasourceClass,
151
        adminEmail: this.selectedRepo.contactEmail
152
      });
153
      if (this.updateGroup.get('softwarePlatform').value == '') {
154
        this.updateGroup.setValue({platformName: this.selectedRepo.typology});
155
      }
156
      if (this.selectedRepo.datasourceType == 'journal') {
157
        this.updateGroup.setValue({
158
          issn: this.selectedRepo.issn,
159
          eissn: this.selectedRepo.eissn,
160
          lissn: this.selectedRepo.lissn
161
        });
162
      }
173 163
    }
174 164
  }
175 165

  
......
192 182
  }
193 183

  
194 184
  getDatasourceClasses() {
195
    this.repoService.getDatasourceClasses(this.source).subscribe(
185
    this.repoService.getDatasourceClasses(this.selectedRepo.datasourceType).subscribe(
196 186
      classes => this.datasourceClasses = classes,
197 187
      error => {
198 188
        this.errorMessage = noServiceMessage;
......
206 196
    );
207 197
  }
208 198

  
209
  updateEnglishName(){
199
  updateRepo(): boolean {
200
    let result: boolean;
201
    this.errorMessage = '';
202
    this.loadingMessage = '';
203
    this.successMessage = '';
204

  
205
    if (this.updateGroup.valid) {
206
      if ( this.selectedRepo.datasourceType != 'journal' || this.updateGroup.get('issn').value ) {
207
        this.refreshSelectedRepo();
208
        this.loadingMessage = formSubmitting;
209
        this.errorMessage = '';
210
        this.repoService.updateRepository(this.selectedRepo).subscribe(
211
          response => {
212
            console.log(`updateRepository responded: ${response}`);
213
            if (response == '200') {
214
              result = true;
215
            } else {
216
              result = false;
217
            }
218
          },
219
          error => {
220
            console.log(error);
221
            this.errorMessage = formErrorWasntSaved;
222
          },
223
          () => {
224
            this.loadingMessage = '';
225
            if (result) {
226
              this.successMessage = formSuccessUpdatedRepo;
227
              this.emittedInfo.emit(this.selectedRepo);
228
            } else {
229
              this.errorMessage = formErrorWasntSaved;
230
            }
231
          }
232
        );
233
      } else {
234
        this.errorMessage = formErrorRequiredFields;
235
        result = false;
236
      }
237
    } else {
238
      this.errorMessage = formErrorRequiredFields;
239
      result = false;
240
    }
241
    return result;
242
  }
243

  
244
  refreshSelectedRepo() {
245
    if (this.updateGroup.get('platformName').value.trim() ) {
246
      this.selectedRepo.typology = this.updateGroup.get('platformName').value;
247
    } else if (this.updateGroup.get('softwarePlatform').value){
248
      this.selectedRepo.typology = this.updateGroup.get('softwarePlatform').value;
249
    }
250
    this.selectedRepo.officialName = this.updateGroup.get('officialName').value;
251
    this.selectedRepo.description = this.updateGroup.get('repoDescription').value;
252
    this.selectedRepo.countryCode = this.updateGroup.get('country').value;
253
    this.selectedRepo.countryName = this.countries.filter(x => x.code == this.updateGroup.get('country').value)[0].name;
254
    this.selectedRepo.longitude = this.updateGroup.get('longtitude').value;
255
    this.selectedRepo.latitude = this.updateGroup.get('latitude').value;
256
    this.selectedRepo.websiteUrl = this.updateGroup.get('websiteUrl').value;
257
    this.selectedRepo.organization = this.updateGroup.get('institutionName').value;
258
    this.selectedRepo.englishName = this.updateGroup.get('englishName').value;
259
    this.selectedRepo.logoUrl = this.updateGroup.get('logoUrl').value;
260
    this.selectedRepo.timezone = this.updateGroup.get('timezone').value;
261
    this.selectedRepo.datasourceClass = this.updateGroup.get('datasourceType').value;
262
    this.selectedRepo.contactEmail = this.updateGroup.get('adminEmail').value;
263
    if (this.selectedRepo.datasourceType == 'journal') {
264
        this.selectedRepo.issn = this.updateGroup.get('issn').value;
265
        this.selectedRepo.eissn = this.updateGroup.get('eissn').value;
266
        this.selectedRepo.lissn = this.updateGroup.get('lissn').value;
267
    }
268
  }
269

  
270
  updateEnglishName() {
210 271
    let status: boolean;
211 272
    this.repoService.updateEnglishName(this.selectedRepo.id,this.updateGroup.get('englishName').value).subscribe(
212 273
      response => {
......
223 284
  }
224 285

  
225 286
}
287

  
288
export function checkPlatform(c: AbstractControl) {
289
  if ( c.get('softwarePlatform').value || c.get('platformName').value )
290
    return null;
291
  return 'invalid';
292
}
modules/uoa-repository-dashboard-gui/trunk/app/pages/sources/sources-forms/journal-info-form.component.ts
2 2
*  created by myrto on 1/22/2018
3 3
*/
4 4

  
5
import { Component, OnInit } from '@angular/core';
5
import { Component, EventEmitter, OnInit, Output } from '@angular/core';
6 6
import {
7 7
  formErrorInvalidFields, formErrorRequiredFields, formErrorWasntSaved, formSuccessRegisteredDatasource,
8 8
  noServiceMessage
......
15 15
import {
16 16
  Description,
17 17
  softwarePlatformDesc,
18
  platformNameDesc,
19 18
  officialNameDesc,
20 19
  issnDesc,
21 20
  eissnDesc,
......
33 32
  adminEmailDesc
34 33
} from '../../../domain/oa-description';
35 34
import { ValidatorService } from '../../../services/validator.service';
35
import { AuthenticationService } from '../../../services/authentication.service';
36 36

  
37 37
@Component ({
38 38
  selector: 'journal-info-form',
......
50 50
  datasourceClasses: Map<string,string> = new Map<string,string>();
51 51
  classCodes: string[] = [];
52 52

  
53
  newDatasource: Repository;
53
  @Output() emittedInfo: EventEmitter<Repository> = new EventEmitter();
54 54

  
55 55
  group: FormGroup;
56 56
  readonly groupDefinition = {
57 57
    softwarePlatform : '',
58
    platformName : '',
59 58
    officialName : ['', Validators.required],
60 59
    issn : ['', [Validators.required, Validators.minLength(8), Validators.maxLength(8)]],
61 60
    eissn : ['', [Validators.minLength(8), Validators.maxLength(8)]],
......
74 73
  };
75 74

  
76 75
  softwarePlatformDesc : Description = softwarePlatformDesc;
77
  platformNameDesc : Description = platformNameDesc;
78 76
  officialNameDesc : Description = officialNameDesc;
79 77
  issnDesc : Description = issnDesc;
80 78
  eissnDesc : Description = eissnDesc;
......
93 91

  
94 92
  constructor(
95 93
    private fb: FormBuilder,
96
    private repoService: RepositoryService
94
    private repoService: RepositoryService,
95
    private authService: AuthenticationService
97 96
  ) {}
98 97

  
99 98
  ngOnInit() {
......
141 140

  
142 141
  registerDatasource(): boolean {
143 142
    if(this.group.valid){
144
      let newRepo: Repository = {
145
        id: '',
146
        officialName: this.group.get('officialName').value,
147
        englishName: this.group.get('englishName').value,
148
        websiteUrl: this.group.get('websiteUrl').value,
149
        logoUrl: this.group.get('logoUrl').value,
150
        contactEmail: this.group.get('adminEmail').value,
151
        countryName: this.group.get('country').value,
152
        countryCode: null, //this.group.get('officialName').value,
153
        organization: null,
154
        latitude: this.group.get('latitude').value,
155
        longitude: this.group.get('longtitude').value,
156
        timezone: this.group.get('timezone').value,
157
        namespacePrefix: '',
158
        odNumberOfItems: '',
159
        odNumberOfItemsDate: null,
160
        odPolicies: '',
161
        odLanguages: '',
162
        odContentTypes: '',
163
        collectedFrom: '',
164
        inferred: null,
165
        deletedByInference: null,
166
        trust: 0,
167
        inferenceProvenance: '',
168
        dateOfValidation: null,
169
        datasourceClass: this.group.get('journalType').value,
170
        provenanceActionClass: '',
171
        dateOfCollection: null,
172
        typology: this.group.get('softwarePlatform').value,
173
        activationId: '',
174
        mergehomonyms: null,
175
        description: this.group.get('repoDescription').value,
176
        releaseStartDate: null,
177
        releaseEndDate: null,
178
        missionStatementUrl: '',
179
        dataProvider: null,
180
        serviceProvider: null,
181
        databaseAccessType: '',
182
        dataUploadType: '',
183
        databaseAccessRestriction: '',
184
        dataUploadRestriction: '',
185
        versioning: null,
186
        citationGuidelineUrl: '',
187
        qualityManagementKind: '',
188
        pidSystems: '',
189
        certificates: '',
190
        aggregator: '',
191
        issn: this.group.get('issn').value,
192
        eissn: this.group.get('eissn').value,
193
        lissn: this.group.get('lissn').value,
194
        interfaces: [],
195
        availableDiskSpace: '',
196
        securityParameters: '',
197
        protocol: 'oai',
198
        registeredBy: 'ant.lebesis@gmail.com',
199
        datasourceType: 'journal',
200
        datasourceAggregatorId: null,
201
        datasourceOriginalIdValue: null,
202
        datasourceOriginalIdProvenance: '',
203
        datasourceAggregated: false,
204
        datasourceComplianceDegreeValue: '',
205
        datasourceComplianceDegreeEncoding: '',
206
        numberOfObjects: 0,
207
        maxSizeOfDatastructure: 0,
208
        maxNumberOfDataStructures: 0,
209
        registered: true,
210
        extraFields: {  },
211
        piwikInfo: null,
212
        environments: [],
213
        registrationDate: null,
214
        verified: false,
215
        dataCollectionTypes: [],
216
        resourceId: '',
217
        resourceUri: '',
218
        resourceKind: '',
219
        resourceType: '',
220
        dateOfCreation: null,
221

  
222
    };
143
      let newRepo = this.createNewRepository();
223 144
      this.repoService.addRepository('journal',newRepo).subscribe(
224 145
        response => console.log(`${JSON.stringify(response)}`),
225 146
        error => console.log(error)
......
250 171
    return status;
251 172
  }
252 173

  
174
  createNewRepository(): Repository {
175
    let newRepo: Repository = new Repository();
176
    newRepo.dateOfCreation = new Date(Date.now());
177
    newRepo.officialName = this.group.get('officialName').value;
178
    newRepo.englishName = this.group.get('englishName').value;
179
    newRepo.websiteUrl = this.group.get('websiteUrl').value;
180
    newRepo.logoUrl = this.group.get('logoUrl').value;
181
    newRepo.contactEmail = this.group.get('adminEmail').value;
182
    newRepo.countryName = this.countries.filter(x => x.code == this.group.get('country').value)[0].name;
183
    newRepo.countryCode = this.group.get('country').value;
184
    newRepo.organization = this.group.get('institutionName').value;
185
    newRepo.latitude = this.group.get('latitude').value;
186
    newRepo.longitude = this.group.get('longtitude').value;
187
    newRepo.timezone = this.group.get('timezone').value;
188
    newRepo.datasourceClass = this.group.get('journalType').value;
189
    newRepo.typology = this.group.get('softwarePlatform').value;
190
    newRepo.description = this.group.get('repoDescription').value;
191
    newRepo.issn = this.group.get('issn').value;
192
    newRepo.eissn = this.group.get('eissn').value;
193
    newRepo.lissn = this.group.get('lissn').value;
194
    newRepo.registeredBy = this.authService.userEmail;
195
    newRepo.datasourceType = 'journal';
196
    newRepo.registered = true;
253 197

  
198
    this.emittedInfo.emit(newRepo);
199

  
200
    return newRepo;
201
  }
202

  
203

  
254 204
}
modules/uoa-repository-dashboard-gui/trunk/app/pages/sources/sources-forms/datasource-interface-form.component.html
6 6
      <h5>OpenDOAR Interface (non-removable)</h5>
7 7
    </div>
8 8
  </div>
9
  <div *ngIf="loadingMessage" class="loading-big">
10
    <div class="loader-big" style="text-align: center; padding-top: 170px; color: rgb(47, 64, 80); font-weight: bold;">
11
      {{ loadingMessage }}
12
    </div>
13
    <div class="whiteFilm"></div>
14
  </div>
9 15
  <div *ngIf="group">
10 16
    <div [formGroup]="group">
11 17
      <div *ngIf="successMessage" class="uk-alert uk-alert-success">{{ successMessage }}</div>
......
27 33
        </div>
28 34
        <select id="selectValidationSet{{index}}" formControlName="selectValidationSet" class="form-control" >
29 35
          <option value="" selected>-- none selected --</option>
30
          <option *ngFor="let set of valset" value="{{set}}">{{set}}</option>
36
          <option *ngFor="let set of valsetList" value="{{set}}">{{set}}</option>
31 37
        </select>
32 38
        <div>
33 39
          <label class="uk-button validationSetRadio" for="customRadio{{index}}">
modules/uoa-repository-dashboard-gui/trunk/app/pages/sources/sources-update-repo.component.html
20 20
            <div *ngIf="repoId">
21 21
              <datasource-info-form [datasourceId]="repoId"
22 22
                                    [showButton]=true
23
                                    (emittedInfo)="getExportedData($event)"></datasource-info-form>
23
                                    (emittedInfo)="getCurrentRepo($event)"></datasource-info-form>
24 24
            </div>
25 25
          </li>
26 26
          <li class="el-item">
27
            <div *ngIf="loadInterfaces" class="uk-width-1-1@m uk-first-column">
27
            <div *ngIf="repoInterfaces && repo" class="uk-width-1-1@m uk-first-column">
28 28
              <form [formGroup]="group">
29 29
                <form-repeat [component]="updateDatasourceInterfaces"
30 30
                             [parentGroup]="group"
31 31
                             [description]="interfaceFormDesc"
32 32
                             [name]="'datasource-interface-form'"
33 33
                             [data]="repoInterfaces"
34
                             [otherData]="exportedData">
34
                             [otherData]="repo">
35 35
                </form-repeat>
36 36
              </form>
37 37
            </div>
modules/uoa-repository-dashboard-gui/trunk/app/pages/sources/sources-update-repo.component.ts
1 1
import { Component, OnInit, Type } from '@angular/core';
2 2
import { FormArray, FormBuilder, FormGroup } from '@angular/forms';
3 3
import { DatasourceInterfaceFormComponent } from './sources-forms/datasource-interface-form.component';
4
import { RepositoryInterface } from '../../domain/typeScriptClasses';
4
import { Repository, RepositoryInterface } from '../../domain/typeScriptClasses';
5 5
import { RepositoryService } from '../../services/repository.service';
6 6
import { ActivatedRoute } from '@angular/router';
7 7
import {
8 8
  Description,
9 9
  interfaceFormDesc,
10 10
} from '../../domain/oa-description';
11
import { Subject } from 'rxjs/Subject';
12 11

  
13 12

  
14 13

  
......
20 19
export class SourcesUpdateRepoComponent implements OnInit {
21 20

  
22 21
  repoId: string;
22
  repo: Repository;
23 23
  repoInterfaces: RepositoryInterface[] = [];
24 24
  loadInterfaces: boolean;
25 25

  
26 26
  group: FormGroup;
27 27
  interfaceFormDesc: Description = interfaceFormDesc;
28 28
  updateDatasourceInterfaces: Type<any> = DatasourceInterfaceFormComponent;
29
  exportedData: string[];
30 29

  
31 30
  constructor (
32 31
    private fb: FormBuilder,
......
58 57
    );
59 58
  }
60 59

  
61
  getExportedData(data: string[]) {
62
    this.exportedData = data;
60
  getCurrentRepo(repo: Repository) {
61
    this.repo = repo;
63 62
  }
64 63

  
65
  loadInterfacesTab() {
66
      this.getRepoInterfaces();
67
/*      console.log("PATCHING");
68
      let patched = [];
69
      this.repoInterfaces.forEach(item => {
70
        patched.push({
71
          baseUrl : item.baseUrl,
72
          selectValidationSet : item.accessSet,
73
          compatibilityLevel : item.desiredCompatibilityLevel
74
        });
75
      });
76
      this.group.patchValue(patched);
77
      console.log(`PATCHED: ${JSON.stringify(patched)}`);*/
78
  }
79 64

  
80

  
81 65
}
modules/uoa-repository-dashboard-gui/trunk/app/services/repository.service.ts
33 33
      .catch(this.handleError);
34 34
  }
35 35

  
36
  updateInterface(interfaceInfo: RepositoryInterface): Observable<string> {
37
    let url = `${this.apiUrl}updateInterface`;
38
    console.log(`knocking on: ${url}`);
39
    console.log(`sending ${JSON.stringify(interfaceInfo)}`);
40
    httpOptions.withCredentials = true;
41
    return this.http.post(url,interfaceInfo,httpOptions)
42
      .map( res => res.status.toString())
43
      .catch(this.handleError);
44
  }
45

  
46
  deleteInterface(id: string): Observable<string> {
47
    let url = `${this.apiUrl}deleteInterface/${id}`;
48
    console.log(`knocking on: ${url}`);
49
    httpOptions.withCredentials = true;
50
    return this.http.delete(url,httpOptions)
51
      .map( res => res.status.toString() )
52
      .catch(this.handleError);
53
  }
54

  
36 55
  addRepository(datatype: string, newRepository: Repository): Observable<Repository> {
37 56
    let url = `${this.apiUrl}addRepository?datatype=${datatype}`;
38 57
    console.log(`knocking on: ${url}`);
......
43 62
      .catch(this.handleError);
44 63
  }
45 64

  
46
  deleteInterface(id: string): Observable<string> {
47
    let url = `${this.apiUrl}deleteInterface/${id}`;
65
  updateRepository(repoInfo: Repository): Observable<string> {
66
    let url = `${this.apiUrl}updateRepository`;
48 67
    console.log(`knocking on: ${url}`);
68
    console.log(`sending ${JSON.stringify(repoInfo)}`);
49 69
    httpOptions.withCredentials = true;
50
    return this.http.delete(url,httpOptions)
51
      .map( res => res.status.toString() )
70
    return this.http.post(url,repoInfo,httpOptions)
71
      .map( res => res.status.toString())
52 72
      .catch(this.handleError);
53 73
  }
54 74

  
modules/uoa-repository-dashboard-gui/trunk/app/shared/reusablecomponents/forms/my-group.interface.ts
27 27

  
28 28
  @Input() public data : any = null;
29 29

  
30
  @Input() public otherData: any[];
30
  @Input() public otherData: any;
31 31

  
32 32
  public patchData : Subject<any> = new Subject();
33 33

  
modules/uoa-repository-dashboard-gui/trunk/app/shared/reusablecomponents/forms/my-array.interface.ts
101 101
/*    (<FormGroup>this.parentGroup).addControl(<string>this.name, this._fb.array([]));
102 102
    !this.initEmpty && this.createView();
103 103
    this.parentGroup.get(this.name as string).patchValue = this.patchValue();*/
104
    if (this.data) {
104
    if (this.data && this.data.length) {
105 105
      for (let i=0; i<this.data.length; i++ ) {
106 106
        !this.initEmpty && this.createView();
107 107
        this.parentGroup.get(this.name as string).patchValue = this.patchValue();
modules/uoa-repository-dashboard-gui/trunk/app/domain/shared-messages.ts
64 64

  
65 65
/* Forms validation Messages */
66 66
export const formInfoLoading = 'Loading information';
67
export const formSubmitting = 'Saving changes ...';
67 68
export const formErrorRequiredFields = 'All the fields marked with (*) are mandatory';
68 69
export const formErrorInvalidFields = 'There are invalid fields';
69 70
export const formErrorWasntSaved = 'There was a problem with the form submission';
modules/uoa-repository-dashboard-gui/trunk/app/domain/typeScriptClasses.ts
52 52
}
53 53

  
54 54
export class DriverResource implements Serializable {
55
    resourceId: string;
56
    resourceUri: string;
57
    resourceKind: string;
58
    resourceType: string;
59
    dateOfCreation: Date;
55
    resourceId: string = null;
56
    resourceUri: string = null;
57
    resourceKind: string = null;
58
    resourceType: string = null;
59
    dateOfCreation: Date = null;
60 60
}
61 61

  
62 62
export class MDFormatDataStructure extends DriverResource {
......
80 80
}
81 81

  
82 82
export class Repository extends DriverResource implements IsSerializable {
83
    id: string;
84
    officialName: string;
85
    englishName: string;
86
    websiteUrl: string;
87
    logoUrl: string;
88
    contactEmail: string;
89
    countryName: string;
90
    countryCode: string;
91
    organization: string;
92
    latitude: number;
93
    longitude: number;
94
    timezone: number;
95
    namespacePrefix: string;
96
    odNumberOfItems: string;
97
    odNumberOfItemsDate: string;
98
    odPolicies: string;
99
    odLanguages: string;
100
    odContentTypes: string;
101
    collectedFrom: string;
102
    inferred: boolean;
103
    deletedByInference: boolean;
104
    trust: number;
105
    inferenceProvenance: string;
106
    dateOfValidation: Date;
107
    datasourceClass: string;
108
    provenanceActionClass: string;
109
    dateOfCollection: Date;
110
    typology: string;
111
    activationId: string;
112
    mergehomonyms: boolean;
113
    description: string;
114
    releaseStartDate: Date;
115
    releaseEndDate: Date;
116
    missionStatementUrl: string;
117
    dataProvider: boolean;
118
    serviceProvider: boolean;
119
    databaseAccessType: string;
120
    dataUploadType: string;
121
    databaseAccessRestriction: string;
122
    dataUploadRestriction: string;
123
    versioning: boolean;
124
    citationGuidelineUrl: string;
125
    qualityManagementKind: string;
126
    pidSystems: string;
127
    certificates: string;
128
    aggregator: string;
129
    issn: string;
130
    eissn: string;
131
    lissn: string;
132
    interfaces: RepositoryInterface[];
133
    availableDiskSpace: string;
134
    securityParameters: string;
135
    protocol: string;
136
    registeredBy: string;
137
    datasourceType: string;
138
    datasourceAggregatorId: string;
139
    datasourceOriginalIdValue: string;
140
    datasourceOriginalIdProvenance: string;
141
    datasourceAggregated: boolean;
142
    datasourceComplianceDegreeValue: string;
143
    datasourceComplianceDegreeEncoding: string;
144
    numberOfObjects: number;
145
    maxSizeOfDatastructure: number;
146
    maxNumberOfDataStructures: number;
147
    registered: boolean;
148
    extraFields: { [index: string]: string };
149
    piwikInfo: PiwikInfo;
150
    environments: string[];
151
    registrationDate: Date;
152
    verified: boolean;
153
    dataCollectionTypes: DataCollectionType[];
83
    id: string = null;
84
    officialName: string = null;
85
    englishName: string = null;
86
    websiteUrl: string = null;
87
    logoUrl: string = null;
88
    contactEmail: string = null;
89
    countryName: string = null;
90
    countryCode: string = null;
91
    organization: string = null;
92
    latitude: number = null;
93
    longitude: number = null;
94
    timezone: number = null;
95
    namespacePrefix: string = null;
96
    odNumberOfItems: string = null;
97
    odNumberOfItemsDate: string = null;
98
    odPolicies: string = null;
99
    odLanguages: string = null;
100
    odContentTypes: string = null;
101
    collectedFrom: string = null;
102
    inferred: boolean = null;
103
    deletedByInference: boolean = null;
104
    trust: number = 0;
105
    inferenceProvenance: string = null;
106
    dateOfValidation: Date = null;
107
    datasourceClass: string = null;
108
    provenanceActionClass: string = null;
109
    dateOfCollection: Date = null;
110
    typology: string = null;
111
    activationId: string = null;
112
    mergehomonyms: boolean = null;
113
    description: string = null;
114
    releaseStartDate: Date = null;
115
    releaseEndDate: Date = null;
116
    missionStatementUrl: string = null;
117
    dataProvider: boolean = null;
118
    serviceProvider: boolean = null;
119
    databaseAccessType: string = null;
120
    dataUploadType: string = null;
121
    databaseAccessRestriction: string = null;
122
    dataUploadRestriction: string = null;
123
    versioning: boolean = null;
124
    citationGuidelineUrl: string = null;
125
    qualityManagementKind: string = null;
126
    pidSystems: string = null;
127
    certificates: string = null;
128
    aggregator: string = null;
129
    issn: string = null;
130
    eissn: string = null;
131
    lissn: string = null;
132
    interfaces: RepositoryInterface[] = [];
133
    availableDiskSpace: string = null;
134
    securityParameters: string = null;
135
    protocol: string = 'oai';
136
    registeredBy: string = null;
137
    datasourceType: string = null;
138
    datasourceAggregatorId: string = null;
139
    datasourceOriginalIdValue: string = null;
140
    datasourceOriginalIdProvenance: string = null;
141
    datasourceAggregated: boolean = false;
142
    datasourceComplianceDegreeValue: string = null;
143
    datasourceComplianceDegreeEncoding: string = null;
144
    numberOfObjects: number = null;
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff