Exemplo n.º 1
0
	}

	goal, found := app.Goals[goalName]
	if !found {
		reactor.DefaultNotFoundScreenFactory(ctx)
	}

	return &XTerm{
		ctx:  ctx,
		goal: goal,
	}
}

var xtermView = brc.MustParseDisplayModel(`
<bs.Panel header="Exec Terminal Session">
	<div id="container" data-api-path="/test" htmlID="terminal-container"></div>
</bs.Panel>
`)

func (x *XTerm) render() {
	view := xtermView.DeepCopy()

	path := fmt.Sprintf("/api/v1.0/applications/%s/goals/%s/exec", x.goal.ApplicationName, x.goal.Name)

	view.SetElementAttribute("container", "data-api-path", path)

	x.ctx.UpdateScreen(&brc.DisplayUpdate{
		Model: WithNavigation(view, [][]string{
			{"Applications", "#/"},
			{x.goal.ApplicationName, fmt.Sprintf("#/apps/%s", x.goal.ApplicationName)},
			{x.goal.Name, fmt.Sprintf("#/apps/%s/%s", x.goal.ApplicationName, x.goal.Name)},
package reactor

import (
	"gitlab.netice9.com/dragan/go-reactor/core"
)

type DefaultNotFoundScreen struct {
	ctx ScreenContext
}

var defaultNotFoundScreenUI = core.MustParseDisplayModel(`
  <bs.PageHeader>Not Found <small>something went wrong</small></bs.PageHeader>
`)

func (d *DefaultNotFoundScreen) Mount() {
	d.ctx.UpdateScreen(&core.DisplayUpdate{Model: defaultNotFoundScreenUI})
}

func (d *DefaultNotFoundScreen) OnUserEvent(*core.UserEvent) {

}

func (d *DefaultNotFoundScreen) Unmount() {
}

func DefaultNotFoundScreenFactory(ctx ScreenContext) Screen {
	return &DefaultNotFoundScreen{ctx}
}
Exemplo n.º 3
0
	a.ctx.UpdateScreen(&brc.DisplayUpdate{
		Model: WithNavigation(view, [][]string{{"Applications", "#/"}, {a.app.Name, fmt.Sprintf("#/apps/%s", a.app.Name)}}),
	})
}

func (a *Application) Unmount() {
	a.app.RemoveListener("update", a.onUpdate)
	a.app.RemoveListener("terminated", a.onUpdate)
}

var goalRowUI = brc.MustParseDisplayModel(`
  <tr id="row">
    <td ><a id="goal_name" href="#" className="btn btn-default"/></td>
    <td id="goal_state" />
    <td id="goal_actions">
			<a id="goal_term_link" href="#" className="btn btn-default">XTerm</a>
		</td>
  </tr>
`)
var applicationUI = brc.MustParseDisplayModel(`
  <div>
    <bs.Panel id="app_panel" header="">
      <bs.Alert id="alert" bsStyle="danger"/>
      <dl>
        <dt>Main Goal</dt>
        <dd id="main_goal"></dd>
      </dl>
      <dl>
        <dt>Goals</dt>
        <dd>
Exemplo n.º 4
0
package ui

import (
	"fmt"

	"github.com/netice9/apparatchik/apparatchik/core"
	"gitlab.netice9.com/dragan/go-reactor"
	brc "gitlab.netice9.com/dragan/go-reactor/core"
)

var breadcrumbItemUI = brc.MustParseDisplayModel(`
	<bs.Breadcrumb.Item id="breadcrumb_item" href="#" />
`)

var navigationUI = brc.MustParseDisplayModel(`
  <div>
  	<bs.Navbar bool:fluid="true">
  		<bs.Navbar.Header>
  			<bs.Navbar.Brand>
  				<a href="#" className="navbar-brand">Apparatchik</a>
  			</bs.Navbar.Brand>
  		</bs.Navbar.Header>
  		<bs.Nav bool:pullRight="true">
  		 	<bs.NavItem href="#/add_application"><bs.Glyphicon glyph="plus"/></bs.NavItem>
  		 </bs.Nav>
  	</bs.Navbar>


  	<bs.Grid bool:fluid="true">
			<bs.Breadcrumb id="breadcrumb" />
			<bs.Row>
Exemplo n.º 5
0
var goalUI = brc.MustParseDisplayModel(`
	<div>
	  <bs.Panel id="goal_panel" header="CPU Stats">
			<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 450 130" width="100%" class="chart">
				<g transform="translate(10,20)">
					<path d="M28 0h3M28 100h3M31 100v3" strokeWidth="1px" stroke="#333"/>
					<path d="M31 0v100M31 100h400" strokeWidth="1px" stroke="#333"/>
					<polyline transform="translate(40,0)" id="cpu_line" fill="none" stroke="#0074d9" strokeWidth="1" points=""/>
					<g fontSize="8px" fontFamily="Georgia" fill="#333">
						<g textAnchor="end">
							<text id="max_cpu" x="26" y="2">100 %</text>
							<text x="26" y="102">0 %</text>
						</g>
					</g>
				</g>
			</svg>
		</bs.Panel>
		<bs.Panel id="goal_panel" header="Memory Stats">
			<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 450 130" width="100%" class="chart">
				<g transform="translate(10,20)">
				  <polyline transform="translate(40,0)" id="memory_line" fill="none" stroke="#0074d9" strokeWidth="1" points=""/>
					<path d="M28 0h3M28 100h3M31 100v3" strokeWidth="1px" stroke="#333"/>
					<path d="M31 0v100M31 100h400" strokeWidth="1px" stroke="#333"/>
					<g fontSize="8px" fontFamily="Georgia" fill="#333">
						<g textAnchor="end">
							<text id="max_memory" x="26" y="2">100 MB</text>
							<text x="26" y="102">0 MB</text>
						</g>
					</g>
				</g>
			</svg>
	  </bs.Panel>
		<bs.Panel id="output_panel" header="Output">
			<pre id="out" reportEvents="wheel:PD:X-deltaY" />
		</bs.Panel>
	</div>
`)