Try   HackMD

Grafana 技巧 如何更改登入 Title 與分頁 Title

如果想對下圖登入介面的紅框處 "Welcome to Grafana" 以及藍框處的分頁 Title 進行修改,可以參考本文的做法

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

1.打開資料夾 ...\grafana\public\build

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

2.以編輯器打開檔案 5893.****.js,如果找不到該名稱的檔案請參考下方補充的方法

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

3.搜尋 AppTitle 找到 o(l,"AppTitle","填入你想要的title") 進行修改

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

重新打開 Grafana 登入畫面發現分頁 Title 已經修改完成
(如果沒成功的話可以嘗試以訪客模式打開 http://localhost:3000)

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

4.搜尋 LoginTitle 找到 o(l,"LoginTitle","Welcome to XXX") 進行修改

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

重新打開 Grafana 登入畫面發現畫面中間的 "Welcome to XXX" 已經修改完成
(如果沒成功的話可以嘗試以訪客模式打開 http://localhost:3000)

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

5.如果想對登入後分頁的 Dashoboard Title 進行修改,在同個資料夾打開 DashboardPage.****.js

搜尋 document.title,在 r.title + " - " + "輸入你想要的title結尾" 的地方進行修改

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

再重新打開 Grafana dashboard,即可看到分頁 Title 後 "-" 帶有剛剛修改的字串

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →


補充

如果在本文步驟二中,找不到一樣的 5893.****.js 檔名或在該檔搜尋不到 LoginTitleAppTitle,可以嘗試以下列步驟進行搜尋

1.在 notepad++ 中選擇搜尋 -> 在多個檔案中尋找 -> 尋找內容: LoginTitle -> 資料夾: ...\grafana\public\bulid -> 全部尋找

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

2.搜尋完應該只會有 ****.js****.js.map 兩個檔案帶有 LoginTitle 的搜尋結果

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

3.找到此 ****.js 並打開,即可回到本文的步驟三往下繼續操作

參考影片:
https://www.youtube.com/watch?v=g_bU7QBAWDY&t=416s


相關技術連結:
Grafana 如何更改 Logo

tags: Grafana tips title