Project

General

Profile

« Previous | Next » 

Revision 60202

[Library | Trunk]

Dashboard - Admin tool pages:
- add tabs components
- add rout module (without guards)
- put tabs and page-content in pages, classes, entities pages

Stakeholder:
initial try to add filters for country and organization fields (doesn't work properly)

View differences:

modules/uoa-services-library/trunk/ng-openaire-library/src/app/dashboard/entity/entities-routing.module.ts
1
import { NgModule } from '@angular/core';
2
import {RouterModule} from '@angular/router';
3
import {EntitiesComponent} from "./entities.component";
4

  
5
@NgModule({
6
  imports: [
7
    RouterModule.forChild([
8
      { path: '',component: EntitiesComponent}
9
    ])
10
  ]
11
})
12
export class EntitiesRoutingModule { }
modules/uoa-services-library/trunk/ng-openaire-library/src/app/dashboard/entity/entities.component.ts
10 10
import {HelperFunctions} from "../../utils/HelperFunctions.class";
11 11
import {UserManagementService} from '../../services/user-management.service';
12 12
import {Subscriber} from "rxjs";
13
import {properties} from "../../../../environments/environment";
13 14

  
14 15
@Component({
15 16
  selector: 'entities',
......
45 46
  public updateErrorMessage = '';
46 47
  public modalErrorMessage = '';
47 48
  public isPortalAdministrator = null;
48
  public filterForm: FormControl;
49
  public filterForm: FormGroup;
49 50
  private subscriptions: any[] = [];
50 51

  
51 52
  constructor(private element: ElementRef, private route: ActivatedRoute,
......
55 56
  }
56 57

  
57 58
  ngOnInit() {
58
    this.filterForm = this._fb.control('');
59
    this.filterForm = this._fb.group({
60
      keyword: [''],
61
      status: ['all', Validators.required]});
62

  
59 63
    this.myForm = this._fb.group({
60 64
      pid: ['', Validators.required],
61 65
      name: ['', Validators.required],
62 66
      isEnabled: '',
63 67
      _id: ''
64 68
    });
65
    this.subscriptions.push(this.filterForm.valueChanges.subscribe(value => {
69
    this.subscriptions.push(this.filterForm.get('keyword').valueChanges.subscribe(value => {
66 70
      this.filterBySearch(value);
67 71
    }));
68
    this.route.data
69
      .subscribe((data: { envSpecific: EnvProperties }) => {
70
        this.properties = data.envSpecific;
72
    this.subscriptions.push(this.filterForm.get('status').valueChanges.subscribe(value => {
73
      this.applyStatusFilter();
74
    }));
71 75

  
72
        this.route.queryParams.subscribe(params => {
73
          HelperFunctions.scroll();
74
          this.userManagementService.getUserInfo().subscribe(user => {
75
            this.selectedCommunityPid = params['communityId'];
76
            this.applyCommunityFilter(this.selectedCommunityPid);
77
            this.isPortalAdministrator = Session.isPortalAdministrator(user) && !this.selectedCommunityPid;
78
          });
76
      this.properties = properties;
77
      this.subscriptions.push(this.route.queryParams.subscribe(params => {
78
        HelperFunctions.scroll();
79
        this.userManagementService.getUserInfo().subscribe(user => {
80
          this.selectedCommunityPid = params['communityId'];
81
          this.applyCommunityFilter(this.selectedCommunityPid);
82
          this.isPortalAdministrator = Session.isPortalAdministrator(user) && !this.selectedCommunityPid;
79 83
        });
80
      });
84
      }));
81 85

  
86

  
82 87
  }
83 88
  ngOnDestroy(): void {
84 89
    this.subscriptions.forEach(value => {
......
123 128
            });
124 129
            this.showLoading = false;
125 130
          },
126
          error => this.handleError('System error retrieving community entities', error));
131
          error => this.handleError('System error retrieving entities', error));
127 132
      }
128 133
    }
129 134
  }
......
281 286
    return textFlag;
282 287
  }
283 288

  
289
  public applyStatusFilter() {
290
    this.checkboxes = [];
291
    this.entities.filter(item => this.filterEntitiesByStatus(item)).forEach(
292
      _ => this.checkboxes.push(<CheckEntity>{entity: _, checked: false})
293
    );
294
  }
295

  
296
  public filterEntitiesByStatus(entity: Entity): boolean {
297
    let status = this.filterForm.get("status").value;
298
    return  status == "all" || (status == "disabled" && !entity.isEnabled) || (status == "enabled" && entity.isEnabled);
299
  }
300

  
284 301
  handleError(message: string, error) {
285 302
    this.errorMessage = message;
286 303
    console.log('Server responded: ' + error);
modules/uoa-services-library/trunk/ng-openaire-library/src/app/dashboard/sharedComponents/admin-tabs/admin-tabs.module.ts
1
import {NgModule} from '@angular/core';
2
import {CommonModule} from '@angular/common';
3
import {AdminTabsComponent} from "./admin-tabs.component";
4
import {RouterModule} from "@angular/router";
5

  
6
@NgModule({
7
  declarations: [AdminTabsComponent],
8
  imports: [
9
    CommonModule, RouterModule
10
  ],
11
  exports:[AdminTabsComponent]
12
})
13
export class AdminTabsModule {
14
}
modules/uoa-services-library/trunk/ng-openaire-library/src/app/dashboard/page/pages.component.html
1
<div id="page_content" click-outside-or-esc targetId="page_content">
2
  <div class="uk-padding-small md-bg-white" uk-grid>
3

  
4
    <div class="uk-width-expand@m uk-width-1-1 uk-flex uk-flex-middle uk-flex-right">
5
      <div class="uk-inline uk-width-medium">
6
        <span class="uk-position-center-right"><i class="material-icons">search</i></span>
7
        <div dashboard-input [formInput]="filterForm" label="Find page"></div>
1
<div page-content>
2
  <admin-tabs tab = "page" [portal]="selectedCommunityPid" header></admin-tabs>
3
  <div inner class="admin-pages">
4
    <div *ngIf="!errorMessage && !showLoading" class="filters" uk-sticky="offset:150">
5
      <div class="show-options uk-float-right">
6
        <button class="uk-button uk-button-primary " type="button">Bulk Actions</button>
7
        <div uk-dropdown="mode: click">
8
          <ul class="uk-nav  uk-margin-left"
9
              [attr.uk-tooltip]="getSelectedPages().length == 0 ? 'pos:left; cls: uk-active' : 'cls: uk-invisible'"
10
              title="Select at least one page">
11
            <li *ngIf="!isPortalAdministrator"><a [class]="getSelectedPages().length == 0 ? 'uk-disabled' : ''"
12
                                                  (click)="togglePages(true, getSelectedPages())"> Activate
13
            </a></li>
14
            <li *ngIf="!isPortalAdministrator"><a [class]="getSelectedPages().length == 0 ? 'uk-disabled' : ''"
15
                                                  (click)="togglePages(false, getSelectedPages())">  Deactivate
16
            </a></li>
17
            <li *ngIf="isPortalAdministrator"><a (click)="confirmDeleteSelectedPages()"> Delete </a></li>
18
          </ul>
19
        </div>
8 20
      </div>
9

  
21
      <div class="uk-inline uk-width-medium uk-float-right uk-margin-right">
22
        <div dashboard-input [formInput]="filterForm.controls.keyword" placeholder="search page" ></div>
23
      </div>
24
      <ul     class="uk-subnav uk-subnav-pill subCategoriesTabs ignore admin  " >
25
        <li [class.uk-active]="filterForm.get('type').value === 'all'"><a
26
          (click)="filterForm.get('type').setValue('all')"><span
27
          class="title">All pages</span></a></li>
28
        <li  *ngFor="let type of typeOptions; let i=index"
29
             [class.uk-active]="filterForm.get('type').value === type.value"><a
30
          (click)="filterForm.get('type').setValue(type.value)"><span
31
          class="title">{{type.label}}</span></a></li>
32
      </ul>
33
<!--      <input    class="uk-width-1-1  "-->
34
<!--               placeholder="SEARCH FOR A COUNTRY" type="text" autocomplete="off" role="combobox" aria-autocomplete="list" aria-expanded="false" aria-haspopup="true">-->
10 35
    </div>
11
  </div>
12 36

  
13
  <div id="page_content_inner">
14
    <div *ngIf="!errorMessage && !showLoading" class="page-controls">
15
      <div class="  filters ">
16
        <div class="show-options uk-float-right">
17
          <button class="uk-button uk-button-primary" type="button">Bulk Actions</button>
18
          <div uk-dropdown="mode: click">
19
            <ul class="uk-nav  uk-margin-left"
20
                [attr.uk-tooltip]="getSelectedPages().length == 0 ? 'pos:left; cls: uk-active' : 'cls: uk-invisible'"
21
                title="Select at least one page">
22
              <li *ngIf="!isPortalAdministrator"><a [class]="getSelectedPages().length == 0 ? 'uk-disabled' : ''"
23
                                                    (click)="togglePages(true, getSelectedPages())"> Activate
24
              </a></li>
25
              <li *ngIf="!isPortalAdministrator"><a [class]="getSelectedPages().length == 0 ? 'uk-disabled' : ''"
26
                                                    (click)="togglePages(false, getSelectedPages())">  Deactivate
27
              </a></li>
28
              <li *ngIf="isPortalAdministrator"><a (click)="confirmDeleteSelectedPages()"> Delete </a></li>
29
            </ul>
30
          </div>
37
    <div class="content-wrapper uk-margin-top" id="contentWrapper">
38
      <a  *ngIf="!showLoading && isPortalAdministrator && !errorMessage" (click)="newPage()"
39
          class="uk-flex uk-flex-right uk-flex-middle uk-margin-small-bottom uk-width-1-1">
40
        <div class="uk-button-default large uk-icon-button uk-margin-small-right"  uk-icon="plus">
31 41
        </div>
32
      </div>
33
    </div>
34
    <h4 class="uk-text-bold uk-text-upper">{{pagesType}} Pages</h4>
35
    <div *ngIf="updateErrorMessage" class="uk-alert-danger" uk-alert>
36
      <a class="uk-alert-close" uk-close></a>
37
      {{updateErrorMessage}}
38
    </div>
39

  
40
    <div class="content-wrapper" id="contentWrapper">
41
      <div>
42
        <div class="contentPanel uk-margin-top">
43

  
44

  
45
          <div *ngIf="!isPortalAdministrator" class="uk-alert uk-alert-primary uk-margin-top-large">
46
            <div>
47
              <span class="uk-margin-small-right uk-icon" uk-icon="warning"></span>
48
              Disable a page to hide it from community dashboard portal.
49
            </div>
50
            <div
51
              class="uk-text-small">If the page is disabled, a message "Can't find that page" will appear in case the url of that page is loaded. If the disabled page belongs to the menu, the link will be removed from menu, too.
52
            </div>
53

  
42
        Add page
43
      </a>
44
      <div class="contentPanel ">
45
        <div *ngIf="!isPortalAdministrator" class="uk-alert uk-alert-primary uk-margin-top-large">
46
          <div>
47
            <span class="uk-margin-small-right uk-icon" uk-icon="warning"></span>
48
            Disable a page to hide it from community dashboard portal.
54 49
          </div>
55
          <div *ngIf="errorMessage" class="uk-alert uk-alert-danger  uk-margin-large-top"
56
               role="alert">{{errorMessage}}</div>
57
          <div [style.display]="showLoading ? 'inline' : 'none'"
58
               class="uk-animation-fade uk-margin-large-top  uk-width-1-1" role="alert"><img
59
            class="uk-align-center loading-gif"></div>
60
          <div class="md-card uk-margin-medium-bottom" *ngIf="!errorMessage && !showLoading">
61
            <div class="md-card-content">
62
              <div class="uk-overflow-container">
63
                <table class="uk-table uk-table-striped">
64
                  <thead>
65
                  <tr>
66
                    <th><input id="allPageCheckbox" type="checkbox" (change)="toggleCheckBoxes($event)"></th>
67
                    <th>Name</th>
68
                    <th *ngIf="!isPortalAdministrator">Change status</th>
69
                    <th *ngIf="!pagesType">Type</th>
70
                    <th *ngIf="!isPortalAdministrator">Related Entities</th>
71
                    <th>Route</th>
72
                    <th *ngIf="!selectedCommunityPid">Portal Type</th>
73
                    <th *ngIf="isPortalAdministrator">Actions</th>
74
                    <th *ngIf="!isPortalAdministrator" class="uk-text-center">Page help texts</th>
75
                    <th *ngIf="!isPortalAdministrator && (pageWithDivIds && pageWithDivIds.length > 0)"
76
                        class="uk-text-center">Class help texts
77
                    </th>
78
                  </tr>
79
                  </thead>
80
                  <tbody>
81
                  <tr *ngFor="let check of checkboxes; let i=index">
82
                    <td><input id="{{check.page._id}}" class="checkBox" type="checkbox"
83
                               name="pagescb[]" value="{{check.page._id}}" [(ngModel)]="check.checked">
84
                    </td>
85
                    <td>
86
                      <div class="name" href="#">{{check.page.name}}</div>
87
                    </td>
88
                    <td *ngIf="!isPortalAdministrator">
89
                      <mat-slide-toggle [checked]="check.page.isEnabled"
90
                                        (change)="($event.source.checked = check.page.isEnabled);togglePages(!check.page.isEnabled,[check.page._id])"></mat-slide-toggle>
91
                    </td>
92
                    <td *ngIf="!pagesType">
93
                      <div class="type" href="#">{{check.page.type}}</div>
94
                    </td>
95
                    <td *ngIf="!isPortalAdministrator">
96
                      <div class="entities" href="#">
97
                        <span *ngFor="let entity of check.page.entities let i=index">{{entity.name}}<span
98
                          *ngIf="i<(check.page.entities.length-1)">, </span></span>
99
                      </div>
100
                    </td>
101
                    <td>
102
                      <div class="route" href="#">{{check.page.route}}</div>
103
                    </td>
104
                    <td *ngIf="!selectedCommunityPid">
105
                      <div class="portalType" href="#">{{check.page.portalType}}</div>
106
                    </td>
50
          <div
51
            class="uk-text-small">If the page is disabled, a message "Can't find that page" will appear in case the url of that page is loaded. If the disabled page belongs to the menu, the link will be removed from menu, too.
52
          </div>
107 53

  
108
                    <td *ngIf="isPortalAdministrator">
109
                      <div class="actions" href="#">
110
                        <i class="clickable " (click)="editPage(i)" uk-icon="pencil"></i>
111
                        <i class="clickable uk-text-danger"
112
                           (click)="confirmDeletePage(check.page._id)" uk-icon="trash"></i>
113
                      </div>
114
                    </td>
115
                    <td *ngIf="!isPortalAdministrator" class="uk-text-center">
54
        </div>
55
        <div *ngIf="updateErrorMessage" class="uk-alert-danger" uk-alert>
56
          <a class="uk-alert-close" uk-close></a>
57
          {{updateErrorMessage}}
58
        </div>
59
        <div *ngIf="errorMessage" class="uk-alert uk-alert-danger  uk-margin-large-top"
60
             role="alert">{{errorMessage}}</div>
61
        <div [style.display]="showLoading ? 'inline' : 'none'"
62
             class="uk-animation-fade uk-margin-large-top  uk-width-1-1" role="alert"><img
63
          class="uk-align-center loading-gif"></div>
64
        <div class="md-card uk-margin-medium-bottom" *ngIf="!errorMessage && !showLoading">
65
          <div class="md-card-content">
66
            <div class="uk-overflow-container">
67
              <ul class="uk-list pages">
68
                <li *ngFor="let check of checkboxes; let i=index" class="uk-card uk-card-default uk-margin-bottom">
69
                  <div class="uk-grid uk-padding">
70
                  <div class=""><input id="{{check.page._id}}" class="checkBox" type="checkbox"
71
                             name="pagescb[]" value="{{check.page._id}}" [(ngModel)]="check.checked">
72
                  </div>
73
                  <div  class="uk-width-expand">
74
                    <div class="title uk-margin-medium-bottom">Name</div>
75
                    <div class="name uk-margin-medium-bottom" href="#">{{check.page.name}}</div>
76
                    <div *ngIf="check.page.entities && check.page.entities.length > 0"><span
77
                      class="title">Entities: </span>
78
                      {{check.page.entities.join(", ")}}</div>
79
                    <div class=" uk-margin-small-bottom"><span class="title">Route: </span> {{check.page.route}}</div>
80
                    <div *ngIf="!pagesType" class=" uk-margin-small-bottom"><span class="title">Type: </span> {{check.page.type}}</div>
81
                    <div *ngIf="!selectedCommunityPid" class=" uk-margin-small-bottom">
82
                      <span class="title" >Portal type: </span>{{check.page.portalType}}
83
                    </div>
84
                  </div>
85
                  <div *ngIf="isPortalAdministrator" class="uk-width-1-4">
86
                    <div class="title uk-margin-medium-bottom">Actions</div>
87
                    <div class="actions" href="#">
88
                      <i class="clickable " (click)="editPage(i)" uk-icon="pencil"></i>
89
                      <i class="clickable uk-text-danger"
90
                         (click)="confirmDeletePage(check.page._id)" uk-icon="trash"></i>
91
                    </div>
92
                  </div>
93
                  <div *ngIf="!isPortalAdministrator" class="uk-width-1-4">
94
                    <div class="title uk-margin-medium-bottom">Helptexts</div>
95
                    <div class=" uk-margin-small-bottom">
116 96
                      <a *ngIf="check.page.top || check.page.bottom || check.page.left || check.page.right"
117 97
                         class="helpContents"
118 98
                         [queryParams]="{communityId: selectedCommunityPid, pageId: check.page._id}"
119 99
                         routerLink="../../helptexts">
120
                        add help texts
100
                        manage help texts
121 101
                      </a>
122
                      <span
123
                        *ngIf="!check.page.top && !check.page.bottom && !check.page.left && !check.page.right">-</span>
124
                    </td>
125
                    <td *ngIf="!isPortalAdministrator && (pageWithDivIds && pageWithDivIds.length > 0)"
126
                        class="uk-text-center">
102
                    </div>
103
                    <div>
127 104
                      <a *ngIf="pageWithDivIds.includes(check.page._id)" class="classHelpContents"
128
                         [queryParams]="{communityId: selectedCommunityPid, pageId: check.page._id}"
129
                         routerLink="../../classContents">add class contents</a>
130
                      <span *ngIf="!pageWithDivIds.includes(check.page._id)">-</span>
131
                    </td>
132
                  </tr>
133
                  </tbody>
134
                </table>
105
                       [queryParams]="{communityId: selectedCommunityPid, pageId: check.page._id}"
106
                       routerLink="../../classContents">manage class contents</a>
107
                    </div>
108
                  </div>
109
                  <div *ngIf="!isPortalAdministrator" class="uk-width-1-4">
110
                    <div class="title uk-margin-medium-bottom">Enable/disable</div>
111
                    <mat-slide-toggle [checked]="check.page.isEnabled"
112
                                      (change)="($event.source.checked = check.page.isEnabled);togglePages(!check.page.isEnabled,[check.page._id])"></mat-slide-toggle>
113
                  </div>
114
                  </div>
115
                </li>
116
                
117
              </ul>
135 118

  
136
                <div *ngIf="checkboxes.length==0" class="col-md-12">
137
                  <div class="uk-alert-warning" uk-alert>No pages found</div>
119
              <div *ngIf="checkboxes.length==0" class="col-md-12">
120
                <div class="uk-alert-warning" uk-alert>No pages found</div>
121
              </div>
122
              <div *ngIf="isPortalAdministrator" class="uk-width-1-1 uk-flex uk-flex-center ">
123
                <div class="uk-width-small uk-button uk-button-default" (click)="newPage()">
124
                  <i class="" uk-icon="plus"></i>
138 125
                </div>
139
                <div *ngIf="isPortalAdministrator" class="uk-width-1-1 uk-flex uk-flex-center ">
140
                  <div class="uk-width-small uk-button uk-button-default" (click)="newPage()">
141
                    <i class="" uk-icon="plus"></i>
142
                  </div>
143
                </div>
144 126
              </div>
145 127
            </div>
146 128
          </div>
......
150 132
  </div>
151 133
</div>
152 134

  
153

  
154 135
<modal-alert #AlertModalSavePage (alertOutput)="pageSaveConfirmed($event)" [okDisabled]="myForm && (myForm.invalid || !myForm.dirty)">
155 136
  <div *ngIf="modalErrorMessage" class="uk-alert-danger" uk-alert aria-hidden="true">{{ modalErrorMessage }}</div>
156 137
  <form [formGroup]="myForm">
......
177 158
          [removable]="true">
178 159
          {{entity.name}}
179 160
          <span (click)="remove(entity)"
180
                class="mat-icon notranslate mat-chip-remove mat-chip-trailing-icon material-icons mat-icon-no-color ng-star-inserted">cancel</span>
161
                class=" notranslate mat-chip-remove mat-chip-trailing-icon " uk-icon="trash"></span>
181 162
        </mat-chip>
182 163
        <input placeholder="Add in  pages..." #PageInput
183 164
               [formControl]="entitiesSearchCtrl" [matAutocomplete]="auto" [matChipInputFor]="chipList">
......
188 169
        </mat-option>
189 170
      </mat-autocomplete>
190 171
    </mat-form-field>
191
    <!--<div formArrayName="entities" class="form-group">
192
      <label for="entityNameTag">Entity Name</label>
193
      <div id="entityNameTag">
194
        <pre class="card card-block card-header"><span *ngFor="let entity of myForm.value.entities; let i=index">{{entity.name}}<span *ngIf="i<(myForm.value.entities.length-1)">, </span></span></pre>
195 172

  
196
        <button type="button" (click)="toggle()">Add / Remove entities</button>
197

  
198
        <ng-container *ngIf="!myForm.value.isCollapsed">
199
          <div *ngIf="errorMessage" class="uk-alert uk-alert-danger" role="alert">{{errorMessage}}</div>
200
          <div [style.display]="showLoading ? 'inline' : 'none'" class="uk-animation-fade uk-width-1-1" role="alert"><img class="uk-align-center loading-gif"></div>
201

  
202
          <div *ngFor="let entity of getKeys(allEntities)">
203
              <span>
204
                <span *ngIf="allEntities.get(entity)" class="activated" >
205
                    <input (click)="toggleEntity(false,[entity._id], entity)" class="deactivate" src="assets/imgs/delete-icon.png" title="Disable" width="20" type="image" height="20">
206
                </span>
207
                <span *ngIf="!allEntities.get(entity)" class="deactivated" >
208
                    <input (click)="toggleEntity(true,[entity._id], entity)" class="deactivate" src="assets/imgs/add-icon.png" title="Enable" width="20" type="image" height="20">
209
                </span>
210
                {{entity.name}}
211
              </span>
212
          </div>
213
        </ng-container>
214
      </div>
215
    </div>-->
216

  
217
<!--    <div class="form-group" uk-grid>-->
218
<!--      <label class="uk-width-1-1 uk-margin-small-bottom">-->
219
<!--        Select positions of help contents for this page.-->
220
<!--      </label>-->
221
<!--      <label class="uk-text-danger uk-margin-small-bottom">-->
222
<!--        By disabling a position, all contents in this position will be deleted.-->
223
<!--      </label>-->
224
<!--      <label class="uk-width-1-4 checkbox">-->
225
<!--        <span class="uk-margin-small-right" style="font-weight: normal;">Top</span>-->
226
<!--        <input tabindex="0" type="checkbox" formControlName="top">-->
227
<!--      </label>-->
228
<!--      <label class="uk-width-1-4 checkbox">-->
229
<!--        <span class="uk-margin-small-right" style="font-weight: normal;">Bottom</span>-->
230
<!--        <input tabindex="0" type="checkbox" formControlName="bottom">-->
231
<!--      </label>-->
232
<!--      <label class="uk-width-1-4 checkbox">-->
233
<!--        <span class="uk-margin-small-right" style="font-weight: normal;">Left</span>-->
234
<!--        <input tabindex="0" type="checkbox" formControlName="left">-->
235
<!--      </label>-->
236
<!--      <label class="uk-width-1-4 checkbox">-->
237
<!--        <span class="uk-margin-small-right" style="font-weight: normal;">Right</span>-->
238
<!--        <input tabindex="0" type="checkbox" formControlName="right">-->
239
<!--      </label>-->
240
<!--    </div>-->
241 173
    <div class="form-group" >
242 174
      <label class="uk-text-danger uk-margin-small-bottom">
243 175
        By disabling a position, all contents in this position will be deleted.
244 176
      </label>
245
      <div class="uk-text-muted"> Select if this page exists in:</div>
177
      <div class="title"> Select if this page exists in:</div>
246 178
      <div class=" uk-grid">
247 179
        <span dashboard-input class="" [formInput]="myForm.get('top')"
248 180
              type="checkbox"
......
262 194
        </span>
263 195
      </div>
264 196
    </div>
265
<!--    <div class="form-group">-->
266

  
267
<!--      <div class="uk-text-muted"> Select if this page exists in:</div>-->
268
<!--      <span dashboard-input class="" [formInput]="myForm.get('openaire')"-->
269
<!--            type="checkbox"-->
270
<!--            label="Explore Portal">-->
271
<!--      </span>-->
272
<!--      <span dashboard-input class="uk-margin-small-left" [formInput]="myForm.get('connect')"-->
273
<!--            type="checkbox"-->
274
<!--            label="Connect Portal">-->
275
<!--      </span>-->
276
<!--      <span dashboard-input class="uk-margin-small-left" [formInput]="myForm.get('communities')"-->
277
<!--            type="checkbox"-->
278
<!--            label="Communities Dashboards">-->
279
<!--      </span>-->
280
<!--    </div>-->
281

  
282 197
    <div [ngClass]="{'has-error':!myForm.controls.portalType.valid && myForm.controls.portalType.dirty}" class="form-group" >
283
      <div class="uk-width-1-1 uk-margin-small-bottom">
198
      <div class="uk-width-1-1 uk-margin-small-bottom uk-text-bold uk-form-label">
284 199
        Page exists in:
285 200
      </div>
286 201
      <div class="uk-child-width-1-2 uk-grid">
......
296 211

  
297 212
</modal-alert>
298 213

  
299
<!--<modal-alert #AlertModalUpdatePage (alertOutput)="pageUpdateConfirmed($event)">-->
300
<!--  <div *ngIf="modalErrorMessage" class="uk-alert-danger" uk-alert aria-hidden="true">{{ modalErrorMessage }}</div>-->
301
<!--  <page-form [group]="myForm"></page-form>-->
302
<!--</modal-alert>-->
303

  
304 214
<modal-alert #AlertModalDeletePages (alertOutput)="confirmedDeletePages($event)"></modal-alert>
modules/uoa-services-library/trunk/ng-openaire-library/src/app/dashboard/page/pages.module.ts
7 7
import {MatAutocompleteModule, MatChipsModule, MatFormFieldModule, MatSlideToggleModule} from '@angular/material';
8 8
import {AdminToolServiceModule} from "../../services/adminToolService.module";
9 9
import {InputModule} from "../../sharedComponents/input/input.module";
10
import {AdminTabsModule} from "../sharedComponents/admin-tabs/admin-tabs.module";
11
import {PageContentModule} from "../sharedComponents/page-content/page-content.module";
12
import {PagesRoutingModule} from "./pages-routing.module";
10 13

  
11 14
@NgModule({
12 15
  imports: [
13 16
    CommonModule, RouterModule, FormsModule, AlertModalModule, ReactiveFormsModule, MatSlideToggleModule, AdminToolServiceModule, InputModule,
14
    MatAutocompleteModule, MatFormFieldModule, MatChipsModule
17
    MatAutocompleteModule, MatFormFieldModule, MatChipsModule, AdminTabsModule, PageContentModule, PagesRoutingModule
15 18
  ],
16 19
    declarations: [PagesComponent],
17 20
    exports: [PagesComponent]
modules/uoa-services-library/trunk/ng-openaire-library/src/app/dashboard/sharedComponents/admin-tabs/admin-tabs.component.ts
1
import {Component, Input, OnInit} from '@angular/core';
2
import {Session, User} from "../../../login/utils/helper.class";
3
import {UserManagementService} from "../../../services/user-management.service";
4
import {Subscriber} from "rxjs";
5
import {ActivatedRoute} from "@angular/router";
6
import {HelperFunctions} from "../../../utils/HelperFunctions.class";
7

  
8
@Component({
9
  selector: 'admin-tabs',
10
  template: `    
11
    <ul class="uk-tab customTabs admin uk-flex uk-flex-center uk-flex-left@m">
12
      <li *ngIf="isPortalAdmin && (!portal )" class="uk-disabled" > <span  class = "uk-margin-small-right" uk-icon="cog"></span></li>
13
      <li *ngIf="isPortalAdmin && !portal" [class.uk-active]="tab === 'portal'"><a routerLink="../../portals"><span class="title">Portals</span></a></li>
14
      <li [class.uk-active]="tab === 'page'"><a  routerLink="../../pages" [queryParams]="(portal? {communityId:portal}:{})"  ><span class="title">Pages</span></a></li>
15
      <li [class.uk-active]="tab === 'entity'"><a  routerLink="../../entities" [queryParams]="(portal? {communityId:portal}:{})"><span class="title">Entities</span></a></li>
16
      <li  *ngIf="isPortalAdmin  && !portal" [class.uk-active]="tab === 'class'"><a routerLink="../../classes"><span class="title">Class Ids</span></a></li>
17
    </ul>
18
  `
19
})
20
export class AdminTabsComponent implements OnInit {
21

  
22
  @Input()
23
  public type: string;
24
  @Input()
25
  portal = null;
26
  @Input()
27
  public user: User;
28
  @Input()
29
  public tab: "portal"| "page" | "entity" | "class" = 'page';
30

  
31
  private subscriptions: any[] = [];
32
  constructor(private route: ActivatedRoute, private userManagementService: UserManagementService) {
33
  }
34

  
35
  ngOnInit() {
36
    this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => {
37
      this.user = user;
38

  
39
    }));
40
    this.subscriptions.push(this.route.queryParams.subscribe(params => {
41
      HelperFunctions.scroll();
42
      this.portal = params['communityId'];
43

  
44
    }));
45
  }
46
  ngOnDestroy(): void {
47
    this.subscriptions.forEach(value => {
48
      if (value instanceof Subscriber) {
49
        value.unsubscribe();
50
      } else if (value instanceof Function) {
51
        value();
52
      }
53
    });
54
  }
55

  
56

  
57
  public get isPortalAdmin() {
58
    return Session.isPortalAdministrator(this.user) || Session.isCurator(this.type, this.user);
59
  }
60

  
61
}
modules/uoa-services-library/trunk/ng-openaire-library/src/app/monitor/entities/stakeholder.ts
209 209
    }else if (field == "project"){
210 210
      return this.getProjectFilter(filterType);
211 211
    }
212
    //TODO add other options
212
    //TODO uncomment to add other options --> following doesn't work
213
/*    else if (field == "country"){
214
      return this.getCountryFilter(filterType);
215
    }else if (field == "organization"){
216
      return this.getOrganizationFilter(filterType);
217
    }*/
213 218

  
214 219
  }
215 220
  static getResultFilter(dbType: string = null, filterType:FilterType) {
......
233 238
    }
234 239
  }
