Skip to content

Commit 7b46038

Browse files
author
Lijun Zhang
committed
DM-7038: added proper tags in few files to generate javascript docs; created configuration file, jsdoc_config.json and added depency libraries to the package.json
1 parent 3f894b4 commit 7b46038

File tree

12 files changed

+425
-111
lines changed

12 files changed

+425
-111
lines changed

jsdoc_config.json

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
{
2+
"tags": {
3+
"allowUnknownTags| ": true,
4+
"dictionaries": ["jsdoc","closure"]
5+
},
6+
"source": {
7+
"include": [
8+
"src/firefly/js/api/",
9+
"src/firefly/js/tables/TableUtil.js",
10+
"src/firefly/js/charts/XYPlotCntlr.js",
11+
"src/firefly/js//visualize/CsysConverter.js",
12+
"src/firefly/js/visualize/DrawLayerCntlr.js"
13+
// ,"src/firefly/js/charts/HistogramCntlr.js"
14+
,"README.md"
15+
16+
],
17+
"exclude": [
18+
//"src/firefly/js/api/ApiBuild.js"
19+
],
20+
//include .js, .jsdoc and jsx files
21+
"includePattern": ".+\\.js(doc)?|(x)$",
22+
//Any file starting with an underscore or in a directory starting with an underscore will be ignored
23+
"excludePattern": "(^|\\/|\\\\)_"
24+
},
25+
26+
"plugins": [
27+
"plugins/markdown",
28+
"plugins/summarize"
29+
],
30+
31+
"markdown" : {
32+
"idInHeadings" : true
33+
},
34+
35+
"jsx": {
36+
"extensions": ["js", "jsx"]
37+
},
38+
"staticFiles": {
39+
"include": ["./docs"],
40+
"exclude": ["./docs/firefly-api-code-examples.md"],
41+
"includePattern": ".+\\.md?$",
42+
// "excludePattern": "(^|\\/|\\\\)_",
43+
"recursive": true//,
44+
//"recursiveLevel": 2,
45+
},
46+
47+
"templates": {
48+
"minami": {
49+
// "default": {
50+
"staticFiles": {
51+
"include": ["./docs/"],
52+
"exclude": ["./docs/firefly-api-code-examples.md"],
53+
// "includePattern": ".+\\.md?$",
54+
// "excludePattern": "(^|\\/|\\\\)_",
55+
"recursive": true//,
56+
//"recursiveLevel": 2,
57+
}
58+
59+
}
60+
},
61+
"opts": {
62+
"template": "node_modules/minami", //use the minami template insetad of the default
63+
// "template": "templates/default",//default", // same as -t templates/default
64+
"encoding": "utf8", // same as -e utf8
65+
"destination": "./jsdoc/", // same as -d ./out/
66+
"recurse": true , //, // same as -r
67+
"tutorials": "./tutorial/",// same as -u path/to/tutorials
68+
"access": "all" //same as -a <value>, values are all, public, private etc
69+
70+
},
71+
"templates": {
72+
"cleverLinks": false,
73+
"monospaceLinks": false,
74+
"default": {
75+
"outputSourceFiles": false
76+
}
77+
}
78+
}
79+

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@
8484
"style-loader": "^0.12.3",
8585
"url-loader": "^0.5.7",
8686
"webpack": "^1.8.2",
87-
"react-addons-perf" : "0.14.7"
88-
87+
"eslint-plugin-jsx-a11y": "^0.6.2",
88+
"jsdoc-jsx": "^0.1.0",
89+
"minami": "^1.1.1"
8990
}
9091
}

src/firefly/js/api/ApiBuild.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,12 @@ import './ApiStyle.css';
5151

