From dacdf58f0d18868065c4c647ac944be4dee24b02 Mon Sep 17 00:00:00 2001 From: Dan Allen Date: Thu, 9 Jan 2020 14:09:30 -0700 Subject: [PATCH 1/9] begin wiring connector article page to UI model --- preview-site-src/ui-model.yml | 1 + src/layouts/default.hbs | 3 ++- src/partials/connectors/connectors-article.hbs | 8 ++++---- src/partials/connectors/connectors-sidebar.hbs | 8 ++++---- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/preview-site-src/ui-model.yml b/preview-site-src/ui-model.yml index 656622e84..76d076ed7 100644 --- a/preview-site-src/ui-model.yml +++ b/preview-site-src/ui-model.yml @@ -70,6 +70,7 @@ site: attributes: page-component-desc: Connect to Anypoint MQ, MuleSoft's multi-tenant cloud messaging service for the enterprise. page-connector-type: Connector + page-connector-tier: Select page-exchange-url: https://www.anypoint.mulesoft.com/exchange/com.mulesoft.connectors/anypoint-mq-connector/ page-vendor-name: msmq page-vendor-title: MuleSoft diff --git a/src/layouts/default.hbs b/src/layouts/default.hbs index ce835dba4..8bd21c89b 100644 --- a/src/layouts/default.hbs +++ b/src/layouts/default.hbs @@ -17,7 +17,8 @@ {{> header}} - {{#if (eq page.attributes.connector-type 'Connector')}} + {{!--{{#if (eq page.attributes.connector-type 'Connector')}}--}} + {{#if (eq page.component.latest.asciidocConfig.attributes.page-connector-type 'Connector')}}
{{> nav}}
diff --git a/src/partials/connectors/connectors-article.hbs b/src/partials/connectors/connectors-article.hbs index 18dc97347..04f268f4c 100644 --- a/src/partials/connectors/connectors-article.hbs +++ b/src/partials/connectors/connectors-article.hbs @@ -8,13 +8,13 @@
Salesforce logo
-

Salesforce Connector

-
+

{{{page.title}}}

