Discussion:
[devinfo] Mojo fun
John Crisp
2018-01-16 17:43:35 UTC
Permalink
Been messing about.

Just trying to create a simple page and have some dropdowns, boxes,
buttons etc and get some data from esmith DBs.

For progress see:

https://gist.github.com/reetp/62340525ee46bda71ce0360249eb71d2

Remember this real elementary stuff.....
_______________________________________________
Server Development Discussion
To unsubscribe, e-mail devinfo-***@lists.contribs.org
Searchable archive at https://lists.contribs.org/mailman/public/devinfo/
brian read
2018-01-16 19:54:05 UTC
Permalink
Hi John

Can you give me some clues as to how I run / test it?


Cheers Brian
Post by John Crisp
Been messing about.
Just trying to create a simple page and have some dropdowns, boxes,
buttons etc and get some data from esmith DBs.
https://gist.github.com/reetp/62340525ee46bda71ce0360249eb71d2
Remember this real elementary stuff.....
_______________________________________________
Server Development Discussion
Searchable archive at https://lists.contribs.org/mailman/public/devinfo/
John Crisp
2018-01-16 20:01:07 UTC
Permalink
Hi John
Can you give me some clues as to how I run / test it?
Ha - this is the blind leading the blind :-)

I ought to do something on the wiki I guess.

First make sure you have perl-Mojolicious installed - not sure which repo.

Next have somewhere you can stick cgi files eg ibay/cgi-bin

Next make sure any files in there are similar to this:

chown root:www *.cgi;chmod 0750 *.cgi;chmod u+s *.cgi

Then grab my crappy code off gist to test (I'll make sure the versions
on there actually work)

Run... play. Break lots...... bash your head against the wall with the
docs :-)

_______________________________________________
Server Development Discussion
To unsubscribe, e-mail devinfo-***@lists.contribs.org
Searchable archive at https://
brian read
2018-01-16 20:30:18 UTC
Permalink
Hi John

ok,

yum install perl-Mojolicious --enablerepo=fws

gets it.

then can access it by

http://<host fqdn>/cgi-bin/file.cgi

Got it!!

Will play...

Cheers Brian
Post by John Crisp
Post by brian read
Hi John
Can you give me some clues as to how I run / test it?
Ha - this is the blind leading the blind :-)
I ought to do something on the wiki I guess.
First make sure you have perl-Mojolicious installed - not sure which repo.
Next have somewhere you can stick cgi files eg ibay/cgi-bin
chown root:www *.cgi;chmod 0750 *.cgi;chmod u+s *.cgi
Then grab my crappy code off gist to test (I'll make sure the versions
on there actually work)
Run... play. Break lots...... bash your head against the wall with the
docs :-)
_______________________________________________
Server Development Discussion
Searchable archive at https://lists.contribs.org/mailman/public/devinfo/
John Crisp
2018-01-16 21:33:10 UTC
Permalink
Hi John
ok,
yum install perl-Mojolicious --enablerepo=fws
gets it.
then can access it by
http://<host fqdn>/cgi-bin/file.cgi
Got it!!
Oh cool.

Take a look at the gist for a few basic ideas. The docs are pretty good but miss some 'obvious' steps.

Stuff I struggled with for instance was passing an array to the 'select_field'.... and then they neglect to mention you need to wrap that in a form.... ! See my gist for that.

The gist will now do a call back but I'm not sure yet how to get the returned value. Tomorrows job !

I'll try a build a set of form objects as demos so you can display DB entries, modify, and return them.

My intention was to try and write a simple panel for my ipsec stuff. No idea if I can do that but I'm learning!! I'm no coder. Just an amateur hack :-)
Will play...
Let us know how you get along. If you have samples then please add them somewhere. If you have a git account I could set up a repo where we could store demo stuff. Let me know.

B. Rgds
John
--
Sent from my Android phone with K-9 Mail. Please excuse my brevity.
_______________________________________________
Server Development Discussion
To unsubscribe, e-mail devinfo-***@lists.contribs.org
Searchable archive at https://lists.contribs.org/mailman/publ
John Crisp
2018-01-17 11:40:33 UTC
Permalink
Git now shows a POST value :-)

Little steps....
_______________________________________________
Server Development Discussion
To unsubscribe, e-mail devinfo-***@lists.contribs.org
Searchable archive at https://lists.contribs.org/mailman/public/devinfo/
John Crisp
2018-01-17 14:13:58 UTC
Permalink
Post by John Crisp
Git now shows a POST value :-)
And now can return multiple form items....
_______________________________________________
Server Development Discussion
To unsubscribe, e-mail devinfo-***@lists.contribs.org
Searchable archive at https://lists.contribs.org/mailman/public/devinfo/
John Crisp
2018-01-17 16:39:59 UTC
Permalink
Ahhh, and now.... (drum roll)

