FEATURE: warn if running an old image
This commit is contained in:
parent
6230468aae
commit
f896b6d2da
|
@ -1,6 +1,8 @@
|
|||
module DockerManager
|
||||
class ApplicationController < ActionController::Base
|
||||
|
||||
helper DockerManager::ApplicationHelper
|
||||
|
||||
include CurrentUser
|
||||
|
||||
before_filter :ensure_admin
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
module DockerManager::ApplicationHelper
|
||||
def has_uglify_js
|
||||
@has_uglify_js ||= `which uglifyjs`.present?
|
||||
end
|
||||
end
|
|
@ -8,6 +8,10 @@
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="docker-manager/config/environment" content="%7B%22modulePrefix%22%3A%22docker-manager%22%2C%22environment%22%3A%22production%22%2C%22baseURL%22%3A%22/%22%2C%22locationType%22%3A%22hash%22%2C%22EmberENV%22%3A%7B%22FEATURES%22%3A%7B%7D%7D%2C%22contentSecurityPolicy%22%3A%7B%22style-src%22%3A%22%27self%27%20%27unsafe-inline%27%22%2C%22default-src%22%3A%22%27none%27%22%2C%22script-src%22%3A%22%27self%27%22%2C%22font-src%22%3A%22%27self%27%22%2C%22connect-src%22%3A%22%27self%27%22%2C%22img-src%22%3A%22%27self%27%22%2C%22media-src%22%3A%22%27self%27%22%7D%2C%22APP%22%3A%7B%7D%2C%22contentSecurityPolicyHeader%22%3A%22Content-Security-Policy-Report-Only%22%2C%22exportApplicationGlobal%22%3Afalse%7D">
|
||||
|
||||
<script>
|
||||
window.Discourse = { hasUglifyjs: <%= has_uglify_js %> };
|
||||
</script>
|
||||
|
||||
<%= javascript_include_tag "docker-manager-vendor" %>
|
||||
<%= javascript_include_tag "docker-manager-app" %>
|
||||
<%= stylesheet_link_tag "docker-manager-app" %>
|
||||
|
|
|
@ -1,11 +1,26 @@
|
|||
import Ember from 'ember';
|
||||
import Ember from "ember";
|
||||
|
||||
export default Ember.ObjectController.extend({
|
||||
showBanner: false,
|
||||
showBanner: function(){
|
||||
if(this.get("bannerDismissed")){
|
||||
return false;
|
||||
}
|
||||
|
||||
var banner = this.get("banner");
|
||||
return banner && banner.length > 0;
|
||||
}.property("banner", "bannerDismissed", "banner.@each"),
|
||||
|
||||
appendBannerHtml: function(html){
|
||||
var banner = this.get("banner") || [];
|
||||
if(banner.indexOf(html) === -1){
|
||||
banner.push(html);
|
||||
}
|
||||
this.set("banner", banner);
|
||||
},
|
||||
|
||||
actions: {
|
||||
dismiss: function () {
|
||||
this.set("showBanner", false);
|
||||
this.set("bannerDismissed", true);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -8,8 +8,14 @@ export default Ember.Route.extend({
|
|||
|
||||
setupController: function(controller, model) {
|
||||
var self = this;
|
||||
var applicationController = self.controllerFor('application');
|
||||
|
||||
controller.setProperties({ model: model, upgrading: null });
|
||||
|
||||
if(!window.Discourse.hasUglify){
|
||||
applicationController.appendBannerHtml("<b>WARNING:</b> You are running an old Docker image, <a href='https://meta.discourse.org/t/how-do-i-update-my-docker-image-to-latest/23325'>please upgrade</a>.");
|
||||
}
|
||||
|
||||
model.forEach(function(repo) {
|
||||
repo.findLatest();
|
||||
if (repo.get('upgrading')) {
|
||||
|
@ -23,7 +29,7 @@ export default Ember.Route.extend({
|
|||
|
||||
// Special case: If the branch is "master" warn user
|
||||
if (repo.get('id') === 'discourse' && repo.get('branch') === 'origin/master') {
|
||||
self.controllerFor('application').set('showBanner', true);
|
||||
applicationController.appendBannerHtml("<b>WARNING:</b> Your Discourse is tracking the 'master' branch which may be unstable, <a href='https://meta.discourse.org/t/change-tracking-branch-for-your-discourse-instance/17014'>we recommend tracking the 'tests-passed' branch</a>.");
|
||||
}
|
||||
|
||||
});
|
||||
|
|
|
@ -9,7 +9,9 @@
|
|||
<div id="banner">
|
||||
<div id="banner-content">
|
||||
<div class="close" {{action "dismiss"}}><i class="fa fa-times" title="Dismiss this banner."></i></div>
|
||||
<p><b>WARNING:</b> Your Discourse is tracking the 'master' branch which may be unstable, <a href="https://meta.discourse.org/t/change-tracking-branch-for-your-discourse-instance/17014">we recommend tracking the 'tests-passed' branch</a>.</p>
|
||||
{{#each row in banner}}
|
||||
<p>{{{row}}}</p>
|
||||
{{/each}}
|
||||
</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
# name: docker_manager
|
||||
# about: Docker manager for Discourse image
|
||||
# version: 0.1
|
||||
# authors: Sam Saffron
|
||||
# authors: Robin Ward, Sam Saffron
|
||||
|
||||
|
||||
module ::DockerManager
|
||||
# should be automatic, but something is weird
|
||||
load File.expand_path(File.dirname(__FILE__)) << '/app/helpers/application_helper.rb'
|
||||
class Engine < ::Rails::Engine
|
||||
engine_name "docker_manager"
|
||||
isolate_namespace DockerManager
|
||||
|
|
Loading…
Reference in New Issue