aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/monlib/service/pages/index_mon_page.h
blob: af96bcd2b9c7f483f5915fc44652ca4a1a658ec9 (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
39
40
41
42
43
#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 {
        }

        bool IsIndex() const override {
            return true;
        }

        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);
        IMonPage* FindPageByAbsolutePath(const TString& absolutePath);

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

}