diff --git a/cache/projectTemplate.xml b/cache/projectTemplate.xml index 29881b7..5da4259 100644 --- a/cache/projectTemplate.xml +++ b/cache/projectTemplate.xml @@ -32,23 +32,24 @@ Return list with all namespaces Returns structured class tree with all classes available in current namespace 1 -namespace:%String +namespace:%String,showMapped=0 %ZEN.proxyObject 1 %Status diff --git a/package.json b/package.json index 38ea028..91a32c3 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "CacheClassExplorer", - "version": "1.18.1", + "version": "1.19.0", "description": "Class Explorer for InterSystems Caché", "directories": { "test": "test" }, "dependencies": {}, diff --git a/web/css/treeView.css b/web/css/treeView.css index 336c604..b01d240 100644 --- a/web/css/treeView.css +++ b/web/css/treeView.css @@ -16,7 +16,7 @@ z-index: 1; } -.ui-sideSearchBlock > input { +.ui-sideSearchBlock input[type=search] { display: block; box-sizing: border-box; border: 1px solid gray; @@ -26,6 +26,17 @@ height: 22px; } +.ui-sideSearchBlock label { + cursor: pointer; + user-select: none; + -moz-user-select: none; + -ms-user-select: none; +} + +.ui-sideSearchBlock input[type=checkbox] { + vertical-align: middle; +} + .tv-package-name.minimized + .tv-package-content { display: none; } diff --git a/web/index.html b/web/index.html index df2362b..2b55c60 100755 --- a/web/index.html +++ b/web/index.html @@ -38,7 +38,15 @@
- +
+ +
+
+ +
diff --git a/web/js/CacheClassExplorer.js b/web/js/CacheClassExplorer.js index 7083327..60c1f15 100755 --- a/web/js/CacheClassExplorer.js +++ b/web/js/CacheClassExplorer.js @@ -50,6 +50,7 @@ var CacheClassExplorer = function (treeViewContainer, classViewContainer) { subLabel: id("subLabel"), closeHelp: id("closeHelp"), settingsExtraText: id("settingsExtraText"), + showMappedCheckbox: id("showMappedCheckbox"), settings: { showDataTypesOnDiagram: id("setting.showDataTypesOnDiagram"), showClassIcons: id("setting.showClassIcons"), @@ -150,16 +151,10 @@ CacheClassExplorer.prototype.updateNamespaces = function (nsData) { */ CacheClassExplorer.prototype.setNamespace = function (namespace) { - var self = this; - this.NAMESPACE = namespace; this.classTree.setSelectedClassList([]); - self.classTree.container.textContent = ""; - self.classTree.showLoader(); - this.source.getClassTree(function (err, data) { - if (!err) self.classTree.updateTree(data); - }); + this.classTree.update(); this.updateNamespace(); this.updateURL(); @@ -269,9 +264,7 @@ CacheClassExplorer.prototype.init = function () { restored = this.restoreFromURL(); this.classTree.showLoader(); - this.source.getClassTree(function (err, data) { - if (!err) self.classTree.updateTree(data); - }); + this.classTree.init(); this.source.getNamespacesInfo(function (err, data) { if (restored && restored.namespace) data.currentNamespace = restored.namespace; if (!err) self.updateNamespaces(data); diff --git a/web/js/ClassTree.js b/web/js/ClassTree.js index 81edf70..877017c 100755 --- a/web/js/ClassTree.js +++ b/web/js/ClassTree.js @@ -15,6 +15,7 @@ var ClassTree = function (parent, treeViewContainer) { this.SELECTED_TYPE = null; // "class" || "package" this.SELECTED_ELEMENT = null; this.SELECTED_LEVEL = null; + this.INCLUDE_MAPPED = this.cacheClassExplorer.elements.showMappedCheckbox.checked; this.treeObject = null; /** * @private @@ -25,6 +26,10 @@ var ClassTree = function (parent, treeViewContainer) { this.cacheClassExplorer.elements.classTreeSearch.addEventListener("input", function (e) { self.searchChanged.call(self, (e.target || e.srcElement).value); }); + this.cacheClassExplorer.elements.showMappedCheckbox.addEventListener("change", function () { + self.INCLUDE_MAPPED = self.cacheClassExplorer.elements.showMappedCheckbox.checked; + self.update(); + }); window.addEventListener("resize", function () { self.updateSizes(); @@ -34,6 +39,19 @@ var ClassTree = function (parent, treeViewContainer) { }; +ClassTree.prototype.update = function () { + + var self = this; + + this.cacheClassExplorer.elements.classTreeSearch.value = ""; + this.container.textContent = ""; + this.showLoader(); + this.cacheClassExplorer.source.getClassTree(this.INCLUDE_MAPPED, function (err, data) { + if (!err) self.updateTree(data); + }); + +}; + ClassTree.prototype.setSelectedClassList = function (list) { // this enables saved view to be consistent for any class names order @@ -70,7 +88,8 @@ ClassTree.prototype.removeLoader = function () { if (!this.loader) return; this.cacheClassExplorer.elements.classTreeSearch.value = ""; - this.loader.parentNode.removeChild(this.loader); + if (this.loader.parentNode) + this.loader.parentNode.removeChild(this.loader); this.loader = null; }; @@ -255,7 +274,7 @@ ClassTree.prototype.updateTree = function (treeObject, doNotChangeRoot) { arr = []; for (i in object) { - arr.push({ name: getRealName(i), val: object[i] }); + arr.push({ name: getRealName(i), val: object[i], isPackage: i[0] === "/" }); } arr.sort(function (a, b) { @@ -268,7 +287,7 @@ ClassTree.prototype.updateTree = function (treeObject, doNotChangeRoot) { if (rec = append( rootElement, element.name, - typeof element.val === "object", + element.isPackage, path.join("."), level )) { @@ -282,4 +301,8 @@ ClassTree.prototype.updateTree = function (treeObject, doNotChangeRoot) { if (!doNotChangeRoot) this.treeObject = treeObject; +}; + +ClassTree.prototype.init = function () { + this.update(); }; \ No newline at end of file diff --git a/web/js/Source.js b/web/js/Source.js index a0fc2f7..9f78e25 100755 --- a/web/js/Source.js +++ b/web/js/Source.js @@ -9,13 +9,15 @@ var Source = function (cacheUMLExplorer) { /** * Return class tree. + * @param {boolean} includeMapped * @param {Source~dataCallback} callback */ -Source.prototype.getClassTree = function (callback) { +Source.prototype.getClassTree = function (includeMapped, callback) { lib.load( this.URL + "/GetClassTree" - + (this.cue.NAMESPACE ? "?namespace=" + encodeURIComponent(this.cue.NAMESPACE) : ""), + + (this.cue.NAMESPACE ? "?namespace=" + encodeURIComponent(this.cue.NAMESPACE) : "") + + "&mapped=" + (includeMapped ? "1" : "0"), null, callback );