Coder Social home page Coder Social logo

gowut's People

Contributors

bl4cksunltd avatar icza avatar s00500 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gowut's Issues

Private method in RadioGroup

// RadioGroup interface defines the group for grouping radio buttons.
type RadioGroup interface {
	// Name returns the name of the radio group.
	Name() string

	// Selected returns the selected radio button of the group.
	Selected() RadioButton

	// PrevSelected returns the radio button that was selected
	// before the current selected radio button.
	PrevSelected() RadioButton

	// setSelected sets the selected radio button of the group,
	// and before that sets the current selected as the prev selected
	setSelected(selected RadioButton)
}

In the file [state_buttons.go]

Hi,
Could you tell me why you didn't put your method in public? Is it a deliberate choice or a mistake?
Thx for your good job !

Synchronous call of XMLHttpRequest is not good

Warning in the browser console:

[Deprecation] Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/.

gowut-v1.3.0.js:244 :

xhr.open("GET", _pathSessCheck, false); // synch call (else we can't catch connection error)

Maybe there is an option to make the call asynchronous to avoid problems with the browser hang when the connection is lost during a call?

listbox.go deselect error.

When deselecting all items from a listbox using ctrl+click, the last item deselected remains active despite no longer being highlighted on the list. This can be demonstrated by going to https://gowut-demo.appspot.com/show and clicking the "ListBox" link on the left, then using ctrl+click to select and deselect items on the list. sum=? will always equal the last item deselected.

go get issue

Hi,

i get this error:

go get -u github.com/icza/gowut
package github.com/icza/gowut
    imports github.com/icza/gowut: no buildable Go source files in /Users/geri/Work/gopath

Adding element has no effect on Panel

After creating a panel and setting it to LayoutNatural, I wanted to add components inside of it. However, I ran into an issue when adding the elements. The first one, which is another panel, got added correctly. The second one however, a link, seems to get skipped when the page is rendered. The page structure goes something like this:

window := gwu.NewWindow("window", "title")
window.SetLayout(gwu.LayoutNatural)

windowPanel := gwu.NewPanel()
windowPanel.SetLayout(gwu.LayoutNatural)

mainPanel := gwu.NewPanel()
mainPanel.SetLayout(gwu.LayoutNatural)
// add things into mainPanel
windowPanel.Add(mainPanel)

confirm := gwu.NewLink("confirm", "url")
windowPanel.Add(confirm)

window.Add(windowPanel)

gowutServer := gwu.NewServer("test", "localhost:8081")
gowutServer.SetText("Test app")
gowutServer.AddWin(window)
gowutServer.Start("window")

The affected panel is windowPanel. The confirm link that should get added doesn't appear on the page nor on the html itself. However, adding a link element manually where it should be using dev tools works as expected.

Is there something wrong with how I add the link to the panel, or is this a bug?
Thank you.

can not panic() program

What steps will reproduce the problem?

b := gwu.NewButton("QUIT")
b.AddEHandlerFunc(func(e gwu.Event) {
  panic("try to show goroutines and quit")
}, gwu.ETYPE_CLICK)

What is the expected output? What do you see instead?
I wish there is a method to let me quit program when button pressed

What version of the product are you using? On what operating system?

go 1.1
gowut 6cc150b5189d

Please provide any additional information below.

Original issue reported on code.google.com by [email protected] on 7 Jun 2013 at 8:30

Session cookie seems to ignore server's port, which causes issues when a user opens multiple applications from the same host in the same browser

I have two applications running on a backend server. They open their gowut servers on different ports (same IP/hostname). I open a browser and connect to the first app and authenticate, everything is ok. Starting a second browser instance/tab and authenticating to the second application stops the first browser session from working. There are no errors, and re-authenticating fixes it but breaks the other session.
However if I use a different browser to connect to the second application, everything works as expected and both applications work as intended.

Expose http.Request via Event

Brainstorming. Consider exposing the http.Request associated with the processing of the Event.

It could be useful for informational purposes such as getting client's IP.

Consider not adding it to the Event interface, so users won't "overuse" it, but document that the dynamic type of Events may have a method something like GetRequest() which could be called after a type assertion.

console logging

Fantastic lib, thank you!

Some of the logging goes directly to the default log implementation, like this:
(

log.Println("Starting GUI server on:", appURL)
)

I define server's logger so I can control the output. the log.Println just goes where it wants.

Also, there is a bunch of debug logging not possible to turn off :
here