Tony Keane built this a few years back using bootstrap/jquery

Just click to 'login'

https://www.reetspetit.com/KoozaliServerManager/koozali_test/main.html

I figured I could probably easily replicate that in Mojo

So..... it ain't big, it ain't clever, the colours were a 5 minute slap
together years back and nothing works as I haven't written any links yet
but...

Same thing in Mojo

https://home.reetspetit.net/testbay/cgi-bin/template.cgi

I added a couple of form elements in the main block as I was testing,
but you get the idea.

I'll try and build a bit more demo stuff.

Once you get it, it really is pretty easy.

Need to paste the code up someplace.

B. Rgds
John
_______________________________________________
Server Development Discussion
To unsubscribe, e-mail devinfo-***@lists.contribs.org
Searchable archive at https://lists.contribs.org/mailman/public/devinfo/
John Crisp
2018-01-17 17:03:00 UTC
Permalink
Damn... stuck on something

I have a 'main' template

That includes a '_content' section with

%= include '_content'


How do I make '_content' a variable like this ?

%= include $contentVar


_______________________________________________
Server Development Discussion
To unsubscribe, e-mail devinfo-***@lists.contribs.org
Searchable archive at https://lists.contribs.org/mailman/public/devinfo/
John Crisp
2018-01-17 23:14:34 UTC
Permalink
On 17 January 2018 23:28:17 CET, Charlie Brady
Post by John Crisp
How do I make '_content' a variable like this ?
%= include $contentVar
$c->stash(contentVar => 'foo');
in the controller.
So my line was right syntax and I just didn't stash the $var....

<slapshead>

I really must get my head round the template syntax...

http://mojolicious.org/perldoc/Mojo/Template#SYNTAX
But I suspect the reason that you are asking that question is because
you
Yes I had.... the link I pasted earlier

https://home.reetspetit.net/testbay/cgi-bin/template.cgi

uses two template pieces. So I can do that, but wanted to vary the
'action' pane/template whilst maintaining the 'main' framework.

So kind of:

@@ main.html.ep
%# code for header, side panel

%= include $contentVar

%# footer junk


@@ _userAaccounts.html.ep
%# some specific user account layout



So contentVar is a var so that when a user clicks say /useraccounts it
then runs

get 'useraccounts' => sub {
# blah some perly code to get accounts
$mojo->stash ( contentVar->_userAccounts );
}
$mojo->render( template => 'main' );


And that calls main template which includes 'useraccounts' template.

You then just need a bit of processing code for an action plus a piece
of template just for that content.

From memory... if that makes sense.... !!

I'll try and get it to work tomorrow & paste some code - easier to see then.
_______________________________________________
Server Development Discussion
To unsubscribe, e-mail devinfo-***@lists.contribs.org
Searchable archive at https://lists.contribs.org/mailman/public/devinfo/
John Crisp
2018-01-17 23:46:58 UTC
Permalink
Post by John Crisp
get 'useraccounts' => sub {
# blah some perly code to get accounts
$mojo->stash ( contentVar->_userAccounts );
$mojo->stash ( contentVar => "_userAccounts" );
You can use a bareword before =>, but not after.
OK...
Post by John Crisp
}
$mojo->render( template => 'main' );
$mojo->render(template => "_userAccounts");
$mojo->render();
} => "_userAccounts";
OK - I kind of get it - I'll see what I can do. Sure I am using a
primitive way of doing it and there are fancier ones, but I am no coder
so doing my KISS principle !

Let me see if I can put it together and paste accordingly.

Hopefully I can lay something out for others to look at and and get
ideas from.

Thanks for the pointers.
_______________________________________________
Server Development Discussion
To unsubscribe, e-mail devinfo-***@lists.contribs.org
Searchable archive at https://lists.contribs.org/mailman/public/devinfo/
John Crisp
2018-01-18 16:18:44 UTC
Permalink
Stuck again.....

My test.cgi file is here:

https://github.com/reetp/server-manager/blob/master/template.cgi

To get this to work (and you might need to check paths)

Clone the repo

Move the cgi file to the cgi-directory of the ibay

Make sure you set the perms for it like this

chown root:www *.cgi;chmod 0770 *.cgi;chmod u+s template.cgi

