forked from kbaseattic/kbase-ui-plugin-dashboard-bak
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update module references to align with kbase-ui
- removed unused "data widget"
- Loading branch information
Showing
14 changed files
with
1,590 additions
and
1,728 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
}; | ||
}); |
Oops, something went wrong.