Display a glyph for official plugins.

This commit is contained in:
Guo Xiang Tan 2018-04-25 12:20:06 +08:00
parent 8f08c864d2
commit 1f686200bb
8 changed files with 61 additions and 26 deletions

View File

@ -51,7 +51,13 @@ module DockerManager
repos << DockerManager::GitRepo.new(File.dirname(p.path), p.name)
end
repos.map! do |r|
result = {name: r.name, path: r.path, branch: r.branch }
result = {
name: r.name,
path: r.path,
branch: r.branch,
official: Plugin::Metadata::OFFICIAL_PLUGINS.include?(r.name)
}
if r.valid?
result[:id] = r.name.downcase.gsub(/[^a-z]/, '_').gsub(/_+/, '_').sub(/_$/, '')
result[:version] = r.latest_local_commit

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -44,6 +44,15 @@ div.logs {
table#repos {
margin-top: 10px;
td:first-child {
width: 3%;
padding-left: 8px;
}
td {
padding: 8px 8px 8px 0px;
}
}
h3.loading {

View File

@ -1,3 +1,8 @@
<td>
{{#if repo.official}}
<span class="glyphicon glyphicon-check" title="Official Plugin"></span>
{{/if}}
</td>
<td>
{{repo.name}}
{{fmt-commit repo.version repo.url repo.branch}}

View File

@ -1,5 +1,6 @@
<table class='table' id='repos'>
<tr>
<th></th>
<th style='width: 50%'>Repository Name</th>
<th>Status</th>
</tr>

View File

@ -30,4 +30,18 @@ RSpec.describe DockerManager::AdminController do
expect(response.status).to eq(200)
end
end
describe '#repos' do
it 'should return the right response' do
sign_in(Fabricate(:admin))
get '/admin/docker/repos'
expect(response.status).to eq(200)
body = JSON.parse(response.body)
expect(body["repos"].first["official"]).to eq(false)
end
end
end