vue-layout-gitcode 1.12.55-multiple-account → 1.12.55

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.
@@ -1,9 +1,9 @@
1
- import { y as useLayoutConfig } from "./index-cvKRePGR.js";
1
+ import { c as useLayoutConfig } from "./index-XmRn4ADt.js";
2
2
  const layoutConfig = useLayoutConfig();
3
- const transWebUrl = (url, params) => {
3
+ const transWebUrl = (url, params, options = {}) => {
4
4
  if (!url) return url;
5
5
  let processedUrl = url;
6
- if (layoutConfig.VITE_ENV !== "production") {
6
+ if (layoutConfig.VITE_ENV !== "production" && !options.preserveOrigin) {
7
7
  const regex = /^(?:https?:\/\/)?(?:www\.)?([^\/]+)(\/.*)$/;
8
8
  const match = url.match(regex);
9
9
  processedUrl = match ? match[2] : url || "/";
@@ -1,202 +0,0 @@
1
- import { defineComponent, inject, openBlock, createElementBlock, Fragment, createElementVNode, toDisplayString, unref, createVNode, 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-cvKRePGR.js";
5
- import "lodash/debounce";
6
- import { u as useReportRepo, S as SearchRepoCard, f as formatNameSpace } from "./index-Ci7lYW7d.js";
7
- import "./transWebUrl-DdydDOiv.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: "mb-[4px] mt-[16px] flex justify-between" };
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: "mb-[8px]",
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: "px-[8px] history-list-project pl-[8px]"
93
- };
94
- const _hoisted_2 = {
95
- key: 1,
96
- class: "px-[8px] history-list-project pl-[8px]"
97
- };
98
- const _hoisted_3 = {
99
- key: 2,
100
- class: "px-[8px] history-list-project pl-[8px]"
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
- };
@@ -1,87 +0,0 @@
1
- import { ref, inject, computed, withDirectives, openBlock, createElementBlock, createElementVNode, toDisplayString, unref, Fragment, renderList, createVNode, vShow } from "vue";
2
- import { a as i18n, h as headRequest, G as GIcon, r as reqCatch } from "./index-cvKRePGR.js";
3
- import { useRoute, useRouter } from "vue-router";
4
- import "vue-devui-lal/icon";
5
- import "vue-devui-lal/icon/style.css";
6
- const _hoisted_1 = { class: "px-[8px] history-list-project pl-[8px]" };
7
- const _hoisted_2 = { class: "history-list-project-globartitle mb-[4px] mt-[16px]" };
8
- const _hoisted_3 = ["href"];
9
- const _hoisted_4 = { class: "flex history-list-project-globarbox" };
10
- const _hoisted_5 = { class: "ml-[8px] ellipsis" };
11
- const _sfc_main = /* @__PURE__ */ Object.assign({ name: "SearchFileList" }, {
12
- __name: "ProjectSearch",
13
- props: ["searchStr", "searchInfo", "isSearchPage"],
14
- setup(__props) {
15
- const { t: $t } = i18n.global;
16
- const props = __props;
17
- const filedList = ref([]);
18
- const route = useRoute();
19
- const router = useRouter();
20
- const API = headRequest(inject("request"));
21
- const loadFileList = async () => {
22
- var _a, _b, _c;
23
- if (!((_a = props == null ? void 0 : props.searchInfo) == null ? void 0 : _a.searchScopeName)) return;
24
- const params = {
25
- repoId: encodeURIComponent(props.searchInfo.searchScopeName),
26
- ref_name: ((_b = props.searchInfo) == null ? void 0 : _b.branch) || ""
27
- };
28
- const res = await reqCatch(API.getRepoFileList, params);
29
- filedList.value = ((_c = res == null ? void 0 : res.data) == null ? void 0 : _c.data) || [];
30
- };
31
- loadFileList();
32
- const searchFileList = computed(() => {
33
- return filedList.value.filter((item) => {
34
- var _a;
35
- return (_a = item == null ? void 0 : item.toLowerCase()) == null ? void 0 : _a.includes(props.searchStr);
36
- }).splice(0, 5);
37
- });
38
- const getRoutePath = (filePath) => {
39
- let params = {};
40
- if (props.isSearchPage) {
41
- const [namespace, repoName] = decodeURIComponent(props.searchInfo.repo).split("/");
42
- params.namespace = namespace;
43
- params.repoName = repoName;
44
- } else {
45
- params = route == null ? void 0 : route.params;
46
- }
47
- const defaultBranch = props.searchInfo.branch;
48
- const branchName = Array.isArray(defaultBranch) ? defaultBranch : defaultBranch == null ? void 0 : defaultBranch.split("/");
49
- const routerPath = router.resolve({
50
- name: "repoFile",
51
- params: {
52
- ...params,
53
- branchName,
54
- filePath: filePath.split("/")
55
- },
56
- query: {
57
- init: "initTree"
58
- }
59
- }).href;
60
- return routerPath;
61
- };
62
- return (_ctx, _cache) => {
63
- return withDirectives((openBlock(), createElementBlock("div", _hoisted_1, [
64
- createElementVNode("p", _hoisted_2, toDisplayString(unref($t)("gitCodeLayout.header.file")), 1),
65
- (openBlock(true), createElementBlock(Fragment, null, renderList(searchFileList.value, (item, index) => {
66
- return openBlock(), createElementBlock("a", {
67
- key: index,
68
- href: getRoutePath(item)
69
- }, [
70
- createElementVNode("p", _hoisted_4, [
71
- createVNode(GIcon, {
72
- name: "gt-file-c",
73
- style: { "flex-shrink": "0" }
74
- }),
75
- createElementVNode("span", _hoisted_5, toDisplayString(item), 1)
76
- ])
77
- ], 8, _hoisted_3);
78
- }), 128))
79
- ], 512)), [
80
- [vShow, searchFileList.value.length]
81
- ]);
82
- };
83
- }
84
- });
85
- export {
86
- _sfc_main as default
87
- };