Run it with something like:

https://home.reetspetit.net/testbay/cgi-bin/template.cgi

Note it can be tricky to edit the cgi file due to perms.

Shout if you need a hand.

Where I am stuck is regenerating the page with returned values from the
form.

So I have my original test page:

https://home.reetspetit.net/testbay/cgi-bin/readtest1.cgi

Code is here:
https://github.com/reetp/server-manager/blob/master/readtest1.cgi

Select a few values and it returns them:

<form name="networks" action="./readtest1.cgi/agent" method="POST">

The returned values are out put with:

post '/agent' => sub {
$c->render( text => "Request.... blah");
};

Easy.

What I can't do is add a template fragment into my 'main' page code.

I can do it on the first 'pass' but when the form returns /result all I
get is an almost blank page with the result of the first dropdown.

This is a rough visualisation:
Loading Image...


Here are the important bits of code:


-----------------------------------------------------------------

get '/' => sub {
# Some stuff
$mojo->stash( contentVar => '_content' );
$mojo->render( template => 'main' );
};


post '/result' => sub {
# Some stuff - get the POST $vars and stash
$mojo->stash( contentVar => '_result' );

# here is where I am stuck
# it should render main with _result embedded in main. But it doesn't
# I think there may be something buffered or otherwise held in memory

$mojo->render( template => 'main' );
};


__DATA__


@@ _content.html.ep
<# Centre panel content - form and welcome
<# blah


@@ _result.html.ep
%# Centre panel content on form submit with results
%# blah

@@ main.html.ep
%# Index page content inc header, side panel etc

%# include the centre panel template content depending on the var set
%# This actually works on the first call to /
<%= include $contentVar %>


-----------------------------------------------------------------

I am sure I am missing something stupidly simple - I'm no guru after all.

Any help/suggestions welcome ! Keep it simple though... ;-)






_______________________________________________
Server Development Discussion
To unsubscribe, e-mail devinfo-***@lists.contribs.org
Searchable archive at https://lists.contribs.org/mailman/public/devinfo/
John Crisp
2018-01-18 21:46:03 UTC
Permalink
Don't bounce around your URL space when you don't need to. Keep things as
simple as possible.
Ok... (not that I would know a name space if it fell on me...)
_______________________________________________
Server Development Discussion
To unsubscribe, e-mail devinfo-***@lists.contribs.org
Searchable archive at https://lists.contribs.org/mailman/public/devinfo/
John Crisp
2018-01-18 21:55:16 UTC
Permalink
Next recommendation is to eliminate as many variables as possible. Forget
OK
Ah neat.
Now you can start submitting a request from the form, using, e.g.
company=germany -f pass=foo /agent 2>/dev/null
Request by Mojolicious (Perl) reached 127.0.0.1. <br />Form data is fish
OK
Now you don't have a very well formatted response, but it is a response
none-the-less.
I can see the value in debugging on the CLI - an option I hadn't gotten
too. That's perfectly readable (especially if you have a vague idea of
what you are expecting to see)

That's cool thanks. You can see I get and can display a response in
readtest1.cgi

Still unsure as to what happens with _result.html.ep in template.cgi

I'm sure my method is fatally flawed and I have missed a trick or five.
Seeing them is another matter......

Head down tomorrow for a bit more hacking about. I really ought to do
some paying work sometime ;-)

_______________________________________________
Server Development Discussion
To unsubscribe, e-mail devinfo-***@lists.contribs.org
Searchable archive at https://lists.contribs.org/mailman/public/devinfo/
John Crisp
2018-01-19 14:34:28 UTC
Permalink
Now you can start submitting a request from the form, using, e.g.
company=germany -f pass=foo /agent 2>/dev/null
Request by Mojolicious (Perl) reached 127.0.0.1. <br />Form data is fish
Now you don't have a very well formatted response, but it is a response
none-the-less.
[***@home cgi-bin]# perl template.cgi get -M POST -f networks=fish -f
company=germany -f pass=foo /
Unknown option: f
Unknown option: f
Unknown option: f
Problem loading URL "networks=fish". (Couldn't connect:
IO::Socket::INET: Bad hostname 'networks=fish')
Unknown command "pass=foo".


Missing options ?
_______________________________________________
Server Development Discussion
To unsubscribe, e-mail devinfo-***@lists.contribs.org
Searchable archive at https://lists.contribs.org/mailman/public/devinfo/
John Crisp
2018-01-19 19:52:03 UTC
Permalink
Sorry, I have no clue. What is in your template.cgi?
Same as the git files mentioned before.

