提交 e56ebc62 编写于 作者: K kzantow

Merge remote-tracking branch 'primary/2.0' into 2.0

# Conflicts:
#	core/src/main/resources/jenkins/install/pluginSetupWizard.properties
#	war/src/main/js/pluginSetupWizardGui.js
#	war/src/main/less/pluginSetupWizard.less
......@@ -47,3 +47,4 @@ installWizard_addFirstUser_title=Create an Admin User
installWizard_configureProxy_label=Configure Proxy
installWizard_configureProxy_save=Save and Continue
installWizard_skipPluginInstallations=Skip Plugin Installations
installWizard_installIncomplete_dependenciesLabel=Dependencies
......@@ -70,8 +70,16 @@ var createPluginSetupWizard = function(appendTarget) {
}
});
// get total number of dependencies
Handlebars.registerHelper('dependencyCount', function(plugName) {
var plug = availablePlugins[plugName];
if(plug && plug.allDependencies && plug.allDependencies.length > 1) { // includes self
return plug.allDependencies.length - 1;
}
});
// gets user friendly dependency text
Handlebars.registerHelper('dependencyText', function(plugName) {
Handlebars.registerHelper('eachDependency', function(plugName, options) {
var plug = availablePlugins[plugName];
if(!plug) {
return '';
......@@ -79,20 +87,25 @@ var createPluginSetupWizard = function(appendTarget) {
var deps = $.grep(plug.allDependencies, function(value) { // remove self
return value !== plugName;
});
var out = '';
var out = '';
for(var i = 0; i < deps.length; i++) {
if(i > 0) {
out += ', ';
}
var depName = deps[i];
var dep = availablePlugins[depName];
if(dep) {
out += dep.title;
out += options.fn(dep);
}
}
return out;
});
// executes a block if there are dependencies
Handlebars.registerHelper('ifVisibleDependency', function(plugName, options) {
if(visibleDependencies[plugName]) {
return options.fn();
}
});
// Include handlebars templates here - explicitly require them and they'll be available by hbsfy as part of the bundle process
var errorPanel = require('./templates/errorPanel.hbs');
var loadingPanel = require('./templates/loadingPanel.hbs');
......@@ -129,6 +142,7 @@ var createPluginSetupWizard = function(appendTarget) {
var pluginList = pluginManager.plugins();
var allPluginNames = pluginManager.pluginNames();
var selectedPluginNames = pluginManager.recommendedPluginNames();
var visibleDependencies = {};
var categories = [];
var availablePlugins = {};
var categorizedPlugins = {};
......@@ -277,6 +291,25 @@ var createPluginSetupWizard = function(appendTarget) {
setPanel(progressPanel, { installingPlugins : installingPlugins });
};
// toggles visibility of dependency listing for a plugin
var toggleDependencyList = function() {
var $btn = $(this);
var $toggle = $btn.parents('.plugin:first');
var plugName = $btn.attr('data-plugin-name');
if(!visibleDependencies[plugName]) {
visibleDependencies[plugName] = true;
}
else {
visibleDependencies[plugName] = false;
}
if(!visibleDependencies[plugName]) {
$toggle.removeClass('show-dependencies');
}
else {
$toggle.addClass('show-dependencies');
}
};
// install the default plugins
var installDefaultPlugins = function() {
......@@ -538,7 +571,7 @@ var createPluginSetupWizard = function(appendTarget) {
findIndex = (findIndex+1) % matches.length;
}
var $el = $(matches[findIndex]);
$el = $el.parents('label:first'); // scroll to the block
$el = $el.parents('.plugin:first'); // scroll to the block
if($el && $el.length > 0) {
var pos = $pl.scrollTop() + $el.position().top;
$pl.stop(true).animate({
......@@ -557,7 +590,7 @@ var createPluginSetupWizard = function(appendTarget) {
// search for given text, optionally scroll to the next match, set classes on appropriate elements from the search match
var searchForPlugins = function(text, scroll) {
var $pl = $('.plugin-list');
var $containers = $pl.find('label');
var $containers = $pl.find('.plugin');
// must always do this, as it's called after refreshing the panel (e.g. check/uncheck plugs)
$containers.removeClass('match');
......@@ -569,7 +602,7 @@ var createPluginSetupWizard = function(appendTarget) {
}
else {
var matches = findElementsWithText($pl[0], text.toLowerCase(), function(d) { return d.toLowerCase(); });
$(matches).parents('label').addClass('match');
$(matches).parents('.plugin').addClass('match');
if(lastSearch !== text && scroll) {
scrollPlugin($pl, matches, text);
}
......@@ -745,6 +778,7 @@ var createPluginSetupWizard = function(appendTarget) {
// click action mappings
var actions = {
'.toggle-dependency-list': toggleDependencyList,
'.install-recommended': installDefaultPlugins,
'.install-custom': loadCustomPluginPanel,
'.install-home': function() { setPanel(welcomePanel); },
......
......@@ -25,21 +25,36 @@
</span>
</div>
<div class="plugin-list">
<div class="plugin-list-description">{{{translations.installWizard_installCustom_pluginListDesc}}}</div>
<div class="plugin-list-description">{{{translations.installWizard_installCustom_pluginListDesc}}}</div>
{{#each categorizedPlugins}}
<h2 id="{{id @key}}" class="expanded">{{@key}} {{pluginCountForCategory @key}}</h2>
<div class="plugins-for-category">
{{#each this}}
<label class="{{#inSelectedPlugins plugin.name}}selected{{/inSelectedPlugins}}" id="row-{{plugin.name}}"
{{#hasDependencies plugin.name}}data-tooltip="{{../../../translations.installWizard_installCustom_dependenciesPrefix}}: {{dependencyText ../plugin.name}}"{{/hasDependencies}}>
<span class="title">
<input type="checkbox" id="chk-{{plugin.name}}" name="{{plugin.name}}" value="{{searchTerm}}" {{#inSelectedPlugins plugin.name}}checked="checked"{{/inSelectedPlugins}}/>
{{plugin.title}}
</span>
<span class="description">
{{{plugin.excerpt}}}
</span>
</label>
<div class="plugin {{#inSelectedPlugins plugin.name}}selected{{/inSelectedPlugins}} {{#ifVisibleDependency plugin.name}}show-dependencies{{/ifVisibleDependency}}" id="row-{{plugin.name}}">
{{#hasDependencies plugin.name}}
<div class="btn btn-link toggle-dependency-list" type="button" data-plugin-name="{{../plugin.name}}">
{{../../../translations.installWizard_installIncomplete_dependenciesLabel}}<span class="badge">{{dependencyCount ../plugin.name}}</span>
</div>
{{/hasDependencies}}
<label>
<span class="title">
<input type="checkbox" id="chk-{{plugin.name}}" name="{{plugin.name}}" value="{{searchTerm}}" {{#inSelectedPlugins plugin.name}}checked="checked"{{/inSelectedPlugins}}/>
{{plugin.title}}
</span>
<span class="description">
{{{plugin.excerpt}}}
</span>
{{#hasDependencies plugin.name}}
<div class="dep-list">
{{#eachDependency ../plugin.name}}
<span class="dep badge">
{{title}}
</span>
{{/eachDependency}}
</div>
{{/hasDependencies}}
</label>
</div>
{{/each}}
</div>
{{/each}}
......
......@@ -286,7 +286,7 @@
}
&.searching-with-transition {
label {
.plugin {
display: none;
transition: all .25s;
......@@ -316,7 +316,7 @@
}
&.searching {
label {
.plugin {
display: none;
transition: all .25s;
......@@ -336,6 +336,22 @@
}
}
.plugin {
position: relative;
&.selected label {
background: #dff0d8;
margin: 4px -7px;
padding: 6px 0 6px 26px;
border-radius: 2px;
border: 1px solid #C2E0A9;
color: #3c763d;
.dependencies {
color: #777;
}
}
label {
font-weight: normal;
padding: 7px 2px 7px 27px;
......@@ -346,16 +362,7 @@
&:hover{
background: rgba(100, 200, 255, 0.1);
box-shadow:inset 0 200px 200px -200px rgba(100, 200, 255, 0.33),inset 0 0 0 1px rgba(100, 200, 255, 0.33);
}
&.selected {
background: #dff0d8;
margin: 4px -7px;
padding: 6px 0 6px 26px;
border-radius: 2px;
border: 1px solid #C2E0A9;
color: #3c763d;
box-shadow:inset 0 400px 400px -100px rgba(100, 200, 255, 0.33), inset 0 0 0 1px rgba(100, 200, 255, 0.33);
}
.title {
......@@ -370,10 +377,6 @@
margin-top: .5em;
}
&.selected .dependencies {
color: #777;
}
input[type=checkbox] {
float: left;
margin: 2px -18px;
......@@ -395,6 +398,56 @@
}
}
}
.toggle-dependency-list {
position: absolute;
top: 0;
right: 0;
color: #777;
border: 0;
text-decoration: none;
padding: 5px 13px;
z-index: 100;
.badge {
margin-left: 7px;
}
&:hover, &.active {
text-decoration: underline;
}
}
.dep-list {
padding: 10px 0 6px 0;
display: none;
.badge {
padding: 4px 8px;
margin: 5px 3px 0 0;
}
}
&.show-dependencies {
.toggle-dependency-list:after {
content: '';
display: inline-block;
position: absolute;
top: 50%;
right: 100%;
width: 0;
height: 0;
border-left: 7px solid transparent;
border-right: 7px solid transparent;
border-top: 7px solid #999;
margin: -3px -3px 0 0;
}
.dep-list {
display: block;
}
}
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册