// 节点登录推荐端口 Vue.component("node-login-suggest-ports", { data: function () { return { ports: [], availablePorts: [], autoSelected: false, isLoading: false } }, methods: { reload: function (host) { let that = this this.autoSelected = false this.isLoading = true Tea.action("/clusters/cluster/suggestLoginPorts") .params({ host: host }) .success(function (resp) { if (resp.data.availablePorts != null) { that.availablePorts = resp.data.availablePorts if (that.availablePorts.length > 0) { that.autoSelectPort(that.availablePorts[0]) that.autoSelected = true } } if (resp.data.ports != null) { that.ports = resp.data.ports if (that.ports.length > 0 && !that.autoSelected) { that.autoSelectPort(that.ports[0]) that.autoSelected = true } } }) .done(function () { that.isLoading = false }) .post() }, selectPort: function (port) { this.$emit("select", port) }, autoSelectPort: function (port) { this.$emit("auto-select", port) } }, template: ` 正在检查端口... 推荐端口:{{port}}     常用端口:{{port}} 常用端口有22等。 (可以点击要使用的端口) ` })