s.logger.Println("\tEvent from comp:", id, " event:", etype)

and here

s.logger.Println("\tRendering comp:", id)

need some help

Im expanding on the login demo.

  1. I have a remote sso service which i call and it returns a token. I need to store that token as a cookie. Any pointers on how to add a cookie to the domain?
  2. Once authorized, I present the user with a set of external links. Now when the user clicks the external link, I need to send above token as a cookie to the external link. How do i achieve this?

Add SetWindowNotFoundHandler similarly SetAppRootHandler in server

In server.go in serveHTTP there is a code:

	if win == nil {
		// Invalid window name, render an error message with a link to the window list
		w.Header().Set("Content-Type", "text/html; charset=utf-8")
		w.WriteHeader(http.StatusNotFound)
		NewWriter(w).Writess("<html><body>Window for name <b>'", winName, `'</b> not found. See the <a href="`, s.appPath, `">Window list</a>.</body></html>`)
		return
	}

Please make an opportunity to appoint the handler for formation of the page of a nonexistent window.

Disable Components While Their Event is Processed

For long running actions, it would be helpful to have a built-in way to disable components while their event is processed. For example, currently the user could press a button multiple times while the first long running action is happening creating successive events using the same selections on the GUI.

I have used the following workaround for a button (which can be extended for other components/paradigms):

Use a timer to continually call MarkDirty() on the button, then on the button click event run a long running action in a goroutine (which will return immediately). Calls to SetEnabled() within the goroutine will be updated as quickly as the timer repeats..

Event handler (ETypeFocus) for panel never actives when tabPanel selects the panel

I have a Panel in a TabPanel that I want to update went the panel becomes visible. The can occur if its TabPanel's tab is clicked on or when SetSelected() is called. Whenever either of these occur I want to update the panel. Using an event handler for ETypeFocus seems like the correct way to go but does not work. Looking at the code I believe that SetSelected() in TabPanel.go should include code to activate such a handler if present but it does not currently do so.

If this is the correct direction, I'd be happy to put together a pull request.

Why is "text" hardcoded in a text box?

Less a bug than a feature request.
If instead of choosing between "text" and "password" at render time these were 
set at "type" attributes (c.SetAttr("type", "text"), for example), then the 
user could over-ride the text box to, say "number".  It also shrinks the code 
quite a bit.
I don't have a full implementation of this change, but I have tested it and 
could flesh it out to submit a patch if you approve of the direction.


Original issue reported on code.google.com by [email protected] on 6 Jan 2014 at 11:59

Calling NewServer with a 0.0.0.0 IP results in gowut attempting to open a browser to 0.0.0.0, which predictably fails

Code example:

this.gwuSvr = gwu.NewServer("guitest", "0.0.0.0:3434")
this.gwuSvr.AddSessCreatorName("login", "Login Window")
this.gwuSvr.AddSHandler(MySessHandler{this, nil})
this.gwuSvr.Start("login")

When Start is called, gowut opens a browser page to the ip and port that were specified in NewServer. In this case, it attempts (and fails) to connect to 0.0.0.0, because that isn't a real IP that can be connected to, it's just a way of saying "listen on all interfaces instead of just one."

File upload mechanisms

Hello

There is no 'native' gowut way to upload a document. There are work-arounds that I have thought of, but they are not too elegant.
Any chance a native file upload widget might be added?

Thanks,
Glen

Forcing component refresh/update without using timer

Hi dev team,
I am developing a simple monitoring dashboard which updates the values every minute using golang thicker. I would like to know how to refresh/update the gwu component when the thicker is about to execute like below sample code:
ticker := time.NewTicker(time.Second * 60)
go func() {
for t := range ticker.C {
log.Println(t)
serverCheck() //retrieve values somewhere and set gwu components values
//missing line that should update the gwu component in the browser to current value
}
}()

I know I can do this using gwu.NewTimer and call e.MarkDirty(...). But I instead opt to use golang thicker so that there is no delays when updating the components.
Can you please suggest, thanks!

Expander inquiry

Hi Dev team,
Thanks for this wonderful golang project.
I am currently developing a simple dashboard using this project.
However, part of the code needs to loop through objects.
I used Expander and set the content as Table.
My concern is that, I want to access the Expander content(table) and be able to loop through its components (cells). How can I do that? What is the reverse of Expander.setContent()?
I am new to golang in general.
Can you provide a simple code to achieve this? Thanks alot! :)

