Skip to content
This repository has been archived by the owner on Feb 25, 2023. It is now read-only.

Commit

Permalink
Merge branch 'develop' into ingress_layout
Browse files Browse the repository at this point in the history
  • Loading branch information
mattkasun authored Sep 27, 2021
2 parents 402fb2d + 81edd7a commit 6fcb53e
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 26 deletions.
7 changes: 7 additions & 0 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM golang:1.17.1
WORKDIR /
COPY *.go go.* ./
RUN GOOS=linux go build -v .
ADD /images/* images/
ADD /html/* html/
CMD ["./netmaker-gui"]
1 change: 1 addition & 0 deletions html/extclient.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@

{{define "ExtClientDetails"}}
<button class="w3-block w3-white w3-left-align" onclick="openClient('{{.ClientID}}');">{{.ClientID}} @ {{.Network}}</button>

<div id="client{{.ClientID}}" class="w3-container w3-hide">
<p><label>IP </label><input type=disabled placeholder="{{.Address}}"></p>
<p><label>Public Key </label><input type=disabled placeholder="{{.PublicKey}}"></p>
Expand Down
3 changes: 3 additions & 0 deletions html/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ <h3>©2021 Matthew R Kasun</h3>
<a href='mailto://mkasun@nusak.ca?subject=netmaker-gui'>mkasun@nusak.ca</a><br>
<a href='https://github.com/mattkasun/netmaker-gui' target='_blank'>github.com/mattkasun/netmaker-gui</a>
<br><br>

<h4>Version</h4>
<h5>Netmaker Backend: {{.Version.Backend}} Netmaker-Gui: {{.Version.Mine}}</h5>
<button class="w3-button w3-teal w3-block w3-padding" onclick="document.getElementById('About').style.display='none'">Close</button>
</div>
</div>
Expand Down
12 changes: 5 additions & 7 deletions html/networks.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,10 @@
<div id="Networks" class="btn-group w3-white tab" style="display=none">
<div class="net All">
{{range .Networks}}
<form action="/refreshkeys/{{.NetID}}" method="GET" style="display:inline">
<p><button class="w3-bar-item" onclick="event.preventDefault();setNetwork('{{.NetID}}');"> {{.DisplayName}} {{.AddressRange}}</button>
<button title="Refresh Keys" class="w3-bar-item w3-button w3-circle w3-white"><span class="material-icons">autorenew</span></button>
</form></p>
{{ end }}
<p><button class="w3-bar-item" onclick="expand('net{{.NetID}}');"> {{.DisplayName}} {{.AddressRange}}</button>
</div>

{{ range .Networks }}
<fieldset class="net {{.NetID}}">
<fieldset class="net {{.NetID}}" id=net{{.NetID}}>
<legend>{{.NetID}}</legend>
<button class="w3-circle w3-green" type="submit">{{.DisplayName}}</button><br>
<label>{{.AddressRange}}<br>
Expand All @@ -29,6 +24,9 @@
<input type="hidden" name="network" value='{{.NetID}}'>
<button class="w3-button" type="submit">Delete</button><br>
</form>
<form action="/refreshkeys/{{.NetID}}" method="GET" style="display:inline">
<button title="Refresh Keys" class="w3-bar-item w3-button w3-circle w3-white"><span class="material-icons">autorenew</span></button>
</form></p>
</fieldset>
{{ end }}
</div>
Expand Down
34 changes: 18 additions & 16 deletions html/nodes.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,12 @@
<div id="Nodes" class="btn-group w3-white tab" style="display=none">
<div class="net All">
{{range .Nodes}}
<p><button id="node{{.MacAddress}}" class="w3-lightgrey" onclick="setNetwork('{{.Network}}');">{{.Name}} {{.Endpoint}} {{.Address}}</button></p>
{{if eq .IsEgressGateway "yes" }}
<button class="w3-bar-item w3-circle w3-white" title="Remove Egress Gateway" onclick="removeEgress('{{.MacAddress}}', '{{.Network}}');"><span class="material-icons">highlight_off</span></button>
{{ else }}
<form action="/create_egress/{{.Network}}/{{.MacAddress}}" Method="POST" style="display:inline">
<button class="w3-bar-item w3-circle w3-white" title="Create Egress Gateway"><span class="material-icons">router</span></button>
</form>
{{end}}
{{if eq .IsIngressGateway "yes"}}
<button class="w3-bar-item w3-circle w3-white" title="Remove Ingress Gateway" onclick="removeIngress('{{.MacAddress}}', '{{.Network}}');"><span class="material-icons">highlight_off</span></button>
{{ else }}
<button class="w3-bar-item w3-circle w3-white" title="Create Ingress Gateway" onclick="addIngress('{{.MacAddress}}', '{{.Network}}');"><span class="material-icons">highlight_off</span></button>
{{end}}
{{end}}
<p><button id="node{{.MacAddress}}" class="w3-lightgrey" onclick="expand('node{{.MacAddress}}');">{{.Name}} {{.Endpoint}} {{.Address}}</button></p>
</div>
{{range .Nodes}}
<fieldset class="net {{.Network}}">



<fieldset class="net {{.Network}}" id='node{{.MacAddress}}'>
<legend>{{.Name }}</legend>
<form action="/edit_node" method=POST>
<input type=hidden name="network" value='{{.Network}}'>
Expand All @@ -35,6 +24,19 @@
<input type=hidden name="mac" value='{{.MacAddress}}'>
<button type=submit class="w3-button" onclick="alert('Are you sure you want to delete node {{.Name}} from Network {{.Network}}?')" >Delete</button>
</form>
{{if eq .IsEgressGateway "yes" }}
<button class="w3-bar-item w3-circle w3-white" title="Remove Egress Gateway" onclick="removeEgress('{{.MacAddress}}', '{{.Network}}');"><span class="material-icons">highlight_off</span></button>
{{ else }}
<form action="/create_egress/{{.Network}}/{{.MacAddress}}" Method="POST" style="display:inline">
<button class="w3-bar-item w3-circle w3-white" title="Create Egress Gateway"><span class="material-icons">router</span></button>
</form>
{{end}}
{{if eq .IsIngressGateway "yes"}}
<button class="w3-bar-item w3-circle w3-white" title="Remove Ingress Gateway" onclick="removeIngress('{{.MacAddress}}', '{{.Network}}');"><span class="material-icons">highlight_off</span></button>
{{ else }}
<button class="w3-bar-item w3-circle w3-white" title="Create Ingress Gateway" onclick="addIngress('{{.MacAddress}}', '{{.Network}}');"><span class="material-icons">highlight_off</span></button>
{{end}}

</fieldset>
{{end}}
</div>
Expand Down
4 changes: 2 additions & 2 deletions html/script.html
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,8 @@
xHttp.send();
}

function openClient(client) {
var x = document.getElementById('client'+client);
function expand(div) {
var x = document.getElementById(div);
if (x.className.indexOf("w3-show") == -1) {
x.className = x.className.replace(" w3-hide", " w3-show");
{{/*x.className += " w3-show";*/}}
Expand Down
10 changes: 9 additions & 1 deletion types.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
controller "github.com/gravitl/netmaker/controllers"
"github.com/gravitl/netmaker/functions"
"github.com/gravitl/netmaker/models"
"github.com/gravitl/netmaker/servercfg"
)

type NodeStatus struct {
Expand All @@ -16,6 +17,11 @@ type NodeStatus struct {
Color string
}

type Version struct {
Backend string
Mine string
}

//PageData -contains data for html template
type PageData struct {
Page string
Expand All @@ -25,6 +31,7 @@ type PageData struct {
Nodes []models.Node
Users []models.ReturnUser
ExtClients []models.ExtClient
Version Version
}

//Initializes (fetches) page data from backend
Expand Down Expand Up @@ -84,7 +91,8 @@ func (data *PageData) Init(page string, c *gin.Context) {
data.ExtClients = clients
}
}

data.Version.Backend = servercfg.GetVersion()
data.Version.Mine = "v0.1.0"
}

func GetAllExtClients() []models.ExtClient {
Expand Down

0 comments on commit 6fcb53e

Please sign in to comment.