Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion agent/app/dto/response/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ type AppParam struct {
}

type AppConfig struct {
Params []AppParam `json:"params"`
Params []AppParam `json:"params"`
RawCompose string `json:"rawCompose"`
request.AppContainerConfig
}
3 changes: 3 additions & 0 deletions agent/app/service/app_install.go
Original file line number Diff line number Diff line change
Expand Up @@ -796,6 +796,9 @@ func (a *AppInstallService) GetParams(id uint) (*response.AppConfig, error) {
res.RestartPolicy = getRestartPolicy(install.DockerCompose)
res.WebUI = install.WebUI
res.Type = install.App.Type
if rawCompose, err := getUpgradeCompose(install, detail); err == nil {
res.RawCompose = rawCompose
}
return &res, nil
}

Expand Down
1 change: 1 addition & 0 deletions frontend/src/api/interface/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ export namespace App {

export interface AppConfig {
params: InstallParams[];
rawCompose?: string;
cpuQuota: number;
memoryLimit: number;
memoryUnit: string;
Expand Down
27 changes: 21 additions & 6 deletions frontend/src/views/app-store/installed/detail/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -126,22 +126,26 @@
<span class="input-help">{{ $t('app.editComposeHelper') }}</span>
</el-form-item>
<div v-if="paramModel.editCompose">
<el-button @click="openDiff()" type="primary" class="!mb-2">
{{ $t('app.showDiff') }}
</el-button>
<CodemirrorPro v-model="paramModel.dockerCompose" mode="yaml"></CodemirrorPro>
</div>
</div>
</el-form>
</div>
<template #footer v-if="edit">
<span>
<el-button @click="handleClose" :disabled="loading">{{ $t('commons.button.cancel') }}</el-button>
<el-button type="primary" :disabled="loading" @click="submit(paramForm)">
{{ $t('commons.button.confirm') }}
</el-button>
</span>
<el-button @click="handleClose" :disabled="loading">{{ $t('commons.button.cancel') }}</el-button>
<el-button type="primary" :disabled="loading" @click="submit(paramForm)">
{{ $t('commons.button.confirm') }}
</el-button>
</template>
<Diff ref="composeDiffRef" @confirm="getNewCompose" />
</DrawerPro>
</template>
<script lang="ts" setup>
import Diff from '@/views/app-store/installed/upgrade/diff/index.vue';

import { App } from '@/api/interface/app';
import { getAppInstallParams, updateAppInstallParams, updateInstallConfig } from '@/api/modules/app';
import { reactive, ref } from 'vue';
Expand Down Expand Up @@ -200,6 +204,16 @@ const limits = ref<Container.ResourceLimit>({
memory: null as number,
});
const oldMemory = ref<number>(0);
const composeDiffRef = ref();
const rawCompose = ref('');

const getNewCompose = (compose: string) => {
paramModel.dockerCompose = compose;
};

const openDiff = () => {
composeDiffRef.value.acceptParams(rawCompose.value, paramModel.dockerCompose);
};

function checkWebUI() {
if (webUI.domain !== '') {
Expand Down Expand Up @@ -266,6 +280,7 @@ const get = async () => {
try {
loading.value = true;
const res = await getAppInstallParams(Number(paramData.value.id));
rawCompose.value = res.data.rawCompose;
const configParams = res.data.params || [];
if (configParams && configParams.length > 0) {
configParams.forEach((d) => {
Expand Down
10 changes: 4 additions & 6 deletions frontend/src/views/app-store/installed/upgrade/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,10 @@
</div>
</div>
<template #footer>
<span class="dialog-footer">
<el-button @click="handleClose" :disabled="loading">{{ $t('commons.button.cancel') }}</el-button>
<el-button type="primary" @click="onOperate" :disabled="versions == null || loading">
{{ $t('commons.button.confirm') }}
</el-button>
</span>
<el-button @click="handleClose" :disabled="loading">{{ $t('commons.button.cancel') }}</el-button>
<el-button type="primary" @click="onOperate" :disabled="versions == null || loading">
{{ $t('commons.button.confirm') }}
</el-button>
</template>
<Diff ref="composeDiffRef" @confirm="getNewCompose" />
</DrawerPro>
Expand Down
Loading