You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@zeppelin.apache.org by Joshua Ochsankehl <jo...@gmail.com> on 2019/10/03 19:20:02 UTC

 Hello I go by the name Ox.  I am working on a project for work to make
Zeppelin more usable to new analysts that don't know how to code.  I am
struggling with a few things that I am trying to do (I haven't code between
two languages before).  I am trying to make an interface that has
everything coded in the background using angular and scala.  In the end it
should produce event flows from a data table.  I don't know if this is the
space for this or not but I'd like to start a dialog about it.

I was able to get a Scala array import into an angular select statement but
I would like to now return the selected result to a scala paragraph
instance.

Also it appears to me that bind isn't working how I think it should.  For
some reason some of my arrays are updating and some aren't even though I
coded them the same way.

Re:

Posted by Joshua Ochsankehl <jo...@gmail.com>.
Sure.

Para 1.
//This is going to setup the DataFrames and Fieldlist to choose from for
later paragraphs.
var value  = Array.empty[String]
var fields = Array(("",""))

def myfunc(command:String){
    command match{
        case "basic" =>
            println("You setup a Basic Flow Table")
            println("and you should feel good!")
            fields = Array(("sip","Source IP"),
                           ("dip","Destination IP"))
        case "http" =>
            println("You setup a HTTP Flow Table")
            fields = Array(("sip","Source IP"),
                           ("dip","Destination IP"),
                           ("header","Header"),
                           ("uri","URI"))
        case "dns" =>
            println("You setup a DNS Flow Table")
            fields = Array(("sip","Source IP"),
                           ("dip","Destination IP"),
                           ("dnsDomain","Domain"),
                           ("dnsArecord","A Record"))
        case "smtp" =>
            println("You setup a SMTP Flow Table")
            fields = Array(("sip","Source IP"),
                           ("dip","Destination IP"),
                           ("smtpHeader","SMTP Header"),
                           ("smtpFromEmail","SMTP From Email Address"))
        case "ssl" =>
            println("You setup a SSL Flow Table")
            fields = Array(("sip","Source IP"),
                           ("dip","Destination IP"),
                           ("sslCompanyName","SSL Company Name"),
                           ("sslCertHash","SSL Certificate Hash"))
        case "ftp" =>
            println("You setup a FTP Flow Table")
            fields = Array(("sip","Source IP"),
                           ("dip","Destination IP"),
                           ("ftpUser","FTP Username"),
                           ("ftpPass","FTP Password"))
        case _  =>
            println("Nothing is setup.")
    }
}

myfunc{
    "" + z.select("Select the Data you want:", Seq(
            ("basic","Basic Flows"),
            ("http","HTTP Flows"),
            ("dns","DNS Flows"),
            ("smtp","SMTP Flows"),
            ("ssl","SSL Flows"),
            ("ftp","FTP Flows")))
}

z.angularBind("fieldlist", fields.toArray)

Para 2.
//This is the frontend code for the users to manipulate.  Currently it's
just a basic list of variables.
%angular
<p>IOC List</p>
    <select name="IOC_LIST" size=10 style="width: 100px !important;
min-width: 100px; max-width: 500px;" ng-change="z.runParagraph('Para 3');"
ng-model="filter_IOC_List" ng-options="i for i in filter_IOC"/>
<p><input type="submit" value="Submit"></p>

<p>Field List</p>
    <select name="FIELD_LIST" ng-change="z.runParagraph('Para 3');"
ng-model="field_List" ng-options="i._1 as i._2 for i in fieldlist"/>

Para 3.
//This currently is setting up the arraylist for the select list in Para
2.  It is also suppose to pull the selected variable from the field_List in
Para 2.
var filter_IOC = Array.empty[String]
filter_IOC = Array("---","Apple","Pear","Orange")
var field_List_Selected = z.angular("field_List").toString
println(field_List_Selected)

-------------------------------------
So i changed the paragraph names here for readability

On Fri, Oct 4, 2019 at 3:16 AM Jeff Zhang <zj...@gmail.com> wrote:

> Do you mind to share some code to demonstrate what you want ?
>
> Joshua Ochsankehl <jo...@gmail.com> 于2019年10月4日周五 上午3:20写道:
>
>> Hello I go by the name Ox.  I am working on a project for work to make
>> Zeppelin more usable to new analysts that don't know how to code.  I am
>> struggling with a few things that I am trying to do (I haven't code between
>> two languages before).  I am trying to make an interface that has
>> everything coded in the background using angular and scala.  In the end it
>> should produce event flows from a data table.  I don't know if this is the
>> space for this or not but I'd like to start a dialog about it.
>>
>> I was able to get a Scala array import into an angular select statement
>> but I would like to now return the selected result to a scala paragraph
>> instance.
>>
>> Also it appears to me that bind isn't working how I think it should.  For
>> some reason some of my arrays are updating and some aren't even though I
>> coded them the same way.
>>
>
>
> --
> Best Regards
>
> Jeff Zhang
>

Re:

Posted by Jeff Zhang <zj...@gmail.com>.
Do you mind to share some code to demonstrate what you want ?

Joshua Ochsankehl <jo...@gmail.com> 于2019年10月4日周五 上午3:20写道:

> Hello I go by the name Ox.  I am working on a project for work to make
> Zeppelin more usable to new analysts that don't know how to code.  I am
> struggling with a few things that I am trying to do (I haven't code between
> two languages before).  I am trying to make an interface that has
> everything coded in the background using angular and scala.  In the end it
> should produce event flows from a data table.  I don't know if this is the
> space for this or not but I'd like to start a dialog about it.
>
> I was able to get a Scala array import into an angular select statement
> but I would like to now return the selected result to a scala paragraph
> instance.
>
> Also it appears to me that bind isn't working how I think it should.  For
> some reason some of my arrays are updating and some aren't even though I
> coded them the same way.
>


-- 
Best Regards

Jeff Zhang