-Cris

nil pointer dereference in gwu.Table.Clear()

If a table is constructed without all cells being populated, it will display fine, but the lack of cell contents causes a nil pointer dereference when performing a Clear() operation at table.go+169

Wrapping that line in an if c2 != nil {} solves the problem for me, but I don't know if that's the proper way to address the issue.

OWASP 10 Security issues

OWASP 10 https://www.owasp.org/index.php/Category:OWASP_Top_Ten_Project "The OWASP Top Ten represents a broad consensus about what the most critical web application security flaws are."

I applied a tool that tests for OWASP 10 vulnerabilities: https://www.owasp.org/index.php/OWASP_Zed_Attack_Proxy_Project

It found a couple, mostly medium level. They involve some headers not being set:

  • "X-Frame-Options header is not included in the HTTP response to protect against 'ClickJacking' attacks."
  • "Web Browser XSS Protection is not enabled, or is disabled by the configuration of the 'X-XSS-Protection' HTTP response header on the web server"
  • "The Anti-MIME-Sniffing header X-Content-Type-Options was not set to 'nosniff'. This allows older versions of Internet Explorer and Chrome to perform MIME-sniffing on the response body, potentially causing the response body to be interpreted and displayed as a content type other than the declared content type. Current (early 2014) and legacy versions of Firefox will use the declared content type (if one is set), rather than performing MIME-sniffing."

Is there any chance the gowut.Server interface could allow setting the underlying http.Response.Header? i.e. setting one or more headers that are sent with every response?

The report for the tool is here: https://drive.google.com/file/d/0B9uNae3afGInUnI2VEI3aENVZEk/view?usp=sharing

Local pdf embedding issues

Hi,
I decided to use Gowut for a simple UI I have to make that needs to display a pdf and some input fields, with the goal of refreshing the pdf after changes have been applied.
However, using the gwu.NewHTML method with both object and embed tags, my local pdf never gets loaded. Here is what I tried:

path, err := os.Getwd()
if err != nil {
    log.Fatal(err)
}
gwu.NewHTML("<object data=\"file:///" + path + "/public/out.pdf\" type=\"application/pdf\">")
gwu.NewHTML("<embed src=\"file:///" + path + "/public/out.pdf\" type=\"application/pdf\">")

Both elements appear in the source html, but not on the page. Only when I replace the file link with a pdf uploaded online does everything work, and yet the pdf file is accessible on my computer at the exact location in the tags, since if I open that location in my browser it shows up just fine.

For some additional context, this program will only be ran on windows machines.

Is this a problem with Gowut, or am I getting my html wrong? Any help would be appreciated.
Thank you.

Add limited <canvas> support

Feature request:
1. add canvas component that supports rendering image or svg.

To learn Go, I am porting a python utility based on matplotlib to Go. 
Matplotlib provides browser-based rendering backend using a canvas element.  
http://matplotlib.org/users/whats_new.html#backends And, I was attracted to 
Gowut as a way to create the UI with Go.

The issue I encountered with reloading the current gowut image component within 
a gowut page is that there was obvious blinking as the image was removed and 
reloaded.  Drawing to a canvas element could avoid this.

Would adding minimal support for a canvas component to Gowut that allows 
drawing images be welcome?

If you do not have time to make this change, but think it would be a good idea, 
can you recommend how to approach it within the Gowut framework?  I'd be happy 
to give it a "go".

Thank you.

Original issue reported on code.google.com by [email protected] on 6 Mar 2014 at 5:04

Custom path handler for OAuth2 auth flow?

I'd like to use OAuth2 Authentication Flow (esp. OpenID Connect) for user authentication.
It needs a redirect URL to handle the token exchange.
Either Server should expose a Handle(http.Handler) function (become a Muxer), or expose its ServeHTTP method (become a http.Handler).

How to update contents of a listbox

Is there a way to amend the contents of a listbox during an event called from the same page?
I'd like a refresh button that would rebuild the contents of a listbox based on the current values in a slice on the server.
I can do this with a textbox using tb.SetText(var) followed by marking the tb as dirty but cant work out how to do this for a list box.

I've managed to achieve this by doing a .Remove(listbox) then creating a new listbox with the new values, adding it to the parent container then marking the parent container dirty. I could do this as the parent container was a table, but not sure how you would reinsert it into the middle of a normal panel? Adding a SetContents(slice) as a listbox method would make things a lot simpler.

IE 6 show javascript errors and some behavior can not work

What steps will reproduce the problem?
1. Use IE 6 to try login_demo
2. for example, when press login, sometimes, it can not login
3. after login, the google picture layout is wrong.

What is the expected output? What do you see instead?


What version of the product are you using? On what operating system?


Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 7 Jun 2013 at 7:03

DatePicker and Menu

Am new for Golang and find this as an extraordinary product. We are planning to use Gowut for our product. Will you continue this further and provide more widgets (Datepicker and Menu very importantly) and keep this upgraded to Golang versions? Please share your views.

Calling MarkDirty from a goroutine doesn't have any effect

I'm currently trying to write an Event Handler function such that after the event has triggered and a fixed time period has passed, some code is executed and the affected part of the page is refreshed. Therefore, I tried to use time.AfterFunc() inside the event handler, like so:

var timer *time.Timer
textBox := gwu.NewTextBox("")
textBox.AddSyncOnETypes(gwu.ETypeKeyUp)
textBox.AddEHandlerFunc(func(e gwu.Event) {
    if timer != nil {
        if !timer.Stop() {
            <-timer.C
        }
        timer = nil
    }
    timer = time.AfterFunc(3*time.Second, func() {
        // some code affecting a panel
        e.MarkDirty(panel)
        timer = nil
    })
}, gwu.ETypeKeyUp)

I checked already that the afterfunc is correctly called after the defined time period using some logs. However, the components are never updated.

This code, that doesn't use the afterfunc call, works:

textBox := gwu.NewTextBox("")
textBox.AddSyncOnETypes(gwu.ETypeKeyUp)
textBox.AddEHandlerFunc(func(e gwu.Event) {
    // some code affecting a panel
    e.MarkDirty(panel)
}, gwu.ETypeKeyUp)

Which led me to suspect the fact that time.AfterFunc() calls the code in its own goroutine.
Is it possible to call MarkDirty() and update components from a goroutine? If not, is there any other way to delay component updates?

Thank you.

Expander.Content() wrong implementation

What steps will reproduce the problem?
func (c *expanderImpl) Content() Comp {
    return c.header
}

What version of the product are you using? On what operating system?
go 1.1.2 for windows/amd64

Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 7 Nov 2013 at 7:19

net/http: invalid byte 'Ã' in Cookie.Path; dropping invalid bytes

For path (window name) with accent:

2016/11/27 09:13:52 Starting GUI server on: http://localhost:8081/Számlázó/
[szamlazo] 2016/11/27 09:13:52 Starting GUI server on: http://localhost:8081/Számlázó/
[szamlazo] 2016/11/27 09:13:52 Incoming: /Számlázó/
[szamlazo] 2016/11/27 09:13:52  Rendering windows list.
[szamlazo] 2016/11/27 09:14:02 Incoming: /Számlázó/main
[szamlazo] 2016/11/27 09:14:18 Incoming: /Számlázó/login
2016/11/27 09:14:18 SESSION created: AaeLFcMlzZ2cle4mGK0Bh0
[szamlazo] 2016/11/27 09:14:18 SESSION created: AaeLFcMlzZ2cle4mGK0Bh0
2016/11/27 09:14:18 net/http: invalid byte 'Ã' in Cookie.Path; dropping invalid bytes

So it seems that that path is used as-is in cookie path - it should be escaped!

Mutual SSL Authentication

Is there any plans to implement mutual authentication such that the gowut server can be configures to request or require client certificate?

fatal error: concurrent map writes

Hello,

I get the above panic when I try and mark two things dirty at nearly the same time. I can fix the above myself by changing my program but I think it would be good for you to implement a locking system if at all possible to prevent this.

Thank you!

make images undraggable

strImgCl = []byte(`">`) // `">`

Hi,
i'm annoyed with dragable images,
is it good idea to make images undraggable ?
strImgCl = []byte(`" draggable="false">`)

If not, just close issue and sorry for noise.

Regards

Can Session closing generate an event?

I use sessions in my application. However, when the session expires, the gui is unresponsive. I would like to update/replace the gui contents when the session expires with a button that says something like "Start again", which starts a new session and presents the starting state of the gui. I have tried a number of things but have not been able to do this.

As the Session.Removed(gwu.Session) does not expose any functions of use (those in Event like Event.ReloadWin(string)) I don't see how I can do this...

Thanks,
Glen

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.