Skip to content

Commit

Permalink
[webserver] Make BE webserver more pretty (apache#4050)
Browse files Browse the repository at this point in the history
Add some CSS and js files, and use boost-table framework to make BE's website more pretty
  • Loading branch information
acelyc111 authored Jul 9, 2020
1 parent efef067 commit 42cb119
Show file tree
Hide file tree
Showing 18 changed files with 7,488 additions and 37 deletions.
51 changes: 51 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -654,3 +654,54 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

--------------------------------------------------------------------------------

webroot/be/bootstrap/css/bootstrap-table.min.css and webroot/be/bootstrap/js/bootstrap-table.min.js MIT license

The MIT License (MIT)

Copyright (c) 2018 zhixin wen

Permission is hereby granted, free of charge, to any person obtaining a copy of this
software and associated documentation files (the "Software"), to deal in the Software
without restriction, including without limitation the rights to use, copy, modify,
merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be included in all copies or
substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

--------------------------------------------------------------------------------

webroot/be/bootstrap/css/bootstrap.min.css and webroot/be/bootstrap/js/bootstrap.min.js MIT license

The MIT License (MIT)

Copyright (c) 2011-2016 Twitter, Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy of this
software and associated documentation files (the "Software"), to deal in the Software
without restriction, including without limitation the rights to use, copy, modify,
merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be included in all copies or
substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

4 changes: 4 additions & 0 deletions be/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -569,3 +569,7 @@ install(FILES
${BASE_DIR}/../conf/be.conf
DESTINATION ${OUTPUT_DIR}/conf)

install(DIRECTORY
${BASE_DIR}/../webroot/be/
DESTINATION ${OUTPUT_DIR}/www)

75 changes: 40 additions & 35 deletions be/src/http/web_page_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,41 +107,46 @@ void WebPageHandler::handle(HttpRequest* req) {
HttpChannel::send_reply(req, HttpStatus::OK, content.str());
}

static const std::string PAGE_HEADER =
"<!DOCTYPE html>"
" <html>"
" <head><title>Doris</title>"
" <link href='www/bootstrap/css/bootstrap.min.css' rel='stylesheet' media='screen'>"
" <style>"
" body {"
" padding-top: 60px; "
" }"
" </style>"
" </head>"
" <body>";

static const std::string PAGE_FOOTER = "</div></body></html>";

static const std::string NAVIGATION_BAR_PREFIX =
"<div class='navbar navbar-inverse navbar-fixed-top'>"
" <div class='navbar-inner'>"
" <div class='container'>"
" <a class='btn btn-navbar' data-toggle='collapse' data-target='.nav-collapse'>"
" <span class='icon-bar'></span>"
" <span class='icon-bar'></span>"
" <span class='icon-bar'></span>"
" </a>"
" <a class='brand' href='/'>Doris</a>"
" <div class='nav-collapse collapse'>"
" <ul class='nav'>";

static const std::string NAVIGATION_BAR_SUFFIX =
" </ul>"
" </div>"
" </div>"
" </div>"
" </div>"
" <div class='container'>";
static const std::string PAGE_HEADER = R"(
<!DOCTYPE html>
<html>
<head>
<title>Doris</title>
<meta charset='utf-8'/>
<link href='/bootstrap/css/bootstrap.min.css' rel='stylesheet' media='screen' />
<link href='/bootstrap/css/bootstrap-table.min.css' rel='stylesheet' media='screen' />
<script src='/jquery-3.2.1.min.js' defer></script>
<script src='/bootstrap/js/bootstrap.min.js' defer></script>
<script src='/bootstrap/js/bootstrap-table.min.js' defer></script>
<script src='/doris.js' defer></script>
<link href='/doris.css' rel='stylesheet' />
</head>
<body>
)";

static const std::string NAVIGATION_BAR_PREFIX = R"(
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" style="padding-top: 5px;" href="/">
<img src="/logo.png" width='40' height='40' alt="Doris" />
</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
)";

static const std::string NAVIGATION_BAR_SUFFIX = R"(
</ul>
</div><!--/.nav-collapse -->
</div><!--/.container-fluid -->
</nav>
)";

static const std::string PAGE_FOOTER = R"(
</body>
</html>
)";

void WebPageHandler::bootstrap_page_header(std::stringstream* output) {
boost::mutex::scoped_lock lock(_map_lock);
Expand Down
8 changes: 6 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -205,13 +205,17 @@ if [ ${BUILD_FE} -eq 1 ]; then
cp -r -p ${DORIS_HOME}/webroot/* ${DORIS_OUTPUT}/fe/webroot/
fi
if [ ${BUILD_BE} -eq 1 ]; then
install -d ${DORIS_OUTPUT}/be/bin ${DORIS_OUTPUT}/be/conf \
install -d ${DORIS_OUTPUT}/be/bin \
${DORIS_OUTPUT}/be/conf \
${DORIS_OUTPUT}/be/lib/ \
${DORIS_OUTPUT}/udf/lib ${DORIS_OUTPUT}/udf/include
${DORIS_OUTPUT}/be/www \
${DORIS_OUTPUT}/udf/lib \
${DORIS_OUTPUT}/udf/include

cp -r -p ${DORIS_HOME}/be/output/bin/* ${DORIS_OUTPUT}/be/bin/
cp -r -p ${DORIS_HOME}/be/output/conf/* ${DORIS_OUTPUT}/be/conf/
cp -r -p ${DORIS_HOME}/be/output/lib/* ${DORIS_OUTPUT}/be/lib/
cp -r -p ${DORIS_HOME}/be/output/www/* ${DORIS_OUTPUT}/be/www/
cp -r -p ${DORIS_HOME}/be/output/udf/*.a ${DORIS_OUTPUT}/udf/lib/
cp -r -p ${DORIS_HOME}/be/output/udf/include/* ${DORIS_OUTPUT}/udf/include/
fi
Expand Down
7 changes: 7 additions & 0 deletions webroot/be/bootstrap/css/bootstrap-table.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions webroot/be/bootstrap/css/bootstrap.min.css

Large diffs are not rendered by default.

Binary file not shown.
9 changes: 9 additions & 0 deletions webroot/be/bootstrap/js/bootstrap-table.min.js

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions webroot/be/bootstrap/js/bootstrap.min.js

Large diffs are not rendered by default.

Loading

0 comments on commit 42cb119

Please sign in to comment.