From e11beeae0d2437ea7b963c4ee8b1c951997872e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mar=C3=ADa=20Florencia=20Caballero?= <66144664+MFCaballero@users.noreply.github.com> Date: Tue, 5 Mar 2024 16:53:43 -0300 Subject: [PATCH] default theme for 1.8.4 --- default/assets/.DS_Store | Bin 0 -> 6148 bytes default/assets/images/.DS_Store | Bin 0 -> 6148 bytes .../javascripts/components/interactive.js | 75 +++++++++++++++--- default/assets/javascripts/main.js | 8 +- default/assets/stylesheets/main.css | 4 - .../assets/stylesheets/pages/api-product.css | 11 ++- .../assets/stylesheets/pages/catalogue.css | 6 +- default/layouts/portal_layout.tmpl | 11 +-- default/layouts/product_layout_doc_redoc.tmpl | 4 +- .../layouts/product_layout_doc_stoplight.tmpl | 4 +- default/mailers/welcome_admin.html.tmpl | 7 ++ default/mailers/welcome_admin.text.tmpl | 7 ++ default/mailers/welcome_admin.tmpl | 7 ++ default/mailers/welcome_dev.html.tmpl | 6 ++ default/mailers/welcome_dev.text.tmpl | 6 ++ default/mailers/welcome_dev.tmpl | 6 ++ default/views/portal_product_detail.tmpl | 8 +- default/views/product_doc_redoc.tmpl | 2 +- 18 files changed, 137 insertions(+), 35 deletions(-) create mode 100644 default/assets/.DS_Store create mode 100644 default/assets/images/.DS_Store create mode 100644 default/mailers/welcome_admin.html.tmpl create mode 100644 default/mailers/welcome_admin.text.tmpl create mode 100644 default/mailers/welcome_admin.tmpl create mode 100644 default/mailers/welcome_dev.html.tmpl create mode 100644 default/mailers/welcome_dev.text.tmpl create mode 100644 default/mailers/welcome_dev.tmpl diff --git a/default/assets/.DS_Store b/default/assets/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..cd3a2cf86a516c8064df523e3cb54a7528c4c45a GIT binary patch literal 6148 zcmeHKOKQU~5S>X)F?8c)mbyZ2AcAuOU!aACP{;>bnzdIsSC7^=pN;Ew=WfCq7(Hn; zPeO0u@ra0SKVLT@ortt>L%G>7H`_O#*(xIngyW38d|Ze3^YL;%%(8zE823@$xbJp-VT7#oUcOC^nH<*~Ix z6;K8KngYCb`;<^h1y*i-{Vr*Kofp$IFH&%LgSbQ)eTt#Qn?g!C{N`BiB|Urm_Xhuj zW|V;!VRtBKjcf`0BNwA+k7CXnQ385ElpHZyvzpfif1egKMZP7KyW=q*4Q9`M$pYNg z*qwR9V*q9$s@(&(c$&3)igs@`?fSxBWAq6|vT%E5tLEmY<~Q*CZjo_?%+1+i_3Ie} zuo6*y3H{cd8mx1je+*7WPZ(8(uj5}v0v)IFWOsNkr)Xb~aR$E^dh}+z#E5guBWsp{ zvq9ZD3YnvN#2!3Kup@j)BCW=(${f`_Ff6rJ1#o7w1&0>3Rs~c6Rp46z-XB5~#@JzH zQML|Las>c((Jh8H|5ae0&|&PbvWPb@V_kvP)wnB$vF_*(9WQoRS+wqC+~vc#%*NeN zjATdrQ0Qc0i(0D!s=%%Sd-ie2=l|8u_y1ideNqKffq$id=}vAYV+_fit={1HtPN4_ qP}rDPSrivk?l_hPAH}CAVt5yF0~kB3ETRXde*{DZtyF { s.classList.remove('active'); stepsCollection[stepIndex].classList.add('active'); + let footer = document.querySelector("footer"); + let activeTab = stepsCollection[stepIndex]; + let redoc = document.getElementById("redoc-wrapper"); + if (activeTab && activeTab.innerHTML != "API SPECIFICATIONS") { + footer.style.marginTop = "0px"; + }else if (activeTab && activeTab.innerHTML == "API SPECIFICATIONS" && redoc){ + footer.style.marginTop = redoc.clientHeight + "px"; + } }); if (stepIndex > 0) { SetMarkdownContent(`set-markdown-content-${stepIndex}`); @@ -114,27 +122,35 @@ function handleContent(element, content) { } element.appendChild(content); } +function getURLValue(urlArr) { + if (urlArr.length > 1 ) { + return urlArr.join("-"); + } + return urlArr[0]; +} + export function HandleApiSpecSelect({selectorId, downloadSelectorId, displaySelectorId}) { let selector = document.getElementById(selectorId); let downloadSelector = document.getElementById(downloadSelectorId); let displaySelector = document.getElementById(displaySelectorId); let oasTemplate = selector?.getAttribute("data-template"); let path = downloadSelector?.getAttribute("data-path"); - let value = selector?.value.split("-"); + let [, ...docURL] = selector && selector.value ? selector.value.split("-") : []; let tmplIsRedoc = isRedoc(oasTemplate); - if (selector && isOAS(value[1]) && tmplIsRedoc) { - Redoc?.init(value[1]) + let url = getURLValue(docURL); + if (selector && isOAS(url) && tmplIsRedoc) { + initRedoc(url); } - selector?.addEventListener('change', (e) => { - let value = e.target.value.split("-"); - downloadSelector.action = `${path}/${value[0]}/docs/download`; - if (tmplIsRedoc && isOAS(value[1])) { - Redoc?.init(value[1]) + let [apiID, ...docURL] = e.target.value.split("-"); + let url = getURLValue(docURL); + downloadSelector.action = `${path}/${apiID}/docs/download`; + if (tmplIsRedoc && isOAS(url)) { + initRedoc(url); return } let elementsApi = document.createElement('elements-api'); - elementsApi.setAttribute('apiDescriptionUrl', value[1]); + elementsApi.setAttribute('apiDescriptionUrl', url); elementsApi.setAttribute('router', 'hash'); elementsApi.setAttribute('layout', 'sidebar'); elementsApi.setAttribute('hideExport', 'true'); @@ -152,4 +168,45 @@ export function SetMarkdownContent(id) { content.innerHTML = html; content.setAttribute("converted", "true"); } +} + +function initRedoc(url) { + let wrapper = document.getElementById("redoc-wrapper"); + if (Redoc) { + Redoc.init(url, { + scrollYOffset: ".navbar", + }, wrapper, (redoc) => { + let footer = document.querySelector("footer"); + let activeTab = document.querySelector(".step.active.tab"); + if (activeTab?.innerHTML == "API SPECIFICATIONS") { + footer.style.marginTop = wrapper.clientHeight + "px"; + } + }) + } +} + +export function HandleTruncateText(selectorWrapper, selector, attribute) { + let elementWrapper = document.querySelectorAll(selectorWrapper); + elementWrapper?.forEach(element => { + let textElement = element.querySelector(selector); + let maxHeight = element.style.maxHeight; + if (textElement && textElement.getAttribute(attribute) != textElement.innerText) { + element.addEventListener('mouseover', function () { + handleTextExpand(textElement, attribute); + element.style.maxHeight = 'none'; + + }); + + element.addEventListener('mouseout', function () { + handleTextExpand(textElement, attribute); + element.style.maxHeight = maxHeight; + }); + } + }) +} + +function handleTextExpand(textElement, attribute) { + let data = textElement?.getAttribute(attribute); + textElement.setAttribute(attribute, textElement.innerText); + textElement.innerText = data; } \ No newline at end of file diff --git a/default/assets/javascripts/main.js b/default/assets/javascripts/main.js index f2d2ba5..cb0f1eb 100644 --- a/default/assets/javascripts/main.js +++ b/default/assets/javascripts/main.js @@ -1,5 +1,5 @@ import { SortBy } from './components/sorting.js'; -import { Interactive, HandleApiSpecSelect, SetMarkdownContent } from './components/interactive.js'; +import { Interactive, HandleApiSpecSelect, SetMarkdownContent, HandleTruncateText } from './components/interactive.js'; import { onProductFormSubmit, onAppFormSubmit, handleTLSCertificate } from './components/submit-form.js'; import { fromSearch, fromButton } from './components/set-element-value.js'; import { decoratePasswordReveal } from './components/decorate-password-reveal.js'; @@ -102,6 +102,8 @@ SelectMultiple({ SelectMultipleInput("response-codes-traffic-chart"); SelectMultipleInput("response-codes-error-rate-chart"); +HandleTruncateText(".product-api-details", ".api-description-text", "data-description"); + /* Enable Bootstrap tooltips */ $(function() { $('[data-toggle="tooltip"]').tooltip() @@ -158,9 +160,9 @@ OnChangeHandlerForFilters("analytics-overview-select-apps", OnChangeHandlerOverv OnChangeHandlerForFilters("error-rate-statistics", OnChangeHandlerStatisticsErrorRate); OnChangeHandlerForFilters("latency-time-unit", OnChangeHandlerLatencyTimeUnit); ExportCSV({chartID: "traffic-chart", buttonID: "traffic-chart-csv", filename: "api-calls.csv"}); -ExportCSV({chartID: "traffic-chart", buttonID: "traffic-chart-csv", filename: "api-calls.csv"}); +ExportCSV({chartID: "error-rate-chart", buttonID: "error-rate-chart-csv", filename: "error-rates.csv"}); ExportCSV({chartID: "hits-vs-errors-chart", buttonID: "hits-vs-errors-chart-csv", filename: "hits-vs-errors.csv"}); -ExportCSV({chartID: "error-rates-chart", buttonID: "error-rates-chart-csv", filename: "error-rates.csv"}); +ExportCSV({chartID: "error-rates-chart", buttonID: "error-rates-chart-csv", filename: "error-rates-api.csv"}); ExportCSV({chartID: "error-breakdown-chart", buttonID: "error-breakdown-chart-csv", filename: "error-breakdown.csv"}); ExportCSV({chartID: "latency-chart", buttonID: "latency-chart-csv", filename: "latency.csv"}); HandleCalendar("#analytics-date-picker"); diff --git a/default/assets/stylesheets/main.css b/default/assets/stylesheets/main.css index 90c4937..7d19b9a 100644 --- a/default/assets/stylesheets/main.css +++ b/default/assets/stylesheets/main.css @@ -139,7 +139,3 @@ body { .container { max-width: 1230px; } - -html { - scroll-behavior: smooth; -} diff --git a/default/assets/stylesheets/pages/api-product.css b/default/assets/stylesheets/pages/api-product.css index a29ab0f..a06ccb3 100644 --- a/default/assets/stylesheets/pages/api-product.css +++ b/default/assets/stylesheets/pages/api-product.css @@ -130,7 +130,6 @@ max-width: 274px; max-height: 166px; cursor: pointer; - overflow: scroll; } .labeled-card:hover { background: var(--tdp-light-gray); @@ -286,9 +285,9 @@ .api-description-text{ min-width: 255px; max-width: 255px; - max-height: 30px; - min-height: 30px; - overflow: scroll; + overflow-x: hidden; + white-space: normal; + overflow-wrap: break-word; } .step-wrapper-api-docs{ @@ -440,3 +439,7 @@ color: var(--tdp-text-color); font-family: 'OpenSans-Regular'!important; } +#redoc-wrapper{ + position: absolute; + width: 100%; +} \ No newline at end of file diff --git a/default/assets/stylesheets/pages/catalogue.css b/default/assets/stylesheets/pages/catalogue.css index 7f79c45..c50cd86 100644 --- a/default/assets/stylesheets/pages/catalogue.css +++ b/default/assets/stylesheets/pages/catalogue.css @@ -97,4 +97,8 @@ width: 100%; margin-bottom: 15px; } -} \ No newline at end of file +} + +.catalogue-input-radio{ + opacity: 1 !important; +} diff --git a/default/layouts/portal_layout.tmpl b/default/layouts/portal_layout.tmpl index e17bd52..966a618 100644 --- a/default/layouts/portal_layout.tmpl +++ b/default/layouts/portal_layout.tmpl @@ -1,5 +1,7 @@ +{{ $pageTitle := PageTitle req }} + @@ -10,7 +12,7 @@ - {{ if .page}} {{.page.Title}} {{else}} Developer Portal {{end}} + {{ if $pageTitle}} {{ $pageTitle}} {{else}} {{ if .page}} {{.page.Title}} {{else}} Developer Portal {{end}} {{end}} {{if IsFullstoryEnabled}} - - - + + + diff --git a/default/layouts/product_layout_doc_redoc.tmpl b/default/layouts/product_layout_doc_redoc.tmpl index e10fd12..f0efe25 100644 --- a/default/layouts/product_layout_doc_redoc.tmpl +++ b/default/layouts/product_layout_doc_redoc.tmpl @@ -30,8 +30,8 @@ {{ render "footer" . }} - - + + diff --git a/default/layouts/product_layout_doc_stoplight.tmpl b/default/layouts/product_layout_doc_stoplight.tmpl index 912d5bc..8c0fb16 100644 --- a/default/layouts/product_layout_doc_stoplight.tmpl +++ b/default/layouts/product_layout_doc_stoplight.tmpl @@ -14,8 +14,8 @@ - - + + diff --git a/default/mailers/welcome_admin.html.tmpl b/default/mailers/welcome_admin.html.tmpl new file mode 100644 index 0000000..725f3cf --- /dev/null +++ b/default/mailers/welcome_admin.html.tmpl @@ -0,0 +1,7 @@ +

Welcome to the Developer portal

+ +Hi, {{.user.First}} {{.user.Last}}.
+Thank you for registering with the Developer Portal. Your admin profile has been created. +Once your profile is activated, you can manage the developer portal content by logging in portal at https://portal.com/admin. + +If you did not perform this action, please contact the customer support team at customer@support.com. \ No newline at end of file diff --git a/default/mailers/welcome_admin.text.tmpl b/default/mailers/welcome_admin.text.tmpl new file mode 100644 index 0000000..7a10b1c --- /dev/null +++ b/default/mailers/welcome_admin.text.tmpl @@ -0,0 +1,7 @@ +Welcome to the Developer portal + +Hi, {{.user.First}} {{.user.Last}}. +Thank you for registering with the Developer Portal. Your admin profile has been created. +Once your profile is activated, you can manage the developer portal content by logging in portal at https://portal.com/admin. + +If you did not perform this action, please contact the customer support team at customer@support.com. \ No newline at end of file diff --git a/default/mailers/welcome_admin.tmpl b/default/mailers/welcome_admin.tmpl new file mode 100644 index 0000000..7a10b1c --- /dev/null +++ b/default/mailers/welcome_admin.tmpl @@ -0,0 +1,7 @@ +Welcome to the Developer portal + +Hi, {{.user.First}} {{.user.Last}}. +Thank you for registering with the Developer Portal. Your admin profile has been created. +Once your profile is activated, you can manage the developer portal content by logging in portal at https://portal.com/admin. + +If you did not perform this action, please contact the customer support team at customer@support.com. \ No newline at end of file diff --git a/default/mailers/welcome_dev.html.tmpl b/default/mailers/welcome_dev.html.tmpl new file mode 100644 index 0000000..d76e105 --- /dev/null +++ b/default/mailers/welcome_dev.html.tmpl @@ -0,0 +1,6 @@ +

Welcome to the Developer portal

+ +Hi, {{.user.First}} {{.user.Last}}.
+Thank you for registering with the Developer Portal. Your developer profile has been created. + +If you did not perform this action, please contact the customer support team at customer@support.com. \ No newline at end of file diff --git a/default/mailers/welcome_dev.text.tmpl b/default/mailers/welcome_dev.text.tmpl new file mode 100644 index 0000000..38028f1 --- /dev/null +++ b/default/mailers/welcome_dev.text.tmpl @@ -0,0 +1,6 @@ +Welcome to the Developer portal + +Hi, {{.user.First}} {{.user.Last}}. +Thank you for registering with the Developer Portal. Your developer profile has been created. + +If you did not perform this action, please contact the customer support team at customer@support.com. \ No newline at end of file diff --git a/default/mailers/welcome_dev.tmpl b/default/mailers/welcome_dev.tmpl new file mode 100644 index 0000000..2664a6f --- /dev/null +++ b/default/mailers/welcome_dev.tmpl @@ -0,0 +1,6 @@ +Welcome to the Developer portal + +Hi, {{.user.First}} {{.user.Last}} +Thank you for registering with the Developer Portal. Your developer profile has been created. + +If you did not perform this action, please contact the customer support team at customer@support.com. \ No newline at end of file diff --git a/default/views/portal_product_detail.tmpl b/default/views/portal_product_detail.tmpl index f8f88dd..7d4b224 100644 --- a/default/views/portal_product_detail.tmpl +++ b/default/views/portal_product_detail.tmpl @@ -25,7 +25,6 @@ {{ if .errors }}