Skip to content

Commit

Permalink
Full role handling
Browse files Browse the repository at this point in the history
  • Loading branch information
recrwplay committed Sep 3, 2024
1 parent a7044e7 commit 5c5cfa7
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 18 deletions.
43 changes: 43 additions & 0 deletions preview-src/docs-roles.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
:page-banner-text: Lorem ipsum dolor sit est.
:page-banner-link: https://neo4j.com/docs
:page-banner-link-text: Link text
:page-product: Neo4j
// :page-labels: fabric enterprise-edition alpha test

[abstract]
Expand All @@ -13,6 +14,48 @@ Flags sections as Not Available on Aura, Aura DB Enterprise, Enterprise Edition,
--


[role=label--beta-until-bolt-1.0 label--removed-2.0]
== Adding a product name to versioned labels


[role=label--beta-until-1.0 label--dynamic-5.22 label--dynamic]
[[messages-ack-failure]]
=== Request message `ACK_FAILURE`

The request message `ACK_FAILURE` signals to the server that the client has acknowledged a previous failure and should return to a `READY` state.

The request message `ACK_FAILURE` is only valid in version *1* and *2* and the request message `RESET` should be used in its place in version *3+*.

*Signature:* `0E`

*Fields:* No fields.

*Detail messages*:

No detail messages should be returned.

*Valid summary messages:*

** `SUCCESS`
** `FAILURE`

The server must be in a `FAILED` state to be able to successfully process an `ACK_FAILURE` request.
For any other states, receipt of an `ACK_FAILURE` request will be considered a protocol violation and will lead to connection closure.

==== Examples
.Synopsis
[source, bolt]
----
ACK_FAILURE
----

.Example
[source, bolt]
----
ACK_FAILURE
----


[role=label--new-5.11 label--beta-until-5.12]
== Beta until

Expand Down
53 changes: 38 additions & 15 deletions src/js/60-docs-roles.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ function checkWrapped () {
}

document.addEventListener('DOMContentLoaded', function () {
const contentDataset = document.querySelector('article.doc').dataset

var camelCased = function (str) {
return str.split(/-|\./)
.map((text) => text.substr(0, 1).toUpperCase() + text.substr(1))
Expand All @@ -34,32 +36,53 @@ document.addEventListener('DOMContentLoaded', function () {

// so if the role is a single word, we use the role as is - ie deprecated
// if it is longer we test to see if it is a 'versionable' roke - ie deprecated-5.20
// if it is a versionable role, and a veresion is specified, we remove the version and use the remaining text as the label class
if (labelParts.length > 1) {
label = (rolesData[label] && rolesData[label].labelCategory !== 'version') ? label : labelParts.slice(0, -1).join('-')
// if it is a versionable role, and a version is specified, we remove the version and use the remaining text as the label class
// if (labelParts.length > 1) {
// label = (rolesData[label] && rolesData[label].labelCategory !== 'version') ? label : labelParts.slice(0, -1).join('-')
// }

let dataLabel, dataProduct, dataVersion
const dataExtras = []

// what about roles like new-bolt-5.20 if we want to use a product name in the label?
while (!dataLabel && labelParts.length > 0) {
const labelCandidate = labelParts.join('-')
if (rolesData[labelCandidate]) {
dataLabel = labelCandidate
} else {
dataExtras.push(labelParts.pop())
}
}

// ignore labels that are not defined in rolesData
if (!rolesData[label]) {
if (!dataLabel) {
return
}

if (dataExtras.length > 0) {
dataVersion = dataExtras.shift()
}

if (dataExtras.length > 0) {
dataProduct = camelCased(dataExtras.join(' '))
}

var labelDetails = {
class: label,
role: label,
text: rolesData[label].displayText || '',
class: dataLabel,
role: dataLabel,
text: rolesData[dataLabel].displayText || '',
joinText: dataVersion ? rolesData[dataLabel].joinText || 'in' : '',
data: {
labelCategory: rolesData[label].labelCategory || '',
product: rolesData[label].product || '',
function: rolesData[label].function || '',
labelCategory: rolesData[dataLabel].labelCategory || '',
product: dataVersion ? dataProduct || rolesData[dataLabel].product || contentDataset.product || '' : '',
version: dataVersion || '',
function: rolesData[dataLabel].function || '',
},
}

// get version number for version labels
if ((rolesData[label].labelCategory === 'version' || rolesData[label].versionText) && labelParts[1]) {
labelDetails.data.version = labelParts.pop()
const joinText = rolesData[label].versionText ? rolesData[label].versionText : 'in'
labelDetails.text = [labelDetails.text, joinText, labelDetails.data.version].join(' ')
// update label text for versioned labels
if ((rolesData[dataLabel].labelCategory === 'version' || (rolesData[dataLabel].joinText && dataVersion))) {
labelDetails.text = [labelDetails.text, labelDetails.joinText, labelDetails.data.product, labelDetails.data.version].join(' ')
}

return labelDetails
Expand Down
4 changes: 2 additions & 2 deletions src/js/data/rolesData.json
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
"dynamic":{
"labelCategory": "function",
"displayText": "Dynamic",
"versionText": "since"
"joinText": "since"
},
"alpha":{
"labelCategory": "version",
Expand All @@ -144,7 +144,7 @@
"description": "The feature or function was in beta until the version specified",
"labelCategory": "version",
"displayText": "Beta",
"versionText": "until"
"joinText": "until"
},
"deprecated":{
"labelCategory": "version",
Expand Down
2 changes: 1 addition & 1 deletion src/partials/article.hbs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div id="skip-to-content"></div>
<article class="doc">
<article class="doc"{{#with page.attributes.product}} data-product="{{this}}"{{/with}}>
{{#if (eq page.layout '404')}}
<h1 class="page">{{{or page.title 'Page Not Found'}}}</h1>
<div class="paragraph">
Expand Down

0 comments on commit 5c5cfa7

Please sign in to comment.