forked from pingcap/tidb-dashboard
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refine clinic cloud variant (pingcap#1414)
* add start entry * refine start options * refine start options * add more app options * make slow query app configurable from html * support cloud ngm topsql
- Loading branch information
Showing
21 changed files
with
426 additions
and
150 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
169 changes: 169 additions & 0 deletions
169
ui/packages/tidb-dashboard-for-clinic-cloud/public/ngm.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,169 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<link rel="icon" href="./distro-res/favicon.ico" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<meta | ||
http-equiv="Cache-control" | ||
content="no-cache, no-store, must-revalidate" | ||
/> | ||
<style> | ||
body { | ||
margin: 0; | ||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, | ||
Oxygen, Ubuntu, Cantarell, 'Fira Sans', 'Droid Sans', 'Helvetica Neue', | ||
sans-serif; | ||
-webkit-font-smoothing: antialiased; | ||
-moz-osx-font-smoothing: grayscale; | ||
background: #fff; | ||
} | ||
|
||
#dashboard_page_spinner { | ||
position: absolute; | ||
top: 50%; | ||
left: 50%; | ||
} | ||
|
||
#dashboard_page_spinner p { | ||
margin-left: -50%; | ||
margin-top: 8px; | ||
color: #888; | ||
} | ||
|
||
.dot-flashing { | ||
position: relative; | ||
width: 10px; | ||
height: 10px; | ||
border-radius: 5px; | ||
background-color: #aaa; | ||
-webkit-animation: dot-flashing 1s infinite linear alternate; | ||
animation: dot-flashing 1s infinite linear alternate; | ||
-webkit-animation-delay: 0.5s; | ||
animation-delay: 0.5s; | ||
} | ||
|
||
.dot-flashing::before, | ||
.dot-flashing::after { | ||
content: ''; | ||
display: inline-block; | ||
position: absolute; | ||
top: 0; | ||
} | ||
|
||
.dot-flashing::before { | ||
left: -15px; | ||
width: 10px; | ||
height: 10px; | ||
border-radius: 5px; | ||
background-color: #aaa; | ||
-webkit-animation: dot-flashing 1s infinite alternate; | ||
animation: dot-flashing 1s infinite alternate; | ||
-webkit-animation-delay: 0s; | ||
animation-delay: 0s; | ||
} | ||
|
||
.dot-flashing::after { | ||
left: 15px; | ||
width: 10px; | ||
height: 10px; | ||
border-radius: 5px; | ||
background-color: #aaa; | ||
-webkit-animation: dot-flashing 1s infinite alternate; | ||
animation: dot-flashing 1s infinite alternate; | ||
-webkit-animation-delay: 1s; | ||
animation-delay: 1s; | ||
} | ||
|
||
@-webkit-keyframes dot-flashing { | ||
0% { | ||
background-color: #aaa; | ||
} | ||
50%, | ||
100% { | ||
background-color: #ddd; | ||
} | ||
} | ||
|
||
@keyframes dot-flashing { | ||
0% { | ||
background-color: #aaa; | ||
} | ||
50%, | ||
100% { | ||
background-color: #ddd; | ||
} | ||
} | ||
</style> | ||
<link rel="stylesheet" href="./dashboardApp.css?t=%TIME_PLACE_HOLDER%" /> | ||
</head> | ||
<body> | ||
<noscript>You need to enable JavaScript to run this app.</noscript> | ||
|
||
<div id="dashboard_page_spinner"> | ||
<div class="dot-flashing"></div> | ||
<p> | ||
It may take a bit long time to load for the first time, due to download | ||
some js files. | ||
</p> | ||
</div> | ||
<div id="root"></div> | ||
|
||
<script type="module"> | ||
import startDashboard from './dashboardApp.js?t=%TIME_PLACE_HOLDER%' | ||
|
||
const apiToken = localStorage.getItem('clinic.auth.csrf_token') | ||
|
||
// example entry link: | ||
// http://localhost:8181/clinic/dashboard/cloud/ngm.html?provider=aws®ion=us-west-2&orgId=30052&projectId=43584&clusterId=61992#/slow_query | ||
// http://localhost:8181/clinic/dashboard/cloud/ngm.html?provider=aws®ion=us-west-2&orgId=30052&projectId=43584&clusterId=61992#/topsql | ||
const searchParams = new URLSearchParams(window.location.search) | ||
const provider = searchParams.get('provider') || '' | ||
const region = searchParams.get('region') || '' | ||
const orgId = searchParams.get('orgId') || '' | ||
const projectId = searchParams.get('projectId') || '' | ||
const clusterId = searchParams.get('clusterId') || '' | ||
if ( | ||
apiToken === '' || | ||
provider === '' || | ||
region === '' || | ||
orgId === '' || | ||
projectId === '' || | ||
clusterId === '' | ||
) { | ||
window.alert( | ||
'Invalid token, provider, region, orgId, projectId or clusterId!' | ||
) | ||
window.location.assign('/') | ||
} | ||
|
||
const apiPathBase = `/ngm/api/v1` | ||
startDashboard({ | ||
clientOptions: { | ||
apiPathBase, | ||
apiToken, | ||
provider, | ||
region, | ||
orgId, | ||
projectId, | ||
clusterId | ||
}, | ||
appOptions: { | ||
hideNav: true, | ||
skipLoadAppInfo: true, | ||
skipReloadWhoAmI: true | ||
}, | ||
appsConfig: { | ||
slowQuery: { | ||
enableExport: false, | ||
showDBFilter: false | ||
}, | ||
topSQL: { | ||
checkNgm: false, | ||
showSetting: false | ||
} | ||
} | ||
}) | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 4 additions & 1 deletion
5
ui/packages/tidb-dashboard-for-clinic-cloud/src/apps/SlowQuery/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
ui/packages/tidb-dashboard-for-clinic-cloud/src/apps/TopSQL/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.