Skip to content

Commit

Permalink
remove unnecessary comments
Browse files Browse the repository at this point in the history
  • Loading branch information
joao-mendonca-encora committed Sep 20, 2023
1 parent 8908d4a commit 10676a6
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@
<nb-card-body>
<!-- <div *ngIf="editMode; then updateView else readView"></div>-->
<div class="code-editor-wrapper">
<!-- <ngx-monaco-editor
<ngx-monaco-editor
#editorComponent
[(ngModel)]="code"
[options]="editorOptions"
class="code-editor"
ngDefaultControl
*ngIf="!isYaml">
</ngx-monaco-editor> -->
</ngx-monaco-editor>
<ngx-monaco-editor
[(ngModel)]="code"
[options]="editorOptionsYaml"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,14 @@ export class SinkConfigComponent implements OnInit, OnChanges {

}
}
// isJson(str: string) {
// try {
// JSON.parse(str);
// return true;
// } catch {
// return false;
// }
// }
isJson(str: string) {
try {
JSON.parse(str);
return true;
} catch {
return false;
}
}
ngOnChanges(changes: SimpleChanges) {
const { editMode, sinkBackend } = changes;
if (editMode && !editMode.firstChange) {
Expand All @@ -144,9 +144,9 @@ ngOnChanges(changes: SimpleChanges) {
? this.sinkConfigSchemaPrometheus
: this.sinkConfigSchemaOtlp;

// this.code = this.isYaml
// ? YAML.stringify(sinkConfigSchema, null)
// : JSON.stringify(sinkConfigSchema, null, 2);
this.code = this.isYaml
? YAML.stringify(sinkConfigSchema, null)
: JSON.stringify(sinkConfigSchema, null, 2);
this.code = YAML.stringify(sinkConfigSchema, null);
}
}
Expand Down Expand Up @@ -177,21 +177,21 @@ updateForm() {
else {
this.orb.startPolling();
}
// this.editorOptions = { ...this.editorOptions, readOnly: !edit };
this.editorOptions = { ...this.editorOptions, readOnly: !edit };
this.editorOptionsYaml = { ...this.editorOptionsYaml, readOnly: !edit };
this.updateForm();
!!notify && this.editModeChange.emit(this.editMode);
}
// toggleLanguage() {
// this.isYaml = !this.isYaml;
// if (this.isYaml) {
// const parsedCode = YAML.parse(this.code);
// this.code = YAML.stringify(parsedCode);
// }
// else {
// const parsedConfig = YAML.parse(this.code);
// this.code = JSON.stringify(parsedConfig, null, 2);
// }
// }
toggleLanguage() {
this.isYaml = !this.isYaml;
if (this.isYaml) {
const parsedCode = YAML.parse(this.code);
this.code = YAML.stringify(parsedCode);
}
else {
const parsedConfig = YAML.parse(this.code);
this.code = JSON.stringify(parsedConfig, null, 2);
}
}

}

0 comments on commit 10676a6

Please sign in to comment.