fix(deploymentlog): show the checkbox only when container exsiting previous
This commit is contained in:
@@ -55,6 +55,12 @@ const ViewLogsModal: React.FC<ViewModalProps> = (props) => {
|
|||||||
);
|
);
|
||||||
}, [countOptions, showPrevious]);
|
}, [countOptions, showPrevious]);
|
||||||
|
|
||||||
|
const hasPreviousContainer = useMemo(() => {
|
||||||
|
return countOptions?.some((option) =>
|
||||||
|
option.children?.some((child) => child.previous)
|
||||||
|
);
|
||||||
|
}, [countOptions]);
|
||||||
|
|
||||||
const handleCancel = useCallback(() => {
|
const handleCancel = useCallback(() => {
|
||||||
logsViewerRef.current?.abort();
|
logsViewerRef.current?.abort();
|
||||||
onCancel();
|
onCancel();
|
||||||
@@ -186,15 +192,15 @@ const ViewLogsModal: React.FC<ViewModalProps> = (props) => {
|
|||||||
{intl.formatMessage({ id: 'common.button.viewlog' })}
|
{intl.formatMessage({ id: 'common.button.viewlog' })}
|
||||||
</span>
|
</span>
|
||||||
<span className="flex-center gap-8" style={{ height: 32 }}>
|
<span className="flex-center gap-8" style={{ height: 32 }}>
|
||||||
{showCascader && (
|
<div
|
||||||
<div
|
style={{
|
||||||
style={{
|
display: 'flex',
|
||||||
display: 'flex',
|
alignItems: 'center',
|
||||||
alignItems: 'center',
|
gap: 16,
|
||||||
gap: 16,
|
marginRight: 8
|
||||||
marginRight: 8
|
}}
|
||||||
}}
|
>
|
||||||
>
|
{hasPreviousContainer && (
|
||||||
<Checkbox onChange={handleOnChecked} checked={showPrevious}>
|
<Checkbox onChange={handleOnChecked} checked={showPrevious}>
|
||||||
<Tooltip
|
<Tooltip
|
||||||
title={
|
title={
|
||||||
@@ -219,6 +225,9 @@ const ViewLogsModal: React.FC<ViewModalProps> = (props) => {
|
|||||||
<QuestionCircleOutlined style={{ marginLeft: 4 }} />
|
<QuestionCircleOutlined style={{ marginLeft: 4 }} />
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</Checkbox>
|
</Checkbox>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{showCascader && (
|
||||||
<BaseSelect
|
<BaseSelect
|
||||||
prefix={
|
prefix={
|
||||||
<span
|
<span
|
||||||
@@ -240,9 +249,8 @@ const ViewLogsModal: React.FC<ViewModalProps> = (props) => {
|
|||||||
onChange={handleContainerChange}
|
onChange={handleContainerChange}
|
||||||
style={{ width: 360 }}
|
style={{ width: 360 }}
|
||||||
></BaseSelect>
|
></BaseSelect>
|
||||||
</div>
|
)}
|
||||||
)}
|
</div>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
type="text"
|
type="text"
|
||||||
color="default"
|
color="default"
|
||||||
|
|||||||
@@ -9,6 +9,10 @@ const useOpenPlayground = () => {
|
|||||||
const plugin = getGPUStackPlugin();
|
const plugin = getGPUStackPlugin();
|
||||||
|
|
||||||
const generateModelName = (row: any) => {
|
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();
|
const org = getOrgById(row.owner_principal_id) ?? getCurrentOrg();
|
||||||
|
|
||||||
// The platform Org is always named ``default`` (backend constant
|
// 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
|
// ``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
|
// caller is currently acting under for the admin "All" view, where the
|
||||||
// row's owner still resolves via the platform-wide org cache.
|
// 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);
|
const modelName = encodeURIComponent(rawModel);
|
||||||
|
|
||||||
for (const [category, path] of Object.entries(categoryToPathMap)) {
|
for (const [category, path] of Object.entries(categoryToPathMap)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user