Skip to content

Commit 9e424e2

Browse files
authored
Merge pull request #10 from eapearson/master
Align modules with kbase-ui
2 parents ccc1d4f + 10dcb5b commit 9e424e2

14 files changed

+1590
-1728
lines changed

.eslintrc.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
env:
2+
browser: true
3+
amd: true
4+
extends: 'eslint:recommended'
5+
rules:
6+
indent:
7+
- error
8+
- 4
9+
linebreak-style:
10+
- error
11+
- unix
12+
quotes:
13+
- error
14+
- single
15+
semi:
16+
- error
17+
- always
18+
no-console:
19+
- error
20+
- allow:
21+
- warn
22+
- error

LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2015 The KBase Project and its Contributors
1+
Copyright (c) 2017 The KBase Project and its Contributors
22

33
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:
44

bower.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,9 @@
1919
"dependencies": {
2020
"bluebird": "^3.0.0",
2121
"bootstrap": "^3.3.0",
22-
"nunjucks": "^1.3.0",
22+
"nunjucks": "^3.0.0",
2323
"jquery": "^2.1.0"
2424
},
25-
"devDependencies": {
26-
},
25+
"devDependencies": {},
2726
"license": "SEE LICENSE IN LICENSE.md"
2827
}

src/plugin/config.yml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,12 @@ source:
1717
module: kb_dashboard_widget_apps
1818
file: widgets/AppsWidget
1919
css: true
20-
# -
21-
# module: kb_widget_dashboard_apps
22-
# file: "widgets/AppsWidget"
2320
-
2421
module: kb_dashboard_widget_base
2522
file: widgets/DashboardWidget
2623
-
2724
module: kb_dashboard_widget_collaborators
2825
file: widgets/CollaboratorsWidget
29-
# -
30-
# module: kb_dashboard_widget_data
31-
# file: "widgets/DataWidget"
3226
-
3327
module: kb_dashboard_widget_metrics
3428
file: "widgets/MetricsWidget"
@@ -62,10 +56,6 @@ install:
6256
module: kb_dashboard_widget_collaborators
6357
id: dashboardCollaborators
6458
type: object
65-
## -
66-
# module: kb_dashboard_widget_data
67-
# id: dashboardData
68-
# type: factory
6959
-
7060
module: kb_dashboard_widget_metrics
7161
id: dashboardMetrics

src/plugin/modules/dashboardPanel.js