https://github.com/reetp/server-manager/blob/master/template.cgi
https://github.com/reetp/server-manager/blob/master/readtest1.cgi


Also:

perl readtest1.cgi get -M POST -f networks=fish -f company=germany -f
pass=foo /

[***@home cgi-bin]# perl readtest1.cgi get -M POST -f networks=fish -f
company=germany -f pass=foo /
Unknown option: f
Unknown option: f
Unknown option: f
Problem loading URL "networks=fish". (Couldn't connect:
IO::Socket::INET: Bad hostname 'networks=fish')
Unknown command "pass=foo".


_______________________________________________
Server Development Discussion
To unsubscribe, e-mail devinfo-***@lists.contribs.org
Searchable archive at https://lists.contribs.org/mailman/public/devinfo/
brian read
2018-01-20 07:30:28 UTC
Permalink
Hi John

I've picked up the server -manager stuff, but am having trouble getting
into it sucessfully.

http://<hostname>/cgi-bin/server-manager/template.cgi

Gives me the sm menu tree, but does not pick up the css despite the fact
that I can see that ../server-manager/css/<whatever> is a valid path.

Suspect it might be permissions, can you post your complete tree with
permissions?


Cheers Brian
Post by John Crisp
Sorry, I have no clue. What is in your template.cgi?
Same as the git files mentioned before.
https://github.com/reetp/server-manager/blob/master/template.cgi
https://github.com/reetp/server-manager/blob/master/readtest1.cgi
perl readtest1.cgi get -M POST -f networks=fish -f company=germany -f
pass=foo /
company=germany -f pass=foo /
Unknown option: f
Unknown option: f
Unknown option: f
IO::Socket::INET: Bad hostname 'networks=fish')
Unknown command "pass=foo".
_______________________________________________
Server Development Discussion
Searchable archive at https://lists.contribs.org/mailman/public/devinfo/
John Crisp
2018-01-21 11:14:09 UTC
Permalink
Hi John
I've picked up the server -manager stuff, but am having trouble getting
into it sucessfully.
There is nothing much to get 'into' :-)

Should just have a few form items above the main panel content - see my
site. The form does not return properly as yet - working on that.
http://<hostname>/cgi-bin/server-manager/template.cgi
Gives me the sm menu tree, but does not pick up the css despite the fact
that I can see that ../server-manager/css/<whatever> is a valid path.
Suspect it might be permissions, can you post your complete tree with
permissions?
I just have an ibay

testbay

This has the usual

cgi-bin
html
files

I have a directory in html:

server-manager

And the html parts in there. Perms are set via the ibay panel, write
group, read everyone, public access Internet, execution of dynamic
content allowed

Perms are john:shared 0664 for files and 775 for dirs

If you go to the ibay and Save the settings you will have to go back to
the cgi-bin file and do:

chown root:www *.cgi;chmod 0770 *.cgi;chmod u+s *.cgi


You should be able to reach this from a browser:

https://my.server.net/testbay/server-manager/css/AdminLTE.css

(note I have https enabled - you may need to change that)


You will get non important this error - that's because this is an old
version of AdminLTE - I'll update it at some point.

dashboard.js:30 Uncaught TypeError: $(...).wysihtml5 is not a function
at HTMLDocument.<anonymous> (dashboard.js:30)
at j (jquery-2.1.1.min.js:2)
at Object.fireWith [as resolveWith] (jquery-2.1.1.min.js:2)
at Function.ready (jquery-2.1.1.min.js:2)
at HTMLDocument.I (jquery-2.1.1.min.js:2)
_______________________________________________
Server Development Discussion
To unsubscribe, e-mail devinfo-***@lists.contribs.org
Searchable archive at
brian read
2018-01-21 13:56:00 UTC
Permalink
Hi John

ok, the key is the server-manager folder in the html folder - I left it
in the cgi-bin

Ok, can see it all now - although how it works seems even more confusing!!


Cheers Brian
Post by John Crisp
Post by brian read
Hi John
I've picked up the server -manager stuff, but am having trouble getting
into it sucessfully.
There is nothing much to get 'into' :-)
Should just have a few form items above the main panel content - see my
site. The form does not return properly as yet - working on that.
Post by brian read
http://<hostname>/cgi-bin/server-manager/template.cgi
Gives me the sm menu tree, but does not pick up the css despite the fact
that I can see that ../server-manager/css/<whatever> is a valid path.
Suspect it might be permissions, can you post your complete tree with
permissions?
I just have an ibay
testbay
This has the usual
cgi-bin
html
files
server-manager
And the html parts in there. Perms are set via the ibay panel, write
group, read everyone, public access Internet, execution of dynamic
content allowed
Perms are john:shared 0664 for files and 775 for dirs
If you go to the ibay and Save the settings you will have to go back to
chown root:www *.cgi;chmod 0770 *.cgi;chmod u+s *.cgi
https://my.server.net/testbay/server-manager/css/AdminLTE.css
(note I have https enabled - you may need to change that)
You will get non important this error - that's because this is an old
version of AdminLTE - I'll update it at some point.
dashboard.js:30 Uncaught TypeError: $(...).wysihtml5 is not a function
at HTMLDocument.<anonymous> (dashboard.js:30)
at j (jquery-2.1.1.min.js:2)
at Object.fireWith [as resolveWith] (jquery-2.1.1.min.js:2)
at Function.ready (jquery-2.1.1.min.js:2)
at HTMLDocument.I (jquery-2.1.1.min.js:2)
_______________________________________________
Server Development Discussion
Searchable archive at https://lists.contribs.org/mailman/public/devinfo/
brian read
2018-01-21 13:59:43 UTC
Permalink
Hi John

https://my.server.net/testbay/server-manager/css/AdminLTE.css

this does nothing for me

link that works is

https://my.server.net/testbay/server-manager/main.html

But I am not seeing your "testing" bits.

Sorry to be so dense, but this is well outside anything I've done/used
before

Cheers Brian
Post by John Crisp
Post by brian read
Hi John
I've picked up the server -manager stuff, but am having trouble getting
into it sucessfully.
There is nothing much to get 'into' :-)
Should just have a few form items above the main panel content - see my
site. The form does not return properly as yet - working on that.
Post by brian read
http://<hostname>/cgi-bin/server-manager/template.cgi
Gives me the sm menu tree, but does not pick up the css despite the fact
that I can see that ../server-manager/css/<whatever> is a valid path.
Suspect it might be permissions, can you post your complete tree with
permissions?
I just have an ibay
testbay
This has the usual
cgi-bin
html
files
server-manager
And the html parts in there. Perms are set via the ibay panel, write
group, read everyone, public access Internet, execution of dynamic
content allowed
Perms are john:shared 0664 for files and 775 for dirs
If you go to the ibay and Save the settings you will have to go back to
chown root:www *.cgi;chmod 0770 *.cgi;chmod u+s *.cgi
https://my.server.net/testbay/server-manager/css/AdminLTE.css
(note I have https enabled - you may need to change that)
You will get non important this error - that's because this is an old
version of AdminLTE - I'll update it at some point.
dashboard.js:30 Uncaught TypeError: $(...).wysihtml5 is not a function
at HTMLDocument.<anonymous> (dashboard.js:30)
at j (jquery-2.1.1.min.js:2)
at Object.fireWith [as resolveWith] (jquery-2.1.1.min.js:2)
at Function.ready (jquery-2.1.1.min.js:2)
at HTMLDocument.I (jquery-2.1.1.min.js:2)
_______________________________________________
Server Development Discussion
Searchable archive at https://lists.contribs.org/mailman/public/devinfo/
John Crisp
2018-01-21 16:28:33 UTC
Permalink
Cool :-)

Read my code, read the docs and then ask away.
Post by brian read
Hi John
I've picked up the server -manager stuff, but am having trouble getting
into it sucessfully.
http://<hostname>/cgi-bin/server-manager/template.cgi
Gives me the sm menu tree, but does not pick up the css despite the fact
that I can see that ../server-manager/css/<whatever> is a valid path.
Suspect it might be permissions, can you post your complete tree with
permissions?
Cheers Brian
Post by John Crisp
Sorry, I have no clue. What is in your template.cgi?
Same as the git files mentioned before.
https://github.com/reetp/server-manager/blob/master/template.cgi
https://github.com/reetp/server-manager/blob/master/readtest1.cgi
perl readtest1.cgi get -M POST -f networks=fish -f company=germany -f
pass=foo /
-f
Post by John Crisp
company=germany -f pass=foo /
Unknown option: f
Unknown option: f
Unknown option: f
IO::Socket::INET: Bad hostname 'networks=fish')
Unknown command "pass=foo".
_______________________________________________
Server Development Discussion
Searchable archive at
https://lists.contribs.org/mailman/public/devinfo/
--
Sent from my Android phone with K-9 Mail. Please excuse my brevity.
John Crisp
2018-01-23 12:57:38 UTC
Permalink
Fixed it....

