From c640b81de2d46bfb61940faf3df16f651e6fc0ba Mon Sep 17 00:00:00 2001 From: yystopf Date: Tue, 9 Jul 2024 17:28:52 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E6=9B=B4=E6=94=B9=EF=BC=9A=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E5=88=97=E8=A1=A8=E8=BF=94=E5=9B=9E=E5=85=B7=E4=BD=93?= =?UTF-8?q?=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/projects/index.json.jbuilder | 1 + 1 file changed, 1 insertion(+) diff --git a/app/views/projects/index.json.jbuilder b/app/views/projects/index.json.jbuilder index a07dd6c1..7841f456 100644 --- a/app/views/projects/index.json.jbuilder +++ b/app/views/projects/index.json.jbuilder @@ -13,6 +13,7 @@ json.projects @projects do |project| json.mirror_url project.repository&.mirror_url json.type project&.numerical_for_project_type json.last_update_time render_unix_time(project.updated_on) + json.full_last_update_time project.updated_on json.time_ago time_from_now(project.updated_on) json.forked_from_project_id project.forked_from_project_id json.open_devops project.open_devops? From 99266bce7ef10f0202ce0c4afa77b1099dda6ca0 Mon Sep 17 00:00:00 2001 From: yystopf Date: Thu, 11 Jul 2024 10:38:26 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E6=96=B0=E5=A2=9E=EF=BC=9A=E6=B5=81?= =?UTF-8?q?=E6=B0=B4=E7=BA=BF=E8=BF=90=E8=A1=8C=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gemfile | 2 +- .../api/v1/projects/actions/runs_controller.rb | 11 +++++++++++ config/routes/api.rb | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index 811fabc4..4e7d9d77 100644 --- a/Gemfile +++ b/Gemfile @@ -141,4 +141,4 @@ gem 'doorkeeper' gem 'doorkeeper-jwt' -gem 'gitea-client', '~> 1.5.7' +gem 'gitea-client', '~> 1.5.8' diff --git a/app/controllers/api/v1/projects/actions/runs_controller.rb b/app/controllers/api/v1/projects/actions/runs_controller.rb index ff7c28e8..9d0cdb8b 100644 --- a/app/controllers/api/v1/projects/actions/runs_controller.rb +++ b/app/controllers/api/v1/projects/actions/runs_controller.rb @@ -5,6 +5,17 @@ class Api::V1::Projects::Actions::RunsController < Api::V1::Projects::Actions::B puts @result_object end + def create + return render_error("请输入正确的流水线文件!") if params[:workflow].blank? + return render_error("请输入正确的分支!") if params[:ref].blank? + gitea_result = $gitea_hat_client.post_repos_actions_runs_by_owner_repo(@project&.owner&.login, @project&.identifier, {query: {workflow: params[:workflow], ref: params[:ref]}}) + if gitea_result + render_ok + else + ender_error("启动流水线任务失败") + end + end + def rerun return render_error("请输入正确的流水线记录ID!") if params[:run_id].blank? gitea_result = $gitea_hat_client.post_repos_actions_runs_rerun_by_owner_repo_run(@project&.owner&.login, @project&.identifier, params[:run_id]) rescue nil diff --git a/config/routes/api.rb b/config/routes/api.rb index 5f4691a2..fd01cc70 100644 --- a/config/routes/api.rb +++ b/config/routes/api.rb @@ -95,7 +95,7 @@ defaults format: :json do collection do post :disable post :enable - resources :runs, only: [:index] do + resources :runs, only: [:index, :create] do post '/jobs/:job', to: 'runs#job_show' post '/rerun', to: 'runs#rerun' post '/jobs/:job/rerun', to: 'runs#job_rerun' From f36a0f18ad492013297ac2a41f936b19c9040e48 Mon Sep 17 00:00:00 2001 From: yystopf Date: Fri, 12 Jul 2024 14:58:24 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E6=96=B0=E5=A2=9E=EF=BC=9A=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E5=88=97=E8=A1=A8=E8=BF=94=E5=9B=9E=E5=85=B7=E4=BD=93?= =?UTF-8?q?=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/organizations/projects/index.json.jbuilder | 1 + app/views/projects/_project_detail.json.jbuilder | 1 + 2 files changed, 2 insertions(+) diff --git a/app/views/organizations/projects/index.json.jbuilder b/app/views/organizations/projects/index.json.jbuilder index 5a4615fc..35096783 100644 --- a/app/views/organizations/projects/index.json.jbuilder +++ b/app/views/organizations/projects/index.json.jbuilder @@ -5,5 +5,6 @@ json.projects @projects.each do |project| json.type project.numerical_for_project_type json.praised project.praised_by?(current_user) json.last_update_time render_unix_time(project.updated_on) + json.full_last_update_time project.updated_on json.time_ago time_from_now(project.updated_on) end \ No newline at end of file diff --git a/app/views/projects/_project_detail.json.jbuilder b/app/views/projects/_project_detail.json.jbuilder index c5b071ab..59160822 100644 --- a/app/views/projects/_project_detail.json.jbuilder +++ b/app/views/projects/_project_detail.json.jbuilder @@ -13,6 +13,7 @@ json.is_public project.is_public json.mirror_url project.repository&.mirror_url json.type project&.numerical_for_project_type json.last_update_time render_unix_time(project.updated_on) +json.full_last_update_time project.updated_on json.time_ago time_from_now(project.updated_on) json.forked_from_project_id project.forked_from_project_id json.open_devops project.open_devops? From 785275c65b1c911793baf78be1d494017b65cad0 Mon Sep 17 00:00:00 2001 From: yystopf Date: Fri, 12 Jul 2024 15:30:02 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E6=9B=B4=E6=94=B9=EF=BC=9A=E5=90=8E?= =?UTF-8?q?=E5=8F=B0=E7=AE=A1=E7=90=86=E9=9A=90=E8=97=8F=E5=8D=A1=E7=89=87?= =?UTF-8?q?=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/admins/shared/_sidebar.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/admins/shared/_sidebar.html.erb b/app/views/admins/shared/_sidebar.html.erb index c238a3bc..7919b12d 100644 --- a/app/views/admins/shared/_sidebar.html.erb +++ b/app/views/admins/shared/_sidebar.html.erb @@ -50,7 +50,7 @@
  • <%= sidebar_item_group('#setting-index', '首页配置', icon: 'file', has_permission: current_user.admin? || current_user.business?) do %>
  • <%= sidebar_item(admins_topic_banners_path, 'banner管理', icon: 'image', controller: 'admins-topic-banners', has_permission: current_user.admin? || current_user.business?) %>
  • -
  • <%= sidebar_item(admins_topic_cards_path, '卡片管理', icon: 'archive', controller: 'admins-topic-cards', has_permission: current_user.admin? || current_user.business?) %>
  • +
  • <%= sidebar_item(admins_topic_activity_forums_path, '平台动态管理', icon: 'bell', controller: 'admins-topic-activity_forums', has_permission: current_user.admin? || current_user.business?) %>
  • <%= sidebar_item(admins_topic_excellent_projects_path, '优秀仓库管理', icon: 'git', controller: 'admins-topic-excellent_projects', has_permission: current_user.admin? || current_user.business?) %>
  • <%= sidebar_item(admins_topic_pinned_forums_path, '精选文章管理', icon: 'edit', controller: 'admins-topic-pinned_forums', has_permission: current_user.admin? || current_user.business?) %>