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
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,10 @@ private void addDatasetToGraph(Dataset dataset, CollectionTaskDetailResponse col
collectionEdge.setDescription(dataset.getDescription());
collectionEdge.setFromNodeId(collectionNode.getId());
collectionEdge.setToNodeId(datasetNode.getId());
lineageService.generateGraph(collectionNode, collectionEdge, datasetNode);
} else {
lineageService.generateGraph(datasetNode, null, null);
}
lineageService.generateGraph(collectionNode, collectionEdge, datasetNode);
}

public DatasetLineage getDatasetLineage(String datasetId) {
Expand Down
18 changes: 10 additions & 8 deletions frontend/src/components/AddTagPopover.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Button, Input, Popover, theme, Tag, Empty } from "antd";
import { PlusOutlined } from "@ant-design/icons";
import { useEffect, useMemo, useState } from "react";
import { useTranslation } from "react-i18next";

interface Tag {
id: number;
Expand All @@ -22,6 +23,7 @@ export default function AddTagPopover({
onCreateAndTag,
}: AddTagPopoverProps) {
const { token } = theme.useToken();
const { t } = useTranslation();
const [showPopover, setShowPopover] = useState(false);

const [newTag, setNewTag] = useState("");
Expand Down Expand Up @@ -68,12 +70,12 @@ export default function AddTagPopover({
content={
<div className="space-y-4 w-[300px]">
<h4 className="font-medium border-b pb-2 border-gray-100">
添加标签
{t("tagManagement.addTag")}
</h4>
{/* Available Tags */}
{availableTags?.length ? (
<div className="space-y-2">
<h5 className="text-sm">选择现有标签</h5>
<h5 className="text-sm">{t("tagManagement.selectExistingTags")}</h5>
<div className="max-h-32 overflow-y-auto space-y-1">
{availableTags.map((tag) => (
<span
Expand All @@ -91,15 +93,15 @@ export default function AddTagPopover({
</div>
</div>
) : (
<Empty description="没有可用标签,请先创建标签。" />
<Empty description={t("tagManagement.noAvailableTags")} />
)}

{/* Create New Tag */}
<div className="space-y-2 border-t border-gray-100 pt-3">
<h5 className="text-sm">创建新标签</h5>
<h5 className="text-sm">{t("tagManagement.createNewTag")}</h5>
<div className="flex gap-2">
<Input
placeholder="输入新标签名称..."
placeholder={t("tagManagement.newTagNamePlaceholder")}
value={newTag}
onChange={(e) => setNewTag(e.target.value)}
className="h-8 text-sm"
Expand All @@ -109,13 +111,13 @@ export default function AddTagPopover({
disabled={!newTag.trim()}
type="primary"
>
添加
{t("tagManagement.createTag")}
</Button>
</div>
</div>

<Button block onClick={() => setShowPopover(false)}>
取消
{t("tagManagement.cancel")}
</Button>
</div>
}
Expand All @@ -126,7 +128,7 @@ export default function AddTagPopover({
className="cursor-pointer"
onClick={() => setShowPopover(true)}
>
添加标签
{t("tagManagement.addTag")}
</Tag>
</Popover>
</>
Expand Down
9 changes: 5 additions & 4 deletions frontend/src/components/CardView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import ActionDropdown from "./ActionDropdown";
import { Database } from "lucide-react";

interface BadgeItem {
name: string;
label: string;
color?: string;
background?: string;
Expand Down Expand Up @@ -84,7 +85,7 @@ const TagsRenderer = ({ tags }: { tags?: Array<string | BadgeItem> }) => {
if (typeof tag === "string") {
tagElement.textContent = tag;
} else {
tagElement.textContent = tag.label;
tagElement.textContent = tag.label ? tag.label : tag.name;
}
tempDiv.appendChild(tagElement);
tagElements.push(tagElement);
Expand Down Expand Up @@ -145,7 +146,7 @@ const TagsRenderer = ({ tags }: { tags?: Array<string | BadgeItem> }) => {
: { background: tag.background, color: tag.color }
}
>
{typeof tag === "string" ? tag : tag.label}
{typeof tag === "string" ? tag : (tag.label ? tag.label : tag.name)}
</Tag>
))}
</div>
Expand All @@ -164,7 +165,7 @@ const TagsRenderer = ({ tags }: { tags?: Array<string | BadgeItem> }) => {
: { background: tag.background, color: tag.color }
}
>
{typeof tag === "string" ? tag : tag.label}
{typeof tag === "string" ? tag : (tag.label ? tag.label : tag.name)}
</Tag>
))}
{hiddenTags.length > 0 && (
Expand Down Expand Up @@ -255,7 +256,7 @@ function CardView<T extends BaseCardDataType>(props: CardViewProps<T>) {
color: item.tags[0].color,
}}
>
{item.tags[0].label}
{item.tags[0].label ? item.tags[0].label : item.tags[0].name}
</Tag>
)}
{item?.status && (
Expand Down
24 changes: 13 additions & 11 deletions frontend/src/components/business/TagManagement.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Drawer, Input, Button, App } from "antd";
import { PlusOutlined } from "@ant-design/icons";
import { Edit, Save, TagIcon, X, Trash } from "lucide-react";
import { TagItem } from "@/pages/DataManagement/dataset.model";
import { useTranslation } from "react-i18next";

interface CustomTagProps {
isEditable?: boolean;
Expand Down Expand Up @@ -105,6 +106,7 @@ const TagManager: React.FC = ({
}) => {
const [showTagManager, setShowTagManager] = useState(false);
const { message } = App.useApp();
const { t } = useTranslation();
const [tags, setTags] = useState<{ id: number; name: string }[]>([]);
const [newTag, setNewTag] = useState("");
const [editingTag, setEditingTag] = useState<string | null>(null);
Expand All @@ -117,7 +119,7 @@ const TagManager: React.FC = ({
const { data } = await onFetch?.();
setTags(data || []);
} catch (e) {
message.error("获取标签失败");
message.error(t("tagManagement.messages.fetchFailed"));
}
};

Expand All @@ -129,9 +131,9 @@ const TagManager: React.FC = ({
});
fetchTags();
setNewTag("");
message.success("标签添加成功");
message.success(t("tagManagement.messages.addSuccess"));
} catch (error) {
message.error("添加标签失败");
message.error(t("tagManagement.messages.addFailed"));
}
};

Expand All @@ -140,19 +142,19 @@ const TagManager: React.FC = ({
try {
await onDelete?.(tag.id);
fetchTags();
message.success("标签删除成功");
message.success(t("tagManagement.messages.deleteSuccess"));
} catch (error) {
message.error("删除标签失败");
message.error(t("tagManagement.messages.deleteFailed"));
}
};

const updateTag = async (oldTag: TagItem, newTag: string) => {
try {
await onUpdate?.({ ...oldTag, name: newTag });
fetchTags();
message.success("标签更新成功");
message.success(t("tagManagement.messages.updateSuccess"));
} catch (error) {
message.error("更新标签失败");
message.error(t("tagManagement.messages.updateFailed"));
}
};

Expand Down Expand Up @@ -192,19 +194,19 @@ const TagManager: React.FC = ({
icon={<TagIcon className="w-4 h-4 mr-2" />}
onClick={() => setShowTagManager(true)}
>
标签管理
{t("tagManagement.manageTags")}
</Button>
<Drawer
open={showTagManager}
onClose={() => setShowTagManager(false)}
title="标签管理"
title={t("tagManagement.manageTags")}
width={500}
>
<div className="space-y-4 flex-overflow">
{/* Add New Tag */}
<div className="flex gap-2">
<Input
placeholder="输入标签名称..."
placeholder={t("tagManagement.tagNamePlaceholder")}
value={newTag}
allowClear
onChange={(e) => setNewTag(e.target.value)}
Expand All @@ -220,7 +222,7 @@ const TagManager: React.FC = ({
disabled={!newTag.trim()}
icon={<PlusOutlined />}
>
添加
{t("tagManagement.createTag")}
</Button>
</div>

Expand Down
Loading
Loading