5252
/**
5353
* Start in api mode. Will create the api and call window.onFireflyLoaded(firefly)
54+
* @ignore
5455
*/
5556
export function initApi() {
5657
const lowlevelApi= buildLowlevelAPI();
5758
const viewInterface= buildViewerApi();
59+
5860
const highLevelApi= buildHighLevelApi(lowlevelApi);
5961
if (!window.firefly) window.firefly= {};
6062
window.firefly.ignoreHistory = true;
@@ -69,7 +71,8 @@ export function initApi() {
6971

7072

7173
/**
72-
Structure of API
74+
75+
Structure of API
7376
{
7477
//--- High level API , all high level api are in the root
7578
all high level functions....
@@ -92,9 +95,8 @@ Structure of API
9295

9396
/**
9497
* Return the api object.
95-
*
9698
* @return {{action:{},ui:{},util:{}}}
97-
*
99+
* @ignore
98100
*/
99101
export function buildLowlevelAPI() {
100102

@@ -142,7 +144,7 @@ export function buildLowlevelAPI() {
142144
PopupMouseReadoutMinimal,
143145
PopupMouseReadoutFull
144146
};
145-
147+
146148
const util= Object.assign({}, ApiUtil, {image:ApiUtilImage}, {chart:ApiUtilChart}, {table:ApiUtilTable}, {data:{}} );
147149

148150
return { action, ui, util };
@@ -153,6 +155,7 @@ export function buildLowlevelAPI() {
153155
* pull all the dispatch functions out of the object
154156
* @param obj
155157
* @return {*}
158+
* @ignore
156159
*/
157160
function findDispatch(obj) {
158161
return Object.keys(obj).reduce( (res,key) => {
@@ -167,6 +170,7 @@ function findDispatch(obj) {
167170
* @param obj
168171
* @param prefix
169172
* @return {*}
173+
* @ignore
170174
*/
171175
function findActionType(obj,prefix) {
172176
return Object.keys(obj).reduce( (res,key) => {

src/firefly/js/api/ApiHighlevelBuild.js

Lines changed: 64 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,16 @@
1414
//===================================================================================
1515

1616
/**
17-
*
17+
* @public
18+
* @desc build highLevelApi using the lowLevelApi as an input
19+
* @module firefly
20+
*/
21+
22+
/**
1823
* @param llApi the lowlevel api
1924
* @return {Object}
25+
* @ignore
26+
*
2027
*/
2128
export function buildHighLevelApi(llApi) {
2229
const current= build(llApi);
@@ -32,6 +39,7 @@ var globalImageViewDefParams= {};
3239
* Build the deprecated API
3340
* @param llApi
3441
* @return {Object}
42+
* @ignore
3543
*/
3644
function build(llApi) {
3745

@@ -111,7 +119,9 @@ function buildTablePart(llApi) {
111119
const {dispatchTableFetch}= llApi.action;
112120

113121
/**
114-
* @typedef {object} TblOptions table options
122+
* @global
123+
* @public
124+
* @typedef {object} TblOptions
115125
* @prop {string} tbl_group the group this table belongs to. Defaults to 'main'.
116126
* @prop {boolean} removable true if this table can be removed from view. Defaults to true.
117127
* @prop {boolean} showUnits defaults to false
@@ -123,11 +133,14 @@ function buildTablePart(llApi) {
123133
*/
124134

125135
/**
126-
* The general plotting function to plot a table.
127136
* @param {string|HTMLDivElement} targetDiv to put the table in.
128137
* @param {Object} request request object created from
129138
* @param {TblOptions} options table options.
139+
* @memberof module:firefly
140+
* @public
141+
* @example fierfly.showTable
130142
*/
143+
// @param {module:firefly.TblOptions} options table options.
131144
const showTable= (targetDiv, request, options) => doShowTable(llApi, targetDiv, request, options);
132145

133146
return {showTable};
@@ -139,7 +152,9 @@ function buildTablePart(llApi) {
139152
function buildChartPart(llApi) {
140153

141154
/**
142-
* @typedef {object} XYPlotOptions xy plot options
155+
* @global
156+
* @public
157+
* @typedef {object} XYPlotOptions
143158
* @prop {string} source location of the ipac table, url or file path; ignored when XY plot view is added to table
144159
* @prop {string} QUERY_ID required when XY plot view is added to the table. It connects this XY Plot to the table and should be the same string that you specified as the div parameter when you created the table.
145160
* @prop {string} chartTitle title of the chart
@@ -155,30 +170,36 @@ function buildChartPart(llApi) {
155170
* @prop {string} yOptions comma separated list of y axis options: grid,flip,log
156171
*/
157172

173+
158174
/**
159-
* The general plotting function to plot an XY Plot.
175+
* @summary The general plotting function to plot an XY Plot.
160176
* @param {string|HTMLDivElement} targetDiv to put the chart in.
161177
* @param {XYPlotOptions} parameters the request object literal with the chart parameters
162-
* @namespace firefly
178+
* @memberof module:firefly
179+
* @example firefly.showXYPlot
180+
* @public
163181
*/
164182
const showXYPlot= (targetDiv, parameters) => doShowXYPlot(llApi, targetDiv, parameters);
165-
166183
/**
167-
* Add XY Plot view of an existing table.
184+
* @summary It appears twice when it is added in the above jsdoc block
168185
* @param {string|HTMLDivElement} targetDiv to put the chart in.
169-
* @param {XYPlotOptions} parameters the request object literal with the chart parameters
170-
* @namespace firefly
186+
* @param {module:firefly.XYPlotOptions} parameters the request object literal with the chart parameters
187+
* @memberof module:firefly
188+
* @public
189+
* @example firefly.addXYPlot
171190
*/
191+
172192
const addXYPlot= (targetDiv, parameters) => doShowXYPlot(llApi, targetDiv, parameters);
173193

174194
return {showXYPlot, addXYPlot};
175195
}
176196

177197
function buildCommon(llApi) {
178198
/**
179-
* Sets the root path for any relative URL. If this method has not been called then relative URLs use the page's root.
199+
* @summary Sets the root path for any relative URL. If this method has not been called then relative URLs use the page's root.
180200
* @param {String} rootUrlPath
181-
* @namespace firefly
201+
* @memberof module:firefly
202+
* @public
182203
*/
183204
const setRootPath= (rootUrlPath) => llApi.action.dispatchRootUrlPath(rootUrlPath);
184205

@@ -187,41 +208,60 @@ function buildCommon(llApi) {
187208

188209
function buildImagePart(llApi) {
189210

211+
190212
const {RequestType}= llApi.util.image;
191213

192-
/**
193-
* The general plotting function to plot a FITS image.
194-
* @param {String|div} targetDiv to put the image in.
195-
* @param {Object} request the request object literal with the plotting parameters
196-
* @namespace firefly
214+
/**
215+
* @summary The general plotting function to plot a FITS image.
216+
* @param {String|div} targetDiv to put the image in.
217+
* @param {Object} request the request object literal with the plotting parameters
218+
* @memberof module:firefly
219+
* @public
220+
* @ignore
221+
* @example firefly.showImage
222+
*
197223
*/
198224
const showImage= (targetDiv, request) => showImageInMultiViewer(llApi, targetDiv, request);
199225

200-
201226
/**
202-
* a convenience plotting function to plot a file on the server or a url. If first looks for the file then
227+
* @summary a convenience plotting function to plot a file on the server or a url. If first looks for the file then
203228
* the url is the fallback
204229
* @param {String|div} targetDiv to put the image in.
205230
* @param {String} file file on server
206231
* @param {String} url url reference to a fits file
207-
* @namespace firefly
232+
* @memberof module:firefly
233+
* @public
234+
* @ignore
235+
* @example firefly.showImageFileOrUrl
208236
*/
237+
209238
const showImageFileOrUrl= (targetDiv, file,url) =>
210239
showImageInMultiViewer(llApi, targetDiv,
211240
{'File' : file,
212241
'URL' : url,
213242
'Type' : RequestType.TRY_FILE_THEN_URL
214243
});
215244

245+
216246
/**
217-
* set global fallback params for every image plotting call
247+
* @summary set global fallback params for every image plotting call
218248
* @param {Object} params a object literal such as any image plot or showImage uses
219-
* @namespace firefly
249+
* @memberof module:firefly
250+
* @public
251+
* @ignore
252+
* @example firefly.setGlobalImageDef
220253
*/
221254
const setGlobalImageDef= (params) => globalImageViewDefParams= params;
222255

223256

224-
257+
/**
258+
*
259+
* @param {div} targetDiv to put the coverage in.
260+
* @param options an object literal containing a list of the coverage options
261+
* @memberof module:firefly
262+
* @public
263+
* @example firefly.showCoverage
264+
*/
225265
const showCoverage= (div,options) => initCoverage(llApi,div,options);
226266

227267
return {showImage, showImageFileOrUrl, setGlobalImageDef, showCoverage};
@@ -232,6 +272,7 @@ function buildImagePart(llApi) {
232272
* @param llApi
233273
* @return {Object}
234274
* @Deprecated
275+
* @ignore
235276
*/
236277
function buildDeprecated(llApi) {
237278

0 commit comments

Comments
 (0)