Skip to content
This repository was archived by the owner on Jan 20, 2021. It is now read-only.

Commit 4ec92d1

Browse files
authored
Fixing cks instance view (#832)
* Fixing instance view * Chaning from ip to ssh port * Fixing html tags in text * Adding messages to kube actions * Removing redundant code
1 parent 01eeb9b commit 4ec92d1

5 files changed

Lines changed: 35 additions & 40 deletions

File tree

src/config/section/compute.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,7 @@ export default {
432432
api: 'startKubernetesCluster',
433433
icon: 'caret-right',
434434
label: 'label.kubernetes.cluster.start',
435+
message: 'message.kubernetes.cluster.start',
435436
docHelp: 'plugins/cloudstack-kubernetes-service.html#starting-a-stopped-kubernetes-cluster',
436437
dataView: true,
437438
show: (record) => { return ['Stopped'].includes(record.state) }
@@ -440,6 +441,7 @@ export default {
440441
api: 'stopKubernetesCluster',
441442
icon: 'poweroff',
442443
label: 'label.kubernetes.cluster.stop',
444+
message: 'message.kubernetes.cluster.stop',
443445
docHelp: 'plugins/cloudstack-kubernetes-service.html#stopping-kubernetes-cluster',
444446
dataView: true,
445447
show: (record) => { return !['Stopped', 'Destroyed', 'Destroying'].includes(record.state) }
@@ -448,6 +450,7 @@ export default {
448450
api: 'scaleKubernetesCluster',
449451
icon: 'swap',
450452
label: 'label.kubernetes.cluster.scale',
453+
message: 'message.kubernetes.cluster.scale',
451454
docHelp: 'plugins/cloudstack-kubernetes-service.html#scaling-kubernetes-cluster',
452455
dataView: true,
453456
show: (record) => { return ['Created', 'Running'].includes(record.state) },
@@ -458,6 +461,7 @@ export default {
458461
api: 'upgradeKubernetesCluster',
459462
icon: 'plus-circle',
460463
label: 'label.kubernetes.cluster.upgrade',
464+
message: 'message.kubernetes.cluster.upgrade',
461465
docHelp: 'plugins/cloudstack-kubernetes-service.html#upgrading-kubernetes-cluster',
462466
dataView: true,
463467
show: (record) => { return ['Created', 'Running'].includes(record.state) },
@@ -468,6 +472,7 @@ export default {
468472
api: 'deleteKubernetesCluster',
469473
icon: 'delete',
470474
label: 'label.kubernetes.cluster.delete',
475+
message: 'message.kubernetes.cluster.delete',
471476
docHelp: 'plugins/cloudstack-kubernetes-service.html#deleting-kubernetes-cluster',
472477
dataView: true,
473478
show: (record) => { return !['Destroyed', 'Destroying'].includes(record.state) }

src/locales/en.json

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -793,8 +793,8 @@
793793
"label.done": "Done",
794794
"label.double.quotes.are.not.allowed": "Double quotes are not allowed",
795795
"label.download": "Download",
796-
"label.download.kubeconfig.cluster": "Download kubeconfig for the cluster <br><br> The <code>kubectl</code> command-line tool uses kubeconfig files to find the information it needs to choose a cluster and communicate with the API server of a cluster.",
797-
"label.download.kubectl": "Download <code>kubectl</code> tool for cluster's Kubernetes version",
796+
"label.download.kubeconfig.cluster": "Download kubeconfig for the cluster <br><br> The <code><b>kubectl</b></code> command-line tool uses kubeconfig files to find the information it needs to choose a cluster and communicate with the API server of a cluster.",
797+
"label.download.kubectl": "Download <code><b>kubectl</b></code> tool for cluster's Kubernetes version",
798798
"label.download.kubernetes.cluster.config": "Download Kubernetes cluster config",
799799
"label.download.progress": "Download Progress",
800800
"label.dpd": "Dead Peer Detection",
@@ -1966,6 +1966,7 @@
19661966
"label.srx.firewall": "Juniper SRX Firewall",
19671967
"label.ssh.key.pair.details": "SSH Key Pair Details",
19681968
"label.ssh.key.pairs": "SSH Key Pairs",
1969+
"label.ssh.port": "SSH Port",
19691970
"label.sshkeypair": "New SSH Key Pair",
19701971
"label.sshkeypairs": "SSH keypairs",
19711972
"label.sslcertificates": "SSL Certificates",
@@ -2147,7 +2148,7 @@
21472148
"label.usageinterface": "Usage Interface",
21482149
"label.usagename": "Usage Type",
21492150
"label.usageunit": "Unit",
2150-
"label.use.kubectl.access.cluster": "Use <code>kubectl</code> and <code>kubeconfig</code> file to access cluster",
2151+
"label.use.kubectl.access.cluster": "<code><b>kubectl</b></code> and <code><b>kubeconfig</b></code> file to access cluster",
21512152
"label.use.vm.ip": "Use VM IP:",
21522153
"label.use.vm.ips": "Use VM IPs",
21532154
"label.used": "Used",
@@ -2891,6 +2892,11 @@
28912892
"message.iso.desc": "Disc image containing data or bootable media for OS",
28922893
"message.join.project": "You have now joined a project. Please switch to Project view to see the project.",
28932894
"message.kubeconfig.cluster.not.available": "Kubernetes cluster kubeconfig not available currently",
2895+
"message.kubernetes.cluster.delete": "Please confirm that you want to destroy the cluster",
2896+
"message.kubernetes.cluster.scale": "Please select desired cluster configuration",
2897+
"message.kubernetes.cluster.start": "Please confirm that you want to start the cluster",
2898+
"message.kubernetes.cluster.stop": "Please confirm that you want to stop the cluster",
2899+
"message.kubernetes.cluster.upgrade": "Please select new kubernetes version",
28942900
"message.launch.vm.on.private.network": "Do you wish to launch your instance on your own private dedicated network?",
28952901
"message.launch.zone": "Zone is ready to launch; please proceed to the next step.",
28962902
"message.launch.zone.description": "Zone is ready to launch; please proceed to the next step.",

src/views/compute/KubernetesServiceTab.vue

Lines changed: 13 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -40,23 +40,21 @@
4040
<a-card :title="$t('label.using.cli')" :loading="this.versionLoading">
4141
<a-timeline>
4242
<a-timeline-item>
43-
<p>
44-
{{ $t('label.download.kubeconfig.cluster') }}
43+
<p v-html="$t('label.download.kubeconfig.cluster')">
4544
</p>
4645
</a-timeline-item>
4746
<a-timeline-item>
47+
<p v-html="$t('label.download.kubectl')"></p>
4848
<p>
49-
{{ $t('label.download.kubectl') }} <br><br>
5049
{{ $t('label.linux') }}: <a :href="this.kubectlLinuxLink">{{ this.kubectlLinuxLink }}</a><br>
5150
{{ $t('label.macos') }}: <a :href="this.kubectlMacLink">{{ this.kubectlMacLink }}</a><br>
5251
{{ $t('label.windows') }}: <a :href="this.kubectlWindowsLink">{{ this.kubectlWindowsLink }}</a>
5352
</p>
5453
</a-timeline-item>
5554
<a-timeline-item>
55+
<p v-html="$t('label.use.kubectl.access.cluster')"></p>
5656
<p>
57-
{{ $t('label.use.kubectl.access.cluster') }}<br><br>
5857
<code><b>kubectl --kubeconfig /custom/path/kube.conf {COMMAND}</b></code><br><br>
59-
6058
<em>{{ $t('label.list.pods') }}</em><br>
6159
<code>kubectl --kubeconfig /custom/path/kube.conf get pods --all-namespaces</code><br>
6260
<em>{{ $t('label.list.nodes') }}</em><br>
@@ -106,6 +104,9 @@
106104
<template slot="state" slot-scope="text">
107105
<status :text="text ? text : ''" displayText />
108106
</template>
107+
<template slot="port" slot-scope="text, record, index">
108+
{{ cksSshStartingPort + index }}
109+
</template>
109110
</a-table>
110111
</a-tab-pane>
111112
<a-tab-pane :tab="$t('label.firewall')" key="firewall" v-if="publicIpAddress">
@@ -165,7 +166,8 @@ export default {
165166
networkLoading: false,
166167
network: {},
167168
publicIpAddress: {},
168-
currentTab: 'details'
169+
currentTab: 'details',
170+
cksSshStartingPort: 2222
169171
}
170172
},
171173
created () {
@@ -185,8 +187,9 @@ export default {
185187
dataIndex: 'instancename'
186188
},
187189
{
188-
title: this.$t('label.ipaddress'),
189-
dataIndex: 'ipaddress'
190+
title: this.$t('label.ssh.port'),
191+
dataIndex: 'port',
192+
scopedSlots: { customRender: 'port' }
190193
},
191194
{
192195
title: this.$t('label.zonename'),
@@ -286,35 +289,8 @@ export default {
286289
},
287290
fetchInstances () {
288291
this.instanceLoading = true
289-
this.virtualmachines = []
290-
if (!this.isObjectEmpty(this.resource) && this.arrayHasItems(this.resource.virtualmachineids)) {
291-
var params = {}
292-
if (this.isAdminOrDomainAdmin()) {
293-
params.listall = true
294-
}
295-
if (this.isValidValueForKey(this.resource, 'projectid') &&
296-
this.resource.projectid !== '') {
297-
params.projectid = this.resource.projectid
298-
}
299-
params.ids = this.resource.virtualmachineids.join()
300-
api('listVirtualMachines', params).then(json => {
301-
const listVms = json.listvirtualmachinesresponse.virtualmachine
302-
if (this.arrayHasItems(listVms)) {
303-
for (var i = 0; i < listVms.length; ++i) {
304-
var vm = listVms[i]
305-
if (vm.nic && vm.nic.length > 0 && vm.nic[0].ipaddress) {
306-
vm.ipaddress = vm.nic[0].ipaddress
307-
listVms[i] = vm
308-
}
309-
}
310-
this.virtualmachines = this.virtualmachines.concat(listVms)
311-
}
312-
}).catch(error => {
313-
this.$notifyError(error)
314-
}).finally(() => {
315-
this.instanceLoading = false
316-
})
317-
}
292+
this.virtualmachines = this.resource.virtualmachines
293+
this.instanceLoading = false
318294
},
319295
fetchPublicIpAddress () {
320296
this.networkLoading = true

src/views/compute/ScaleKubernetesCluster.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@
1818
<template>
1919
<div class="form-layout">
2020
<a-spin :spinning="loading">
21+
<a-alert type="warning">
22+
<span slot="message" v-html="$t('message.kubernetes.cluster.scale')" />
23+
</a-alert>
24+
<br />
2125
<a-form
2226
:form="form"
2327
@submit="handleSubmit"

src/views/compute/UpgradeKubernetesCluster.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@
1818
<template>
1919
<div class="form-layout">
2020
<a-spin :spinning="loading">
21+
<a-alert type="warning">
22+
<span slot="message" v-html="$t('message.kubernetes.cluster.upgrade')" />
23+
</a-alert>
24+
<br />
2125
<a-form
2226
:form="form"
2327
@submit="handleSubmit"

0 commit comments

Comments
 (0)