Skip to content

Commit

Permalink
Support gxci
Browse files Browse the repository at this point in the history
  • Loading branch information
arlejeun committed May 22, 2018
1 parent 7e713ab commit ff9e056
Show file tree
Hide file tree
Showing 19 changed files with 234 additions and 119 deletions.
10 changes: 5 additions & 5 deletions web/project/api/Input_dashboard_example.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{

"title": "CX Insight Supervisor",
"short_desc": "Team Leader dashboard helps you monitor in real-time agent status as well as the kind of interaction agents are handling right now. This dashboard monitors operational KPIs to compare agent performance and identify the top performers of your team.",
"short_desc": "This dashboard monitors operational KPIs to keep track of your team or skill center performance and helps you compare agent performance and identify the top performers of your team.",
"tags": [
"CX Insights",
"Inbound",
Expand All @@ -12,14 +12,14 @@
"overview": {
"author": "<p>This dashboard was built by the Genesys CX Insights Team. <aside class=\"warning\"><p><b>Note:</b> This dashboard is not shipped out-of-box with CX Insights but it is an example of what kind of dashboard can be used to monitor your service level across your queues.</p></aside></p>",
"goals": [
"Monitor the overall time spent by a team, skill center or a customer representative in a specific status",
"Monitor Skill Center Performance and occupancy by Agent center",
"Measure the distribution of agent status time spent by a team and skill center",
"Quantify the volume of interactions handled by skill centers or customer representatives with the technical result",
"Quantify the volume of interactions handled by skill centers or customer representatives with the technical result for a given time period",
"Identify the best performers to handle customer inquiries within your teams"
],
"prerequisites": [
"Genesys CIM 8.1+",
"Genesys Pulse 8.5.106+"
"Genesys GCXI 9.0+"
]
},

Expand All @@ -34,7 +34,7 @@
"url": "https://docs.genesys.com/Documentation/PMA/latest/CCAWAHelp/Using"
}
],
"templates": "This dashboard cannot be directly downloaded from this website because it is only accessible with the Genesys Advisors Sellable Items. In order to deploy this dashboard into your environment, you must install the Genesys Advisors and deploy the SSO for Pulse and Advisors as described in the technical documentation."
"templates": "This dashboard cannot be directly downloaded from this website because it is only accessible with the Genesys Customer Experience Insights (GCXI). In order to deploy this dashboard into your environment, you must install the GCXI as described in the technical documentation."
},

"rating": 4
Expand Down
49 changes: 41 additions & 8 deletions web/project/api/dashboards.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# -*- coding: utf-8 -*-

from flask import json, jsonify, request, Blueprint, flash
from flask import json, jsonify, request, Blueprint, g, flash
from flask_security import auth_token_required, http_auth_required, login_required, current_user
from ..models import db, Dashboards
from flask_principal import Permission, RoleNeed
from mongoengine.queryset import Q
from ..settings import PAGINATION_DASHBOARD_PAGE


dashboard_api = Blueprint('dashboard_api', __name__, url_prefix='/api/pulse/dashboards')
dashboard_api = Blueprint('dashboard_api', __name__, url_prefix='/api/<dashboard_type>/dashboards')

# Create a permission with a single Need, in this case a RoleNeed.
admin_permission = Permission(RoleNeed('admin'))
Expand All @@ -17,25 +17,50 @@
PER_PAGE = PAGINATION_DASHBOARD_PAGE


@dashboard_api.url_defaults
def add_dashboard_type(endpoint, values):
values.setdefault('dashboard_type', g.dashboard_type)


@dashboard_api.url_value_preprocessor
def pull_dashboard_type(endpoint, values):
g.dashboard_type = values.pop('dashboard_type')


@dashboard_api.route('', methods=['GET'])
@dashboard_api.route('/', methods=['GET'])
def get_dashboards_api():

total = Dashboards.objects().count()
page = 1
product = getProduct(g.dashboard_type)

if 'page' in request.args:
page = int(request.args['page'])

if current_user.has_role('admin'):
dashboards = Dashboards.objects.all().order_by('-pub_date').paginate(page=page, per_page=PER_PAGE).items
if product == 'pureEngage':
dashboards = Dashboards.objects.all().order_by('-pub_date').paginate(page=page, per_page=PER_PAGE).items
else:
dashboards = Dashboards.objects(Q(product=product)).order_by('-pub_date').paginate(
page=page, per_page=PER_PAGE).items
total = Dashboards.objects(Q(product=product)).count()

