HUE-3947 [editor] Offer to manually run queries in editor when sample data timeouts

Review Request #9687 - Created March 1, 2017 and submitted

Adrian Yavorskyy
hue
master
hue
enricoberti, erickt, johan, romain
commit 3dc5404a357091fddca9f8976812f91554ec2fe4
Author: Adrian Yavorskyy <ayav@softserveinc.com>
Date:   Wed Mar 1 13:57:45 2017 +0200

    HUE-3947 [editor] Offer to manually run queries in editor when sample data timeouts

:100644 100644 7f49072... 1cbd475... M	desktop/core/src/desktop/static/desktop/js/ko.hue-bindings.js
:100644 100644 b87f770... e71fd17... M	desktop/core/src/desktop/templates/sql_context_popover.mako

Manual in Chrome

  • 1
  • 0
  • 12
  • 0
  • 13
Description From Last Updated
Just wondering, there is no way to re-use the query from the drag&drop a table and SELECT? (I will harmonize ... Romain Rigaux
  1. 
      
    1. Thanks for feedback !
      BTW: I thought it would be great to hide a popover after a user clicks on a hyperlink to insert a sample query. I was trying to use a hidePopover(), but it wasn't working. Could you please suggest what else could be done?

    2. I think, I figured out:
      <a href="javascript:void(0);" data-bind="click: function(){ huePubSub.publish('sample.error.insert.click', $data); huePubSub.publish('sql.context.popover.hide');}">...

  2. I would do something more specific, like
    subscribe('sample.error.insert.click'

  3. is .identifierChain always != null and with at least 2 items, and the second item with a property called name? we should probably check for probable null pointer exceptions here, like

    var table = '';
    if (popoverEntry.identifierChain && ?popoverEntry.identifierChain.length > 1 && popoverEntry.identifierChain[1]['name']) {
    table = popoverEntry.identifierChain[1]['name'];
    }

    if (table !== ''){
    editor.session.insert(editor.getCursorPosition(), 'SELECT * FROM '+ table + ' LIMIT 100');
    }

  4. maybe <span> instead of <p>? no idea how it looks though

    1. It looks better with a span :)

  5. no need for an additional function to call

    data-bind="click: function(){ huePubSub.publish('blablabal', $data); }"

  6. 
      
  1. Thanks! Some small issues but otherwise fine by me.

    1. Thanks for review and useful tips !

  2. 'sample.Click' is too vague. Should be more like 'editor.insert.sample.select'

    Nit: For strings try to use single quotes

  3. is the table name always on index 1? I can't remember if that's the case. Probably better to say identifierChain[identifierChain.length - 1]

  4. var text = and skip the text = '' above

  5. 'Click' is not an appropriate name, sampleErrorClick is easier to follow

  6. This is also used for columns, in which case tableName would be set to the column name. Probably better to keep this as title, i.e. title: self.title.

  7. At first I thought this was the flag to indicate that a sampleError had occured. We probably want something like 'enableSampleError' instead.

  8. 
      
  1. Ship It!
    1. I've attached a patch to a jira issue ! Thanks !

    2. I'm not convinced about the popoverEntry.identifierChain && ?popoverEntry.identifierChain.length > 1 && popoverEntry.identifierChain[1]['name']) anymore after Johan's comments so I didn't push it yet

    3. Ok, I will change it for identifierChain[identifierChain.length - 1]

  2. 
      
  1. 
      
  2. Just wondering, there is no way to re-use the query from the drag&drop a table and SELECT?

    (I will harmonize these query generations soon: https://issues.cloudera.org/browse/HUE-5985)

    1. I couldn't find a way to re-use a query from the drag&drop. Could you share your idea of how to do it ?

    2. Probably notworth it for now actually (too much work), will put a note one HUE-5985!

    3. Okey !

  3. 
      
  1. Ship It!
    1. I've attached a patch to a jira !

    2. Pushed, thanks!

  2. 
      
Review request changed

Status: Closed (submitted)

Loading...