|
97 | 97 | > |
98 | 98 | {{ $t('commons.operate.restart') }} |
99 | 99 | </el-button> |
100 | | - <el-button |
101 | | - :disabled="row.createdBy !== '1Panel'" |
102 | | - plain |
103 | | - round |
104 | | - size="small" |
105 | | - @click="onDelete(row)" |
106 | | - > |
| 100 | + <el-button plain round size="small" @click="onDelete(row)"> |
107 | 101 | {{ $t('commons.operate.delete') }} |
108 | 102 | </el-button> |
109 | 103 | </div> |
|
174 | 168 | <el-descriptions-item :label="$t('container.memTotal')"> |
175 | 169 | {{ computeSizeForDocker(row.memoryLimit) }} |
176 | 170 | </el-descriptions-item> |
177 | | - |
178 | | - <el-descriptions-item> |
| 171 | + <el-descriptions-item v-if="row.hasLoadSize"> |
179 | 172 | <template #label> |
180 | 173 | {{ $t('container.sizeRw') }} |
181 | 174 | <el-tooltip :content="$t('container.sizeRwHelper')"> |
|
184 | 177 | </template> |
185 | 178 | {{ computeSize2(row.sizeRw) }} |
186 | 179 | </el-descriptions-item> |
187 | | - <el-descriptions-item :label="$t('container.sizeRootFs')"> |
| 180 | + <el-descriptions-item |
| 181 | + :label="$t('container.sizeRootFs')" |
| 182 | + v-if="row.hasLoadSize" |
| 183 | + > |
188 | 184 | <template #label> |
189 | 185 | {{ $t('container.sizeRootFs') }} |
190 | 186 | <el-tooltip :content="$t('container.sizeRootFsHelper')"> |
|
194 | 190 | {{ computeSize2(row.sizeRootFs) }} |
195 | 191 | </el-descriptions-item> |
196 | 192 | </el-descriptions> |
| 193 | + |
| 194 | + <el-button |
| 195 | + class="mt-2" |
| 196 | + v-if="!row.hasLoadSize" |
| 197 | + size="small" |
| 198 | + link |
| 199 | + type="primary" |
| 200 | + @click="loadSize(row)" |
| 201 | + > |
| 202 | + {{ $t('container.loadSize') }} |
| 203 | + </el-button> |
197 | 204 | </template> |
198 | 205 | </el-popover> |
199 | 206 | </div> |
|
252 | 259 |
|
253 | 260 | <div v-show="showType === 'log'"> |
254 | 261 | <ContainerLog |
| 262 | + v-model:loading="detailLoading" |
255 | 263 | :key="currentCompose.path" |
256 | 264 | :compose="currentCompose.path" |
| 265 | + :resource="currentCompose.name" |
257 | 266 | :highlightDiff="450" |
258 | 267 | :defaultFollow="true" |
259 | 268 | /> |
@@ -282,7 +291,14 @@ import TerminalDialog from '@/views/container/container/terminal/index.vue'; |
282 | 291 | import ContainerLogDialog from '@/components/log/container-drawer/index.vue'; |
283 | 292 | import CreateDialog from '@/views/container/compose/create/index.vue'; |
284 | 293 | import DeleteDialog from '@/views/container/compose/delete/index.vue'; |
285 | | -import { composeOperator, composeUpdate, containerListStats, inspect, searchCompose } from '@/api/modules/container'; |
| 294 | +import { |
| 295 | + composeOperator, |
| 296 | + composeUpdate, |
| 297 | + containerItemStats, |
| 298 | + containerListStats, |
| 299 | + inspect, |
| 300 | + searchCompose, |
| 301 | +} from '@/api/modules/container'; |
286 | 302 | import DockerStatus from '@/views/container/docker-status/index.vue'; |
287 | 303 | import i18n from '@/lang'; |
288 | 304 | import { Container } from '@/api/interface/container'; |
@@ -381,11 +397,15 @@ const loadDetail = async (row: Container.ComposeInfo, withRefresh: boolean) => { |
381 | 397 | detailLoading.value = true; |
382 | 398 | currentCompose.value = row; |
383 | 399 | composeContainers.value = row.containers || []; |
384 | | - await inspect({ id: currentCompose.value.name, type: 'compose' }).then((res) => { |
385 | | - composeContent.value = res.data; |
386 | | - detailLoading.value = false; |
387 | | - }); |
388 | | - loadContainerStats(); |
| 400 | + await inspect({ id: currentCompose.value.name, type: 'compose' }) |
| 401 | + .then((res) => { |
| 402 | + composeContent.value = res.data; |
| 403 | + detailLoading.value = false; |
| 404 | + }) |
| 405 | + .finally(() => { |
| 406 | + loadContainerStats(); |
| 407 | + detailLoading.value = false; |
| 408 | + }); |
389 | 409 | }; |
390 | 410 |
|
391 | 411 | const loadContainerStats = async () => { |
@@ -440,6 +460,14 @@ const handleComposeOperate = async (operation: 'up' | 'stop' | 'restart', row: a |
440 | 460 | }); |
441 | 461 | }; |
442 | 462 |
|
| 463 | +const loadSize = async (row: any) => { |
| 464 | + containerItemStats(row.containerID).then((res) => { |
| 465 | + row.sizeRw = res.data.sizeRw || 0; |
| 466 | + row.sizeRootFs = res.data.sizeRootFs || 0; |
| 467 | + row.hasLoadSize = true; |
| 468 | + }); |
| 469 | +}; |
| 470 | +
|
443 | 471 | const onSubmitEdit = async () => { |
444 | 472 | const param = { |
445 | 473 | name: currentCompose.value.name, |
|
0 commit comments