by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 17:51
    umka1332 opened #65
  • 17:49

    umka1332 on cobmbolookup-no-autocoplete

    Add support for autocomplete at… Disable autocomplete for input … 5.9.1 (compare)

  • Sep 17 14:03

    5HT on master

    vsn (compare)

  • Sep 17 14:03
    5HT closed #51
  • Sep 17 13:49
    pal-alex opened #51
  • Sep 17 13:48

    pal-alex on update_cursors

    vsn (compare)

  • Sep 17 13:29

    5HT on master

    a reader for rocks (compare)

  • Sep 17 13:29
    5HT closed #50
  • Sep 17 13:28
    pal-alex opened #50
  • Sep 17 13:27

    pal-alex on update_cursors

    a reader for rocks (compare)

  • Sep 14 11:10

    SunRiseGG on master

    Validation fix for comboLookUpE… new version Merge pull request #64 from syn… (compare)

  • Sep 14 11:10
    SunRiseGG closed #64
  • Sep 14 11:06
    SunRiseGG opened #64
  • Sep 14 11:06

    SunRiseGG on comboLookUpEditFix

    new version (compare)

  • Sep 14 11:03

    SunRiseGG on comboLookUpEditFix

    Validation fix for comboLookUpE… (compare)

  • Sep 08 12:06
    5HT commented #60
  • Sep 08 12:06

    5HT on master

    6.9.0 (compare)

  • Sep 08 12:04
    5HT commented #60
  • Sep 08 12:04

    5HT on master

    Fixed unicode characters on lin… Fixed unicode characters on mac (compare)

  • Sep 08 12:04
    5HT closed #60
Namdak Tonpa
@5HT
N2O makes reliable WS connection and provides BERT encoding
NITRO renders pages and provides SPA page signaling protocol (Nitrogen Web Framework in terms of Erlang API) on top of N2O BERT raw channel
N2O/NITRO stack introduce zero-overhead in terms of Erlang processes on top of COWBOY
Thereby we use raw COWBOY router and introduce no ours
N2O core consists of TWO callback functions:
  1. info/3 (message, query, #cx{}) for N2O contexts
  2. proc/2 (message, #pi{}) for Process Instance (SYNRC gen_server replacement)
info is for N2O protocols
proc is for Erlang protocols (native Erlang processes without sockets and encodings)
By combaning them you create your own application topology
Namdak Tonpa
@5HT
E.g. FTP protocol spawns proc/2 per each file, while all starts stops and chunks are being passed first to info/3 as N2O protocol entry point
BPE protocols also could/should spawn proc/2 per business process, etc.
N2O Expire timer implemented as proc/2
I believe you got the idea. so PI is just gen_server replacement in our stack
while N2O protocol is a part of socket handlers (n2o protocols) chain
we specify list of N2O protocols in {n2o,protolos} env variable
> :application.get_env(:n2o,:protocols)
{:ok, [:nitro_n2o, :crm_ftp, :n2o_heart]}
as you may see my N2O instance contains three protocols (servlets in terms of Java) on top of each socket listener
that's are socket entry points
each of these modules expose info/3 functions
Kool Quark
@koolquark
@5HT , thanks . I will update once I progress through my project. This framework allows us to write everything in Erlang which is a great advantage.
Namdak Tonpa
@5HT
The idea behing N2O/NITRO is to have constant size 5K js for everything (DOM manipulations) with zero-overhead on server side (you don't need to preprocess messages from JS, they are already BERT)!
Why you still can use any templater, DTL or any external library, they are just not needed, because you have native Erlang templater which is NITRO Elements API
on top of NITRO we also have FORM layer where you can declare UI and not to code it :-) for ERP.UNO apps
Namdak Tonpa
@5HT
BPE is an engine where FORMs are being passed for user to input on each transactional step, that's how we build ERP apps
as NITRO the only component for DOM manipulations we have BPE as the only component for backend software
BPE provides action/2 (message, #process{})
Each N2O lib has such callback action that hides some N2O protocol
NITRO has event/1 (message) API as Nitrogen legacy, with implicit #cx{} inside Erlang process dictionary
Kool Quark
@koolquark

I am trying to render html from nitro ; how do we render following snippet ;

 <p>
   Dashboard
   <i class="right fas fa-angle-left"></i>
 </p>
#p{ body = [ #WhatElementGoesHere ..  , 
             RecordFor<i> 
           ] 
  }.

For <i> I can use

#element{html_tag = <<"i">> , class = <<"fas fa-angle-left">> body = <<"">> }
Kool Quark
@koolquark
Figured out that :
#p{ body = [ #literal{body = "Dashboard"},
             #element{html_tag = <<"i">> class = <<"fas fa-angle-left">> body = <<"">>}
           ] 
  }.
