vue-layout-gitcode 1.12.15-beta.6 → 1.12.15-beta.61
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/GloabarSearch-uyAWrX7X.js +154 -0
- package/{MenuItem-gpMioL7c.js → MenuItem-Dkx_uTDj.js} +7 -2
- package/{ProjectMenuList-qJRgFFc2.js → ProjectMenuList-CP4-QaX-.js} +2 -2
- package/{ProjectMenuListV2-DxeLKcuC.js → ProjectMenuListV2-CIaKJoPo.js} +3 -3
- package/{ProjectSearch-ByOYVtZa.js → ProjectSearch-B4CGDNjV.js} +36 -10
- package/{SearchHistoryList-BSEHxpLm.js → SearchHistoryList-DAWX7oM1.js} +13 -10
- package/{SearchRecommed-DxKb5eje.js → SearchRecommed-C6GXaNWA.js} +2 -2
- package/{SearchScopeList-D-VLtvR3.js → SearchScopeList-B5d3IluA.js} +1 -1
- package/{UserSearch-CMvjqb9t.js → UserSearch-Bnk1WM4z.js} +15 -12
- package/{index-DB8vSwNM.js → index-BeRIIRfv.js} +1 -1
- package/{index-VaV5XVhn.js → index-CUz285eq.js} +1 -1
- package/{index-CKKeJYA9.js → index-DzTQ2iLs.js} +3693 -1966
- package/index.d.ts +53 -856
- package/index.js +21 -13
- package/{notice-DPBhpIrF.js → notice-D08Onnii.js} +1 -1
- package/package.json +1 -1
- package/style.css +1 -1
- package/{transWebUrl-C5NH2PM9.js → transWebUrl-D0hbacwo.js} +1 -1
- package/{index-BfpPpmj0.js → useReportRepo-sTMQBVbL.js} +90 -109
- package/GloabarSearch-iT2fx6Su.js +0 -202
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import { t as transWebUrl } from "./transWebUrl-C5NH2PM9.js";
|
|
1
|
+
import { defineComponent, toDisplayString, unref, mergeModels, useModel, ref, watch, createElementBlock, openBlock, createVNode, withDirectives, normalizeClass, createElementVNode, vShow, inject, withModifiers, createBlock, Fragment, computed, createCommentVNode, normalizeStyle, createTextVNode, renderList, withCtx, reactive, onMounted, watchEffect } from "vue";
|
|
2
|
+
import { d as transferNumber, G as GIcon, _ as _export_sfc, s as setLoginTriggerSource, f as useRequestReport, r as reqCatch, h as headRequest, a as i18n, T as TOPIC_TYPE, g as useTimeFormat, j as useCookie, k as usePageResize, L as LANG_ZH, m as isGstarRepo, o as _sfc_main$b, p as isIncubationRepo, q as highlightWords, t as transformUrl, w as _frEventTrack, E as EVENT_NAME, c as REPO_TYPE, e as extractRepoInfoWithURL, x as LANG_KEY } from "./index-DzTQ2iLs.js";
|
|
3
|
+
import { t as transWebUrl } from "./transWebUrl-D0hbacwo.js";
|
|
5
4
|
import { useRouter } from "vue-router";
|
|
6
5
|
import { Row, Col } from "vue-devui-lal/grid";
|
|
7
6
|
import { Skeleton, SkeletonItem } from "vue-devui-lal/skeleton";
|
|
@@ -9,74 +8,7 @@ import "vue-devui-lal/grid/style.css";
|
|
|
9
8
|
import "vue-devui-lal/skeleton/style.css";
|
|
10
9
|
import { Popover } from "vue-devui-lal/popover";
|
|
11
10
|
import "vue-devui-lal/popover/style.css";
|
|
12
|
-
|
|
13
|
-
const list = ref([]);
|
|
14
|
-
const pageRef = ref((window == null ? void 0 : window.page_ref) || "");
|
|
15
|
-
const locationHref = ref((window == null ? void 0 : window.location.href) || "");
|
|
16
|
-
const keyword = ref(reportParams == null ? void 0 : reportParams.keyword);
|
|
17
|
-
const moduleName = ref(reportParams == null ? void 0 : reportParams.moduleName);
|
|
18
|
-
const triggerReport = (type, data) => {
|
|
19
|
-
if (type === "click") {
|
|
20
|
-
const params = {
|
|
21
|
-
chat_title: "",
|
|
22
|
-
related: {
|
|
23
|
-
list: [formatItem(data)],
|
|
24
|
-
type: "repo"
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
viewReport(pageRef.value, locationHref.value, "click", params);
|
|
28
|
-
} else if (type === "expo") {
|
|
29
|
-
list.value.push(data);
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
const formatItem = (data) => {
|
|
33
|
-
const channelNames = [];
|
|
34
|
-
if (data.channelName) channelNames.push(data.channelName);
|
|
35
|
-
if (data.subChannelName) channelNames.push(data.subChannelName);
|
|
36
|
-
const repoId = isNaN(Number(data.id)) ? data.id : Number(data.id);
|
|
37
|
-
return {
|
|
38
|
-
type: "gitcode",
|
|
39
|
-
repo_id: repoId,
|
|
40
|
-
dest_url: data.web_url,
|
|
41
|
-
strategy: channelNames.join("、") || "",
|
|
42
|
-
// 官方项目
|
|
43
|
-
repo_index: data.index,
|
|
44
|
-
page: data.pageIndex || data.p || 0,
|
|
45
|
-
per_page: data.pageSize || data.pp || 0,
|
|
46
|
-
q: data.keyword || ""
|
|
47
|
-
};
|
|
48
|
-
};
|
|
49
|
-
const doReport = debounce(() => {
|
|
50
|
-
if (list.value.length >= 1) {
|
|
51
|
-
const reportList = list.value.splice(0).map((item) => {
|
|
52
|
-
return formatItem(item);
|
|
53
|
-
});
|
|
54
|
-
const params = {
|
|
55
|
-
chat_title: "",
|
|
56
|
-
extend_json: {
|
|
57
|
-
key_words: keyword.value,
|
|
58
|
-
module_name: moduleName.value
|
|
59
|
-
},
|
|
60
|
-
related: {
|
|
61
|
-
list: reportList,
|
|
62
|
-
type: "repo"
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
viewReport(pageRef.value, locationHref.value, "expo", params);
|
|
66
|
-
}
|
|
67
|
-
}, 500, { leading: false });
|
|
68
|
-
watchEffect(() => {
|
|
69
|
-
if (list.value.length) {
|
|
70
|
-
doReport();
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
return {
|
|
74
|
-
triggerReport
|
|
75
|
-
};
|
|
76
|
-
};
|
|
77
|
-
const formatNameSpace = (content) => {
|
|
78
|
-
return content.trim().replace(/\s+/g, "").replace(/^(GitHub加速计划\/|HuggingFace镜像\/)/, "").split("/").filter(Boolean);
|
|
79
|
-
};
|
|
11
|
+
import debounce from "lodash/debounce";
|
|
80
12
|
const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
81
13
|
__name: "index",
|
|
82
14
|
props: {
|
|
@@ -290,7 +222,7 @@ const ForkTag = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-
|
|
|
290
222
|
const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
291
223
|
__name: "index",
|
|
292
224
|
props: {
|
|
293
|
-
tagInfo: { default: [] },
|
|
225
|
+
tagInfo: { default: () => [] },
|
|
294
226
|
type: {}
|
|
295
227
|
},
|
|
296
228
|
setup(__props) {
|
|
@@ -298,15 +230,6 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
298
230
|
const isTag = computed(() => props.type === "tag");
|
|
299
231
|
const languageTag = props.tagInfo[0] || "";
|
|
300
232
|
const tagColor = props.tagInfo[1] || "#00ADD8";
|
|
301
|
-
computed(() => {
|
|
302
|
-
if (isTag.value) {
|
|
303
|
-
return {
|
|
304
|
-
background: tagColor,
|
|
305
|
-
opacity: 0.1
|
|
306
|
-
};
|
|
307
|
-
}
|
|
308
|
-
return {};
|
|
309
|
-
});
|
|
310
233
|
const tagFontColor = computed(() => {
|
|
311
234
|
if (isTag.value) {
|
|
312
235
|
return { color: tagColor };
|
|
@@ -408,12 +331,12 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
408
331
|
__name: "index",
|
|
409
332
|
props: {
|
|
410
333
|
repoInfo: {},
|
|
411
|
-
hideTopicTags: { type: Boolean },
|
|
412
|
-
tagInfo: {},
|
|
413
|
-
hideUpdateTime: { type: Boolean },
|
|
414
|
-
hideStarIncrease: { type: Boolean },
|
|
415
|
-
hideStarCount: { type: Boolean },
|
|
416
|
-
searchCard: { type: Boolean }
|
|
334
|
+
hideTopicTags: { type: Boolean, default: false },
|
|
335
|
+
tagInfo: { default: () => [] },
|
|
336
|
+
hideUpdateTime: { type: Boolean, default: false },
|
|
337
|
+
hideStarIncrease: { type: Boolean, default: false },
|
|
338
|
+
hideStarCount: { type: Boolean, default: false },
|
|
339
|
+
searchCard: { type: Boolean, default: false }
|
|
417
340
|
},
|
|
418
341
|
emits: ["topicClick"],
|
|
419
342
|
setup(__props, { emit: __emit }) {
|
|
@@ -425,22 +348,12 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
425
348
|
var _a;
|
|
426
349
|
return ((_a = props.repoInfo.tags) == null ? void 0 : _a.filter((item) => item.type === TOPIC_TYPE.USER)) || [];
|
|
427
350
|
});
|
|
428
|
-
ref(topicNames.value);
|
|
429
|
-
const visibleCount = ref(0);
|
|
430
|
-
ref(false);
|
|
431
351
|
const showUpdateTimeDot = computed(() => {
|
|
432
352
|
return !props.hideUpdateTime && (!props.hideStarCount || props.tagInfo && props.tagInfo[0] || props.repoInfo.forks_count);
|
|
433
353
|
});
|
|
434
|
-
computed(() => {
|
|
435
|
-
return topicNames.value.length - visibleCount.value + 1;
|
|
436
|
-
});
|
|
437
354
|
const handleTopicClick = (topic) => {
|
|
438
355
|
emits("topicClick", topic);
|
|
439
356
|
};
|
|
440
|
-
onMounted(() => {
|
|
441
|
-
});
|
|
442
|
-
onUnmounted(() => {
|
|
443
|
-
});
|
|
444
357
|
return (_ctx, _cache) => {
|
|
445
358
|
return openBlock(), createElementBlock(Fragment, null, [
|
|
446
359
|
createElementVNode("div", null, [
|
|
@@ -489,6 +402,9 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
489
402
|
}
|
|
490
403
|
});
|
|
491
404
|
const RepoCardFooter = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-vue-layout-gitcode"]]);
|
|
405
|
+
const formatNameSpace = (content) => {
|
|
406
|
+
return content.trim().replace(/\s+/g, "").replace(/^(GitHub加速计划\/|HuggingFace镜像\/)/, "").split("/").filter(Boolean);
|
|
407
|
+
};
|
|
492
408
|
const _hoisted_1$2 = { class: "new-tag-content" };
|
|
493
409
|
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
494
410
|
__name: "index",
|
|
@@ -624,18 +540,19 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
624
540
|
info: {},
|
|
625
541
|
keyword: {},
|
|
626
542
|
cardType: {},
|
|
627
|
-
noborder: { type: Boolean },
|
|
628
|
-
hover: { type: Boolean },
|
|
629
|
-
hideTopicTags: { type: Boolean },
|
|
630
|
-
urlParams: {},
|
|
631
|
-
hideStarBtn: { type: Boolean },
|
|
632
|
-
hideFooter: { type: Boolean },
|
|
633
|
-
hideDescription: { type: Boolean }
|
|
543
|
+
noborder: { type: Boolean, default: false },
|
|
544
|
+
hover: { type: Boolean, default: false },
|
|
545
|
+
hideTopicTags: { type: Boolean, default: false },
|
|
546
|
+
urlParams: { default: () => ({}) },
|
|
547
|
+
hideStarBtn: { type: Boolean, default: false },
|
|
548
|
+
hideFooter: { type: Boolean, default: false },
|
|
549
|
+
hideDescription: { type: Boolean, default: false }
|
|
634
550
|
},
|
|
635
551
|
emits: ["report"],
|
|
636
552
|
setup(__props, { emit: __emit }) {
|
|
637
553
|
const lang = useCookie(LANG_KEY, LANG_ZH);
|
|
638
|
-
const
|
|
554
|
+
const request = inject("request") || (() => Promise.resolve({ data: {} }));
|
|
555
|
+
const API = headRequest(request);
|
|
639
556
|
const emits = __emit;
|
|
640
557
|
const router = useRouter();
|
|
641
558
|
const { widthType } = usePageResize();
|
|
@@ -649,7 +566,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
649
566
|
emits("report", "starReport");
|
|
650
567
|
};
|
|
651
568
|
const rowSpan = reactive({ xxl: 8, xl: 12, md: 12, lg: 24, sm: 24 });
|
|
652
|
-
const repoIcon = { repo: "gt-line-repositories", model: "gt-
|
|
569
|
+
const repoIcon = { repo: "gt-line-repositories", model: "gt-line-line-Models", dataset: "gt-line-Datasets" };
|
|
653
570
|
const props = __props;
|
|
654
571
|
console.log("i-search-projects-card", props.info, props.cardType);
|
|
655
572
|
const iconName = computed(() => {
|
|
@@ -702,7 +619,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
702
619
|
name_with_namespace: nameWithSpace,
|
|
703
620
|
path_with_namespace: path,
|
|
704
621
|
import_url: importUrl,
|
|
705
|
-
is_gh_mirrors: isGhMirrors,
|
|
706
622
|
is_mirrors: isMirrors
|
|
707
623
|
} = info || {};
|
|
708
624
|
const isGitcodeRepo = REPO_TYPE.GITCODE === isMirrors;
|
|
@@ -834,7 +750,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
834
750
|
]),
|
|
835
751
|
_: 1
|
|
836
752
|
})) : createCommentVNode("", true)
|
|
837
|
-
])) : isModel.value ? (openBlock(), createBlock(ModelCardFooter, {
|
|
753
|
+
])) : isModel.value && !_ctx.hideFooter ? (openBlock(), createBlock(ModelCardFooter, {
|
|
838
754
|
key: 2,
|
|
839
755
|
repoInfo: _ctx.info
|
|
840
756
|
}, null, 8, ["repoInfo"])) : (openBlock(), createElementBlock(Fragment, { key: 3 }, [
|
|
@@ -854,6 +770,71 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
854
770
|
}
|
|
855
771
|
});
|
|
856
772
|
const SearchRepoCard = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-vue-layout-gitcode"]]);
|
|
773
|
+
const useReportRepo = (reportParams, viewReport) => {
|
|
774
|
+
const list = ref([]);
|
|
775
|
+
const pageRef = ref((window == null ? void 0 : window.page_ref) || "");
|
|
776
|
+
const locationHref = ref((window == null ? void 0 : window.location.href) || "");
|
|
777
|
+
const keyword = ref(reportParams == null ? void 0 : reportParams.keyword);
|
|
778
|
+
const moduleName = ref(reportParams == null ? void 0 : reportParams.moduleName);
|
|
779
|
+
const triggerReport = (type, data) => {
|
|
780
|
+
if (type === "click") {
|
|
781
|
+
const params = {
|
|
782
|
+
chat_title: "",
|
|
783
|
+
related: {
|
|
784
|
+
list: [formatItem(data)],
|
|
785
|
+
type: "repo"
|
|
786
|
+
}
|
|
787
|
+
};
|
|
788
|
+
viewReport(pageRef.value, locationHref.value, "click", params);
|
|
789
|
+
} else if (type === "expo") {
|
|
790
|
+
list.value.push(data);
|
|
791
|
+
}
|
|
792
|
+
};
|
|
793
|
+
const formatItem = (data) => {
|
|
794
|
+
const channelNames = [];
|
|
795
|
+
if (data.channelName) channelNames.push(data.channelName);
|
|
796
|
+
if (data.subChannelName) channelNames.push(data.subChannelName);
|
|
797
|
+
const repoId = isNaN(Number(data.id)) ? data.id : Number(data.id);
|
|
798
|
+
return {
|
|
799
|
+
type: "gitcode",
|
|
800
|
+
repo_id: repoId,
|
|
801
|
+
dest_url: data.web_url,
|
|
802
|
+
strategy: channelNames.join("、") || "",
|
|
803
|
+
// 官方项目
|
|
804
|
+
repo_index: data.index,
|
|
805
|
+
page: data.pageIndex || data.p || 0,
|
|
806
|
+
per_page: data.pageSize || data.pp || 0,
|
|
807
|
+
q: data.keyword || ""
|
|
808
|
+
};
|
|
809
|
+
};
|
|
810
|
+
const doReport = debounce(() => {
|
|
811
|
+
if (list.value.length >= 1) {
|
|
812
|
+
const reportList = list.value.splice(0).map((item) => {
|
|
813
|
+
return formatItem(item);
|
|
814
|
+
});
|
|
815
|
+
const params = {
|
|
816
|
+
chat_title: "",
|
|
817
|
+
extend_json: {
|
|
818
|
+
key_words: keyword.value,
|
|
819
|
+
module_name: moduleName.value
|
|
820
|
+
},
|
|
821
|
+
related: {
|
|
822
|
+
list: reportList,
|
|
823
|
+
type: "repo"
|
|
824
|
+
}
|
|
825
|
+
};
|
|
826
|
+
viewReport(pageRef.value, locationHref.value, "expo", params);
|
|
827
|
+
}
|
|
828
|
+
}, 500, { leading: false });
|
|
829
|
+
watchEffect(() => {
|
|
830
|
+
if (list.value.length) {
|
|
831
|
+
doReport();
|
|
832
|
+
}
|
|
833
|
+
});
|
|
834
|
+
return {
|
|
835
|
+
triggerReport
|
|
836
|
+
};
|
|
837
|
+
};
|
|
857
838
|
export {
|
|
858
839
|
SearchRepoCard as S,
|
|
859
840
|
formatNameSpace as f,
|
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
import { defineComponent, inject, createElementBlock, openBlock, Fragment, createElementVNode, toDisplayString, createVNode, unref, renderList, withDirectives, createBlock, ref, watch, onMounted, createCommentVNode } from "vue";
|
|
2
|
-
import "vue-devui-lal/icon";
|
|
3
|
-
import "vue-devui-lal/icon/style.css";
|
|
4
|
-
import { h as headRequest, R as REPO_MODULE, a as i18n, G as GIcon, v as vElementExposure, b as REPO_EVENT, _ as _export_sfc, c as REPO_TYPE, e as extractRepoInfoWithURL } from "./index-CKKeJYA9.js";
|
|
5
|
-
import "lodash/debounce";
|
|
6
|
-
import { u as useReportRepo, S as SearchRepoCard, f as formatNameSpace } from "./index-BfpPpmj0.js";
|
|
7
|
-
import "./transWebUrl-C5NH2PM9.js";
|
|
8
|
-
import "vue-devui-lal/tooltip";
|
|
9
|
-
import "vue-devui-lal/tooltip/style.css";
|
|
10
|
-
import "vue-router";
|
|
11
|
-
import "vue-devui-lal/grid";
|
|
12
|
-
import "vue-devui-lal/skeleton";
|
|
13
|
-
import "vue-devui-lal/grid/style.css";
|
|
14
|
-
import "vue-devui-lal/skeleton/style.css";
|
|
15
|
-
import "vue-devui-lal/popover";
|
|
16
|
-
import "vue-devui-lal/popover/style.css";
|
|
17
|
-
const _hoisted_1$1 = { class: "search-repo-list-header" };
|
|
18
|
-
const _hoisted_2$1 = { class: "title" };
|
|
19
|
-
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
20
|
-
__name: "SearchRepoCardList",
|
|
21
|
-
props: {
|
|
22
|
-
dataList: {
|
|
23
|
-
type: Array,
|
|
24
|
-
default: () => []
|
|
25
|
-
},
|
|
26
|
-
searchStr: {
|
|
27
|
-
type: String,
|
|
28
|
-
default: ""
|
|
29
|
-
},
|
|
30
|
-
type: {
|
|
31
|
-
type: String,
|
|
32
|
-
default: ""
|
|
33
|
-
},
|
|
34
|
-
name: {
|
|
35
|
-
type: String,
|
|
36
|
-
default: ""
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
emits: ["report"],
|
|
40
|
-
setup(__props, { emit: __emit }) {
|
|
41
|
-
const API = headRequest(inject("request"));
|
|
42
|
-
const { triggerReport } = useReportRepo({ moduleName: REPO_MODULE.SEARCH_SUGGESTION_CARD }, API.viewReport);
|
|
43
|
-
const { t: $t } = i18n.global;
|
|
44
|
-
const useReport = inject("useReport");
|
|
45
|
-
const emits = __emit;
|
|
46
|
-
const handleReport = (item) => {
|
|
47
|
-
useReport(REPO_EVENT.CLICK, { module_name: REPO_MODULE.SEARCH_SUGGESTION_CARD, repo_id: item.id });
|
|
48
|
-
};
|
|
49
|
-
const handleMore = () => {
|
|
50
|
-
emits("more");
|
|
51
|
-
};
|
|
52
|
-
return (_ctx, _cache) => {
|
|
53
|
-
return openBlock(), createElementBlock(Fragment, null, [
|
|
54
|
-
createElementVNode("div", _hoisted_1$1, [
|
|
55
|
-
createElementVNode("p", _hoisted_2$1, toDisplayString(__props.name), 1),
|
|
56
|
-
createElementVNode("a", {
|
|
57
|
-
class: "more-btn",
|
|
58
|
-
onClick: handleMore
|
|
59
|
-
}, [
|
|
60
|
-
createElementVNode("span", null, toDisplayString(unref($t)("gitCodeLayout.common.more")), 1),
|
|
61
|
-
createVNode(GIcon, {
|
|
62
|
-
name: "gt-line-right",
|
|
63
|
-
color: "var(--theme-placeholder)"
|
|
64
|
-
})
|
|
65
|
-
])
|
|
66
|
-
]),
|
|
67
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.dataList, (item, index) => {
|
|
68
|
-
return withDirectives((openBlock(), createBlock(SearchRepoCard, {
|
|
69
|
-
key: item.id,
|
|
70
|
-
class: "search-repo-list-card",
|
|
71
|
-
info: { ...item, index },
|
|
72
|
-
keyword: __props.searchStr,
|
|
73
|
-
hover: "",
|
|
74
|
-
hideTopicTags: "",
|
|
75
|
-
hideStarBtn: "",
|
|
76
|
-
hideFooter: "",
|
|
77
|
-
hideDescription: "",
|
|
78
|
-
onReport: () => handleReport(item),
|
|
79
|
-
cardType: __props.type,
|
|
80
|
-
"url-params": { source_module: "search_project" }
|
|
81
|
-
}, null, 8, ["info", "keyword", "onReport", "cardType"])), [
|
|
82
|
-
[unref(vElementExposure), { trigger: (type) => unref(triggerReport)(type, item) }]
|
|
83
|
-
]);
|
|
84
|
-
}), 128))
|
|
85
|
-
], 64);
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
const SearchRepoCardList = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-vue-layout-gitcode"]]);
|
|
90
|
-
const _hoisted_1 = {
|
|
91
|
-
key: 0,
|
|
92
|
-
class: "history-list-project history-list-project--padded"
|
|
93
|
-
};
|
|
94
|
-
const _hoisted_2 = {
|
|
95
|
-
key: 1,
|
|
96
|
-
class: "history-list-project history-list-project--padded"
|
|
97
|
-
};
|
|
98
|
-
const _hoisted_3 = {
|
|
99
|
-
key: 2,
|
|
100
|
-
class: "history-list-project history-list-project--padded"
|
|
101
|
-
};
|
|
102
|
-
const _sfc_main = {
|
|
103
|
-
__name: "GloabarSearch",
|
|
104
|
-
props: ["searchStr"],
|
|
105
|
-
emits: ["searchMore"],
|
|
106
|
-
setup(__props, { emit: __emit }) {
|
|
107
|
-
const emits = __emit;
|
|
108
|
-
const { t: $t } = i18n.global;
|
|
109
|
-
const API = headRequest(inject("request"));
|
|
110
|
-
const useReport = inject("useReport");
|
|
111
|
-
const projectList = ref([]);
|
|
112
|
-
const datasetList = ref([]);
|
|
113
|
-
const modelList = ref([]);
|
|
114
|
-
const origin = window.location.origin;
|
|
115
|
-
const props = __props;
|
|
116
|
-
let timer = null;
|
|
117
|
-
const convertDataList = (dataList) => {
|
|
118
|
-
return dataList == null ? void 0 : dataList.slice(0, 5).map((item) => {
|
|
119
|
-
const isGitcodeRepo = REPO_TYPE.GITCODE === item.is_mirrors;
|
|
120
|
-
const repoName = (!isGitcodeRepo ? extractRepoInfoWithURL(item.import_url) : item.name_with_namespace) || item.name_with_namespace;
|
|
121
|
-
const displayName = formatNameSpace(repoName).join("/");
|
|
122
|
-
return {
|
|
123
|
-
...item,
|
|
124
|
-
path: `${origin}/${item.path_with_namespace}`,
|
|
125
|
-
displayName,
|
|
126
|
-
web_url: `${origin}/${item.path_with_namespace}`
|
|
127
|
-
};
|
|
128
|
-
});
|
|
129
|
-
};
|
|
130
|
-
const handleMore = (type) => {
|
|
131
|
-
emits("searchMore", type);
|
|
132
|
-
};
|
|
133
|
-
const getData = async () => {
|
|
134
|
-
if (!props.searchStr) {
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
try {
|
|
138
|
-
useReport("search-project", {});
|
|
139
|
-
const res = await API.getGloabarSearchKeyLink({ q: props.searchStr });
|
|
140
|
-
const { recommend_project = [], recommend_model = [], recommend_dataset = [] } = res.data || {};
|
|
141
|
-
projectList.value = convertDataList(recommend_project);
|
|
142
|
-
modelList.value = convertDataList(recommend_model);
|
|
143
|
-
datasetList.value = convertDataList(recommend_dataset);
|
|
144
|
-
} catch (error) {
|
|
145
|
-
console.error("Failed to fetch search results:", error);
|
|
146
|
-
projectList.value = [];
|
|
147
|
-
modelList.value = [];
|
|
148
|
-
datasetList.value = [];
|
|
149
|
-
}
|
|
150
|
-
};
|
|
151
|
-
if (props.searchStr) {
|
|
152
|
-
getData();
|
|
153
|
-
}
|
|
154
|
-
watch(
|
|
155
|
-
() => props.searchStr,
|
|
156
|
-
() => {
|
|
157
|
-
if (timer) {
|
|
158
|
-
clearTimeout(timer);
|
|
159
|
-
}
|
|
160
|
-
timer = setTimeout(() => {
|
|
161
|
-
getData();
|
|
162
|
-
}, 300);
|
|
163
|
-
}
|
|
164
|
-
);
|
|
165
|
-
onMounted(() => {
|
|
166
|
-
});
|
|
167
|
-
return (_ctx, _cache) => {
|
|
168
|
-
return openBlock(), createElementBlock(Fragment, null, [
|
|
169
|
-
projectList.value.length ? (openBlock(), createElementBlock("div", _hoisted_1, [
|
|
170
|
-
createVNode(SearchRepoCardList, {
|
|
171
|
-
"data-list": projectList.value,
|
|
172
|
-
"search-str": __props.searchStr,
|
|
173
|
-
name: unref($t)("gitCodeLayout.header.repo"),
|
|
174
|
-
type: "repo",
|
|
175
|
-
onMore: _cache[0] || (_cache[0] = () => handleMore("repo"))
|
|
176
|
-
}, null, 8, ["data-list", "search-str", "name"])
|
|
177
|
-
])) : createCommentVNode("", true),
|
|
178
|
-
modelList.value.length ? (openBlock(), createElementBlock("div", _hoisted_2, [
|
|
179
|
-
createVNode(SearchRepoCardList, {
|
|
180
|
-
"data-list": modelList.value,
|
|
181
|
-
"search-str": __props.searchStr,
|
|
182
|
-
name: unref($t)("gitCodeLayout.aihub.model"),
|
|
183
|
-
type: "model",
|
|
184
|
-
onMore: _cache[1] || (_cache[1] = () => handleMore("model"))
|
|
185
|
-
}, null, 8, ["data-list", "search-str", "name"])
|
|
186
|
-
])) : createCommentVNode("", true),
|
|
187
|
-
datasetList.value.length ? (openBlock(), createElementBlock("div", _hoisted_3, [
|
|
188
|
-
createVNode(SearchRepoCardList, {
|
|
189
|
-
"data-list": datasetList.value,
|
|
190
|
-
"search-str": __props.searchStr,
|
|
191
|
-
name: unref($t)("gitCodeLayout.aihub.dataSet"),
|
|
192
|
-
type: "dataset",
|
|
193
|
-
onMore: _cache[2] || (_cache[2] = () => handleMore("dataset"))
|
|
194
|
-
}, null, 8, ["data-list", "search-str", "name"])
|
|
195
|
-
])) : createCommentVNode("", true)
|
|
196
|
-
], 64);
|
|
197
|
-
};
|
|
198
|
-
}
|
|
199
|
-
};
|
|
200
|
-
export {
|
|
201
|
-
_sfc_main as default
|
|
202
|
-
};
|