Skip to content
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
8 changes: 8 additions & 0 deletions vendor/wheels/Public.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,14 @@ component output="false" displayName="Internal GUI" extends="wheels.Global" {
include "/wheels/public/views/cli.cfm";
return "";
}
function packagelist() {
include "/wheels/public/views/packagelist.cfm";
return "";
}
function packageentry() {
include "/wheels/public/views/packageentry.cfm";
return "";
}
function plugins() {
include "/wheels/public/views/plugins.cfm";
return "";
Expand Down
37 changes: 36 additions & 1 deletion vendor/wheels/events/onrequestend/debug.cfm
Original file line number Diff line number Diff line change
Expand Up @@ -310,9 +310,38 @@
</cfif>
</dl>
</div>
<cfif StructKeyExists(application.wheels, "enablePackagesComponent") AND application.wheels.enablePackagesComponent>
<div class="wdb-section">
<div class="wdb-section-title">Packages</div>
<cfif StructKeyExists(application.wheels, "packageMeta") AND StructCount(application.wheels.packageMeta) GT 0>
<table class="wdb-table">
<thead><tr><th>Package</th><th>Version</th><th>Description</th></tr></thead>
<tbody>
<cfloop collection="#application.wheels.packageMeta#" item="local.pkgName">
<cfset local.pkgInfo = application.wheels.packageMeta[local.pkgName]>
<tr>
<td><code>#local.pkgInfo.name#</code></td>
<td>#local.pkgInfo.version#</td>
<td style="color:##a6adc8;">#local.pkgInfo.description#</td>
</tr>
</cfloop>
</tbody>
</table>
<cfelse>
<p style="color:##6c7086;">No packages installed.</p>
</cfif>
<cfif StructKeyExists(application.wheels, "failedPackages") AND ArrayLen(application.wheels.failedPackages) GT 0>
<div style="color:##f38ba8;font-size:12px;margin-top:8px;">
<cfloop array="#application.wheels.failedPackages#" index="local.fp">
<p>Failed to load <strong>#local.fp.name#</strong>: #local.fp.error#</p>
</cfloop>
</div>
</cfif>
</div>
</cfif>
<cfif $get("enablePluginsComponent")>
<div class="wdb-section">
<div class="wdb-section-title">Plugins</div>
<div class="wdb-section-title">Plugins (Legacy)</div>
<cfif StructCount($get("plugins")) IS NOT 0>
<table class="wdb-table">
<thead><tr><th>Plugin</th><th>Version</th></tr></thead>
Expand Down Expand Up @@ -403,6 +432,12 @@
Migrator
</a>
</cfif>
<cfif StructKeyExists(application.wheels, "enablePackagesComponent") AND application.wheels.enablePackagesComponent>
<a href="#urlFor(route = 'wheelsPackageList')#" class="wdb-link-card" target="_blank">
<svg viewBox="0 0 512 512"><path d="M234.5 5.7c13.9-5.3 29.7-5.3 43.6 0l192 73.7C493.6 89.5 512 112.3 512 138.4V373.6c0 26.1-18.4 48.9-42 59l-192 73.7c-13.9 5.3-29.7 5.3-43.6 0l-192-73.7C18.4 422.5 0 399.7 0 373.6V138.4c0-26.1 18.4-48.9 42-59l192-73.7zM256 66L82 133l174 67 174-67L256 66zM32 373.6c0 8.7 6.1 16.3 14 19.7l192 73.7V274L46 200v173.6zM274 467l192-73.7c7.9-3 14-11 14-19.7V200L274 274V467z"/></svg>
Packages
</a>
</cfif>
<cfif $get("enablePluginsComponent")>
<a href="#urlFor(route = 'wheelsPlugins')#" class="wdb-link-card" target="_blank">
<svg viewBox="0 0 384 512"><path d="M96 0C78.3 0 64 14.3 64 32v96h64V32c0-17.7-14.3-32-32-32zm192 0c-17.7 0-32 14.3-32 32v96h64V32c0-17.7-14.3-32-32-32zM32 160c-17.7 0-32 14.3-32 32s14.3 32 32 32v32c0 77.4 55 142 128 156.8V480c0 17.7 14.3 32 32 32s32-14.3 32-32v-67.2C297 398 352 333.4 352 256v-32c17.7 0 32-14.3 32-32s-14.3-32-32-32H32z"/></svg>
Expand Down
11 changes: 11 additions & 0 deletions vendor/wheels/public/layout/_header.cfm
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,17 @@ if (application.wheels.enableMigratorComponent) {
}
);
}
if (StructKeyExists(application.wheels, "enablePackagesComponent") && application.wheels.enablePackagesComponent) {
ArrayAppend(
request.navigation,
{
route = "wheelsPackageList",
title = "Packages",
isFluid = false,
text = '<svg xmlns="http://www.w3.org/2000/svg" height="14" width="14" viewBox="0 0 512 512"><path d="M234.5 5.7c13.9-5.3 29.7-5.3 43.6 0l192 73.7C493.6 89.5 512 112.3 512 138.4V373.6c0 26.1-18.4 48.9-42 59l-192 73.7c-13.9 5.3-29.7 5.3-43.6 0l-192-73.7C18.4 422.5 0 399.7 0 373.6V138.4c0-26.1 18.4-48.9 42-59l192-73.7zM256 66L82 133l174 67 174-67L256 66zM32 373.6c0 8.7 6.1 16.3 14 19.7l192 73.7V274L46 200v173.6zM274 467l192-73.7c7.9-3 14-11 14-19.7V200L274 274V467z"/></svg>&nbsp Packages'
}
);
}
if (application.wheels.enablePluginsComponent) {
ArrayAppend(
request.navigation,
Expand Down
2 changes: 2 additions & 0 deletions vendor/wheels/public/routes.cfm
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ mapper()
.post(name = "mcpPost", pattern = "mcp", to = "public##mcp")
.post(name = "consoleEval", pattern = "console/eval", to = "public##consoleeval")
.get(name = "cli", pattern = "cli", to = "public##cli")
.get(name = "packageEntry", pattern = "packages/[name]", to = "public##packageentry")
.get(name = "packageList", pattern = "packages", to = "public##packagelist")
.get(name = "pluginEntry", pattern = "plugins/[name]", to = "public##pluginentry")
.post(name = "pluginPost", pattern = "plugins/[name]", to = "public##pluginentry")
.get(name = "plugins", pattern = "plugins", to = "public##plugins")
Expand Down
2 changes: 1 addition & 1 deletion vendor/wheels/public/views/info.cfm
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ paths = [
'assetPaths'
];

components = ['enablePluginsComponent', 'enableMigratorComponent', 'enablePublicComponent'];
components = ['enablePackagesComponent', 'enablePluginsComponent', 'enableMigratorComponent', 'enablePublicComponent'];
environment = [
'hostName',
'environment',
Expand Down
115 changes: 115 additions & 0 deletions vendor/wheels/public/views/packageentry.cfm
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
<cfscript>
param name="request.wheels.params.name";

if (!StructKeyExists(application.wheels, "enablePackagesComponent") || !application.wheels.enablePackagesComponent)
Throw(type = "wheels.packages", message = "The Wheels Package component is disabled.");

local.pkgName = request.wheels.params.name;
local.packageMeta = StructKeyExists(application.wheels, "packageMeta") ? application.wheels.packageMeta : {};

if (!StructKeyExists(local.packageMeta, local.pkgName))
Throw(type = "wheels.packages.notFound", message = "Package '#local.pkgName#' is not installed.");

local.meta = local.packageMeta[local.pkgName];
local.manifest = local.meta.manifest;
</cfscript>
<cfinclude template="../layout/_header.cfm">
<cfoutput>
<div class="ui container">
#pageHeader("Packages", "Installed vendor packages")#

<div class="ui menu">
<a href="#urlFor(route = "wheelsPackageList")#" class="item">
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 640 640" style="vertical-align: middle;">
<circle cx="320" cy="320" r="256" fill="black"/>
<path d="M188.7 308.7L292.7 204.7C297.3 200.1 304.2 198.8 310.1 201.2C316 203.6 320 209.5 320 216V272H416C433.7 272 448 286.3 448 304V336C448 353.7 433.7 368 416 368H320V424C320 430.5 316.1 436.3 310.1 438.8C304.1 441.3 297.2 439.9 292.7 435.3L188.7 331.3C182.5 325.1 182.5 314.9 188.7 308.7Z" fill="white"/>
</svg>
&nbsp; Back to Package List
</a>
</div>

<cfif StructKeyExists(local.manifest, "homepage") AND Len(local.manifest.homepage)>
<a class="ui button small teal" href="#local.manifest.homepage#" target="_blank">
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="white" viewBox="0 0 24 24" style="vertical-align: middle;">
<path d="M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z"/>
</svg>
<span style="position: relative; top: 2px;">Homepage</span>
</a>
</cfif>

<div class="ui segment">
<h3 class="ui header">#local.meta.name#</h3>
<cfif Len(local.meta.description)>
<p>#local.meta.description#</p>
</cfif>

<table class="ui definition table">
<tbody>
<tr>
<td class="two wide">Version</td>
<td>#local.meta.version#</td>
</tr>
<cfif Len(local.meta.author)>
<tr>
<td>Author</td>
<td>#local.meta.author#</td>
</tr>
</cfif>
<tr>
<td>Directory</td>
<td><code>#local.meta.directory#</code></td>
</tr>
<cfif StructKeyExists(local.manifest, "wheelsVersion") AND Len(local.manifest.wheelsVersion)>
<tr>
<td>Wheels Version</td>
<td>#local.manifest.wheelsVersion#</td>
</tr>
</cfif>
<cfif StructKeyExists(local.manifest, "provides")>
<tr>
<td>Provides</td>
<td>
<cfset local.provides = local.manifest.provides>
<cfif StructKeyExists(local.provides, "mixins") AND Len(local.provides.mixins)>
<span class="ui blue label">Mixins: #local.provides.mixins#</span>
</cfif>
<cfif StructKeyExists(local.provides, "services") AND IsArray(local.provides.services) AND ArrayLen(local.provides.services)>
<span class="ui green label">Services: #ArrayToList(local.provides.services, ", ")#</span>
</cfif>
<cfif StructKeyExists(local.provides, "middleware") AND IsArray(local.provides.middleware) AND ArrayLen(local.provides.middleware)>
<span class="ui violet label">Middleware: #ArrayLen(local.provides.middleware)#</span>
</cfif>
</td>
</tr>
</cfif>
<cfif StructKeyExists(local.manifest, "dependencies") AND IsStruct(local.manifest.dependencies) AND StructCount(local.manifest.dependencies) GT 0>
<tr>
<td>Dependencies</td>
<td>
<cfloop collection="#local.manifest.dependencies#" item="local.depName">
<span class="ui label">#local.depName#: #local.manifest.dependencies[local.depName]#</span>
</cfloop>
</td>
</tr>
</cfif>
</tbody>
</table>
</div>

<!--- Include package-provided index if it exists --->
<cfset local.pkgIndexPath = "/vendor/#LCase(local.pkgName)#/index.cfm">
<cfif FileExists(expandPath(local.pkgIndexPath))>
<div class="ui segment">
<cfinclude template="#local.pkgIndexPath#">
</div>
</cfif>

<!--- Show test link if package has tests --->
<cfif DirectoryExists(expandPath("/vendor/#LCase(local.pkgName)#/tests"))>
<a class="ui button" href="#urlFor(route='testbox')#&directory=vendor.#LCase(local.pkgName)#.tests">
Run Package Tests
</a>
</cfif>
</div>
</cfoutput>
<cfinclude template="../layout/_footer.cfm">
105 changes: 105 additions & 0 deletions vendor/wheels/public/views/packagelist.cfm
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
<cfscript>
param name="request.wheels.params.format" default="html";

if (!StructKeyExists(application.wheels, "enablePackagesComponent") || !application.wheels.enablePackagesComponent)
throw(type="wheels.packages", message="The Wheels Package component is disabled.");

packageMeta = StructKeyExists(application.wheels, "packageMeta") ? application.wheels.packageMeta : {};
failedPackages = StructKeyExists(application.wheels, "failedPackages") ? application.wheels.failedPackages : [];

// JSON format
if (request.wheels.params.format == "json") {
local.data = {
"version": application.wheels.version,
"timestamp": now(),
"packages": {
"enabled": true,
"loaded": {},
"failed": [],
"count": StructCount(packageMeta)
}
};

for (local.pkgName in packageMeta) {
local.data.packages.loaded[local.pkgName] = {
"name": packageMeta[local.pkgName].name,
"version": packageMeta[local.pkgName].version,
"author": packageMeta[local.pkgName].author,
"description": packageMeta[local.pkgName].description
};
}

if (ArrayLen(failedPackages)) {
local.data.packages.failed = failedPackages;
}

cfcontent(type="application/json", reset=true);
writeOutput(serializeJSON(local.data));
abort;
}
</cfscript>
<cfinclude template="../layout/_header.cfm">
<cfoutput>
<!--- cfformat-ignore-start --->
<div class="ui container">
#pageHeader("Packages", "Installed vendor packages")#

<cfif ArrayLen(failedPackages)>
<div class="ui error message">
<div class="header">Package Loading Errors</div>
<cfloop array="#failedPackages#" index="local.fp">
<p><strong>#local.fp.name#</strong>: #local.fp.error#<cfif Len(local.fp.detail)> &mdash; #local.fp.detail#</cfif></p>
</cfloop>
</div>
</cfif>

<cfif StructCount(packageMeta) GT 0>
<table class="ui celled striped table">
<thead>
<tr>
<th>Name</th>
<th>Version</th>
<th>Author</th>
<th>Description</th>
<th>Info</th>
</tr>
</thead>
<tbody>
<cfloop collection="#packageMeta#" item="local.pkgKey">
<cfset local.pkg = packageMeta[local.pkgKey]>
<tr>
<td>
<a href="#urlFor(route="wheelsPackageEntry", name=local.pkgKey)#">#local.pkg.name#</a>
</td>
<td>#local.pkg.version#</td>
<td>#local.pkg.author#</td>
<td>#local.pkg.description#</td>
<td>
<a class="ui button tiny teal" href="#urlFor(route='wheelsPackageEntry', name=local.pkgKey)#">
<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="8 6 8 12" fill="white" style="vertical-align: middle; margin-right: 4px;">
<path d="M11 7h2v2h-2V7zm0 4h2v6h-2v-6z"/>
</svg>
Details
</a>
<cfif DirectoryExists("#expandPath("/vendor/#LCase(local.pkgKey)#/tests")#")>
<a class="ui button tiny" href="#urlFor(route='testbox')#&directory=vendor.#LCase(local.pkgKey)#.tests">View Tests</a>
</cfif>
</td>
</tr>
</cfloop>
</tbody>
</table>
<cfelse>
<div class="ui placeholder segment">
<div class="ui icon header">
<svg xmlns="http://www.w3.org/2000/svg" height="60" width="60" viewBox="0 0 512 512"><path fill="##6c7086" d="M234.5 5.7c13.9-5.3 29.7-5.3 43.6 0l192 73.7C493.6 89.5 512 112.3 512 138.4V373.6c0 26.1-18.4 48.9-42 59l-192 73.7c-13.9 5.3-29.7 5.3-43.6 0l-192-73.7C18.4 422.5 0 399.7 0 373.6V138.4c0-26.1 18.4-48.9 42-59l192-73.7zM256 66L82 133l174 67 174-67L256 66zM32 373.6c0 8.7 6.1 16.3 14 19.7l192 73.7V274L46 200v173.6zM274 467l192-73.7c7.9-3 14-11 14-19.7V200L274 274V467z"/></svg>
<br>No packages installed
</div>
<p>Activate packages by copying them from <code>packages/</code> to <code>vendor/</code>.</p>
</div>
</cfif>
</div>

</cfoutput>
<cfinclude template="../layout/_footer.cfm">
<!--- cfformat-ignore-end --->
Loading