-
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 fd7d76a8..412189c7 100644
--- a/dashboard/menu/menu.component.ts
+++ b/dashboard/menu/menu.component.ts
@@ -1,4 +1,4 @@
-import {Component, ElementRef, OnInit, ViewChild} from '@angular/core';
+import {Component, ElementRef, OnInit, ViewChild, Input} from '@angular/core';
import {ActivatedRoute, Router} from '@angular/router';
import {HelpContentService} from '../../services/help-content.service';
import {FormBuilder, FormGroup, Validators} from '@angular/forms';
@@ -36,12 +36,12 @@ export class MenuComponent implements OnInit {
public activeRootMenuId: string;
public activeRootMenu: MenuItem;
public childrenMenuItems: MenuItem[] = [];
+
private index: number;
-
+
public menuItemForm: FormGroup;
public pageForm: FormGroup;
public rootMenuItems = [];
- public menuItems = [];
public allPages = [];
public selectedMenuItem: string;
@@ -123,11 +123,11 @@ export class MenuComponent implements OnInit {
data => {
this.rootMenuItems = data;
if(data && data.length > 0) {
- // this.activeRootMenuId = data[0]['_id'];
this.changeActiveRootMenuItem(data[0]);
}
},
- err => console.error("Server error fetching menu items: ", err)
+ // err => console.error("Server error fetching menu items: ", err)
+ error => this.handleError("Server error fetching menu items", error)
)
);
}
@@ -163,7 +163,7 @@ export class MenuComponent implements OnInit {
}
}
},
- err => console.error("Server error fetching pages: ", err)
+ error => this.handleError("Server error fetching pages", error)
)
);
}
@@ -172,7 +172,7 @@ export class MenuComponent implements OnInit {
this.newPageWindowOpen = !this.newPageWindowOpen;
this.pageForm = this._fb.group({
_id: this._fb.control(null),
- route: this._fb.control('', Validators.required),
+ route: this._fb.control('', [Validators.required, StringUtils.validRoute(this.allPages, 'value')]),
name: this._fb.control('', Validators.required),
isEnabled: this._fb.control(true),
portalType: this._fb.control(this.properties.adminToolsPortalType, Validators.required),
@@ -202,7 +202,10 @@ export class MenuComponent implements OnInit {
});
this.newPageWindowOpen = !this.newPageWindowOpen;
this.menuItemForm.get('route').setValue(page.route);
- }
+ this.menuItemForm.get('route').markAsDirty();
+ this.showLoading = false;
+ },
+ error => this.handleError('System error creating page', error)
)
);
}
@@ -211,14 +214,15 @@ export class MenuComponent implements OnInit {
this.destroyTypeSubscription();
this.typeSub = this.menuItemForm.get('type').valueChanges.subscribe(value => {
setTimeout(() => {
- // console.log(value);
+ this.menuItemForm.controls['route'].clearValidators();
+ this.menuItemForm.controls['url'].clearValidators();
if(value === "internal") {
this.menuItemForm.controls['route'].setValidators([Validators.required]);
- this.menuItemForm.controls['route'].updateValueAndValidity();
} else if(value === "external") {
- this.menuItemForm.controls['url'].setValidators([Validators.required]);
- this.menuItemForm.controls['url'].updateValueAndValidity();
+ this.menuItemForm.controls['url'].setValidators([Validators.required, StringUtils.urlValidator()]);
}
+ this.menuItemForm.controls['route'].updateValueAndValidity();
+ this.menuItemForm.controls['url'].updateValueAndValidity();
}, 0);
});
}
@@ -243,8 +247,8 @@ export class MenuComponent implements OnInit {
_id: this._fb.control(menuItem['_id']),
title: this._fb.control(menuItem.title,Validators.required),
type: this._fb.control(menuItem['type'],Validators.required),
- route: this._fb.control(menuItem.route),
- url: this._fb.control(menuItem.url),
+ route: this._fb.control(menuItem.route, (menuItem['type'] == "internal") ? [Validators.required] : []),
+ url: this._fb.control(menuItem.url, (menuItem['type'] == "external") ? [Validators.required, StringUtils.urlValidator()] : []),
parentItemId: this._fb.control(menuItem['parentItemId'])
});
this.isChild = isChild;
@@ -284,7 +288,8 @@ export class MenuComponent implements OnInit {
pos: 'bottom-right'
});
this.showLoading = false;
- }
+ },
+ error => this.handleError("Server error deleting menu item", error)
)
)
}
@@ -323,7 +328,8 @@ export class MenuComponent implements OnInit {
timeout: 6000,
pos: 'bottom-right'
});
- }
+ },
+ error => this.handleError("System error creating menu item", error)
)
)
} else {
@@ -336,7 +342,8 @@ export class MenuComponent implements OnInit {
timeout: 6000,
pos: 'bottom-right'
});
- }
+ },
+ error => this.handleError("System error updating menu item", error)
)
)
}
@@ -360,8 +367,18 @@ export class MenuComponent implements OnInit {
this.showLoading = false;
}
+ handleError(message: string, error) {
+ UIkit.notification(message, {
+ status: 'danger',
+ timeout: 6000,
+ pos: 'bottom-right'
+ });
+ console.log('Server responded: ' + error);
+ this.showLoading = false;
+ }
+
public applyFilters() {
- this.childrenMenuItems = this.activeRootMenu.items.filter(item => item.title.toLowerCase().includes(this.searchText));
+ this.childrenMenuItems = this.activeRootMenu.items.filter(item => item.title.toLowerCase().includes(this.searchText) || (item.url||'').toLowerCase().includes(this.searchText) || (item.route||'').toLowerCase().includes(this.searchText));
}
public onSearchClose() {
diff --git a/dashboard/menu/menu.module.ts b/dashboard/menu/menu.module.ts
index 450812d8..a57d6f90 100644
--- a/dashboard/menu/menu.module.ts
+++ b/dashboard/menu/menu.module.ts
@@ -13,7 +13,7 @@ import {MenuRoutingModule} from "./menu-routing.module";
import {SearchInputModule} from "../../sharedComponents/search-input/search-input.module";
import {IconsModule} from "../../utils/icons/icons.module";
import {IconsService} from "../../utils/icons/icons.service";
-import {add} from "../../utils/icons/icons";
+import {add, edit, remove} from "../../utils/icons/icons";
import {LoadingModule} from "../../utils/loading/loading.module";
@NgModule({
@@ -26,6 +26,6 @@ import {LoadingModule} from "../../utils/loading/loading.module";
})
export class MenuModule {
constructor(private iconsService: IconsService) {
- this.iconsService.registerIcons([add]);
+ this.iconsService.registerIcons([add, edit, remove]);
}
}
diff --git a/dashboard/page/pages.component.html b/dashboard/page/pages.component.html
index 9fb4796c..5437ff27 100644
--- a/dashboard/page/pages.component.html
+++ b/dashboard/page/pages.component.html
@@ -63,57 +63,71 @@
0" class="uk-list pages">
-
-
-
-
-
-
Name
-
{{check.page.name}}
-
0">Entities:
- {{getEntitiesAsString(check.page)}}
-
Route: {{check.page.route}}
-
Type: {{check.page.type}}
-
-
Portal type: {{check.page.portalType}}
+
+
-
-
Actions
-
-
-
+
+
Name
+
{{check.page.name}}
+
0">Entities:
+ {{getEntitiesAsString(check.page)}}
+
Route: {{check.page.route}}
+
Type: {{check.page.type}}
+
+ Portal type: {{check.page.portalType}}
+
+
+ Portal PID: {{check.page.portalPid}}
+
-
-
-
Help texts
-
-
-
-
Enable/disable
-
-
+
+
+
+
+
+
+
+
+
@@ -136,7 +150,7 @@
type="text" placeholder="Write a name"
label="Page Name">
-
+
@@ -171,7 +185,7 @@
By disabling a position, all contents in this position will be deleted.
-
+
diff --git a/dashboard/page/pages.component.ts b/dashboard/page/pages.component.ts
index af631036..59785e37 100644
--- a/dashboard/page/pages.component.ts
+++ b/dashboard/page/pages.component.ts
@@ -242,7 +242,7 @@ export class PagesComponent implements OnInit {
this.index = this.pages.findIndex(value => value._id === page._id);
this.pageForm = this._fb.group({
_id: this._fb.control(page._id),
- route: this._fb.control(page.route, Validators.required),
+ route: this._fb.control(page.route, [Validators.required, StringUtils.validRoute(this.pages, 'route', page.route)]),
name: this._fb.control(page.name, Validators.required),
isEnabled: this._fb.control(page.isEnabled),
portalType: this._fb.control(page.portalType, Validators.required),
@@ -268,7 +268,7 @@ export class PagesComponent implements OnInit {
this.entitiesCtrl = this._fb.array([]);
this.pageForm = this._fb.group({
_id: this._fb.control(null),
- route: this._fb.control('', Validators.required),
+ route: this._fb.control('', [Validators.required, StringUtils.validRoute(this.pages, 'route')]),
name: this._fb.control('', Validators.required),
isEnabled: this._fb.control(true),
portalType: this._fb.control('', Validators.required),
@@ -364,7 +364,7 @@ export class PagesComponent implements OnInit {
if (error == null) {
// this.formComponent.reset();
this.pageForm = this._fb.group({
- route: this._fb.control('', Validators.required),
+ route: this._fb.control('', [Validators.required, StringUtils.validRoute(this.pages, 'route')]),
name: this._fb.control('', Validators.required),
isEnabled: this._fb.control(true),
portalType: this._fb.control('', Validators.required),
diff --git a/dashboard/page/pages.module.ts b/dashboard/page/pages.module.ts
index bdac5062..ba6a54a5 100644
--- a/dashboard/page/pages.module.ts
+++ b/dashboard/page/pages.module.ts
@@ -16,7 +16,7 @@ import {PagesRoutingModule} from "./pages-routing.module";
import {SearchInputModule} from "../../sharedComponents/search-input/search-input.module";
import {IconsModule} from "../../utils/icons/icons.module";
import {IconsService} from "../../utils/icons/icons.service";
-import {add} from "../../utils/icons/icons";
+import {add, edit, remove} from "../../utils/icons/icons";
import {LoadingModule} from "../../utils/loading/loading.module";
@NgModule({
@@ -29,6 +29,6 @@ import {LoadingModule} from "../../utils/loading/loading.module";
})
export class PagesModule {
constructor(private iconsService: IconsService) {
- this.iconsService.registerIcons([add]);
+ this.iconsService.registerIcons([add, edit, remove]);
}
}
diff --git a/dashboard/portal/portals.component.html b/dashboard/portal/portals.component.html
index c741e7b2..54fbeec3 100644
--- a/dashboard/portal/portals.component.html
+++ b/dashboard/portal/portals.component.html
@@ -69,9 +69,8 @@
-
-
+
+
|
diff --git a/dashboard/portal/portals.module.ts b/dashboard/portal/portals.module.ts
index d578f9b4..98f55248 100644
--- a/dashboard/portal/portals.module.ts
+++ b/dashboard/portal/portals.module.ts
@@ -10,7 +10,7 @@ import {AdminTabsModule} from "../sharedComponents/admin-tabs/admin-tabs.module"
import {PageContentModule} from "../sharedComponents/page-content/page-content.module";
import {PortalsRoutingModule} from "./portals-routing.module";
import {IconsService} from "../../utils/icons/icons.service";
-import {add} from "../../utils/icons/icons";
+import {add, edit, remove} from "../../utils/icons/icons";
import {IconsModule} from "../../utils/icons/icons.module";
import {SearchInputModule} from "../../sharedComponents/search-input/search-input.module";
import {LoadingModule} from "../../utils/loading/loading.module";
@@ -26,6 +26,6 @@ import {LoadingModule} from "../../utils/loading/loading.module";
})
export class PortalsModule {
constructor(private iconsService: IconsService) {
- this.iconsService.registerIcons([add]);
+ this.iconsService.registerIcons([add, edit, remove]);
}
}
diff --git a/dashboard/sharedComponents/admin-tabs/admin-tabs.component.ts b/dashboard/sharedComponents/admin-tabs/admin-tabs.component.ts
index 2fc24a99..788d5fac 100644
--- a/dashboard/sharedComponents/admin-tabs/admin-tabs.component.ts
+++ b/dashboard/sharedComponents/admin-tabs/admin-tabs.component.ts
@@ -12,7 +12,7 @@ import { properties } from 'src/environments/environment';
- Portals
- Pages
- Entities
-
- Menu
+
- Menu
- Classes
`
diff --git a/sharedComponents/input/input.component.ts b/sharedComponents/input/input.component.ts
index 96de7b4b..d33aa0b5 100644
--- a/sharedComponents/input/input.component.ts
+++ b/sharedComponents/input/input.component.ts
@@ -77,7 +77,7 @@ export interface Option {
(openedChange)="stopPropagation()" [formControl]="formControl"
[disableOptionCentering]="true">
{{placeholder}}
-
+
{{option.label}}
@@ -200,7 +200,7 @@ export class InputComponent implements OnInit, OnDestroy, OnChanges {
@Input() panelWidth: number = 300;
@Input() panelClass: string = null;
@Input() showOptionsOnEmpty: boolean = true;
- @Input() validators: ValidatorFn[];
+ @Input() validators: ValidatorFn[] | ValidatorFn;
@Output() focusEmitter: EventEmitter = new EventEmitter();
/** LogoUrl information */
public secure: boolean = true;
@@ -211,6 +211,7 @@ export class InputComponent implements OnInit, OnDestroy, OnChanges {
public filteredOptions: Observable