Skip to content

Commit

Permalink
Merge pull request #166 from hisptz/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
rajey authored Sep 17, 2019
2 parents 184a7b4 + 49d820c commit 4309df0
Show file tree
Hide file tree
Showing 160 changed files with 1,608 additions and 3,915 deletions.
1,604 changes: 821 additions & 783 deletions package-lock.json

Large diffs are not rendered by default.

45 changes: 24 additions & 21 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,31 +22,34 @@
"@angular/material": "^8.2.0",
"@angular/platform-browser": "^9.0.0-next.1",
"@angular/platform-browser-dynamic": "^9.0.0-next.1",
"@angular/pwa": "^0.803.0",
"@angular/pwa": "^0.803.3",
"@angular/router": "^9.0.0-next.1",
"@angular/service-worker": "^9.0.0-next.1",
"@hisptz/ngx-dhis2-dictionary": "^1.0.17",
"@hisptz/ngx-dhis2-http-client": "^2.0.2",
"@hisptz/ngx-dhis2-menu": "^1.0.9",
"@hisptz/ngx-dhis2-table": "^1.0.0",
"@iapps/function-analytics": "^1.0.0-beta.18",
"@iapps/function-analytics": "^1.0.0-beta.20",
"@iapps/ngx-dhis2-http-client": "^2.0.8-beta.3",
"@iapps/ngx-dhis2-org-unit-filter": "^1.1.21-beta.2",
"@iapps/ngx-dhis2-period-filter": "^1.0.0-beta.16",
"@mapbox/geojson-area": "^0.2.2",
"@ng-select/ng-select": "^3.0.6",
"@ngrx/effects": "^8.2.0",
"@ngrx/entity": "^8.2.0",
"@ngrx/router-store": "^8.2.0",
"@ngrx/store": "^8.2.0",
"@ng-select/ng-select": "^3.0.7",
"@ngrx/effects": "^8.3.0",
"@ngrx/entity": "^8.3.0",
"@ngrx/router-store": "^8.3.0",
"@ngrx/store": "^8.3.0",
"@ngx-translate/core": "^11.0.1",
"@ngx-translate/http-loader": "^4.0.0",
"@swimlane/dragula": "^3.8.0",
"@swimlane/ngx-dnd": "^8.0.0",
"@types/geojson": "^7946.0.7",
"@types/polylabel": "^1.0.5",
"bootstrap": "^4.3.1",
"core-js": "^3.2.0",
"core-js": "^3.2.1",
"d2-utilizr": "^0.2.16",
"d3-color": "^1.3.0",
"d3-scale": "^3.0.1",
"d3-scale": "^3.1.0",
"d3-time-format": "^2.1.1",
"dexie": "^2.0.4",
"dom-to-image": "https://[email protected]/heshan0131/dom-to-image.git",
Expand All @@ -55,7 +58,7 @@
"geojson": "^0.5.0",
"gis-api": "^25.0.4",
"hammerjs": "^2.0.8",
"highcharts": "^7.1.2",
"highcharts": "^7.2.0",
"highcharts-grouped-categories": "^1.1.3",
"jquery": "^3.4.1",
"jszip": "^3.2.2",
Expand All @@ -68,38 +71,38 @@
"ngx-pagination": "^4.1.0",
"polylabel": "^1.0.2",
"pwa": "^1.9.7",
"rxjs": "^6.5.2",
"rxjs": "^6.5.3",
"shp-write": "^0.3.2",
"zone.js": "~0.10.1"
"zone.js": "~0.10.2"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.803.0",
"@angular/cli": "^8.2.1",
"@angular-devkit/build-angular": "~0.803.3",
"@angular/cli": "^8.3.3",
"@angular/compiler-cli": "^9.0.0-next.1",
"@angular/language-service": "^9.0.0-next.1",
"@compodoc/compodoc": "^1.1.10",
"@ngrx/schematics": "^8.2.0",
"@ngrx/store-devtools": "^8.2.0",
"@ngrx/schematics": "^8.3.0",
"@ngrx/store-devtools": "^8.3.0",
"@types/jasmine": "^3.4.0",
"@types/jasminewd2": "^2.0.6",
"@types/node": "~12.7.1",
"@types/node": "~12.7.4",
"codelyzer": "^5.1.0",
"commitizen": "^4.0.3",
"cz-conventional-changelog": "^3.0.2",
"d2-manifest": "^1.0.0",
"husky": "^3.0.3",
"husky": "^3.0.5",
"jasmine-core": "~3.4.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "^4.2.0",
"karma": "^4.3.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage-istanbul-reporter": "~2.1.0",
"karma-jasmine": "~2.0.1",
"karma-jasmine-html-reporter": "^1.4.2",
"ngrx-store-freeze": "^0.2.4",
"protractor": "^6.0.0",
"ts-node": "~8.3.0",
"tslint": "^5.18.0",
"typescript": "~3.5.3"
"tslint": "^5.20.0",
"typescript": "^3.5.3"
},
"config": {
"commitizen": {
Expand Down
6 changes: 6 additions & 0 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import { RouteSerializer } from './utils';

import { NgxDhis2MenuModule } from '@hisptz/ngx-dhis2-menu';
import { DragulaModule } from 'ng2-dragula';
import { NgxDhis2HttpClientModule } from '@iapps/ngx-dhis2-http-client';

@NgModule({
declarations: [AppComponent],
Expand All @@ -46,6 +47,11 @@ import { DragulaModule } from 'ng2-dragula';
deps: [HttpClient]
}
}),
NgxDhis2HttpClientModule.forRoot({
version: 1,
namespace: 'bottleneck',
models: {}
}),
/**
* Menu module
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import { MatDialog } from '@angular/material/dialog';
import * as _ from 'lodash';

import { generateUid } from '../../../helpers/generate-uid.helper';
import { User } from '../../../models';
import { Dashboard } from '../../models';
import { SelectionFilterConfig } from '../../modules/ngx-dhis2-data-selection-filter/models/selected-filter-config.model';
import { VisualizationDataSelection } from '../../modules/ngx-dhis2-visualization/models';
import { DashboardDeleteDialogComponent } from '../dashboard-delete-dialog/dashboard-delete-dialog.component';
import { User } from '@iapps/ngx-dhis2-http-client';

@Component({
selector: 'app-current-dashboard-header',
Expand All @@ -23,28 +23,14 @@ import { DashboardDeleteDialogComponent } from '../dashboard-delete-dialog/dashb
changeDetection: ChangeDetectionStrategy.OnPush
})
export class CurrentDashboardHeaderComponent implements OnInit {
@Input()
currentDashboard: Dashboard;
@Input()
currentUser: User;

@Input()
currentUserHasAuthorities: boolean;

@Input()
dashboardLoading: boolean;

@Input()
dashboardLoaded: boolean;

@Input()
globalDataSelections: VisualizationDataSelection[];

@Input()
globalDataSelectionSummary: string;

@Input()
visualizationLoadingPercent: number;
@Input() currentDashboard: Dashboard;
@Input() currentUser: User;
@Input() currentUserHasAuthorities: boolean;
@Input() dashboardLoading: boolean;
@Input() dashboardLoaded: boolean;
@Input() globalDataSelections: VisualizationDataSelection[];
@Input() globalDataSelectionSummary: string;
@Input() visualizationLoadingPercent: number;

selectionFilterConfig: SelectionFilterConfig;
showFavoriteFilter: boolean;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,47 +1,28 @@
<a
[ngClass]="{
<a [ngClass]="{
'dashboard-menu-item': true,
'current-dashboard':
dashboardMenuItem?.id === currentDashboardId &&
!dashboardMenuItem?.unSaved,
'un-saved-dashboard': dashboardMenuItem?.unSaved
}"
(click)="onSetDashboard($event)"
(mouseenter)="onHover($event)"
(mouseleave)="onBlur($event)"
[title]="
dashboardMenuItem?.unSaved
? 'This dashboard contains unsaved changes'
: dashboardMenuItem?.name
"
>
<a
[@open]
[title]="
'un-saved-dashboard': dashboardMenuItem?.unSaved,
'dashboard-has-data': hasRootCauseData
}" (click)="onSetDashboard($event)" (mouseenter)="onHover($event)" (mouseleave)="onBlur($event)"
[title]="dashboardItemDescription">
<a [@open] [title]="
(dashboardMenuItem?.bookmarked
? 'You have bookmarked this dashboard'
: 'Bookmark this dashboard') | translate
"
[ngClass]="{
? 'You have bookmarked this intervention'
: 'Bookmark this intervention') | translate
" [ngClass]="{
'dashboard-menu-bookmark-btn': true,
'active-dashboard-menu-bookmarked-btn':
dashboardMenuItem?.id === currentDashboardId
}"
*ngIf="dashboardMenuItem?.bookmarked && !dashboardMenuItem?.bookmarkPending"
(click)="onToggleBookmark($event)"
>
}" *ngIf="dashboardMenuItem?.bookmarked && !dashboardMenuItem?.bookmarkPending" (click)="onToggleBookmark($event)">
<img *ngIf="dashboardMenuItem?.bookmarked" [src]="bookmarkedIcon" alt="" />
</a>
<a
[@open]
[title]="'Bookmarking dashboard...' | translate"
[ngClass]="{
<a [@open] [title]="'Bookmarking dashboard...' | translate" [ngClass]="{
'dashboard-menu-bookmark-btn': true,
'active-dashboard-menu-bookmarked-btn':
dashboardMenuItem?.id === currentDashboardId
}"
*ngIf="dashboardMenuItem?.bookmarkPending"
>
}" *ngIf="dashboardMenuItem?.bookmarkPending">
<img [src]="bookmarkPendingIcon" alt="" />
</a>
<div *ngIf="!dashboardMenuItem?.bookmarked">&nbsp;</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,7 @@
.current-dashboard:hover {
background-color: #1c8275;
}

.dashboard-has-data {
font-weight: 700 !important;
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import {
BOOKMARKED_SELECTED_ICON
} from '../../../icons';
import { openAnimation } from '../../../animations';
import { VisualizationDataSelection } from '../../modules/ngx-dhis2-visualization/models';
import { dashboardHasRootCauseData } from '../../helpers/dashboard-has-root-cause-data.helper';

@Component({
selector: 'app-dashboard-menu-item',
Expand All @@ -27,6 +29,8 @@ export class DashboardMenuItemComponent implements OnInit {
dashboardMenuItem: Dashboard;
@Input()
currentDashboardId: string;
@Input() dataSelections: VisualizationDataSelection[];
@Input() rootCauseDataIds: string[];
@Output()
setDashboard: EventEmitter<string> = new EventEmitter<string>();
@Output()
Expand All @@ -48,6 +52,29 @@ export class DashboardMenuItemComponent implements OnInit {
this.showBookmarkButton = false;
}

get hasRootCauseData(): boolean {
return dashboardHasRootCauseData(
this.dataSelections || [],
this.dashboardMenuItem ? this.dashboardMenuItem.id : '',
this.rootCauseDataIds || []
);
}

get dashboardItemDescription(): string {
if (!this.dashboardMenuItem) {
return '';
}

return `${
this.dashboardMenuItem.unSaved
? 'This intervention contains unsaved changes'
: this.dashboardMenuItem.name
}${
this.hasRootCauseData
? '(This intervention has root cause data for selected period and organisation unit)'
: ''
}`;
}
ngOnInit() {}

onSetDashboard(e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
| sortByBookmark
">
<app-dashboard-menu-item [dashboardMenuItem]="dashboardMenuItem" [currentDashboardId]="currentDashboardId"
[dataSelections]="dataSelections" [rootCauseDataIds]="rootCauseDataIds"
(setDashboard)="onSetCurrentDashboard($event)" (toggleDashboardMenuItemBookmark)="
onToggleDashboardMenuItemBookmark($event)
"></app-dashboard-menu-item>
Expand All @@ -25,4 +26,6 @@
<small>No search result found</small>
</li>
</ul>


</div>
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ import {
OnInit
} from '@angular/core';
import { Dashboard, DashboardGroups } from '../../models';
import { User, SystemInfo } from '../../../models';
import { DataGroup } from '../../../models/data-group.model';
import { User, SystemInfo } from '@iapps/ngx-dhis2-http-client';
import { VisualizationDataSelection } from '../../modules/ngx-dhis2-visualization/models';

@Component({
selector: 'app-dashboard-menu',
Expand Down Expand Up @@ -39,6 +40,10 @@ export class DashboardMenuComponent implements OnInit {
@Input()
currentUserHasAuthorities: boolean;

@Input() dataSelections: VisualizationDataSelection[];

@Input() rootCauseDataIds: string[];

searchTerm: string;

@Output()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@

.default-dashboard-list {
width: 400px;
position: absolute;
position: fixed;
list-style-type: none;
padding: 0;
margin: 0;
top: 40px;
left: 0;
top: 95px;
left: 15px;
right: 0;
background-color: #ffffff;
border: solid thin #dddddd;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<div class="current-dashboard-visualization-container">
<ngx-dhis2-visualization *ngIf="(currentDashboardVisualizationLoaded$ | async) && (currentVisualizationId$ | async) !== ''"
[id]="currentVisualizationId$ | async" [currentUser]="currentUser$ | async" [systemInfo]="systemInfo$ | async" [dashboard]="currentDashboard$ | async"
(toggleFullScreen)="onToggleVisualizationFullScreen($event)"></ngx-dhis2-visualization>
</div>
<ngx-dhis2-visualization
*ngIf="(currentDashboardVisualizationLoaded$ | async) && (currentVisualizationId$ | async) !== ''"
[id]="currentVisualizationId$ | async" [currentUser]="currentUser$ | async" [systemInfo]="systemInfo$ | async"
[dashboard]="currentDashboard$ | async" [selectionSummary]="globalSelectionSummary$ | async"
(toggleFullScreen)="onToggleVisualizationFullScreen($event)">
</ngx-dhis2-visualization>
</div>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component, OnInit } from '@angular/core';
import { Store } from '@ngrx/store';
import { Store, select } from '@ngrx/store';
import { Observable } from 'rxjs';

// root state
Expand All @@ -13,8 +13,10 @@ import * as fromDashboardSelectors from '../../store/selectors';
import { SetCurrentDashboardAction } from '../../store/actions';

// models
import { User, SystemInfo } from '../../../models';
import { SystemInfo } from '../../../models';
import { Dashboard } from '../../models';
import { User } from '@iapps/ngx-dhis2-http-client';
import { getGlobalDataSelectionSummary } from '../../store/selectors/data-selections.selectors';

@Component({
selector: 'app-current-dashboard-visualization',
Expand All @@ -28,6 +30,7 @@ export class CurrentDashboardVisualizationComponent implements OnInit {
systemInfo$: Observable<SystemInfo>;
currentDashboardVisualizationLoading$: Observable<boolean>;
currentDashboardVisualizationLoaded$: Observable<boolean>;
globalSelectionSummary$: Observable<string>;

constructor(private store: Store<State>) {
this.currentVisualizationId$ = this.store.select(
Expand All @@ -53,5 +56,9 @@ export class CurrentDashboardVisualizationComponent implements OnInit {
new SetCurrentDashboardAction(fullScreenDetails.dashboardId)
);
}
ngOnInit() {}
ngOnInit() {
this.globalSelectionSummary$ = this.store.select(
getGlobalDataSelectionSummary
);
}
}
Loading

0 comments on commit 4309df0

Please sign in to comment.