diff --git a/ui/src/app/pages/datasets/policies.agent/view/agent.policy.view.component.html b/ui/src/app/pages/datasets/policies.agent/view/agent.policy.view.component.html
index aae188a96..8d857becb 100644
--- a/ui/src/app/pages/datasets/policies.agent/view/agent.policy.view.component.html
+++ b/ui/src/app/pages/datasets/policies.agent/view/agent.policy.view.component.html
@@ -34,25 +34,39 @@
diff --git a/ui/src/app/shared/components/orb/policy/policy-datasets/policy-datasets.component.ts b/ui/src/app/shared/components/orb/policy/policy-datasets/policy-datasets.component.ts
index 581214a66..46c4ac583 100644
--- a/ui/src/app/shared/components/orb/policy/policy-datasets/policy-datasets.component.ts
+++ b/ui/src/app/shared/components/orb/policy/policy-datasets/policy-datasets.component.ts
@@ -100,7 +100,7 @@ export class PolicyDatasetsComponent
prop: 'agent_group',
name: 'Agent Group',
resizeable: true,
- canAutoResize: true,
+ canAutoResize: false,
width: 250,
cellTemplate: this.groupTemplateCell,
},
@@ -108,7 +108,7 @@ export class PolicyDatasetsComponent
prop: 'valid',
name: 'Valid',
resizeable: true,
- canAutoResize: true,
+ canAutoResize: false,
minWidth: 80,
width: 80,
cellTemplate: this.validTemplateCell,
@@ -117,7 +117,7 @@ export class PolicyDatasetsComponent
prop: 'sinks',
name: 'Sinks',
resizeable: true,
- canAutoResize: true,
+ canAutoResize: false,
width: 450,
cellTemplate: this.sinksTemplateCell,
},
diff --git a/ui/src/app/shared/components/orb/policy/policy-interface/policy-interface.component.html b/ui/src/app/shared/components/orb/policy/policy-interface/policy-interface.component.html
index f66dd5180..0519c3a16 100644
--- a/ui/src/app/shared/components/orb/policy/policy-interface/policy-interface.component.html
+++ b/ui/src/app/shared/components/orb/policy/policy-interface/policy-interface.component.html
@@ -20,15 +20,14 @@
-
-
-
-
+
+
diff --git a/ui/src/app/shared/components/orb/policy/policy-interface/policy-interface.component.scss b/ui/src/app/shared/components/orb/policy/policy-interface/policy-interface.component.scss
index e21374c8b..1183e2e06 100644
--- a/ui/src/app/shared/components/orb/policy/policy-interface/policy-interface.component.scss
+++ b/ui/src/app/shared/components/orb/policy/policy-interface/policy-interface.component.scss
@@ -62,15 +62,8 @@ nb-card {
}
.code-editor {
- height: calc(100%);
width: calc(100%);
padding: calc(1rem);
-}
-
-.code-editor-wrapper {
- min-height: 350px;
- min-width: 200px;
- height: 367px;
- width: calc(100%);
- display: block;
+ min-height: 367px;
+ max-height: 55vh;
}
diff --git a/ui/src/app/shared/components/orb/policy/policy-interface/policy-interface.component.ts b/ui/src/app/shared/components/orb/policy/policy-interface/policy-interface.component.ts
index 2599fbded..5c35ca85d 100644
--- a/ui/src/app/shared/components/orb/policy/policy-interface/policy-interface.component.ts
+++ b/ui/src/app/shared/components/orb/policy/policy-interface/policy-interface.component.ts
@@ -8,11 +8,14 @@ import {
Output,
SimpleChanges,
ViewChild,
+ Renderer2,
} from '@angular/core';
import { AgentPolicy } from 'app/common/interfaces/orb/agent.policy.interface';
import { FormBuilder, FormControl, Validators } from '@angular/forms';
import IStandaloneEditorConstructionOptions = monaco.editor.IStandaloneEditorConstructionOptions;
import { OrbService } from 'app/common/services/orb.service';
+import { EditorComponent } from 'ngx-monaco-editor';
+
@Component({
selector: 'ngx-policy-interface',
@@ -32,8 +35,8 @@ export class PolicyInterfaceComponent implements OnInit, AfterViewInit, OnChange
@Input()
detailsEditMode: boolean;
- @ViewChild('editorComponent')
- editor;
+ @ViewChild(EditorComponent, { static: true })
+ editorComponent: EditorComponent;
editorOptions: IStandaloneEditorConstructionOptions = {
theme: 'vs-dark',
@@ -63,6 +66,7 @@ export class PolicyInterfaceComponent implements OnInit, AfterViewInit, OnChange
constructor(
private fb: FormBuilder,
private orb: OrbService,
+ private renderer: Renderer2,
) {
this.policy = {};
this.code = '';
@@ -72,6 +76,17 @@ export class PolicyInterfaceComponent implements OnInit, AfterViewInit, OnChange
this.detailsEditMode = false;
}
+ getCodeLineCount() {
+ const editorInstance = this.editorComponent['_editor'];
+ if (editorInstance) {
+ const model = editorInstance.getModel();
+ editorInstance.layout();
+ return model ? model.getLineCount() : 0;
+
+ }
+ return 0;
+ }
+
ngOnInit(): void {
this.code = this.policy.policy_data || JSON.stringify(this.policy.policy, null, 2);
}