Browse Source

Merge pull request #9923 from miguelvazq/HPCC-16377

HPCC-16377 Display file history information

Reviewed-By: Gordon Smith <gordon.smith@lexisnexis.com>
Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 8 years ago
parent
commit
d4e11c0731

+ 129 - 0
esp/src/eclwatch/FileHistoryWidget.js

@@ -0,0 +1,129 @@
+/*##############################################################################
+#    HPCC SYSTEMS software Copyright (C) 2012 HPCC Systems®.
+#
+#    Licensed under the Apache License, Version 2.0 (the "License");
+#    you may not use this file except in compliance with the License.
+#    You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#    Unless required by applicable law or agreed to in writing, software
+#    distributed under the License is distributed on an "AS IS" BASIS,
+#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#    See the License for the specific language governing permissions and
+#    limitations under the License.
+############################################################################## */
+define([
+    "dojo/_base/declare",
+    "dojo/_base/lang",
+    "dojo/i18n",
+    "dojo/i18n!./nls/hpcc",
+    "dojo/_base/array",
+
+    "dijit/registry",
+
+    "dijit/form/Button",
+    "dijit/ToolbarSeparator",
+
+    "hpcc/GridDetailsWidget",
+    "hpcc/WsDfu",
+    "hpcc/ESPUtil"
+], function (declare, lang, i18n, nlsHPCC, arrayUtil,
+                registry, Button, ToolbarSeparator,
+                GridDetailsWidget, WsDfu, ESPUtil) {
+    return declare("FileHistoryWidget", [GridDetailsWidget], {
+        i18n: nlsHPCC,
+        gridTitle: nlsHPCC.History,
+        idProperty: "Name",
+
+        init: function (params) {
+            if (this.inherited(arguments))
+                return;
+            this._refreshActionState();
+            this.refreshGrid();
+            this.initTab();
+        },
+
+        _onRefresh: function (event) {
+            this.refreshGrid();
+        },
+
+        createGrid: function (domID) {
+            var context = this;
+
+            this.openButton = registry.byId(this.id + "Open");
+
+            this.eraseHistory = new Button({
+                label: context.i18n.EraseHistory,
+                onClick: function () { context._onErase(); }
+            }).placeAt(this.openButton, "after");
+
+            var tmpSplitter = new ToolbarSeparator().placeAt(this.eraseHistory.domNode, "before");
+
+            dojo.destroy(this.openButton);
+
+            var retVal = new declare([ESPUtil.Grid(true, true)])({
+                store: this.store,
+                columns: {
+                    Name: {label: this.i18n.Name, width:70, sortable: false},
+                    IP: {label: this.i18n.IP, width: 30, sortable: false},
+                    Operation: {label: this.i18n.Operation, width: 30, sortable: false},
+                    Owner: {label: this.i18n.Owner, width: 30, sortable: false},
+                    Path: {label: this.i18n.Path, width: 70, sortable: false},
+                    Timestamp: {label: this.i18n.TimeStamp, width: 30, sortable: false},
+                    Workunit: {label: this.i18n.Workunit, width: 30, sortable: false}
+                }
+            }, domID);
+
+            return retVal;
+        },
+
+        _onErase: function (event) {
+            var context = this;
+            if (confirm(this.i18n.EraseHistoryQ + "\n" + this.params.Name + "?")) {
+                WsDfu.EraseHistory({
+                    request: {
+                        Name: context.params.Name
+                    }
+                }).then(function (response) {
+                    if (response) {
+                        context.refreshGrid();
+                    }
+                });
+            }
+        },
+
+        refreshGrid: function () {
+            var context = this;
+
+            WsDfu.ListHistory({
+                request: {
+                    Name: context.params.Name
+                }
+            }).then(function (response) {
+                var results = [];
+                var newRows = [];
+                if (lang.exists("ListHistoryResponse.History.Origin", response)) {
+                    results = response.ListHistoryResponse.History.Origin;
+                }
+
+                if (results.length) {
+                    arrayUtil.forEach(results, function (row, idx) {
+                       newRows.push({
+                            Name: row.Name,
+                            IP: row.IP,
+                            Operation: row.Operation,
+                            Owner: row.Owner,
+                            Path: row.Path,
+                            Timestamp: row.Timestamp,
+                            Workunit: row.Workunit
+                        });
+                    });
+                }
+
+                context.store.setData(newRows);
+                context.grid.set("query", {});
+            });
+        }
+    });
+});

