-
Notifications
You must be signed in to change notification settings - Fork 27.4k
chore(docs-app): allow switching to newer versions #15281
Conversation
With this patch, the docs app will request available versions data from the snapshot, which are now stored in a separate versions-data.json file. This only affects docs apps that contain this commit, so older doc apps will still only display the versions up to their own version.
minor = version.minor; | ||
} | ||
}).then(function() { | ||
return $http.get('../snapshot/versions_data.json'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this relative URL work when it is running from the root of https://docs.angularjs.org
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. So for https://docs.angularjs.org (which is the snapshot) we cannot use this relative path. At the moment, it doesn't matter, because we only get the snapshot versions-data when we are not on the snapshot.
For all other versions the root is https://code.angularjs.org//docs. In that case, this should be either ../../snapshot/versions_data.json
or /snapshot/versions_data.json
.
However, since we want to point docs.angularjs.org to the latest stable, an absolute url is probably the best idea. At the moment, this doesn't work because of CORS, though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this fail silently when people run the docs app locally?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. It will also fail silently if the snapshot json data can't be requested for some reason. It's strictly an optional enhancement.
👍 This is a much needed improvement. |
@Narretz and I had a chat about this. We came up with new idea that doesn't require a change to the docs app and will work with older versions too. |
What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
Feature for the docs app
What is the current behavior? (You can also link to an open issue here)
You cannot switch to a newer version from an older version in the docs app.
What is the new behavior (if this is a feature change)?
For docs app versions that contain this commit, switchting is possible. The docs app
will request the new versions-data.json file from the snapshot folder and fill the version switcher with
this data.
Does this PR introduce a breaking change?
No
Please check if the PR fulfills these requirements
[] Tests for the changes have been added (for bug fixes / features)[ ] Docs have been added / updated (for bug fixes / features)Other information:
With this patch, the docs app will request available versions data from the snapshot,
which are now stored in a separate versions-data.json file.
This only affects docs apps that contain this commit, so older doc apps
will still only display the versions up to their own version.