partkeepr

fork of partkeepr
git clone https://git.e1e0.net/partkeepr.git
Log | Files | Refs | Submodules | README | LICENSE

commit 6df74373371a6f42d92d564f92e283ebd1a24aa6
parent 5ecfd2f072de4795c847e92f79b6f10488b87349
Author: Felicia Hummel <felicia@drachenkatze.org>
Date:   Mon, 25 Jun 2018 21:50:06 +0200

Removed the static HTML template and added a textarea which displays the hints to create the database; enables copy'n'paste again

Diffstat:
Mweb/setup/js/Cards/DatabaseParametersCard.MySQL.js | 29+++++++++++++++++++----------
1 file changed, 19 insertions(+), 10 deletions(-)

diff --git a/web/setup/js/Cards/DatabaseParametersCard.MySQL.js b/web/setup/js/Cards/DatabaseParametersCard.MySQL.js @@ -23,11 +23,9 @@ Ext.define('PartKeeprSetup.DatabaseParametersCard.MySQL', { initComponent: function () { this.createHintTemplate = Ext.create("Ext.Template", [ - "<code>CREATE DATABASE {name} CHARACTER SET UTF8;<br/>GRANT USAGE ON *.* TO {user}@{localhost} IDENTIFIED BY '{password}';<br/>GRANT ALL PRIVILEGES ON {name}.* TO {user}@{localhost};<br/><br/>" + "CREATE DATABASE {name} CHARACTER SET UTF8;\nGRANT USAGE ON *.* TO {user}@{localhost} IDENTIFIED BY '{password}';\nGRANT ALL PRIVILEGES ON {name}.* TO {user}@{localhost};" ]); - this.masterTemplate = Ext.create("Ext.Template", ["The database must be manually created prior installation."]); - this.hostname = Ext.create("Ext.form.field.Text", { fieldLabel: 'Database Hostname', labelWidth: this.defaults.labelWidth, @@ -145,6 +143,16 @@ Ext.define('PartKeeprSetup.DatabaseParametersCard.MySQL', { items: [ this.showHintCheckbox, { + xtype: 'textarea', + border: false, + width: "450px", + height: "100px", + autoScroll: true, + layout: 'fit', + hidden: true, + id: 'mysql-parameters-hint' + }, + { xtype: 'container', border: false, style: 'overflow: auto;', @@ -152,8 +160,7 @@ Ext.define('PartKeeprSetup.DatabaseParametersCard.MySQL', { height: "100px", autoScroll: true, layout: 'fit', - id: 'mysql-parameters-hint', - html: "&nbsp" + html: "The database must be manually created prior installation." } ] } @@ -197,16 +204,18 @@ Ext.define('PartKeeprSetup.DatabaseParametersCard.MySQL', { host = "&lt;YOUR-CONNECTING-IP&gt;"; } - this.createHintTemplate.overwrite(Ext.getCmp("mysql-parameters-hint").getEl(), { + Ext.getCmp("mysql-parameters-hint").show(); + + Ext.getCmp("mysql-parameters-hint").setValue( + this.createHintTemplate.apply( + { localhost: host, user: this.username.getValue(), password: this.password.getValue(), name: this.databaseName.getValue() - }); - - this.masterTemplate.append(Ext.getCmp("mysql-parameters-hint").getEl()); + })); } else { - this.masterTemplate.overwrite(Ext.getCmp("mysql-parameters-hint").getEl()); + Ext.getCmp("mysql-parameters-hint").hide(); } if (this.hostname.getValue() !== "" && this.username.getValue() !== "" && this.password.getValue() !== "" &&