Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create user guide for the viewer server #865

Merged
merged 1 commit into from
Oct 9, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ vendor/build-logger/build/

# doxygen generated files
gen-docs/
www/userguide/gen-docs/

# thrift generated files
thrift_api/gen-js/
Expand Down
10 changes: 8 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ thrift: build_dir

BUILD_DIR=$(BUILD_DIR) $(MAKE) -C api/

package: build_dir gen-docs thrift
userguide: build_dir
$(MAKE) -C www/userguide

package: build_dir gen-docs thrift userguide
if [ ! -d "$(BUILD_DIR)/CodeChecker" ]; then \
./scripts/build_package.py -r $(ROOT) -o $(BUILD_DIR) -b $(BUILD_DIR); \
fi
Expand All @@ -56,7 +59,7 @@ clean_venv_dev:

clean: clean_package clean_vendor

clean_package:
clean_package: clean_userguide
rm -rf $(BUILD_DIR)
rm -rf gen-docs
find . -name "*.pyc" -delete
Expand All @@ -69,3 +72,6 @@ clean_vendor:
rm -rf vendor/jsplumb
rm -rf vendor/marked
rm -rf vendor/thrift

clean_userguide:
rm -rf www/userguide/gen-docs
1 change: 1 addition & 0 deletions config/package_layout.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"plugin": "plugin",
"www": "www",
"docs": "www/docs",
"userguide": "www/userguide",
"checker_md_docs": "www/docs/checker_md_docs",
"web_client": "www/scripts/codechecker-api",
"web_client_plugins": "www/scripts/plugins",
Expand Down
3 changes: 2 additions & 1 deletion libcodechecker/server/routing.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
'fonts',
'images',
'scripts',
'style'
'style',
'userguide'
]

# A list of top-level path elements in requests (such as Thrift endpoints)
Expand Down
20 changes: 17 additions & 3 deletions scripts/build_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,16 +117,20 @@ def create_folder_layout(path, layout):
sys.exit()


def copy_tree(src, dst):
def copy_tree(src, dst, skip=None):
""" Copy file tree. """

if not os.path.exists(dst):
os.makedirs(dst)
for item in os.listdir(src):
source = os.path.join(src, item)
destination = os.path.join(dst, item)

if skip is not None and source in skip:
continue

if os.path.isdir(source):
copy_tree(source, destination)
copy_tree(source, destination, skip)
else:
delta = os.stat(src).st_mtime - os.stat(dst).st_mtime
if not os.path.exists(destination) or delta > 0:
Expand Down Expand Up @@ -709,7 +713,17 @@ def build_package(repository_root, build_package_config, env=None):
LOG.debug('Copy web client files')
source = os.path.join(repository_root, 'www')
target = os.path.join(package_root, package_layout['www'])
copy_tree(source, target)

# Copy user guide to the web directory except images which will be placed
# to the common image directory.
userguide_images = os.path.join(source, 'userguide', 'images')
copy_tree(source, target, [userguide_images])
copy_tree(userguide_images, os.path.join(target, 'images'))

# Rename gen-docs to docs.
target_userguide = os.path.join(package_root, package_layout['userguide'])
shutil.move(os.path.join(target_userguide, 'gen-docs'),
os.path.join(target_userguide, 'doc'))

# Copy font files.
for _, dep in vendor_projects.items():
Expand Down
85 changes: 85 additions & 0 deletions www/scripts/codecheckerviewer/HeaderMenu.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
// -------------------------------------------------------------------------
// The CodeChecker Infrastructure
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// -------------------------------------------------------------------------

define([
'dojo/_base/declare',
'dojo/topic',
'dijit/Dialog',
'dijit/DropDownMenu',
'dijit/form/DropDownButton',
'dijit/MenuItem'],
function (declare, topic, Dialog, DropDownMenu, DropDownButton, MenuItem) {

var HeaderMenuItems = declare(DropDownMenu, {
postCreate : function () {
this.inherited(arguments);

var that = this;

this.addChild(new MenuItem({
label : 'CodeChecker @ GitHub',
onClick : function () {
window.open('http://github.com/Ericsson/codechecker', '_blank');
}
}));

this.addChild(new MenuItem({
label : 'Send bug report',
onClick : function () {
window.open('http://github.com/Ericsson/codechecker/issues/new',
'_blank');
}
}));

this.addChild(new MenuItem({
label : 'Credits',
postCreate : function () {
this._creditsDialog = new Dialog({
title : 'Credits',
class : 'credits',
content :
'<b>D&aacute;niel Krupp</b> <a href="http://github.com/dkrupp">@dkrupp</a><br /> \
daniel.krupp@ericsson.com<br /> \
<b>Gy&ouml;rgy Orb&aacute;n</b> <a href="http://github.com/gyorb">@gyorb</a><br /> \
gyorgy.orban@ericsson.com<br /> \
<b>Tibor Brunner</b> <a href="http://github.com/bruntib">@bruntib</a><br /> \
tibor.brunner@ericsson.com<br /> \
<b>G&aacute;bor Horv&aacute;th</b> <a href="http://github.com/Xazax-hun">@Xazax-hun</a><br /> \
gabor.a.horvath@ericsson.com<br /> \
<b>Rich&aacute;rd Szalay</b> <a href="http://github.com/whisperity">@whisperity</a><br /> \
richard.szalay@ericsson.com<br /> \
<b>M&aacute;rton Csord&aacute;s</b> <a href="http://github.com/csordasmarton">@csordasmarton</a><br /> \
marton.csordas@ericsson.com<br /> \
<b>Boldizs&aacute;r T&oacute;th</b> <a href="http://github.com/bobszi">@bobszi</a><br /> \
toth.boldizsar@gmail.com<br> \
<b>Bence Babati</b> <a href="http://github.com/babati">@babati</a><br /> \
bence.babati@ericsson.com<br /> \
<b>G&aacute;bor Alex Isp&aacute;novics</b> <a href="http://github.com/igalex">@igalex</a><br /> \
gabor.alex.ispanovics@ericsson.com<br /> \
<b>Szabolcs Sipos</b> <a href="http://github.com/labuwx">@labuwx</a><br /> \
labuwx@balfug.com<br />'
});
},
onClick : function () { this._creditsDialog.show(); }
}));

this.addChild(new MenuItem({
label : 'User guide',
onClick : function () {
topic.publish('tab/userguide');
}
}));
}
});

return declare(DropDownButton, {
postCreate : function () {
this.inherited(arguments);

this.set('dropDown', new HeaderMenuItems());
}
});
});
110 changes: 46 additions & 64 deletions www/scripts/codecheckerviewer/codecheckerviewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,19 @@ define([
'dojo/topic',
'dojo/dom-construct',
'dijit/Dialog',
'dijit/DropDownMenu',
'dijit/MenuItem',
'dijit/form/Button',
'dijit/form/DropDownButton',
'dijit/layout/BorderContainer',
'dijit/layout/ContentPane',
'dijit/layout/TabContainer',
'codechecker/CheckerStatistics',
'codechecker/hashHelper',
'codechecker/HeaderMenu',
'codechecker/ListOfBugs',
'codechecker/ListOfRuns',
'codechecker/util'],
function (declare, topic, domConstruct, Dialog, DropDownMenu, MenuItem,
Button, DropDownButton, BorderContainer, ContentPane, TabContainer,
CheckerStatistics, hashHelper, ListOfBugs, ListOfRuns, util) {
function (declare, topic, domConstruct, Dialog, Button,
BorderContainer, ContentPane, TabContainer, CheckerStatistics, hashHelper,
HeaderMenu, ListOfBugs, ListOfRuns, util) {

var runDataList = null;

Expand All @@ -36,6 +34,12 @@ function (declare, topic, domConstruct, Dialog, DropDownMenu, MenuItem,
function initByUrl() {
var state = hashHelper.getValues();

for (var key in state)
if (key.indexOf('userguide-') !== -1) {
topic.publish('tab/userguide');
return;
}

switch (state.tab) {
case undefined:
if (state.run || state.baseline || state.newcheck || state.difftype ||
Expand All @@ -47,6 +51,9 @@ function (declare, topic, domConstruct, Dialog, DropDownMenu, MenuItem,
case 'statistics':
topic.publish('tab/checkerStatistics');
return;
case 'userguide':
topic.publish('tab/userguide');
return;
case 'allReports':
topic.publish('tab/allReports');
return;
Expand Down Expand Up @@ -134,61 +141,6 @@ function (declare, topic, domConstruct, Dialog, DropDownMenu, MenuItem,
});
}

//--- Menu button ---//

var credits = new Dialog({
title : 'Credits',
class : 'credits',
content :
'<b>D&aacute;niel Krupp</b> <a href="http://github.com/dkrupp">@dkrupp</a><br /> \
daniel.krupp@ericsson.com<br /> \
<b>Gy&ouml;rgy Orb&aacute;n</b> <a href="http://github.com/gyorb">@gyorb</a><br /> \
gyorgy.orban@ericsson.com<br /> \
<b>Tibor Brunner</b> <a href="http://github.com/bruntib">@bruntib</a><br /> \
tibor.brunner@ericsson.com<br /> \
<b>G&aacute;bor Horv&aacute;th</b> <a href="http://github.com/Xazax-hun">@Xazax-hun</a><br /> \
gabor.a.horvath@ericsson.com<br /> \
<b>Rich&aacute;rd Szalay</b> <a href="http://github.com/whisperity">@whisperity</a><br /> \
richard.szalay@ericsson.com<br /> \
<b>M&aacute;rton Csord&aacute;s</b> <a href="http://github.com/csordasmarton">@csordasmarton</a><br /> \
marton.csordas@ericsson.com<br /> \
<b>Boldizs&aacute;r T&oacute;th</b> <a href="http://github.com/bobszi">@bobszi</a><br /> \
toth.boldizsar@gmail.com<br> \
<b>Bence Babati</b> <a href="http://github.com/babati">@babati</a><br /> \
bence.babati@ericsson.com<br /> \
<b>G&aacute;bor Alex Isp&aacute;novics</b> <a href="http://github.com/igalex">@igalex</a><br /> \
gabor.alex.ispanovics@ericsson.com<br /> \
<b>Szabolcs Sipos</b> <a href="http://github.com/labuwx">@labuwx</a><br /> \
labuwx@balfug.com<br />'
});

var menuItems = new DropDownMenu();

menuItems.addChild(new MenuItem({
label : 'CodeChecker @ GitHub',
onClick : function () {
window.open('http://github.com/Ericsson/codechecker', '_blank');
}
}));

menuItems.addChild(new MenuItem({
label : 'Send bug report',
onClick : function () {
window.open('http://github.com/Ericsson/codechecker/issues/new', '_blank');
}
}));

menuItems.addChild(new MenuItem({
label : 'Credits',
onClick : function () { credits.show(); }
}));

var menuButton = new DropDownButton({
class : 'main-menu-button',
iconClass : 'dijitIconFunction',
dropDown : menuItems
});

//--- Back button to product list ---//

var productListButton = new Button({
Expand All @@ -201,9 +153,12 @@ function (declare, topic, domConstruct, Dialog, DropDownMenu, MenuItem,
}
});

var headerMenu = domConstruct.create('div', {
id : 'header-menu'
});
var headerMenu = domConstruct.create('div', { id : 'header-menu' });

var menuButton = new HeaderMenu({
class : 'main-menu-button',
iconClass : 'dijitIconFunction',
});

if (loginUserSpan != null)
domConstruct.place(loginUserSpan, headerMenu);
Expand Down Expand Up @@ -314,6 +269,33 @@ function (declare, topic, domConstruct, Dialog, DropDownMenu, MenuItem,
runsTab.selectChild(runIdToTab[tabId]);
});

topic.subscribe('tab/userguide', function () {
var that = this;

if (!this.userguide) {
this.userguide = new ContentPane({
title : 'User guide',
closable : true,
href : 'userguide/doc/html/md_userguide.html',
onClose : function () {
delete that.userguide;
return true;
},
onShow : function () {
hashHelper.resetStateValues({
'tab' : 'userguide'
});
}
});
runsTab.addChild(this.userguide);
}

hashHelper.resetStateValues({
'tab' : 'userguide'
});
runsTab.selectChild(this.userguide);
});

var docDialog = new Dialog();

topic.subscribe('showDocumentation', function (checkerId) {
Expand Down
Loading