From 109f562f06428a6cd7b23579569d9abdda922df7 Mon Sep 17 00:00:00 2001 From: midoks Date: Mon, 30 Oct 2023 14:47:54 +0800 Subject: [PATCH] update --- plugins/gogs/index.py | 11 +++++++++-- plugins/gogs/js/gogs.js | 24 +++++++++++++++++------- 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/plugins/gogs/index.py b/plugins/gogs/index.py index fd3a5918b..cf5c3bbf6 100755 --- a/plugins/gogs/index.py +++ b/plugins/gogs/index.py @@ -545,10 +545,17 @@ def repoList(): data['root_url'] = getRootUrl() + repo_where1 = '' + repo_where2 = '' + if search != '': + repo_where1 = ' where name like "%' + search + '%"' + repo_where2 = ' where r.name like "%' + search + '%"' + start = (page - 1) * page_size - list_count = pQuery('select count(id) as num from repository') + list_count = pQuery( + 'select count(id) as num from repository' + repo_where1) count = list_count[0]["num"] - sql = 'select r.id,r.owner_id,r.name as repo, u.name from repository r left join user u on r.owner_id=u.id order by r.id desc limit ' + \ + sql = 'select r.id,r.owner_id,r.name as repo, u.name from repository r left join user u on r.owner_id=u.id ' + repo_where2 + ' order by r.id desc limit ' + \ str(start) + ',' + str(page_size) # print(sql) list_data = pQuery(sql) diff --git a/plugins/gogs/js/gogs.js b/plugins/gogs/js/gogs.js index 828b772de..2999ccbc4 100755 --- a/plugins/gogs/js/gogs.js +++ b/plugins/gogs/js/gogs.js @@ -137,7 +137,7 @@ function gogsUserList(page, search) { return; } content = '
'; - content += '
'; + content += ''; content += '
'; content += ''; @@ -164,13 +164,18 @@ function gogsUserList(page, search) { content += ''; content += '
'; - var page = ''; + var page_html = ''; - content += page; + content += page_html; $(".soft-man-con").html(content); + + $('.find_user').click(function(){ + var name = $('#find_user').val(); + gogsUserList(page, name); + }); }); } @@ -324,6 +329,11 @@ function gogsRepoListPage(page, search){ $('#repo_list tbody').html(body); $('#repo_list_page').html(rdata['data']['list']); + $('.find_repo').click(function(){ + var find_repo = $('#find_repo').val(); + gogsRepoListPage(page, find_repo); + }); + $('#repo_list .load').click(function(){ var i = $(this).data('index'); @@ -409,8 +419,8 @@ function gogsRepoListPage(page, search){ function gogsRepoList() { - content = '
'; - content += '
'; + content = '
'; + content += '
'; content += '
'; content += '';