Bladeren bron

Table now looking real nice

Andy Baugh 5 jaren geleden
bovenliggende
commit
48ea1cc556
3 gewijzigde bestanden met toevoegingen van 37 en 18 verwijderingen
  1. 11 11
      js/pgupgrade.js
  2. 25 5
      lib/Troglodyne/CpPostgreSQL.pm
  3. 1 2
      templates/ui/pgupgrade.tmpl

+ 11 - 11
js/pgupgrade.js

@@ -6,7 +6,7 @@ function versionHandler () {
         // Construct version warning/display
         let pgVersion = obj.data.installed_version.major + '.' + obj.data.installed_version.minor;
         let elem = document.getElementById('psqlVersion');
-        let html = pgVersion;
+        let html = `<strong>${pgVersion}</strong>`;
         if( parseFloat(pgVersion) < parseFloat(obj.data.minimum_supported_version) ) {
             elem.classList.add('callout', 'callout-danger');
             html += " -- You are using a version of PostgreSQL Server that is no longer supported! Immediate upgrade reccomended.";
@@ -15,24 +15,23 @@ function versionHandler () {
 
         // Now let's build the table
         let rows = '';
-        for ( var version of Object.keys(obj.data.available_versions) ) {
+        for ( var version of Object.keys(obj.data.available_versions).sort(function(a,b) { return parseFloat(b) - parseFloat(a) }) ) {
             rows +=
 `<tr id="pgVersionRow-${version}">
     <td>
-        <input type="radio" name="selectedVersion" value="${version}"></input>
+        <input type="radio" name="selectedVersion" value="${version}" onclick="document.getElementById('submit').disabled = false;"></input>
         ${version}
     </td>
+    <td><ul>`;
+        obj.data.available_versions[version].features.forEach(function(feature) {
+            rows += `<li>${feature}</li>`;
+        });
+    rows += `</ul></td>
     <td>
-        Lorem Ipsum
+        ${new Date(obj.data.available_versions[version].release * 1000).toLocaleString(undefined, { year: 'numeric', month: 'long', day: 'numeric' })}
     </td>
     <td>
-        Community
-    </td>
-    <td>
-        ${obj.data.available_versions[version].release}
-    </td>
-    <td>
-        ${obj.data.available_versions[version].EOL}
+        ${new Date(obj.data.available_versions[version].EOL * 1000).toLocaleString(undefined, { year: 'numeric', month: 'long', day: 'numeric' })}
     </td>
 </tr>`;
         }
@@ -42,6 +41,7 @@ function versionHandler () {
     }
 }
 
+document.getElementById('submit').disabled = true;
 var oReq = new XMLHttpRequest();
 oReq.addEventListener("load", versionHandler);
 oReq.open("GET", "api.cgi?module=Postgres&function=get_postgresql_versions");

+ 25 - 5
lib/Troglodyne/CpPostgreSQL.pm

@@ -16,11 +16,31 @@ our $MINIMUM_SUPPORTED_VERSION = '9.5';
 
 # Times are in seconds since epoch, as that allows easier localization.
 our %SUPPORTED_VERSIONS_MAP = (
-    '9.5' => { 'release' => 1452146400, 'EOL' => 1613023200 },
-    '9.6' => { 'release' => 1475125200, 'EOL' => 1636610400 },
-    '10'  => { 'release' => 1507179600, 'EOL' => 1668060000 },
-    '11'  => { 'release' => 1539838800, 'EOL' => 1699509600 },
-    '12'  => { 'release' => 1570078800, 'EOL' => 1731564000 },
+    '9.5' => {
+        'release'  => 1452146400,
+        'EOL'      => 1613023200,
+        'features' => [ 'INSERTS with constraint conflicts can be turned into UPDATEs or ignored', 'Row-level security control', 'Adds Block Range Indexes' ],
+    },
+    '9.6' => {
+        'release'  => 1475125200,
+        'EOL'      => 1636610400,
+        'features' => [ 'Synchronous replication now allows multiple standby servers', 'Full-text search can now search for phrases', 'Substantial performance improvements' ],
+     },
+    '10'  => {
+        'release'  => 1507179600,
+        'EOL'      => 1668060000,
+        'features' => [ 'Logical replication using publish/subscribe', 'Significant general performance improvements', 'Stronger password authentication', 'Improved monitoring and control' ],
+     },
+    '11'  => {
+        'release'  => 1539838800,
+        'EOL'      => 1699509600,
+        'features' => [ 'Improvements to partitioning and parallelism', 'SQL stored procedures that support embedded transactions', 'Many other useful performance improvements' ]
+     },
+    '12'  => {
+        'release'  => 1570078800,
+        'EOL'      => 1731564000,
+        'features' => [ 'General performance improvements', 'Stored generated columns', 'Support for the SQL/JSON path language', 'New authentication features' ]
+    },
 );
 
 # The BS that cPanel will be installing with /scripts/installpostgres

+ 1 - 2
templates/ui/pgupgrade.tmpl

@@ -41,7 +41,6 @@ This interface at least attempts to take care of those issues for you.
         <tr>
             <th>Version</th>
             <th>Features</th>
-            <th>Source</th>
             <th>Release Date</th>
             <th>End of Life</th>
         </th>
@@ -58,7 +57,7 @@ This interface at least attempts to take care of those issues for you.
         </tr>
     </tbody>
 </table>
-<input id="submit" name="submit" type="submit" value="Maximum GO"></input>
+<input id="submit" name="submit" class="btn btn-success" type="submit" value="Continue" title="Please select a version above to continue"></input>
 </form>
 <script type="text/javascript" src="js/pgupgrade.js"></script>
 [% END %]