diff --git a/nailgun/static/css/styles.less b/nailgun/static/css/styles.less index 46f9fc6ec8..0bc8799710 100755 --- a/nailgun/static/css/styles.less +++ b/nailgun/static/css/styles.less @@ -382,6 +382,16 @@ label {cursor: default;} .action-btn {margin-top: 7px;} } +#content .register-trial { + margin-bottom: 0px; + p { + margin: 0px; + } + a { + text-decoration: underline; + } +} + // Footer // ------------------------- .container, @@ -1820,7 +1830,7 @@ label.error { background-image: none; text-decoration: none; .box-shadow-mixin(inset 0 1px 0px rgba(255, 255, 255, 0)); - filter: alpha(opacity=65); + filter: alpha(opacity=65); &:hover { background: none; } } } @@ -2342,7 +2352,7 @@ input.error:focus { margin: -6px 20px 8px 46px; } -legend { +legend { &.openstack-settings, &.networks { display: block; margin-bottom: 15px; @@ -2356,10 +2366,10 @@ legend { .box-sizing-mixin; .font-layout-mixin(@font-size-base + 4, @font-color-dark, null, null, 18px); .box-sizing-mixin; - } + } &.openstack-sub-title { .font-layout-mixin(@font-size-big-1, null, null, null, 30px); - margin: 25px 0px 6px 14px; + margin: 25px 0px 6px 14px; } .toggleable { font-size: @font-size-base + 4; diff --git a/nailgun/static/i18n/translation.json b/nailgun/static/i18n/translation.json index 151270c59d..27d710df7b 100755 --- a/nailgun/static/i18n/translation.json +++ b/nailgun/static/i18n/translation.json @@ -96,7 +96,7 @@ "irc_text": "If you have any questions, you can also reach out to developers on the IRC channel", "log_text": "If you have encountered some bugs or errors, you may also need to provide the support team with deployment and operational logs. You can download them all at once by clicking the button below.", "contact_support": "Contact Support", - "register_fuel_title": "Register Fuel", + "register_fuel_title": "Register product", "register_fuel_content": "Registering will ensure that you receive important notifications about issues and new versions of Mirantis products. In addition, you will receive complementary access to our basic support services for the next 30 days!", "download_diagnostic_snapshot_text": "Download Diagnostic Snapshot", "gen_logs_snapshot_text": "Generating logs snapshot...", @@ -128,7 +128,10 @@ "cluster_hardware_nodes": "Nodes", "cluster_hardware_cpu": "CPU (cores)", "cluster_hardware_hdd": "HDD", - "cluster_hardware_ram": "RAM" + "cluster_hardware_ram": "RAM", + "register_trial_message_click": "Master node installation completed successfully. If you want to register your installation and sign up for trial support, please click ", + "register_trial_link_label": "here", + "register_trial_message_close": ". Otherwise you can close this panel." }, "cluster_page": { "tabs": { diff --git a/nailgun/static/js/app.js b/nailgun/static/js/app.js index bb434a3543..c1682b7dc3 100644 --- a/nailgun/static/js/app.js +++ b/nailgun/static/js/app.js @@ -42,6 +42,8 @@ function(Coccyx, coccyxMixins, models, commonViews, ClusterPage, NodesTab, Clust '*default': 'listClusters' }, initialize: function() { + this.version = new models.FuelVersion(); + this.version.fetch(); this.content = $('#content'); this.navbar = new commonViews.Navbar({elements: [ ['environments', '#clusters'], @@ -51,7 +53,7 @@ function(Coccyx, coccyxMixins, models, commonViews, ClusterPage, NodesTab, Clust this.content.before(this.navbar.render().el); this.breadcrumbs = new commonViews.Breadcrumbs(); this.content.before(this.breadcrumbs.render().el); - this.footer = new commonViews.Footer(); + this.footer = new commonViews.Footer({version: this.version}); $('#footer').html(this.footer.render().el); this.content.find('.loading').addClass('layout-loaded'); }, diff --git a/nailgun/static/js/models.js b/nailgun/static/js/models.js index e0e610f26c..b6f0aa313c 100644 --- a/nailgun/static/js/models.js +++ b/nailgun/static/js/models.js @@ -728,6 +728,11 @@ define(['utils', 'deepModel'], function(utils) { urlRoot: '/api/registration/key' }); + models.FuelVersion = Backbone.Model.extend({ + constructorName: 'FuelVersion', + urlRoot: '/api/version' + }); + models.LogsPackage = Backbone.Model.extend({ constructorName: 'LogsPackage', urlRoot: '/api/logs/package' diff --git a/nailgun/static/js/views/clusters_page.js b/nailgun/static/js/views/clusters_page.js index 88f8911b2e..148c078f5f 100644 --- a/nailgun/static/js/views/clusters_page.js +++ b/nailgun/static/js/views/clusters_page.js @@ -21,11 +21,12 @@ define( 'views/dialogs', 'text!templates/clusters/page.html', 'text!templates/clusters/cluster.html', - 'text!templates/clusters/new.html' + 'text!templates/clusters/new.html', + 'text!templates/clusters/register_trial.html' ], -function(models, utils, commonViews, dialogViews, clustersPageTemplate, clusterTemplate, newClusterTemplate) { +function(models, utils, commonViews, dialogViews, clustersPageTemplate, clusterTemplate, newClusterTemplate, registerTrialTemplate) { 'use strict'; - var ClustersPage, ClusterList, Cluster; + var ClustersPage, ClusterList, Cluster, RegisterTrial; ClustersPage = commonViews.Page.extend({ navbarActiveElement: 'clusters', @@ -39,6 +40,9 @@ function(models, utils, commonViews, dialogViews, clustersPageTemplate, clusterT var clustersView = new ClusterList({collection: this.collection}); this.registerSubView(clustersView); this.$('.cluster-list').html(clustersView.render().el); + var registerTrialView = new RegisterTrial(); + this.registerSubView(registerTrialView); + this.$('.page-title').before(registerTrialView.render().el); return this; } }); @@ -137,5 +141,38 @@ function(models, utils, commonViews, dialogViews, clustersPageTemplate, clusterT } }); + RegisterTrial = Backbone.View.extend({ + template: _.template(registerTrialTemplate), + events: { + 'click .register-trial .close': 'closeTrialWarning' + }, + bindings: { + '.registration-link': { + attributes: [{ + name: 'href', + observe: 'key', + onGet: function(value) { + return !_.isUndefined(value) ? 'http://fuel.mirantis.com/create-subscriber/?key=' + value : '/'; + } + }] + } + }, + initialize: function() { + this.fuelKey = new models.FuelKey(); + this.fuelKey.fetch(); + app.version.on('sync', this.render, this); + }, + closeTrialWarning: function() { + localStorage.setItem('trialRemoved', 'true'); + this.remove(); + }, + render: function() { + if (app.version.get('mirantis') == 'yes' && !localStorage.trialRemoved) { + this.$el.html(this.template()).i18n(); + this.stickit(this.fuelKey); + } + return this; + } + }); return ClustersPage; }); diff --git a/nailgun/static/js/views/common.js b/nailgun/static/js/views/common.js index 85500926a4..beef229afe 100644 --- a/nailgun/static/js/views/common.js +++ b/nailgun/static/js/views/common.js @@ -266,16 +266,14 @@ function(utils, models, dialogViews, navbarTemplate, nodesStatsTemplate, notific initialize: function(options) { this.locales = this.getAvailableLocales(); this.setDefaultLocale(); - $.ajax({url: '/api/version'}).done(_.bind(function(data) { - this.version = data.release; - this.isMirantis = data.mirantis == "yes"; - this.render(); - }, this)); + this.version = options.version; + this.version.on('sync', this.render, this); + this.render(); }, render: function() { this.$el.html(this.template({ - version: this.version, - isMirantis: this.isMirantis, + version: this.version.get('release'), + isMirantis: this.version.get('mirantis') == "yes", locales: this.locales, currentLocale: this.getCurrentLocale() })).i18n(); diff --git a/nailgun/static/templates/clusters/register_trial.html b/nailgun/static/templates/clusters/register_trial.html new file mode 100644 index 0000000000..20dcc8340c --- /dev/null +++ b/nailgun/static/templates/clusters/register_trial.html @@ -0,0 +1,6 @@ +
+ +

+ <%- $.t('clusters_page.register_trial_message_click') %><%- $.t('clusters_page.register_trial_link_label') %><%- $.t('clusters_page.register_trial_message_close') %> +

+
\ No newline at end of file