aaronucsd commented on a change in pull request #3817: [TE] frontend - 
harleyjj/yaml-editor - makes yaml autocomplete insert…
URL: https://github.com/apache/incubator-pinot/pull/3817#discussion_r255714623
 
 

 ##########
 File path: 
thirdeye/thirdeye-frontend/app/pods/components/yaml-editor/component.js
 ##########
 @@ -176,14 +176,25 @@ export default Component.extend({
                 id: metric.id,
                 completer:{
                   insertMatch: (editor, data) => {
+                    // replace metric row with selected metric
                     editor.session.replace({
                       start: { row: data.row, column: 0 },
                       end: { row: data.row, column: Number.MAX_VALUE }},
                     `metric: ${data.metricname}`);
-                    editor.session.replace({
-                      start: { row: data.row+2, column: 0},
-                      end: { row: data.row+2, column: Number.MAX_VALUE }},
-                    `dataset: ${data.dataset}`);
+                    // find dataset: field in text
+                    const datasetLocation = editor.find('dataset:');
+                    // if found, replace with dataset
+                    if (datasetLocation) {
+                      editor.session.replace({
+                        start: { row: datasetLocation.start.row, column: 0},
 
 Review comment:
   make a small helper
   ```
   _editorReplace(data, replaceStr) {
   editor.session.replace({
                         start: { row: data.row, column: 0 },                   
  
                         end: { row: data.row, column: Number.MAX_VALUE }},     
                     
                       replaceStr);                         
   }
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@pinot.apache.org
For additional commands, e-mail: dev-h...@pinot.apache.org

Reply via email to