Ember upgrade to 3.6.1 (#49)

Ember upgrade to 3.6.1 (#49)

  • Ember upgrade to 3.6.1

  • ember-ajax printing deprecations; stop using it

  • Use tag versions when possible instead of hashes

  • Remove inline scripts for CSP

  • dump git describe errors

  • Commit hashes still needed for github diff link

  • Update READMEs

  • Production build

  • Make repo-status component more isolated

  • Minor tweaks

  • Get JS tests in a working state, and write tests for repo-status component

  • Add a note about tests in README

  • Apply Prettier

  • Production build #2

  • We need vendor/message-bus.js

diff --git a/.gitignore b/.gitignore
index 9777706..169014e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,4 @@
 *.swp
-manager-client/vendor/*
 *.sublime-workspace
 .DS_Store
 ._.DS_Store
diff --git a/README.md b/README.md
index 71e4794..afa9d95 100644
--- a/README.md
+++ b/README.md
@@ -4,9 +4,9 @@ This plugin works with the Discourse docker image. It allows you to perform upgr
 
 ## Development Notes
 
-* Install `node.js`, `bower`, `grunt`
+* Install `node.js` and `yarn`
 * Clone this repo to desired folder path
-* In console, from folder path do `cd manager-client`, `npm install`, `bower install`
+* In console, from folder path do `cd manager-client`, `yarn install`
 * Create a symlink for this folder in your local Discourse instance "plugins" folder (eg. `path/to/your/discourse_folder/plugins/discourse_manager`)
 * Make sure your Discourse instance is running locally at port 3000 and you are logged in as Admin
 
@@ -14,9 +14,9 @@ This plugin works with the Discourse docker image. It allows you to perform upgr
 
 * Install the client app dependencies:
   * `cd manager-client`
-  * `npm install`
-  * `bower install`
-* Use `ember server --proxy "http://localhost:3000"` to proxy to your Discourse instance running on port 3000
+  * `yarn install`
+* Make sure your local Discourse instance is running at port 3000
+* Run `./dev_server` which will run ember server for you with proxy to your local Discourse instance
   * If that gives errors, you may need to start your Discourse rails server like this: `bundle exec rails s -b 127.0.0.1`
 * JUST open up a browser to port 4200 and you're off to the races!
 
@@ -25,6 +25,15 @@ The client application is built using [Ember CLI](http://www.ember-cli.com/).
 To create a compiled version for distribution, run `./compile_client.sh` to compile the site and
 move it into the proper directories.
 
+## Running tests
+
+* Ruby
+  * Run `RAILS_ENV=test bundle exec rake plugin:spec[docker_manager]` in your discourse directory.
+
+* JS Tests
+  * Run `ember s` in the `/manager-client` directory
+  * Open up your favorite browser and head to `http://localhost:4200/tests`and you should see all passing/failing tests
+
 ## Contributing
 
 1. Fork it
diff --git a/app/controllers/docker_manager/admin_controller.rb b/app/controllers/docker_manager/admin_controller.rb
index 92e74be..46cfaeb 100644
--- a/app/controllers/docker_manager/admin_controller.rb
+++ b/app/controllers/docker_manager/admin_controller.rb
@@ -35,6 +35,7 @@ module DockerManager
         if r.valid?
           result[:id] = r.name.downcase.gsub(/[^a-z]/, '_').gsub(/_+/, '_').sub(/_$/, '')
           result[:version] = r.latest_local_commit
+          result[:pretty_version] = r.latest_local_tag_version.presence
           result[:url] = r.url
           if r.upgrading?
             result[:upgrading] = true
@@ -61,6 +62,7 @@ module DockerManager
         {
           path: repo.path,
           version: repo.latest_origin_commit,
+          pretty_version: repo.latest_origin_tag_version.presence,
           commits_behind: repo.commits_behind,
           date: repo.latest_origin_commit_date
         }
diff --git a/app/views/docker_manager/admin/index.html.erb b/app/views/docker_manager/admin/index.html.erb
index 933bbad..8eeddc8 100644
--- a/app/views/docker_manager/admin/index.html.erb
+++ b/app/views/docker_manager/admin/index.html.erb
@@ -7,25 +7,7 @@
   <meta name="description" content="">
   <meta name="viewport" content="width=device-width, initial-scale=1">
   <meta name="manager-client/config/environment" content="%7B%22modulePrefix%22%3A%22manager-client%22%2C%22environment%22%3A%22development%22%2C%22rootURL%22%3A%22/%22%2C%22locationType%22%3A%22hash%22%2C%22EmberENV%22%3A%7B%22FEATURES%22%3A%7B%7D%2C%22EXTEND_PROTOTYPES%22%3A%7B%22Date%22%3Afalse%7D%7D%2C%22APP%22%3A%7B%22name%22%3A%22manager-client%22%2C%22version%22%3A%220.0.0+cfc32897%22%7D%2C%22exportApplicationGlobal%22%3Atrue%7D" />
-
-  <script>
-    window.Discourse = {
-      rootUrl: '<%= discourse_root_url %>',
-      longPollingBaseUrl: '<%= long_polling_base_url %>',
-
-      getURL: function(url) {
-        if (!url) return url;
-
-        // if it's a non relative URL, return it.
-        if (url !== '/' && !/^\/[^\/]/.test(url)) return url;
-
-        if (url.indexOf(Discourse.rootUrl) !== -1) return url;
-        if (url[0] !== "/") url = "/" + url;
-
-        return Discourse.rootUrl + url;
-      }
-    };
-  </script>
+  <meta id="preloaded-data" data-preload="<%= { rootUrl: discourse_root_url, longPollingBaseUrl: long_polling_base_url }.to_json %>">
 
   <%= javascript_include_tag "docker-manager-vendor" %>
   <%= javascript_include_tag "docker-manager-app" %>
diff --git a/assets/docker-manager-app.css b/assets/docker-manager-app.css
index b6709d5..2b460ca 100644
--- a/assets/docker-manager-app.css
+++ b/assets/docker-manager-app.css
@@ -1,6 +1,6 @@
-/*!
+@charset "UTF-8";/*!
  * Bootstrap v4.1.1 (https://getbootstrap.com/)
  * Copyright 2011-2018 The Bootstrap Authors
  * Copyright 2011-2018 Twitter, Inc.
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)

[... diff too long, it was truncated ...]

GitHub sha: 13099552

1 Like

@OsamaSayegh when you free up can you upgrade again to 3.8?

2 Likes

I didn’t notice any issues with this change locally; I clicked around on the site and performed an upgrade and I didn’t see any errors or deprecations in the console.

1 Like