Skip to content

Commit c268a71

Browse files
Namespace update, linking improvements
1 parent dc898b5 commit c268a71

File tree

3 files changed

+28
-9
lines changed

3 files changed

+28
-9
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "CacheClassExplorer",
3-
"version": "1.16.1",
3+
"version": "1.16.2",
44
"description": "Class Explorer for InterSystems Caché",
55
"directories": {
66
"test": "test"

web/js/CacheClassExplorer.js

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -152,24 +152,41 @@ CacheClassExplorer.prototype.setNamespace = function (namespace) {
152152
var self = this;
153153

154154
this.NAMESPACE = namespace;
155+
this.classTree.setSelectedClassList([]);
155156

156157
self.classTree.container.textContent = "";
157158
self.classTree.showLoader();
158159
this.source.getClassTree(function (err, data) {
159160
if (!err) self.classTree.updateTree(data);
160161
});
161162

163+
this.updateNamespace();
164+
this.updateURL();
165+
166+
};
167+
168+
/**
169+
* Updates namespace UI.
170+
*/
171+
CacheClassExplorer.prototype.updateNamespace = function () {
172+
173+
this.elements.namespaces.value = this.NAMESPACE;
174+
162175
};
163176

164177
CacheClassExplorer.prototype.updateURL = function () {
165178

166179
var obj = {
167-
name: this.classTree.SELECTED_NAME,
168-
type: this.classTree.SELECTED_TYPE,
169-
level: this.classTree.SELECTED_LEVEL
180+
name: this.classTree.SELECTED_NAME
170181
};
182+
183+
if (this.classTree.SELECTED_TYPE !== null)
184+
obj.type = this.classTree.SELECTED_TYPE;
185+
if (this.classTree.SELECTED_LEVEL !== null)
186+
obj.level = this.classTree.SELECTED_LEVEL;
171187

172-
if (this.NAMESPACE) obj["namespace"] = this.NAMESPACE;
188+
if (this.NAMESPACE)
189+
obj["namespace"] = this.NAMESPACE;
173190

174191
location.hash = JSON.stringify(obj);
175192

@@ -182,11 +199,13 @@ CacheClassExplorer.prototype.restoreFromURL = function () {
182199

183200
try { obj = JSON.parse(hash); } catch (e) { obj = {}; }
184201

185-
if (obj.level) {
202+
if (obj.level)
186203
this.classTree.SELECTED_LEVEL = obj.level;
204+
if (obj.namespace) {
205+
this.NAMESPACE = obj.namespace;
206+
this.updateNamespace();
187207
}
188208

189-
if (obj.namespace) this.NAMESPACE = obj.namespace;
190209
if (obj.type === "class") { // left for older Class Explorer versions support
191210
this.classView.loadClasses([obj.name], true);
192211
} else if (obj.type === "package") {

web/js/ClassView.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,6 @@ ClassView.prototype.renderInfoGraphic = function () {
143143
this.cacheClassExplorer.elements.className.textContent =
144144
"Welcome to Caché Class explorer!";
145145

146-
location.hash = "{\"type\":\"help\"}";
147-
148146
this.showLoader();
149147
this.render({
150148
basePackageName: "Welcome to Caché Class explorer!",
@@ -159,6 +157,8 @@ ClassView.prototype.renderInfoGraphic = function () {
159157

160158
this.removeLoader();
161159

160+
this.cacheClassExplorer.updateURL();
161+
162162
};
163163

164164
/**

0 commit comments

Comments
 (0)