I had the $var names wrongng

To run it on the CLI for testing I did

perl template.cgi get -M POST / list=fish&pass=abc&country=uk

That showed me the error, and then I could debug it.

Try the template.cgi again - if you enter some values you get them returned

https://home.reetspetit.net/testbay/cgi-bin/template.cgi

I'll update git in a bit
_______________________________________________
Server Development Discussion
To unsubscribe, e-mail devinfo-***@lists.contribs.org
Searchable archive at https://lists.contribs.org/mailman/public/devinfo/
brian read
2018-01-23 13:07:15 UTC
Permalink
Excellent news.

Looking forward to paying with it again.

So - does the team think that we should re-create our existing server
manager in mojolicious? Giving us the extra flexibility to create new
pages, but with the same general look and feel.

Then perhaps we could work on a new look and feel later on.

Or do we try to do a complete re-write now?

I am certainly up for re-programming our existing interface in mojo... I
think (hope) it is not beyond my limited Perl skills now that john has
seen the general way forward.

My ability at designing look and feel is minimal but am happy to do what
someone else has designed.

Cheers Brian
Post by John Crisp
Fixed it....
I had the $var names wrongng
To run it on the CLI for testing I did
perl template.cgi get -M POST / list=fish&pass=abc&country=uk
That showed me the error, and then I could debug it.
Try the template.cgi again - if you enter some values you get them returned
https://home.reetspetit.net/testbay/cgi-bin/template.cgi
I'll update git in a bit
_______________________________________________
Server Development Discussion
Searchable archive at https://lists.contribs.org/mailman/public/devinfo/
John Crisp
2018-01-23 14:12:28 UTC
Permalink
Post by brian read
Excellent news.
That bit is, yes.
Post by brian read
Looking forward to paying with it again.
Cool.
Post by brian read
So - does the team think that we should re-create our existing server
manager in mojolicious? Giving us the extra flexibility to create new
pages, but with the same general look and feel.
I've just hit a new roadblock, and this is a biggy.

The issue is that the current panels have formmagick stuff actually
embedded in the code.

Think of the old html days before separation of code and style prior to css.

That means you can't just use/call an existing function. It won't just
give you pure data, but a load of formmagick layout code too.

The current server-manager 'API' is a mix of code and style.

It would need entirely unpicking, separating the code from the content.

What makes it even worse is the complete mix of style. Some files are
probably easier than others. useraccounts.pm includes quite a bit of
Formmagick code inline. Others have much less.
Post by brian read
Then perhaps we could work on a new look and feel later on.
Or do we try to do a complete re-write now?
I am certainly up for re-programming our existing interface in mojo...
Essentially look and feel isn't really an issue if we separate function
from style.

I had a look at Stefanos code last night and today and can see what he
was doing (though he was running his mojo script as a 'daemon' which I
do not think is required)

Essentially if the functions were rewritten with the style completely
stripped out, they could output to a Mojo template (using say
bootstrap/jquery as I have done), or just as a string of JSON data to
another frontend - eg cockpit or somesuch.

Really it is then a case of :

Get "called.pm?send me a template/send me some json using this data"

Do something
render->template
or
render->jsonstring

The call could come from 'anywhere/any app'. You could theoretically
drop in any frontend you wanted as long as the data was output in a
standard form.

(As an aside, language is another issue I'll happily forget about right
now !)
Post by brian read
I am certainly up for re-programming our existing interface in mojo... I
think (hope) it is not beyond my limited Perl skills now that john has
seen the general way forward.
My ability at designing look and feel is minimal but am happy to do what
someone else has designed.
As I have outlined, I think it really needs a rewrite of all the core
panel code. Have a look here to see the files that need modifying:

/usr/share/perl5/vendor_perl/esmith/FormMagick/Panel

Whether there is a quick/dirty/easy way of doing this I do not know -
the original files can be used as a template, in conjunction with
whatever is in /etc/e-smith/web/functions

The only GOOD news is there are not too many files !!!!

Whether I can figure out an interim way of doing something, or if you
just have to bite the bullet and rewrite entirely I don't as yet know.

I had a look at the WBL plugin code - that seems to be fairly well
separated between code and style and I might try and use that as the
basis for a test panel with my bootstrap/jquery stuff, just for the
shits & giggles :-)

Any comments or suggestions are welcome.... I may have missed some
important stuff, made some stupid assumptions, or just be plain wrong.

