Skip to content

dashboard cleanup #394

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/api.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -852,7 +852,7 @@
<cffunction name="sortURIMatchOrder" access="private" output="false">
<cfargument name="endpoints" />
<cfset var URIMatchOrder = listToArray( structKeyList(arguments.endpoints, chr(10)), chr(10) ) />
<cfset arraySort(URIMatchOrder, "text", "desc") />
<cfset arraySort(URIMatchOrder, "textnocase", "desc") />
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line change gave me quite a bit of pause. I was worried that we might lose some nuance of the way we handle incoming URI's and some tiny corner case bug might be introduced by moving from more explicit to less...

But then I realized that we're using these strings as patterns in a reMatchNoCase() so it was already case insensitive.

<cfset local.attempt = reMatchNoCase(application._taffy.URIMatchOrder[local.i], arguments.requestedURI) />

I am still mildly curious what problem this solves. The only thing I can think of is carelessness from developers in using consistent casing that might result in separation of resources in the dashboard that might have otherwise been grouped:

For example, using a case-sensitive sort:

/Users/abb
/users/bbb
/users/aaa

Whereas a case-insensitive sort would result in:

/users/bbb
/Users/abb
/users/aaa

<cfreturn URIMatchOrder />
</cffunction>

Expand Down
26 changes: 13 additions & 13 deletions dashboard/dashboard.cfm
Original file line number Diff line number Diff line change
Expand Up @@ -189,17 +189,7 @@
<div class="panel-heading">
<h4 class="panel-title">
<a href="###local.resourceHTTPID#" class="accordion-toggle" data-toggle="collapse" data-parent="##resourcesAccordion">
<cfif structKeyExists(local.md, "taffy:dashboard:name")>
#local.md['taffy:dashboard:name']#
<cfelseif structKeyExists(local.md, "taffy_dashboard_name")>
#local.md['taffy_dashboard_name']#
<cfelseif structKeyExists(local.md, "taffy:docs:name")>
#local.md['taffy:docs:name']#
<cfelseif structKeyExists(local.md, "taffy_docs_name")>
#local.md['taffy_docs_name']#
<cfelse>
#local.currentResource.beanName#
</cfif>
<code>#local.currentResource.srcUri#</code>
</a>
<cfloop list="DELETE|warning,PATCH|warning,PUT|warning,POST|danger,GET|primary" index="local.verb">
<cfif structKeyExists(local.currentResource.methods, listFirst(local.verb,'|'))>
Expand All @@ -208,7 +198,6 @@
<span class="verb label label-default">#ucase(listFirst(local.verb,'|'))#</span>
</cfif>
</cfloop>
<code style="float:right; margin-top: -15px; display: inline-block;">#local.currentResource.srcUri#</code>
</h4>
</div>
<div class="panel-collapse collapse" id="#local.resourceHTTPID#">
Expand Down Expand Up @@ -307,7 +296,7 @@
<cfelse>
<cfset local.functions = arrayNew(1) />
</cfif>

<!--- only save body templates for POST & PUT --->
<cfloop from="1" to="#arrayLen(local.functions)#" index="local.f">
<cfif local.functions[local.f].name eq "POST" or local.functions[local.f].name eq "PUT" or local.functions[local.f].name eq "PATCH">
Expand Down Expand Up @@ -361,6 +350,17 @@
</div><!-- /col-md-8 -->
<div class="col-md-4 docs">
<div class="row"><div class="col-md-12"><button class="btn btn-default hideDocs">Hide Docs</button></div></div>
<strong><cfif structKeyExists(local.md, "taffy:dashboard:name")>
#lcase(local.md['taffy:dashboard:name'])#
<cfelseif structKeyExists(local.md, "taffy_dashboard_name")>
#lcase(local.md['taffy_dashboard_name'])#
<cfelseif structKeyExists(local.md, "taffy:docs:name")>
#lcase(local.md['taffy:docs:name'])#
<cfelseif structKeyExists(local.md, "taffy_docs_name")>
#lcase(local.md['taffy_docs_name'])#
<cfelse>
#lcase(local.currentResource.beanName)#
</cfif></strong><br />
<cfset local.metadata = getMetaData(application._taffy.factory.getBean(local.currentResource.beanName)) />
<cfset local.docData = getHintsFromMetadata(local.metadata) />
<cfif structKeyExists(local.docData, 'hint')><div class="doc">#local.docData.hint#</div><hr/></cfif>
Expand Down