Project

General

Profile

« Previous | Next » 

Revision 60666

[Library | Trunk]: Dashboard: Admin tools pages: Fix no rasults card and loading. Add notifications on actions and errors.

View differences:

modules/uoa-services-library/trunk/ng-openaire-library/src/app/dashboard/divId/divIds.component.html
1 1
<div page-content class="admin-pages">
2 2
  <div header>
3 3
    <admin-tabs tab="class" header></admin-tabs>
4
    <div *ngIf="!errorMessage && !showLoading" class="uk-grid" uk-grid>
4
    <div *ngIf="!showLoading" class="uk-grid" uk-grid>
5 5
      <div class="uk-width-1-1">
6 6
        <ul class="uk-subnav uk-subnav-pill">
7 7
          <li [class.uk-active]="filterForm.get('type').value === 'all'" class="uk-margin-small-bottom"><a
......
14 14
        </ul>
15 15
      </div>
16 16
      <div class="uk-width-1-1 uk-flex uk-flex-right@m uk-flex-center uk-flex-wrap uk-flex-middle uk-grid" uk-grid>
17
        <div #searchInputComponent search-input [control]="filterForm.controls.keyword" [showSearch]="false" placeholder="Search class"
17
        <div #searchInputComponent search-input [control]="filterForm.controls.keyword" [showSearch]="false"
18
             placeholder="Search class"
18 19
             [selected]="selectedKeyword" (closeEmitter)="onSearchClose()" (resetEmitter)="reset()"
19
             [bordered]="true" colorClass="uk-text-secondary" class="uk-width-1-3@xl uk-width-2-5@l uk-width-1-2@m uk-width-1-1"></div>
20
             [bordered]="true" colorClass="uk-text-secondary"
21
             class="uk-width-1-3@xl uk-width-2-5@l uk-width-1-2@m uk-width-1-1"></div>
20 22
        <div class="show-options">
21 23
          <button class="uk-button uk-button-secondary">Bulk Actions</button>
22 24
          <div uk-dropdown="mode: click">
......
41 43
    </div>
42 44
  </div>
43 45
  <div inner>
44
    <loading *ngIf="showLoading" class="uk-margin-large-top"></loading>
46
    <div *ngIf="showLoading" class="uk-position-center">
47
      <loading></loading>
48
    </div>
45 49
    <div *ngIf="!showLoading">
46
        <div *ngIf="updateErrorMessage" class="uk-alert-danger" uk-alert>
47
          <a class="uk-alert-close" uk-close></a>
48
          {{updateErrorMessage}}
49
        </div>
50
        <div *ngIf="errorMessage" class="uk-alert uk-alert-danger  uk-margin-large-top"
51
             role="alert">{{errorMessage}}</div>
52
        <div class="md-card uk-margin-medium-bottom" *ngIf="!errorMessage">
53
          <div class="md-card-content">
54
            <div class="uk-overflow-container">
55

  
56
              <table class="uk-table uk-table-striped uk-table-large">
57
                <thead class="uk-card-header">
58
                <tr>
59
                  <th
60
                      class="uk-width-small"><input id="allDivIdCheckbox" type="checkbox"
61
                                                    (change)="toggleCheckBoxes($event)"></th>
62
                  <th>Name</th>
63
                  <th *ngIf="!selectedCommunityPid">Portal Type</th>
64
                  <th>Page</th>
65
                  <th>Actions</th>
66
                </tr>
67
                </thead>
68
                <tbody>
69
                <tr *ngFor="let check of checkboxes; let i=index">
70
                  <td><input id="{{check.divId._id}}" class="checkBox" type="checkbox"
71
                             name="divIdscb[]" value="{{check.divId._id}}" [(ngModel)]="check.checked">
72
                  </td>
73
                  <td>
74
                    <div class="name" href="#">{{check.divId.name}}</div>
75
                  </td>
76
                  <td *ngIf="!selectedCommunityPid">
77
                    <div class="portalType" href="#">{{check.divId.portalType}}</div>
78
                  </td>
79
                  <td>
80
                    <div class="pages" href="#">
50
      <table *ngIf="checkboxes.length > 0"class="uk-table uk-table-striped uk-table-large">
51
        <thead class="uk-card-header">
52
        <tr>
53
          <th
54
              class="uk-width-small"><input id="allDivIdCheckbox" type="checkbox"
55
                                            (change)="toggleCheckBoxes($event)"></th>
56
          <th>Name</th>
57
          <th *ngIf="!selectedCommunityPid">Portal Type</th>
58
          <th>Page</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.divId._id}}" class="checkBox" type="checkbox"
65
                     name="divIdscb[]" value="{{check.divId._id}}" [(ngModel)]="check.checked">
66
          </td>
67
          <td>
68
            <div class="name" href="#">{{check.divId.name}}</div>
69
          </td>
70
          <td *ngIf="!selectedCommunityPid">
71
            <div class="portalType" href="#">{{check.divId.portalType}}</div>
72
          </td>
73
          <td>
74
            <div class="pages" href="#">
81 75
                  <span *ngFor="let page of check.divId.pages let i=index">{{page.name}}<span
82 76
                      *ngIf="i<(check.divId.pages.length-1)">, </span></span>
83
                    </div>
84
                  </td>
85
                  <td>
77
            </div>
78
          </td>
79
          <td>
86 80

  
87
                    <div class="actions" href="#">
88
                      <i class="clickable" uk-icon="pencil" (click)="editDivId(i)"></i>
89
                      <i class="clickable uk-text-danger" uk-icon="trash"
90
                         (click)="confirmDeleteDivId(check.divId._id)"></i>
91
                    </div>
92
                  </td>
93
                </tr>
94
                </tbody>
95
              </table>
96
              <div *ngIf="checkboxes.length==0" class="col-md-12">
97
                <div class="uk-alert-warning uk-alert">No classes found</div>
98
              </div>
81
            <div class="actions" href="#">
82
              <i class="clickable" uk-icon="pencil" (click)="editDivId(i)"></i>
83
              <i class="clickable uk-text-danger" uk-icon="trash"
84
                 (click)="confirmDeleteDivId(check.divId._id)"></i>
99 85
            </div>
100
          </div>
101
        </div>
86
          </td>
87
        </tr>
88
        </tbody>
89
      </table>
90
      <div *ngIf="checkboxes.length == 0"
91
           class="uk-card uk-card-default uk-padding-large uk-text-center uk-margin-bottom uk-text-bold">
92
        <div>No classes found</div>
102 93
      </div>
94
    </div>
103 95
  </div>
104 96
</div>
105 97
<modal-alert #editModal (alertOutput)="divIdSaveConfirmed($event)"
106 98
             [okDisabled]="classForm && (classForm.invalid || !classForm.dirty)">
107
  <div *ngIf="modalErrorMessage" class="uk-alert-danger" uk-alert aria-hidden="true">{{ modalErrorMessage }}</div>
108 99
  <form *ngIf="classForm" [formGroup]="classForm" class="uk-grid uk-child-width-1-1" uk-grid>
109 100
    <div dashboard-input [formInput]="classForm.get('name')"
110 101
         type="text" label="Class Name" placeholder="Write a name">
modules/uoa-services-library/trunk/ng-openaire-library/src/app/dashboard/divId/divIds.component.ts
37 37
  public properties: EnvProperties = properties;
38 38
  public formPages: Page[] = [];
39 39
  public showLoading: boolean = true;
40
  public errorMessage: string = '';
41
  public updateErrorMessage: string = '';
42
  public modalErrorMessage: string = '';
43 40
  public filterForm: FormGroup;
44 41
  private subscriptions: any[] = [];
45 42
  public allPages: Option[] = [];
......
93 90
      });
94 91
    } else {
95 92
      this.showLoading = true;
96
      this.updateErrorMessage = "";
97
      this.errorMessage = "";
98

  
99 93
      this.subscriptions.push(this._helpContentService.getAllDivIdsFull( this.properties.adminToolsAPIURL).subscribe(
100 94
        divIds => {
101 95
          this.divIds = divIds;
......
174 168
      });
175 169
    } else {
176 170
      this.showLoading = true;
177
      this.updateErrorMessage = "";
178 171
      this.subscriptions.push(this._helpContentService.deleteDivIds(this.selectedDivIds, this.properties.adminToolsAPIURL).subscribe(
179 172
        _ => {
180 173
          this.deleteDivIdsFromArray(this.selectedDivIds);
......
219 212
      pages: this.pagesCtrl,
220 213
      portalType: this._fb.control('', Validators.required)
221 214
    });
222
    this.modalErrorMessage = "";
223 215
    this.divIdsModalOpen("Create class", "Create");
224 216
  }
225 217

  
......
252 244
      });