235 240
  static getOrganizationFilter( filterType:FilterType) {
236
      if (filterType == "fundingL0") {
237
        return '';
238
      } else if (filterType == "start_year") {
239
        return '';
240
      } else if (filterType == "end_year") {
241
        return '';
242
      }
241
    if (filterType == "fundingL0") {
242
      return '{"groupFilters":[{"field":"organization.project.funding level 0","type":"=","values":["' + ChartHelper.prefix + 'fundingL0' + ChartHelper.suffix + '"]}],"op":"AND"}';
243
    } else if (filterType == "start_year") {
244
      return '{"groupFilters":[{"field":"organization.project.start year","type":">=","values":["' + ChartHelper.prefix + 'start_year' + ChartHelper.suffix + '"]}],"op":"AND"}';
245
    } else if (filterType == "end_year") {
246
      return '{"groupFilters":[{"field":"organization.project.start year","type":"<=","values":["' + ChartHelper.prefix + 'end_year' + ChartHelper.suffix + '"]}],"op":"AND"}';
247
    }
243 248
  }
249
  static getCountryFilter( filterType:FilterType) {
250
    if (filterType == "fundingL0") {
251
      return '{"groupFilters":[{"field":"country.organization.project.funding level 0","type":"=","values":["' + ChartHelper.prefix + 'fundingL0' + ChartHelper.suffix + '"]}],"op":"AND"}';
252
    } else if (filterType == "start_year") {
253
      return '{"groupFilters":[{"field":"country.organization.project.start year","type":">=","values":["' + ChartHelper.prefix + 'start_year' + ChartHelper.suffix + '"]}],"op":"AND"}';
254
    } else if (filterType == "end_year") {
255
      return '{"groupFilters":[{"field":"country.organization.project.start year","type":"<=","values":["' + ChartHelper.prefix + 'end_year' + ChartHelper.suffix + '"]}],"op":"AND"}';
256
    }
257
  }
