Add kubectl/helm download mirror select to preferences (#185)

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
Jari Kolehmainen authored and GitHub committed 2020-04-01 07:19:10 +03:00
1 parent f0dd4095ac
commit 5c2e64b487
7 files changed
+73 -81

No files matched your search

+23 -54
View File
@@ -5,34 +5,6 @@
<div class="header sticky-top">
<h2>Preferences</h2>
</div>
<!-- <div class="row">
<div class="col-3" />
<div ref="content" class="global-settings col-6">
<h2>Kontena Lens PRO License</h2>
<b-form-group
label="No Kontena Lens PRO license assigned. Assign license by entering license key below:"
label-for="input-license-key"
v-if="!licenceData || licenceData.status !== 'valid'"
>
<b-form-input
id="input-license-key"
v-model="licenseKey"
trim
@blur="onLicenseKeySave"
placeholder="Enter license key"
:disabled="!isLoggedIn"
:state="errors.licenseKey"
/>
</b-form-group>
<div v-if="licenceData">
<p v-if="licenceData.status === 'valid'">
Valid Kontena Lens PRO license assigned. Valid until {{ licenceData.valid_until }}<span v-if="licenceData.recurring">(renews automatically)</span>.
</p>
</div>
</div>
<div class="col-3" />
</div> -->
<div class="row">
<div class="col-3" />
<div ref="content" class="global-settings col-6">
@@ -52,6 +24,25 @@
</div>
<div class="col-3" />
</div>
<div class="row">
<div class="col-3" />
<div ref="content" class="global-settings col-6">
<h2>Download Mirror</h2>
<b-form-group
label="Download mirror for kubectl/helm:"
label-for="input-download-mirror"
>
<b-form-select
id="input-download-mirror"
v-model="preferences.downloadMirror"
@change="onSave"
:options="downloadMirrorOptions"
/>
</b-form-group>
</div>
<div class="col-3" />
</div>
<div class="row">
<div class="col-3" />
<div ref="content" class="global-settings col-6">
@@ -156,16 +147,16 @@ export default {
},
data(){
return {
licenseKey: "",
hubRepositories: [],
selectedHubRepo: "",
colorThemeOptions: [
{ value: "dark", text: "Dark" },
{ value: "light", text: "Light" },
],
errors: {
licenseKey: null
},
downloadMirrorOptions: [
{ value: "default", text: "Default (Google)" },
{ value: "china", text: "China (Azure)" },
],
isHelmProcessing: null,
}
},
@@ -176,33 +167,11 @@ export default {
preferences: function() {
return this.$store.getters.preferences;
},
licenceData: function() {
return this.$store.getters.licenseData;
},
isLoggedIn: function() {
console.log(this.$store.getters.isLoggedIn)
return this.$store.getters.isLoggedIn;
}
},
methods: {
onSave: function() {
this.$store.commit("savePreferences", this.preferences);
},
onLicenseKeySave: async function() {
if (this.licenseKey !== "") {
try {
await this.$store.dispatch("exhangeKey", {
key: this.licenseKey,
user: this.$store.getters.user
})
this.errors.licenseKey = true;
} catch(error) {
this.errors.licenseKey = false;
}
} else {
this.errors.licenseKey = null;
}
},
request: async function(opts) {
const o = Object.assign({
timeout: 10000,