improve layout of import wizard

This commit is contained in:
Sebastian Sdorra
2014-11-28 13:58:18 +01:00
parent 054ea07a34
commit c5bb3c70b6
5 changed files with 157 additions and 18 deletions

View File

@@ -77,6 +77,7 @@
<!-- sonia.util --> <!-- sonia.util -->
<script type="text/javascript" src="resources/js/util/sonia.util.js"></script> <script type="text/javascript" src="resources/js/util/sonia.util.js"></script>
<script type="text/javascript" src="resources/js/util/sonia.util.link.js"></script> <script type="text/javascript" src="resources/js/util/sonia.util.link.js"></script>
<script type="text/javascript" src="resources/js/util/sonia.util.tip.js"></script>
<!-- sonia.override --> <!-- sonia.override -->
<script type="text/javascript" src="resources/js/override/ext.form.vtypes.js"></script> <script type="text/javascript" src="resources/js/override/ext.form.vtypes.js"></script>

View File

@@ -105,6 +105,11 @@ a.scm-link:hover {
margin-left: 2px; margin-left: 2px;
} }
.scm-form-fileupload-help-button {
position: absolute;
right: -19px;
}
.scm-nav-item { .scm-nav-item {
cursor: pointer; cursor: pointer;
} }
@@ -238,3 +243,12 @@ div.noscript-container h1 {
.unhealthy { .unhealthy {
color: red; color: red;
} }
/** import **/
.import-fu {
margin-right: 24px;
}
.import-fu input {
width: 215px;
}

View File

@@ -77,6 +77,9 @@ Ext.override(Ext.form.Field, {
cls = 'scm-form-combo-help-button'; cls = 'scm-form-combo-help-button';
} }
break; break;
case 'fileuploadfield':
cls = 'scm-form-fileupload-help-button';
break;
case 'textarea': case 'textarea':
cls = 'scm-form-textarea-help-button'; cls = 'scm-form-textarea-help-button';
break; break;

View File

@@ -41,7 +41,7 @@ Sonia.repository.ImportWindow = Ext.extend(Ext.Window,{
title: this.title, title: this.title,
layout: 'fit', layout: 'fit',
width: 420, width: 420,
height: 140, height: 190,
closable: true, closable: true,
resizable: true, resizable: true,
plain: true, plain: true,
@@ -85,6 +85,21 @@ Sonia.repository.ImportPanel = Ext.extend(Ext.Panel, {
importJobsFinished: 0, importJobsFinished: 0,
importJobs: 0, importJobs: 0,
// help text
importTypeDirectoryHelpText: 'Imports all repositories that are located at the repository folder of SCM-Manager.',
importTypeURLHelpText: 'Imports a repository from a remote url.',
importTypeFileHelpText: 'Imports a repository from a file (e.g. SVN dump).',
importUrlNameHelpText: 'The name of the repository in SCM-Manager.',
importUrlHelpText: 'The source url of the repository.',
importFileNameHelpText: 'The name of the repository in SCM-Manager.',
importFileHelpText: 'Choose the dump file you want to import to SCM-Manager.',
// tips
tipRepositoryType: 'Choose your repository type for the import.',
tipImportType: 'Select the type of import. <b>Note:</b> Not all repository types support all options.',
// settings // settings
repositoryType: null, repositoryType: null,
@@ -108,11 +123,10 @@ Sonia.repository.ImportPanel = Ext.extend(Ext.Panel, {
] ]
}); });
var types = []; var typeItems = [];
Ext.each(state.repositoryTypes, function(repositoryType){ Ext.each(state.repositoryTypes, function(repositoryType){
console.log(repositoryType); typeItems.push({
types.push({
boxLabel: repositoryType.displayName, boxLabel: repositoryType.displayName,
name: 'repositoryType', name: 'repositoryType',
inputValue: repositoryType.name, inputValue: repositoryType.name,
@@ -120,6 +134,16 @@ Sonia.repository.ImportPanel = Ext.extend(Ext.Panel, {
}); });
}); });
typeItems = typeItems.sort(function(a, b){
return a.boxLabel > b.boxLabel;
});
typeItems.push({
xtype: 'scmTip',
content: this.tipRepositoryType,
width: '100%'
});
var config = { var config = {
layout: 'card', layout: 'card',
activeItem: 0, activeItem: 0,
@@ -156,7 +180,7 @@ Sonia.repository.ImportPanel = Ext.extend(Ext.Panel, {
xtype: 'radiogroup', xtype: 'radiogroup',
name: 'chooseRepositoryType', name: 'chooseRepositoryType',
columns: 1, columns: 1,
items: [types], items: [typeItems],
listeners: { listeners: {
change: function(){ change: function(){
Ext.getCmp('move-next').setDisabled(false); Ext.getCmp('move-next').setDisabled(false);
@@ -175,21 +199,28 @@ Sonia.repository.ImportPanel = Ext.extend(Ext.Panel, {
boxLabel: 'Import from directory', boxLabel: 'Import from directory',
name: 'importType', name: 'importType',
inputValue: 'directory', inputValue: 'directory',
disabled: false disabled: false,
helpText: this.importTypeDirectoryHelpText
},{ },{
id: 'importTypeURL', id: 'importTypeURL',
boxLabel: 'Import from URL', boxLabel: 'Import from url',
name: 'importType', name: 'importType',
inputValue: 'url', inputValue: 'url',
checked: false, checked: false,
disabled: true disabled: true,
helpText: this.importTypeURLHelpText
},{ },{
id: 'importTypeFile', id: 'importTypeFile',
boxLabel: 'Import from File', boxLabel: 'Import from file',
name: 'importType', name: 'importType',
inputValue: 'file', inputValue: 'file',
checked: false, checked: false,
disabled: true disabled: true,
helpText: this.importTypeFileHelpText
},{
xtype: 'scmTip',
content: this.tipImportType,
width: '100%'
}], }],
listeners: { listeners: {
change: function(){ change: function(){
@@ -209,33 +240,46 @@ Sonia.repository.ImportPanel = Ext.extend(Ext.Panel, {
fieldLabel: 'Repository name', fieldLabel: 'Repository name',
name: 'importUrlName', name: 'importUrlName',
type: 'textfield', type: 'textfield',
disabled: false disabled: false,
helpText: this.importUrlNameHelpText
},{ },{
id: 'importUrl', id: 'importUrl',
xtype: 'textfield', xtype: 'textfield',
fieldLabel: 'Import URL', fieldLabel: 'Import URL',
name: 'importUrl', name: 'importUrl',
disabled: false disabled: false,
helpText: this.importUrlHelpText
},{
xtype: 'scmTip',
content: 'Please insert name and remote url of the repository.',
width: '100%'
}] }]
},{ },{
id: 'importFileLayout', id: 'importFileLayout',
layout: 'form', layout: 'form',
defaults: {
width: 250
},
items: [{ items: [{
id: 'importFileName', id: 'importFileName',
xtype: 'textfield', xtype: 'textfield',
fieldLabel: 'Repository name', fieldLabel: 'Repository name',
name: 'importFileName', name: 'importFileName',
type: 'textfield', type: 'textfield',
disabled: false width: 250,
helpText: this.importFileNameHelpText
},{ },{
id: 'importFile', id: 'importFile',
xtype: 'textfield', xtype: 'fileuploadfield',
fieldLabel: 'Import File', fieldLabel: 'Import File',
ctCls: 'import-fu',
name: 'importFile', name: 'importFile',
disabled: false helpText: this.importFileHelpText,
cls: 'import-fu',
buttonCfg: {
iconCls: 'upload-icon'
}
},{
xtype: 'scmTip',
content: 'Please insert name and upload the repository file.',
width: '100%'
}] }]
},{ },{
id: 'importFinishedLayout', id: 'importFinishedLayout',

View File

@@ -0,0 +1,77 @@
/*
* Copyright (c) 2010, Sebastian Sdorra
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of SCM-Manager; nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* http://bitbucket.org/sdorra/scm-manager
*
*/
Sonia.util.Tip = Ext.extend(Ext.BoxComponent, {
tpl: new Ext.XTemplate('\
<div id="" class="x-tip" style="position: inherit; visibility: visible;">\
<div class="x-tip-tl">\
<div class="x-tip-tr">\
<div class="x-tip-tc">\
<div class="x-tip-header x-unselectable">\
<span class="x-tip-header-text"></span>\
</div>\
</div>\
</div>\
</div>\
<div class="x-tip-bwrap">\
<div class="x-tip-ml">\
<div class="x-tip-mr">\
<div class="x-tip-mc">\
<div class="x-tip-body" style="height: auto; width: auto;">\
{content}\
</div>\
</div>\
</div>\
</div>\
<div class="x-tip-bl x-panel-nofooter">\
<div class="x-tip-br">\
<div class="x-tip-bc"></div>\
</div>\
</div>\
</div>\
</div>'),
constructor: function(config) {
config = config || {};
var cl = 'scm-tip';
if (config['class']){
cl += ' ' + config['class'];
}
config.xtype = 'box';
this.html = this.tpl.apply({content: config.content});
Sonia.util.Tip.superclass.constructor.apply(this, arguments);
}
});
// register xtype
Ext.reg('scmTip', Sonia.util.Tip);