Skip to content

Commit

Permalink
Update ComposeConfig.vue and casaos-appmanagement-openapi to latest v…
Browse files Browse the repository at this point in the history
…ersions
  • Loading branch information
zhanghengxin committed Apr 2, 2024
1 parent 6c49afe commit 3c4c7e2
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 19 deletions.
40 changes: 24 additions & 16 deletions main/src/components/Apps/ComposeConfig.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<b-tabs
class="has-text-full-03"
style="height: 100%"
@input="(key) => $emit('updateDockerComposeServiceName', key)"
v-model="current_service"
>
<b-tab-item v-for="(service, key) in configData.services" :key="key" :label="key" :value="key">
<ValidationObserver :ref="key + 'valida'">
Expand All @@ -22,7 +22,7 @@
>
<b-input
:key="service.image"
:readonly="state == 'update' || mainStableVersion !== ''"
:readonly="state == 'update' || serviceStableVersion !== ''"
:value="getFirstField(service.image)"
:placeholder="$t('e.g.,hello-world:latest')"
@input="(V) => changeIcon(V)"
Expand Down Expand Up @@ -72,14 +72,14 @@
</b-dropdown-item>
<b-dropdown-item
key="stable"
v-show="mainStableVersion !== '' && firstAppName === key"
v-show="serviceStableVersion !== '' && firstAppName === key"
@click="
() => {
service.image = service.image.split(':')[0] + ':' + mainStableVersion;
service.image = service.image.split(':')[0] + ':' + serviceStableVersion;
}
"
>
stable({{ mainStableVersion }})
stable({{ serviceStableVersion }})
</b-dropdown-item>
</b-dropdown>
</b-field>
Expand Down Expand Up @@ -342,9 +342,10 @@ export default {
},
data() {
return {
current_service: "",
baseUrl: "",
portSelected: null,
mainStableVersion: "",
serviceStableVersion: "",
configData: {
services: {
main_app: {
Expand Down Expand Up @@ -416,6 +417,21 @@ export default {
},
},
watch: {
current_service: {
async handler(val) {
this.$emit("updateDockerComposeServiceName", val);
this.serviceStableVersion = await this.$openAPI.appManagement.appStore
.composeAppStableTag(yaml.name, this.current_service)
.then((res) => {
return res.data.data.tag;
})
.catch((e) => {
console.error(e);
return "";
});
},
immediate: true,
},
// Watch if configData changes
configData: {
handler(val, newVal) {
Expand Down Expand Up @@ -601,23 +617,15 @@ export default {
this.configData.services = {};
// 删除掉原默认主应用。
this.$delete(this.configData.services, "main_app");
// this.current_service = yaml["x-casaos"].main;
this.current_service = Object.keys(yaml.services)[0];
// 解析 services,并将其赋值到 configData.services中。
for (const serviceKey in yaml.services) {
this.$set(this.configData.services, serviceKey, this.parseComposeItem(yaml.services[serviceKey]));
}
// set top level x-casaos data
this.configData["x-casaos"] = merge(this.configData["x-casaos"], yaml["x-casaos"]);
this.mainStableVersion = await this.$openAPI.appManagement.appStore
.composeAppStableTag(yaml.name)
.then((res) => {
return res.data.data.tag;
})
.catch((e) => {
console.error(e);
return "";
});
} catch (error) {
console.log(error);
}
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1673,11 +1673,11 @@ __metadata:
linkType: hard

"@icewhale/casaos-appmanagement-openapi@npm:latest":
version: 0.4.7-alpha4
resolution: "@icewhale/casaos-appmanagement-openapi@npm:0.4.7-alpha4"
version: 0.4.8-alpha1
resolution: "@icewhale/casaos-appmanagement-openapi@npm:0.4.8-alpha1"
dependencies:
axios: ^1.1.0
checksum: 3d28cacea22b26d77179388cf19b56e57552a4abcb5e499d829a24f9d0579acd709720cae47a93f93df1c59f35ca882f96534137dfaaf4d1f05a424a70a469cc
checksum: 8a7ae5e99352e97e76597969019d40f77e04c8509a1d81c1eac1949b431249f590bde6432c42d1dc257d730c109a136c7734293dee2039ee15f97e42c7607dee
languageName: node
linkType: hard

Expand Down

0 comments on commit 3c4c7e2

Please sign in to comment.