that should work
Namdak Tonpa
@5HT
Yes, #i, #b elements was removed due to var interference with local variables i, b in Elixir
class could be rewritten as class = ['fas', 'fa-angle-left'] which looks more bold
also body = []
it already has =[] as default so could be ommited
you can bring back those records by introducing them in this way:
-record(i, ?DEFAULT_BASE).
-record(b, ?DEFAULT_BASE).
after that you can write:
#'div'{ body = [ #b{ body = "Text"}, #i{body = "Text"} ]}
Kool Quark
@koolquark
Ok, class as list is better to read.
In nitro can we just update some attributes of element without replacing it . When we do nitro:update are we not replacing the element identified by the id.
?
Kool Quark
@koolquark

In my initial loaded index.htm I have

    <li class="nav-item">
       <a id="sbSRNew" href="#" class="nav-link active">
        <i class="far fa-circle nav-icon"></i>
        <p>New Request</p>
       </a>
    </li>

What I would like do is just update the postback for
element sbSRNew . Currently when I use nitro:update,
I think I have to construct the entire segment ie the full <a>
using nitro records. Is there any way to just update the postback
attribute only ? .

Namdak Tonpa
@5HT
The answer is no, when you need to update DOM with postback you usually replace full dom with its recursive reinitialization.
 nitro:update(sbSRNew, 
    #link{id="sbSRNew", href="#", class=['nav-link','active'],
          postback={mypost}, body = [#i{...},#p{...}]})
Namdak Tonpa
@5HT
But there is a possibility to deliver only postback, we need just to implement new nitro API or snippet.
basically you need to emit NITRO.event
-module(action_event).
-include_lib("nitro/include/nitro.hrl").
-include_lib("nitro/include/event.hrl").
-compile(export_all).
-define(B(E), nitro:to_binary(E)).

render_action(#event{source=undefined}) -> [];
render_action(#event{postback=Postback,actions=_A,source=Source,
                     target=Control,type=Type,delegate=D,validation=V}) ->
    E = ?B(Control),
    ValidationSource = [ S || S <- Source, not is_tuple(S) ],
    PostbackBin = wf_event:new(Postback, E, D, event, data(E,Source), ValidationSource, V),
    ["{var x=qi('",E,"'); x && x.addEventListener('",?B(Type),
     "',function (event){ event.preventDefault(); ",PostbackBin,"});};"].

data(E,SourceList) ->
    Type=fun(A) when is_atom(A)   -> [ "atom('",atom_to_list(A),"')" ];
            (A) when is_binary(A) -> [ "bin('",binary_to_list(A),"')" ];
                              (A) -> [ "string('",A,"')" ] end,
    list_to_binary(["[tuple(tuple(string('",E,"'),bin('detail')),[])",
        [ case S of {Id,Code} -> [ ",tuple(",Type(Id),",",Code,")" ];
                            _ -> [ ",tuple(",Type(S),",querySource('",?B(S),"'))" ]
          end || S <- SourceList ],"]"]).
This is postback delivery.
As you can see the only requirement is presence of DOM element in DOM tree