But I never claimed to be a coder.....

_______________________________________________
Server Development Discussion
To unsubscribe, e-mail devinfo-***@lists.contribs.org
Searchable archive at https://lists.contribs.org/mailman/public/devinfo/
brian read
2018-01-24 07:22:19 UTC
Permalink
Actually i never imagined that we could just drop in the current code, I
think each panel will need to be re-coded, hopefully using as much as
the current code as we can to extract the data. We can also examine the
html from the existing server manager  and reproduce that in the new
mojolicious template way.

There is also the issue of the framework html (the left hand sidebar)
which needs to have a structure which is also flexible so that we easily
add entries without any more serious coding (and programmatically from
eg a contribs rpm).

I seem to remember John mentioning xml.  We could structure a
description in xml and use that to create the html. Suggest having a
directory like /etc/cron.d where we can drop in extra bits of xml for
the optional bits.
Post by John Crisp
I've just hit a new roadblock, and this is a biggy.
The issue is that the current panels have formmagick stuff actually
embedded in the code.
Think of the old html days before separation of code and style prior to css.
That means you can't just use/call an existing function. It won't just
give you pure data, but a load of formmagick layout code too.
The current server-manager 'API' is a mix of code and style.
It would need entirely unpicking, separating the code from the content.
brian read
2018-01-24 07:24:48 UTC
Permalink
Although a past master at gold plating software in the past I think in
this case we ought to just get on and produce something that does the
job. My experience of this sort of "flexibility" is that is is hardly
ever actually used.

https://en.wikipedia.org/wiki/Gold_plating_(software_engineering)
Post by John Crisp
Essentially if the functions were rewritten with the style completely
stripped out, they could output to a Mojo template (using say
bootstrap/jquery as I have done), or just as a string of JSON data to
another frontend - eg cockpit or somesuch.
Stefano Zamboni
2018-01-23 14:28:08 UTC
Permalink
Post by brian read
Excellent news.
Looking forward to paying with it again.
So - does the team think that we should re-create our existing server
manager in mojolicious? Giving us the extra flexibility to create new
pages, but with the same general look and feel.
Then perhaps we could work on a new look and feel later on.
Or do we try to do a complete re-write now?
I am certainly up for re-programming our existing interface in mojo...
I think (hope) it is not beyond my limited Perl skills now that john
has seen the general way forward.
My ability at designing look and feel is minimal but am happy to do
what someone else has designed.
Cheers Brian
Brian, don't get me wrong but take some time to re read posts on this
list sent between the end of january and the beginning of february 2016

I'm abandoning SME, both on support/public side and on the dev one, but
I'll forward a mail I sent privately to the board an year ago with my
approach for the new SM using mojo, REST API ecc.. unfortunately no one
was interested..

if you search bugzilla using cockpit or mojo as search key you'll find
some interesting results.

Ciao
S.
John Crisp
2018-01-23 15:06:16 UTC
Permalink
Post by John Crisp
Fixed it....
Tidied some code and added a direct call to the networks DB just to demo.

https://home.reetspetit.net/testbay/cgi-bin/template.cgi

Code on git
_______________________________________________
Server Development Discussion
To unsubscribe, e-mail devinfo-***@lists.contribs.org
Searchable archive at https://lists.contribs.org/mailman/public/devinfo/
brian read
2018-01-24 07:27:36 UTC
Permalink
I still cannot understand why your paths in the template.cgi:

"../server-manager/js/jquery/jquery-2.1.1.min.js" (line 383) work for
you, whereas mine need:

"../../server-manager/js/jquery/jquery-2.1.1.min.js" in order to work.
Post by John Crisp
Post by John Crisp
Fixed it....
Tidied some code and added a direct call to the networks DB just to demo.
https://home.reetspetit.net/testbay/cgi-bin/template.cgi
Code on git
_______________________________________________
Server Development Discussion
Searchable archive at https://lists.contribs.org/mailman/public/devinfo/
Terry Fage
2018-01-18 04:44:59 UTC
Permalink
Careful, to much of this new stuff might catch on.. :-)

Bloody hell what would we do then?

So it appears you have foresaken the life of a castawy in the south
paciifc :-) hope you had a great time of it..just back from a couple of
weeks away..