elif current_user.has_role('editor'):
dashboards = Dashboards.objects(Q(status='public') | Q(contributor=current_user.email)).order_by('-pub_date').paginate(page=page, per_page=PER_PAGE).items
if product == 'pureEngage':
dashboards = Dashboards.objects(Q(status='public') | Q(contributor=current_user.email)).order_by('-pub_date').paginate(page=page, per_page=PER_PAGE).items

else:
dashboards = Dashboards.objects((Q(status='public') | Q(contributor=current_user.email)) & (Q(product=product))).order_by(
'-pub_date').paginate(page=page, per_page=PER_PAGE).items
total = Dashboards.objects((Q(status='public') | Q(contributor=current_user.email)) & (Q(product=product))).count()
else:
#dashboards = Dashboards.objects(Q(status='public')).order_by('-pub_date')
dashboards = Dashboards.objects(Q(status='public')).order_by('-pub_date').paginate(page=page, per_page=PER_PAGE).items

if product == 'pureEngage':
dashboards = Dashboards.objects(Q(status='public')).order_by('-pub_date').paginate(page=page,per_page=PER_PAGE).items
total = Dashboards.objects(Q(status='public')).count()
else:
dashboards = Dashboards.objects(Q(status='public') & Q(product=product)).order_by('-pub_date').paginate(page=page, per_page=PER_PAGE).items
total = Dashboards.objects(Q(status='public') & Q(product=product)).count()

return jsonify({'total': total, 'per_page': PER_PAGE, 'result': dashboards})

Expand Down Expand Up @@ -77,4 +102,12 @@ def put_dashboard_api(dash):
subset = {k: payload[k] for k in validfields}
dashboard.update(**subset)
dashboard.save()
return jsonify({'result': 'OK', 'msg': 'visualization updated', 'name':dash})
return jsonify({'result': 'OK', 'msg': 'visualization updated', 'name':dash})


def getProduct(dash_type):
switcher = {
'pulse': 'pulse',
'gcxi': 'gcxi'
}
return switcher.get(dash_type, "pureEngage")
2 changes: 1 addition & 1 deletion web/project/dashboards/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ class AddDashboardForm(FlaskForm):
dashboard_metadata = FileField('Dashboard CC Metadata definition', validators=[DataRequired(),FileAllowed(upload_exported_templates, 'JSON only!')])
dashboard_image = FileField('Dashboard screenshot', validators=[FileRequired(), FileAllowed(upload_images, 'Images only!')])
dashboard_export = FileField('Dashboard export', validators=[FileRequired(), FileAllowed(upload_exported_templates, 'JSON only!')])
dashboard_type = RadioField('Label', choices=[('pulse', 'Pulse Dashboard'), ('cx_insights', 'CX Insights Dashboard')], validators=[DataRequired()])
dashboard_type = RadioField('Label', choices=[('pulse', 'Pulse Dashboard'), ('gcxi', 'CX Insights Dashboard')], validators=[DataRequired()])

submit_button = SubmitField('Submit Dashboard')
25 changes: 22 additions & 3 deletions web/project/dashboards/views.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
# -*- coding: utf-8 -*-

from flask import json, jsonify, request, Blueprint, flash, render_template, redirect, url_for
from flask import json, jsonify, request, Blueprint, flash, render_template, g, redirect, url_for
from flask_security import auth_token_required, http_auth_required, login_required, current_user


dash_bp = Blueprint('dashboards', __name__, url_prefix='/pulse/dashboards', static_folder='../frontend/static', template_folder='../frontend/templates')
#dash_bp = Blueprint('dashboards', __name__, url_prefix='/pulse/dashboards', static_folder='../frontend/static', template_folder='../frontend/templates')
dash_bp = Blueprint('dashboards', __name__, url_prefix='/<dashboard_type>/dashboards', static_folder='../frontend/static', template_folder='../frontend/templates')


@dash_bp.url_defaults
def add_dashboard_type(endpoint, values):
if 'dashboard_type' in values or not g.dashboard_type:
return
values.setdefault('dashboard_type', getDashboardType(g.dashboard_type))


@dash_bp.url_value_preprocessor
def pull_dashboard_type(endpoint, values):
g.dashboard_type = values.pop('dashboard_type', None)


@dash_bp.route('', methods=['GET'])
Expand All @@ -13,9 +26,15 @@ def get_dashboard_list():
return render_template('index.html', user=current_user)



@dash_bp.route('/<name>', methods=['GET'])
def get_dashboard(name=None):
# return dash_bp.send_static_file('index.html')
return render_template('index.html', user=current_user)


