Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
nikitaeverywhere committed Jan 11, 2016
2 parents de11f23 + 6787ac9 commit 1cc44b0
Show file tree
Hide file tree
Showing 9 changed files with 224 additions and 29 deletions.
52 changes: 46 additions & 6 deletions cache/projectTemplate.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<Description>
Cache Class Explorer vX.X.X/*build.replace:pkg.version*/
Class contains methods that return structured classes/packages data.</Description>
<TimeChanged>63919,67431.456639</TimeChanged>
<TimeChanged>63928,63957.580821</TimeChanged>
<TimeCreated>63653,67019.989197</TimeCreated>

<Method name="getAllNamespacesList">
Expand Down Expand Up @@ -193,7 +193,7 @@ Return structured data about class.</Description>
set xd = classDefinition.XDatas.GetAt(i)
for j=1:1:props.Properties.Count() {
set pname = props.Properties.GetAt(j).Name
set:(pname '= "parent") $PROPERTY(oProp, pname) = $PROPERTY(xd, pname)
set:((pname '= "parent") && (pname '= "Object")) $PROPERTY(oProp, pname) = $PROPERTY(xd, pname)
}
do oXDatas.%DispatchSetProperty(xd.Name, oProp)
}
Expand Down Expand Up @@ -319,14 +319,22 @@ Returns new (correct) super</Description>
<Description>
Setup basic output data object</Description>
<ClassMethod>1</ClassMethod>
<FormalSpec>packageName:%String</FormalSpec>
<FormalSpec>packageName:%String,baseNamespace:%String,savedName:%String</FormalSpec>
<Private>1</Private>
<ReturnType>%ZEN.proxyObject</ReturnType>
<Implementation><![CDATA[
set oData = ##class(%ZEN.proxyObject).%New()
set oData.basePackageName = packageName
set oData.restrictPackage = 1 // expand classes only in base package
set oData.classes = ##class(%ZEN.proxyObject).%New()
set ns = $namespace
zn baseNamespace
if $get(^ClassExplorer("savedView", ns_":"_savedName)) '= "" {
set oData.savedView = $get(^ClassExplorer("savedView", ns_":"_savedName))
}
zn ns
quit oData
]]></Implementation>
</Method>
Expand All @@ -348,9 +356,10 @@ Returns structured class data</Description>
<FormalSpec>className:%String,namespace:%String</FormalSpec>
<ReturnType>%ZEN.proxyObject</ReturnType>
<Implementation><![CDATA[
set baseNamespace = $namespace
zn:$GET(namespace)'="" namespace
set package = $LISTTOSTRING($LIST($LISTFROMSTRING(className, "."), 1, *-1), ".")
set oData = ..getBaseOData(package)
set oData = ..getBaseOData(package, baseNamespace, "CLASS:"_className)
do ..fillClassData(oData, className)
quit oData
]]></Implementation>
Expand All @@ -363,8 +372,9 @@ Returns structured package data</Description>
<FormalSpec>rootPackageName:%String,namespace:%String</FormalSpec>
<ReturnType>%ZEN.proxyObject</ReturnType>
<Implementation><![CDATA[
set baseNamespace = $namespace
zn:$GET(namespace)'="" namespace
set oData = ..getBaseOData(rootPackageName)
set oData = ..getBaseOData(rootPackageName, baseNamespace, "PACKAGE:"_rootPackageName)
set classes = ##class(%ResultSet).%New("%Dictionary.ClassDefinition:Summary")
do classes.Execute()
set listLen = $LISTLENGTH($LISTFROMSTRING(rootPackageName, ".")) // bottom level of package to extract
Expand Down Expand Up @@ -397,7 +407,7 @@ Returns structured package data</Description>
<Description>
REST interface for ClassExplorer</Description>
<Super>%CSP.REST</Super>
<TimeChanged>63697,73073.878177</TimeChanged>
<TimeChanged>63928,63486.89174</TimeChanged>
<TimeCreated>63648,30450.187229</TimeCreated>

<XData name="UrlMap">
Expand All @@ -413,6 +423,8 @@ REST interface for ClassExplorer</Description>
<Route Url="/GetAllNamespacesList" Method="GET" Call="GetAllNamespacesList"/>
<Route Url="/GetPackageView" Method="GET" Call="GetPackageView"/>
<Route Url="/GetMethod" Method="GET" Call="GetMethod"/>
<Route Url="/SaveView" Method="POST" Call="SaveView"/>
<Route Url="/ResetView" Method="GET" Call="ResetView"/>
</Routes>
]]></Data>
</XData>
Expand Down Expand Up @@ -441,6 +453,34 @@ Returns classTree by given class name</Description>
]]></Implementation>
</Method>