+ 9 - 2
esp/src/eclwatch/LFDetailsWidget.js

@@ -47,6 +47,7 @@ define([
     "hpcc/ESPDFUWorkunit",
     "hpcc/ESPDFUWorkunit",
     "hpcc/FileBelongsToWidget",
     "hpcc/FileBelongsToWidget",
     "hpcc/FileSpray",
     "hpcc/FileSpray",
+    "hpcc/FileHistoryWidget",
 
 
     "dojo/text!../templates/LFDetailsWidget.html",
     "dojo/text!../templates/LFDetailsWidget.html",
 
 
@@ -60,7 +61,7 @@ define([
 
 
 ], function (exports, declare, lang, i18n, nlsHPCC, arrayUtil, dom, domAttr, domClass, domForm, query,
 ], function (exports, declare, lang, i18n, nlsHPCC, arrayUtil, dom, domAttr, domClass, domForm, query,
                 BorderContainer, TabContainer, ContentPane, Toolbar, TooltipDialog, Form, SimpleTextarea, TextBox, Button, DropDownButton, TitlePane, registry,
                 BorderContainer, TabContainer, ContentPane, Toolbar, TooltipDialog, Form, SimpleTextarea, TextBox, Button, DropDownButton, TitlePane, registry,
-                _TabContainerWidget, DelayLoadWidget, TargetSelectWidget, TargetComboBoxWidget, ESPLogicalFile, ESPDFUWorkunit, FileBelongsToWidget, FileSpray,
+                _TabContainerWidget, DelayLoadWidget, TargetSelectWidget, TargetComboBoxWidget, ESPLogicalFile, ESPDFUWorkunit, FileBelongsToWidget, FileSpray, FileHistoryWidget,
                 template) {
                 template) {
     exports.fixCircularDependency = declare("LFDetailsWidget", [_TabContainerWidget], {
     exports.fixCircularDependency = declare("LFDetailsWidget", [_TabContainerWidget], {
         templateString: template,
         templateString: template,
@@ -83,6 +84,7 @@ define([
         workunitWidget: null,
         workunitWidget: null,
         dfuWorkunitWidget: null,
         dfuWorkunitWidget: null,
         fileBelongsTo: null,
         fileBelongsTo: null,
+        fileHistoryWidget: null,
 
 
         logicalFile: null,
         logicalFile: null,
         prevState: "",
         prevState: "",
@@ -102,6 +104,7 @@ define([
             this.queriesWidget = registry.byId(this.id + "_Queries");
             this.queriesWidget = registry.byId(this.id + "_Queries");
             this.workunitWidget = registry.byId(this.id + "_Workunit");
             this.workunitWidget = registry.byId(this.id + "_Workunit");
             this.dfuWorkunitWidget = registry.byId(this.id + "_DFUWorkunit");
             this.dfuWorkunitWidget = registry.byId(this.id + "_DFUWorkunit");
+            this.fileHistoryWidget = registry.byId(this.id + "_FileHistory");
             this.copyTargetSelect = registry.byId(this.id + "CopyTargetSelect");
             this.copyTargetSelect = registry.byId(this.id + "CopyTargetSelect");
             this.desprayTargetSelect = registry.byId(this.id + "DesprayTargetSelect");
             this.desprayTargetSelect = registry.byId(this.id + "DesprayTargetSelect");
             this.desprayTooltiopDialog = registry.byId(this.id + "DesprayTooltipDialog");
             this.desprayTooltiopDialog = registry.byId(this.id + "DesprayTooltipDialog");
@@ -299,6 +302,10 @@ define([
                         NodeGroup: this.logicalFile.NodeGroup,
                         NodeGroup: this.logicalFile.NodeGroup,
                         Name: this.logicalFile.Name
                         Name: this.logicalFile.Name
                     });
                     });
+                 } else if (currSel.id == this.fileHistoryWidget.id) {
+                    this.fileHistoryWidget.init({
+                        Name: this.logicalFile.Name
+                    });
                  } else {
                  } else {
                     currSel.init(currSel.params);
                     currSel.init(currSel.params);
                 }
                 }
@@ -411,4 +418,4 @@ define([
             this.setDisabled(this.id + "ReplicateDropDown", !this.logicalFile.CanReplicateFlag || this.logicalFile.ReplicateFlag === false);
             this.setDisabled(this.id + "ReplicateDropDown", !this.logicalFile.CanReplicateFlag || this.logicalFile.ReplicateFlag === false);
         }
         }
     });
     });
-});
+});