244 258

  
245 259
  static filterIndexOf(filterToAdd, currentFilters):any{
246 260
    for(let fi =0; fi< currentFilters.length; fi++){
modules/uoa-services-library/trunk/ng-openaire-library/src/app/dashboard/divId/divIds.component.html
1
<div id="page_content">
2
  <div class="uk-padding-small md-bg-white" uk-grid>
3

  
4
    <div class="uk-width-expand@m uk-width-1-1 uk-flex uk-flex-middle uk-flex-right">
5
      <div class="uk-inline uk-width-medium">
6
        <span class="uk-position-center-right"><i class="material-icons">search</i></span>
7
        <div dashboard-input [formInput]="filterForm" label="Find class"></div>
1
<div page-content>
2
  <admin-tabs tab = "class" header></admin-tabs>
3
  <div inner class="admin-pages">
4
  <div *ngIf="!errorMessage && !showLoading" class="filters" uk-sticky="offset:150">
5
    <div class="show-options uk-float-right">
6
      <button class="uk-button uk-button-primary " type="button">Bulk Actions</button>
7
      <div uk-dropdown="mode: click">
8
        <ul class="uk-nav uk-margin-left"
9
            [attr.uk-tooltip]="getSelectedDivIds().length == 0 ? 'pos:left; cls: uk-active' : 'cls: uk-invisible'"
10
            title="Select at least one class">
11
          <li><a [class]="getSelectedDivIds().length == 0 ? 'uk-disabled' : ''"
12
                 (click)="confirmDeleteSelectedDivIds()"><i></i> Delete </a></li>
13
        </ul>
8 14
      </div>
9

  
10 15
    </div>
16
    <div class="uk-inline uk-width-medium  uk-float-right uk-margin-right" >
17
      <span class="uk-position-center-right"><i class="material-icons">search</i></span>
18
      <div dashboard-input  [formInput]="filterForm.controls.keyword"
19
           placeholder="Search"></div>
20
    </div>
21
    <ul     class="uk-subnav uk-subnav-pill subCategoriesTabs ignore admin  " >
22
      <li [class.uk-active]="filterForm.get('type').value === 'all'" class="uk-margin-small-bottom"><a
23
        (click)="filterForm.get('type').setValue('all')"><span
24
        class="title">All portals</span></a></li>
25
      <li  *ngFor="let type of  portalUtils.portalTypes; let i=index"
26
           [class.uk-active]="filterForm.get('type').value === type.value" class="uk-margin-small-bottom"><a
27
        (click)="filterForm.get('type').setValue(type.value)"><span
28
        class="title">{{type.label}}</span></a></li>
29
    </ul>
11 30
  </div>
12 31

  
13 32

  
14
  <div id="page_content_inner">
15
    <div class="menubar ">
16
      <h4 class="uk-text-bold">Predefined classes for contents</h4>
17
      <div *ngIf="updateErrorMessage" class="uk-alert-danger" uk-alert>
18
        <a class="uk-alert-close" uk-close></a>
19
        {{updateErrorMessage}}
20
      </div>
21

  
22
    </div>
23

  
24 33
    <div class="content-wrapper" id="contentWrapper">
34
      <a  *ngIf="!showLoading && !errorMessage" (click)="newDivId()"
35
          class="uk-flex uk-flex-right uk-flex-middle uk-margin-small-bottom uk-width-1-1">
36
        <div class="uk-button-default large uk-icon-button uk-margin-small-right"  uk-icon="plus">
37
        </div>
38
        Add class
39
      </a>
25 40
      <div>
26 41
        <div class="contentPanel">
42
          <div *ngIf="updateErrorMessage" class="uk-alert-danger" uk-alert>
43
            <a class="uk-alert-close" uk-close></a>
44
            {{updateErrorMessage}}
45
          </div>
27 46
          <div *ngIf="errorMessage" class="uk-alert uk-alert-danger  uk-margin-large-top"
28 47
               role="alert">{{errorMessage}}</div>
29 48
          <div [style.display]="showLoading ? 'inline' : 'none'"
30 49
               class="uk-animation-fade uk-margin-large-top  uk-width-1-1" role="alert"><img
31 50
            class="uk-align-center loading-gif"></div>
32 51

  
33
          <div *ngIf="!errorMessage && !showLoading" class="page-controls">
34
            <div class="  filters ">
35
              <div class="show-options uk-float-right">
36
                <button class="uk-button" type="button">Bulk Actions</button>
37
                <div uk-dropdown="mode: click">
38
                  <ul class="uk-nav uk-margin-left"
39
                      [attr.uk-tooltip]="getSelectedDivIds().length == 0 ? 'pos:left; cls: uk-active' : 'cls: uk-invisible'"
40
                      title="Select at least one class">
41
                    <li><a [class]="getSelectedDivIds().length == 0 ? 'uk-disabled' : ''"
42
                           (click)="confirmDeleteSelectedDivIds()"><i></i> Delete </a></li>
43
                  </ul>
44
                </div>
45
              </div>
46
            </div>
47
          </div>
48

  
49 52
          <div class="md-card uk-margin-medium-bottom" *ngIf="!errorMessage && !showLoading">
50 53
            <div class="md-card-content">
51 54
              <div class="uk-overflow-container">
52 55

  
53
                <table class="uk-table uk-table-striped">
54
                  <thead>
56
                <table class="uk-table uk-table-striped uk-table-large">
57
                  <thead class="form-header">
55 58
                  <tr>
56
                    <th><input id="allDivIdCheckbox" type="checkbox" (change)="toggleCheckBoxes($event)"></th>
59
                    <th
60
                      class="uk-width-small"><input id="allDivIdCheckbox" type="checkbox" (change)="toggleCheckBoxes($event)"></th>
57 61
                    <th>Name</th>
62
                    <th *ngIf="!selectedCommunityPid">Portal Type</th>
58 63
                    <th>Page</th>
59
                    <th *ngIf="selectedCommunityPid">Portal Type</th>
60 64
                    <th>Actions</th>
61 65
                  </tr>
62 66
                  </thead>
......
104 108
      </div>
105 109
    </div>
106 110
  </div>
107
</div>
108 111

  
109

  
110 112
<modal-alert #AlertModalSaveDivId (alertOutput)="divIdSaveConfirmed($event)"
111 113
             [okDisabled]="myForm && (myForm.invalid || !myForm.dirty)">
112 114
  <div *ngIf="modalErrorMessage" class="uk-alert-danger" uk-alert aria-hidden="true">{{ modalErrorMessage }}</div>
......
124 126
          [removable]="true">
125 127
          {{page.name}}
126 128
          <span (click)="remove(page)"
127
                class="mat-icon notranslate mat-chip-remove mat-chip-trailing-icon material-icons mat-icon-no-color ng-star-inserted">cancel</span>
129
                class=" notranslate mat-chip-remove mat-chip-trailing-icon " uk-icon="trash"></span>
128 130
        </mat-chip>
129 131
        <input placeholder="Add in  pages..." #PageInput
130 132
               [formControl]="pageSearchCtrl" [matAutocomplete]="auto" [matChipInputFor]="chipList">
......
137 139
    </mat-form-field>
138 140

  
139 141
    <div [ngClass]="{'has-error':!myForm.controls.portalType.valid && myForm.controls.portalType.dirty}" class="form-group" uk-grid>
140
      <label class="uk-width-1-1 uk-margin-small-bottom">
142
      <div class="uk-width-1-1 uk-margin-small-bottom uk-text-bold uk-form-label">
141 143
        Class exists in:
142
      </label>
143
      <label class="uk-width-1-1 radio uk-margin-large-left">
144
        <span class="uk-margin-small-right" style="font-weight: normal;">OpenAIRE portal</span>
145
        <input type="radio" value="explore" formControlName="portalType">
146
      </label>
147
      <label class="uk-width-1-1 radio uk-margin-large-left">
148
        <span class="uk-margin-small-right" style="font-weight: normal;">OpenAIRE Connect portal</span>
149
        <input type="radio" value="connect" formControlName="portalType">
150
      </label>
151
      <label class="uk-width-1-1 radio uk-margin-large-left">
152
        <span class="uk-margin-small-right" style="font-weight: normal;">Communities' Gateway</span>
153
        <input type="radio" value="community" formControlName="portalType">
154
      </label>
144
      </div>
145
      <div class="uk-child-width-1-2 uk-grid">
146
        <span *ngFor="let option of portalUtils.portalTypes" class="radio ">
147
          <span class="uk-margin-small-right" style="font-weight: normal;">{{option.label}}</span>
148
          <input type="radio" [value]="option.value" formControlName="portalType">
149
        </span>
150
      </div>
155 151
    </div>
156 152

  
157

  
158
<!--    <div class="form-group uk-margin-small-left">-->
159
<!--      <div class="uk-text-muted"> Select if this class exists in:</div>-->
160
<!--      <span dashboard-input class="" [formInput]="myForm.get('openaire')"-->
161
<!--           type="checkbox"-->
162
<!--           label="Explore Portal">-->
163
<!--      </span>-->
164
<!--      <span dashboard-input class="uk-margin-small-left" [formInput]="myForm.get('connect')"-->
165
<!--           type="checkbox"-->
166
<!--           label="Connect Portal">-->
167
<!--      </span>-->
168
<!--      <span dashboard-input class="uk-margin-small-left" [formInput]="myForm.get('communities')"-->
169
<!--           type="checkbox"-->
170
<!--           label="Communities Dashboards">-->
171
<!--      </span>-->
172
<!--&lt;!&ndash;      <mat-checkbox  [formControl]="myForm.get('openaire')" >Explore Portal</mat-checkbox>&ndash;&gt;-->
173
<!--&lt;!&ndash;      <input type="checkbox" id="openaire" formControlName="openaire"/> Explore Portal&ndash;&gt;-->
174
<!--&lt;!&ndash;      <input type="checkbox" [formControl]="myForm.get('connect')" formControlName="connect"/> Connect Portal&ndash;&gt;-->
175
<!--&lt;!&ndash;      <input type="checkbox" [formControl]="myForm.controls.communities"&ndash;&gt;-->
176
<!--&lt;!&ndash;             formControlName="communities"/>Communities Dashboards&ndash;&gt;-->
177
<!--    </div>-->
178

  
179

  
180 153
    <input type="hidden" formControlName="_id">
181 154
  </form>
182 155

  
modules/uoa-services-library/trunk/ng-openaire-library/src/app/dashboard/divId/divIds.component.ts
12 12
import {Observable, Subscriber} from "rxjs";
13 13
import {map, startWith} from "rxjs/operators";
14 14
import {MatAutocompleteSelectedEvent, MatChipInputEvent} from "@angular/material";
15
import {properties} from "../../../../environments/environment";
16
import {PortalUtils} from "../portal/portalHelper";
17
import {CheckPortal, Portal} from "../../utils/entities/adminTool/portal";
15 18

  
16 19
@Component({
17 20
  selector: 'divIds',
......
39 42
  public errorMessage: string = '';
40 43
  public updateErrorMessage: string = '';
41 44
  public modalErrorMessage: string = '';
42
  public filterForm: FormControl;
45
  public filterForm: FormGroup;
43 46
  private subscriptions: any[] = [];
44 47
  public allPages: Page[] = [];
45 48
  filteredPages: Observable<Page[]>;
46 49
  @ViewChild('PageInput') pageInput: ElementRef<HTMLInputElement>;
47 50
  selectedPages: Page[] = [];
48 51
  selectedCommunityPid = null;
49

  
52
  public portalUtils:PortalUtils = new PortalUtils();
50 53
  ngOnInit() {
51
    this.filterForm = this._fb.control('');
52
    this.pageSearchCtrl = this._fb.control('');
53
    this.subscriptions.push(this.filterForm.valueChanges.subscribe(value => {
54
    this.filterForm =  this._fb.group({
55
      keyword: [''],
56
      type: ['all', Validators.required]});
57
    this.subscriptions.push(this.filterForm.get('keyword').valueChanges.subscribe(value => {
54 58
      this.filterBySearch(value);
55 59
    }));
60
    this.subscriptions.push(this.filterForm.get('type').valueChanges.subscribe(value => {
61
      this.applyTypeFilter();
62
    }));
63
    this.pageSearchCtrl = this._fb.control('');
56 64
    this.pagesCtrl = this._fb.array([]);
57 65
    this.myForm = this._fb.group({
58 66
      _id: '',
......
60 68
      pages: this.pagesCtrl,
61 69
      portalType: ['', Validators.required]
62 70
    });
71
    this.properties = properties;
72
    this.getDivIds();
73
    this.subscriptions.push(this.route.queryParams.subscribe(params => {
74
      HelperFunctions.scroll();
75
      this.selectedCommunityPid = params['communityId'];
76
      this.getPages();
77
    }));
63 78

  
64
    this.route.data
65
      .subscribe((data: { envSpecific: EnvProperties }) => {
66
        HelperFunctions.scroll();
67

  
68
        this.properties = data.envSpecific;
69

  
70
        this.getDivIds();
71
        this.route.queryParams.subscribe(params => {
72
          this.selectedCommunityPid = params['communityId'];
73
          this.getPages();
74
        });
75
      });
76 79
  }
77 80

  
78 81
  constructor(private element: ElementRef, private route: ActivatedRoute, private _router: Router, private _helpContentService: HelpContentService, private _fb: FormBuilder) {
......
101 104
      this.updateErrorMessage = "";
102 105
      this.errorMessage = "";
103 106

  
104
      this._helpContentService.getAllDivIdsFull( this.properties.adminToolsAPIURL).subscribe(
107
      this.subscriptions.push(this._helpContentService.getAllDivIdsFull( this.properties.adminToolsAPIURL).subscribe(
105 108
        divIds => {
106 109
          this.divIds = divIds;
107 110
          this.checkboxes = [];
......
113 116

  
114 117
          this.showLoading = false;
115 118
        },
116
        error => this.handleError('System error retrieving classes', error));
119
        error => this.handleError('System error retrieving classes', error)));
117 120
    }
118 121
  }
119 122

  
......
179 182
    } else {
180 183
      this.showLoading = true;
181 184
      this.updateErrorMessage = "";
182
      this._helpContentService.deleteDivIds(this.selectedDivIds, this.properties.adminToolsAPIURL).subscribe(
185
      this.subscriptions.push(this._helpContentService.deleteDivIds(this.selectedDivIds, this.properties.adminToolsAPIURL).subscribe(
183 186
        _ => {
184 187
          this.deleteDivIdsFromArray(this.selectedDivIds);
185 188
          this.showLoading = false;
186 189
        },
187 190
        error => this.handleUpdateError('System error deleting the selected classes', error)
188
      );
191
      ));
189 192
    }
190 193
  }
191 194

  
......
260 263

  
261 264
        this.modalErrorMessage = "";
262 265

  
263
        this._helpContentService.saveDivId(<DivId>this.myForm.value, this.properties.adminToolsAPIURL).subscribe(
266
        this.subscriptions.push(this._helpContentService.saveDivId(<DivId>this.myForm.value, this.properties.adminToolsAPIURL).subscribe(
264 267
          divId => {
265 268
            this.divIdSavedSuccessfully(divId);
266 269
          },
267 270
          error => this.handleUpdateError("System error creating class", error)
268
        );
271
        ));
269 272
      } else {
270
        this._helpContentService.updateDivId(<DivId>this.myForm.value, this.properties.adminToolsAPIURL).subscribe(
273
        this.subscriptions.push(this._helpContentService.updateDivId(<DivId>this.myForm.value, this.properties.adminToolsAPIURL).subscribe(
271 274
          divId => {
272 275
            this.divIdUpdatedSuccessfully(divId);
273 276
          },
274 277
          error => this.handleUpdateError("System error updating class", error)
275
        );
278
        ));
276 279

  
277 280
      }
278 281
    }
......
299 302
      _ => this.checkboxes.push(<CheckDivId>{divId: _, checked: false})
300 303
    );
301 304
  }