+
{{> article}} diff --git a/src/partials/connectors/connectors-sidebar.hbs b/src/partials/connectors/connectors-sidebar.hbs index 245834ec0..c4bf749da 100644 --- a/src/partials/connectors/connectors-sidebar.hbs +++ b/src/partials/connectors/connectors-sidebar.hbs @@ -7,14 +7,14 @@
Runtime
-
Mule 4
+
{{#if (eq page.version '0')}}Mule 3{{else}}Mule 4{{/if}}
Tier
- Select -
+ {{{page.attributes.connector-tier}}} +
@@ -23,7 +23,7 @@
Links
Release notes - View in Exchange + View in Exchange
From 7189209104651a4a24ca953686fbd869615796bb Mon Sep 17 00:00:00 2001 From: Dan Allen Date: Thu, 9 Jan 2020 19:38:20 -0700 Subject: [PATCH 2/9] prototype version menu in connector sidebar --- .../connectors/connectors-sidebar.hbs | 7 ++++-- .../connectors/connectors-version-menu.hbs | 22 +++++++++++++------ 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/src/partials/connectors/connectors-sidebar.hbs b/src/partials/connectors/connectors-sidebar.hbs index c4bf749da..82db56342 100644 --- a/src/partials/connectors/connectors-sidebar.hbs +++ b/src/partials/connectors/connectors-sidebar.hbs @@ -1,13 +1,16 @@
-
Version
+
Versions
{{> connectors-version-menu}}
-
Runtime
+
Mule Runtime
+ +
≥ 4.1.1
Tier
diff --git a/src/partials/connectors/connectors-version-menu.hbs b/src/partials/connectors/connectors-version-menu.hbs index 22758613e..12f2decab 100644 --- a/src/partials/connectors/connectors-version-menu.hbs +++ b/src/partials/connectors/connectors-version-menu.hbs @@ -1,23 +1,31 @@
- v5.4.0–4.0.1 + 9.2.0 to 9.8.1
From cedb8428c80c4464cd9a939024a49cdc7ea6705e Mon Sep 17 00:00:00 2001 From: Dan Allen Date: Wed, 15 Jan 2020 19:02:40 -0700 Subject: [PATCH 3/9] activate link from connector article back to connectors --- src/partials/connectors/connectors-article.hbs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/partials/connectors/connectors-article.hbs b/src/partials/connectors/connectors-article.hbs index 04f268f4c..c04e4abba 100644 --- a/src/partials/connectors/connectors-article.hbs +++ b/src/partials/connectors/connectors-article.hbs @@ -1,6 +1,6 @@
- + All Connectors From db15e52c59aafdee9d23f2858578daad09849772 Mon Sep 17 00:00:00 2001 From: Dan Allen Date: Wed, 15 Jan 2020 19:02:58 -0700 Subject: [PATCH 4/9] remove commented line in default template --- src/layouts/default.hbs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/layouts/default.hbs b/src/layouts/default.hbs index 8bd21c89b..ce835dba4 100644 --- a/src/layouts/default.hbs +++ b/src/layouts/default.hbs @@ -17,8 +17,7 @@ {{> header}} - {{!--{{#if (eq page.attributes.connector-type 'Connector')}}--}} - {{#if (eq page.component.latest.asciidocConfig.attributes.page-connector-type 'Connector')}} + {{#if (eq page.attributes.connector-type 'Connector')}}
{{> nav}}
From 6b05a201da46fc95d768fdfad196d892bb7f303c Mon Sep 17 00:00:00 2001 From: Dan Allen Date: Wed, 15 Jan 2020 19:52:39 -0700 Subject: [PATCH 5/9] remove unused connectors-menu partial --- src/partials/connectors/connectors-menu.hbs | 27 --------------------- 1 file changed, 27 deletions(-) delete mode 100644 src/partials/connectors/connectors-menu.hbs diff --git a/src/partials/connectors/connectors-menu.hbs b/src/partials/connectors/connectors-menu.hbs deleted file mode 100644 index 686e7f84d..000000000 --- a/src/partials/connectors/connectors-menu.hbs +++ /dev/null @@ -1,27 +0,0 @@ - From e875b2978f1556cc3d54c23fed145a58181230fb Mon Sep 17 00:00:00 2001 From: Dan Allen Date: Thu, 16 Jan 2020 14:40:21 -0700 Subject: [PATCH 6/9] activate link to release notes page, if available --- gulp.d/tasks/build-preview-pages.js | 17 ++++++++++++++--- preview-site-src/connector-relnotes.adoc | 5 +++++ preview-site-src/ui-model.yml | 3 ++- src/helpers/resolvePageUrl.js | 7 +++++++ src/partials/connectors/connectors-sidebar.hbs | 5 ++++- src/partials/connectors/connectors-table.hbs | 9 +++++++-- 6 files changed, 39 insertions(+), 7 deletions(-) create mode 100644 preview-site-src/connector-relnotes.adoc create mode 100644 src/helpers/resolvePageUrl.js diff --git a/gulp.d/tasks/build-preview-pages.js b/gulp.d/tasks/build-preview-pages.js index 20ef4e6ff..5343f262c 100644 --- a/gulp.d/tasks/build-preview-pages.js +++ b/gulp.d/tasks/build-preview-pages.js @@ -25,14 +25,13 @@ module.exports = (src, previewSrc, previewDest, sink = () => map(), layouts = {} toPromise( merge( compileLayouts(src, layouts), - registerPartials(src), registerHelpers(src), + registerPartials(src), copyImages(previewSrc, previewDest) ) ), ]) - .then(([baseUiModel]) => ({ ...baseUiModel, env: process.env })) - .then((baseUiModel) => + .then(([baseUiModel]) => merge( vfs.src('**/*.adoc', { base: previewSrc, cwd: previewSrc }).pipe( map((file, enc, next) => { @@ -115,6 +114,8 @@ module.exports = (src, previewSrc, previewDest, sink = () => map(), layouts = {} function loadSampleUiModel (src) { return fs.readFile(ospath.join(src, 'ui-model.yml'), 'utf8').then((contents) => { const uiModel = yaml.safeLoad(contents) + uiModel.env = process.env + uiModel.site.contentCatalog = { resolvePage, resolvePageUrl } Object.values(uiModel.site.components).forEach(({ versions }) => { versions.forEach((version) => { if (!('displayVersion' in version)) version.displayVersion = version.version @@ -135,6 +136,8 @@ function registerPartials (src) { } function registerHelpers (src) { + handlebars.registerHelper('resolvePage', resolvePage) + handlebars.registerHelper('resolvePageUrl', resolvePageUrl) return vfs.src('helpers/*.js', { base: src, cwd: src }).pipe( map((file, enc, next) => { handlebars.registerHelper(file.stem, requireFromString(file.contents.toString())) @@ -156,6 +159,14 @@ function copyImages (src, dest) { return vfs.src('**/*.{png,svg}', { base: src, cwd: src }).pipe(vfs.dest(dest)) } +function resolvePage (spec, context = {}) { + if (spec) return { pub: { url: resolvePageUrl(spec) } } +} + +function resolvePageUrl (spec, context = {}) { + if (spec) return '/' + spec.slice(0, spec.lastIndexOf('.')) + '.html' +} + function toPromise (stream) { return new Promise((resolve, reject) => stream.on('error', reject).on('finish', resolve)) } diff --git a/preview-site-src/connector-relnotes.adoc b/preview-site-src/connector-relnotes.adoc new file mode 100644 index 000000000..6869e928c --- /dev/null +++ b/preview-site-src/connector-relnotes.adoc @@ -0,0 +1,5 @@ += Salesforce Connector Release Notes +:page-component-name: general + +This page contains the release notes for the Salesforce Connector. +It's just a placeholder. diff --git a/preview-site-src/ui-model.yml b/preview-site-src/ui-model.yml index 76d076ed7..790878774 100644 --- a/preview-site-src/ui-model.yml +++ b/preview-site-src/ui-model.yml @@ -1,4 +1,4 @@ -antoraVersion: '2.3.0-alpha.1' +antoraVersion: '2.3.0-alpha.2' site: url: &home_url /home.html title: MuleSoft Documentation @@ -89,6 +89,7 @@ site: page-connector-type: Connector page-connector-tier: Select page-exchange-url: https://www.anypoint.mulesoft.com/exchange/com.mulesoft.connectors/mule-salesforce-connector/ + page-release-notes-page: connector-relnotes.adoc page-vendor-name: salesforce page-vendor-title: Salesforce navigation: diff --git a/src/helpers/resolvePageUrl.js b/src/helpers/resolvePageUrl.js new file mode 100644 index 000000000..cd5d48e4b --- /dev/null +++ b/src/helpers/resolvePageUrl.js @@ -0,0 +1,7 @@ +'use strict' + +// NOTE override built-in resolvePageUrl to fix bug +module.exports = function (spec, { data: { root }, hash: context }) { + const page = root.site.contentCatalog.resolvePage(spec, context) + if (page) return page.pub.url +} diff --git a/src/partials/connectors/connectors-sidebar.hbs b/src/partials/connectors/connectors-sidebar.hbs index 82db56342..bc2cfba99 100644 --- a/src/partials/connectors/connectors-sidebar.hbs +++ b/src/partials/connectors/connectors-sidebar.hbs @@ -25,7 +25,10 @@
Links
- Release notes + {{#with (resolvePageUrl page.attributes.release-notes-page)}} + Release notes + {{else}} + {{/with}} View in Exchange diff --git a/src/partials/connectors/connectors-table.hbs b/src/partials/connectors/connectors-table.hbs index 315ec3f19..6f179b207 100644 --- a/src/partials/connectors/connectors-table.hbs +++ b/src/partials/connectors/connectors-table.hbs @@ -30,7 +30,7 @@ Mule 3
  • - Release notes + Release notes
  • View in Exchange @@ -58,8 +58,11 @@ "title": "{{delete-suffix connector.title ' Connector'}}", "type": "{{attributes.page-connector-type}}", "iconUrl": "{{@root.uiRootPath}}/img/icons/connectors/icon-{{delete-suffix connector.name '-connector'}}.svg", - "pageUrl": "{{relativize connector.url}}", "exchangeUrl": "{{attributes.page-exchange-url}}", + {{#with (resolvePageUrl attributes.page-release-notes-page)}} + "releaseNotesPageUrl": "{{relativize this}}", + {{else}} + {{/with}} {{#with connector.latest as |latest|}} "latestVersion": { "version": "{{latest.version}}", @@ -132,6 +135,8 @@ row.querySelector('.js-connector-qlinks').removeChild(row.querySelector('.js-connector-qlink-mule3').parentNode) } row.querySelector('.js-connector-qlink-exchange').href = connector.exchangeUrl + var relnotesQLink = row.querySelector('.js-connector-qlink-relnotes') + if (!(relnotesQLink.href = connector.releaseNotesPageUrl)) relnotesQLink.parentNode.style.display = 'none' return accum.concat(row) }, []) slot.innerHTML = '' From c11268e06f9e9412d1c3a4b5c2f1361bcf5dbc5f Mon Sep 17 00:00:00 2001 From: Dan Allen Date: Fri, 17 Jan 2020 18:02:59 -0700 Subject: [PATCH 7/9] set displayVersion property on page model --- gulp.d/tasks/build-preview-pages.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/gulp.d/tasks/build-preview-pages.js b/gulp.d/tasks/build-preview-pages.js index 5343f262c..140816495 100644 --- a/gulp.d/tasks/build-preview-pages.js +++ b/gulp.d/tasks/build-preview-pages.js @@ -53,17 +53,19 @@ module.exports = (src, previewSrc, previewDest, sink = () => map(), layouts = {} const componentName = doc.getAttribute('page-component-name', pageModel.src.component) const versionString = doc.getAttribute('page-version', (doc.hasAttribute('page-component-name') ? undefined : pageModel.src.version)) + let componentVersion if (componentName) { const component = pageModel.component = uiModel.site.components[componentName] - pageModel.componentVersion = versionString + componentVersion = pageModel.componentVersion = versionString ? component.versions.find(({ version }) => version === versionString) : component.latest } else { const component = pageModel.component = Object.values(uiModel.site.components)[0] - pageModel.componentVersion = component.latest + componentVersion = pageModel.componentVersion = component.latest } pageModel.module = 'ROOT' - pageModel.version = pageModel.componentVersion.version + pageModel.version = componentVersion.version + pageModel.displayVersion = componentVersion.displayVersion pageModel.editUrl = pageModel.origin.editUrlPattern.replace('%s', file.relative) pageModel.breadcrumbs = [{ content: pageModel.title, url: pageModel.url, urlType: 'internal' }] pageModel.versions = pageModel.component.versions.map(({ version, displayVersion, url }, idx, arr) => { @@ -76,8 +78,7 @@ module.exports = (src, previewSrc, previewDest, sink = () => map(), layouts = {} } return pageVersion }) - const componentVersionAttributes = pageModel.componentVersion.asciidocConfig.attributes - pageModel.attributes = Object.entries(Object.assign(attributes, componentVersionAttributes)) + pageModel.attributes = Object.entries({ ...attributes, ...componentVersion.asciidocConfig.attributes }) .filter(([name, val]) => name.startsWith('page-')) .reduce((accum, [name, val]) => ({ ...accum, [name.substr(5)]: val }), {}) pageModel.contents = Buffer.from(doc.convert()) From da4bb710709676de317a7addbe1e844733d869c2 Mon Sep 17 00:00:00 2001 From: Dan Allen Date: Fri, 17 Jan 2020 18:07:33 -0700 Subject: [PATCH 8/9] populate versions and runtime in sidebar on connector article page --- preview-site-src/ui-model.yml | 13 +++++++++++++ src/css/pages/connector-article.css | 1 + src/partials/connectors/connectors-sidebar.hbs | 12 ++++++++---- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/preview-site-src/ui-model.yml b/preview-site-src/ui-model.yml index 790878774..b820df551 100644 --- a/preview-site-src/ui-model.yml +++ b/preview-site-src/ui-model.yml @@ -72,6 +72,7 @@ site: page-connector-type: Connector page-connector-tier: Select page-exchange-url: https://www.anypoint.mulesoft.com/exchange/com.mulesoft.connectors/anypoint-mq-connector/ + page-mule-runtime-version: 4.1.1 page-vendor-name: msmq page-vendor-title: MuleSoft versions: @@ -89,6 +90,7 @@ site: page-connector-type: Connector page-connector-tier: Select page-exchange-url: https://www.anypoint.mulesoft.com/exchange/com.mulesoft.connectors/mule-salesforce-connector/ + page-mule-runtime-version: 4.1.1 page-release-notes-page: connector-relnotes.adoc page-vendor-name: salesforce page-vendor-title: Salesforce @@ -101,6 +103,17 @@ site: - version: '0' displayVersion: 'Mule 3' url: '#' + asciidocConfig: + attributes: + page-component-desc: Connect to the Salesforce SOAP API, REST API, Bulk API, and Streaming API. + page-connector-type: Connector + page-connector-tier: Select + page-connector-versions: 5.4.10 to 8.9.x + page-exchange-url: https://www.anypoint.mulesoft.com/exchange/org.mule.modules/mule-module-sfdc/ + page-mule-runtime-version: 3.5.0 + page-release-notes-page: connector-relnotes.adoc + page-vendor-name: salesforce + page-vendor-title: Salesforce connector-devkit: &component name: connector-devkit title: Connector DevKit diff --git a/src/css/pages/connector-article.css b/src/css/pages/connector-article.css index 1c20f3b3c..afc7c93dc 100644 --- a/src/css/pages/connector-article.css +++ b/src/css/pages/connector-article.css @@ -54,6 +54,7 @@ & .col:first-child, & .categories-header { color: var(--aluminum-5); + padding-right: var(--sm); } & .col:last-child { diff --git a/src/partials/connectors/connectors-sidebar.hbs b/src/partials/connectors/connectors-sidebar.hbs index bc2cfba99..e25dfa1e4 100644 --- a/src/partials/connectors/connectors-sidebar.hbs +++ b/src/partials/connectors/connectors-sidebar.hbs @@ -1,16 +1,20 @@
    Versions
    + {{!--
    {{> connectors-version-menu}}
    + --}} +
    {{#with page.attributes.connector-versions}}{{this}}{{else}}{{page.version}}.x{{/with}}
    -
    Mule Runtime
    - -
    ≥ 4.1.1
    + {{/with}}
    Tier
    From 45d99b9b457a45bb3baf2179532c51649f753db6 Mon Sep 17 00:00:00 2001 From: Dan Allen Date: Fri, 17 Jan 2020 18:16:55 -0700 Subject: [PATCH 9/9] build exchange URL from group ID and asset ID --- preview-site-src/ui-model.yml | 9 ++++++--- src/partials/connectors/connectors-sidebar.hbs | 4 +++- src/partials/connectors/connectors-table.hbs | 4 +++- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/preview-site-src/ui-model.yml b/preview-site-src/ui-model.yml index b820df551..faca9d31a 100644 --- a/preview-site-src/ui-model.yml +++ b/preview-site-src/ui-model.yml @@ -71,7 +71,8 @@ site: page-component-desc: Connect to Anypoint MQ, MuleSoft's multi-tenant cloud messaging service for the enterprise. page-connector-type: Connector page-connector-tier: Select - page-exchange-url: https://www.anypoint.mulesoft.com/exchange/com.mulesoft.connectors/anypoint-mq-connector/ + page-exchange-asset-id: anypoint-mq-connector + page-exchange-group-id: com.mulesoft.connectors page-mule-runtime-version: 4.1.1 page-vendor-name: msmq page-vendor-title: MuleSoft @@ -89,7 +90,8 @@ site: page-component-desc: Connect to the Salesforce SOAP API, REST API, Bulk API, and Streaming API. page-connector-type: Connector page-connector-tier: Select - page-exchange-url: https://www.anypoint.mulesoft.com/exchange/com.mulesoft.connectors/mule-salesforce-connector/ + page-exchange-asset-id: mule-salesforce-connector + page-exchange-group-id: com.mulesoft.connectors page-mule-runtime-version: 4.1.1 page-release-notes-page: connector-relnotes.adoc page-vendor-name: salesforce @@ -109,7 +111,8 @@ site: page-connector-type: Connector page-connector-tier: Select page-connector-versions: 5.4.10 to 8.9.x - page-exchange-url: https://www.anypoint.mulesoft.com/exchange/org.mule.modules/mule-module-sfdc/ + page-exchange-asset-id: org.mule.modules + page-exchange-group-id: mule-module-sfdc page-mule-runtime-version: 3.5.0 page-release-notes-page: connector-relnotes.adoc page-vendor-name: salesforce diff --git a/src/partials/connectors/connectors-sidebar.hbs b/src/partials/connectors/connectors-sidebar.hbs index e25dfa1e4..8792d23e0 100644 --- a/src/partials/connectors/connectors-sidebar.hbs +++ b/src/partials/connectors/connectors-sidebar.hbs @@ -33,8 +33,10 @@
    Release notes {{else}} {{/with}} - View in Exchange + {{#if page.attributes.exchange-asset-id}} + View in Exchange + {{/if}}
  • diff --git a/src/partials/connectors/connectors-table.hbs b/src/partials/connectors/connectors-table.hbs index 6f179b207..bf0ab67fb 100644 --- a/src/partials/connectors/connectors-table.hbs +++ b/src/partials/connectors/connectors-table.hbs @@ -58,7 +58,9 @@ "title": "{{delete-suffix connector.title ' Connector'}}", "type": "{{attributes.page-connector-type}}", "iconUrl": "{{@root.uiRootPath}}/img/icons/connectors/icon-{{delete-suffix connector.name '-connector'}}.svg", - "exchangeUrl": "{{attributes.page-exchange-url}}", + {{#if attributes.page-exchange-asset-id}} + "exchangeUrl": "https://www.anypoint.mulesoft.com/exchange/{{attributes.page-exchange-group-id}}/{{attributes.page-exchange-asset-id}}/", + {{/if}} {{#with (resolvePageUrl attributes.page-release-notes-page)}} "releaseNotesPageUrl": "{{relativize this}}", {{else}}