Skip to content

Commit

Permalink
feat: updated dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
tikazyq committed Nov 7, 2024
1 parent d943ae5 commit c01a4fc
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 19 deletions.
1 change: 0 additions & 1 deletion src/components/core/dependency/DependencyVersions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ const versions = computed(() => {
const versions = new Set<string>();
repo.dependencies?.forEach(dep => {
if (!dep.version) return;
console.debug(dep.version);
versions.add(dep.version);
});
return versions;
Expand Down
5 changes: 3 additions & 2 deletions src/components/core/node/NodeTag.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import { computed } from 'vue';
import { NODE_STATUS_OFFLINE, NODE_STATUS_ONLINE } from '@/constants';
import { translate } from '@/utils';
import { ElTag } from 'element-plus';
const t = translate;
Expand All @@ -14,6 +13,7 @@ const props = defineProps<{
clickable?: boolean;
loading?: boolean;
effect?: BasicEffect;
hit?: boolean;
iconOnly?: boolean;
}>();
Expand Down Expand Up @@ -75,8 +75,9 @@ defineOptions({ name: 'ClNodeTag' });
:tooltip="tooltip"
:clickable="clickable"
:effect="effect"
:hit="hit"
max-width="150px"
short
short-width="100px"
@click="emit('click')"
@mouseenter="emit('mouseenter')"
@mouseleave="emit('mouseleave')"
Expand Down
35 changes: 23 additions & 12 deletions src/components/ui/tag/Tag.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { computed, onMounted, ref, watch } from 'vue';
import { computed, CSSProperties, onMounted, ref, watch } from 'vue';
import { ElTag } from 'element-plus';
interface TagProps {
Expand All @@ -14,13 +14,13 @@ interface TagProps {
size?: BasicSize;
spinning?: boolean;
width?: string;
maxWidth?: string;
effect?: BasicEffect;
clickable?: boolean;
closable?: boolean;
disabled?: boolean;
className?: string;
short?: boolean;
shortWidth?: string;
}
const props = defineProps<TagProps>();
Expand Down Expand Up @@ -94,27 +94,38 @@ const setStyle = () => {
elTagClose.setAttribute('style', styleTagClose);
};
watch(() => props.color, setStyle);
watch(() => props.backgroundColor, setStyle);
watch(() => props.borderColor, setStyle);
onMounted(() => {
setStyle();
const style = computed<CSSProperties>(() => {
const { color, borderColor, width, maxWidth } = props;
return {
color,
borderColor,
width,
maxWidth,
};
});
// watch(() => props.color, setStyle);
// watch(() => props.backgroundColor, setStyle);
// watch(() => props.borderColor, setStyle);
// onMounted(() => {
// setStyle();
// });
defineOptions({ name: 'ClTag' });
</script>

<template>
<el-tooltip :content="tooltip" :disabled="!tooltip && !$slots.tooltip">
<el-tooltip :content="tooltip" :disabled="!tooltip && !slots.tooltip">
<el-tag
ref="tagRef"
:closable="closable"
class="tag"
:class="cls"
:size="size"
:type="type"
:closable="closable"
:color="backgroundColor"
:effect="effect"
class="tag"
:style="style"
@click="onClick($event)"
@close="onClose($event)"
@mouseenter="$emit('mouseenter')"
Expand Down Expand Up @@ -170,7 +181,7 @@ defineOptions({ name: 'ClTag' });
}
&.short {
max-width: 120px;
max-width: 150px;
overflow: hidden;
justify-content: start;
align-items: center;
Expand Down
7 changes: 3 additions & 4 deletions src/views/dependency/list/useDependencyList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,12 @@ const useDependencyList = () => {
value: (row: DependencyRepo) =>
row.dependencies?.map(dep => {
const node = allNodeDict.value.get(dep.node_id!);
return node ? (
if (!node?.active) return;
return (
<ClNodeTag
node={node}
loading={isLoading(dep)}
effect={isLoading(dep) ? 'dark' : 'light'}
hit={isLoading(dep)}
type={getTypeByDep(dep)}
clickable
onClick={() => {
Expand Down Expand Up @@ -270,8 +271,6 @@ const useDependencyList = () => {
},
}}
</ClNodeTag>
) : (
''
);
}),
},
Expand Down

0 comments on commit c01a4fc

Please sign in to comment.