Reset network / user script when choosing ostype from windows to linux (#292)

* reset network / user script when choosing windows

Signed-off-by: Andy Lee <andy.lee@suse.com>

* change OS type from Windows init user and network data

Signed-off-by: Andy Lee <andy.lee@suse.com>

---------

Signed-off-by: Andy Lee <andy.lee@suse.com>
This commit is contained in:
Andy Lee 2025-05-14 14:15:39 +08:00 committed by GitHub
parent 0cd5651c38
commit 63c4810b99
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 21 additions and 2 deletions

View File

@ -20,6 +20,10 @@ export default {
type: String, type: String,
default: 'create' default: 'create'
}, },
osType: {
type: String,
default: ''
},
value: { value: {
type: String, type: String,
default: '' default: ''
@ -64,6 +68,12 @@ export default {
}, },
watch: { watch: {
osType(neu) {
if (neu === 'windows') {
this.id = '';
}
},
value(neu) { value(neu) {
this.yamlScript = neu; this.yamlScript = neu;
}, },

View File

@ -28,6 +28,10 @@ export default {
type: String, type: String,
default: '' default: ''
}, },
osType: {
type: String,
default: ''
},
userScript: { userScript: {
type: String, type: String,
default: '' default: ''
@ -203,6 +207,7 @@ export default {
<DataTemplate <DataTemplate
ref="userTemplate" ref="userTemplate"
:value="userScript" :value="userScript"
:os-type="osType"
type="user" type="user"
:view-code="viewCode" :view-code="viewCode"
:mode="mode" :mode="mode"
@ -219,6 +224,7 @@ export default {
ref="networkTemplate" ref="networkTemplate"
:value="networkScript" :value="networkScript"
type="network" type="network"
:os-type="osType"
:view-code="viewCode" :view-code="viewCode"
:mode="mode" :mode="mode"
:config-id="configNetworkId" :config-id="configNetworkId"

View File

@ -862,6 +862,7 @@ export default {
ref="yamlEditor" ref="yamlEditor"
:user-script="userScript" :user-script="userScript"
:mode="mode" :mode="mode"
:os-type="osType"
:view-code="isWindows" :view-code="isWindows"
:namespace="value.metadata.namespace" :namespace="value.metadata.namespace"
:network-script="networkScript" :network-script="networkScript"

View File

@ -1533,6 +1533,7 @@ export default {
if (val) { if (val) {
this['sshKey'] = []; this['sshKey'] = [];
this['userScript'] = undefined; this['userScript'] = undefined;
this['networkScript'] = undefined;
this['installAgent'] = false; this['installAgent'] = false;
} }
}, },
@ -1590,8 +1591,9 @@ export default {
} }
}, },
osType(neu) { osType(neu, old) {
const out = this.getUserData({ installAgent: this.installAgent, osType: neu }); this.installAgent = old === 'windows' ? true : this.installAgent;
const out = old === 'windows' ? this.getInitUserData({ osType: neu }) : this.getUserData({ installAgent: this.installAgent, osType: neu });
this['userScript'] = out; this['userScript'] = out;
this.refreshYamlEditor(); this.refreshYamlEditor();