Skip to content

Commit

Permalink
remove: 搜索页面去掉 ”码客“ (#1446)
Browse files Browse the repository at this point in the history
  • Loading branch information
leafage-collb authored Jul 3, 2024
1 parent 67df5ce commit 2d2200f
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 198 deletions.
1 change: 0 additions & 1 deletion webfe/package_vue/src/language/lang/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
*/

export default {
码客: '码客',
'工蜂 Git': '工蜂 Git',
'工蜂 Git 授权': '工蜂 Git authorization',
'GitHub 授权': 'GitHub authorization',
Expand Down
1 change: 0 additions & 1 deletion webfe/package_vue/src/language/lang/zh.js
Original file line number Diff line number Diff line change
Expand Up @@ -1584,7 +1584,6 @@ export default {
最近一次告警内容: '最近一次告警内容',
输入搜索内容: '输入搜索内容',
资料库: '资料库',
码客: '码客',
您没有访问当前应用该功能的权限: '您没有访问当前应用该功能的权限',
'页面找不到了!': '页面找不到了!',
查看已下架应用: '查看已下架应用',
Expand Down
42 changes: 14 additions & 28 deletions webfe/package_vue/src/store/modules/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,26 +26,20 @@ import { json2Query } from '@/common/tools';

// actions
const actions = {
fetchSearchApp: async function (_, { filterKey, params }) {
return Vue.http.get(BACKEND_URL + '/api/bkapps/applications/lists/search?keyword=' + filterKey, {
params
}).then((res) => {
return res.results.map(data => {
return {
code: data.code,
name: data.name,
moduleId: data.default_module_name
};
});
}, (err) => {
async fetchSearchApp(_, { filterKey, params }) {
return Vue.http.get(`${BACKEND_URL}/api/bkapps/applications/lists/search?keyword=${filterKey}`, {
params,
}).then(res => res.results.map(data => ({
code: data.code,
name: data.name,
moduleId: data.default_module_name,
})), (err) => {
console.error('fetchSearchApp Error', err);
return [];
});
},
fetchSearchDoc: async function (_, filterKey) {
return Vue.http.get(BACKEND_URL + `/api/document/search/?format=json&keyword=${filterKey}`).then(res => {
return res;
}, (err) => {
async fetchSearchDoc(_, filterKey) {
return Vue.http.get(`${BACKEND_URL}/api/document/search/?format=json&keyword=${filterKey}`).then(res => res, (err) => {
console.error('fetchSearchDoc Error', err);
return [];
});
Expand All @@ -54,37 +48,29 @@ const actions = {
/**
* 获取搜索的应用
*/
getSearchApp ({ commit, state }, params, config = {}) {
getSearchApp({}, params, config = {}) {
const url = `${BACKEND_URL}/api/search/applications/?${json2Query(params)}`;
return http.get(url, config);
},

/**
* 获取搜索的资料文档条目
*/
getSearchDocs ({ commit, state }, params, config = {}) {
getSearchDocs({}, params, config = {}) {
const url = `${BACKEND_URL}/api/search/bk_docs/?${json2Query(params)}`;
return http.get(url, config);
},

/**
* 获取搜索的iwiki
*/
getSearchIwiki ({ commit, state }, params, config = {}) {
getSearchIwiki({}, params, config = {}) {
const url = `${BACKEND_URL}/api/search/iwiki/?${json2Query(params)}`;
return http.get(url, config);
},

/**
* 获取搜索的码客
*/
getSearchMk ({ commit, state }, params, config = {}) {
const url = `${BACKEND_URL}/api/search/mk/?${json2Query(params)}`;
return http.get(url, config);
}
};

export default {
namespaced: true,
actions
actions,
};
136 changes: 0 additions & 136 deletions webfe/package_vue/src/views/dev-center/search/comps/mk.vue

This file was deleted.

36 changes: 4 additions & 32 deletions webfe/package_vue/src/views/dev-center/search/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,6 @@
:data="searchData[curTab].list"
:filter-key="filterKey"
/>
<mk
v-if="curTab === 'mk'"
:data="searchData[curTab].list"
:filter-key="filterKey"
/>
</template>
</div>
<div
Expand All @@ -105,7 +100,6 @@ import { bus } from '@/common/bus';
import App from './comps/application';
import Docu from './comps/docu';
import Iwiki from './comps/iwiki';
import Mk from './comps/mk';
const getDefaultSearchData = () => ({
app: {
Expand All @@ -117,9 +111,6 @@ const getDefaultSearchData = () => ({
docu: {
list: [],
},
mk: {
list: [],
},
});
export default {
Expand All @@ -128,7 +119,6 @@ export default {
App,
Docu,
Iwiki,
Mk,
},
data() {
return {
Expand All @@ -150,7 +140,6 @@ export default {
{ name: 'app', label: this.$t('应用'), count: 0 },
{ name: 'iwiki', label: 'iwiki', count: 0 },
{ name: 'docu', label: this.$t('资料库'), count: 0 },
{ name: 'mk', label: this.$t('码客'), count: 0 },
],
filterKey: '',
};
Expand All @@ -165,7 +154,7 @@ export default {
return curTabData.count > 0;
},
isSetPadding() {
return ['docu', 'iwiki', 'mk'].includes(this.curTab);
return ['docu', 'iwiki'].includes(this.curTab);
},
},
beforeRouteLeave(to, from, next) {
Expand Down Expand Up @@ -223,7 +212,7 @@ export default {
async fetchData() {
this.isLoading = true;
try {
const res = await Promise.all([this.fetchApp(), this.fetchIwiki(), this.fetchDocu(), this.fetchMk()].map(item => this.promiseWithError(item)));
const res = await Promise.all([this.fetchApp(), this.fetchIwiki(), this.fetchDocu()].map(item => this.promiseWithError(item)));
res.forEach((item, index) => {
const { count, results } = item;
this.panels[index].count = count || 0;
Expand All @@ -236,9 +225,6 @@ export default {
if (index === 2) {
this.searchData.docu.list = [...results];
}
if (index === 3) {
this.searchData.mk.list = [...results];
}
});
this.filterKey = this.value;
this.isShowTab = true;
Expand Down Expand Up @@ -320,14 +306,6 @@ export default {
});
},
fetchMk() {
return this.$store.dispatch('search/getSearchMk', {
limit: this.pageConf.limit,
offset: this.pageConf.limit * (this.pageConf.curPage - 1),
keyword: this.value,
});
},
handleSwitchTab() {
this.handleInitPageConf();
this.$nextTick(() => {
Expand All @@ -349,12 +327,9 @@ export default {
} else if (this.curTab === 'docu') {
const res = await this.fetchDocu();
this.searchData.docu.list = [...res.results];
} else if (this.curTab === 'iwiki') {
} else {
const res = await this.fetchIwiki();
this.searchData.iwiki.list = [...res.results];
} else {
const res = await this.fetchMk();
this.searchData.mk.list = [...res.results];
}
} catch (e) {
this.$paasMessage({
Expand All @@ -376,12 +351,9 @@ export default {
} else if (this.curTab === 'docu') {
const res = await this.fetchDocu();
this.searchData.docu.list = [...res.results];
} else if (this.curTab === 'iwiki') {
} else {
const res = await this.fetchIwiki();
this.searchData.iwiki.list = [...res.results];
} else {
const res = await this.fetchMk();
this.searchData.mk.list = [...res.results];
}
} catch (e) {
this.$paasMessage({
Expand Down

0 comments on commit 2d2200f

Please sign in to comment.