Ejemplo n.º 1
0
Archivo: render.go Proyecto: hako/dry
//Render renders dry in the given screen
func Render(d *Dry, screen *ui.Screen, status *ui.StatusBar) {
	switch d.State.viewMode {
	case Main:
		{
			//after a refresh, sorting is needed
			d.dockerDaemon.Sort(d.State.SortMode)
			d.renderer.SortMode(d.State.SortMode)
			status.Render()
			screen.RenderLine(0, 0, `<right><white>`+time.Now().Format(`15:04:05`)+`</></right>`)
			screen.Render(1, d.renderer.Render())

			screen.RenderLineWithBackGround(0, screen.Height-1, keyMappings, ui.MenuBarBackgroundColor)
			d.State.changed = false
		}
	}

	screen.Flush()
}
Ejemplo n.º 2
0
//Render renders dry in the given screen
func Render(d *Dry, screen *ui.Screen, status *ui.StatusBar) {
	switch d.state.viewMode {
	case Main:
		{
			//after a refresh, sorting is needed
			d.dockerDaemon.Sort(d.state.SortMode)
			d.renderer.SortMode(d.state.SortMode)
			status.Render()
			screen.RenderLine(0, 0, `<right><white>`+time.Now().Format(`15:04:05`)+`</></right>`)
			screen.Render(1, d.renderer.Render())
			screen.RenderLine(0, screenDescriptionIndex,
				fmt.Sprintf(
					"<b><blue>Containers: </><yellow>%d</></>", d.dockerDaemon.ContainersCount()))

			screen.RenderLineWithBackGround(0, screen.Height-1, keyMappings, ui.MenuBarBackgroundColor)
			d.state.changed = false
		}
	case Images:
		{
			status.Render()
			screen.RenderLine(0, 0, `<right><white>`+time.Now().Format(`15:04:05`)+`</></right>`)
			d.dockerDaemon.SortImages(d.state.SortImagesMode)

			screen.Render(1,
				appui.NewDockerImagesRenderer(d.dockerDaemon, screen.Height, screen.Cursor, d.state.SortImagesMode).Render())
			screen.RenderLine(0, screenDescriptionIndex,
				fmt.Sprintf(
					"<b><blue>Images: </><yellow>%d</></>", d.dockerDaemon.ImagesCount()))
			screen.RenderLineWithBackGround(0, screen.Height-1, imagesKeyMappings, ui.MenuBarBackgroundColor)
			d.state.changed = false
		}
	case Networks:
		{
			status.Render()
			screen.RenderLine(0, 0, `<right><white>`+time.Now().Format(`15:04:05`)+`</></right>`)

			screen.Render(1,
				appui.NewDockerNetworksRenderer(d.dockerDaemon, screen.Height, screen.Cursor, d.state.SortNetworksMode).Render())
			screen.RenderLine(0, screenDescriptionIndex,
				fmt.Sprintf(
					"<b><blue>Networks: </><yellow>%d</></>", d.dockerDaemon.NetworksCount()))
			screen.RenderLineWithBackGround(0, screen.Height-1, networkKeyMappings, ui.MenuBarBackgroundColor)
			d.state.changed = false
		}

	}

	screen.Flush()
}