Lines changed: 105 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -1,106 +1,115 @@
1-
/*global
2-
define, require
3-
*/
4-
/*jslint
5-
browser: true,
6-
white: true
7-
*/
81
define([
92
'promise',
10-
'kb/common/html',
11-
'kb/common/observed',
12-
'kb/widget/widgetSet'
13-
],
14-
function (Promise, html, observed, fWidgetSet) {
15-
'use strict';
3+
'kb_common/html',
4+
'kb_common/observed',
5+
'kb_widget/widgetSet'
6+
], function(Promise, html, observed, fWidgetSet) {
7+
'use strict';
168

17-
function widget(config) {
18-
var mount, container, runtime = config.runtime,
19-
widgetSet = fWidgetSet.make({runtime: runtime}),
20-
viewState = observed.make();
21-
function renderPanel() {
22-
return new Promise(function (resolve) {
23-
// View stat is a local state machine for this view.
24-
var div = html.tag('div'),
25-
panel = div({class: 'kbase-view kbase-dashboard-view container-fluid', 'data-kbase-view': 'social'}, [
26-
div({class: 'row'}, [
27-
div({class: 'col-sm-8'}, [
28-
div({id: widgetSet.addWidget('dashboardNarratives', {
29-
viewState: viewState
30-
})}),
31-
div({id: widgetSet.addWidget('dashboardSharedNarratives', {
32-
viewState: viewState
33-
})}),
34-
div({id: widgetSet.addWidget('dashboardPublicNarratives', {
35-
viewState: viewState
36-
})})
37-
//div({id: widgetSet.addWidget('dashboardApps', {
38-
// viewState: viewState
39-
// })})
40-
]),
41-
div({class: 'col-sm-4'}, [
42-
div({id: widgetSet.addWidget('dashboardProfile', {
43-
viewState: viewState
44-
})}),
45-
div({id: widgetSet.addWidget('dashboardMetrics', {
46-
viewState: viewState
47-
})}),
48-
div({id: widgetSet.addWidget('dashboardCollaborators', {
49-
viewState: viewState
50-
})})
51-
])
9+
function widget(config) {
10+
var mount, container, runtime = config.runtime,
11+
widgetSet = fWidgetSet.make({ runtime: runtime }),
12+
viewState = observed.make();
13+
14+
function renderPanel() {
15+
return new Promise(function(resolve) {
16+
// View stat is a local state machine for this view.
17+
var div = html.tag('div'),
18+
panel = div({ class: 'kbase-view kbase-dashboard-view container-fluid', 'data-kbase-view': 'social' }, [
19+
div({ class: 'row' }, [
20+
div({ class: 'col-sm-8' }, [
21+
div({
22+
id: widgetSet.addWidget('dashboardNarratives', {
23+
viewState: viewState
24+
})
25+
}),
26+
div({
27+
id: widgetSet.addWidget('dashboardSharedNarratives', {
28+
viewState: viewState
29+
})
30+
}),
31+
div({
32+
id: widgetSet.addWidget('dashboardPublicNarratives', {
33+
viewState: viewState
34+
})
35+
})
36+
//div({id: widgetSet.addWidget('dashboardApps', {
37+
// viewState: viewState
38+
// })})
39+
]),
40+
div({ class: 'col-sm-4' }, [
41+
div({
42+
id: widgetSet.addWidget('dashboardProfile', {
43+
viewState: viewState
44+
})
45+
}),
46+
div({
47+
id: widgetSet.addWidget('dashboardMetrics', {
48+
viewState: viewState
49+
})
50+
}),
51+
div({
52+
id: widgetSet.addWidget('dashboardCollaborators', {
53+
viewState: viewState
54+
})
55+
})
5256
])
53-
]);
54-
resolve({
55-
// title: 'Dashboard for ' + runtime.getService('session').getUsername(),
56-
title: 'Your Dashboard',
57-
content: panel
58-
});
57+
])
58+
]);
59+
resolve({
60+
// title: 'Dashboard for ' + runtime.getService('session').getUsername(),
61+
title: 'Your Dashboard',
62+
content: panel
5963
});
60-
}
64+
});
65+
}
6166

62-
// API
63-
function attach(node) {
64-
return Promise.try(function () {
65-
mount = node;
66-
container = document.createElement('div');
67-
mount.appendChild(container);
68-
return renderPanel()
69-
.then(function (rendered) {
70-
container.innerHTML = rendered.content;
71-
runtime.send('ui', 'setTitle', rendered.title);
72-
// create widgets.
73-
return widgetSet.init();
74-
})
75-
.then(function () {
76-
return widgetSet.attach(container);
77-
});
78-
});
79-
}
80-
function start(params) {
81-
return widgetSet.start(params);
82-
}
83-
function run(params) {
84-
return widgetSet.run(params);
85-
}
86-
function stop() {
87-
return widgetSet.stop();
88-
}
89-
function detach() {
90-
return widgetSet.detach();
91-
}
92-
return {
93-
attach: attach,
94-
start: start,
95-
run: run,
96-
stop: stop,
97-
detach: detach
98-
};
67+
// API
68+
function attach(node) {
69+
return Promise.try(function() {
70+
mount = node;
71+
container = document.createElement('div');
72+
mount.appendChild(container);
73+
return renderPanel()
74+
.then(function(rendered) {
75+
container.innerHTML = rendered.content;
76+
runtime.send('ui', 'setTitle', rendered.title);
77+
// create widgets.
78+
return widgetSet.init();
79+
})
80+
.then(function() {
81+
return widgetSet.attach(container);
82+
});
83+
});
84+
}
85+
86+
function start(params) {
87+
return widgetSet.start(params);
9988
}
10089

90+
function run(params) {
91+
return widgetSet.run(params);
92+
}
93+
94+
function stop() {
95+
return widgetSet.stop();
96+
}
97+
98+
function detach() {
99+
return widgetSet.detach();
100+
}
101101
return {
102-
make: function (config) {
103-
return widget(config);
104-
}
102+
attach: attach,
103+
start: start,
104+
run: run,
105+
stop: stop,
106+
detach: detach
105107
};
106-
});
108+
}
109+
110+
return {
111+
make: function(config) {
112+
return widget(config);
113+
}
114+
};
115+
});

0 commit comments

Comments
 (0)