Skip to content
This repository has been archived by the owner on Nov 21, 2024. It is now read-only.

Commit

Permalink
fix: Add check variables to undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
EndyKaufman committed May 8, 2018
1 parent 4189e83 commit 6770db2
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
14 changes: 9 additions & 5 deletions libs/@rucken/core/src/shared/models/group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,16 @@ export class Group implements IModel {
@Type(serializeModel(Permission))
permissions: Permission[] = [];
get permissionsAsString() {
const permissionsLength = this.permissions.length;
if (permissionsLength > 14) {
return this.permissions.filter((item, index) => index < 7).join(', ') +
((permissionsLength > 7) ? `... +${permissionsLength - 7}` : '');
if (this.permissions) {
const permissionsLength = this.permissions.length;
if (permissionsLength > 14) {
return this.permissions.filter((item, index) => index < 7).join(', ') +
((permissionsLength > 7) ? `... +${permissionsLength - 7}` : '');
}
return this.permissions.join(', ');
} else {
return '';
}
return this.permissions.join(', ');
}
toString() {
return this.title;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,13 @@ export class EntityGridComponent<TModel extends IModel> {
this._columns = columns;
}
get columns() {
return this._columns.filter(column =>
column === 'action' ? ((this.readonly === true || (!this.isEnableDelete && !this.isEnableUpdate)) ? false : true) : true
);
if (this._columns) {
return this._columns.filter(column =>
column === 'action' ? ((this.readonly === true || (!this.isEnableDelete && !this.isEnableUpdate)) ? false : true) : true
);
} else {
return this._columns;
}
}
@Input()
classes: string[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ export class EntityModalComponent extends BasePromptFormModalComponent<any> {
ignoredFields = ['id'];

set form(form: DynamicFormGroup<any>) {
this.keys = Object.keys(form.controls).filter(key =>
this.keys = form.controls ? Object.keys(form.controls).filter(key =>
this.ignoredFields.indexOf(
key.toLowerCase()
) === -1
);
) : [];
this._form = form;
}
get form() {
Expand Down

0 comments on commit 6770db2

Please # to comment.