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/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?) %>
  • 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? 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? 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'