mirror of https://github.com/rancher/ui.git
Kubectl tab
This commit is contained in:
parent
67ddccaabc
commit
81a99dea66
|
|
@ -1,5 +1,5 @@
|
||||||
{{#if model.length}}
|
{{#if model.length}}
|
||||||
<table class="table fixed no-lines r-mb0">
|
<table class="grid fixed no-lines r-mb0">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Container Name</th>
|
<th>Container Name</th>
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{{#if expanded}}
|
{{#if expanded}}
|
||||||
<tr>
|
<tr class="nohover">
|
||||||
<td colspan="6" class="subtable">
|
<td colspan="6" class="subtable">
|
||||||
{{k8s/container-section model=model.displayContainers}}
|
{{k8s/container-section model=model.displayContainers}}
|
||||||
</td>
|
</td>
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,13 @@
|
||||||
import Ember from 'ember';
|
import Ember from 'ember';
|
||||||
|
|
||||||
|
const DEFAULT_COMMAND = ["/bin/sh","-c",'TERM=xterm-256color; export TERM; [ -x /bin/bash ] && ([ -x /usr/bin/script ] && /usr/bin/script -q -c "/bin/bash" /dev/null || exec /bin/bash) || exec /bin/sh'];
|
||||||
|
|
||||||
export default Ember.Component.extend({
|
export default Ember.Component.extend({
|
||||||
originalModel: null,
|
originalModel: null,
|
||||||
instance: Ember.computed.alias('originalModel'),
|
instance: Ember.computed.alias('originalModel'),
|
||||||
|
command: null, // defaults to DEFAULT_COMMAND
|
||||||
|
showHeader: true,
|
||||||
|
showClose: true,
|
||||||
|
|
||||||
status: 'Connecting...',
|
status: 'Connecting...',
|
||||||
socket: null,
|
socket: null,
|
||||||
|
|
@ -28,7 +33,7 @@ export default Ember.Component.extend({
|
||||||
attachStdin: true,
|
attachStdin: true,
|
||||||
attachStdout: true,
|
attachStdout: true,
|
||||||
tty: true,
|
tty: true,
|
||||||
command: ["/bin/sh","-c",'TERM=xterm-256color; export TERM; [ -x /bin/bash ] && ([ -x /usr/bin/script ] && /usr/bin/script -q -c "/bin/bash" /dev/null || exec /bin/bash) || exec /bin/sh'],
|
command: this.get('command') || DEFAULT_COMMAND,
|
||||||
};
|
};
|
||||||
|
|
||||||
instance.doAction('execute',opt).then((exec) => {
|
instance.doAction('execute',opt).then((exec) => {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,13 @@
|
||||||
|
{{#if showHeader}}
|
||||||
<h2><i class="icon icon-terminal"></i> Shell: {{instance.displayName}}</h2>
|
<h2><i class="icon icon-terminal"></i> Shell: {{instance.displayName}}</h2>
|
||||||
|
{{else}}
|
||||||
|
{{yield}}
|
||||||
|
{{/if}}
|
||||||
<div class="shell-body clearfix">
|
<div class="shell-body clearfix">
|
||||||
</div>
|
</div>
|
||||||
<div class="footer-actions">
|
<div class="footer-actions">
|
||||||
<div class="console-status text-muted">{{status}}</div>
|
<div class="console-status text-muted">{{status}}</div>
|
||||||
|
{{#if showClose}}
|
||||||
<button {{action "cancel"}} class="btn btn-primary">Close</button>
|
<button {{action "cancel"}} class="btn btn-primary">Close</button>
|
||||||
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,11 @@ export default Ember.Component.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
show(node) {
|
show(node) {
|
||||||
|
if ( this._state === 'destroying' )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var svc = this.get('tooltipService');
|
var svc = this.get('tooltipService');
|
||||||
|
|
||||||
this.set('showTimer', null);
|
this.set('showTimer', null);
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,38 @@
|
||||||
|
import Ember from 'ember';
|
||||||
|
import C from 'ui/utils/constants';
|
||||||
|
|
||||||
|
export default Ember.Route.extend({
|
||||||
|
k8s: Ember.inject.service(),
|
||||||
|
|
||||||
|
model() {
|
||||||
|
return this.get('store').findAll('container').then((containers) => {
|
||||||
|
let inst = null;
|
||||||
|
for ( let i = 0 ; i < containers.get('length') ; i++)
|
||||||
|
{
|
||||||
|
let container = containers.objectAt(i);
|
||||||
|
if ( container.get('state') !== 'running' )
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
var labels = container.get('labels')||{};
|
||||||
|
if ( labels[C.LABEL.K8S_KUBECTL]+'' === 'true' )
|
||||||
|
{
|
||||||
|
inst = container;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( inst )
|
||||||
|
{
|
||||||
|
return Ember.Object.create({
|
||||||
|
instance: inst,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return Ember.RSVP.reject('Unable to find an active kubectld container');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
<section class="header">
|
||||||
|
<h1 style="display: block">kubectl</h1>
|
||||||
|
<p class="help-block">Use this shell to directly execute <code>kubectl</code> commands.</p>
|
||||||
|
</section>
|
||||||
|
<div class="r-m20">
|
||||||
|
{{modal-shell
|
||||||
|
originalModel=model.instance
|
||||||
|
showHeader=false
|
||||||
|
showClose=false
|
||||||
|
}}
|
||||||
|
</div>
|
||||||
|
|
@ -14,11 +14,11 @@
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
<ul class="nav nav-tabs nav-tabs-well shadowed">
|
<ul class="nav nav-tabs nav-tabs-well">
|
||||||
<li role="presentation" class="tab" data-section="containers" {{action "selectTab" "containers" target="view"}}><a href="#">Containers</a></li>
|
<li role="presentation" class="tab" data-section="containers" {{action "selectTab" "containers" target="view"}}><a href="#">Containers</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<div class="horizontal-form well">
|
<div class="horizontal-form well nav-well">
|
||||||
<div class="section container-fluid" data-section="containers">
|
<div class="section container-fluid" data-section="containers">
|
||||||
{{k8s/container-section model=model.displayContainers}}
|
{{k8s/container-section model=model.displayContainers}}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
import Ember from 'ember';
|
||||||
|
import SelectTab from 'ui/mixins/select-tab';
|
||||||
|
|
||||||
|
export default Ember.View.extend(SelectTab, {
|
||||||
|
didInsertElement() {
|
||||||
|
this.send('selectTab', 'containers');
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
import Ember from 'ember';
|
||||||
|
import SelectTab from 'ui/mixins/select-tab';
|
||||||
|
|
||||||
|
export default Ember.View.extend(SelectTab, {
|
||||||
|
didInsertElement() {
|
||||||
|
this.send('selectTab', 'pods');
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
@ -33,13 +33,13 @@
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
<ul class="nav nav-tabs nav-tabs-well shadowed">
|
<ul class="nav nav-tabs nav-tabs-well">
|
||||||
<li role="presentation" class="tab" data-section="pods" {{action "selectTab" "pods" target="view"}}><a href="#">Pods</a></li>
|
<li role="presentation" class="tab" data-section="pods" {{action "selectTab" "pods" target="view"}}><a href="#">Pods</a></li>
|
||||||
<li role="presentation" class="tab" data-section="labels" {{action "selectTab" "labels" target="view"}}><a href="#">Labels</a></li>
|
<li role="presentation" class="tab" data-section="labels" {{action "selectTab" "labels" target="view"}}><a href="#">Labels</a></li>
|
||||||
<li role="presentation" class="tab" data-section="ports" {{action "selectTab" "ports" target="view"}}><a href="#">Ports</a></li>
|
<li role="presentation" class="tab" data-section="ports" {{action "selectTab" "ports" target="view"}}><a href="#">Ports</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<div class="horizontal-form well">
|
<div class="horizontal-form well nav-well">
|
||||||
<div class="section container-fluid" data-section="pods">
|
<div class="section container-fluid" data-section="pods">
|
||||||
{{k8s/pod-section model=model.selectedPods}}
|
{{k8s/pod-section model=model.selectedPods}}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -145,6 +145,7 @@ Router.map(function() {
|
||||||
this.route('index', {path: '/'});
|
this.route('index', {path: '/'});
|
||||||
|
|
||||||
this.route('apply', {path: '/apply'});
|
this.route('apply', {path: '/apply'});
|
||||||
|
this.route('kubectl', {path: '/kubectl'});
|
||||||
|
|
||||||
this.route('namespaces', {path: '/namespaces'}, function() {
|
this.route('namespaces', {path: '/namespaces'}, function() {
|
||||||
this.route('index', {path: '/'});
|
this.route('index', {path: '/'});
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
{{#link-to "k8s-tab.namespace.services" namespace.id}}<i class="icon icon-compass"></i>Services{{/link-to}}
|
{{#link-to "k8s-tab.namespace.services" namespace.id}}<i class="icon icon-compass"></i>Services{{/link-to}}
|
||||||
{{#link-to "k8s-tab.namespace.rcs" namespace.id}}<i class="icon icon-tachometer"></i>RCs{{/link-to}}
|
{{#link-to "k8s-tab.namespace.rcs" namespace.id}}<i class="icon icon-tachometer"></i>RCs{{/link-to}}
|
||||||
{{#link-to "k8s-tab.namespace.pods" namespace.id}}<i class="icon icon-containers"></i>Pods{{/link-to}}
|
{{#link-to "k8s-tab.namespace.pods" namespace.id}}<i class="icon icon-containers"></i>Pods{{/link-to}}
|
||||||
|
{{#link-to "k8s-tab.kubectl"}}<i class="icon icon-terminal"></i>kubectl{{/link-to}}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue