remove old ui

This commit is contained in:
Sebastian Sdorra
2018-08-27 15:45:56 +02:00
parent 56b629fa9d
commit b09c46abcf
35 changed files with 99 additions and 3374 deletions

View File

@@ -29,7 +29,7 @@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
http://bitbucket.org/sdorra/scm-manager
jo
-->
@@ -42,7 +42,7 @@
-->
<plugin>
<scm-version>2</scm-version>
<information>
@@ -61,9 +61,4 @@
<min-version>${project.parent.version}</min-version>
</conditions>
<resources>
<script>/sonia/scm/hg.config.js</script>
<script>/sonia/scm/hg.config-wizard.js</script>
</resources>
</plugin>

View File

@@ -1,449 +0,0 @@
/*
* 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
*
*/
Ext.ns("Sonia.hg");
Sonia.hg.ConfigWizard = Ext.extend(Ext.Window,{
hgConfig: null,
title: 'Mercurial Configuration Wizard',
initComponent: function(){
this.addEvents('finish');
var config = {
title: this.title,
layout: 'fit',
width: 420,
height: 140,
closable: true,
resizable: true,
plain: true,
border: false,
modal: true,
bodyCssClass: 'x-panel-mc',
items: [{
id: 'hgConfigWizardPanel',
xtype: 'hgConfigWizardPanel',
hgConfig: this.hgConfig,
listeners: {
finish: {
fn: this.onFinish,
scope: this
}
}
}]
};
Ext.apply(this, Ext.apply(this.initialConfig, config));
Sonia.hg.ConfigWizard.superclass.initComponent.apply(this, arguments);
},
onFinish: function(config){
this.fireEvent('finish', config);
this.close();
}
});
Sonia.hg.InstallationJsonReader = function(){
this.RecordType = Ext.data.Record.create([{
name: "path",
mapping: "path",
type: "string"
}]);
};
Ext.extend(Sonia.hg.InstallationJsonReader, Ext.data.JsonReader, {
readRecords: function(o){
this.jsonData = o;
if (debug){
console.debug('read installation data from json');
console.debug(o);
}
var records = [];
var paths = o.path;
for ( var i=0; i<paths.length; i++ ){
records.push(new this.RecordType({
'path': paths[i]
}));
}
return {
success: true,
records: records,
totalRecords: records.length
};
}
});
Sonia.hg.ConfigWizardPanel = Ext.extend(Ext.Panel,{
hgConfig: null,
packageTemplate: '<tpl for="."><div class="x-combo-list-item">\
{id} (hg: {hg-version}, py: {python-version}, size: {size:fileSize})\
</div></tpl>',
// text
backText: 'Back',
nextText: 'Next',
finishText: 'Finish',
configureLocalText: 'Configure local installation',
configureRemoteText: 'Download and install',
loadingText: 'Loading ...',
hgInstallationText: 'Mercurial Installation',
pythonInstallationText: 'Python Installation',
hgPackageText: 'Mercurial Package',
errorTitleText: 'Error',
packageInstallationFailedText: 'Package installation failed',
installPackageText: 'install mercurial package {0}',
initComponent: function(){
this.addEvents('finish');
var packageStore = new Ext.data.JsonStore({
storeId: 'pkgStore',
proxy: new Ext.data.HttpProxy({
url: restUrl + 'config/repositories/hg/packages',
disableCaching: false
}),
fields: [ 'id', 'hg-version', 'python-version', 'size' ],
root: 'package',
listeners: {
load: {
fn: this.checkIfPackageAvailable,
scope: this
}
}
});
var hgInstallationStore = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({
url: restUrl + 'config/repositories/hg/installations/hg'
}),
fields: [ 'path' ],
reader: new Sonia.hg.InstallationJsonReader(),
autoLoad: true,
autoDestroy: true
});
var pythonInstallationStore = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({
url: restUrl + 'config/repositories/hg/installations/python'
}),
fields: [ 'path' ],
reader: new Sonia.hg.InstallationJsonReader(),
autoLoad: true,
autoDestroy: true
});
var config = {
layout: 'card',
activeItem: 0,
bodyStyle: 'padding: 5px',
defaults: {
bodyCssClass: 'x-panel-mc',
border: false,
labelWidth: 120,
width: 250
},
bbar: ['->',{
id: 'move-prev',
text: this.backText,
handler: this.navHandler.createDelegate(this, [-1]),
disabled: true,
scope: this
},{
id: 'move-next',
text: this.nextText,
handler: this.navHandler.createDelegate(this, [1]),
scope: this
},{
id: 'finish',
text: this.finishText,
handler: this.applyChanges,
scope: this,
disabled: true
}],
items: [{
id: 'cod',
items: [{
id: 'configureOrDownload',
xtype: 'radiogroup',
name: 'configureOrDownload',
columns: 1,
items: [{
boxLabel: this.configureLocalText,
name: 'cod',
inputValue: 'localInstall',
checked: true
},{
id: 'remoteInstallRadio',
boxLabel: this.configureRemoteText,
name: 'cod',
inputValue: 'remoteInstall',
disabled: true
}]
}],
listeners: {
render: {
fn: function(panel){
panel.body.mask(this.loadingText);
var store = Ext.StoreMgr.lookup('pkgStore');
store.load.defer(100, store);
},
scope: this
}
}
},{
id: 'localInstall',
layout: 'form',
defaults: {
width: 250
},
items: [{
id: 'mercurial',
fieldLabel: this.hgInstallationText,
name: 'mercurial',
xtype: 'combo',
readOnly: false,
triggerAction: 'all',
lazyRender: true,
mode: 'local',
editable: true,
store: hgInstallationStore,
valueField: 'path',
displayField: 'path',
allowBlank: false,
value: this.hgConfig.hgBinary
},{
id: 'python',
fieldLabel: this.pythonInstallationText,
name: 'python',
xtype: 'combo',
readOnly: false,
triggerAction: 'all',
lazyRender: true,
mode: 'local',
editable: true,
store: pythonInstallationStore,
valueField: 'path',
displayField: 'path',
allowBlank: false,
value: this.hgConfig.pythonBinary
}]
},{
id: 'remoteInstall',
layout: 'form',
defaults: {
width: 250
},
items: [{
id: 'package',
fieldLabel: this.hgPackageText,
name: 'package',
xtype: 'combo',
readOnly: false,
triggerAction: 'all',
lazyRender: true,
mode: 'local',
editable: false,
store: packageStore,
valueField: 'id',
displayField: 'id',
allowBlank: false,
tpl: this.packageTemplate,
listeners: {
select: function(){
Ext.getCmp('finish').setDisabled(false);
}
}
}]
}]
};
Ext.apply(this, Ext.apply(this.initialConfig, config));
Sonia.hg.ConfigWizardPanel.superclass.initComponent.apply(this, arguments);
},
checkIfPackageAvailable: function(store){
Ext.getCmp('cod').body.unmask();
var c = store.getTotalCount();
if ( debug ){
console.debug( "found " + c + " package(s)" );
}
if ( c > 0 ){
Ext.getCmp('remoteInstallRadio').setDisabled(false);
}
},
navHandler: function(direction){
var layout = this.getLayout();
var id = layout.activeItem.id;
var next = -1;
if ( id === 'cod' && direction === 1 ){
var v = Ext.getCmp('configureOrDownload').getValue().getRawValue();
var df = false;
if ( v === 'localInstall' ){
next = 1;
} else if ( v === 'remoteInstall' ){
next = 2;
df = true;
}
Ext.getCmp('move-prev').setDisabled(false);
Ext.getCmp('move-next').setDisabled(true);
Ext.getCmp('finish').setDisabled(df);
}
else if (direction === -1 && (id === 'localInstall' || id === 'remoteInstall')) {
next = 0;
Ext.getCmp('move-prev').setDisabled(true);
Ext.getCmp('move-next').setDisabled(false);
Ext.getCmp('finish').setDisabled(true);
}
if ( next >= 0 ){
layout.setActiveItem(next);
}
},
applyChanges: function(){
var v = Ext.getCmp('configureOrDownload').getValue().getRawValue();
if ( v === 'localInstall' ){
this.applyLocalConfiguration();
} else if ( v === 'remoteInstall' ){
this.applyRemoteConfiguration();
}
},
applyRemoteConfiguration: function(){
if ( debug ){
console.debug( "apply remote configuration" );
}
var pkg = Ext.getCmp('package').getValue();
if ( debug ){
console.debug( 'install mercurial package ' + pkg );
}
var lbox = Ext.MessageBox.show({
title: this.loadingText,
msg: String.format(this.installPackageText, pkg),
width: 300,
wait: true,
animate: true,
progress: true,
closable: false
});
Ext.Ajax.request({
url: restUrl + 'config/repositories/hg/packages/' + pkg,
method: 'POST',
scope: this,
timeout: 900000, // 15min
success: function(){
if ( debug ){
console.debug('package successfully installed');
}
lbox.hide();
this.fireEvent('finish');
},
failure: function(){
if ( debug ){
console.debug('package installation failed');
}
lbox.hide();
Ext.MessageBox.show({
title: this.errorTitleText,
msg: this.packageInstallationFailedText,
buttons: Ext.MessageBox.OK,
icon:Ext.MessageBox.ERROR
});
}
});
},
applyLocalConfiguration: function(){
if ( debug ){
console.debug( "apply remote configuration" );
}
var mercurial = Ext.getCmp('mercurial').getValue();
var python = Ext.getCmp('python').getValue();
if (debug){
console.debug( 'configure mercurial=' + mercurial + " and python=" + python );
}
delete this.hgConfig.pythonPath;
delete this.hgConfig.useOptimizedBytecode;
this.hgConfig.hgBinary = mercurial;
this.hgConfig.pythonBinary = python;
if ( debug ){
console.debug( this.hgConfig );
}
this.fireEvent('finish', this.hgConfig);
}
});
// register xtype
Ext.reg('hgConfigWizardPanel', Sonia.hg.ConfigWizardPanel);
// i18n
if ( i18n && i18n.country === 'de' ){
Ext.override(Sonia.hg.ConfigWizardPanel, {
backText: 'Zurück',
nextText: 'Weiter',
finishText: 'Fertigstellen',
configureLocalText: 'Eine lokale Installation Konfigurieren',
configureRemoteText: 'Herunterladen und installieren',
loadingText: 'Lade ...',
hgInstallationText: 'Mercurial Installation',
pythonInstallationText: 'Python Installation',
hgPackageText: 'Mercurial Package',
errorTitleText: 'Fehler',
packageInstallationFailedText: 'Package Installation fehlgeschlagen',
installPackageText: 'Installiere Mercurial-Package {0}'
});
}