Have to setup a test box and join in, at least on the suck it and see
side :-)
_______________________________________________
Server Development Discussion
To unsubscribe, e-mail devinfo-***@lists.contribs.org
Searchable archive at https://lists.contribs.org/mailman/public/devinfo/
John Crisp
2018-01-18 09:14:35 UTC
Permalink
Post by Terry Fage
Careful, to much of this new stuff might catch on.. :-)
Bloody hell what would we do then?
LOLs.... I just thought I'd have a tinker for my own purposes and it all went a but bandy :-)
Post by Terry Fage
So it appears you have foresaken the life of a castawy in the south
paciifc :-) hope you had a great time of it..just back from a couple of weeks away..
Yeah it's a bummer. Spent a week on a tiny island in Fiji. Next island to us was where they filmed Castaway.....

Horrible to get back to winter. I'm definitely designed to live in the tropics.
Post by Terry Fage
Have to setup a test box and join in, at least on the suck it and see side
Let me try and flesh out a bit more with some notes to try and explain. I'll try and do a bit more today.
--
Sent from my Android phone with K-9 Mail. Please excuse my brevity.
_______________________________________________
Server Development Discussion
To unsubscribe, e-mail devinfo-***@lists.contribs.org
Searchable archive at https://lists.contribs.org/mailman/public/devinfo/
John Crisp
2018-01-17 17:40:47 UTC
Permalink
Damn I broke it a bit. Will check later !!
Post by John Crisp
Ahhh, and now.... (drum roll)
Tony Keane built this a few years back using bootstrap/jquery
Just click to 'login'
https://www.reetspetit.com/KoozaliServerManager/koozali_test/main.html
I figured I could probably easily replicate that in Mojo
So..... it ain't big, it ain't clever, the colours were a 5 minute slap
together years back and nothing works as I haven't written any links yet
but...
Same thing in Mojo
https://home.reetspetit.net/testbay/cgi-bin/template.cgi
I added a couple of form elements in the main block as I was testing,
but you get the idea.
I'll try and build a bit more demo stuff.
Once you get it, it really is pretty easy.
Need to paste the code up someplace.
B. Rgds
John
_______________________________________________
Server Development Discussion
Searchable archive at
https://lists.contribs.org/mailman/public/devinfo/
--
Sent from my Android phone with K-9 Mail. Please excuse my brevity.
John Crisp
2018-01-17 18:45:08 UTC
Permalink
Post by John Crisp
Damn I broke it a bit. Will check later !!
Fixed again...

_______________________________________________
Server Development Discussion
To unsubscribe, e-mail devinfo-***@lists.contribs.org
Searchable archive at https://lists.contribs.org/mailman/public/devinfo/
John Crisp
2018-01-17 19:09:15 UTC
Permalink
For anyone interested, Tony buiilt the panel based on adminLTE

https://home.reetspetit.net/testbay/server-manager/AdminLTE-2.4.2/index2.html

He used the starter file and worked from there:

https://home.reetspetit.net/testbay/server-manager/AdminLTE-2.4.2/starter.html

Now I am no webby guru, nor perl, nor Mojo, but I can see the potential.

I'm going to try and build out a little more of the original code as a
demo and then see what happens.

_______________________________________________
Server Development Discussion
To unsubscribe, e-mail devinfo-***@lists.contribs.org
Searchable archive at https://lists.contribs.org/mailman/public/devinfo/
John Crisp
2018-01-17 22:25:20 UTC
Permalink
Thanks. Some bedtime reading.

Any thoughts on my 'include' issue?
--
Sent from my Android phone with K-9 Mail. Please excuse my brevity.
_______________________________________________
Server Development Discussion
To unsubscribe, e-mail devinfo-***@lists.contribs.org
Searchable archive at https://lists.contribs.org/mailman/public/devinfo/
John Crisp
2018-01-17 10:56:55 UTC
Permalink
OK,

I just had a thought.

A couple of years back Tony Keane (RIP mate) did some messing about with
bootstrap. I still have the old test code here:

https://www.reetspetit.com/KoozaliServerManager/koozali_test/

Just click to enter.

You can see that we added a load of links down the left. These are
generated from the 'main.html' file.

Each link (not sure if we did them all but you get the idea) points to a
cgi file which COULD be a Mojo cgi file.

So effectively there is a framework for the manager?

I'm going to try and see if I can take this concept forward a little -
basically I think you generate the initial index.html from a template,
and then each cgi file uses the same template layout with some
additional code for itself.

Yes, I think I know what I am talking about - I'll try some tests and
post some code later :-)

Any suggestions welcome....

_______________________________________________
Server Development Discussion
To unsubscribe, e-mail devinfo-***@lists.contribs.org
Searchable archive at https://lists.contribs.org/mailman/public/devinfo/
Loading...