Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEATURE: Add indicator if plugin is official but forked #96

Merged
merged 1 commit into from
Mar 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/controllers/docker_manager/admin_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ def repos
official: Plugin::Metadata::OFFICIAL_PLUGINS.include?(r.name)
}

result[:fork] = true if result[:official] && !r.url.starts_with?("https://github.com/discourse/")

if r.valid?
result[:id] = r.name.downcase.gsub(/[^a-z]/, '_').gsub(/_+/, '_').sub(/_$/, '')
result[:version] = r.latest_local_commit
Expand Down
2 changes: 1 addition & 1 deletion assets/docker-manager-app.css

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions assets/docker-manager-app.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 20 additions & 9 deletions manager-client/app/components/repo-status.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default Component.extend({
"repo",
"managerRepo",
"managerRepo.upToDate",
function() {
function () {
const upgradingRepo = this.get("upgradingRepo");

if (!upgradingRepo) {
Expand All @@ -26,18 +26,29 @@ export default Component.extend({
}
),

officialRepoImageSrc: computed("repo.official", function() {
if (!this.get("repo.official")) {
return;
officialRepoImageSrc: computed("repo.official", function () {
if (this.get("repo.fork")) {
return Discourse.getAppURL(
"/plugins/docker_manager/images/font-awesome-exclamation-circle.png"
);
} else if (this.get("repo.official")) {
return Discourse.getAppURL(
"/plugins/docker_manager/images/font-awesome-check-circle.png"
);
}
}),

officialRepoImageTitle: computed("repo.official", function () {
if (this.get("repo.fork")) {
return "Forked Official Plugin";
} else if (this.get("repo.official")) {
return "Official Plugin";
}
return Discourse.getAppURL(
"/plugins/docker_manager/images/font-awesome-check-circle.png"
);
}),

actions: {
upgrade() {
this.get("router").transitionTo("upgrade", this.get("repo"));
}
}
},
},
});
4 changes: 2 additions & 2 deletions manager-client/app/templates/components/repo-status.hbs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<td>
{{#if repo.official}}
<img class="check-circle" src={{officialRepoImageSrc}} alt="Official Plugin" title="Official Plugin">
{{#if officialRepoImageSrc}}
<img class="check-circle" src={{officialRepoImageSrc}} alt={{officialRepoImageTitle}} title={{officialRepoImageTitle}}>
{{/if}}
</td>
<td>
Expand Down
Binary file added public/images/font-awesome-exclamation-circle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.