View File

@@ -1,287 +0,0 @@
/*
* 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
*
*/
Ext.ns("Sonia.hg");
Sonia.hg.ConfigPanel = Ext.extend(Sonia.config.ConfigForm, {
// labels
titleText: 'Mercurial Settings',
hgBinaryText: 'HG Binary',
pythonBinaryText: 'Python Binary',
pythonPathText: 'Python Module Search Path',
repositoryDirectoryText: 'Repository directory',
useOptimizedBytecodeText: 'Optimized Bytecode (.pyo)',
configWizardText: 'Start Configuration Wizard',
configWizardLabelText: 'Start Configuration Wizard',
encodingText: 'Encoding',
disabledText: 'Disabled',
showRevisionInIdText: 'Show Revision',
// helpText
hgBinaryHelpText: 'Location of Mercurial binary.',
pythonBinaryHelpText: 'Location of Python binary.',
pythonPathHelpText: 'Python Module Search Path (PYTHONPATH).',
repositoryDirectoryHelpText: 'Location of the Mercurial repositories.',
useOptimizedBytecodeHelpText: 'Use the Python "-O" switch.',
encodingHelpText: 'Repository Encoding.',
disabledHelpText: 'Enable or disable the Mercurial plugin. \n\
Note you have to reload the page, after changing this value.',
showRevisionInIdHelpText: 'Show revision as part of the node id. Note: \n\
You have to restart the ApplicationServer to affect cached changesets.',
initComponent: function(){
var config = {
title : this.titleText,
items : [{
xtype : 'textfield',
fieldLabel : this.hgBinaryText,
name : 'hgBinary',
allowBlank : false,
helpText: this.hgBinaryHelpText
},{
xtype : 'textfield',
fieldLabel : this.pythonBinaryText,
name : 'pythonBinary',
allowBlank : false,
helpText: this.pythonBinaryHelpText
},{
xtype : 'textfield',
fieldLabel : this.pythonPathText,
name : 'pythonPath',
helpText: this.pythonPathHelpText
},{
xtype: 'textfield',
name: 'repositoryDirectory',
fieldLabel: this.repositoryDirectoryText,
helpText: this.repositoryDirectoryHelpText,
allowBlank : false
},{
xtype: 'textfield',
name: 'encoding',
fieldLabel: this.encodingText,
helpText: this.encodingHelpText,
allowBlank : false
},{
xtype: 'checkbox',
name: 'useOptimizedBytecode',
fieldLabel: this.useOptimizedBytecodeText,
inputValue: 'true',
helpText: this.useOptimizedBytecodeHelpText
},{
xtype: 'checkbox',
name: 'showRevisionInId',
fieldLabel: this.showRevisionInIdText,
inputValue: 'true',
helpText: this.showRevisionInIdHelpText
},{
xtype: 'checkbox',
name: 'disabled',
fieldLabel: this.disabledText,
inputValue: 'true',
helpText: this.disabledHelpText
},{
xtype: 'button',
text: this.configWizardText,
fieldLabel: this.configWizardLabelText,
handler: function(){
var config = this.getForm().getValues();
var wizard = new Sonia.hg.ConfigWizard({
hgConfig: config
});
wizard.on('finish', function(config){
var self = Ext.getCmp('hgConfigForm');
if ( config ){
if (debug){
console.debug( 'load config from wizard and submit to server' );
}
self.loadConfig( self.el, 'config/repositories/hg/auto-configuration', 'POST', config );
} else {
if (debug){
console.debug( 'reload config' );
}
self.onLoad(self.el);
}
}, this);
wizard.show();
},
scope: this
}]
};
Ext.apply(this, Ext.apply(this.initialConfig, config));
Sonia.hg.ConfigPanel.superclass.initComponent.apply(this, arguments);
},
onSubmit: function(values){
this.el.mask(this.submitText);
Ext.Ajax.request({
url: restUrl + 'config/repositories/hg',
method: 'POST',
jsonData: values,
scope: this,
disableCaching: true,
success: function(){
this.el.unmask();
},
failure: function(){
this.el.unmask();
alert('failure');
}
});
},
onLoad: function(el){
this.loadConfig(el, 'config/repositories/hg', 'GET');
},
loadConfig: function(el, url, method, config){
var tid = setTimeout( function(){ el.mask(this.loadingText); }, 100);
Ext.Ajax.request({
url: restUrl + url,
method: method,
jsonData: config,
scope: this,
disableCaching: true,
success: function(response){
var obj = Ext.decode(response.responseText);
this.load(obj);
clearTimeout(tid);
el.unmask();
},
failure: function(){
el.unmask();
clearTimeout(tid);
alert('failure');
}
});
}
});
Ext.reg("hgConfigPanel", Sonia.hg.ConfigPanel);
// i18n
if ( i18n && i18n.country === 'de' ){
Ext.override(Sonia.hg.ConfigPanel, {
// labels
titleText: 'Mercurial Einstellungen',
hgBinaryText: 'HG Pfad',
pythonBinaryText: 'Python Pfad',
pythonPathText: 'Python Modul Suchpfad',
repositoryDirectoryText: 'Repository-Verzeichnis',
useOptimizedBytecodeText: 'Optimierter Bytecode (.pyo)',
autoConfigText: 'Einstellungen automatisch laden',
autoConfigLabelText: 'Automatische Einstellung',
configWizardText: 'Konfigurations-Assistenten starten',
configWizardLabelText: 'Konfigurations-Assistent',
disabledText: 'Deaktivieren',
showRevisionInIdText: 'Zeige Revision an',
// helpText
hgBinaryHelpText: 'Pfad zum "hg" Befehl.',
pythonBinaryHelpText: 'Pfad zum "python" Befehl.',
pythonPathHelpText: 'Python Modul Suchpfad (PYTHONPATH).',
repositoryDirectoryHelpText: 'Verzeichnis der Mercurial-Repositories.',
useOptimizedBytecodeHelpText: 'Optimierten Bytecode verwenden (python -O).',
disabledHelpText: 'Aktivieren oder deaktivieren des Mercurial Plugins.\n\
Die Seite muss neu geladen werden wenn dieser Wert geändert wird.',
showRevisionInIdHelpText: 'Zeige die Revision als teil der NodeId an. \n\
Der ApplicationServer muss neugestartet werden um zwischengespeicherte\n\
Changesets zuändern.'
});
}
// register information panel
initCallbacks.push(function(main){
main.registerInfoPanel('hg', {
checkoutTemplate: 'hg clone <a href="{0}" target="_blank">{0}</a>',
xtype: 'repositoryExtendedInfoPanel'
});
});
// register config panel
registerConfigPanel({
id: 'hgConfigForm',
xtype : 'hgConfigPanel'
});
// register type icon
Sonia.repository.typeIcons['hg'] = 'resources/images/icons/16x16/mercurial.png';
// override ChangesetViewerGrid to render changeset id's with revisions
Ext.override(Sonia.repository.ChangesetViewerGrid, {
isMercurialRepository: function(){
return this.repository.type === 'hg';
},
getChangesetId: function(id, record){
if ( this.isMercurialRepository() ){
var rev = Sonia.util.getProperty(record.get('properties'), 'hg.rev');
if ( rev ){
id = rev + ':' + id;
}
}
return id;
},
getParentIds: function(id, record){
var parents = record.get('parents');
if ( this.isMercurialRepository() ){
if ( parents && parents.length > 0 ){
var properties = record.get('properties');
var rev = Sonia.util.getProperty(properties, 'hg.p1.rev');
if (rev){
parents[0] = rev + ':' + parents[0];
}
if ( parents.length > 1 ){
rev = Sonia.util.getProperty(properties, 'hg.p2.rev');
if (rev){
parents[1] = rev + ':' + parents[1];
}
}
}
}
return parents;
}
});