aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/monlib/service/pages/index_mon_page.h
blob: ea4df882ad3c7be5f7d393767837eda65f37e7e7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#pragma once

#include "mon_page.h"

namespace NMonitoring {
    struct TIndexMonPage: public IMonPage {
        TMutex Mtx;
        typedef TVector<TMonPagePtr> TPages;
        TPages Pages;
        typedef THashMap<TString, TMonPagePtr> TPagesByPath;
        TPagesByPath PagesByPath;

        TIndexMonPage(const TString& path, const TString& title)
            : IMonPage(path, title)
        {
        }

        ~TIndexMonPage() override {
        }

        void Output(IMonHttpRequest& request) override;
        void OutputIndexPage(IMonHttpRequest& request);
        virtual void OutputIndex(IOutputStream& out, bool pathEndsWithSlash);
        virtual void OutputCommonJsCss(IOutputStream& out);
        void OutputHead(IOutputStream& out);
        void OutputBody(IMonHttpRequest& out);

        void Register(TMonPagePtr page);
        TIndexMonPage* RegisterIndexPage(const TString& path, const TString& title);

        IMonPage* FindPage(const TString& relativePath);
        TIndexMonPage* FindIndexPage(const TString& relativePath);

        void SortPages();
        void ClearPages(); 
    };

}