Skip to content

Commit

Permalink
Merge pull request #68 from e-ucm/uiFixes
Browse files Browse the repository at this point in the history
Check roles to avoid loading some views
  • Loading branch information
gorco committed Sep 16, 2016
2 parents a6d042b + a6e0e53 commit af5a101
Show file tree
Hide file tree
Showing 7 changed files with 107 additions and 105 deletions.
5 changes: 5 additions & 0 deletions app/public/js/controllers/devVisualizator.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ angular.module('devVisualizatorApp', ['ngStorage', 'services'])
function ($scope, $location, $http, $window, $localStorage, Games, Versions, Role, CONSTANTS, $sce, QueryParams) {
$scope.$storage = $localStorage;

$scope.isDeveloper = function () {
return Role.isDeveloper();
};

var versionId = QueryParams.getQueryParam('version');
$scope.gameId = QueryParams.getQueryParam('game');

Expand All @@ -49,6 +53,7 @@ angular.module('devVisualizatorApp', ['ngStorage', 'services'])
// Add dashboard
var numPan = 1;
data.forEach(function (visualizationId) {

$http.post(CONSTANTS.PROXY + '/kibana/visualization/session/' + $scope.gameId + '/' + visualizationId + '/' + versionId,
{}).success(function(result) {
panels.push('{\"id\":\"' + visualizationId + '_' + versionId +
Expand Down
8 changes: 6 additions & 2 deletions app/public/js/controllers/session.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,12 @@ angular.module('sessionApp', ['myApp', 'ngStorage', 'services'])
new ColumnProgress(angular.element(element).children('.score-marker')[0], scope.result.score);
};
})
.controller('SessionCtrl', ['$scope', '$location', 'SessionsId', 'Results', 'Versions', 'QueryParams', '$sce', 'CONSTANTS',
function ($scope, $location, SessionsId, Results, Versions, QueryParams, $sce, CONSTANTS) {
.controller('SessionCtrl', ['$scope', '$location', 'SessionsId', 'Results', 'Versions', 'QueryParams', '$sce', 'CONSTANTS', 'Role',
function ($scope, $location, SessionsId, Results, Versions, QueryParams, $sce, CONSTANTS, Role) {

$scope.isTeacher = function() {
return Role.isTeacher();
};

$scope.refreshResults = function () {
var rawResults = Results.query({
Expand Down
4 changes: 2 additions & 2 deletions app/views/data.jade
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ block content
include data/realtime/realtime
#students.tab-pane
include data/students
#game-analytics.tab-pane
include data/game-analytics
#config.tab-pane
include data/config
#analysis.tab-pane
include data/analysis
#dev-visualization.tab-pane
include data/dev-visualization
#game-analytics.tab-pane
include data/game-analytics


88 changes: 44 additions & 44 deletions app/views/data/config.jade
Original file line number Diff line number Diff line change
Expand Up @@ -14,52 +14,52 @@
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
h1 Old Analytics Setup
a(href="#", editable-text="selectedGame.link" onaftersave="changeGameLink()") Link: {{ selectedGame.link }}
.row
.col-md-8
.checkbox
label
input(type="checkbox" ng-change='publicGame()' ng-model='checkboxPublic')
| Public game
br
.row.top10
.col-sm-12
h4 Session information
.row.top10(ng-if="selectedVersion")
.col-sm-12
ul
li
span Alias
| =
a(href="#", editable-text="selectedVersion.alias" onbeforesave="saveVersion()") {{ selectedVersion.alias || 'this.name' }}
.row(ng-controller="DataCtrl")
.row(ng-if="isDeveloper()")
h1 Alerts & Warnings Setup
a(href="#", editable-text="selectedGame.link" onaftersave="changeGameLink()") Link: {{ selectedGame.link }}
.row
.col-md-8
.checkbox
label
input(type="checkbox" ng-change='publicGame()' ng-model='checkboxPublic')
| Public game
br
.row.top10
.col-sm-12
strong Warnings
a.glyphicon.glyphicon-plus(ng-click="addWarning()")
h4 Session information
.row.top10(ng-if="selectedVersion")
.col-sm-12
ul
li(ng-repeat="warning in selectedVersion.warnings")
span.right10.left10 Message:
a(href="#",editable-text="warning.message" onbeforesave="saveVersion()") {{ warning.message }}
span.right10.left10 Condition:
a(href="#",editable-text="warning.cond" onbeforesave="saveVersion()") {{ warning.cond }}
button.left10.btn.btn-xs.btn-default(ng-click="deleteFromList('warnings', warning)") Delete
.row.top10
.col-sm-12
strong Alerts
a.glyphicon.glyphicon-plus(ng-click="addAlert()")
.row.top10(ng-if="selectedVersion")
.col-sm-12
ul
li(ng-repeat="alert in selectedVersion.alerts")
span.right10.left10 Message:
a(href="#",editable-text="alert.message" onbeforesave="saveVersion()") {{ alert.message }}
span.right10.left10 Value:
a(href="#",editable-text="alert.value" onbeforesave="saveVersion()") {{ alert.value || 'Not set' }}
span.right10.left10 Maximum difference:
a(href="#",editable-number="alert.maxDiff" e-step="any" onbeforesave="saveVersion()") {{ alert.maxDiff }}
button.left10.btn.btn-xs.btn-default(ng-click="deleteFromList('alerts', alert)") Delete
li
span Alias
| =
a(href="#", editable-text="selectedVersion.alias" onbeforesave="saveVersion()") {{ selectedVersion.alias || 'this.name' }}
.row(ng-controller="DataCtrl")
.row.top10
.col-sm-12
strong Warnings
a.glyphicon.glyphicon-plus(ng-click="addWarning()")
.row.top10(ng-if="selectedVersion")
.col-sm-12
ul
li(ng-repeat="warning in selectedVersion.warnings")
span.right10.left10 Message:
a(href="#",editable-text="warning.message" onbeforesave="saveVersion()") {{ warning.message }}
span.right10.left10 Condition:
a(href="#",editable-text="warning.cond" onbeforesave="saveVersion()") {{ warning.cond }}
button.left10.btn.btn-xs.btn-default(ng-click="deleteFromList('warnings', warning)") Delete
.row.top10
.col-sm-12
strong Alerts
a.glyphicon.glyphicon-plus(ng-click="addAlert()")
.row.top10(ng-if="selectedVersion")
.col-sm-12
ul
li(ng-repeat="alert in selectedVersion.alerts")
span.right10.left10 Message:
a(href="#",editable-text="alert.message" onbeforesave="saveVersion()") {{ alert.message }}
span.right10.left10 Value:
a(href="#",editable-text="alert.value" onbeforesave="saveVersion()") {{ alert.value || 'Not set' }}
span.right10.left10 Maximum difference:
a(href="#",editable-number="alert.maxDiff" e-step="any" onbeforesave="saveVersion()") {{ alert.maxDiff }}
button.left10.btn.btn-xs.btn-default(ng-click="deleteFromList('alerts', alert)") Delete
7 changes: 4 additions & 3 deletions app/views/data/dev-visualization.jade
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
limitations under the License.
h1(ng-controller='DevVisualizatorCtrl') Developer Visualizations
.row(data-ng-init='showVisualization()')
iframe#dashboardIframe.no-border.top10(src = "{{dashboardLink}}" width="100%")
script(src='./js/iresizer.js')
.row(ng-if="isDeveloper()")
.row(data-ng-init='showVisualization()')
iframe#dashboardIframe.no-border.top10(src = "{{dashboardLink}}" width="100%")
script(src='./js/iresizer.js')
9 changes: 0 additions & 9 deletions app/views/data/game-analytics.jade
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,3 @@ style.
#lrsActivityLastWeek.container.t
h2#headerLrsWeek
svg
tr
td
#actorScore.container.t
h2#headerScore
svg
td
#actorProgress.container.t
h2#headerProgress
svg
91 changes: 46 additions & 45 deletions app/views/data/realtime/realtime.jade
Original file line number Diff line number Diff line change
Expand Up @@ -17,51 +17,52 @@
link(rel="stylesheet", href="css/realtime.css")
.container-fluid.height100(ng-controller="SessionCtrl" role="tabpanel" style="position:relative")
h1(ng-if="results.length > 0") Alerts & Warnings
.row(ng-show="player")
.col-xs-12
.row
.col-xs-8
.col-xs-4.text-right(ng-click="viewAll()" style="min-height: 1cm; color: #777")
span.glyphicon.glyphicon-remove
.row.titles
h3.col-xs-12 {{ player.name }}
.row
ul.nav.nav-tabs(role="tablist")
li.col-xs-6.active.tab-button
a(href="#alerts" data-toggle="tab")
.row(ng-if="isTeacher()")
h1(ng-if="results.length > 0") Alerts & Warnings
.row(ng-show="player")
.col-xs-12
.row
.col-xs-8
.col-xs-4.text-right(ng-click="viewAll()" style="min-height: 1cm; color: #777")
span.glyphicon.glyphicon-remove
.row.titles
h3.col-xs-12 User: {{ player.name }}
.row
ul.nav.nav-tabs(role="tablist")
li.col-xs-6.active.tab-button
a(href="#alerts" data-toggle="tab")
span.glyphicon.glyphicon-remove-sign.right10(style="color:red")
| Alerts ({{ player.alerts.length }})
li.col-xs-6.tab-button
a(href="#warnings" data-toggle="tab")
span.glyphicon.glyphicon-exclamation-sign.right10(style="color:orange")
| Warnings ({{ player.warnings.length }})
.row.tab-content.height100
#alerts.tab-pane.active.col-xs-12
.row(ng-repeat="alert in player.alerts")
h4 {{ i }} - {{ version.alerts[alert.id].message }}
a.pull-right(ng-if="player.alerts.length > 0" ng-click='updateLevels(player)')
span.glyphicon.glyphicon-ok
| Remove alerts
#warnings.tab-pane.col-xs-12
.row(ng-repeat="i in player.warnings")
h4 {{ i }} - {{ version.warnings[i].message }}
.row.tab-content(ng-show="!player")
table.table.table-hover.warning-alert-table(ng-if="results.length > 0" )
thead
tr
th User
th
span.glyphicon.glyphicon-remove-sign.right10(style="color:red")
| Alerts ({{ player.alerts.length }})
li.col-xs-6.tab-button
a(href="#warnings" data-toggle="tab")
| Alerts
th
span.glyphicon.glyphicon-exclamation-sign.right10(style="color:orange")
| Warnings ({{ player.warnings.length }})
.row.tab-content.height100
#alerts.tab-pane.active.col-xs-12
.row(ng-repeat="alert in player.alerts")
h4 {{ i }} - {{ version.alerts[alert.id].message }}
a.pull-right(ng-if="player.alerts.length > 0" ng-click='updateLevels(player)')
span.glyphicon.glyphicon-ok
| Remove alerts
#warnings.tab-pane.col-xs-12
.row(ng-repeat="i in player.warnings")
h4 {{ i }} - {{ version.warnings[i].message }}
.row.tab-content(ng-show="!player")
table.table.table-hover.warning-alert-table(ng-if="results.length > 0" )
thead
tr
th User
th
span.glyphicon.glyphicon-remove-sign.right10(style="color:red")
| Alerts
th
span.glyphicon.glyphicon-exclamation-sign.right10(style="color:orange")
| Warnings
tbody
tr(ng-repeat="result in results | orderBy:alertScore:true" ng-click="viewPlayer(result)")
td {{ result.name }}
td {{ result.alerts.length }}
td {{ result.warnings.length }}
h1 Visualizations
iframe#dashboardIframe.no-border(src = "{{dashboardLink()}}" scrolling="no" width="100%")
| Warnings
tbody
tr(ng-repeat="result in results | orderBy:alertScore:true" ng-click="viewPlayer(result)")
td {{ result.name }}
td {{ result.alerts.length }}
td {{ result.warnings.length }}
h1 Visualizations
iframe#dashboardIframe.no-border(src = "{{dashboardLink()}}" scrolling="no" width="100%")
include scripts

0 comments on commit af5a101

Please sign in to comment.