diff --git a/dashboard/menu/menu.component.html b/dashboard/menu/menu.component.html
index 3587fd8d..fa421d13 100644
--- a/dashboard/menu/menu.component.html
+++ b/dashboard/menu/menu.component.html
@@ -131,7 +131,26 @@
Select one of the pages
-
+
+
+
+
+
Create New Page
+
+
+
\ No newline at end of file
diff --git a/dashboard/menu/menu.component.ts b/dashboard/menu/menu.component.ts
index 6be41581..510bc66a 100644
--- a/dashboard/menu/menu.component.ts
+++ b/dashboard/menu/menu.component.ts
@@ -13,8 +13,6 @@ import {Title} from "@angular/platform-browser";
import {AlertModal} from '../../utils/modal/alert';
import {CheckMenuItem, MenuItem} from '../../sharedComponents/menu';
import {SearchInputComponent} from '../../sharedComponents/search-input/search-input.component';
-import {Option} from '../../sharedComponents/input/input.component';
-
@Component({
selector: 'menuSelector',
@@ -42,6 +40,7 @@ export class MenuComponent implements OnInit {
public properties: EnvProperties = properties;
+ public newPageWindowOpen: boolean = false;
public showLoading = true;
public isPortalAdministrator = null;
public filterForm: FormGroup;
@@ -75,6 +74,8 @@ export class MenuComponent implements OnInit {
this.isPortalAdministrator = Session.isPortalAdministrator(user) && !this.portal;
});
this.showLoading = false;
+ this.getMenuItems();
+ this.getPages();
}
ngOnDestroy(): void {
@@ -87,6 +88,34 @@ export class MenuComponent implements OnInit {
});
}
+ getMenuItems() {
+ this.subscriptions.push(
+ this._helpContentService.getMenuItems(this.portal).subscribe(
+ data => {
+ console.log(data);
+ },
+ err => console.error("Server error fetching menu items: ", err)
+ )
+ );
+ }
+
+ getPages() {
+ this.subscriptions.push(
+ this._helpContentService.getAllPages(this.properties.adminToolsAPIURL,this.portal).subscribe(
+ data => {
+ let pages = data;
+ this.allPages = [];
+ for(let i = 0; i < pages.length; i++) {
+ if(pages[i] && pages[i].name && pages[i].route) {
+ this.allPages.push({value: pages[i].route, label: pages[i].name});
+ }
+ }
+ },
+ err => console.error("Server error fetching pages: ", err)
+ )
+ );
+ }
+
public newRootMenu() {
this.menuItemForm = this._fb.group({
id: this._fb.control(""),
@@ -161,6 +190,10 @@ export class MenuComponent implements OnInit {
console.log('Delete menu item');
}
+ public newPageWindow() {
+ this.newPageWindowOpen = !this.newPageWindowOpen;
+ }
+
private menuItemsModalOpen(title: string, yesBtn: string) {
this.editModal.cancelButton = true;
this.editModal.okButton = true;
diff --git a/services/help-content.service.ts b/services/help-content.service.ts
index 4fd3d156..bd36763f 100644
--- a/services/help-content.service.ts
+++ b/services/help-content.service.ts
@@ -14,6 +14,7 @@ import {StatisticsDisplay, StatisticsSummary} from '../connect/statistics/statis
import {CustomOptions} from './servicesUtils/customOptions.class';
import {catchError, map} from "rxjs/operators";
import {properties} from "../../../environments/environment";
+import { MenuItem } from '../sharedComponents/menu';
@Injectable()
export class HelpContentService {
@@ -264,7 +265,7 @@ export class HelpContentService {
// parameters += "&with_positions="+with_positions;
// }
// }
- return this.http.get>(helpContentUrl + 'page' + (pid?"pid="+pid:""))
+ return this.http.get>(helpContentUrl + 'page?' + (pid?"pid="+pid:""))
//.map(res => > res.json())
.pipe(catchError(this.handleError));
}
@@ -314,6 +315,11 @@ export class HelpContentService {
.pipe(catchError(this.handleError));
}
+ getMenuItems(portalPid: string) {
+ return this.http.get>(properties.adminToolsAPIURL + properties.adminToolsPortalType + "/" + portalPid + "/menu/root/full")
+ .pipe(catchError(this.handleError));
+ }
+
// unused
getCommunities( helpContentUrl:string) {
return this.http.get>(helpContentUrl + properties.adminToolsPortalType)