+ 8 - 1
esp/src/eclwatch/WsDfu.js

@@ -171,6 +171,14 @@ define([
             return ESPRequest.send("WsDfu", "DFUSpace", params);
             return ESPRequest.send("WsDfu", "DFUSpace", params);
         },
         },
 
 
+        ListHistory: function (params) {
+            return ESPRequest.send("WsDfu", "ListHistory", params);
+        },
+
+        EraseHistory: function (params) {
+            return ESPRequest.send("WsDfu", "EraseHistory", params);
+        },
+
         DFUInfo: function (params) {
         DFUInfo: function (params) {
             return ESPRequest.send("WsDfu", "DFUInfo", params).then(function (response) {
             return ESPRequest.send("WsDfu", "DFUInfo", params).then(function (response) {
                 if (lang.exists("Exceptions.Exception", response)) {
                 if (lang.exists("Exceptions.Exception", response)) {
@@ -220,4 +228,3 @@ define([
 
 
     return self;
     return self;
 });
 });
-

+ 6 - 1
esp/src/eclwatch/nls/es/hpcc.js

@@ -175,6 +175,8 @@ define(
     EnglishQ: "Ingles?",
     EnglishQ: "Ingles?",
     EnterAPercentage: "Entre un porcentaje",
     EnterAPercentage: "Entre un porcentaje",
     EnterAPercentageOrMB: "Entre un porcentaje o MB",
     EnterAPercentageOrMB: "Entre un porcentaje o MB",
+    EraseHistory: "Borrar Historia",
+    EraseHistoryQ: "Borrar historia de archivo:",
     Error: "Error",
     Error: "Error",
     Errorparsingserverresult: "Error analizando los resultados del servidor",
     Errorparsingserverresult: "Error analizando los resultados del servidor",
     Errors: "Errores",
     Errors: "Errores",
@@ -395,6 +397,7 @@ define(
     OpenSafeMode: "Abrir (modo seguro)",
     OpenSafeMode: "Abrir (modo seguro)",
     OpenSource: "Código Abierto",
     OpenSource: "Código Abierto",
     OpenTreeMode: "Abrir (vista en arbol)",
     OpenTreeMode: "Abrir (vista en arbol)",
+    Operation: "Operación",
     Operations: "Operaciones",
     Operations: "Operaciones",
     Options: "Opciones",
     Options: "Opciones",
     OriginalFile: "Archivo Original",
     OriginalFile: "Archivo Original",
@@ -629,6 +632,7 @@ define(
     ThorNetworkAddress: "Dirección de red de Thor",
     ThorNetworkAddress: "Dirección de red de Thor",
     ThorProcess: "Proceso de Thor",
     ThorProcess: "Proceso de Thor",
     Time: "Tiempo",
     Time: "Tiempo",
+    TimeStamp: "Marca de hora",
     Timers: "Cronómetros",
     Timers: "Cronómetros",
     TimeSeconds: "Tiempo (Segundos)",
     TimeSeconds: "Tiempo (Segundos)",
     TimeStarted: "Tiempo empezado",
     TimeStarted: "Tiempo empezado",
@@ -664,6 +668,7 @@ define(
     title_HPCCPlatformOps: "ECL Watch - Operaciones",
     title_HPCCPlatformOps: "ECL Watch - Operaciones",
     title_HPCCPlatformRoxie: "ECL Watch - Roxie",
     title_HPCCPlatformRoxie: "ECL Watch - Roxie",
     title_HPCCPlatformServicesPlugin: "ECL Watch - Plugins",
     title_HPCCPlatformServicesPlugin: "ECL Watch - Plugins",
+    title_History: "Historia",
     title_Inputs: "Entradas",
     title_Inputs: "Entradas",
     title_LFDetails: "Detalles de archivos lógicos",
     title_LFDetails: "Detalles de archivos lógicos",
     title_LibrariesUsed: "Librerias Usadas",
     title_LibrariesUsed: "Librerias Usadas",
@@ -781,4 +786,4 @@ define(
     ZoomAll: "Aumentar todo",
     ZoomAll: "Aumentar todo",
     ZoomWidth: "Aumentar al ancho"
     ZoomWidth: "Aumentar al ancho"
 })
 })
-);
+);

+ 5 - 0
esp/src/eclwatch/nls/hpcc.js

@@ -181,6 +181,8 @@ define({root:
     EnglishQ: "English?",
     EnglishQ: "English?",
     EnterAPercentage: "Enter a percentage",
     EnterAPercentage: "Enter a percentage",
     EnterAPercentageOrMB: "Enter A Percentage or MB",
     EnterAPercentageOrMB: "Enter A Percentage or MB",
+    EraseHistory: "Erase History",
+    EraseHistoryQ: "Erase history for:",
     Error: "Error",
     Error: "Error",
     Errorparsingserverresult: "Error parsing server result",
     Errorparsingserverresult: "Error parsing server result",
     Errors: "Error(s)",
     Errors: "Error(s)",
@@ -400,6 +402,7 @@ define({root:
     OpenLegacyMode: "Open (legacy)",
     OpenLegacyMode: "Open (legacy)",
     OpenNativeMode: "Open (native)",
     OpenNativeMode: "Open (native)",
     OpenSource: "Open Source",
     OpenSource: "Open Source",
+    Operation: "Operation",
     Operations: "Operations",
     Operations: "Operations",
     Options: "Options",
     Options: "Options",
     OriginalFile: "Original File",
     OriginalFile: "Original File",
@@ -638,6 +641,7 @@ define({root:
     ThorMasterAddress: "Thor Master Address",
     ThorMasterAddress: "Thor Master Address",
     ThorProcess: "Thor Process",
     ThorProcess: "Thor Process",
     Time: "Time",
     Time: "Time",
+    TimeStamp: "Time Stamp",
     TimeSeconds: "Time (Seconds)",
     TimeSeconds: "Time (Seconds)",
     TimeStarted: "Time Started",
     TimeStarted: "Time Started",
     TimeStopped: "Time Stopped",
     TimeStopped: "Time Stopped",
@@ -673,6 +677,7 @@ define({root:
     title_HPCCPlatformOps: "ECL Watch - Operations",
     title_HPCCPlatformOps: "ECL Watch - Operations",
     title_HPCCPlatformRoxie: "ECL Watch - Roxie",
     title_HPCCPlatformRoxie: "ECL Watch - Roxie",
     title_HPCCPlatformServicesPlugin: "ECL Watch - Plugins",
     title_HPCCPlatformServicesPlugin: "ECL Watch - Plugins",
+    title_History: "History",
     title_Inputs: "Inputs",
     title_Inputs: "Inputs",
     title_Log: "Log File",
     title_Log: "Log File",
     title_LFDetails: "Logical File Details",
     title_LFDetails: "Logical File Details",

+ 2 - 0
esp/src/eclwatch/templates/LFDetailsWidget.html

@@ -210,6 +210,8 @@
             </div>
             </div>
             <div id="${id}_DFUWorkunit" title="${i18n.Workunit}" data-dojo-props="delayWidget: 'DFUWUDetailsWidget'" data-dojo-type="DelayLoadWidget">
             <div id="${id}_DFUWorkunit" title="${i18n.Workunit}" data-dojo-props="delayWidget: 'DFUWUDetailsWidget'" data-dojo-type="DelayLoadWidget">
             </div>
             </div>
+            <div id="${id}_FileHistory" title="${i18n.History}" data-dojo-props="delayWidget: 'FileHistoryWidget'" data-dojo-type="DelayLoadWidget">
+            </div>
         </div>
         </div>
     </div>
     </div>
 </div>
 </div>