<Method name="SaveView">
<Description>
Saves the view preferences</Description>
<ClassMethod>1</ClassMethod>
<ReturnType>%Status</ReturnType>
<Implementation><![CDATA[
set name = %request.Get("name")
set content = %request.Content.Read($$$MaxStringLength) // ~ 7mb
set ^test = name
set ^ClassExplorer("savedView", name) = content
write "{""OK"":true}"
return $$$OK
]]></Implementation>
</Method>

<Method name="ResetView">
<Description>
Saves the view preferences</Description>
<ClassMethod>1</ClassMethod>
<ReturnType>%Status</ReturnType>
<Implementation><![CDATA[
set name = %request.Get("name")
kill ^ClassExplorer("savedView", name)
write "{""OK"":true}"
return $$$OK
]]></Implementation>
</Method>

<Method name="GetPackageView">
<Description>
Returns all package class trees by given package name</Description>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "CacheClassExplorer",
"version": "1.12.0",
"version": "1.13.1",
"description": "Class Explorer for InterSystems Caché",
"directories": {
"test": "test"
Expand Down
10 changes: 9 additions & 1 deletion web/css/extras.css
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@
}

.icon {
position: relative;
display: inline-block;
background-color: #333;
border-radius: 12px;
width: 24px;
height: 24px;
position: relative;
cursor: pointer;
-webkit-transition: all .2s ease;
-moz-transition: all .2s ease;
Expand All @@ -80,6 +80,14 @@
user-select: none;
}

.icon img {
position: absolute;
width: 16px;
height: 16px;
left: 4px;
top: 4px;
}

.icon:hover {
box-shadow: 0 0 5px 2px #ffcc1b;
}
Expand Down
11 changes: 7 additions & 4 deletions web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,13 @@
<div class="inlineSearchBlock" id="diagramSearchBlock">
<input type="search" id="diagramSearch" placeholder="Search on diagram..."/>
</div>
<div id="button.diagramSearch" class="icon search"></div>
<div id="button.zoomIn" class="icon plus"></div>
<div id="button.zoomNormal" class="icon scaleNormal"></div>
<div id="button.zoomOut" class="icon minus"></div>
<div id="button.diagramSearch" class="icon search" title="Search"></div>
<div id="button.zoomIn" class="icon plus" title="Zoom In"></div>
<div id="button.zoomNormal" class="icon scaleNormal" title="Zoom Normal"></div>
<div id="button.zoomOut" class="icon minus" title="Zoom Out"></div>
<div id="button.saveView" class="icon pin" title="Keep Positions">
<img id="saveViewIcon"/>
</div>
</div>
<div id="classView">
<div id="methodCodeView">
Expand Down
13 changes: 13 additions & 0 deletions web/js/CacheClassExplorer.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ var CacheClassExplorer = function (treeViewContainer, classViewContainer) {
showSettingsButton: id("button.showSettings"),
helpButton: id("button.showHelp"),
infoButton: id("button.showInfo"),
saveViewButton: id("button.saveView"),
saveViewIcon: id("saveViewIcon"),
methodCodeView: id("methodCodeView"),
closeMethodCodeView: id("closeMethodCodeView"),
methodLabel: id("methodLabel"),
Expand Down Expand Up @@ -258,4 +260,15 @@ CacheClassExplorer.prototype.init = function () {

enableSVGDownload(this.classTree);

// default icon
this.elements.saveViewIcon.src = lib.image.pin;
this.elements.saveViewButton.addEventListener("click", function () {
self.classView.switchViewSave();
if (self.classView.viewSaving) {
self.classView.saveView();
} else {
self.source.resetView( self.NAMESPACE + ":" + self.classView.CURRENT_RENDER_NAME );
}
});

};
Loading

0 comments on commit 1cc44b0

Please sign in to comment.