From e5375db78ed29f66fc0b962aaab0f7c5f1e1f773 Mon Sep 17 00:00:00 2001 From: Sima Zhu Date: Fri, 30 Oct 2020 17:46:50 -0700 Subject: [PATCH 1/7] Added collapsible GA and Preview in each artifact. --- eng/docgeneration/Generate-DocIndex.ps1 | 8 +-- .../templates/matthews/styles/main.css | 26 ++++++++ .../templates/matthews/styles/main.js | 66 ++++++++++++++----- 3 files changed, 80 insertions(+), 20 deletions(-) diff --git a/eng/docgeneration/Generate-DocIndex.ps1 b/eng/docgeneration/Generate-DocIndex.ps1 index 4e5c8321daee1..b3b2e765f5d12 100644 --- a/eng/docgeneration/Generate-DocIndex.ps1 +++ b/eng/docgeneration/Generate-DocIndex.ps1 @@ -98,9 +98,9 @@ function GenerateDocfxTocContent([Hashtable]$tocContent, [String]$lang) { $DocOutDir = "${RepoRoot}/docfx_project" LogDebug "Initializing Default DocFx Site..." - & $($DocFx) init -q -o "${DocOutDir}" + #& $($DocFx) init -q -o "${DocOutDir}" # The line below is used for testing in local - #docfx init -q -o "${DocOutDir}" + docfx init -q -o "${DocOutDir}" LogDebug "Copying template and configuration..." New-Item -Path "${DocOutDir}" -Name "templates" -ItemType "directory" -Force Copy-Item "${DocGenDir}/templates/*" -Destination "${DocOutDir}/templates" -Force -Recurse @@ -134,9 +134,9 @@ function GenerateDocfxTocContent([Hashtable]$tocContent, [String]$lang) { Copy-Item "$($RepoRoot)/CONTRIBUTING.md" -Destination "${DocOutDir}/api/CONTRIBUTING.md" -Force LogDebug "Building site..." - & $($DocFx) build "${DocOutDir}/docfx.json" + #& $($DocFx) build "${DocOutDir}/docfx.json" # The line below is used for testing in local - #docfx build "${DocOutDir}/docfx.json" + docfx build "${DocOutDir}/docfx.json" Copy-Item "${DocGenDir}/assets/logo.svg" -Destination "${DocOutDir}/_site/" -Force } diff --git a/eng/docgeneration/templates/matthews/styles/main.css b/eng/docgeneration/templates/matthews/styles/main.css index 10df6c1a5d903..74208c31bc019 100644 --- a/eng/docgeneration/templates/matthews/styles/main.css +++ b/eng/docgeneration/templates/matthews/styles/main.css @@ -255,6 +255,32 @@ article h4 { .navbar-inverse .navbar-link:hover { color: #ecdbff; } +.versionarrow { + margin: 1em; +} + +.versionarrow::before { + position: absolute; + content: ''; + width: 0; + height: 0; + border: .5em solid transparent; + border-left-color: gray; + transform-origin: 0 50%; + transition: transform .1s; + margin-top: 0.2em; +} + + +.versionarrow.disable { + text-decoration: line-through; +} + +.versionarrow.down::before { + transform: rotate(90deg); + margin-top: 0em; + transition: transform .1s; +} @media (max-width: 767px) { .navbar-inverse .navbar-nav .open .dropdown-menu > li > a { diff --git a/eng/docgeneration/templates/matthews/styles/main.js b/eng/docgeneration/templates/matthews/styles/main.js index fbf97f0702987..1dbfec74d2b43 100644 --- a/eng/docgeneration/templates/matthews/styles/main.js +++ b/eng/docgeneration/templates/matthews/styles/main.js @@ -68,6 +68,7 @@ $(function () { }) function httpGetAsync(targetUrl, callback) { + console.log(targetUrl); var xmlHttp = new XMLHttpRequest(); xmlHttp.onreadystatechange = function () { if (xmlHttp.readyState == 4 && xmlHttp.status == 200) @@ -78,24 +79,57 @@ function httpGetAsync(targetUrl, callback) { } function populateIndexList(selector, packageName) { - url = "https://azuresdkdocs.blob.core.windows.net/$web/" + SELECTED_LANGUAGE + "/" + packageName + "/versioning/versions" - - httpGetAsync(url, function (responseText) { - - var publishedversions = document.createElement("ul") - if (responseText) { - options = responseText.match(/[^\r\n]+/g) - - for (var i in options) { - $(publishedversions).append('
  • ' + options[i] + '
  • ') + var url = "https://azuresdkdocs.blob.core.windows.net/$web/" + SELECTED_LANGUAGE + "/" + packageName + "/versioning/versions" + var gaCollapsible = $('
       GA versions
    ') + var previewCollapsible = $('
       Preview versions
    ') + var gaPublishedVersions = $('') + var previewPublishedVersions = $('') + $(selector).after(gaCollapsible) + $(gaCollapsible).after(gaPublishedVersions) + $(gaPublishedVersions).after(previewCollapsible) + $(previewCollapsible).after(previewPublishedVersions) + var collapsibleFunc = function(collapsible, publishedVersions) { + $(collapsible).on('click', function(event) { + event.preventDefault(); + if (collapsible.hasClass('disable')) { + return } - } - else { - $(publishedversions).append('
  • No discovered versions present in blob storage.
  • ') - } + $(this).toggleClass('down') + if ($(this).hasClass('down')) { + if (!$(selector).hasClass('loaded')){ + httpGetAsync(url, function (responseText) { + if (responseText) { + options = responseText.match(/[^\r\n]+/g) + for (var i in options) { + if (options[i].indexOf('beta') >= 0) { + $(previewPublishedVersions).append('
  • ' + packageName + ' - ' + options[i] + '
  • ') + } else { + $(gaPublishedVersions).append('
  • ' + packageName + ' - ' + options[i] + '
  • ') + } + } + } + else { + $(publishedVersions).append('
  • No discovered versions present in blob storage.
  • ') + } + $(selector).addClass("loaded") + + if ($(previewPublishedVersions).children().length == 0) { + $(previewCollapsible).addClass('disable') + } + if ($(gaPublishedVersions).children().length == 0) { + $(gaCollapsible).addClass('disable') + } + }) + } + $(publishedVersions).show() + } else { + $(publishedVersions).hide() + } + }); + } - $(selector).after(publishedversions) - }) + collapsibleFunc($(gaCollapsible), $(gaPublishedVersions)) + collapsibleFunc($(previewCollapsible), $(previewPublishedVersions)) } function getPackageUrl(language, package, version) { From 3680e2d736b9ca0b043c99e71b6da063a7b56961 Mon Sep 17 00:00:00 2001 From: Sima Zhu Date: Fri, 30 Oct 2020 18:09:32 -0700 Subject: [PATCH 2/7] Added check on preview --- eng/docgeneration/templates/matthews/styles/main.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/docgeneration/templates/matthews/styles/main.js b/eng/docgeneration/templates/matthews/styles/main.js index 1dbfec74d2b43..3de7d4544dcda 100644 --- a/eng/docgeneration/templates/matthews/styles/main.js +++ b/eng/docgeneration/templates/matthews/styles/main.js @@ -101,10 +101,10 @@ function populateIndexList(selector, packageName) { if (responseText) { options = responseText.match(/[^\r\n]+/g) for (var i in options) { - if (options[i].indexOf('beta') >= 0) { - $(previewPublishedVersions).append('
  • ' + packageName + ' - ' + options[i] + '
  • ') + if (options[i].indexOf('beta') >= 0 || options[i].indexOf('preview') >= 0) { + $(previewPublishedVersions).append('
  • ' + options[i] + '
  • ') } else { - $(gaPublishedVersions).append('
  • ' + packageName + ' - ' + options[i] + '
  • ') + $(gaPublishedVersions).append('
  • ' + options[i] + '
  • ') } } } From f6abe141a6a77184b20b0cb9e3d9c1babf0d12b1 Mon Sep 17 00:00:00 2001 From: Sima Zhu Date: Tue, 10 Nov 2020 12:46:38 -0800 Subject: [PATCH 3/7] Make a change to the UI look --- .../templates/matthews/styles/main.css | 2 +- .../templates/matthews/styles/main.js | 99 ++++++++++--------- 2 files changed, 53 insertions(+), 48 deletions(-) diff --git a/eng/docgeneration/templates/matthews/styles/main.css b/eng/docgeneration/templates/matthews/styles/main.css index 74208c31bc019..fe2d0525fd147 100644 --- a/eng/docgeneration/templates/matthews/styles/main.css +++ b/eng/docgeneration/templates/matthews/styles/main.css @@ -256,7 +256,7 @@ article h4 { color: #ecdbff; } .versionarrow { - margin: 1em; + margin: 1.5em; } .versionarrow::before { diff --git a/eng/docgeneration/templates/matthews/styles/main.js b/eng/docgeneration/templates/matthews/styles/main.js index 3de7d4544dcda..e3cef797dae93 100644 --- a/eng/docgeneration/templates/matthews/styles/main.js +++ b/eng/docgeneration/templates/matthews/styles/main.js @@ -80,56 +80,61 @@ function httpGetAsync(targetUrl, callback) { function populateIndexList(selector, packageName) { var url = "https://azuresdkdocs.blob.core.windows.net/$web/" + SELECTED_LANGUAGE + "/" + packageName + "/versioning/versions" - var gaCollapsible = $('
       GA versions
    ') - var previewCollapsible = $('
       Preview versions
    ') - var gaPublishedVersions = $('
      ') - var previewPublishedVersions = $('
        ') - $(selector).after(gaCollapsible) - $(gaCollapsible).after(gaPublishedVersions) - $(gaPublishedVersions).after(previewCollapsible) - $(previewCollapsible).after(previewPublishedVersions) - var collapsibleFunc = function(collapsible, publishedVersions) { - $(collapsible).on('click', function(event) { - event.preventDefault(); - if (collapsible.hasClass('disable')) { - return - } - $(this).toggleClass('down') - if ($(this).hasClass('down')) { - if (!$(selector).hasClass('loaded')){ - httpGetAsync(url, function (responseText) { - if (responseText) { - options = responseText.match(/[^\r\n]+/g) - for (var i in options) { - if (options[i].indexOf('beta') >= 0 || options[i].indexOf('preview') >= 0) { - $(previewPublishedVersions).append('
      • ' + options[i] + '
      • ') - } else { - $(gaPublishedVersions).append('
      • ' + options[i] + '
      • ') - } - } - } - else { - $(publishedVersions).append('
      • No discovered versions present in blob storage.
      • ') - } - $(selector).addClass("loaded") + var latestGAUrl = "https://azuresdkdocs.blob.core.windows.net/$web/" + SELECTED_LANGUAGE + "/" + packageName + "/versioning/latest-ga" + var latestPreviewUrl = "https://azuresdkdocs.blob.core.windows.net/$web/" + SELECTED_LANGUAGE + "/" + packageName + "/versioning/latest-preview" + var latestVersions = document.createElement("ul") + httpGetAsync(latestGAUrl, function (responseText) { + if (responseText) { + version = responseText.match(/[^\r\n]+/g) + $(latestVersions).append('
      • ' + 'Latest GA Version: ' + version + '
      • ') + } + else { + $(latestVersions).append('
      • No latest GA versions found.
      • ') + } + }) + httpGetAsync(latestPreviewUrl, function (responseText) { + if (responseText) { + version = responseText.match(/[^\r\n]+/g) + $(latestVersions).append('
      • ' + 'Latest Preview Version: ' + version + '
      • ') + } + else { + $(latestVersions).append('
      • No latest Preview versions found.
      • ') + } + }) + var publishedVersions = $('
          ') + var collapsible = $('
             Other versions
          ') - if ($(previewPublishedVersions).children().length == 0) { - $(previewCollapsible).addClass('disable') - } - if ($(gaPublishedVersions).children().length == 0) { - $(gaCollapsible).addClass('disable') + $(selector).after(latestVersions) + $(latestVersions).after(collapsible) + $(collapsible).after(publishedVersions) + + $(collapsible).on('click', function(event) { + event.preventDefault(); + if (collapsible.hasClass('disable')) { + return + } + $(this).toggleClass('down') + if ($(this).hasClass('down')) { + if (!$(selector).hasClass('loaded')){ + httpGetAsync(url, function (responseText) { + if (responseText) { + options = responseText.match(/[^\r\n]+/g) + for (var i in options) { + $(publishedVersions).append('
        • ' + options[i] + '
        • ') + } - }) - } - $(publishedVersions).show() - } else { - $(publishedVersions).hide() + } + else { + $(publishedVersions).append('
        • No discovered versions present in blob storage.
        • ') + } + $(selector).addClass("loaded") + }) } - }); - } - - collapsibleFunc($(gaCollapsible), $(gaPublishedVersions)) - collapsibleFunc($(previewCollapsible), $(previewPublishedVersions)) + $(publishedVersions).show() + } else { + $(publishedVersions).hide() + } + }); } function getPackageUrl(language, package, version) { From 2f9c8197acf97d43132b014320a7c89b5b8eb8ed Mon Sep 17 00:00:00 2001 From: Sima Zhu Date: Tue, 10 Nov 2020 12:51:07 -0800 Subject: [PATCH 4/7] Revert testing changes --- eng/docgeneration/Generate-DocIndex.ps1 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/eng/docgeneration/Generate-DocIndex.ps1 b/eng/docgeneration/Generate-DocIndex.ps1 index 4ff3cce3ca1c8..293e3d2f3609d 100644 --- a/eng/docgeneration/Generate-DocIndex.ps1 +++ b/eng/docgeneration/Generate-DocIndex.ps1 @@ -98,9 +98,9 @@ function GenerateDocfxTocContent([Hashtable]$tocContent, [String]$lang) { LogDebug "Start generating the docfx toc and build docfx site..." LogDebug "Initializing Default DocFx Site..." - #& $($DocFx) init -q -o "${DocOutDir}" + & $($DocFx) init -q -o "${DocOutDir}" # The line below is used for testing in local - docfx init -q -o "${DocOutDir}" + #docfx init -q -o "${DocOutDir}" LogDebug "Copying template and configuration..." New-Item -Path "${DocOutDir}" -Name "templates" -ItemType "directory" -Force Copy-Item "${DocGenDir}/templates/*" -Destination "${DocOutDir}/templates" -Force -Recurse @@ -134,9 +134,9 @@ function GenerateDocfxTocContent([Hashtable]$tocContent, [String]$lang) { Copy-Item "$($RepoRoot)/CONTRIBUTING.md" -Destination "${DocOutDir}/api/CONTRIBUTING.md" -Force LogDebug "Building site..." - #& $($DocFx) build "${DocOutDir}/docfx.json" + & $($DocFx) build "${DocOutDir}/docfx.json" # The line below is used for testing in local - docfx build "${DocOutDir}/docfx.json" + #docfx build "${DocOutDir}/docfx.json" Copy-Item "${DocGenDir}/assets/logo.svg" -Destination "${DocOutDir}/_site/" -Force } From 5d10c74198aad90842c30d177439a4c21766ef21 Mon Sep 17 00:00:00 2001 From: Sima Zhu Date: Thu, 12 Nov 2020 15:36:06 -0800 Subject: [PATCH 5/7] adjust the version arrow position. --- eng/docgeneration/Generate-DocIndex.ps1 | 8 ++--- .../templates/matthews/styles/main.css | 5 +++- .../templates/matthews/styles/main.js | 29 +++++++------------ 3 files changed, 19 insertions(+), 23 deletions(-) diff --git a/eng/docgeneration/Generate-DocIndex.ps1 b/eng/docgeneration/Generate-DocIndex.ps1 index 293e3d2f3609d..4ff3cce3ca1c8 100644 --- a/eng/docgeneration/Generate-DocIndex.ps1 +++ b/eng/docgeneration/Generate-DocIndex.ps1 @@ -98,9 +98,9 @@ function GenerateDocfxTocContent([Hashtable]$tocContent, [String]$lang) { LogDebug "Start generating the docfx toc and build docfx site..." LogDebug "Initializing Default DocFx Site..." - & $($DocFx) init -q -o "${DocOutDir}" + #& $($DocFx) init -q -o "${DocOutDir}" # The line below is used for testing in local - #docfx init -q -o "${DocOutDir}" + docfx init -q -o "${DocOutDir}" LogDebug "Copying template and configuration..." New-Item -Path "${DocOutDir}" -Name "templates" -ItemType "directory" -Force Copy-Item "${DocGenDir}/templates/*" -Destination "${DocOutDir}/templates" -Force -Recurse @@ -134,9 +134,9 @@ function GenerateDocfxTocContent([Hashtable]$tocContent, [String]$lang) { Copy-Item "$($RepoRoot)/CONTRIBUTING.md" -Destination "${DocOutDir}/api/CONTRIBUTING.md" -Force LogDebug "Building site..." - & $($DocFx) build "${DocOutDir}/docfx.json" + #& $($DocFx) build "${DocOutDir}/docfx.json" # The line below is used for testing in local - #docfx build "${DocOutDir}/docfx.json" + docfx build "${DocOutDir}/docfx.json" Copy-Item "${DocGenDir}/assets/logo.svg" -Destination "${DocOutDir}/_site/" -Force } diff --git a/eng/docgeneration/templates/matthews/styles/main.css b/eng/docgeneration/templates/matthews/styles/main.css index fe2d0525fd147..430f25f3cd644 100644 --- a/eng/docgeneration/templates/matthews/styles/main.css +++ b/eng/docgeneration/templates/matthews/styles/main.css @@ -256,7 +256,10 @@ article h4 { color: #ecdbff; } .versionarrow { - margin: 1.5em; + margin-left: 1em; + margin-top: -1.5em; + margin-bottom: -1em; + padding: 1em; } .versionarrow::before { diff --git a/eng/docgeneration/templates/matthews/styles/main.js b/eng/docgeneration/templates/matthews/styles/main.js index e3cef797dae93..449afbecc96be 100644 --- a/eng/docgeneration/templates/matthews/styles/main.js +++ b/eng/docgeneration/templates/matthews/styles/main.js @@ -78,29 +78,22 @@ function httpGetAsync(targetUrl, callback) { xmlHttp.send(null); } +function httpGetLatestAsync(targetUrl, latestVersions, packageName) { + httpGetAsync(targetUrl, function (responseText) { + if (responseText) { + version = responseText.match(/[^\r\n]+/g) + $(latestVersions).append('
        • ' + version + '
        • ') + } + }) +} + function populateIndexList(selector, packageName) { var url = "https://azuresdkdocs.blob.core.windows.net/$web/" + SELECTED_LANGUAGE + "/" + packageName + "/versioning/versions" var latestGAUrl = "https://azuresdkdocs.blob.core.windows.net/$web/" + SELECTED_LANGUAGE + "/" + packageName + "/versioning/latest-ga" var latestPreviewUrl = "https://azuresdkdocs.blob.core.windows.net/$web/" + SELECTED_LANGUAGE + "/" + packageName + "/versioning/latest-preview" var latestVersions = document.createElement("ul") - httpGetAsync(latestGAUrl, function (responseText) { - if (responseText) { - version = responseText.match(/[^\r\n]+/g) - $(latestVersions).append('
        • ' + 'Latest GA Version: ' + version + '
        • ') - } - else { - $(latestVersions).append('
        • No latest GA versions found.
        • ') - } - }) - httpGetAsync(latestPreviewUrl, function (responseText) { - if (responseText) { - version = responseText.match(/[^\r\n]+/g) - $(latestVersions).append('
        • ' + 'Latest Preview Version: ' + version + '
        • ') - } - else { - $(latestVersions).append('
        • No latest Preview versions found.
        • ') - } - }) + httpGetLatestAsync(latestGAUrl, latestVersions, packageName) + httpGetLatestAsync(latestPreviewUrl, latestVersions, packageName) var publishedVersions = $('
            ') var collapsible = $('
               Other versions
            ') From edda34232ac84af243c89d1ffaf1e3ec9082c7f6 Mon Sep 17 00:00:00 2001 From: Sima Zhu Date: Thu, 12 Nov 2020 15:40:16 -0800 Subject: [PATCH 6/7] More adjustment --- eng/docgeneration/templates/matthews/styles/main.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/docgeneration/templates/matthews/styles/main.css b/eng/docgeneration/templates/matthews/styles/main.css index 430f25f3cd644..21eb0c3567f36 100644 --- a/eng/docgeneration/templates/matthews/styles/main.css +++ b/eng/docgeneration/templates/matthews/styles/main.css @@ -256,7 +256,7 @@ article h4 { color: #ecdbff; } .versionarrow { - margin-left: 1em; + margin-left: 0.8em; margin-top: -1.5em; margin-bottom: -1em; padding: 1em; From 073cb1c630b6303e7b1d12245642f563ad1d4e65 Mon Sep 17 00:00:00 2001 From: Sima Zhu Date: Thu, 12 Nov 2020 16:09:38 -0800 Subject: [PATCH 7/7] comment back the docfx command --- eng/docgeneration/Generate-DocIndex.ps1 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/eng/docgeneration/Generate-DocIndex.ps1 b/eng/docgeneration/Generate-DocIndex.ps1 index 4ff3cce3ca1c8..293e3d2f3609d 100644 --- a/eng/docgeneration/Generate-DocIndex.ps1 +++ b/eng/docgeneration/Generate-DocIndex.ps1 @@ -98,9 +98,9 @@ function GenerateDocfxTocContent([Hashtable]$tocContent, [String]$lang) { LogDebug "Start generating the docfx toc and build docfx site..." LogDebug "Initializing Default DocFx Site..." - #& $($DocFx) init -q -o "${DocOutDir}" + & $($DocFx) init -q -o "${DocOutDir}" # The line below is used for testing in local - docfx init -q -o "${DocOutDir}" + #docfx init -q -o "${DocOutDir}" LogDebug "Copying template and configuration..." New-Item -Path "${DocOutDir}" -Name "templates" -ItemType "directory" -Force Copy-Item "${DocGenDir}/templates/*" -Destination "${DocOutDir}/templates" -Force -Recurse @@ -134,9 +134,9 @@ function GenerateDocfxTocContent([Hashtable]$tocContent, [String]$lang) { Copy-Item "$($RepoRoot)/CONTRIBUTING.md" -Destination "${DocOutDir}/api/CONTRIBUTING.md" -Force LogDebug "Building site..." - #& $($DocFx) build "${DocOutDir}/docfx.json" + & $($DocFx) build "${DocOutDir}/docfx.json" # The line below is used for testing in local - docfx build "${DocOutDir}/docfx.json" + #docfx build "${DocOutDir}/docfx.json" Copy-Item "${DocGenDir}/assets/logo.svg" -Destination "${DocOutDir}/_site/" -Force }