Skip to content

Commit

Permalink
Release v2021.08.26.1 (#987)
Browse files Browse the repository at this point in the history
* Fix can't handle the portal event correctly (#986)
  • Loading branch information
baurine authored Aug 26, 2021
1 parent 8d88b8d commit 29034af
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 12 deletions.
2 changes: 1 addition & 1 deletion release-version
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# This file specifies the TiDB Dashboard internal version, which will be printed in `--version`
# and UI. In release branch, changing this file will result in publishing a new version and tag.
2021.07.30.1
2021.08.26.1
27 changes: 16 additions & 11 deletions ui/dashboardApp/index.ts
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -148,17 +148,22 @@ async function webPageStart() {
async function main() {
if (routing.isPortalPage()) {
// the portal page is only used to receive options
window.addEventListener(
'message',
(event) => {
const { token, lang, hideNav, redirectPath } = event.data
auth.setAuthToken(token)
saveAppOptions({ hideNav, lang })
window.location.hash = `#${redirectPath}`
window.location.reload()
},
{ once: true }
)
function handlePortalEvent(event) {
const { type, token, lang, hideNav, redirectPath } = event.data
// the event type must be "DASHBOARD_PORTAL_EVENT"
if (type !== 'DASHBOARD_PORTAL_EVENT') {
return
}

auth.setAuthToken(token)
saveAppOptions({ hideNav, lang })
window.location.hash = `#${redirectPath}`
window.location.reload()

window.removeEventListener('message', handlePortalEvent)
}

window.addEventListener('message', handlePortalEvent)
return
}

Expand Down
1 change: 1 addition & 0 deletions ui/tests/config-portal-test.html
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1OTIwMjUzMjgsIm9yaWdfaWF0IjoxNTkxOTM4OTI4LCJwIjoibkZyZGh1OXlxdnNOSnBXS1daUUlUTkRPakJFMTc4eExQaXc3Y1g4eGxrNFlxMXBRWXVUU1BLVHdNQXIwM2VDajhvTnJuWDc5ZEFDQWZtblBzZXcwaXhnQWdaR1kveU1pMXNqUUc4L1VkMy9McDJKUTN5elMifQ.ynPM1S2jOBvnEcRJgZK-FEaUuhNCI16GCUXKdYs9T18'
dashboard.contentWindow.postMessage(
{
type: 'DASHBOARD_PORTAL_EVENT',
token,
lang: 'en',
hideNav: true,
Expand Down

0 comments on commit 29034af

Please sign in to comment.