def getDashboardType(dash_type):
switcher = {
'pulse': 'pulse',
'gcxi': 'gcxi'
}
return switcher.get(dash_type, "pureEngage")
15 changes: 12 additions & 3 deletions web/project/frontend/static/src/gsys-detail-dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -180,15 +180,15 @@
<app-route route="[[route]]" pattern="/:dashboardId" data="{{routeData}}"></app-route>

<market-category-data id="categoryData"
category-name="pulse_dashboards"
category-name="[[_getCategoryName(route, routeData)]]"
item-name="{{_getDashboardName(routeData.dashboardId)}}"
item="{{item}}"
failure="{{failure}}">
</market-category-data>

<!-- Initial view of dashboard -->
<template is="dom-if" if="[[_hasFeatures(item)]]">
<google-codelab title="Pulse Dashboard" environment="web" last-updated="2017-04-18" noToolbar=true
<google-codelab title="Dashboard" environment="web" last-updated="2017-04-18" noToolbar=true
noHighlight=true>


Expand Down Expand Up @@ -385,7 +385,7 @@ <h4>Would you recommend this dashboard for your organization?</h4>

<!-- Simplified view of dashboard -->
<template is="dom-if" if="[[!_hasFeatures(item)]]">
<google-codelab title="Pulse Dashboard" environment="web" last-updated="2017-04-19" noToolbar=true
<google-codelab title="Dashboard" environment="web" last-updated="2017-04-19" noToolbar=true
noHighlight=true>

<google-codelab-step label="Overview" duration="2">
Expand Down Expand Up @@ -516,6 +516,15 @@ <h3>Who developed this dashboard?</h3>
return item;
},

_getCategoryName: function (route, routeData) {
if (route.prefix == "/gcxi/dashboards") {
return "gcxi_dashboards";
} else if (route.prefix == "/pulse/dashboards") {
return "pulse_dashboards";
} else {
return "pureEngage_dashboards";
}
},

