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,
default: 'create'
},
osType: {
type: String,
default: ''
},
value: {
type: String,
default: ''
@ -64,6 +68,12 @@ export default {
},
watch: {
osType(neu) {
if (neu === 'windows') {
this.id = '';
}
},
value(neu) {
this.yamlScript = neu;
},

View File

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

View File

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

View File

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