Beispiel #1
0
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
}
Beispiel #2
0
func updateTable(table ui.Table) {
	for {
		running := ps()
		table.Lock()
		d := table.Data().(*[]Container)
		*d = running
		table.Unlock()
		time.Sleep(1 * time.Second)
	}
}
Beispiel #3
0
// 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)
	}
}