Skip to content

Commit 01fc8b8

Browse files
committed
DHFPROD-1433 make entity editor scrollable
Fixes entity editor extending beyond browser window when there are too many properties, making buttons not clickable: - Make dialog body container scrollable after a max-height - When new property is added, scroll to bottom
1 parent eaed862 commit 01fc8b8

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

quick-start/src/main/ui/app/entity-modeler/entity-editor.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<i class="fa fa-close"></i>
77
</mdl-button>
88
</div>
9-
<div class="mdl-dialog__content">
9+
<div class="mdl-dialog__content" #dialogContent>
1010
<div>
1111
<mdl-textfield type="text" autofocus label="Title" required [(ngModel)]="entity.info.title" floating-label></mdl-textfield>
1212
</div>

quick-start/src/main/ui/app/entity-modeler/entity-editor.component.scss

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ $bg-color: unquote("rgb(#{$palette-datahub-500})");
2121
bottom: 12px;
2222
}
2323

24+
div.selected-entity div.mdl-dialog__content {
25+
display:block;
26+
overflow:auto;
27+
max-height:596px;
28+
width:100%;
29+
}
30+
2431
table.properties {
2532
border-collapse: collapse;
2633
border: 1px solid #ccc;

quick-start/src/main/ui/app/entity-modeler/entity-editor.component.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import {
22
Component,
33
HostListener,
44
Inject,
5+
ElementRef,
6+
ViewChild
57
} from '@angular/core';
68

79
import { MdlDialogService, MdlDialogReference } from '@angular-mdl/core';
@@ -17,7 +19,10 @@ import * as _ from 'lodash';
1719
templateUrl: './entity-editor.component.html',
1820
styleUrls: ['./entity-editor.component.scss']
1921
})
20-
export class EntityEditorComponent {
22+
export class EntityEditorComponent implements AfterViewChecked {
23+
24+
@ViewChild('dialogContent') el:ElementRef;
25+
2126
entity: Entity;
2227
actions: any;
2328
dataTypes: Array<any>;
@@ -41,6 +46,8 @@ export class EntityEditorComponent {
4146
}
4247
];
4348

49+
propAdded: boolean = false;
50+
4451
// property name pattern: name cannot have space characters in it
4552
readonly PROPERTY_NAME_PATTERN = /^[^\s]+$/;
4653

@@ -162,6 +169,14 @@ export class EntityEditorComponent {
162169

163170
addProperty() {
164171
this.entity.definition.properties.push(new PropertyType());
172+
this.propAdded = true;
173+
}
174+
175+
ngAfterViewChecked() {
176+
if (this.propAdded) {
177+
this.el.nativeElement.scrollTop = this.el.nativeElement.scrollHeight;
178+
this.propAdded = false;
179+
}
165180
}
166181

167182
deleteSelectedProperties() {

0 commit comments

Comments
 (0)