Project

General

Profile

« Previous | Next » 

Revision 50290

forms array view works!

View differences:

modules/uoa-repository-dashboard-gui/trunk/app/pages/adminPg/adminPg-metrics.component.ts
34 34

  
35 35
  /* NEEDS TO CALL GET PIWIK INFO INSTEAD!! */
36 36
  getPiwiks(){
37
    this.piwiks = [
38
      {
39
        'repositoryId': 'repo_id',
40
        'openaireId': 'oa_id',
41
        'repositoryName': 'the repo name',
42
        'country': 'Greece',
43
        'siteId': '123',
44
        'authenticationToken': '32846584f571be9b57488bf4088f30ea',
45
        'creationDate':  new Date(2018, 1, 3),
46
        'requestorName': 'Bla blabla',
47
        'requestorEmail': 'blabla@gmail.com',
48
        'validated': false,
49
        'validationDate':  new Date(2018, 1, 3),
50
        'comment' : ''
51
      },
52
      {
53
        'repositoryId': 'repo_id2',
54
        'openaireId': 'oa_id2',
55
        'repositoryName': 'the repo name2',
56
        'country': 'Greece',
57
        'siteId': '123',
58
        'authenticationToken': '32846584f88f30easdfasdfa',
59
        'creationDate':  new Date(2018, 1, 4),
60
        'requestorName': 'Bla blabla',
61
        'requestorEmail': 'blabla2@gmail.com',
62
        'validated': true,
63
        'validationDate':  new Date(2018, 1, 4),
64
        'comment' : ''
65
      },
66
      {
67
        'repositoryId': 'repo_id3',
68
        'openaireId': 'oa_id',
69
        'repositoryName': 'the repo name',
70
        'country': 'Greece',
71
        'siteId': '123',
72
        'authenticationToken': '32846584f571be9b57488bf4088f30ea',
73
        'creationDate': new Date(2018, 1, 3),
74
        'requestorName': 'Bla blabla',
75
        'requestorEmail': 'blabla2@gmail.com',
76
        'validated': false,
77
        'validationDate': new Date(2018, 1, 3),
78
        'comment' : ''
79
      }
80
    ]
81
/*
82 37
    this.showSpinner = true;
83 38
    this.loadingMessage = loadingReposMessage;
84 39
    this.repoService.getPiwikSitesForRepos()
......
103 58
          this.loadingMessage = '';
104 59
        }
105 60
      );
106
*/
107 61
  }
108 62

  
109 63
  /*NOT SURE IF THESE PARAMETERS ARE THE CORRECT ONES*/
