Skip to content

Commit

Permalink
Update module references to align with kbase-ui
Browse files Browse the repository at this point in the history
- removed unused "data widget"
  • Loading branch information
eapearson committed Apr 17, 2017
1 parent 3be2656 commit d3ddaa0
Show file tree
Hide file tree
Showing 14 changed files with 1,590 additions and 1,728 deletions.
22 changes: 22 additions & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
env:
browser: true
amd: true
extends: 'eslint:recommended'
rules:
indent:
- error
- 4
linebreak-style:
- error
- unix
quotes:
- error
- single
semi:
- error
- always
no-console:
- error
- allow:
- warn
- error
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2015 The KBase Project and its Contributors
Copyright (c) 2017 The KBase Project and its Contributors

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:

Expand Down
5 changes: 2 additions & 3 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@
"dependencies": {
"bluebird": "^3.0.0",
"bootstrap": "^3.3.0",
"nunjucks": "^1.3.0",
"nunjucks": "^3.0.0",
"jquery": "^2.1.0"
},
"devDependencies": {
},
"devDependencies": {},
"license": "SEE LICENSE IN LICENSE.md"
}
10 changes: 0 additions & 10 deletions src/plugin/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,12 @@ source:
module: kb_dashboard_widget_apps
file: widgets/AppsWidget
css: true
# -
# module: kb_widget_dashboard_apps
# file: "widgets/AppsWidget"
-
module: kb_dashboard_widget_base
file: widgets/DashboardWidget
-
module: kb_dashboard_widget_collaborators
file: widgets/CollaboratorsWidget
# -
# module: kb_dashboard_widget_data
# file: "widgets/DataWidget"
-
module: kb_dashboard_widget_metrics
file: "widgets/MetricsWidget"
Expand Down Expand Up @@ -62,10 +56,6 @@ install:
module: kb_dashboard_widget_collaborators
id: dashboardCollaborators
type: object
## -
# module: kb_dashboard_widget_data
# id: dashboardData
# type: factory
-
module: kb_dashboard_widget_metrics
id: dashboardMetrics
Expand Down
201 changes: 105 additions & 96 deletions src/plugin/modules/dashboardPanel.js
Original file line number Diff line number Diff line change
@@ -1,106 +1,115 @@
/*global
define, require
*/
/*jslint
browser: true,
white: true
*/
define([
'promise',
'kb/common/html',
'kb/common/observed',
'kb/widget/widgetSet'
],
function (Promise, html, observed, fWidgetSet) {
'use strict';
'kb_common/html',
'kb_common/observed',
'kb_widget/widgetSet'
], function(Promise, html, observed, fWidgetSet) {
'use strict';

function widget(config) {
var mount, container, runtime = config.runtime,
widgetSet = fWidgetSet.make({runtime: runtime}),
viewState = observed.make();
function renderPanel() {
return new Promise(function (resolve) {
// View stat is a local state machine for this view.
var div = html.tag('div'),
panel = div({class: 'kbase-view kbase-dashboard-view container-fluid', 'data-kbase-view': 'social'}, [
div({class: 'row'}, [
div({class: 'col-sm-8'}, [
div({id: widgetSet.addWidget('dashboardNarratives', {
viewState: viewState
})}),
div({id: widgetSet.addWidget('dashboardSharedNarratives', {
viewState: viewState
})}),
div({id: widgetSet.addWidget('dashboardPublicNarratives', {
viewState: viewState
})})
//div({id: widgetSet.addWidget('dashboardApps', {
// viewState: viewState
// })})
]),
div({class: 'col-sm-4'}, [
div({id: widgetSet.addWidget('dashboardProfile', {
viewState: viewState
})}),
div({id: widgetSet.addWidget('dashboardMetrics', {
viewState: viewState
})}),
div({id: widgetSet.addWidget('dashboardCollaborators', {
viewState: viewState
})})
])
function widget(config) {
var mount, container, runtime = config.runtime,
widgetSet = fWidgetSet.make({ runtime: runtime }),
viewState = observed.make();

function renderPanel() {
return new Promise(function(resolve) {
// View stat is a local state machine for this view.
var div = html.tag('div'),
panel = div({ class: 'kbase-view kbase-dashboard-view container-fluid', 'data-kbase-view': 'social' }, [
div({ class: 'row' }, [
div({ class: 'col-sm-8' }, [
div({
id: widgetSet.addWidget('dashboardNarratives', {
viewState: viewState
})
}),
div({
id: widgetSet.addWidget('dashboardSharedNarratives', {
viewState: viewState
})
}),
div({
id: widgetSet.addWidget('dashboardPublicNarratives', {
viewState: viewState
})
})
//div({id: widgetSet.addWidget('dashboardApps', {
// viewState: viewState
// })})
]),
div({ class: 'col-sm-4' }, [
div({
id: widgetSet.addWidget('dashboardProfile', {
viewState: viewState
})
}),
div({
id: widgetSet.addWidget('dashboardMetrics', {
viewState: viewState
})
}),
div({
id: widgetSet.addWidget('dashboardCollaborators', {
viewState: viewState
})
})
])
]);
resolve({
// title: 'Dashboard for ' + runtime.getService('session').getUsername(),
title: 'Your Dashboard',
content: panel
});
])
]);
resolve({
// title: 'Dashboard for ' + runtime.getService('session').getUsername(),
title: 'Your Dashboard',
content: panel
});
}
});
}

// API
function attach(node) {
return Promise.try(function () {
mount = node;
container = document.createElement('div');
mount.appendChild(container);
return renderPanel()
.then(function (rendered) {
container.innerHTML = rendered.content;
runtime.send('ui', 'setTitle', rendered.title);
// create widgets.
return widgetSet.init();
})
.then(function () {
return widgetSet.attach(container);
});
});
}
function start(params) {
return widgetSet.start(params);
}
function run(params) {
return widgetSet.run(params);
}
function stop() {
return widgetSet.stop();
}
function detach() {
return widgetSet.detach();
}
return {
attach: attach,
start: start,
run: run,
stop: stop,
detach: detach
};
// API
function attach(node) {
return Promise.try(function() {
mount = node;
container = document.createElement('div');
mount.appendChild(container);
return renderPanel()
.then(function(rendered) {
container.innerHTML = rendered.content;
runtime.send('ui', 'setTitle', rendered.title);
// create widgets.
return widgetSet.init();
})
.then(function() {
return widgetSet.attach(container);
});
});
}

function start(params) {
return widgetSet.start(params);
}

function run(params) {
return widgetSet.run(params);
}

function stop() {
return widgetSet.stop();
}

function detach() {
return widgetSet.detach();
}
return {
make: function (config) {
return widget(config);
}
attach: attach,
start: start,
run: run,
stop: stop,
detach: detach
};
});
}

return {
make: function(config) {
return widget(config);
}
};
});
Loading

0 comments on commit d3ddaa0

Please # to comment.