Просмотр исходного кода

Merge pull request #4219 from GordonSmith/HPCC-9079

HPCC-9079 Enable "Close" on tabs

Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 12 лет назад
Родитель
Сommit
ef541ace1e

+ 31 - 24
esp/files/scripts/DFUQueryWidget.js

@@ -304,32 +304,39 @@ define([
             id = obj.join("");
             var retVal = this.tabMap[id];
             if (!retVal) {
-                var context = this;
-                if (params.isSuperfile) {
-                    retVal = new SFDetailsWidget.fixCircularDependency({
-                        id: id,
-                        title: params.Name,
-                        closable: false,
-                        onClose: function () {
-                            delete context.tabMap[id];
-                            return true;
-                        },
-                        _hpccParams: params
-                    });
-                } else {
-                    retVal = new LFDetailsWidget.fixCircularDependency({
-                        id: id,
-                        title: params.Name,
-                        closable: false,
-                        onClose: function () {
-                            delete context.tabMap[id];
-                            return true;
-                        },
-                        _hpccParams: params
-                    });
+                retVal = registry.byId(id);
+                if (!retVal) {
+                    var context = this;
+                    if (params.isSuperfile) {
+                        retVal = new SFDetailsWidget.fixCircularDependency({
+                            id: id,
+                            title: params.Name,
+                            closable: true,
+                            onClose: function () {
+                                //  Workaround for http://bugs.dojotoolkit.org/ticket/16475
+                                context._tabContainer.removeChild(this);
+                                delete context.tabMap[this.id];
+                                return false;
+                            },
+                            _hpccParams: params
+                        });
+                    } else {
+                        retVal = new LFDetailsWidget.fixCircularDependency({
+                            id: id,
+                            title: params.Name,
+                            closable: true,
+                            onClose: function () {
+                                //  Workaround for http://bugs.dojotoolkit.org/ticket/16475
+                                context._tabContainer.removeChild(this);
+                                delete context.tabMap[this.id];
+                                return false;
+                            },
+                            _hpccParams: params
+                        });
+                    }
                 }
                 this.tabMap[id] = retVal;
-                this.addChild(retVal, 2);
+                this.addChild(retVal, 1);
             }
             return retVal;
         },

+ 17 - 12
esp/files/scripts/GetDFUWorkunitsWidget.js

@@ -320,19 +320,24 @@ define([
         ensurePane: function (id, params) {
             var retVal = this.tabMap[id];
             if (!retVal) {
-                var context = this;
-                retVal = new DFUWUDetailsWidget({
-                    Wuid: id,
-                    title: id,
-                    closable: false,
-                    onClose: function () {
-                        delete context.tabMap[id];
-                        return true;
-                    },
-                    params: params
-                });
+                retVal = registry.byId(id);
+                if (!retVal) {
+                    var context = this;
+                    retVal = new DFUWUDetailsWidget({
+                        Wuid: id,
+                        title: id,
+                        closable: true,
+                        onClose: function () {
+                            //  Workaround for http://bugs.dojotoolkit.org/ticket/16475
+                            context.tabContainer.removeChild(this);
+                            delete context.tabMap[this.id];
+                            return false;
+                        },
+                        params: params
+                    });
+                }
                 this.tabMap[id] = retVal;
-                this.tabContainer.addChild(retVal, 2);
+                this.tabContainer.addChild(retVal, 1);
             }
             return retVal;
         },

+ 17 - 12
esp/files/scripts/WUQueryWidget.js

@@ -544,19 +544,24 @@ define([
         ensurePane: function (id, params) {
             var retVal = this.tabMap[id];
             if (!retVal) {
-                var context = this;
-                retVal = new WUDetailsWidget({
-                    id: id,
-                    title: params.Wuid,
-                    closable: false,
-                    onClose: function () {
-                        delete context.tabMap[id];
-                        return true;
-                    },
-                    params: params
-                });
+                retVal = registry.byId(id);
+                if (!retVal) {
+                    var context = this;
+                    retVal = new WUDetailsWidget({
+                        id: id,
+                        title: params.Wuid,
+                        closable: true,
+                        onClose: function () {
+                            //  Workaround for http://bugs.dojotoolkit.org/ticket/16475
+                            context._tabContainer.removeChild(this);
+                            delete context.tabMap[this.id];
+                            return false;
+                        },
+                        params: params
+                    });
+                }
                 this.tabMap[id] = retVal;
-                this.addChild(retVal, 2);
+                this.addChild(retVal, 1);
             }
             return retVal;
         }