Skip to content

Commit ae1655c

Browse files
authored
KWA: Use new Editor component (Monaco) (#2023)
* kwa(front): Add new Editor component Import new Editor component from Kubeflow Common Library and replace all instances of previous Ace Editor. Signed-off-by: Orfeas Kourkakis <[email protected]> * Update COMMIT file to a more recent one in Kubeflow Signed-off-by: Orfeas Kourkakis <[email protected]> Signed-off-by: Orfeas Kourkakis <[email protected]>
1 parent a5ef2db commit ae1655c

24 files changed

+80
-87
lines changed

pkg/new-ui/v1beta1/frontend/COMMIT

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
c4ca7a9
1+
1cca7b81

pkg/new-ui/v1beta1/frontend/angular.json

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,17 @@
2323
"main": "src/main.ts",
2424
"polyfills": "src/polyfills.ts",
2525
"tsConfig": "tsconfig.app.json",
26-
"assets": ["src/favicon.ico", "src/assets"],
27-
"styles": ["src/styles.scss", "src/assets/css/d3.parcoords.css"],
28-
"scripts": [
29-
"node_modules/ace-builds/src-min/ace.js",
30-
"node_modules/ace-builds/src-min/mode-yaml.js",
31-
"node_modules/ace-builds/src-min/theme-xcode.js"
26+
"assets": [
27+
"src/favicon.ico",
28+
"src/assets",
29+
{
30+
"glob": "**/*",
31+
"input": "node_modules/monaco-editor",
32+
"output": "assets/monaco-editor"
33+
}
3234
],
35+
"styles": ["src/styles.scss", "src/assets/css/d3.parcoords.css"],
36+
"scripts": [],
3337
"vendorChunk": true,
3438
"extractLicenses": false,
3539
"buildOptimizer": false,

pkg/new-ui/v1beta1/frontend/karma.conf.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,17 @@ module.exports = function (config) {
1212
require('karma-coverage-istanbul-reporter'),
1313
require('@angular-devkit/build-angular/plugins/karma')
1414
],
15+
files: [
16+
{
17+
pattern: 'node_modules/monaco-editor/**',
18+
watched: false,
19+
included: false,
20+
served: true,
21+
},
22+
],
23+
proxies: {
24+
'/static/assets/monaco-editor/': '/base/node_modules/monaco-editor/',
25+
},
1526
client: {
1627
clearContext: false // leave Jasmine Spec Runner output visible in browser
1728
},

pkg/new-ui/v1beta1/frontend/package-lock.json

Lines changed: 6 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/new-ui/v1beta1/frontend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"js-yaml": "^4.0.0",
4040
"lodash-es": "4.17.21",
4141
"material-icons": "^0.7.7",
42-
"ng2-ace-editor": "^0.3.9",
42+
"monaco-editor": "^0.33.0",
4343
"ngx-echarts": "^8.0.1",
4444
"ngx-json-viewer": "^2.4.0",
4545
"rxjs": "~6.6.7",

pkg/new-ui/v1beta1/frontend/proxy.conf.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,10 @@
44
"secure": false,
55
"logLevel": "debug",
66
"changeOrigin": true
7+
},
8+
"/static": {
9+
"target": "http://localhost:4200",
10+
"pathRewrite": { "^/static": "" },
11+
"secure": false
712
}
813
}

pkg/new-ui/v1beta1/frontend/src/app/pages/experiment-creation/metrics-collector/metrics-collector.component.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,13 @@
6868
</ng-container>
6969

7070
<ng-container *ngSwitchCase="kind.CUSTOM">
71-
<div
72-
ace-editor
73-
class="ace-editor"
71+
<lib-monaco-editor
7472
[(text)]="customYaml"
75-
mode="yaml"
76-
theme="xcode"
77-
></div>
73+
[language]="'yaml'"
74+
[readOnly]="false"
75+
[width]="375"
76+
[height]="300"
77+
></lib-monaco-editor>
7878
</ng-container>
7979
</ng-container>
8080
</div>
Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +0,0 @@
1-
.ace-editor {
2-
width: 375px;
3-
height: 300px;
4-
}

pkg/new-ui/v1beta1/frontend/src/app/pages/experiment-creation/metrics-collector/metrics-collector.component.spec.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
22
import { FormControl, FormGroup } from '@angular/forms';
33
import { CommonModule } from '@angular/common';
4-
import { FormModule } from 'kubeflow';
4+
import { EditorModule, FormModule } from 'kubeflow';
55
import { ListKeyValueModule } from 'src/app/shared/list-key-value/list-key-value.module';
6-
import { AceEditorModule } from 'ng2-ace-editor';
76

87
import { FormMetricsCollectorComponent } from './metrics-collector.component';
98
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
@@ -20,7 +19,7 @@ describe('FormMetricsCollectorComponent', () => {
2019
BrowserAnimationsModule,
2120
FormModule,
2221
ListKeyValueModule,
23-
AceEditorModule,
22+
EditorModule,
2423
],
2524
declarations: [FormMetricsCollectorComponent],
2625
}).compileComponents();
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
import { NgModule } from '@angular/core';
22
import { CommonModule } from '@angular/common';
33
import { FormMetricsCollectorComponent } from './metrics-collector.component';
4-
import { FormModule } from 'kubeflow';
4+
import { FormModule, EditorModule } from 'kubeflow';
55
import { ListKeyValueModule } from 'src/app/shared/list-key-value/list-key-value.module';
6-
import { AceEditorModule } from 'ng2-ace-editor';
76

87
@NgModule({
98
declarations: [FormMetricsCollectorComponent],
10-
imports: [CommonModule, FormModule, ListKeyValueModule, AceEditorModule],
9+
imports: [CommonModule, FormModule, ListKeyValueModule, EditorModule],
1110
exports: [FormMetricsCollectorComponent],
1211
})
1312
export class FormMetricsCollectorModule {}

0 commit comments

Comments
 (0)