Skip to content

Commit

Permalink
Merge pull request #29 from psteiwer/dev
Browse files Browse the repository at this point in the history
Merge Dev to Master
  • Loading branch information
psteiwer authored Apr 10, 2019
2 parents 193c7f5 + ecf7b56 commit f882505
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 5 deletions.
4 changes: 2 additions & 2 deletions AnalyzeThis/Dashboard/AutoPivot.cls
Original file line number Diff line number Diff line change
Expand Up @@ -664,9 +664,9 @@ ClassMethod AddWidget(pCubeName As %String, pname As %String, wtype As %String,
If (wtype="time") Do Properties.SetAt(mdx,"MDX")
If (wtype="barChart") {
// Check to see if Highcharts Portlet exists
If ##class(%Dictionary.CompiledClass).%ExistsId("%DeepSee.Highcharts.Portlet") {
If ##class(%Dictionary.CompiledClass).%ExistsId("ThirdPartyChartPortlets.Highcharts") {
Set widget.type="portlet"
Set widget.subtype="%DeepSee.Highcharts.Portlet"
Set widget.subtype="ThirdPartyChartPortlets.Highcharts"
Set widget.subtypeClass="portlet"
Do Properties.SetAt(2,"chartType")
Do Properties.SetAt(0,"print")
Expand Down
8 changes: 8 additions & 0 deletions AnalyzeThis/Generator.cls
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,14 @@ ClassMethod JSONToClass(propertiesJSON As %String, pClassName As %String) As %St
Do class.Properties.Insert(prop)
//}
}

// Set global name directly to allow for global mapping of AnalyzeThis.*
Set param=##class(%Dictionary.ParameterDefinition).%New()
Set param.Name="DEFAULTGLOBAL"
// Unique up to 32 characters, only take first 16 chars of class name to avoid confusion
Set param.Default="^AnalyzeThis.G."_$extract($piece(pClassName,".",*),1,16)
Do class.Parameters.Insert(param)

Set tSC=class.%Save()
Set tSC=$system.OBJ.Compile(pClassName,"fck /displayerror=0 /displaylog=0")

Expand Down
26 changes: 25 additions & 1 deletion AnalyzeThis/UI/Dialog/CSVImport.cls
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,12 @@ Method GenerateCubeName() [ ZenMethod ]
} ElseIf ..SourceType="Class" {
Set tName=..Source
// Class should end in .cls, extract package + .cls extension to get class name
Set tName=$piece(tName,".",*-1)
// If class does not end in .cls, handle appropriately
Set tCls=1
If $zconvert($extract(tName,*-3,*),"U")'=".CLS" {
Set tCls=0
}
Set tName=$piece(tName,".",*-tCls)
} Else {
// SouceType not supported to auto generate class name
Quit
Expand Down Expand Up @@ -732,6 +737,13 @@ ClientMethod nextPage() [ Language = javascript ]
zen("CubeName").focus();
break;
}

var uniquename=zenPage.UniqueName(zen("CubeName").getValue());
if (uniquename!="") {
this.showMsg($$$Text(uniquename),1);
zen("CubeName").focus();
break;
}

tabGroup.showNextTab();
break;
Expand Down Expand Up @@ -1141,6 +1153,18 @@ ClassMethod ValidateFile(FILE) As %Integer [ Internal, ZenMethod ]
Quit 1
}

ClassMethod UniqueName(pName) As %String [ Internal, ZenMethod ]
{
Set tResponse=""
Set tSQL="SELECT ID FROM %Dictionary.ClassDefinition WHERE ID %STARTSWITH ?"
Set tRS=##class(%SQL.Statement).%ExecDirect(,tSQL,"AnalyzeThis.Generated."_$E(pName,1,16))
Set tNotUnique=tRS.%Next()
If tNotUnique {
Set tResponse="First 16 characters of CubeName must be unique from existing CubeNames. "_pName_" is not unique from "_$Piece(tRS.ID,".",*)
}
Quit tResponse
}

/// This method is invoked only when user selects to import from Local Machine.<br/>
/// The necessary parameters are passed in URL. The temp file name is saved in %session and to be used in loading content.
ClassMethod %OnSubmit(pSubmit As %ZEN.Submit) As %Status [ Internal ]
Expand Down
8 changes: 6 additions & 2 deletions AnalyzeThis/Utils.cls
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,12 @@ ClassMethod SQLToJSON(pSourceQuery As %String, ByRef propertyJSONStreamId, ByRef

ClassMethod ClassToQuery(pClass) As %String
{
// Assume pClass ends in .cls
Set sqlTableName=##class(%DeepSee.Utils).%GetSQLTableName($piece(pClass,".",1,*-1))
// Check for .cls extension
Set tCls=1
If $zconvert($extract(pClass,*-3,*),"U")'=".CLS" {
Set tCls=0
}
Set sqlTableName=##class(%DeepSee.Utils).%GetSQLTableName($piece(pClass,".",1,*-tCls))
Set sqlQuery="SELECT * FROM "_sqlTableName
Quit sqlQuery
}
Expand Down

0 comments on commit f882505

Please sign in to comment.