mirror of https://github.com/rancher/ui.git
41 lines
1.3 KiB
JavaScript
41 lines
1.3 KiB
JavaScript
import { later } from '@ember/runloop';
|
|
import { alias } from '@ember/object/computed';
|
|
import { inject as service } from '@ember/service';
|
|
import { get, computed } from '@ember/object';
|
|
import Controller, { inject as controller } from '@ember/controller';
|
|
|
|
export default Controller.extend({
|
|
modalService: service('modal'),
|
|
scope: service(),
|
|
k8s: service(),
|
|
|
|
projectController: controller('authenticated.project'),
|
|
tags: alias('projectController.tags'),
|
|
|
|
actions: {
|
|
dashboard() {
|
|
window.open(this.get('k8s.kubernetesDashboard'),'_blank');
|
|
},
|
|
|
|
kubectl(e) {
|
|
if (e.metaKey) {
|
|
let proj = this.get('scope.currentProject.id');
|
|
later(() => {
|
|
window.open(`//${window.location.host}/env/${proj}/infra/console?kubernetes=true&isPopup=true`, '_blank', "toolbars=0,width=900,height=700,left=200,top=200");
|
|
});
|
|
} else {
|
|
this.get('modalService').toggleModal('modal-kubectl');
|
|
}
|
|
},
|
|
|
|
kubeconfig() {
|
|
this.get('modalService').toggleModal('modal-kubeconfig');
|
|
},
|
|
},
|
|
|
|
currentClusterNodes: computed('model.nodes.@each.{capacity,allocatable,state}', function () {
|
|
const clusterId = get(this, 'scope.currentCluster.id');
|
|
return get(this, 'model.nodes').filter(n => n.clusterId === clusterId);
|
|
}),
|
|
});
|