modules/uoa-repository-dashboard-gui/trunk/app/pages/sources/update-datasource-interface-form.component.ts
10 10
export class UpdateDatasourceInterfaceFormComponent extends MyGroup {
11 11
  successMessage: string;
12 12
  errorMessage: string;
13
  existingValSet: boolean;
13 14

  
14 15
  readonly groupDefinition = {
15 16
    baseUrl: ['', Validators.required],
16 17
    selectValidationSet: [''],
17
    customValidationSet: ['']
18
    customValidationSet: [''],
19
    compatibilityLevel: ['', Validators.required]
18 20
  };
19 21

  
20 22

  
21 23
  ngOnInit(){
22 24
    super.ngOnInit();
23 25
    console.log(this.group,this.parentGroup);
26

  
27
    this.existingValSet = true;
24 28
    this.getMyControl('customValidationSet').disable();
25 29
  }
26 30

  
27 31

  
28 32
  chooseValSet(existingValSet: boolean) {
29 33
     if(existingValSet) {
34
       this.existingValSet = true;
30 35
       this.getMyControl('selectValidationSet').enable();
31 36
       this.getMyControl('customValidationSet').disable();
32 37
     }  else {
38
       this.existingValSet = false;
33 39
       this.getMyControl('selectValidationSet').disable();
34 40
       this.getMyControl('customValidationSet').enable();
35 41
     }
......
37 43

  
38 44
  saveInterface(){
39 45
    console.log("saved  something!");
46
    if (this.existingValSet){
47
      console.log(this.getMyControl('selectValidationSet').value);
48
    } else {
49
      console.log(this.getMyControl('customValidationSet').value);
50
    }
40 51
  }
41

  
42
  removeInterface(){
43
    console.log("removed  something!");
44
  }
45 52
}
modules/uoa-repository-dashboard-gui/trunk/app/pages/sources/sources-update.component.html
4 4
      <h1 class="uk-article-title">Update your datasource</h1>
5 5
    </div>
6 6
    <div class="">
7
      <a [routerLink]="['repo']" class="btn btn-primary">DELETE ME LATER !!</a>
8 7
      <repository-tiles [parent]="parent_id">
9 8
        Choose the Datasource you would like to manage</repository-tiles>
10 9
      <div class="row openAIRECompliantLogoDownload">
modules/uoa-repository-dashboard-gui/trunk/app/pages/sources/sources-update-repo.component.html
22 22
                    Basic information
23 23
                  </h4>
24 24
                </div>
25
                <div class="uk-alert uk-alert-warning">
25
                <div class="alert alert-warning">
26 26
                  The following fields are completed by OpenDOAR.<br>
27 27
                  If you want to edit them, you can do it by using this
28 28
                  <a href="http://www.opendoar.org/suggest.php?rID=2893" target="_blank">OpenDOAR link</a>
......
106 106
          </li>
107 107
          <li class="el-item">
108 108
            <div class="uk-width-1-1@m uk-first-column">
109
              <div class="interfacesForm">
110
                <form [formGroup]="group">
111
                  <!--<update-datasource-interface-form #datasourceForm [name]="'myname'" [parentGroup]="group"></update-datasource-interface-form>-->
112
                  <form-repeat [component]="updateDatasource"
113
                               [parentGroup]="group"
114
                               [description]="interfaceFormDesc"
115
                               [name]="'repeat'">
116
                  </form-repeat>
117
                </form>
118
              </div>
109
              <form [formGroup]="group">
110
                <!--<update-datasource-interface-form #datasourceForm [name]="'myname'" [parentGroup]="group"></update-datasource-interface-form>-->
111
                <form-repeat [component]="updateDatasource"
112
                             [parentGroup]="group"
113
                             [description]="interfaceFormDesc"
114
                             [name]="'repeat'">
115
                </form-repeat>
116
              </form>
119 117
            </div>
120 118
          </li>
121 119
        </ul>
modules/uoa-repository-dashboard-gui/trunk/app/pages/sources/sources-update-repo.component.ts
15 15
  updateDatasource : Type<any> = UpdateDatasourceInterfaceFormComponent;
16 16

  
17 17
  constructor(private fb: FormBuilder) {
18
    this.group = fb.group({});
19 18
  }
20 19

  
21 20
  // use for the other tab
......
23 22
  // datasourceForm : UpdateDatasourceInterfaceFormComponent;
24 23

  
25 24
  ngOnInit() {
25
    this.group = this.fb.group({});
26 26
    // console.log("DATASOURCE",this.datasourceForm);
27 27
  }
28 28

  
modules/uoa-repository-dashboard-gui/trunk/app/pages/sources/update-datasource-interface-form.component.html
1
<div>
2 1
  <div>
3 2
    <div class="interfaceActionsPanel">
4 3
      <a (click)="saveInterface()"><i class="fa fa-save fa-lg"></i></a>
......
7 6
      <h5>OpenDOAR Interface (non-removable)</h5>
8 7
    </div>
9 8
  </div>
10
  <div [formGroup]="group">
11
    <div *ngIf="successMessage" class="uk-alert uk-alert-success" style="display:none;" aria-hidden="true">{{ successMessage }}</div>
12
    <div *ngIf="errorMessage" class="uk-alert uk-alert-danger" style="display:none;" aria-hidden="true">{{ errorMessage }}</div>
13
    <div class="uk-fieldset">
14
      <label class="uk-form-controls-text control-label">Base URL (*)
15
        <input type="text" class="uk-input" formControlName="baseUrl" disabled="">
16
      </label>
17
    </div>
18
    <div class="uk-fieldset">
19
      <label class="uk-form-controls-text control-label">Validation Set</label>
20
      <div>
21
        <label class="uk-button uk-button-link validationSetRadio disabled">
22
          <input value="select" name="validationSet" type="radio" class="uk-radio" (change)="chooseValSet(true)">
23
          <span>choose existing</span>
9
  <div>
10
    <div [formGroup]="group">
11
      <div *ngIf="successMessage" class="uk-alert uk-alert-success" style="display:none;" aria-hidden="true">{{ successMessage }}</div>
12
      <div *ngIf="errorMessage" class="uk-alert uk-alert-danger" style="display:none;" aria-hidden="true">{{ errorMessage }}</div>
13
      <div class="uk-fieldset">
14
        <label class="uk-form-controls-text control-label">Base OAI-PMH URL (*)
15
          <input type="text" class="uk-input" formControlName="baseUrl" disabled="">
24 16
        </label>
25
        <div class="uk-margin">
26
          <select formControlName="selectValidationSet" class="uk-select">
27
            <option value="noneSelected">-- none selected --</option>
17
      </div>
18
      <div class="uk-fieldset">
19
        <label class="uk-form-controls-text control-label">Validation Set</label>
20
        <div>
21
          <label class="uk-button uk-button-link validationSetRadio">
22
            <input value="select" name="validationSet" type="radio" class="uk-radio" (change)="chooseValSet(true)">
23
            <span>choose existing</span>
24
          </label>
25
          <div class="uk-margin">
26
            <select formControlName="selectValidationSet" class="uk-select">
27
              <option value="">-- none selected --</option>
28
            </select>
29
          </div>
30
          <label class="uk-button uk-button-link validationSetRadio control-label">
31
            <input value="custom" name="validationSet" type="radio" class="uk-radio" (change)="chooseValSet(false)">
32
            <span>or a custom one</span>
33
          </label>
34
          <div class="uk-margin">
35
            <input formControlName="customValidationSet" class="uk-input" type="text">
36
          </div>
37
        </div>
38
      </div>
39
      <div class="uk-fieldset">
40
        <label class="uk-form-controls-select control-label">Desired Compatibility Level (*)
41
          <select class="uk-select" #compLvl name="compatibilityLevel" formControlname="compatibilityLevel">
42
            <option value="">-- none selected --</option>
28 43
          </select>
29
        </div>
30
        <label class="uk-button uk-button-link validationSetRadio disabled">
31
          <input value="custom" name="validationSet" type="radio" class="uk-radio" (change)="chooseValSet(false)">
32
          <span>or a custom one</span>
33 44
        </label>
34
        <div class="uk-margin">
35
          <input formControlName="customValidationSet" class="uk-input" type="text">
36
        </div>
37 45
      </div>
46
      <div>
47
        <label class="uk-form-controls-text control-label">Current Compatibility Level</label>
48
        <div *ngIf="compLvl.value == ''">not available</div>
49
      </div>
38 50
    </div>
39
    <div class="uk-fieldset">
40
      <label class="uk-form-controls-select control-label">Desired Compatibility Level (*)
41
        <select class="uk-select" name="compatibilityLevel" formControlname="compatibilityLevel">
42
          <option value="">-- none selected --</option>
43
        </select>
44
      </label>
45
    </div>
46
    <div>
47
      <label class="uk-form-controls-text control-label">Current Compatibility Level
48
        <!-- SHOW CURRENT LEVEL -->
49
      </label>
50
    </div>
51 51
  </div>
52
</div>
modules/uoa-repository-dashboard-gui/trunk/app/pages/sources/sources.routing.ts
49 49
            component: SourcesUpdateComponent
50 50
          },
51 51
          {
52
            path: 'repo',
52
            path: ':repo',
53 53
            component: SourcesUpdateRepoComponent
54 54
          }
55 55
        ]
modules/uoa-repository-dashboard-gui/trunk/app/pages/metrics/metrics.routing.ts
12 12
const metricsRoutes: Routes = [
13 13
  {
14 14
    path: 'getImpact',
15
//    canActivate: [AuthGuardService],
15
    canActivate: [AuthGuardService],
16 16
    children: [
17 17
      {
18 18
        path: '',
modules/uoa-repository-dashboard-gui/trunk/app/shared/reusablecomponents/repository-tiles.component.html
23 23
      </div>
24 24

  
25 25
      <!--TILES VIEW-->
26
      <div class="uk-grid-large uk-grid-margin-large uk-grid repos-grid" *ngIf="layoutChoice == 'tiles'">
26
      <div class="uk-grid-large uk-grid-margin-large uk-grid repos-grid" *ngIf="tilesView">
27 27
        <div *ngFor="let repo of reposOfUser" class="uk-width-1-3@m uk-first-column uk-margin-small-bottom">
28
          {{ setPropertiesForRepo(repo) }}
29 28
          <div class="uk-margin uk-grid-match uk-child-width-1-1 uk-grid-small uk-grid-divider uk-grid uk-scrollspy-inview uk-animation-slide-top-medium uk-grid-stack">
30 29
            <div class="uk-first-column">
31 30
              <div>
32 31
                <div class="el-item uk-panel uk-scrollspy-inview uk-animation-slide-top-medium" uk-scrollspy-class="">
33 32
                  <div class="uk-child-width-expand uk-grid-medium uk-flex-middle uk-grid" uk-grid="">
34 33
                    <div class="uk-width-1-3@m uk-first-column">
35
                      <a class="el-link" href="{{ linkToNext }}">
34
                      <a class="el-link" [routerLink]="[getLinkToNext(repo)]">
36 35
                        <img *ngIf="!repo.logoUrl" class="el-image uk-border-rounded" src="/assets/imgs/yourLogoHere.jpg" alt="">
37 36
                        <img *ngIf="repo.logoUrl" class="el-image uk-border-rounded" src="{{ repo.logoUrl }}" alt="">
38 37
                      </a>
39 38
                    </div>
40 39
                    <div>
41 40
                      <h3 class="el-title uk-margin uk-h5 uk-margin-remove-adjacent uk-margin-small-bottom">{{ repo.officialName }}</h3>
42
                      <div class="{{ badgeCSS }}">
41
                      <div class="{{ getBadgeCSS(repo) }}">
43 42
                        <span *ngIf="parent == 'contentEvents'">(</span>
44
                        {{ badgeText }}
43
                        {{ getBadgeText(repo) }}
45 44
                        <span *ngIf="parent == 'contentEvents'"> events)</span>
46 45
                      </div>
47 46
                    </div>
......
54 53
      </div>
55 54

  
56 55
      <!-- LIST VIEW -->
57
      <div class="uk-grid-large uk-grid-margin-large uk-grid repos-list" *ngIf="layoutChoice == 'list'">
56
      <div class="uk-grid-large uk-grid-margin-large uk-grid repos-list" *ngIf="!tilesView">
58 57
        <div class="uk-width-1-1@m uk-first-column">
59 58
          <div class="uk-overflow-auto uk-scrollspy-inview uk-animation-slide-top-medium">
60 59
            <div>
......
70 69
                </thead>
71 70
                <tbody>
72 71
                  <tr class="el-item" *ngFor="let repo of reposOfUser">
73
                    {{ setPropertiesForRepo(repo) }}
74 72
                    <!-- SHARED FIELDS -->
75 73
                    <td class="uk-table-shrink">
74
                      <img *ngIf="repo.logoUrl" class="el-image uk-preserve-width" src="{{ repo.logoUrl }}" style="height: 45px;">
76 75
                      <img *ngIf="!repo.logoUrl" class="el-image uk-preserve-width" src="assets/imgs/yourLogoHere.jpg" alt="[Repo Logo]" style="height: 45px;">
77
                      <img *ngIf="repo.logoUrl" class="el-image uk-preserve-width" src="{{ repo.logoUrl }}" style="height: 45px;">
78 76
                    </td>
79 77
                    <td class="uk-text-nowrap uk-table-shrink">{{ repo.officialName }}</td>
80 78

  
81 79
                    <!-- SET STATUS OR EVENTS -->
82
                    <td *ngIf="parent=='metrics'" class="uk-text-nowrap uk-table-shrink">
83
                      <div class="{{ badgeCSS }}">{{ badgeText }}</div>
80
                    <td *ngIf="parent == 'metrics'" class="uk-text-nowrap uk-table-shrink">
81
                      <div class="{{ getBadgeCSS(repo) }}">{{ getBadgeText(repo) }}</div>
84 82
                    </td>
85 83
                    <td *ngIf="parent=='contentEvents'" class="uk-text-nowrap uk-table-shrink">
86
                      {{ badgeText }}</td>
84
                      {{ getBadgeText(repo) }}</td>
87 85

  
88 86
                    <!--SET ACTIONS-->
89 87
                    <td class="uk-text-nowrap uk-table-shrink">
90
                      <a href="{{ linkToNext }}">
88
                      <a [routerLink]="[getLinkToNext(repo)]">
91 89
                        <i *ngIf="parent !== 'sourcesUpdate'" class="fa fa-eye" aria-hidden="true"></i>
92 90
                        <i *ngIf="parent == 'sourcesUpdate'"class="fa fa-pencil" aria-hidden="true"></i>
93 91
                      </a>
modules/uoa-repository-dashboard-gui/trunk/app/shared/reusablecomponents/repository-tiles.component.ts
1 1
import { Component, Input, OnInit } from '@angular/core';
2
import { PiwikInfo, Repository } from '../../domain/typeScriptClasses';
2
import { Repository } from '../../domain/typeScriptClasses';
3 3
import { RepositoryService } from '../../services/repository.service';
4 4
import { AuthenticationService } from '../../services/authentication.service';
5 5
import { loadingReposMessage, reposRetrievalError } from '../../domain/shared-messages';
......
12 12
export class RepositoryTilesComponent implements OnInit {
13 13
  reposOfUser: Repository[] = [];
14 14
  showSpinner: boolean;
15
  layoutChoice: string;
16
  badgeCSS: string;
17
  badgeText: string;
18
  linkToNext: string;
15
  tilesView: boolean;
19 16
  errorMessage: string;
20 17
  loadingMessage: string;
21 18

  
......
26 23

  
27 24
  ngOnInit() {
28 25
    this.getReposOfUser();
29
    this.layoutChoice = 'tiles';
26
    this.tilesView = true;
30 27
  }
31 28

  
32 29
  getReposOfUser(): void {
......
56 53
      );
57 54
  }
58 55

  
59
  setPropertiesForRepo(repo: Repository): void {
60
    if(this.parent=='metrics'){
61
      this.goToValidationLink(repo.piwikInfo, repo.id);
56
  getLinkToNext(repo): string {
57
    if (this.parent == 'metrics') {
58
      if (repo.piwikInfo) {
59
        if (repo.piwikInfo.validated === true) {
60
          return `show_metrics/${repo.id}`;
61
        } else if (repo.piwikInfo.validated === false) {
62
          return `instructions/${repo.id}`;
63
        }
64
      } else {
65
        return `enable/${repo.id}`;
66
      }
67
    } else if(this.parent == 'sourcesUpdate'){
68
      return repo.id;
69
    } else if(this.parent=='contentEvents'){
70
      return repo.officialName;
71
    }
72
  }
62 73

  
74
  getBadgeCSS(repo): string {
75
    if (this.parent == 'metrics') {
76
      if (repo.piwikInfo) {
77
        if (repo.piwikInfo.validated === true) {
78
          return 'uk-badge uk-badge-success';
79
        } else if (repo.piwikInfo.validated === false) {
80
          return 'uk-badge uk-badge-warning';
81
        }
82
      } else {
83
        return 'uk-badge uk-badge-danger';
84
      }
85
    } else if (this.parent == 'sourcesUpdate') {
86
      return repo.id;
63 87
    } else if(this.parent=='contentEvents'){
64
      this.badgeCSS = 'el-meta uk-margin uk-text-meta';
65
      this.badgeText = '0';
66
      this.linkToNext = `/contact/events/${repo.officialName}`;
67

  
68
    } else if(this.parent=='sourcesUpd') {
69
      console.log("got repo id!!");
70
      this.linkToNext = `/sources/update/${repo.id}`;
88
      return 'el-meta uk-margin uk-text-meta';
71 89
    }
72 90
  }
73 91

  
74
  goToValidationLink(piwik: PiwikInfo, id: string) {
75
    if(piwik){
76
      if(piwik.validated === true){
77
        this.badgeCSS = 'uk-badge uk-badge-success';
78
        this.badgeText = 'enabled';
79
        this.linkToNext = `/getImpact/show_metrics/${id}`;
92
  getBadgeText(repo): string {
93
    if(this.parent=='metrics'){
94
      if(repo.piwikInfo){
95
        if(repo.piwikInfo.validated === true){
96
          return 'enabled';
97
        } else if ( repo.piwikInfo.validated === false ) {
98
          return 'enabling in progress';
99
        }
100
      } else {
101
        return 'not enabled';
102
      }
80 103

  
81
      } else if ( piwik.validated === false ) {
82
        this.badgeCSS = 'uk-badge uk-badge-warning';
83
        this.badgeText = 'enabling in progress';
84
        this.linkToNext = `/getImpact/instructions/${id}`;
85
      }
86
    } else {
87
      this.badgeCSS = 'uk-badge uk-badge-danger';
88
      this.badgeText = 'not enabled';
89
      this.linkToNext = `/getImpact/enable/${id}`;
104
    } else if(this.parent=='contentEvents') {
105
      return '0';
90 106
    }
91 107
  }
92 108

  
93 109
  showTiles(){
94
    this.layoutChoice = 'tiles';
110
    this.tilesView = true;
95 111
  }
96 112

  
97 113
  showList(){
98
    this.layoutChoice = 'list';
114
    this.tilesView = false;
99 115
  }
100 116
}
modules/uoa-repository-dashboard-gui/trunk/app/shared/reusablecomponents/forms/my-array.interface.ts
13 13
@Component({
14 14
  selector : 'form-repeat',
15 15
  template : `
16
  <div [formGroup]="parentGroup" class="uk-margin uk-grid-match uk-child-width-1-2@m uk-grid-small uk-grid uk-scrollspy-inview uk-animation-fade">
16
  <div [formGroup]="parentGroup" class="interfacesForm uk-margin uk-grid-match uk-child-width-1-1 uk-child-width-1-2@m uk-grid-small uk-grid uk-scrollspy-inview uk-animation-fade">
17 17
      <!--<div formArrayName="{{name}}">-->
18
          <ng-template my-form></ng-template>
18
      <ng-template my-form></ng-template>
19 19
      <!--</div>-->
20
      <div class="el-item uk-card uk-card-default uk-card-body uk-scrollspy-inview uk-animation-fade">
21
        <div class="interface-box new" style="text-align: center">
22
          <a class="add-new-element add-new-group" (click)="push()"><i class="fa fa-plus-square-o" aria-hidden="true"></i>
23
            <span class="info">Add New {{ description.label }}</span></a>
24
        </div>
25
      </div>
20 26
  </div>
21
  <div class="uk-margin uk-grid-match uk-child-width-1-2@m uk-grid-small uk-grid uk-scrollspy-inview uk-animation-fade">
22
    <div class="interface-box new" style="text-align: center">
23
        <a class="add-new-element add-new-group" (click)="push()"><i class="fa fa-plus-square-o" aria-hidden="true"></i>
24
          <span class="info">Add New {{ description.label }}</span></a>
25
    </div>
26
  </div>
27 27
`
28 28

  
29 29
})
......
143 143
@Component({
144 144
  selector : 'form-repeat-wrapper',
145 145
  template : `
146
    <div class="group">
147
<!--
148
        <div class="uk-grid">
149
            <div class="uk-width-1-5"></div>
150
            <div class="uk-width-expand\@m">
151
                <label class="">
152
                    {{description.label}}
153
                    <a *ngIf="canDelete" class="remove-element" (click)="remove()">
154
                        <i class="fa fa-times" aria-hidden="true"></i>
155
                    </a>
156
                </label>
157
            </div>
158
        </div>
159
-->
146
    <div class="el-item uk-card uk-card-default uk-card-body uk-scrollspy-inview uk-animation-fade">
160 147
      <div class="interfaceActionsPanel" style="margin-left: 5px;">
161 148
        <a (click)="remove()"><i class="fa fa-remove fa-lg"></i></a>
162 149
      </div>

Also available in: Unified diff