Skip to content

Instantly share code, notes, and snippets.

@satour
Last active August 7, 2019 02:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save satour/aa71af2da4c5abc70b740ba41ff84f15 to your computer and use it in GitHub Desktop.
Save satour/aa71af2da4c5abc70b740ba41ff84f15 to your computer and use it in GitHub Desktop.
/*
https://console.treasuredata.com/app/workflows
上記に表示されているワークフローの情報をcsv形式で出力するスクリプトです。
開発者ツールのコンソールにコピー&ペーストして実行してください。
Treasure Data の仕様上、画面に表示されていないワークフローの情報が取得できない為、すべてのワークフローの行が画面に表示されるように、ブラウザのサイズを調整してから実行してください。
※Webブラウザの開発者ツールを表示→画面サイズで縦を 5000 などの大きな数値に設定するとすべてのワークフローの行が画面に表示されると思われます。
*/
var wfcsv = '\"workflow_name\", \"project_name\", \"last_attempt\", \"schedule\", \"next_attempt\"\n';
document.querySelectorAll('.ReactVirtualized__Table__row').forEach(function(element) {
let workflow_name = '\"' + element.childNodes[0].childNodes[0].childNodes[0].title + '\"'
let project_name = '\"' + element.childNodes[0].childNodes[0].childNodes[1].innerText+ '\"'
let last_attempt = element.childNodes[2].hasChildNodes()? '\"' + element.childNodes[2].childNodes[0].title + '\"' : ''
let schedule = element.childNodes[3].hasChildNodes()? '\"' + element.childNodes[3].childNodes[0].childNodes[1].childNodes[0].innerText + '\"' : ''
let next_attempt = element.childNodes[4].hasChildNodes()? '\"' + element.childNodes[4].childNodes[0].title + '\"' : ''
wfcsv = wfcsv + workflow_name + ',' + project_name + ',' + last_attempt + ',' +schedule + ',' + next_attempt + '\n'
});
console.log(wfcsv);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment