-
Notifications
You must be signed in to change notification settings - Fork 16
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
New debug view #141 #362
New debug view #141 #362
Conversation
@abovedave I like it! the datasource view (and anywhere datasources are listed) should include both the original endpoint as specified in the schema, and the actual endpoint fired |
@abovedave this changes globalEvents to be run as part of the request lifecycle, rather than as preload, right? |
Yes, this guy 👉 #258 |
} catch (e) { | ||
console.log('RouteValidator Load Error:', datasource.name, req.url) | ||
console.log(e) | ||
var results = data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use const
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could just change the next line to if (data.results && data.results.length > 0) {
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed!
this.data = {} | ||
|
||
this.templateName = | ||
this.page.hostKey + | ||
this.page.template.slice(0, this.page.template.indexOf('.')) | ||
|
||
this.templateEngineSettings = this.page.settings.engine || {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is likely a breaking change, is it documented as such?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Send the templated page | ||
const templateData = Object.assign({}, this.data, { | ||
host: this.page.hostKey | ||
}) | ||
|
||
this.template | ||
.render(templateData, { | ||
keepWhitespace: this.page.keepWhitespace |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the breaking change, I mean 🥇
dadi/lib/controller/index.js
Outdated
config.get('allowJsonView') && | ||
urlData.query.json && | ||
urlData.query.json.toString() === 'true' | ||
// allow debug view using ?debug= |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we keep json=true
for backwards compatibility, translating it to debug=json
?
New debug view for #141
allowJsonView
toallowDebugView
?json=true
with?debug=json
?debug
Shows the page data object, template and the output (prior to any
postProcessors
)?debug=data
Shows the page data object
?debug=page
Shows the data used to the construct the page internally to Web
?debug=ds
Shows all the datasources attached to the page, including
?debug=result
Shows the rendered template next to the output with
postProcessors
applied (if applicable)?debug=stats
The data that used to be attached to the page data, with the addition of extra information e.g.,
And some new additions:
?debug=route
Shows the list of routes and the current page
pathname
. The active route is highlighted and the user can change thepathname
to see their proposed input matches any of this pages routes.?debug=headers
Shows the
request
andresponse
headers. Theresponse
headers are made from a newhttp
call to the page so is not the full picture (e.g.,http
doesn’t send anyaccept-encoding
headers)?debug=json
What used to be
?json=true
ie., the raw page data JSON.Changing of default page
data
url
object which includes stuff from the native Node.jsurl.parse()
pathname
becomesurl.pathname
host
becomesurl.host
title
becomespage.name
stats
which appeared whendebug
mode enabledcheckValue
becomes a more usefultimestamp
which is UNIX miliseconds (new Date().getTime()
)Misc changes
dadi/lib/debug/views.js
)Controller.numInstances
debug code put in my @jimlambieglobalEvents
now have access to page data. Closes Give globalEvents access to page data #258req
andres
in functionspage.settings.keepWhitespace
option. Closes Passpage.settings
to the template engine #255page
module to no longer accept the?json=true
view (it is now handled in thecontroller
)config.paths
#262. Web now does not create new workspace folders on boot