`)
func www_box_ng() ([]byte, error) {
return _www_box_ng, nil
}
var _www_index_html = []byte(`
`)
func www_index_html() ([]byte, error) {
return _www_index_html, nil
}
var _www_k8s_style_css = []byte(`.logo {
background: url('titlelogo.svg');
background-repeat: no-repeat;
height: 150px;
width: 600px;
}
.navbar-logo {
margin-left: 10px;
margin-top: 5px;
}
.title {
color: #fff;
font-size: 14pt;
height: 20px;
padding-top: 10px;
padding-left: 10px;
width: 1024px;
}
#nav-logo-img {
height: 42px;
}
.spread {
width: 1024px;
}
.content {
margin-left: 20px;
margin-top: 10px;
}
.bar {
background: #DFE7FA;
padding: 10px;
}
.navbar {
background-color: #447AE8;
border: 0px;
border-radius: 0;
}
.link {
color: #22F;
cursor: pointer;
text-decoration: underline;
}
.k8s-title-font {
font-family: 'Ubuntu Mono', arial, sans-serif;
font-size: 14pt;
}
.k8s-font-medium {
font-size: 18pt;
}
.k8s-font-regular {
font-size: 12pt;
}
.k8s-box {
background: #CCC;
border: 1px solid darkgray;
padding: 10px;
width: 90%;
margin-left: 5%;
}
.k8s-item {
background: #DDD;
border: 1px solid whitesmoke;
padding: 10px;
width: 200px;
}
.k8s-list {
background: #DDD;
border: 1px solid whitesmoke;
padding: 10px;
width: 90%;
}
.k8s-inline {
display: inline-block;
}
.k8s-button {
border: 1px solid black;
background: lightgray;
cursor: pointer;
padding: 2px 4px 2px 4px;
}
.k8s-odd {
background: #EEE;
}
.k8s-even {
background: #DDD;
}
.k8s-cell {
padding: 10px;
}`)
func www_k8s_style_css() ([]byte, error) {
return _www_k8s_style_css, nil
}
var _www_logotext_svg = []byte(`
`)
func www_logotext_svg() ([]byte, error) {
return _www_logotext_svg, nil
}
var _www_partials_groups_html = []byte(`
`)
func www_partials_groups_html() ([]byte, error) {
return _www_partials_groups_html, nil
}
var _www_partials_pod_html = []byte(`
{{pod.id}}
{{pod.currentState.status}} on
{{pod.currentState.host}}
Created: {{pod.creationTimestamp}}
Pod Networking : {{pod.currentState.podIP}}
:{{port.containerPort}}
Host Networking
{{pod.currentState.hostIP}}
:{{port.hostPort}}
Containers:
Name Image Restarts
{{container.name}}
{{container.image}}
{{pod.currentState.info[container.name].restartCount}}
`)
func www_partials_pod_html() ([]byte, error) {
return _www_partials_pod_html, nil
}
var _www_podcontroller_js = []byte(`/**
Copyright 2014 Google Inc. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
var k8sApp = angular.module('k8s', ['ngRoute']);
function PodController() {}
var apiBase = '/api/v1beta1/';
PodController.prototype.handlePod = function(podId) {
this.scope.loading = true;
this.http.get(apiBase + "pods/" + podId)
.success(angular.bind(this, function(data) {
this.scope.pod = data;
this.scope.loading = false;
}))
.error(angular.bind(this, this.handleError));
};
/**
* Generic AJAX error handler. Dumps info to console.
*/
PodController.prototype.handleError = function(data, status, headers, config) {
console.log("Error (" + status + "): " + data);
this.scope_.loading = false;
};
k8sApp.controller('PodCtrl', function ($scope, $http, $routeParams) {
$scope.controller = new PodController();
$scope.controller.http = $http;
$scope.controller.scope = $scope;
$scope.controller.handlePod($routeParams.podId);
});
function GroupController() {}
GroupController.prototype.resetGroupLayout = function(group) {
delete group.settings;
};
GroupController.prototype.handlePath = function(path) {
var parts = path.split("/")
// split leaves an empty string at the beginning.
parts = parts.slice(1);
if (parts.length == 0) {
return;
}
this.handleGroups(parts.slice(1));
};
GroupController.prototype.clearSelector = function(grouping) {
window.location.hash = "/groups/" + grouping + "/selector/";
};
GroupController.prototype.createBarrier = function(count, callback) {
var barrier = count;
var barrierFunction = angular.bind(this, function(data) {
// JavaScript is single threaded so this is safe.
barrier--;
if (barrier == 0) {
if (callback) {
callback();
}
}
});
return barrierFunction;
};
GroupController.prototype.handleGroups = function(parts, selector) {
this.groupBy = parts;
this.scope.loading = true;
this.scope.selector = selector;
var args = [];
var type = "";
if (selector && selector.length > 0) {
this.scope.selectorPieces = selector.split(",");
var labels = [];
var fields = [];
for (var i = 0; i < this.scope.selectorPieces.length; i++) {
var piece = this.scope.selectorPieces[i];
if (piece[0] == '$') {
fields.push(piece.slice(2));
} else {
if (piece.indexOf("type=") == 0) {
var labelParts = piece.split("=");
if (labelParts.length > 1) {
type = labelParts[1];
}
} else {
labels.push(piece);
}
}
}
if (labels.length > 0) {
args.push("labels=" + encodeURI(labels.join(",")));
}
if (fields.length > 0) {
args.push("fields=" + encodeURI(fields.join(",")));
}
}
var query = "?" + args.join("&");
var list = [];
var count = type.length > 0 ? 1 : 3;
var barrier = this.createBarrier(count, angular.bind(this, function() {
this.scope.groups = this.groupData(list, 0);
this.scope.loading = false;
}));
if (type == "" || type == "pod") {
this.http.get(apiBase + "pods" + query)
.success(angular.bind(this, function(data) {
this.addLabel("type", "pod", data.items);
for (var i = 0; data.items && i < data.items.length; ++i) {
data.items[i].labels["host"] = data.items[i].currentState.host;
list.push(data.items[i]);
}
barrier();
}))
.error(angular.bind(this, this.handleError));
}
if (type == "" || type == "service") {
this.http.get(apiBase + "services" + query)
.success(angular.bind(this, function(data) {
this.addLabel("type", "service", data.items);
for (var i = 0; data.items && i < data.items.length; ++i) {
list.push(data.items[i]);
}
barrier();
}))
.error(angular.bind(this, this.handleError));
}
if (type == "" || type == "replicationController") {
this.http.get(apiBase + "replicationControllers" + query)
.success(angular.bind(this, function(data) {
this.addLabel("type", "replicationController", data.items);
for (var i = 0; data.items && i < data.items.length; ++i) {
list.push(data.items[i]);
}
barrier();
}))
.error(angular.bind(this, this.handleError));
}
};
GroupController.prototype.addLabel = function(key, value, items) {
if (!items) {
return;
}
for (var i = 0; i < items.length; i++) {
if (!items[i].labels) {
items[i].labels = []
}
items[i].labels[key] = value;
}
};
GroupController.prototype.groupData = function(items, index) {
var result = {
"items": {},
"kind": "grouping"
};
for (var i = 0; i < items.length; i++) {
key = items[i].labels[this.groupBy[index]];
if (!key) {
key = "";
}
list = result.items[key];
if (!list) {
list = [];
result.items[key] = list;
}
list.push(items[i]);
}
if (index + 1 < this.groupBy.length) {
for (var key in result.items) {
result.items[key] = this.groupData(result.items[key], index + 1);
}
}
return result;
};
/**
* Generic AJAX error handler. Dumps info to console.
*/
GroupController.prototype.handleError = function(data, status, headers, config) {
console.log("Error (" + status + "): " + data);
this.scope.loading = false;
};
k8sApp.controller('GroupCtrl', function ($scope, $http, $route, $routeParams) {
$scope.controller = new GroupController();
$scope.controller.http = $http;
$scope.controller.scope = $scope;
$scope.controller.route = $route;
$scope.controller.routeParams = $routeParams;
var groups = $routeParams.grouping;
if (!groups) {
groups = "";
}
$scope.controller.handleGroups(groups.split("/"), $routeParams.selector);
});
k8sApp.config(['$routeProvider',
function($routeProvider) {
$routeProvider.
when('/groups/:grouping*?\/selector/:selector*?', {
templateUrl: 'partials/groups.html',
controller: 'GroupCtrl'
}).
when('/pods/:podId', {
templateUrl: 'partials/pod.html',
controller: 'PodCtrl'
}).
otherwise({
redirectTo: '/groups//selector/'
});
}]);
`)
func www_podcontroller_js() ([]byte, error) {
return _www_podcontroller_js, nil
}
var _www_titlelogo_svg = []byte(`
image/svg+xml `)
func www_titlelogo_svg() ([]byte, error) {
return _www_titlelogo_svg, nil
}
// Asset loads and returns the asset for the given name.
// It returns an error if the asset could not be found or
// could not be loaded.
func Asset(name string) ([]byte, error) {
cannonicalName := strings.Replace(name, "\\", "/", -1)
if f, ok := _bindata[cannonicalName]; ok {
return f()
}
return nil, fmt.Errorf("Asset %s not found", name)
}
// AssetNames returns the names of the assets.
func AssetNames() []string {
names := make([]string, 0, len(_bindata))
for name := range _bindata {
names = append(names, name)
}
return names
}
// _bindata is a table, holding each asset generator, mapped to its name.
var _bindata = map[string]func() ([]byte, error){
"www/box.ng": www_box_ng,
"www/index.html": www_index_html,
"www/k8s-style.css": www_k8s_style_css,
"www/logotext.svg": www_logotext_svg,
"www/partials/groups.html": www_partials_groups_html,
"www/partials/pod.html": www_partials_pod_html,
"www/podcontroller.js": www_podcontroller_js,
"www/titlelogo.svg": www_titlelogo_svg,
}
// AssetDir returns the file names below a certain
// directory embedded in the file by go-bindata.
// For example if you run go-bindata on data/... and data contains the
// following hierarchy:
// data/
// foo.txt
// img/
// a.png
// b.png
// then AssetDir("data") would return []string{"foo.txt", "img"}
// AssetDir("data/img") would return []string{"a.png", "b.png"}
// AssetDir("foo.txt") and AssetDir("notexist") would return an error
// AssetDir("") will return []string{"data"}.
func AssetDir(name string) ([]string, error) {
node := _bintree
if len(name) != 0 {
cannonicalName := strings.Replace(name, "\\", "/", -1)
pathList := strings.Split(cannonicalName, "/")
for _, p := range pathList {
node = node.Children[p]
if node == nil {
return nil, fmt.Errorf("Asset %s not found", name)
}
}
}
if node.Func != nil {
return nil, fmt.Errorf("Asset %s not found", name)
}
rv := make([]string, 0, len(node.Children))
for name := range node.Children {
rv = append(rv, name)
}
return rv, nil
}
type _bintree_t struct {
Func func() ([]byte, error)
Children map[string]*_bintree_t
}
var _bintree = &_bintree_t{nil, map[string]*_bintree_t{
"www": {nil, map[string]*_bintree_t{
"box.ng": {www_box_ng, map[string]*_bintree_t{}},
"index.html": {www_index_html, map[string]*_bintree_t{}},
"k8s-style.css": {www_k8s_style_css, map[string]*_bintree_t{}},
"logotext.svg": {www_logotext_svg, map[string]*_bintree_t{}},
"partials": {nil, map[string]*_bintree_t{
"groups.html": {www_partials_groups_html, map[string]*_bintree_t{}},
"pod.html": {www_partials_pod_html, map[string]*_bintree_t{}},
}},
"podcontroller.js": {www_podcontroller_js, map[string]*_bintree_t{}},
"titlelogo.svg": {www_titlelogo_svg, map[string]*_bintree_t{}},
}},
}}