fix(deploymentlog): show the checkbox only when container exsiting previous

This commit is contained in:
jialin
2026-06-18 11:50:19 +08:00
committed by jialin
parent 032f1eefef
commit 7cf4932f3a
2 changed files with 26 additions and 14 deletions
@@ -55,6 +55,12 @@ const ViewLogsModal: React.FC<ViewModalProps> = (props) => {
);
}, [countOptions, showPrevious]);
const hasPreviousContainer = useMemo(() => {
return countOptions?.some((option) =>
option.children?.some((child) => child.previous)
);
}, [countOptions]);
const handleCancel = useCallback(() => {
logsViewerRef.current?.abort();
onCancel();
@@ -186,15 +192,15 @@ const ViewLogsModal: React.FC<ViewModalProps> = (props) => {
{intl.formatMessage({ id: 'common.button.viewlog' })}
</span>
<span className="flex-center gap-8" style={{ height: 32 }}>
{showCascader && (
<div
style={{
display: 'flex',
alignItems: 'center',
gap: 16,
marginRight: 8
}}
>
<div
style={{
display: 'flex',
alignItems: 'center',
gap: 16,
marginRight: 8
}}
>
{hasPreviousContainer && (
<Checkbox onChange={handleOnChecked} checked={showPrevious}>
<Tooltip
title={
@@ -219,6 +225,9 @@ const ViewLogsModal: React.FC<ViewModalProps> = (props) => {
<QuestionCircleOutlined style={{ marginLeft: 4 }} />
</Tooltip>
</Checkbox>
)}
{showCascader && (
<BaseSelect
prefix={
<span
@@ -240,9 +249,8 @@ const ViewLogsModal: React.FC<ViewModalProps> = (props) => {
onChange={handleContainerChange}
style={{ width: 360 }}
></BaseSelect>
</div>
)}
)}
</div>
<Button
type="text"
color="default"
@@ -9,6 +9,10 @@ const useOpenPlayground = () => {
const plugin = getGPUStackPlugin();
const generateModelName = (row: any) => {
// if has plugin, it means is enterpise edition, we need to generate the model name with org name prefix, otherwise, we just use the model name
if (!plugin) {
return row.name;
}
const org = getOrgById(row.owner_principal_id) ?? getCurrentOrg();
// The platform Org is always named ``default`` (backend constant
@@ -30,8 +34,8 @@ const useOpenPlayground = () => {
// ``owner_principal_id`` (an org principal id); fall back to the Org the
// caller is currently acting under for the admin "All" view, where the
// row's owner still resolves via the platform-wide org cache.
// if has plugin, it means is enterpise edition, we need to generate the model name with org name prefix, otherwise, we just use the model name
const rawModel = plugin ? generateModelName(row) : row.name;
const rawModel = generateModelName(row);
const modelName = encodeURIComponent(rawModel);
for (const [category, path] of Object.entries(categoryToPathMap)) {