305
  public applyTypeFilter() {
306
    this.checkboxes = [];
307
    this.divIds.filter(item => this.filterByType(item)).forEach(
308
      _ => this.checkboxes.push(<CheckDivId>{divId: _, checked: false})
309
    );
310
  }
302 311

  
312
  public filterByType(divId: DivId): boolean {
313
    let type = this.filterForm.get("type").value;
314
    return  type == "all" || (type  == divId.portalType);
315
  }
303 316
  public filterDivIds(divId: DivId): boolean {
304 317
    let textFlag = this.searchText.toString() == '' || (divId.name + ' ' + divId.portalType).match(this.searchText) != null;
305 318
    return textFlag;
......
326 339
  getPages() {
327 340
    this.showLoading = true;
328 341
    this.errorMessage = "";
329
    this._helpContentService.getAllPages(this.properties.adminToolsAPIURL).subscribe(
342
    this.subscriptions.push(this._helpContentService.getAllPages(this.properties.adminToolsAPIURL).subscribe(
330 343
      pages => {
331 344
        this.allPages = pages;
332 345
        this.showLoading = false;
333 346
      },
334 347
      error => this.handleError('System error retrieving pages', error)
335
    );
348
    ));
336 349

  
337 350
  }
338 351

  
modules/uoa-services-library/trunk/ng-openaire-library/src/app/dashboard/divId/divIds.module.ts
13 13

  
14 14

  
15 15
import {MatChipsModule} from '@angular/material/chips';
16
import {AdminTabsModule} from "../sharedComponents/admin-tabs/admin-tabs.module";
17
import {PageContentModule} from "../sharedComponents/page-content/page-content.module";
18
import {ClassesRoutingModule} from "./classes-routing.module";
16 19

  
17 20
@NgModule({
18
    imports: [
19
        CommonModule,  RouterModule, FormsModule,
20
        AlertModalModule, ReactiveFormsModule, AdminToolServiceModule, InputModule, MatAutocompleteModule, MatFormFieldModule, MatChipsModule,
21
        MatCheckboxModule
22
    ],
21
  imports: [
22
    CommonModule, RouterModule, FormsModule,
23
    AlertModalModule, ReactiveFormsModule, AdminToolServiceModule, InputModule, MatAutocompleteModule, MatFormFieldModule, MatChipsModule,
24
    MatCheckboxModule, AdminTabsModule, PageContentModule, ClassesRoutingModule
25
  ],
23 26
    declarations: [DivIdsComponent],
24 27
    exports: [DivIdsComponent]
25 28
})
modules/uoa-services-library/trunk/ng-openaire-library/src/app/dashboard/divId/classes-routing.module.ts
1
import {NgModule} from '@angular/core';
2
import {RouterModule} from '@angular/router';
3
import {DivIdsComponent} from "./divIds.component";
4

  
5

  
6
@NgModule({
7
    imports: [
8
        RouterModule.forChild([
9
            { path: '',  component: DivIdsComponent}
10
        ])
11
    ]
12
})
13
export class ClassesRoutingModule { }
modules/uoa-services-library/trunk/ng-openaire-library/src/app/dashboard/helpTexts/new-page-help-content-routing.module.ts
1
import {NgModule} from '@angular/core';
2
import {RouterModule} from '@angular/router';
3
import {NewPageHelpContentComponent} from "./new-page-help-content.component";
4

  
5

  
6
@NgModule({
7
    imports: [
8
        RouterModule.forChild([
9
            { path: '', component: NewPageHelpContentComponent}
10
        ])
11
    ]
12
})
13
export class NewPageHelpContentRoutingModule { }
modules/uoa-services-library/trunk/ng-openaire-library/src/app/dashboard/helpTexts/edit-page-help-content.module.ts
6 6
import {EditPageHelpContentComponent} from './edit-page-help-content.component';
7 7
import {PageHelpContentFormModule} from './page-help-content-form.module';
8 8
import {AdminToolServiceModule} from "../../services/adminToolService.module";
9
import {EditPageHelpContentRoutingModule} from "./edit-page-help-content-routing.module";
9 10

  
10 11
@NgModule({
11 12
    imports: [
12 13
        CommonModule,  RouterModule,
13
        PageHelpContentFormModule, AdminToolServiceModule
14
        PageHelpContentFormModule, AdminToolServiceModule, EditPageHelpContentRoutingModule
14 15
    ],
15 16
    declarations: [
16 17
        EditPageHelpContentComponent
modules/uoa-services-library/trunk/ng-openaire-library/src/app/dashboard/helpTexts/page-help-contents.module.ts
10 10
import {MatSlideToggleModule} from '@angular/material';
11 11
import {AdminToolServiceModule} from "../../services/adminToolService.module";
12 12
import {InputModule} from "../../sharedComponents/input/input.module";
13
import {PageHelpContentsRoutingModule} from "./page-help-contents-routing.module";
13 14

  
14 15
@NgModule({
15 16
  imports: [
16 17
    CommonModule, RouterModule, FormsModule, SafeHtmlPipeModule,
17
    AlertModalModule, ReactiveFormsModule, MatSlideToggleModule, AdminToolServiceModule, InputModule
18
    AlertModalModule, ReactiveFormsModule, MatSlideToggleModule, AdminToolServiceModule, InputModule, PageHelpContentsRoutingModule
18 19
  ],
19 20
    declarations: [
20 21
        PageHelpContentsComponent
modules/uoa-services-library/trunk/ng-openaire-library/src/app/dashboard/helpTexts/new-page-help-content.module.ts
6 6
import {NewPageHelpContentComponent} from './new-page-help-content.component';
7 7
import {PageHelpContentFormModule} from './page-help-content-form.module';
8 8
import {AdminToolServiceModule} from "../../services/adminToolService.module";
9
import {NewPageHelpContentRoutingModule} from "./new-page-help-content-routing.module";
9 10

  
10 11
@NgModule({
11 12
    imports: [
12 13
        CommonModule,  RouterModule,
13
        PageHelpContentFormModule, AdminToolServiceModule
14
        PageHelpContentFormModule, AdminToolServiceModule, NewPageHelpContentRoutingModule
14 15
    ],
15 16
    declarations: [
16 17
        NewPageHelpContentComponent
modules/uoa-services-library/trunk/ng-openaire-library/src/app/dashboard/helpTexts/edit-page-help-content-routing.module.ts
1
import {NgModule} from '@angular/core';
2
import {RouterModule} from '@angular/router';
3
import {EditPageHelpContentComponent} from "./edit-page-help-content.component";
4

  
5

  
6
@NgModule({
7
    imports: [
8
        RouterModule.forChild([
9
            { path: '', component: EditPageHelpContentComponent}
10
        ])
11
    ]
12
})
13
export class EditPageHelpContentRoutingModule { }
modules/uoa-services-library/trunk/ng-openaire-library/src/app/dashboard/helpTexts/page-help-contents-routing.module.ts
1
import { NgModule } from '@angular/core';
2
import {RouterModule} from '@angular/router';
3
import {PageHelpContentsComponent} from "./page-help-contents.component";
4

  
5
@NgModule({
6
    imports: [
7
        RouterModule.forChild([
8
            { path: '',  component: PageHelpContentsComponent}
9
        ])
10
    ]
11
})
12
export class PageHelpContentsRoutingModule { }
modules/uoa-services-library/trunk/ng-openaire-library/src/app/dashboard/portal/portals-routing.module.ts
1
import {NgModule} from '@angular/core';
2
import {RouterModule} from '@angular/router';
3
import {PortalsComponent} from "./portals.component";
4

  
5
@NgModule({
6
  imports: [
7
    RouterModule.forChild([
8
      { path: '',  component: PortalsComponent}
9
    ])
10
  ]
11
})
12
export class PortalsRoutingModule { }
modules/uoa-services-library/trunk/ng-openaire-library/src/app/dashboard/portal/portals.component.html
1
<div id="page_content" click-outside-or-esc targetId="page_content">
2
  <!--       [escClose]="false"-->
3
  <!--       (clickOutside)="toggleOpen($event)">-->
4
  <div class="uk-padding-small md-bg-white" uk-grid>
5

  
6
    <div class="uk-width-expand@m uk-width-1-1 uk-flex uk-flex-middle uk-flex-right">
7
      <div class="uk-inline uk-width-medium">
1
<div page-content>
2
  <admin-tabs tab = "portal" header></admin-tabs>
3
  <div inner class="admin-pages">
4
    <div *ngIf="!errorMessage && !showLoading" class="filters" uk-sticky="offset:150">
5
      <div class="show-options uk-float-right">
6
        <button class="uk-button uk-button-primary " type="button">Bulk Actions</button>
7
        <div uk-dropdown="mode: click">
8
          <ul class="uk-nav uk-margin-left"
9
              [attr.uk-tooltip]="getSelectedCommunities().length == 0 ? 'pos:left; cls: uk-active' : 'cls: uk-invisible'"
10
              title="Select at least one portal">
11
            <li><a [class]="getSelectedCommunities().length == 0 ? 'uk-disabled' : ''"
12
                   (click)="confirmDeleteSelectedCommunities()"><i></i> Delete </a></li>
13
          </ul>
14
        </div>
15
      </div>
16
      <div class="uk-inline uk-width-medium  uk-float-right uk-margin-right" >
8 17
        <span class="uk-position-center-right"><i class="material-icons">search</i></span>
9
        <div dashboard-input label="Locate indicator" [formInput]="formControl" label="Locate portal"></div>
18
        <div dashboard-input  [formInput]="filterForm.controls.keyword"
19
             placeholder="Search"></div>
10 20
      </div>
11

  
21
      <ul     class="uk-subnav uk-subnav-pill subCategoriesTabs ignore admin  " >
22
        <li [class.uk-active]="filterForm.get('type').value === 'all'" class="uk-margin-small-bottom"><a
23
          (click)="filterForm.get('type').setValue('all')"><span
24
          class="title">All portals</span></a></li>
25
        <li  *ngFor="let type of  portalUtils.portalTypes; let i=index"
26
             [class.uk-active]="filterForm.get('type').value === type.value" class="uk-margin-small-bottom"><a
27
          (click)="filterForm.get('type').setValue(type.value)"><span
28
          class="title">{{type.label}}</span></a></li>
29
      </ul>
12 30
    </div>
13
  </div>
14
  <div id="page_content_inner">
15 31

  
16
    <div class="menubar ">
17
      <h4 class="uk-text-bold">Portals</h4>
32
    <div class="uk-margin-top">
33
      <a  *ngIf="!showLoading && !errorMessage" (click)="newCommunity()"
34
          class="uk-flex uk-flex-right uk-flex-middle uk-margin-small-bottom">
35
        <div class="uk-button-default large uk-icon-button uk-margin-small-right"  uk-icon="plus">
36
        </div>
37
        Add portal
38
      </a>
18 39
      <div *ngIf="updateErrorMessage" class="uk-alert-danger" uk-alert>
19 40
        <a class="uk-alert-close" uk-close></a>
20 41
        {{updateErrorMessage}}
21 42
      </div>
22
    </div>
43
      <div *ngIf="errorMessage" class="uk-alert uk-alert-danger  uk-margin-large-top"
44
           role="alert">{{errorMessage}}</div>
45
      <div [style.display]="showLoading ? 'inline' : 'none'"
46
           class="uk-animation-fade uk-margin-large-top  uk-width-1-1" role="alert"><img
47
        class="uk-align-center loading-gif"></div>
23 48

  
24
    <div class="content-wrapper" id="contentWrapper">
25 49

  
26
      <div class="contentPanel">
27
        <div *ngIf="errorMessage" class="uk-alert uk-alert-danger  uk-margin-large-top"
28
             role="alert">{{errorMessage}}</div>
29
        <div [style.display]="showLoading ? 'inline' : 'none'"
30
             class="uk-animation-fade uk-margin-large-top  uk-width-1-1" role="alert"><img
31
          class="uk-align-center loading-gif"></div>
32 50

  
33
        <div *ngIf="!errorMessage && !showLoading" class="page-controls">
34
          <div class="  filters ">
35
            <div class="show-options uk-float-right">
36
              <button class="uk-button" type="button">Bulk Actions</button>
37
              <div uk-dropdown="mode: click">
38
                <ul class="uk-nav uk-margin-left"
39
                    [attr.uk-tooltip]="getSelectedCommunities().length == 0 ? 'pos:left; cls: uk-active' : 'cls: uk-invisible'"
40
                    title="Select at least one portal">
41
                  <li><a [class]="getSelectedCommunities().length == 0 ? 'uk-disabled' : ''"
42
                         (click)="confirmDeleteSelectedCommunities()"><i></i> Delete </a></li>
43
                </ul>
44
              </div>
45
            </div>
46
          </div>
47
        </div>
51
      <div class=" uk-margin-medium-bottom" *ngIf="!errorMessage && !showLoading">
48 52

  
49
        <div class="md-card uk-margin-medium-bottom" *ngIf="!errorMessage && !showLoading">
50
          <div class="md-card-content">
51
            <div class="uk-overflow-container">
52
              <table class="uk-table uk-table-striped uk-table-hover">
53
        <div class="">
54
          <div class="uk-overflow-container">
55
            <table class="uk-table uk-table-striped uk-table-hover">
56
              <thead class="form-header">
57
              <tr>
58
                <th><input id="allCommunityCheckbox" type="checkbox" (change)="toggleCheckBoxes($event)"></th>
59
                <th>Name</th>
60
                <th>Type</th>
61
                <th>Actions</th>
62
              </tr>
63
              </thead>
64
              <tbody>
65
              <tr *ngFor="let check of checkboxes; let i=index">
66
                <td><input id="{{check.community._id}}" class="checkBox" type="checkbox"
67
                           name="communitiescb[]" value="{{check.community._id}}" [(ngModel)]="check.checked">
68
                </td>
69
                <td>
70
                  <div class="name" href="#">{{check.community.name}}</div>
71
                </td>
72
                <td>
73
                  <div class="type" href="#">{{check.community.type}}</div>
74
                </td>
75
                <td>
76
                  <div class="actions" href="#">
77
                    <i class="clickable" uk-icon="pencil" (click)="editCommunity(i)"></i>
78
                    <i class="clickable uk-text-danger" uk-icon="trash"
79
                       (click)="confirmDeleteCommunity(check.community._id)"></i>
80
                  </div>
81
                </td>
53 82

  
54
                <thead>
55
                <tr>
56
                  <th><input id="allCommunityCheckbox" type="checkbox" (change)="toggleCheckBoxes($event)"></th>
57
                  <th>Name</th>
58
                  <th>Type</th>
59
                  <th>Actions</th>
60
                </tr>
61
                </thead>
62
                <tbody>
63
                <tr *ngFor="let check of checkboxes; let i=index">
64
                  <td><input id="{{check.community._id}}" class="checkBox" type="checkbox"
65
                             name="communitiescb[]" value="{{check.community._id}}" [(ngModel)]="check.checked">
66
                  </td>
67
                  <td>
68
                    <div class="name" href="#">{{check.community.name}}</div>
69
                  </td>
70
                  <td>
71
                    <div class="type" href="#">{{check.community.type}}</div>
72
                  </td>
73
                  <td>
74
                    <div class="actions" href="#">
75
                      <i class="clickable" uk-icon="pencil" (click)="editCommunity(i)"></i>
76
                      <i class="clickable uk-text-danger" uk-icon="trash"
77
                         (click)="confirmDeleteCommunity(check.community._id)"></i>
78
                    </div>
79
                  </td>
83
              </tr>
80 84

  
81
                </tr>
82

  
83
                </tbody>
84
              </table>
85
              <div class="uk-width-1-1 uk-flex uk-flex-center ">
86
                <div class="uk-width-small uk-button-default uk-button" (click)="newCommunity()">
87
                  <i class="" uk-icon="plus"></i>
88
                </div>
85
              </tbody>
86
            </table>
87
            <div *ngIf="checkboxes.length==0" class="col-md-12">
88
              <div class="uk-alert-warning" uk-alert>No portals found</div>
89
            </div>
90
            <!--<div class="uk-width-1-1 uk-flex uk-flex-center ">
91
              <div class="uk-width-small uk-button-default uk-button" (click)="newCommunity()">
92
                <i class="" uk-icon="plus"></i>
89 93
              </div>
90

  
91

  
92
              <div *ngIf="checkboxes.length==0" class="col-md-12">
93
                <div class="uk-alert-warning" uk-alert>No portals found</div>
94
              </div>
95
            </div>
94
            </div>-->
96 95
          </div>
97 96
        </div>
98

  
99

  
100 97
      </div>
101 98
    </div>
99
  </div>
100
  </div>
102 101

  
103

  
104
  </div>
105 102
  <modal-alert #AlertModalSaveCommunity (alertOutput)="communitySaveConfirmed($event)"
106 103
               [okDisabled]="portalFG && (portalFG.invalid || !portalFG.dirty)">
107 104

  
......
129 126
    </form>
130 127

  
131 128
  </modal-alert>
132

  
133

  
134 129
  <modal-alert #AlertModalDeleteCommunities (alertOutput)="confirmedDeleteCommunities($event)"></modal-alert>
135
</div>
modules/uoa-services-library/trunk/ng-openaire-library/src/app/dashboard/portal/portals.component.ts
1 1
import {Component, ViewChild, OnInit, ElementRef} from '@angular/core';
2 2
import {ActivatedRoute, Router} from '@angular/router';
3 3
import {HelpContentService} from '../../services/help-content.service';
4
import {FormBuilder, FormControl, FormGroup} from '@angular/forms';
4
import {FormBuilder, FormControl, FormGroup, Validators} from '@angular/forms';
5 5
import {EnvProperties} from '../../utils/properties/env-properties';
6 6

  
7 7
import {Session} from '../../login/utils/helper.class';
......
11 11
import {CheckPortal, Portal} from "../../utils/entities/adminTool/portal";
12 12
import {PortalUtils} from "./portalHelper";
13 13
import {properties} from "../../../../environments/environment";
14
import {CheckPage, Page} from "../../utils/entities/adminTool/page";
14 15

  
15 16
@Component({
16 17
  selector: 'portals',
......
27 28
  public communities: Portal[] = [];
28 29

  
29 30
  public portalFG: FormGroup;
30
  public formControl: FormControl;
31
  public filterForm: FormGroup;
31 32
  private subscriptions: any[] = [];
32 33

  
33 34
  private searchText: RegExp = new RegExp('');
......
48 49
      piwik:'',
49 50
      type: ''
50 51
    });
51
    this.formControl = this._fb.control('');
52
    this.subscriptions.push(this.formControl.valueChanges.subscribe(value => {
52
    this.filterForm =  this._fb.group({
53
      keyword: [''],
54
      type: ['all', Validators.required]});
55
    this.subscriptions.push(this.filterForm.get('keyword').valueChanges.subscribe(value => {
53 56
      this.filterBySearch(value);
54 57
    }));
58
    this.subscriptions.push(this.filterForm.get('type').valueChanges.subscribe(value => {
59
      this.applyTypeFilter();
60
    }));
55 61

  
56 62
    HelperFunctions.scroll();
57 63
    this.properties = properties;
......
95 101
          }
96 102
          this.showLoading = false;
97 103
        },
98
        error => this.handleError('System error retrieving communities', error)));
104
        error => this.handleError('System error retrieving portals', error)));
99 105
    }
100 106
  }
101 107

  
......
273 279
      _ => this.checkboxes.push(<CheckPortal>{community: _, checked: false})
274 280
    );
275 281
  }
282
  public applyTypeFilter() {
283
    this.checkboxes = [];
284
    this.communities.filter(item => this.filterByType(item)).forEach(
285
      _ => this.checkboxes.push(<CheckPortal>{community: _, checked: false})
286
    );
287
  }
276 288

  
289
  public filterByType(community: Portal): boolean {
290
    let type = this.filterForm.get("type").value;
291
    return  type == "all" || (type  == community.type);
292
  }
277 293
  public filterCommunities(community: Portal): boolean {
278 294
    const textFlag = this.searchText.toString() === '' || (community.name || community.type).match(this.searchText) != null;
279 295
    return textFlag;
modules/uoa-services-library/trunk/ng-openaire-library/src/app/dashboard/portal/portals.module.ts
6 6
import {AlertModalModule} from '../../utils/modal/alertModal.module';
7 7
import {AdminToolServiceModule} from "../../services/adminToolService.module";
8 8
import {InputModule} from "../../sharedComponents/input/input.module";
9
import {AdminTabsModule} from "../sharedComponents/admin-tabs/admin-tabs.module";
10
import {PageContentModule} from "../sharedComponents/page-content/page-content.module";
11
import {PortalsRoutingModule} from "./portals-routing.module";
9 12

  
10 13
@NgModule({
11 14
  imports: [
12 15
    CommonModule, FormsModule, AlertModalModule,
13 16
    ReactiveFormsModule,
14
    RouterModule, AdminToolServiceModule, InputModule
17
    RouterModule, AdminToolServiceModule, InputModule, AdminTabsModule, PageContentModule, PortalsRoutingModule
15 18
  ],
16 19
  declarations: [PortalsComponent],
17 20
  exports: [PortalsComponent]
18 21
})
19
export class PortalModule { }
22
export class PortalsModule { }
modules/uoa-services-library/trunk/ng-openaire-library/src/app/dashboard/divhelpcontent/new-div-help-content.module.ts
4 4
import {NewDivHelpContentComponent} from './new-div-help-content.component';
5 5
import {DivHelpContentFormModule} from './div-help-content-form.module';
6 6
import {AdminToolServiceModule} from "../../services/adminToolService.module";
7
import {NewDivHelpContentRoutingModule} from "./new-div-help-content-routing.module";
7 8

  
8 9
@NgModule({
9 10
    imports: [
10 11
        CommonModule,  RouterModule,
11
        DivHelpContentFormModule, AdminToolServiceModule
12
        DivHelpContentFormModule, AdminToolServiceModule, NewDivHelpContentRoutingModule
12 13
    ],
13 14
    declarations: [
14 15
        NewDivHelpContentComponent
modules/uoa-services-library/trunk/ng-openaire-library/src/app/dashboard/divhelpcontent/div-help-contents-routing.module.ts
1
import { NgModule } from '@angular/core';
2
import {RouterModule} from '@angular/router';
3
import {DivHelpContentsComponent} from "./div-help-contents.component";
4

  
5
@NgModule({
6
    imports: [
7
        RouterModule.forChild([
8
            { path: '',  component: DivHelpContentsComponent}
9
        ])
10
    ]
11
})
12
export class DivHelpContentsRoutingModule { }
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff