コード例 #1
0
ファイル: main.go プロジェクト: odewahn/carina-gui
func getSelectedCluster(table ui.Table) (libcarina.Cluster, bool) {
	var out libcarina.Cluster
	found := false
	c := table.Selected()
	table.Lock()
	d := table.Data().(*[]libcarina.Cluster)
	newC := *d
	table.Unlock()
	if c > -1 {
		out = newC[c]
		found = true
	}
	return out, found
}
コード例 #2
0
ファイル: main.go プロジェクト: odewahn/swarm-gui-example
func updateTable(table ui.Table) {
	for {
		running := ps()
		table.Lock()
		d := table.Data().(*[]Container)
		*d = running
		table.Unlock()
		time.Sleep(1 * time.Second)
	}
}
コード例 #3
0
ファイル: main.go プロジェクト: odewahn/carina-gui
// monitor the carina client
func monitorClusterList(t ui.Table) {
	for {
		clusters, _ := carinaClient.List()
		t.Lock()
		d := t.Data().(*[]libcarina.Cluster)
		*d = clusters
		t.Unlock()
		time.Sleep(5 * time.Second)
	}
}