253 245
    } else {
254 246
      if (!this.classForm.value._id) {
255
        this.modalErrorMessage = "";
256 247
        this.subscriptions.push(this._helpContentService.saveDivId(<DivId>this.classForm.value, this.properties.adminToolsAPIURL).subscribe(
257 248
          divId => {
258 249
            this.divIdSavedSuccessfully(divId);
......
317 308
    if (error == null) {
318 309
      // this.formComponent.reset();
319 310
    } else {
320
      this.updateErrorMessage = message;
311
      UIkit.notification(message, {
312
        status: 'danger',
313
        timeout: 6000,
314
        pos: 'bottom-right'
315
      });
321 316
      console.log('Server responded: ' + error);
322 317
    }
323
    UIkit.notification('An error has occurred. Please try again later', {
318
    this.showLoading = false;
319
  }
320

  
321
  handleError(message: string, error) {
322
    UIkit.notification(message, {
324 323
      status: 'danger',
325 324
      timeout: 6000,
326 325
      pos: 'bottom-right'
327 326
    });
328
    this.showLoading = false;
329
  }
330

  
331
  handleError(message: string, error) {
332
    this.errorMessage = message;
333 327
    console.log('Server responded: ' + error);
334

  
335 328
    this.showLoading = false;
336 329
  }
337 330

  
338 331
  getPages() {
339 332
    this.showLoading = true;
340
    this.errorMessage = "";
341 333
    this.subscriptions.push(this._helpContentService.getAllPages(this.properties.adminToolsAPIURL).subscribe(
342 334
      pages => {
343 335
        this.allPages = [];
modules/uoa-services-library/trunk/ng-openaire-library/src/app/dashboard/helpTexts/page-help-content-form.component.html
27 27
                  class="uk-button uk-button-secondary outlined uk-margin-small-right">Reset
28 28
          </button>
29 29
          <button (click)="saveCustom()" class="uk-button uk-button-secondary uk-margin-small-right"
30
                  [disabled]="showLoading || !myForm.dirty || !myForm.valid ">Save
30
                  [disabled]="showLoading || !myForm.dirty || myForm.invalid ">Save
31 31
          </button>
32 32
        </div>
33 33
      </div>
34 34
    </div>
35 35
    <div class="uk-card uk-card-default uk-position-relative  " style="min-height: 60vh">
36 36
      <div style="max-height: 60vh" class="uk-padding-large uk-overflow-auto">
37

  
38
        <div *ngIf="errorMessage" class="uk-alert uk-alert-danger" role="alert">{{errorMessage}}</div>
39 37
        <div class="uk-animation-fade uk-width-1-1" role="alert">
40
          <div *ngIf="updateErrorMessage" class="uk-alert uk-alert-danger" role="alert">{{updateErrorMessage}}</div>
41

  
42 38
          <div *ngIf="showLoading" class="uk-position-center">
43 39
            <loading *ngIf="showLoading"></loading>
44 40
          </div>
......
57 53
            </div>
58 54

  
59 55
            <div class="form-group uk-margin-top">
60
              <span class="uk-text-bold uk-margin-small-right">Select Status (Enable/ disable)</span>
61

  
56
              <div class="uk-text-bold uk-margin-medium-bottom">Select Status (Enable/ disable)</div>
62 57
              <mat-slide-toggle [checked]="myForm.get('isActive').value"
63 58
                                (change)="changeStatus()"
64 59
                                uk-tooltip="title:<div class='uk-padding-small uk-width-large'><div class='uk-text-bold '> Enable or disable help text to show or hide it from the dashboard</div></div>"
65 60
              ></mat-slide-toggle>
66 61
            </div>
67
            <div class="form-group uk-margin-large-top"
62
            <div class="form-group uk-margin-medium-top"
68 63
                 [ngClass]="{'has-error':!myForm.controls.content.valid &&
69
                    myForm.controls.content.dirty}"
70
            >
64
                    myForm.controls.content.dirty}">
71 65
              <label class="uk-text-bold">Content</label>
72 66
              <div class="uk-margin-top">
73 67
                <ckeditor (change)="contentChanged()"
modules/uoa-services-library/trunk/ng-openaire-library/src/app/dashboard/helpTexts/page-help-content-form.component.ts
13 13
import {PageHelpContent} from '../../utils/entities/adminTool/page-help-content';
14 14
import {ConnectHelper} from "../../connect/connectHelper";
15 15

  
16
declare var UIkit;
17

  
16 18
@Component({
17 19
  selector: 'page-content-form',
18 20
  templateUrl: './page-help-content-form.component.html',
......
28 30
  orderOptions = [];
29 31
  
30 32
  private availablePages: Page[] = [];
31
  //private errorMessage: string;
32
  
33 33
  private ckeditorContent: string;
34 34
  public properties: EnvProperties = null;
35
  
36 35
  public showLoading: boolean = true;
37
  public errorMessage: string = '';
38
  @Input() updateErrorMessage: string = '';
39 36
  private subs: Subscription[] = [];
40 37
  public pageHelpContent: PageHelpContent;
41 38
  
......
157 154
          this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
158 155
      } else {
159 156
          this.showLoading = true;
160
          this.errorMessage = "";
161
          this.updateErrorMessage = "";
162 157

  
163 158
          this.subs.push(this._helpContentService.getPageHelpContent(pageContentId as string, this.properties.adminToolsAPIURL, this.communityPid).subscribe(
164 159
            pageHelpContent => {
......
244 239
  }
245 240
  
246 241
  handleError(message: string, error) {
247
    this.errorMessage = message;
242
    UIkit.notification(message, {
243
      status: 'danger',
244
      timeout: 6000,
245
      pos: 'bottom-right'
246
    });
248 247
    console.error('Server responded: ' + error);
249 248
    
250 249
    this.showLoading = false;
......
259 258
        }
260 259
      });
261 260
    } else {
262
      //this.errorMessage = null;
263
      
264 261
      if (this.myForm.valid) {
265 262
        this.showLoading = true;
266
        this.updateErrorMessage = "";
267 263
        this.myForm.get('order').enable();
268 264
        this.myForm.get('placement').enable();
269 265
        let pageHelpContent: PageHelpContent = this.myForm.value;
270 266
        this.subs.push(this._helpContentService.savePageHelpContent(pageHelpContent, this.properties.adminToolsAPIURL, this.portal).subscribe(
271 267
          _ => {
268
            UIkit.notification('Page content has been <b>successfully ' + (this.pageContentId?'updated':'created') + '</b>', {
269
              status: 'success',
270
              timeout: 6000,
271
              pos: 'bottom-right'
272
            });
272 273
            this._router.navigate(['../'], {queryParams: {"pageId": this.pageId}, relativeTo: this.route});
273 274
            this.showLoading = false;
274 275
          },
......
276 277
        ));
277 278
      } else {
278 279
        this.showLoading = false;
279
        this.errorMessage = "Please fill all required fields";
280 280
      }
281 281
    }
282 282
  }
......
292 292
  }
293 293
  
294 294
  handleUpdateError(message: string, error) {
295
    
296
    this.updateErrorMessage = message;
295
    UIkit.notification(message, {
296
      status: 'danger',
297
      timeout: 6000,
298
      pos: 'bottom-right'
299
    });
297 300
    console.error('Server responded: ' + error);
298 301
    
299 302
    this.showLoading = false;
modules/uoa-services-library/trunk/ng-openaire-library/src/app/dashboard/helpTexts/page-help-contents.component.html
1 1
<div page-content>
2 2
  <div header>
3
      <div *ngIf="updateErrorMessage" class="uk-alert-danger" uk-alert>
4
        <a class="uk-alert-close" uk-close></a>
5
        {{updateErrorMessage}}
6
      </div>
7 3
    <div class="uk-text-bold">
8 4
      <span *ngIf="selectedPageId && page">{{page.name}}</span>
9 5
    </div>
10 6
    <div class="uk-margin-top">
11 7
      <a routerLink="../pages/" class="uk-text-secondary uk-text-uppercase uk-text-bold uk-text-small">
12
         <span  class="uk-icon-button small uk-icon uk-button-secondary">
8
         <span class="uk-icon-button small uk-icon uk-button-secondary">
13 9
          <icon name="arrow_left"></icon>
14 10
         </span>
15 11
        <span class="space">
......
20 16
    <div class="uk-width-1-1 uk-flex uk-flex-right@m uk-flex-center uk-flex-wrap uk-flex-middle uk-grid" uk-grid>
21 17
      <div #searchInputComponent search-input [control]="filterForm" [showSearch]="false" placeholder="Search helptext"
22 18
           [selected]="selectedKeyword" (closeEmitter)="onSearchClose()" (resetEmitter)="reset()"
23
           [bordered]="true" colorClass="uk-text-secondary" class="uk-width-1-3@xl uk-width-2-5@l uk-width-1-2@m uk-width-1-1"></div>
19
           [bordered]="true" colorClass="uk-text-secondary"
20
           class="uk-width-1-3@xl uk-width-2-5@l uk-width-1-2@m uk-width-1-1"></div>
24 21
      <div>
25 22
        <a (click)="newPageContent()"
26 23
           class="uk-flex uk-flex-middle uk-text-uppercase">
......
38 35
                                                      [ngModel]="getSelectedPageHelpContents().length ==checkboxes.length"/>
39 36
      <span *ngIf="getSelectedPageHelpContents().length > 0" class="uk-margin-left uk-text-muted">
40 37
                        {{getSelectedPageHelpContents().length}} pages selected </span>
41
      <a  class="uk-margin-left ">Actions  </a>
38
      <a class="uk-margin-left ">Actions </a>
42 39
      <div uk-dropdown="mode: click">
43 40
        <ul class="uk-nav uk-dropdown-nav"
44 41
            [attr.uk-tooltip]="getSelectedPageHelpContents().length == 0 ? 'pos:left; cls: uk-active' : 'cls: uk-invisible'"
45 42
            title="Select at least one help text">
46 43
          <li><a [class]="getSelectedPageHelpContents().length == 0 ? 'uk-disabled' : ''"
47
                                                (click)="togglePageHelpContents(true,getSelectedPageHelpContents())"><i></i> Enable
44
                 (click)="togglePageHelpContents(true,getSelectedPageHelpContents())"><i></i> Enable
48 45
          </a></li>
49 46
          <li><a [class]="getSelectedPageHelpContents().length == 0 ? 'uk-disabled' : ''"
50
                                                (click)="togglePageHelpContents(false,getSelectedPageHelpContents())"><i></i> Disable
47
                 (click)="togglePageHelpContents(false,getSelectedPageHelpContents())"><i></i> Disable
51 48
          </a>
52 49
          </li>
53 50
          <li><a [class]="getSelectedPageHelpContents().length == 0 ? 'uk-disabled' : ''"
54
                                               (click)="confirmDeleteSelectedPageHelpContents()"><i></i> Delete </a></li>
51
                 (click)="confirmDeleteSelectedPageHelpContents()"><i></i> Delete </a></li>
55 52
        </ul>
56 53
      </div>
57 54
    </div>
58 55
  </div>
59

  
60 56
  <div inner>
61

  
62 57
    <div class="content-wrapper" id="contentWrapper">
63 58
      <div>
64 59
        <div class="contentPanel">
65
          <div *ngIf="errorMessage" class="uk-alert uk-alert-danger  uk-margin-large-top"
66
               role="alert">{{errorMessage}}</div>
67
          <div *ngIf="showLoading" class="uk-position-center">
68
            <loading *ngIf="showLoading"></loading>
69
          </div>
60
          <div *ngIf="!showLoading">
61
            <ul *ngIf="checkboxes.length > 0" class="uk-list pages">
62
              <li *ngFor="let check of checkboxes; let i=index" class="uk-card uk-card-default uk-margin-bottom">
63
                <div class="uk-grid uk-grid-divider uk-padding" uk-grid>
64
                  <div class="uk-width-4-5 uk-first-column ">
65
                    <div class="uk-grid uk-flex uk-flex-middle">
66
                      <div><input id="{{check.pageHelpContent._id}}" class="checkBox" type="checkbox"
67
                                  name="entitiescb[]" value="{{check.pageHelpContent._id}}" [(ngModel)]="check.checked">
68
                      </div>
69
                      <div class="uk-width-expand uk-margin-medium-bottom">
70
                        <div *ngIf="!selectedPageId">
71
                          <div class="page" href="#">{{check.pageHelpContent.page.name}}</div>
72
                        </div>
73
                        <div class="content multi-line-ellipsis lines-2">
74
                          <p>{{check.pageHelpContent.content|htmlToString}}</p></div>
75
                      </div>
76
                      <div class="uk-grid uk-width-1-1 uk-margin-left">
77
                        <div class=" ">
78
                          <span class="title">Placement: </span>{{check.pageHelpContent.placement}}
79
                        </div>
80
                        <div class=" ">
81
                          <span class="title">Order: </span>{{check.pageHelpContent.order}}
82
                        </div>
83
                        <div class=" ">
84
                          <span class="title uk-margin-small-right">Enable/disable: </span>
85
                          <mat-slide-toggle [checked]="check.pageHelpContent.isActive"
86
                                            (change)="($event.source.checked = check.pageHelpContent.isActive);togglePageHelpContents(!check.pageHelpContent.isActive,[check.pageHelpContent._id])"
87
                                            uk-tooltip="title:<div class='uk-padding-small uk-width-large'><div class='uk-text-bold '> Enable or disable help text to show or hide it from the dashboard</div></div>"
88
                          ></mat-slide-toggle>
89
                        </div>
90
                      </div>
91
                    </div>
70 92

  
93
                  </div>
94
                  <div class="uk-width-1-5 uk-first-column">
71 95

  
72
          <div *ngIf="!errorMessage && !showLoading">
73
            <div class="md-card uk-margin-medium-bottom" *ngIf="!errorMessage && !showLoading">
74
              <div class="md-card-content">
75
                <div class="uk-overflow-container">
76
                  <div class="uk-overflow-container">
77
                  <ul class="uk-list pages">
78
                    <li *ngFor="let check of checkboxes; let i=index" class="uk-card uk-card-default uk-margin-bottom">
79
                      <div class="uk-grid uk-grid-divider uk-padding" uk-grid>
80
                        <div class="uk-width-4-5 uk-first-column ">
81
                          <div class="uk-grid uk-flex uk-flex-middle">
82
                            <div><input id="{{check.pageHelpContent._id}}" class="checkBox" type="checkbox"
83
                                       name="entitiescb[]" value="{{check.pageHelpContent._id}}" [(ngModel)]="check.checked">
84
                            </div>
85
                            <div class="uk-width-expand uk-margin-medium-bottom">
86
                              <div *ngIf="!selectedPageId" >
87
                                <div class="page" href="#">{{check.pageHelpContent.page.name}}</div>
88
                              </div>
89
                              <div class="content multi-line-ellipsis lines-2">
90
                                <p>{{check.pageHelpContent.content|htmlToString}}</p></div>
91
                            </div>
92
                            <div class="uk-grid uk-width-1-1 uk-margin-left">
93
                              <div   class=" ">
94
                                <span class="title">Placement: </span>{{check.pageHelpContent.placement}}
95
                              </div>
96
                              <div   class=" ">
97
                                <span class="title">Order: </span>{{check.pageHelpContent.order}}
98
                              </div>
99
                              <div  class=" ">
100
                                <span class="title uk-margin-small-right">Enable/disable: </span>
101
                                <mat-slide-toggle [checked]="check.pageHelpContent.isActive"
102
                                                  (change)="($event.source.checked = check.pageHelpContent.isActive);togglePageHelpContents(!check.pageHelpContent.isActive,[check.pageHelpContent._id])"
103
                                                  uk-tooltip="title:<div class='uk-padding-small uk-width-large'><div class='uk-text-bold '> Enable or disable help text to show or hide it from the dashboard</div></div>"
104
                                ></mat-slide-toggle>
105
                              </div>
106
                            </div>
107
                          </div>
108

  
109
                        </div>
110
                        <div class="uk-width-1-5 uk-first-column">
111

  
112
                          <div class=" uk-flex-center uk-flex">
113
                            <div class="actions" href="#">
114
                              <div class="" (click)="editPageHelpContent(check.pageHelpContent._id)" class="uk-button action uk-margin-top uk-flex uk-flex-middle ">
115
                                <i class="clickable" uk-icon="pencil"
116
                                   ></i>
117
                                <span class="uk-margin-small-left">
96
                    <div class=" uk-flex-center uk-flex">
97
                      <div class="actions" href="#">
98
                        <div class="" (click)="editPageHelpContent(check.pageHelpContent._id)"
99
                             class="uk-button action uk-margin-top uk-flex uk-flex-middle ">
100
                          <i class="clickable" uk-icon="pencil"
101
                          ></i>
102
                          <span class="uk-margin-small-left">
118 103
                                  Edit
119 104
                                </span>
120
                              </div>
121
                              <div (click)="confirmDeletePageHelpContent(check.pageHelpContent._id)" class="uk-button action uk-margin-top uk-flex uk-flex-middle ">
122
                                <i class="clickable " uk-icon="trash"
123
                                   ></i>
124
                                <span class="uk-margin-small-left">
105
                        </div>
106
                        <div (click)="confirmDeletePageHelpContent(check.pageHelpContent._id)"
107
                             class="uk-button action uk-margin-top uk-flex uk-flex-middle ">
108
                          <i class="clickable " uk-icon="trash"
109
                          ></i>
110
                          <span class="uk-margin-small-left">
125 111
                                  Delete
126 112
                                </span>
127
                              </div>
128
                            </div>
129
                          </div>
130 113
                        </div>
131 114
                      </div>
132
                    </li>
133
                    </ul>
115
                    </div>
134 116
                  </div>
135
                  <div *ngIf="checkboxes.length==0" class="col-md-12">
136
                    <div class="uk-alert-warning" uk-alert>No page contents found</div>
137
                  </div>
138

  
139 117
                </div>
140
              </div>
118
              </li>
119
            </ul>
120
            <div *ngIf="checkboxes.length == 0" class="uk-card uk-card-default uk-padding-large uk-text-center uk-margin-bottom uk-text-bold">
121
              <div>No page contents found</div>
141 122
            </div>
142 123
          </div>
143 124
        </div>
144 125
      </div>
145 126
    </div>
146 127
  </div>
147
  </div>
148
  <modal-alert #AlertModalDeletePageHelpContents (alertOutput)="confirmedDeletePageHelpContents($event)"></modal-alert>
128
</div>
129
<modal-alert #AlertModalDeletePageHelpContents (alertOutput)="confirmedDeletePageHelpContents($event)"></modal-alert>
modules/uoa-services-library/trunk/ng-openaire-library/src/app/dashboard/helpTexts/page-help-contents.component.ts
19 19
import {SearchInputComponent} from '../../sharedComponents/search-input/search-input.component';
20 20
import {ConnectHelper} from '../../connect/connectHelper';
21 21

  
22
declare var UIkit;
22 23

  
23 24
@Component({
24 25
  selector: 'page-help-contents',
25 26
  templateUrl: './page-help-contents.component.html',
26 27
})
27 28
export class PageHelpContentsComponent implements OnInit {
28

  
29 29
  @ViewChild('AlertModalDeletePageHelpContents') alertModalDeletePageHelpContents;
30 30
  private selectedPageContents: string[] = [];
31

  
32 31
  public checkboxes: CheckPageHelpContent[] = [];
33

  
34 32
  public pageHelpContents: PageHelpContent[] = [];
35

  
36 33
  public formGroup: FormGroup;
37

  
38 34
  public pages: Page[];
39

  
40 35
  public checkboxAll: boolean = false;
41

  
42 36
  public filters: PageHelpContentFilterOptions = {id: '', active: null, text: new RegExp('')};
43 37
  public keyword: string = "";
44

  
45 38
  public counter = {all: 0, active: 0, inactive: 0};
46

  
47 39
  public communities: Portal[] = [];
48

  
49 40
  public portal: string;
50

  
51 41
  public selectedPageId: string;
52

  
53 42
  public community: Portal;
54

  
55 43
  public page: Page;
56
  public properties: EnvProperties = null;
57

  
44
  public properties: EnvProperties = properties;
58 45
  public showLoading: boolean = true;
59
  public errorMessage: string = '';
60
  public updateErrorMessage: string = '';
61 46
  public filterForm: FormControl;
62 47
  public selectForm: FormControl;
63 48
  public selectOptions = [];
64 49
  private subscriptions: any[] = [];
65 50
  public selectedKeyword: string;
66 51
  @ViewChild('searchInputComponent') searchInputComponent: SearchInputComponent;
67

  
52
  
68 53
  ngOnInit() {
69 54
    this.filterForm = this._fb.control('');
70 55
    this.selectForm = this._fb.control('');
......
74 59
    this.subscriptions.push(this.selectForm.valueChanges.subscribe(value => {
75 60
      this.filterByPage(value);
76 61
    }));
77

  
78
    this.properties = properties;
79 62
    this.subscriptions.push(this.route.params.subscribe(params => {
80 63
      this.portal = (this.route.snapshot.data.portal) ? this.route.snapshot.data.portal : this.route.snapshot.params[this.route.snapshot.data.param];
81 64
      ConnectHelper.setPortalTypeFromPid(this.portal);
......
85 68
        if (this.portal && this.selectedPageId) {
86 69
          this.getPage(this.selectedPageId);
87 70
        }
88
        if(!this.selectedPageId) {
89
          this.router.navigate(['../pages'], {relativeTo: this.route });
71
        if (!this.selectedPageId) {
72
          this.router.navigate(['../pages'], {relativeTo: this.route});
90 73
        }
91 74
      }));
92 75
    }));
93 76
  }
94

  
77
  
95 78
  constructor(private element: ElementRef, private route: ActivatedRoute, private router: Router, private _helpService: HelpContentService, private _fb: FormBuilder, private sanitizer: DomSanitizer) {
96 79
  }
80
  
97 81
  ngOnDestroy(): void {
98 82
    this.subscriptions.forEach(value => {
99 83
      if (value instanceof Subscriber) {
......
103 87
      }
104 88
    });
105 89
  }
106
  init(){
107

  
108
  }
90
  
109 91
  getPage(pageId: string) {
110 92
    if (!Session.isLoggedIn()) {
111 93
      this.router.navigate(['/user-info'], {
......
116 98
      });
117 99
    } else {
118 100
      this.showLoading = true;
119
      this.updateErrorMessage = "";
120
      this.errorMessage = "";
121 101
      this.subscriptions.push(this._helpService.getPageByPortal(pageId, this.properties.adminToolsAPIURL, this.portal).subscribe(
122 102
        page => {
123 103
          if (this.properties.adminToolsPortalType != page.portalType) {
124
            this.router.navigate(['./pageContents'], {queryParams: {"communityId": this.portal}});
104
            this.router.navigate(['./pageContents']);
125 105
          } else {
126 106
            this.page = page;
127 107
            this.getPageHelpContents(this.portal);
......
130 110
        error => this.handleError('System error retrieving page', error)));
131 111
    }
132 112
  }
133

  
113
  
134 114
  getPages(community_pid: string) {
135 115
    if (!Session.isLoggedIn()) {
136 116
      this.router.navigate(['/user-info'], {
......
141 121
      });
142 122
    } else {
143 123
      this.showLoading = true;
144
      this.updateErrorMessage = "";
145
      this.errorMessage = "";
146

  
147 124
      //this._helpService.getCommunityPages(community_pid, "", this.properties.adminToolsAPIURL).subscribe(
148
      this.subscriptions.push(this._helpService.getCommunityPagesWithPositions(community_pid,this.properties.adminToolsAPIURL).subscribe(
125
      this.subscriptions.push(this._helpService.getCommunityPagesWithPositions(community_pid, this.properties.adminToolsAPIURL).subscribe(
149 126
        pages => {
150 127
          this.pages = pages;
151 128
          this.getPageHelpContents(this.portal);
152
          this.selectOptions = [{label:'All pages', value: ''}];
129
          this.selectOptions = [{label: 'All pages', value: ''}];
153 130
          for (let page of this.pages) {
154
            this.selectOptions.push({label:page.name, value: page._id})
131
            this.selectOptions.push({label: page.name, value: page._id})
155 132
          }
156 133
        },
157 134
        error => this.handleError('System error retrieving pages', error)));
158 135
    }
159 136
  }
160

  
137
  
161 138
  public countPageHelpContents() {
162 139
    this.counter = {all: 0, active: 0, inactive: 0};
163 140
    let filter = Object.assign({}, this.filters);
......
170 147
    });
171 148
    this.counter.all = this.counter.active + this.counter.inactive;
172 149
  }
173

  
150
  
174 151
  getPageHelpContents(community_pid: string) {
175 152
    if (!Session.isLoggedIn()) {
176 153
      this.router.navigate(['/user-info'], {
......
185 162
          this.pageHelpContents = pageHelpContents as Array<PageHelpContent>;
186 163
          this.counter.all = this.pageHelpContents.length;
187 164
          this.checkboxes = [];
188

  
165
          
189 166
          for (let i = this.pageHelpContents.length - 1; i >= 0; i -= 1) {
190
              this.checkboxes.unshift(<CheckPageHelpContent>{
191
                pageHelpContent: this.pageHelpContents[i],
192
                checked: false
193
              });
167
            this.checkboxes.unshift(<CheckPageHelpContent>{
168
              pageHelpContent: this.pageHelpContents[i],
169
              checked: false
170
            });
194 171
          }
195

  
172
          
196 173
          this.countPageHelpContents();
197

  
174
          
198 175
          this.showLoading = false;
199 176
        },
200 177
        error => this.handleError('System error retrieving page contents', error)));
201 178
    }
202 179
  }
203

  
204
  // public showModal():void {
205
  //     this.modal.showModal();
206
  // }
207

  
180
  
208 181
  public toggleCheckBoxes(event) {
209 182
    this.checkboxes.forEach(_ => _.checked = event.target.checked);
210 183
    this.checkboxAll = event.target.checked;
211 184
  }
212

  
185
  
213 186
  public applyCheck(flag: boolean) {
214 187
    this.checkboxes.forEach(_ => _.checked = flag);
215 188
    this.checkboxAll = false;
216 189
  }
217

  
190
  
218 191
  public getSelectedPageHelpContents(): string[] {
219 192
    return this.checkboxes.filter(pageHelpContent => pageHelpContent.checked == true)
220 193
      .map(checkedPageHelpContent => checkedPageHelpContent.pageHelpContent).map(res => res._id);
221 194
  }
222

  
195
  
223 196
  public confirmDeletePageHelpContent(id: string) {
224 197
    //this.deleteConfirmationModal.ids = [id];
225 198
    //this.deleteConfirmationModal.showModal();
226 199
    this.selectedPageContents = [id];
227 200
    this.confirmModalOpen();
228 201
  }
229

  
202
  
230 203
  public confirmDeleteSelectedPageHelpContents() {
231 204
    //this.deleteConfirmationModal.ids = this.getSelectedPageHelpContents();
232 205
    //this.deleteConfirmationModal.showModal();
233 206
    this.selectedPageContents = this.getSelectedPageHelpContents();
234 207
    this.confirmModalOpen();
235 208
  }
236

  
209
  
237 210
  private confirmModalOpen() {
238 211
    if (!Session.isLoggedIn()) {
239 212
      this.router.navigate(['/user-info'], {
......
251 224
      this.alertModalDeletePageHelpContents.open();
252 225
    }
253 226
  }
254

  
227
  
255 228
  public confirmedDeletePageHelpContents(data: any) {
256 229
    if (!Session.isLoggedIn()) {
257 230
      this.router.navigate(['/user-info'], {
......
262 235
      });
263 236
    } else {
264 237
      this.showLoading = true;
265
      this.updateErrorMessage = "";
266

  
267 238
      this.subscriptions.push(this._helpService.deletePageHelpContents(this.selectedPageContents, this.properties.adminToolsAPIURL, this.portal).subscribe(
268 239
        _ => {
269 240
          this.deletePageHelpContentsFromArray(this.selectedPageContents);
241
          UIkit.notification('Page content(s) has been <b>successfully deleted</b>', {
242
            status: 'success',
243
            timeout: 6000,
244
            pos: 'bottom-right'
245
          });
270 246
          this.showLoading = false;
271 247
        },
272 248
        error => this.handleUpdateError('System error deleting the selected page content(s)', error)
273 249
      ));
274 250
    }
275 251
  }
276

  
252
  
277 253
  private deletePageHelpContentsFromArray(ids: string[]): void {
278 254
    for (let id of ids) {
279 255
      let iqc = this.checkboxes.findIndex(_ => _.pageHelpContent._id == id);
......
283 259
    }
284 260
    this.countPageHelpContents();
285 261
  }
286

  
262
  
287 263
  public editPageHelpContent(id: string) {
288 264
    //this.router.navigate(['/pageContents/edit/', _id]);
289 265
    if (this.selectedPageId) {
290 266
      this.router.navigate(['edit/'], {
291 267
        queryParams: {
292 268
          "pageContentId": id,
293
          "communityId": this.portal,
294 269
          "pageId": this.selectedPageId
295 270
        }, relativeTo: this.route
296 271
      });
297 272
    } else {
298 273
      this.router.navigate(['edit/'], {
299 274
        queryParams: {
300
          "pageContentId": id,
301
          "communityId": this.portal
275
          "pageContentId": id``
302 276
        }, relativeTo: this.route
303 277
      });
304 278
    }
305 279
  }
306

  
280
  
307 281
  public togglePageHelpContents(status: boolean, ids: string[]) {
308 282
    if (!Session.isLoggedIn()) {
309 283
      this.router.navigate(['/user-info'], {
......
313 287
        }
314 288
      });
315 289
    } else {
316
      this.updateErrorMessage = "";
317

  
318 290
      this.subscriptions.push(this._helpService.togglePageHelpContents(ids, status, this.properties.adminToolsAPIURL, this.portal).subscribe(
319 291
        () => {
320 292
          for (let id of ids) {
321 293
            let i = this.checkboxes.findIndex(_ => _.pageHelpContent._id == id);
322 294
            this.checkboxes[i].pageHelpContent.isActive = status;
323 295
          }
296
          UIkit.notification('Page content(s) has been <b>successfully updated</b>', {
297
            status: 'success',
298
            timeout: 6000,
299
            pos: 'bottom-right'
300
          });
324 301
          this.countPageHelpContents();
325 302
          this.applyCheck(false);
326 303
        },
......
328 305
      ));
329 306
    }
330 307
  }
331

  
308
  
332 309
  public pageHelpContentSavedSuccessfully(pageHelpContent: PageHelpContent) {
333 310
    this.checkboxes.push(<CheckPageHelpContent>{pageHelpContent: pageHelpContent, checked: false});
334 311
    this.pageHelpContents.push(pageHelpContent);
335 312
    this.applyCheck(false);
336 313
    this.countPageHelpContents();
337 314
  }
338

  
315
  
339 316
  public pageHelpContentUpdatedSuccessfully(pageHelpContent: PageHelpContent) {
340 317
    this.checkboxes.find(checkItem => checkItem.pageHelpContent._id == pageHelpContent._id).pageHelpContent = pageHelpContent;
341 318
    let index = this.pageHelpContents.findIndex(checkItem => checkItem._id == pageHelpContent._id);
......
343 320
    this.applyCheck(false);
344 321
    this.countPageHelpContents();
345 322
  }
346

  
347

  
323
  
324
  
348 325
  public filterPageHelpContent(pageHelpContent: PageHelpContent, filters: PageHelpContentFilterOptions): boolean {
349 326
    let idFlag = filters.id == '' || (<Page>pageHelpContent.page)._id == filters.id;
350 327
    let activeFlag = filters.active == null || pageHelpContent.isActive == filters.active;
......
352 329
      || ((<Page>pageHelpContent.page).name).match(filters.text) != null;
353 330
    return idFlag && activeFlag && textFlag;
354 331
  }
355

  
356

  
332
  
333
  
357 334
  public applyFilter() {
358 335
    this.checkboxes = [];
359 336
    this.pageHelpContents.filter(item => this.filterPageHelpContent(item, this.filters)).forEach(
......
363 340
    );
364 341
    // this.countPageHelpContents();
365 342
  }
366

  
343
  
367 344
  public filterByPage(event: any) {
368
    if(event.target && event.target.value) {
345
    if (event.target && event.target.value) {
369 346
      this.filters.id = event.target.value;
370 347
      this.applyFilter();
371 348
    }
372 349
  }
373

  
350
  
374 351
  public displayAllPageHelpContents() {
375 352
    this.filters.active = null;
376 353
    this.applyFilter();
377 354
  }
378

  
355
  
379 356
  public displayActivePageHelpContents() {
380 357
    this.filters.active = true;
381 358
    this.applyFilter();
382 359
  }
383

  
360
  
384 361
  public filterBySearch(text: string) {
385 362
    this.filters.text = new RegExp(text, "i");
386 363
    this.applyFilter();
387 364
  }
388

  
365
  
389 366
  public displayInactivePageHelpContents() {
390 367
    this.filters.active = false;
391 368
    this.applyFilter();
392 369
  }
393

  
370
  
394 371
  handleError(message: string, error) {
395
    this.errorMessage = message;
372
    UIkit.notification(message, {
373
      status: 'danger',
374
      timeout: 6000,
375
      pos: 'bottom-right'
376
    });
396 377
    console.log('Server responded: ' + error);
397

  
398 378
    this.showLoading = false;
399 379
  }
400

  
380
  
401 381
  handleUpdateError(message: string, error) {
402
    this.updateErrorMessage = message;
382
    UIkit.notification(message, {
383
      status: 'danger',
384
      timeout: 6000,
385
      pos: 'bottom-right'
386
    });
403 387
    console.log('Server responded: ' + error);
404

  
405 388
    this.showLoading = false;
406 389
  }
407

  
390
  
408 391
  public newPageContent() {
409
      this.router.navigate(['edit'], {
410
        queryParams: {
411
          pageId: this.selectedPageId
412
        }, relativeTo: this.route
413
      });
392
    this.router.navigate(['edit'], {
393
      queryParams: {
394
        pageId: this.selectedPageId
395
      }, relativeTo: this.route
396
    });
414 397
  }
415

  
398
  
416 399
  public onSearchClose() {
417 400
    this.selectedKeyword = this.filterForm.value;
418 401
  }
419

  
402
  
420 403
  public reset() {
421 404
    this.selectedKeyword = null;
422 405
    this.searchInputComponent.reset()
423 406
  }
424
  selectAll(){
425
    let checked = !!(this.getSelectedPageHelpContents().length != this.checkboxes.length);
426
      for (let check of this.checkboxes) {
427
        check.checked = checked;
428
      }
407
  
408
  selectAll() {
409
    let checked = (this.getSelectedPageHelpContents().length != this.checkboxes.length);
410
    for (let check of this.checkboxes) {
411
      check.checked = checked;
412
    }
429 413
  }
430 414
}
modules/uoa-services-library/trunk/ng-openaire-library/src/app/dashboard/portal/portals.component.html
1 1
<div page-content class="admin-pages">
2 2
  <div header>
3 3
    <admin-tabs tab="portal"></admin-tabs>
4
    <div *ngIf="!errorMessage && !showLoading" class="uk-grid" uk-grid>
4
    <div *ngIf="!showLoading" class="uk-grid" uk-grid>
5 5
      <div class="uk-width-1-1">
6 6
        <ul class="uk-subnav uk-subnav-pill">
7 7
          <li [class.uk-active]="filterForm.get('type').value === 'all'" class="uk-margin-small-bottom"><a
......
14 14
        </ul>
15 15
      </div>
16 16
      <div class="uk-width-1-1 uk-flex uk-flex-right@m uk-flex-center uk-flex-wrap uk-flex-middle uk-grid" uk-grid>
17
        <div #searchInputComponent search-input [control]="filterForm.controls.keyword" [showSearch]="false" placeholder="Search portal"
17
        <div #searchInputComponent search-input [control]="filterForm.controls.keyword" [showSearch]="false"
18
             placeholder="Search portal"
18 19
             [selected]="selectedKeyword" (closeEmitter)="onSearchClose()" (resetEmitter)="reset()"
19
             [bordered]="true" colorClass="uk-text-secondary" class="uk-width-1-3@xl uk-width-2-5@l uk-width-1-2@m uk-width-1-1"></div>
20
             [bordered]="true" colorClass="uk-text-secondary"
21
             class="uk-width-1-3@xl uk-width-2-5@l uk-width-1-2@m uk-width-1-1"></div>
20 22
        <div class="show-options">
21 23
          <button class="uk-button uk-button-secondary">Bulk Actions</button>
22 24
          <div uk-dropdown="mode: click">
......
41 43
    </div>
42 44
  </div>
43 45
  <div inner>
44
    <loading *ngIf="showLoading" class="uk-margin-large-top"></loading>
46
    <div *ngIf="showLoading" class="uk-position-center">
47
      <loading></loading>
48
    </div>
45 49
    <div *ngIf="!showLoading">
46
      <div *ngIf="updateErrorMessage" class="uk-alert-danger" uk-alert>
47
        <a class="uk-alert-close" uk-close></a>
48
        {{updateErrorMessage}}
49
      </div>
50
      <div *ngIf="errorMessage" class="uk-alert uk-alert-danger  uk-margin-large-top"
51
           role="alert">{{errorMessage}}</div>
52
      <div class=" uk-margin-medium-bottom" *ngIf="!errorMessage">
53
        <div class="uk-overflow-container">
54
            <table class="uk-table uk-table-striped uk-table-hover">
55
              <thead class="uk-card-header">
56
              <tr>
57
                <th><input id="allCommunityCheckbox" type="checkbox" (change)="toggleCheckBoxes($event)"></th>
58
                <th>Name</th>
59
                <th>Type</th>
60
                <th>Actions</th>
61
              </tr>
62
              </thead>
63
              <tbody>
64
              <tr *ngFor="let check of checkboxes; let i=index">
65
                <td><input id="{{check.portal._id}}" class="checkBox" type="checkbox"
66
                           name="communitiescb[]" value="{{check.portal._id}}" [(ngModel)]="check.checked">
67
                </td>
68
                <td>
69
                  <div class="name" href="#">{{check.portal.name}}</div>
70
                </td>
71
                <td>
72
                  <div class="type" href="#">{{check.portal.type}}</div>
73
                </td>
74
                <td>
75
                  <div class="actions" href="#">
76
                    <i class="clickable" uk-icon="pencil" (click)="editPortal(i)"></i>
77
                    <i class="clickable uk-text-danger" uk-icon="trash"
78
                       (click)="confirmDeletePortal(check.portal._id)"></i>
79
                  </div>
80
                </td>
50
      <table *ngIf="checkboxes.length > 0" class="uk-table uk-table-striped uk-table-hover">
51
        <thead class="uk-card-header">
52
        <tr>
53
          <th><input id="allCommunityCheckbox" type="checkbox" (change)="toggleCheckBoxes($event)"></th>
54
          <th>Name</th>
55
          <th>Type</th>
56
          <th>Actions</th>
57
        </tr>
58
        </thead>
59
        <tbody>
60
        <tr *ngFor="let check of checkboxes; let i=index">
61
          <td><input id="{{check.portal._id}}" class="checkBox" type="checkbox"
62
                     name="communitiescb[]" value="{{check.portal._id}}" [(ngModel)]="check.checked">
63
          </td>
64
          <td>
65
            <div class="name" href="#">{{check.portal.name}}</div>
66
          </td>
67
          <td>
68
            <div class="type" href="#">{{check.portal.type}}</div>
69
          </td>
70
          <td>
71
            <div class="actions" href="#">
72
              <i class="clickable" uk-icon="pencil" (click)="editPortal(i)"></i>
73
              <i class="clickable uk-text-danger" uk-icon="trash"
74
                 (click)="confirmDeletePortal(check.portal._id)"></i>
75
            </div>
76
          </td>
81 77

  
82
              </tr>
78
        </tr>
83 79

  
84
              </tbody>
85
            </table>
86
            <div *ngIf="checkboxes.length==0" class="col-md-12">
87
              <div class="uk-alert-warning" uk-alert>No portals found</div>
88
            </div>
89
            <!--<div class="uk-width-1-1 uk-flex uk-flex-center ">
90
              <div class="uk-width-small uk-button-default uk-button" (click)="newCommunity()">
91
                <i class="" uk-icon="plus"></i>
92
              </div>
93
            </div>-->
94
          </div>
80
        </tbody>
81
      </table>
82
      <div *ngIf="checkboxes.length == 0"
83
           class="uk-card uk-card-default uk-padding-large uk-text-center uk-margin-bottom uk-text-bold">
84
        <div>No portals found</div>
95 85
      </div>
96 86
    </div>
97 87
  </div>
......
99 89

  
100 90
<modal-alert #editModal (alertOutput)="portalSaveConfirmed($event)"
101 91
             [okDisabled]="portalForm && (portalForm.invalid || !portalForm.dirty)">
102
  <div *ngIf="modalErrorMessage" class="uk-alert-danger" uk-alert aria-hidden="true">{{ modalErrorMessage }}</div>
103 92
  <form *ngIf="portalForm" [formGroup]="portalForm" class="uk-grid uk-child-width-1-1" uk-grid>
104
    <div dashboard-input [formInput]="portalForm.get('name')" type="text" label="Portal Name" placeholder="Write a name">
93
    <div dashboard-input [formInput]="portalForm.get('name')" type="text" label="Portal Name"
94
         placeholder="Write a name">
105 95
    </div>
106
    <div dashboard-input type="select" label="Portal Type" placeholder="Choose a type" [formInput]="portalForm.get('type')" [options]="portalUtils.portalTypes"></div>
96
    <div dashboard-input type="select" label="Portal Type" placeholder="Choose a type"
97
         [formInput]="portalForm.get('type')" [options]="portalUtils.portalTypes"></div>
107 98
    <div dashboard-input [formInput]="portalForm.get('pid')"
108 99
         type="text" placeholder="Write pid of portal"
109 100
         label="Portal persistent id for portal">
modules/uoa-services-library/trunk/ng-openaire-library/src/app/dashboard/portal/portals.component.ts
40 40
  public properties: EnvProperties = null;
41 41
  
42 42
  public showLoading = true;
43
  public errorMessage = '';
44
  public updateErrorMessage = '';
45
  public modalErrorMessage = '';
46 43
  public portalUtils: PortalUtils = new PortalUtils();
47 44
  private index: number;
48 45
  public selectedKeyword: string;
......
89 86
      });
90 87
    } else {
91 88
      this.showLoading = true;
92
      this.updateErrorMessage = '';
93
      this.errorMessage = '';
94
      
95
      
96 89
      this.subscriptions.push(this._helpContentService.getPortalsFull(this.properties.adminToolsAPIURL).subscribe(
97 90
        portals => {
98 91
          this.portals = portals;
......
164 157
      });
165 158
    } else {
166 159
      this.showLoading = true;
167
      this.updateErrorMessage = '';
168
      
169 160
      this.subscriptions.push(this._helpContentService.deleteCommunities(this.selectedPortals, this.properties.adminToolsAPIURL).subscribe(
170 161
        _ => {
171 162
          this.deletePortalsFromArray(this.selectedPortals);
......
192 183
      type: this._fb.control(portal.type, Validators.required),
193 184
    });
194 185
    this.portalForm.get('type').disable();
195
    this.modalErrorMessage = '';
196 186
    this.portalModalOpen('Edit Portal', 'Save');
197 187
  }
198 188
  
......
207 197
      piwik: this._fb.control(''),
208 198
      type: this._fb.control('', Validators.required),
209 199
    });
210
    this.modalErrorMessage = '';
211 200
    this.portalModalOpen('Create Portal', 'Create');
212 201
  }
213 202
  
......
239 228
        }
240 229
      });
241 230
    } else {
242
      this.modalErrorMessage = '';
243 231
      if (this.portalForm.value._id) {
244 232
        this.portalForm.get('type').enable();
245 233
        this.subscriptions.push(this._helpContentService.updateCommunity(<Portal>this.portalForm.value,
......
313 301
        type: ''
314 302
      });
315 303
    } else {
316
      this.updateErrorMessage = message;
304
      UIkit.notification(message, {
305
        status: 'danger',
306
        timeout: 6000,
307
        pos: 'bottom-right'
308
      });
317 309
      console.log('Server responded: ' + error);
318 310
    }
319
    UIkit.notification('An error has occurred. Please try again later', {
311
    this.showLoading = false;
312
  }
313
  
314
  handleError(message: string, error) {
315
    UIkit.notification(message, {
320 316
      status: 'danger',
321 317
      timeout: 6000,
322 318
      pos: 'bottom-right'
323 319
    });
324
    this.showLoading = false;
325
  }
326
  
327
  handleError(message: string, error) {
328
    this.errorMessage = message;
329 320
    console.log('Server responded: ' + error);
330 321
    this.showLoading = false;
331 322
  }
modules/uoa-services-library/trunk/ng-openaire-library/src/app/dashboard/users/role-users/role-users.component.html
31 31
    </div>
32 32
  </div>
33 33
  <div inner>
34
    <div *ngIf="loadActive || loadPending" class="uk-margin-large-top">
34
    <div *ngIf="loadActive || loadPending" class="uk-position-center">
35 35
      <loading></loading>
36 36
    </div>
37 37
    <div *ngIf="!loadActive && !loadPending">
38 38
      <div *ngIf="(showActive && active.length == 0) || (!showActive && pending.length == 0)"
39 39
           class="uk-card uk-card-default uk-padding-large uk-text-center uk-margin-bottom uk-text-bold">
40
        <div *ngIf="showActive">No {{role}}s for {{name}}</div>
41
        <div *ngIf="!showActive">No pending {{role}} invitations for {{name}}</div>
40
        <div *ngIf="showActive">No {{role}}s found</div>
41
        <div *ngIf="!showActive">No pending {{role}} invitations found</div>
42 42
      </div>
43 43
      <div *ngIf="(showActive && active.length > 0) || (!showActive && pending.length > 0)">
44 44
        <div class="uk-card uk-card-default uk-card-body uk-text-small uk-margin-bottom"
modules/uoa-services-library/trunk/ng-openaire-library/src/app/dashboard/users/subscribers/subscribers.component.html
24 24
    </div>
25 25
  </div>
26 26
  <div inner>
27
    <div *ngIf="loading" class="uk-margin-large-top">
27
    <div *ngIf="loading" class="uk-position-center">
28 28
      <loading></loading>
29 29
    </div>
30 30
    <div *ngIf="!loading">
31 31
      <div *ngIf="showSubscribers.length == 0"
32 32
           class="uk-card uk-card-default uk-padding-large uk-text-center uk-margin-bottom uk-text-bold">
33
        <div>No subscribers for {{name}}</div>
33
        <div>No subscribers found</div>
34 34
      </div>
35 35
      <div *ngIf="showSubscribers.length > 0">
36 36
        <no-load-paging [type]="(subscribers.length > 1)?'subscribers':'subscriber'"
modules/uoa-services-library/trunk/ng-openaire-library/src/app/dashboard/entity/entities.component.html
1 1
<div page-content class="admin-pages">
2 2
  <div header>
3 3
    <admin-tabs tab="entity" [portal]="portal"></admin-tabs>
4
    <div *ngIf="!errorMessage && !showLoading" class="uk-grid" uk-grid>
4
    <div *ngIf="!showLoading" class="uk-grid" uk-grid>
5 5
      <div class="uk-width-1-1">
6 6
        <ul *ngIf="!isPortalAdministrator" class="uk-subnav uk-subnav-pill">
7 7
          <li [class.uk-active]="filterForm.get('status').value === 'all'"><a
......
14 14
        </ul>
15 15
      </div>
16 16
      <div class="uk-width-1-1 uk-flex uk-flex-right@m uk-flex-center uk-flex-wrap uk-flex-middle uk-grid uk-margin-remove-top"
17
           uk-grid>
18
        <div #searchInputComponent search-input [control]="filterForm.controls.keyword" [showSearch]="false" placeholder="Search entity"
17
          uk-grid>
18
        <div #searchInputComponent search-input [control]="filterForm.controls.keyword" [showSearch]="false"
19
             placeholder="Search entity"
19 20
             [selected]="selectedKeyword" (closeEmitter)="onSearchClose()" (resetEmitter)="reset()"
20
             [bordered]="true" colorClass="uk-text-secondary" class="uk-width-1-3@xl uk-width-2-5@l uk-width-1-2@m uk-width-1-1"></div>
21
        <!--<div class="show-options">
22
          <button class="uk-button uk-button-secondary">Bulk Actions</button>
23
          <div uk-dropdown="mode: click">
24
            <ul class="uk-nav uk-dropdown-nav"
25
                [attr.uk-tooltip]="getSelectedEntities().length == 0 ? 'pos:left; cls: uk-active' : 'cls: uk-invisible'"
26
                title="Select at least one entity">
27
              <li *ngIf="!isPortalAdministrator"><a [class]="getSelectedEntities().length == 0 ? 'uk-disabled' : ''"
28
                                                    (click)="toggleEntities(true, getSelectedEntities())"><i></i>
29
                Activate
30
              </a></li>
31
              <li *ngIf="!isPortalAdministrator"><a [class]="getSelectedEntities().length == 0 ? 'uk-disabled' : ''"
32
                                                    (click)="toggleEntities(false, getSelectedEntities())"><i></i>
33
                Deactivate
34
              </a></li>
35
              <li *ngIf="isPortalAdministrator"><a [class]="getSelectedEntities().length == 0 ? 'uk-disabled' : ''"
36
                                                   (click)="confirmDeleteSelectedEntities()"><i></i> Delete </a></li>
37
            </ul>
38
          </div>
39
        </div>-->
40

  
21
             [bordered]="true" colorClass="uk-text-secondary"
22
             class="uk-width-1-3@xl uk-width-2-5@l uk-width-1-2@m uk-width-1-1"></div>
41 23
        <div *ngIf="isPortalAdministrator">
42 24
          <a (click)="newEntity()"
43 25
             class="uk-flex uk-flex-middle uk-text-uppercase">
......
48 30
          </a>
49 31
        </div>
50 32
      </div>
51
      <!--<div *ngIf="checkboxes.length > 0" class=" uk-margin-remove-top uk-margin-small-left"
52
           [attr.uk-tooltip]="getSelectedEntities().length == 0 ? 'pos:left; cls: uk-active' : 'cls: uk-invisible'"
53
           title="Select at least one entity">
54
        <input id="checkAll" type="checkbox" (click)="selectAll()"
55
               [ngModel]="getSelectedEntities().length ==checkboxes.length"/>
56
        <a *ngIf="!isPortalAdministrator" class="uk-margin-left" [class.uk-disabled]="getSelectedEntities().length
57
               == 0"
58
           (click)="toggleEntities(true, getSelectedEntities())"><i></i> Activate </a>
59
        <a *ngIf="!isPortalAdministrator" class="uk-margin-left" [class.uk-disabled]="getSelectedEntities().length == 0"
60
           (click)="toggleEntities(false, getSelectedEntities())"><i></i> Deactivate </a>
61
        <a  *ngIf="isPortalAdministrator" class="uk-margin-left" [class.uk-disabled]="getSelectedEntities().length == 0"
62
            (click)="confirmDeleteSelectedEntities()"><i></i> Delete </a>
63

  
64
      </div>-->
65 33
    </div>
66 34
    <div *ngIf="!showLoading && checkboxes.length > 0"
67 35
         class="uk-margin-remove-top uk-margin-small-left uk-margin-small-bottom uk-display-inline"
68 36
         [attr.uk-tooltip]="getSelectedEntities().length == 0 ? 'pos:left; cls: uk-active' : null"
69 37
         title="Select at least one entity"><input id="checkAll" type="checkbox" (click)="selectAll()"
70
                                                      [ngModel]="getSelectedEntities().length ==checkboxes.length"/>
38
                                                   [ngModel]="getSelectedEntities().length ==checkboxes.length"/>
71 39
      <span *ngIf="getSelectedEntities().length > 0" class="uk-margin-left uk-text-muted">
72 40
                        {{getSelectedEntities().length}} entities selected </span>
73
      <a  class="uk-margin-left ">Actions  </a>
41
      <a class="uk-margin-left ">Actions </a>
74 42
      <div uk-dropdown="mode: click">
75 43
        <ul class="uk-nav uk-dropdown-nav"
76 44
            [attr.uk-tooltip]="getSelectedEntities().length == 0 ? 'pos:left; cls: uk-active' : 'cls: uk-invisible'"
......
90 58
  </div>
91 59
  <div inner>
92 60
    <div *ngIf="showLoading" class="uk-position-center">
93
      <loading *ngIf="showLoading"></loading>
61
      <loading></loading>
94 62
    </div>
95 63
    <div *ngIf="!showLoading">
96
      <!--<div *ngIf="!isPortalAdministrator" class="uk-alert uk-alert-primary uk-margin-top-large">
97
        <div>
98
          <span class="uk-margin-small-right uk-icon" uk-icon="warning"></span>
99
          Disable an entity to hide it from community dashboard portal.
100
        </div>
101
        <div
102
            class="uk-text-small">If an entity is disabled, all related search and advanced search pages will be
103
          hidden from the community dashborad and a message "Can't find that page" will appear in case the url of that
104
          page is loaded. If the related page belongs to the menu the link will be removed from menu, too.
105
        </div>
64
      <table *ngIf="checkboxes.length > 0 " class="uk-table uk-table-striped uk-table-hover uk-table-large">
65
        <thead class="uk-card-header">
66
        <tr>
67
          <th class="uk-width-small"></th>
68
          <th>Name</th>
69
          <th *ngIf="!isPortalAdministrator">Status</th>
70
          <th *ngIf="!isPortalAdministrator">Enable/Disable</th>
71
          <th *ngIf="isPortalAdministrator">Actions</th>
72
        </tr>
73
        </thead>
74
        <tbody>
75
        <tr *ngFor="let check of checkboxes; let i=index">
76
          <td><input id="{{check.entity._id}}" class="checkBox" type="checkbox"
77
                     name="entitiescb[]" value="{{check.entity._id}}" [(ngModel)]="check.checked">
78
          </td>
79
          <td>
80
            <div class="name" href="#">{{check.entity.name}}</div>
81
          </td>
82
          <td *ngIf="!isPortalAdministrator">
83
            <div class="name" href="#">{{check.entity.isEnabled ? "Enabled" : "Disabled"}}</div>
84
          </td>
85
          <td *ngIf="!isPortalAdministrator">
86
            <mat-slide-toggle [checked]="check.entity.isEnabled"
87
                              (change)="($event.source.checked = check.entity.isEnabled);toggleEntities(!check.entity.isEnabled,[check.entity._id])"
88
                              uk-tooltip="title:<div class='uk-padding-small uk-width-large'><div class='uk-text-bold '>Disable an entity to hide it from community dashboard portal.</div><div class=' uk-margin-top'>If an entity is disabled, all related search and advanced search pages will be hidden from the community dashborad and a message 'Can't find that page' will appear in case the url of  that page is loaded. If the related page belongs to the menu the link will be removed from menu, too.</div></div>"
89
            ></mat-slide-toggle>
90
          </td>
106 91

  
107
      </div>-->
108
      <div *ngIf="updateErrorMessage" class="uk-alert-danger" uk-alert>
109
        <a class="uk-alert-close" uk-close></a>
110
        {{updateErrorMessage}}
111
      </div>
112
      <div *ngIf="errorMessage" class="uk-alert uk-alert-danger  uk-margin-large-top"
113
           role="alert">{{errorMessage}}</div>
114
      <div class="md-card uk-margin-medium-bottom" *ngIf="!errorMessage">
115
        <div class="md-card-content">
116
          <div class="uk-overflow-container">
117
            <table class="uk-table uk-table-striped uk-table-hover uk-table-large">
118
              <thead class="uk-card-header">
119
              <tr>
120
                <th class="uk-width-small">
121
                  <!--<input id="allEntityCheckbox" type="checkbox"
122
                                                  (change)="toggleCheckBoxes($event)">-->
123
                </th>
124
                <th>Name</th>
125
                <th *ngIf="!isPortalAdministrator">Status</th>
126
                <th *ngIf="!isPortalAdministrator">Enable/Disable</th>
127
                <th *ngIf="isPortalAdministrator">Actions</th>
128
              </tr>
129
              </thead>
130
              <tbody>
131
              <tr *ngFor="let check of checkboxes; let i=index">
132
                <td><input id="{{check.entity._id}}" class="checkBox" type="checkbox"
133
                           name="entitiescb[]" value="{{check.entity._id}}" [(ngModel)]="check.checked">
134
                </td>
135
                <td>
136
                  <div class="name" href="#">{{check.entity.name}}</div>
137
                </td>
138
                <td *ngIf="!isPortalAdministrator">
139
                  <div class="name" href="#">{{check.entity.isEnabled ? "Enabled" : "Disabled"}}</div>
140
                </td>
141
                <td *ngIf="!isPortalAdministrator">
142
                  <mat-slide-toggle [checked]="check.entity.isEnabled"
143
                                    (change)="($event.source.checked = check.entity.isEnabled);toggleEntities(!check.entity.isEnabled,[check.entity._id])"
144
                                     uk-tooltip="title:<div class='uk-padding-small uk-width-large'><div class='uk-text-bold '>Disable an entity to hide it from community dashboard portal.</div><div class=' uk-margin-top'>If an entity is disabled, all related search and advanced search pages will be hidden from the community dashborad and a message 'Can't find that page' will appear in case the url of  that page is loaded. If the related page belongs to the menu the link will be removed from menu, too.</div></div>"
145
                  ></mat-slide-toggle>
146
                </td>
147

  
148
                <td *ngIf="isPortalAdministrator">
149
                  <div class="actions" href="#">
150
                    <i class="clickable " uk-icon="pencil" (click)="editEntity(i)"></i>
151
                    <i class="clickable uk-text-danger" uk-icon="trash"
152
                       (click)="confirmDeleteEntity(check.entity._id)"></i>
153
                  </div>
154
                </td>
155
              </tr>
156
              </tbody>
157
            </table>
158
            <div *ngIf="checkboxes.length ==0 ">
159
              <div class="uk-alert-warning" uk-alert>No entities found</div>
92
          <td *ngIf="isPortalAdministrator">
93
            <div class="actions" href="#">
94
              <i class="clickable " uk-icon="pencil" (click)="editEntity(i)"></i>
95
              <i class="clickable uk-text-danger" uk-icon="trash"
96
                 (click)="confirmDeleteEntity(check.entity._id)"></i>
160 97
            </div>
161
          </div>
162
        </div>
163

  
98
          </td>
99
        </tr>
100
        </tbody>
101
      </table>
102
      <div *ngIf="checkboxes.length == 0"
103
           class="uk-card uk-card-default uk-padding-large uk-text-center uk-margin-bottom uk-text-bold">
104
        <div>No entities found</div>
164 105
      </div>
165 106
    </div>
166 107
  </div>
167 108
</div>
168

  
169 109
<modal-alert #editModal (alertOutput)="entitySaveConfirmed($event)"
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff