yellow team mailing list archive
-
yellow team
-
Mailing list archive
-
Message #01292
[Merge] lp:~benji/juju-gui/doc-extraction into lp:juju-gui
Benji York has proposed merging lp:~benji/juju-gui/doc-extraction into lp:juju-gui.
Requested reviews:
Juju GUI Hackers (juju-gui)
Related bugs:
Bug #1071740 in juju-ui: "Enable yuidoc and add a start to docs."
https://bugs.launchpad.net/juju-gui/+bug/1071740
For more details, see:
https://code.launchpad.net/~benji/juju-gui/doc-extraction/+merge/131603
Enable yuidoc and add a start to docs.
We now install yuidoc and generate docs as part of "make install". Similarly
this branch makes "make install" stop doing a "make test" as discussed
previously.
https://codereview.appspot.com/6783049/
--
https://code.launchpad.net/~benji/juju-gui/doc-extraction/+merge/131603
Your team Juju GUI Hackers is requested to review the proposed merge of lp:~benji/juju-gui/doc-extraction into lp:juju-gui.
=== modified file '.bzrignore'
--- .bzrignore 2012-09-21 05:41:40 +0000
+++ .bzrignore 2012-10-26 12:50:24 +0000
@@ -17,3 +17,4 @@
tags
Session.vim
virtualenv
+yuidoc
=== modified file 'Makefile'
--- Makefile 2012-10-10 13:37:25 +0000
+++ Makefile 2012-10-26 12:50:24 +0000
@@ -1,23 +1,29 @@
FILES=$(shell bzr ls -RV -k file | grep -v assets/ | grep -v app/templates.js | grep -v server.js)
NODE_TARGETS=node_modules/chai node_modules/d3 node_modules/jshint \
- node_modules/yui
+ node_modules/yui node_modules/yuidoc
TEMPLATE_TARGETS=$(shell bzr ls -k file app/templates)
-all: prep test
+all: install
app/templates.js: $(TEMPLATE_TARGETS) bin/generateTemplates
@./bin/generateTemplates
+yuidoc: $(FILES)
+ @node_modules/.bin/yuidoc -o yuidoc -x assets app
+
$(NODE_TARGETS): package.json
@npm install
@#link depends
@ln -sf `pwd`/node_modules/yui ./app/assets/javascripts/
@ln -sf `pwd`/node_modules/d3/d3.v2* ./app/assets/javascripts/
-install: $(NODE_TARGETS) app/templates.js
+install: $(NODE_TARGETS) app/templates.js yuidoc
gjslint: virtualenv/bin/gjslint
- @virtualenv/bin/gjslint --strict --nojsdoc --custom_jsdoc_tags=property,default,since --jslint_error=all $(FILES)
+ @virtualenv/bin/gjslint --strict --nojsdoc --jslint_error=all \
+ --custom_jsdoc_tags \
+ property,default,since,method,module,submodule,namespace \
+ $(FILES)
jshint: node_modules/jshint
@node_modules/jshint/bin/hint $(FILES)
=== modified file 'app/app.js'
--- app/app.js 2012-10-23 19:54:44 +0000
+++ app/app.js 2012-10-26 12:50:24 +0000
@@ -1,4 +1,9 @@
'use strict';
+/**
+ * Provides the main app class.
+ *
+ * @module app
+ */
// Create a global for debug console access to YUI context.
var yui;
@@ -12,6 +17,11 @@
models = Y.namespace('juju.models'),
views = Y.namespace('juju.views');
+ /**
+ * The main app class.
+ *
+ * @class App
+ */
var JujuGUI = Y.Base.create('juju-gui', Y.App, [], {
views: {
environment: {
@@ -74,8 +84,11 @@
/*
* Data driven behaviors
- * This is a placehold for real behaviors associated with
- * DOM Node data-* attributes.
+ *
+ * This is a placehold for real behaviors associated with DOM Node data-*
+ * attributes.
+ *
+ * @attribute behaviors
*/
behaviors: {
timestamp: {
@@ -92,6 +105,9 @@
}
},
+ /**
+ * @method initializer
+ */
initializer: function() {
// If this flag is true, start the application with the console activated
if (this.get('consoleEnabled')) {
@@ -199,6 +215,11 @@
});
},
+ /**
+ * Hook up all of the declared behaviors.
+ *
+ * @method enableBehaviors
+ */
enableBehaviors: function() {
Y.each(this.behaviors, function(behavior) {
behavior.callback.call(this);
@@ -206,14 +227,19 @@
},
+ /**
+ * @method on_database_changed
+ */
on_database_changed: function(evt) {
Y.log(evt, 'debug', 'App: Database changed');
// Redispatch to current view to update.
this.dispatch();
},
- /*
+ /**
* When services are added we update endpoints here.
+ *
+ * @method updateEndpoints
*/
updateEndpoints: function(callback) {
var self = this;
@@ -235,29 +261,46 @@
},
// Event handlers
+
+ /**
+ * @method navigate_to_unit
+ */
navigate_to_unit: function(e) {
console.log('Evt.Nav.Router unit target', e.unit_id);
this.navigate('/unit/' + e.unit_id.replace('/', '-') + '/');
},
+ /**
+ * @method navigate_to_service
+ */
navigate_to_service: function(e) {
var service = e.service;
console.log(service.get('id'), 'Evt.Nav.Router service target');
this.navigate('/service/' + service.get('id') + '/');
},
+ /**
+ * @method navigate_to_charm
+ */
navigate_to_charm: function(e) {
console.log('Evt.Nav.Router charm');
var charm_url = e.charm_data_url;
this.navigate('/charms/' + charm_url);
},
+ /**
+ * @method navigate_to_environment
+ */
navigate_to_environment: function(e) {
console.log('Evt.Nav.Router environment');
this.navigate('/');
},
// Route handlers
+
+ /**
+ * @method show_unit
+ */
show_unit: function(req) {
console.log(
'App: Route: Unit', req.params.id, req.path, req.pendingRoutes);
@@ -278,6 +321,10 @@
querystring: req.query });
},
+ /**
+ * @method _prefetch_service
+ * @private
+ */
_prefetch_service: function(service) {
// only prefetch once
// we redispatch to the service view after we have status
@@ -301,6 +348,10 @@
}
},
+ /**
+ * @method _buildServiceView
+ * @private
+ */
_buildServiceView: function(req, viewName) {
console.log('App: Route: Service',
viewName, req.params.id, req.path, req.pendingRoutes);
@@ -320,22 +371,37 @@
});
},
+ /**
+ * @method show_service
+ */
show_service: function(req) {
this._buildServiceView(req, 'service');
},
+ /**
+ * @method show_service_config
+ */
show_service_config: function(req) {
this._buildServiceView(req, 'service_config');
},
+ /**
+ * @method show_service_relations
+ */
show_service_relations: function(req) {
this._buildServiceView(req, 'service_relations');
},
+ /**
+ * @method show_service_constraints
+ */
show_service_constraints: function(req) {
this._buildServiceView(req, 'service_constraints');
},
+ /**
+ * @method show_charm_collection
+ */
show_charm_collection: function(req) {
console.log('App: Route: Charm Collection', req.path, req.query);
this.showView('charm_collection', {
@@ -344,6 +410,9 @@
});
},
+ /**
+ * @method show_charm
+ */
show_charm: function(req) {
console.log('App: Route: Charm', req.path, req.params);
var charm_url = req.params.charm_store_path;
@@ -354,6 +423,9 @@
});
},
+ /**
+ * @method show_notifications_overview
+ */
show_notifications_overview: function(req) {
this.showView('notifications_overview', {
app: this,
@@ -361,12 +433,14 @@
notifications: this.db.notifications});
},
- /*
+ /**
* Persistent Views
*
* 'notifications' is a preserved views that remains rendered on all main
* views. we manually create an instance of this view and insert it into
* the App's view metadata.
+ *
+ * @method show_notifications_view
*/
show_notifications_view: function(req, res, next) {
var view = this.getViewInfo('notifications'),
@@ -382,11 +456,14 @@
next();
},
- /* Display the provider type.
+ /**
+ * Display the provider type.
*
* The provider type arrives asynchronously. Instead of updating the
* display from the environment code (a separation of concerns violation)
* we update it here.
+ *
+ * @method onProviderTypeChange
*/
onProviderTypeChange: function(evt) {
var providerType = evt.newVal,
@@ -396,6 +473,9 @@
}
},
+ /**
+ * @method show_environment
+ */
show_environment: function(req, res, next) {
var view = this.getViewInfo('environment'),
instance = view.instance;
@@ -428,7 +508,11 @@
next();
},
- // Model interactions -> move to db layer
+ /**
+ * Model interactions -> move to db layer
+ *
+ * @method load_service
+ */
load_service: function(evt) {
console.log('load service', evt);
if (evt.err) {
@@ -457,30 +541,31 @@
this.dispatch();
},
- /*
- * Object routing support
- * This is a utility that helps map from model objects to routes
- * defined on the App object.
+ /**
+ * Object routing support
*
- * getModelURL(model, [intent])
- * :model: the model to determine a route url for
- * :intent: (optional) the name of an intent associated with
- * a route. When more than one route can match a model
- * the route w/o an intent is matched when this attribute
- * is missing. If intent is provided as a string it
- * is matched to the 'intent' attribute specified on the
- * route. This is effectively a tag.
+ * This is a utility that helps map from model objects to routes
+ * defined on the App object.
*
* To support this we supplement our routing information with
* additional attributes as follows:
*
- * :model: model.name (required)
- * :reverse_map: (optional) route_path_key: str
- * reverse map can map :id to the name of attr on model
- * if no value is provided its used directly as attribute name
- * :intent: (optional) A string named intent for which this route
- * should be used. This can be used to select which subview
- * is selected to resolve a models route.
+ * model: model.name (required)
+ * reverse_map: (optional) A reverse mapping of route_path_key to the
+ * name of the attribute on the model. If no value is provided its
+ * used directly as attribute name.
+ * intent: (optional) A string named intent for which this route should
+ * be used. This can be used to select which subview is selected to
+ * resolve a models route.
+ *
+ * @method getModelURL
+ * @param {object} model The model to determine a route url for.
+ * @param {object} [intent] the name of an intent associated with a route.
+ * When more than one route can match a model the route w/o an intent is
+ * matched when this attribute is missing. If intent is provided as a
+ * string it is matched to the 'intent' attribute specified on the route.
+ * This is effectively a tag.
+ *
*/
getModelURL: function(model, intent) {
var matches = [],
@@ -533,8 +618,13 @@
return matches[idx] && matches[idx].path;
},
- // Override Y.Router.route (and setter) to allow inclusion
- // of additional routing params
+ /**
+ * Override Y.Router.route (and setter) to allow inclusion of additional
+ * routing params
+ *
+ * @method _setRoutes
+ * @private
+ */
_setRoutes: function(routes) {
this._routes = [];
Y.Array.each(routes, function(route) {
@@ -544,6 +634,10 @@
}, this);
return this._routes.concat();
},
+
+ /**
+ * @method route
+ */
route: function(path, callback, options) {
JujuGUI.superclass.route.call(this, path, callback);
=== modified file 'app/views/unit.js'
--- app/views/unit.js 2012-10-05 20:39:08 +0000
+++ app/views/unit.js 2012-10-26 12:50:24 +0000
@@ -1,4 +1,10 @@
'use strict';
+/**
+ * The unit view(s).
+ *
+ * @module views
+ * @submodule unit
+ */
YUI.add('juju-view-unit', function(Y) {
@@ -7,6 +13,12 @@
utils = Y.namespace('juju.views.utils'),
Templates = views.Templates;
+ /**
+ * Display a unit.
+ *
+ * @class UnitView
+ * @namespace views.unit
+ */
var UnitView = Y.Base.create('UnitView', Y.View, [], {
initializer: function() {
console.log('view.init.unit', this.get('unit'));
@@ -14,6 +26,9 @@
template: Templates.unit,
+ /**
+ * @method render
+ */
render: function() {
var container = this.get('container');
console.log('view.render.unit');
@@ -308,7 +323,6 @@
});
-
views.unit = UnitView;
}, '0.1.0', {
=== modified file 'package.json'
--- package.json 2012-10-15 21:06:34 +0000
+++ package.json 2012-10-26 12:50:24 +0000
@@ -23,7 +23,9 @@
"should": ">=1.0.0",
"chai": ">=1.2.0",
"less": "1.3.x",
- "jshint": ">=0.9.0"
+ "jshint": ">=0.9.0",
+ "node-markdown": "0.1.x",
+ "yuidocjs": "0.3.x"
},
"optionalDependencies": {}
}
Follow ups