Skip to content
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

Added collapsible GA and Preview in each artifact. #17041

Merged
merged 8 commits into from
Nov 13, 2020
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions eng/docgeneration/Generate-DocIndex.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For testing purpose, will revert the change once ready to merge

LogDebug "Copying template and configuration..."
New-Item -Path "${DocOutDir}" -Name "templates" -ItemType "directory" -Force
Copy-Item "${DocGenDir}/templates/*" -Destination "${DocOutDir}/templates" -Force -Recurse
Expand Down Expand Up @@ -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"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

orthogonal but I'm curious why you don't just remove these and just pass docfx as a parameter?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is better to pass the docfx path in my local run. I am using nuget and npm command to install docfx commands. Have some trouble to find the right path. The best approach is to pass the path as an argument.

# 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
}

Expand Down
29 changes: 29 additions & 0 deletions eng/docgeneration/templates/matthews/styles/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,35 @@ article h4 {
.navbar-inverse .navbar-link:hover {
color: #ecdbff;
}
.versionarrow {
margin-left: 0.8em;
margin-top: -1.5em;
margin-bottom: -1em;
padding: 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 {
Expand Down
62 changes: 47 additions & 15 deletions eng/docgeneration/templates/matthews/styles/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -77,25 +78,56 @@ function httpGetAsync(targetUrl, callback) {
xmlHttp.send(null);
}

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")
function httpGetLatestAsync(targetUrl, latestVersions, packageName) {
httpGetAsync(targetUrl, function (responseText) {
if (responseText) {
options = responseText.match(/[^\r\n]+/g)
version = responseText.match(/[^\r\n]+/g)
$(latestVersions).append('<li><a href="' + getPackageUrl(SELECTED_LANGUAGE, packageName, version) + '" target="_blank">' + version + '</a></li>')
}
})
}

for (var i in options) {
$(publishedversions).append('<li><a href="' + getPackageUrl(SELECTED_LANGUAGE, packageName, options[i]) + '" target="_blank">' + options[i] + '</a></li>')
}
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"
sima-zhu marked this conversation as resolved.
Show resolved Hide resolved
var latestPreviewUrl = "https://azuresdkdocs.blob.core.windows.net/$web/" + SELECTED_LANGUAGE + "/" + packageName + "/versioning/latest-preview"
var latestVersions = document.createElement("ul")
httpGetLatestAsync(latestGAUrl, latestVersions, packageName)
httpGetLatestAsync(latestPreviewUrl, latestVersions, packageName)
var publishedVersions = $('<ul style="display: none;"></ul>')
sima-zhu marked this conversation as resolved.
Show resolved Hide resolved
var collapsible = $('<div class="versionarrow">&nbsp;&nbsp;&nbsp;Other versions</div>')

$(selector).after(latestVersions)
$(latestVersions).after(collapsible)
$(collapsible).after(publishedVersions)

$(collapsible).on('click', function(event) {
event.preventDefault();
if (collapsible.hasClass('disable')) {
return
}
else {
$(publishedversions).append('<li>No discovered versions present in blob storage.</li>')
$(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('<li><a href="' + getPackageUrl(SELECTED_LANGUAGE, packageName, options[i]) + '" target="_blank">' + options[i] + '</a></li>')

}
}
else {
$(publishedVersions).append('<li>No discovered versions present in blob storage.</li>')
}
$(selector).addClass("loaded")
})
}
$(publishedVersions).show()
} else {
$(publishedVersions).hide()
}

$(selector).after(publishedversions)
})
});
}

function getPackageUrl(language, package, version) {
Expand Down