Merge branch 'standalone_develop' of https://gitlink.org.cn/Trustie/forgeplus into standalone_develop
This commit is contained in:
commit
8a46bb263b
|
@ -2,7 +2,7 @@ class Admins::NpsController < Admins::BaseController
|
|||
before_action :require_business
|
||||
def index
|
||||
@on_off_switch = EduSetting.get("nps-on-off-switch").to_s == 'true'
|
||||
@user_nps = UserNp.joins(:user).order(created_at: :desc)
|
||||
@user_nps = UserNp.order(created_at: :desc)
|
||||
keyword = params[:keyword].to_s.strip.presence
|
||||
if keyword
|
||||
sql = 'CONCAT(users.lastname, users.firstname) LIKE :keyword OR users.nickname LIKE :keyword OR users.login LIKE :keyword OR users.mail LIKE :keyword OR users.phone LIKE :keyword'
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
class Api::Pm::ActionRunsController < Api::Pm::BaseController
|
||||
before_action :require_login
|
||||
|
||||
def index
|
||||
render_error('请输入workflows') if params[:workflows].blank?
|
||||
@owner = Owner.find_by(login: params[:owner_id].to_s) || Owner.find_by(id: params[:owner_id].to_s)
|
||||
render_error('组织未找到') if @owner.blank?
|
||||
action_runs = Gitea::ActionRun.where(owner_id: @owner.gitea_uid)
|
||||
group_data = action_runs.where(workflow_id: params[:workflows].to_s.split(",")).group(:workflow_id, :status).count
|
||||
@result = []
|
||||
params[:workflows].to_s.split(",").each do |file|
|
||||
last_action_run = action_runs.where(workflow_id: file).order(updated: :desc).first
|
||||
last_action_run_json = last_action_run.present? ? {
|
||||
id: last_action_run.id,
|
||||
schedule: last_action_run.schedule_id > 0,
|
||||
title: last_action_run.title,
|
||||
index: last_action_run.index,
|
||||
status: last_action_run.status,
|
||||
started: last_action_run.started,
|
||||
stopped: last_action_run.stopped,
|
||||
length: last_action_run.stopped - last_action_run.started,
|
||||
created: last_action_run.created,
|
||||
updated: last_action_run.updated,
|
||||
} : {}
|
||||
|
||||
total = 0
|
||||
success = 0
|
||||
failure = 0
|
||||
group_data.each do |k,v|
|
||||
total += v if k[0] == file
|
||||
success += v if k[0] == file && k[1] == 1
|
||||
failure += v if k[0] == file && k[1] == 2
|
||||
end
|
||||
|
||||
@result << {
|
||||
name: file,
|
||||
last_action_run: last_action_run_json,
|
||||
history: {
|
||||
total: total,
|
||||
success: success,
|
||||
failure: failure
|
||||
}
|
||||
}
|
||||
end
|
||||
render :json => @result
|
||||
end
|
||||
|
||||
end
|
|
@ -2,7 +2,7 @@ class Api::V1::Projects::Actions::ActionsController < Api::V1::Projects::Actions
|
|||
|
||||
def new_index
|
||||
@files = $gitea_client.get_repos_contents_by_owner_repo_filepath(@project&.owner&.login, @project&.identifier, ".gitea/workflows")
|
||||
@action_runs = Gitea::ActionRun.where(repo_id: @project.gpid, status: [1,2])
|
||||
@action_runs = Gitea::ActionRun.where(repo_id: @project.gpid)
|
||||
@action_runs = @action_runs.where(id: params[:ids].split(",")) if params[:ids].present?
|
||||
@action_runs = @action_runs.where(workflow_id: params[:workflow_ids].split(",")) if params[:workflow_ids].present?
|
||||
group_data = @action_runs.group(:workflow_id, :status).count
|
||||
|
|
|
@ -12,15 +12,15 @@
|
|||
<tbody>
|
||||
<% if user_nps.present? %>
|
||||
<% user_nps.each_with_index do |nps, index| %>
|
||||
<tr class="user-item-<%= nps.user.id %>">
|
||||
<tr class="user-item-<%= nps.user.nil? ? "用户已注销" : nps.user.id %>">
|
||||
<td><%= list_index_no((params[:page] || 1).to_i, index) %></td>
|
||||
<td class="text-left">
|
||||
<%= link_to "/#{nps.user.login}", target: '_blank' do %>
|
||||
<%= overflow_hidden_span nps.user.real_name, width: 100 %>
|
||||
<%= link_to "/#{nps.user.nil? ? "用户已注销" : nps.user.login}", target: '_blank' do %>
|
||||
<%= overflow_hidden_span (nps.user.nil? ? "用户已注销" : nps.user.real_name), width: 100 %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td><%= display_text(nps.created_at&.strftime('%Y-%m-%d %H:%M')) %></td>
|
||||
<td><%= display_text(nps.user.last_login_on&.strftime('%Y-%m-%d %H:%M')) %></td>
|
||||
<td><%= display_text(nps.user.nil? ? "用户已注销" : nps.user.last_login_on&.strftime('%Y-%m-%d %H:%M')) %></td>
|
||||
<td><%= nps.action_type == 'close' ? '--' : nps.score %></td>
|
||||
<td><%= nps.memo %></td>
|
||||
</tr>
|
||||
|
|
|
@ -50,6 +50,7 @@ defaults format: :json do
|
|||
get :polyline
|
||||
end
|
||||
end
|
||||
resources :action_runs, only: [:index]
|
||||
end
|
||||
|
||||
namespace :v1 do
|
||||
|
|
Loading…
Reference in New Issue