disabled create page button by default, fix a bug with endless loading - dev only

This commit is contained in:
Alex Martzios 2022-01-13 11:23:27 +02:00
parent 73491221f0
commit cd329c70e4
2 changed files with 5 additions and 9 deletions

View File

@ -121,14 +121,8 @@
<form *ngIf="pageForm" [formGroup]="pageForm" class="uk grid uk-child-width-1-1" uk-grid>
<div dashboard-input [formInput]="pageForm.get('name')" type="text" label="Name" placeholder="Write a name"></div>
<div dashboard-input [formInput]="pageForm.get('route')" type="text" label="Route" placeholder="Write a route"></div>
<!-- <div>
<div class="uk-text-bold uk-form-label uk-margin-small-bottom">Enable/disable</div>
<mat-slide-toggle [checked]="pageForm.get('isEnabled')"
uk-tooltip="title:<div class='uk-padding-small uk-width-large'><div class='uk-text-bold '>Disable a page to hide it from community dashboard portal.</div><div class=' uk-margin-top'>If the page is disabled, a message 'Can't find that page' will appear in case the url of that page is loaded. If the disabled page belongs to the menu, the link will be removed from menu, too.</div></div>">
</mat-slide-toggle>
</div> -->
<div class="uk-flex uk-flex-right">
<button class="uk-button uk-button-default" (click)="createPage()">Create Page</button>
<button [disabled]="!(pageForm.get('name').value && pageForm.get('route').value)" class="uk-button uk-button-secondary outlined" (click)="createPage()">Create Page</button>
</div>
</form>
</div>

View File

@ -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,8 +36,9 @@ 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 = [];
@ -202,6 +203,7 @@ export class MenuComponent implements OnInit {
});
this.newPageWindowOpen = !this.newPageWindowOpen;
this.menuItemForm.get('route').setValue(page.route);
this.showLoading = false;
},
error => this.handleError('System error creating page', error)
)