register trial Fuel version

Change-Id: I01d5dab680dd85d798bbb677478ae1eac0b9a085
This commit is contained in:
Alexandra Stepanchuk 2014-04-17 17:36:08 +03:00
parent 0b10ed5fae
commit 843174fb4f
7 changed files with 78 additions and 17 deletions

View File

@ -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;

View File

@ -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": {

View File

@ -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');
},

View File

@ -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'

View File

@ -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;
});

View File

@ -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();

View File

@ -0,0 +1,6 @@
<div class="alert alert-info alert-dismissable register-trial">
<button type="button" class="close" aria-hidden="true">&times;</button>
<p>
<%- $.t('clusters_page.register_trial_message_click') %><a target="_blank" class="registration-link" href=""><%- $.t('clusters_page.register_trial_link_label') %></a><%- $.t('clusters_page.register_trial_message_close') %>
</p>
</div>