_getDashboardName:function(dashboardId) {
console.log(dashboardId);
Expand Down
22 changes: 21 additions & 1 deletion web/project/frontend/static/src/gsys-pulse-dashboards.html
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,25 @@
return 'pulse_dashboards';
}
}
if (route.prefix && route.prefix.replace(/\//g,"_").slice(1)=='gcxi_dashboards') {
if (route.path) {
console.log("Search for a specific Dashboard: " + route.path);
// return 'gcxi_dashboards';
} else {
return 'gcxi_dashboards';
}

}

if (route.prefix && route.prefix.replace(/\//g,"_").slice(1)=='pureEngage_dashboards') {
if (route.path) {
console.log("Search for a specific Dashboard: " + route.path);
// return 'pureEngage_dashboards';
} else {
return 'pureEngage_dashboards';
}

}
},

//Not called
Expand All @@ -205,7 +224,8 @@

_getTemplateID: function(route) {
console.log(route);
return (route.prefix=='/pulse/dashboards' & route.path != "")
//return (route.prefix=='/pulse/dashboards' & route.path != "");
return (route.prefix && route.prefix.includes('dashboards') && route.path != "");
},

_categoryChanged: function(category, visible) {
Expand Down
1 change: 1 addition & 0 deletions web/project/frontend/static/src/gsys-pulse.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
<gsys-pulse-templates name="templates" route="[[subroute]]" category="[[routeData.category]]" user="[[user]]" role="[[role]]"></gsys-pulse-templates>
<gsys-pulse-visualizations name="visualizations" route="[[subroute]]" category="[[routeData.category]]" user="[[user]]" role="[[role]]"></gsys-pulse-visualizations>


<gsys-pulse-help name="help" route="[[subroute]]"></gsys-pulse-help>
<gsys-view404 name="view404"></gsys-view404>

Expand Down
4 changes: 2 additions & 2 deletions web/project/frontend/static/src/landing-page.html
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ <h3>Welcome</h3>


<li class="item">
<a href="/pulse/dashboards">
<a href="/pureEngage/dashboards">
<paper-card heading="DASHBOARDS" class="redgen">
<div class="card-content">
Check out the list of dashboards curated by Genesys to help organizations quickly deploy dashboards with best practices of our Genesys community.
Expand Down Expand Up @@ -331,7 +331,7 @@ <h3>Welcome</h3>
},

_showDashboards: function (evt) {
location.href= '/pulse/dashboards';
location.href= '/pureEngage/dashboards';
},

_showVisualizations: function (evt) {
Expand Down
56 changes: 14 additions & 42 deletions web/project/frontend/static/src/market-app.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->


To follow-up on this item
<link rel="import" href="../bower_components/polymer/polymer.html">
<link rel="import" href="../bower_components/app-layout/app-drawer/app-drawer.html">
<link rel="import" href="../bower_components/app-layout/app-drawer-layout/app-drawer-layout.html">
Expand Down Expand Up @@ -142,41 +142,6 @@
role="navigation">

<!--Courtesy of http://jsbin.com/sutavom/edit?html,output-->
<!--<paper-menu id="menu" on-iron-select="_menuItemSelected" multi>
<paper-submenu xyz="1">
<paper-item xyz="2" class="menu-trigger">Pulse &rtri;</paper-item>
<paper-menu class="menu-content">
<a class="paper-item-link" name="pulse-dashboards" href="/pulse/dashboards">
<paper-item xyz="a">Dashboards</paper-item>
</a>
<a class="paper-item-link" name="pulse-visualizations" href="/pulse/visualizations">
<paper-item xyz="c">Visualizations</paper-item>
</a>
<a class="paper-item-link" name="pulse-templates" href="/pulse/templates">
<paper-item xyz="c">Templates</paper-item>
</a>
<paper-item xyz="d">Contact Center Advisor</paper-item>
<paper-item xyz="e">Frontline Advisor</paper-item>
<paper-item xyz="f">Workforce Advisor</paper-item>
</paper-menu>
</paper-submenu>
<paper-submenu xyz="5">
<paper-item class="menu-trigger">CX Insigths &rtri;</paper-item>
<paper-menu class="menu-content">
<paper-item xyz="6">Dashboards</paper-item>
<paper-item xyz="7">Visualizations</paper-item>
</paper-menu>
</paper-submenu>
</paper-menu> -->


<paper-menu id="menu" on-iron-select="_menuItemSelected" multi>

Expand All @@ -202,8 +167,9 @@
<paper-submenu xyz="5">
<paper-item class="menu-trigger">CX Insigths &rtri;</paper-item>
<paper-menu class="menu-content">
<a class="paper-item-link" name="gcxi-dashboards" href="/gcxi/dashboards">
<paper-item xyz="e">Dashboards</paper-item>
<paper-item xyz="f">Visualizations</paper-item>
</a>
</paper-menu>
</paper-submenu>
</paper-menu>
Expand Down Expand Up @@ -260,9 +226,12 @@
fallback-selection="view404"
role="main">

<gsys-pulse name="pureEngage" route="[[subroute]]" user="[[user]]"
role="[[_roleChanged(role)]]"></gsys-pulse>
<gsys-pulse name="pulse" route="[[subroute]]" user="[[user]]"
role="[[_roleChanged(role)]]"></gsys-pulse>
<gsys-insights name="insights" route="[[subroute]]"></gsys-insights>
<gsys-pulse name="gcxi" route="[[subroute]]" user="[[user]]"
role="[[_roleChanged(role)]]"></gsys-pulse>
<gsys-detail-template name="detail" route="[[subroute]]"
category="pulse_wallboards"></gsys-detail-template>

Expand Down Expand Up @@ -341,7 +310,7 @@
return user != 'anonymous';
var self = this;
// Load page import on demand. Show 404 page if fails
var routes = ["pulse", "insights", "view404"]
var routes = ["pulse", "gcxi", "view404"]
if (routes.indexOf(this.page) > -1) {
var resolvedPageUrl = this.resolveUrl('gsys-' + page + '.html');
this.importHref(resolvedPageUrl, null, this._showPage404, true);
Expand All @@ -360,7 +329,11 @@

_onExploreDashboard: function (evt) {
this.$.appLocation.set('__hash',0);
this.$.appLocation.set('path','pulse/dashboards/'+ evt.detail.name);
if (evt.detail && evt.detail.product) {
this.$.appLocation.set('path',evt.detail.product + '/dashboards/'+ evt.detail.name);
} else {
this.$.appLocation.set('path','pulse/dashboards/'+ evt.detail.name);
}
},

_onExploreVisualization: function (evt) {
Expand All @@ -372,7 +345,6 @@
_onExploreTemplate: function (evt) {
this.$.appLocation.set('__hash',0);
this.$.appLocation.set('path','pulse/templates/'+ evt.detail.definition.guid);

},

_onLookTemplate: function (evt) {
Expand All @@ -396,7 +368,7 @@

_showDashboards: function (evt) {
//this.$.appLocation.set('path','pulse/dashboards');
location.href= '/pulse/dashboards';
location.href= '/pureEngage/dashboards';
},

_showVisualizations: function (evt) {
Expand Down
Loading

0 comments on commit ff9e056

Please sign in to comment.