Skip to content

Commit 289bf86

Browse files
authored
feat(RepoHeader): update source display logic (#1021)
- Change condition for displaying source icon - Remove OpenCSG source handling - Return empty string for undefined sources
1 parent bcb2200 commit 289bf86

File tree

2 files changed

+3
-23
lines changed

2 files changed

+3
-23
lines changed

frontend/src/components/__tests__/shared/RepoHeader.spec.js

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -265,24 +265,4 @@ describe('RepoHeader Source Display', () => {
265265
wrapper.findComponent({ name: 'RepoHeaderSourceIcon' }).props('source')
266266
).toBe('HuggingFace')
267267
})
268-
269-
it('displays OpenCSG source with cleaned path', async () => {
270-
mockRepoDetailStore.hfPath = null
271-
mockRepoDetailStore.csgPath = 'cleaned_path'
272-
273-
const wrapper = createWrapper()
274-
const sourceIcon = wrapper.findComponent({ name: 'RepoHeaderSourceIcon' })
275-
276-
expect(sourceIcon.props('source')).toBe('OpenCSG')
277-
expect(sourceIcon.props('sourcePath')).toBe('cleaned_path')
278-
})
279-
280-
it('handles CSG_ prefixed path correctly', async () => {
281-
mockRepoDetailStore.hfPath = null
282-
mockRepoDetailStore.msPath = null
283-
mockRepoDetailStore.csgPath = null
284-
285-
const wrapper = createWrapper()
286-
expect(wrapper.vm.repoSourcePath).toBe('123')
287-
})
288268
})

frontend/src/components/shared/RepoHeader.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
nickname.trim() === '' ? name : nickname
1919
}}</span>
2020
<RepoHeaderSourceIcon
21-
v-if="repoDetailStore.source !== 'local'"
21+
v-if="!!repoSource"
2222
:repoType="repoType"
2323
:source="repoSource"
2424
:sourcePath="repoSourcePath"
@@ -113,7 +113,7 @@
113113
nickname.trim() === '' ? name : nickname
114114
}}</span>
115115
<RepoHeaderSourceIcon
116-
v-if="repoDetailStore.source !== 'local'"
116+
v-if="!!repoSource"
117117
:repoType="repoType"
118118
:source="repoSource"
119119
:sourcePath="repoSourcePath"
@@ -335,7 +335,7 @@
335335
} else if (repoDetailStore.msPath) {
336336
return 'ModelScope'
337337
} else {
338-
return 'OpenCSG'
338+
return ''
339339
}
340340
})
341341

0 commit comments

Comments
 (0)