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 5 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
26 changes: 26 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,32 @@ article h4 {
.navbar-inverse .navbar-link:hover {
color: #ecdbff;
}
.versionarrow {
margin: 1.5em;
}

.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
65 changes: 52 additions & 13 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 @@ -78,24 +79,62 @@ 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")
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")
httpGetAsync(latestGAUrl, 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>')
}
version = responseText.match(/[^\r\n]+/g)
$(latestVersions).append('<li><a href="' + getPackageUrl(SELECTED_LANGUAGE, packageName, version) + '" target="_blank">' + 'Latest GA Version: ' + version + '</a></li>')
}
else {
$(publishedversions).append('<li>No discovered versions present in blob storage.</li>')
$(latestVersions).append('<li>No latest GA versions found.</li>')
}
})
httpGetAsync(latestPreviewUrl, function (responseText) {
if (responseText) {
version = responseText.match(/[^\r\n]+/g)
$(latestVersions).append('<li><a href="' + getPackageUrl(SELECTED_LANGUAGE, packageName, version) + '" target="_blank">' + 'Latest Preview Version: ' + version + '</a></li>')
}

$(selector).after(publishedversions)
else {
$(latestVersions).append('<li>No latest Preview versions found.</li>')
}
})
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
}
$(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()
}
});
}

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