d2-analysis
Advanced tools
Comparing version 29.0.39 to 29.0.41
@@ -185,7 +185,2 @@ 'use strict'; | ||
//permission | ||
if ((0, _isString2.default)(c.permission)) { | ||
t.permission = c.permission; | ||
} | ||
//user group accesses | ||
@@ -220,2 +215,10 @@ if ((0, _arrayFrom2.default)(c.userGroupAccesses).length) { | ||
t.canRead = function () { | ||
return _access ? _access.read : false; | ||
}; | ||
t.canUpdate = function () { | ||
return _access ? _access.update : false; | ||
}; | ||
t.setAccess = function (a) { | ||
@@ -471,3 +474,3 @@ _access = a; | ||
var deleteAnyway = ['klass', 'name', 'parentGraphMap', 'reportingPeriod', 'organisationUnit', 'parentOrganisationUnit', 'cumulative', 'sortOrder', 'topLimit', 'displayDescription', 'displayName', 'interpretations', 'lastUpdated', 'created', 'user', 'publicAccess', 'permission', 'userGroupAccesses', 'prototype', 'url']; | ||
var deleteAnyway = ['klass', 'name', 'parentGraphMap', 'reportingPeriod', 'organisationUnit', 'parentOrganisationUnit', 'cumulative', 'sortOrder', 'topLimit', 'displayDescription', 'displayName', 'interpretations', 'lastUpdated', 'created', 'user', 'publicAccess', 'userGroupAccesses', 'prototype', 'url']; | ||
@@ -533,2 +536,4 @@ deleteIfTruthy.forEach(function (item) { | ||
delete this.getAccess; | ||
delete this.canRead; | ||
delete this.canUpdate; | ||
delete this.setAccess; | ||
@@ -576,3 +581,3 @@ delete this.getDataDimensionItems; | ||
delete this.publicAccess; | ||
delete this.permission, delete this.userGroupAccesses; | ||
delete this.userGroupAccesses; | ||
delete this.displayName; | ||
@@ -579,0 +584,0 @@ }; |
@@ -188,27 +188,29 @@ 'use strict'; | ||
if (sublevels.length > 0) { | ||
var root = this.getRootAncestor(); | ||
(function () { | ||
var root = _this3.getRootAncestor(); | ||
items.push({ | ||
isSubtitle: true, | ||
style: 'padding: 5px 5px 5px 5px; font-size: 120%; font-weight:bold', | ||
html: this.i18n.drill_down | ||
}); | ||
sublevels.forEach(function (ou) { | ||
items.push({ | ||
items: [{ id: ou.id + ';' + 'LEVEL-' + ou.level }], | ||
text: 'Show all <span class="name">' + ou.name.toLowerCase() + ' units in ' + _this3.getName() + '</span>', | ||
iconCls: 'ns-menu-item-float' | ||
isSubtitle: true, | ||
style: 'padding: 5px 5px 5px 5px; font-size: 120%; font-weight:bold', | ||
html: _this3.i18n.drill_down | ||
}); | ||
}); | ||
sublevels.forEach(function (ou) { | ||
if (root.level !== _this3.getLevel()) { | ||
sublevels.forEach(function (ou) { | ||
items.push({ | ||
items: [{ id: root.id + ';' + 'LEVEL-' + ou.level }], | ||
text: 'Show all <span class="name">' + ou.name + ' units</span>', | ||
items: [{ id: ou.id + ';' + 'LEVEL-' + ou.level }], | ||
text: 'Show all <span class="name">' + ou.name.toLowerCase() + ' units in ' + _this3.getName() + '</span>', | ||
iconCls: 'ns-menu-item-float' | ||
}); | ||
} | ||
}); | ||
}); | ||
sublevels.forEach(function (ou) { | ||
if (root.level !== _this3.getLevel()) { | ||
items.push({ | ||
items: [{ id: root.id + ';' + 'LEVEL-' + ou.level }], | ||
text: 'Show all <span class="name">' + ou.name + ' units</span>', | ||
iconCls: 'ns-menu-item-float' | ||
}); | ||
} | ||
}); | ||
})(); | ||
} | ||
@@ -215,0 +217,0 @@ |
@@ -193,19 +193,4 @@ 'use strict'; | ||
success: function success(r) { | ||
$.ajax({ | ||
url: appManager.getApiPath() + '/' + t.apiEndpoint + '/' + id, | ||
type: 'PATCH', | ||
data: JSON.stringify({}), | ||
// avoid jQuery choke on empty 200 Success response | ||
dataType: 'text', | ||
headers: appManager.defaultRequestHeaders, | ||
success: function success(sharing) { | ||
var layout = new Layout(refs, r, { permission: "write" }); | ||
fn(layout, true); | ||
}, | ||
error: function error(xhr) { | ||
var permission = xhr.status === 404 ? "none" : "read"; | ||
var layout = new Layout(refs, r, { permission: permission }); | ||
fn(layout, true); | ||
} | ||
}); | ||
var layout = new Layout(refs, r); | ||
fn(layout, true); | ||
}, | ||
@@ -212,0 +197,0 @@ error: function error(r) { |
@@ -264,48 +264,50 @@ 'use strict'; | ||
if (ouId) { | ||
menu.add({ | ||
uid: 'OU_MENU', | ||
text: i18n.organisation_units_drill_down || 'Org unit drill down/up', | ||
iconCls: 'ns-menu-item-datasource', | ||
menu: { | ||
items: [{ html: '<div class="spinner"></div>' }] | ||
} | ||
}); | ||
(function () { | ||
menu.add({ | ||
uid: 'OU_MENU', | ||
text: i18n.organisation_units_drill_down || 'Org unit drill down/up', | ||
iconCls: 'ns-menu-item-datasource', | ||
menu: { | ||
items: [{ html: '<div class="spinner"></div>' }] | ||
} | ||
}); | ||
var ouMenu = menu.items.findBy(function (submenu) { | ||
return submenu.uid === 'OU_MENU'; | ||
}); | ||
var organisationUnit = new _OrganisationUnit.OrganisationUnit(layout.getRefs(), { id: ouId }); | ||
var ouMenu = menu.items.findBy(function (submenu) { | ||
return submenu.uid === 'OU_MENU'; | ||
}); | ||
var organisationUnit = new _OrganisationUnit.OrganisationUnit(layout.getRefs(), { id: ouId }); | ||
uiManager.mask(); | ||
uiManager.mask(); | ||
organisationUnit.getAncestorsRequest(true).done(function (data) { | ||
organisationUnit.setAncestors(data.ancestors); | ||
organisationUnit.setLevel(data.level); | ||
organisationUnit.getAncestorsRequest(true).done(function (data) { | ||
organisationUnit.setAncestors(data.ancestors); | ||
organisationUnit.setLevel(data.level); | ||
var organisationUnitMenuItems = organisationUnit.getContextMenuItemsConfig(); | ||
var organisationUnitMenuItems = organisationUnit.getContextMenuItemsConfig(); | ||
// setting click handler | ||
for (var i = 0; i < organisationUnitMenuItems.length; ++i) { | ||
var ou = organisationUnitMenuItems[i]; | ||
// setting click handler | ||
for (var i = 0; i < organisationUnitMenuItems.length; ++i) { | ||
var ou = organisationUnitMenuItems[i]; | ||
if (ou.isSubtitle) { | ||
continue; | ||
} | ||
if (ou.isSubtitle) { | ||
continue; | ||
} | ||
ou.handler = function () { | ||
var layout = instanceManager.getStateCurrent(); | ||
var ouDimension = new _Dimension.Dimension(layout.getRefs(), { dimension: 'ou', items: this.items }); | ||
ou.handler = function () { | ||
var layout = instanceManager.getStateCurrent(); | ||
var ouDimension = new _Dimension.Dimension(layout.getRefs(), { dimension: 'ou', items: this.items }); | ||
layout.replaceDimensionByName(ouDimension); | ||
layout.replaceDimensionByName(ouDimension); | ||
layout.setResponse(null); | ||
layout.setResponse(null); | ||
instanceManager.getReport(layout, false, false, true); | ||
}; | ||
} | ||
instanceManager.getReport(layout, false, false, true); | ||
}; | ||
} | ||
ouMenu.menu.removeAll(); | ||
ouMenu.menu.add(organisationUnitMenuItems); | ||
uiManager.unmask(); | ||
}); | ||
ouMenu.menu.removeAll(); | ||
ouMenu.menu.add(organisationUnitMenuItems); | ||
uiManager.unmask(); | ||
}); | ||
})(); | ||
} | ||
@@ -383,23 +385,25 @@ | ||
if (item && (0, _arrayContains2.default)(METADATA_DETAILED_TYPES, item.dimensionItemType)) { | ||
var html = '<p>Type: ' + item.dimensionItemType + '</p>'; | ||
(function () { | ||
var html = '<p>Type: ' + item.dimensionItemType + '</p>'; | ||
if (item.description) { | ||
html += '<p>Description: ' + item.description + '</p>'; | ||
} | ||
if (item.description) { | ||
html += '<p>Description: ' + item.description + '</p>'; | ||
} | ||
if (item.code) { | ||
html += '<p>Code: ' + item.code + '</p>'; | ||
} | ||
if (item.code) { | ||
html += '<p>Code: ' + item.code + '</p>'; | ||
} | ||
var tip = Ext.create('Ext.tip.ToolTip', { | ||
target: Ext.get(obj.uuid), | ||
bodyStyle: 'font-size: 110%', | ||
html: html | ||
}); | ||
var tip = Ext.create('Ext.tip.ToolTip', { | ||
target: Ext.get(obj.uuid), | ||
bodyStyle: 'font-size: 110%', | ||
html: html | ||
}); | ||
Ext.get(obj.uuid).on({ | ||
mouseover: function mouseover() { | ||
Ext.Function.createBuffered(tip.show, 1000, tip); | ||
} | ||
}); | ||
Ext.get(obj.uuid).on({ | ||
mouseover: function mouseover() { | ||
Ext.Function.createBuffered(tip.show, 1000, tip); | ||
} | ||
}); | ||
})(); | ||
} | ||
@@ -406,0 +410,0 @@ }; |
@@ -123,3 +123,3 @@ 'use strict'; | ||
// Change Link | ||
if (layout && layout.permission === "write") { | ||
if (layout && layout.canUpdate && layout.canUpdate()) { | ||
descriptionItems.push({ | ||
@@ -187,3 +187,3 @@ xtype: 'label', | ||
// Favorite Details Panel content when favorite loaded | ||
var userCanEditSharing = layout && layout.permission === 'write'; | ||
var userCanEditSharing = layout && layout.canUpdate && layout.canUpdate(); | ||
@@ -317,3 +317,3 @@ detailsPanelItems = [{ | ||
itemId: 'commentPanel-' + (comment ? comment.id : "new"), | ||
hidden: !visible || !layout || layout.permission === "none", | ||
hidden: !visible || !interpretation.access || !interpretation.access.update, | ||
style: 'margin-top: 1px;', | ||
@@ -446,2 +446,3 @@ cls: 'comment greyBackground', | ||
style: 'color: #666', | ||
hidden: !interpretation.access || !interpretation.access.update, | ||
text: _DateManager.DateManager.getTimeDifference(comment.lastUpdated) + ' ' + i18n.ago | ||
@@ -692,3 +693,3 @@ }, { | ||
style: 'margin-bottom: 5px;', | ||
hidden: !layout || layout.permission === "none", | ||
hidden: !interpretation.access || !interpretation.access.read, | ||
@@ -706,2 +707,3 @@ items: [{ | ||
xtype: 'label', | ||
hidden: !interpretation.access || !interpretation.access.update, | ||
text: '·', | ||
@@ -712,2 +714,3 @@ style: 'margin-right: 5px;' | ||
html: getLink(i18n.comment), | ||
hidden: !interpretation.access || !interpretation.access.update, | ||
style: 'margin-right: 5px;', | ||
@@ -854,3 +857,3 @@ listeners: { | ||
style: 'padding:6px; border-width:0 0 1px 0; border-style:solid;', | ||
hidden: displayingInterpretation || !layout || layout.permission === "none", | ||
hidden: displayingInterpretation || !layout || !layout.canRead || !layout.canRead(), | ||
itemId: 'shareInterpretation', | ||
@@ -857,0 +860,0 @@ items: [{ |
{ | ||
"name": "d2-analysis", | ||
"version": "29.0.39", | ||
"version": "29.0.41", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -139,7 +139,2 @@ import isArray from 'd2-utilizr/lib/isArray'; | ||
//permission | ||
if (isString(c.permission)) { | ||
t.permission = c.permission; | ||
} | ||
//user group accesses | ||
@@ -174,2 +169,10 @@ if (arrayFrom(c.userGroupAccesses).length) { | ||
t.canRead = function() { | ||
return _access ? _access.read : false; | ||
}; | ||
t.canUpdate = function() { | ||
return _access ? _access.update : false; | ||
}; | ||
t.setAccess = function(a) { | ||
@@ -487,3 +490,2 @@ _access = a; | ||
'publicAccess', | ||
'permission', | ||
'userGroupAccesses', | ||
@@ -556,2 +558,4 @@ 'prototype', | ||
delete this.getAccess; | ||
delete this.canRead; | ||
delete this.canUpdate; | ||
delete this.setAccess; | ||
@@ -599,3 +603,3 @@ delete this.getDataDimensionItems; | ||
delete this.publicAccess; | ||
delete this.permission, delete this.userGroupAccesses; | ||
delete this.userGroupAccesses; | ||
delete this.displayName; | ||
@@ -602,0 +606,0 @@ }; |
@@ -168,19 +168,4 @@ import isFunction from 'd2-utilizr/lib/isFunction'; | ||
success: function(r) { | ||
$.ajax({ | ||
url: appManager.getApiPath() + '/' + t.apiEndpoint + '/' + id, | ||
type: 'PATCH', | ||
data: JSON.stringify({}), | ||
// avoid jQuery choke on empty 200 Success response | ||
dataType: 'text', | ||
headers: appManager.defaultRequestHeaders, | ||
success: function(sharing) { | ||
var layout = new Layout(refs, r, {permission: "write"}); | ||
fn(layout, true); | ||
}, | ||
error: function(xhr) { | ||
var permission = xhr.status === 404 ? "none" : "read"; | ||
var layout = new Layout(refs, r, {permission: permission}); | ||
fn(layout, true); | ||
} | ||
}); | ||
var layout = new Layout(refs, r); | ||
fn(layout, true); | ||
}, | ||
@@ -187,0 +172,0 @@ error: function(r) { |
@@ -110,3 +110,3 @@ import {DateManager} from '../manager/DateManager.js'; | ||
// Change Link | ||
if (layout && layout.permission === "write") { | ||
if (layout && layout.canUpdate && layout.canUpdate()) { | ||
descriptionItems.push({ | ||
@@ -174,3 +174,3 @@ xtype: 'label', | ||
// Favorite Details Panel content when favorite loaded | ||
var userCanEditSharing = layout && layout.permission === 'write'; | ||
var userCanEditSharing = layout && layout.canUpdate && layout.canUpdate(); | ||
@@ -305,3 +305,3 @@ detailsPanelItems = [{ | ||
itemId: 'commentPanel-' + (comment ? comment.id : "new"), | ||
hidden: !visible || (!layout || layout.permission === "none"), | ||
hidden: !visible || !interpretation.access || !interpretation.access.update, | ||
style: 'margin-top: 1px;', | ||
@@ -434,2 +434,3 @@ cls: 'comment greyBackground', | ||
style: 'color: #666', | ||
hidden: !interpretation.access || !interpretation.access.update, | ||
text: DateManager.getTimeDifference(comment.lastUpdated) + ' ' + i18n.ago | ||
@@ -681,3 +682,3 @@ }, { | ||
style: 'margin-bottom: 5px;', | ||
hidden: !layout || layout.permission === "none", | ||
hidden: !interpretation.access || !interpretation.access.read, | ||
@@ -695,2 +696,3 @@ items: [{ | ||
xtype: 'label', | ||
hidden: !interpretation.access || !interpretation.access.update, | ||
text: '·', | ||
@@ -701,2 +703,3 @@ style: 'margin-right: 5px;' | ||
html: getLink(i18n.comment), | ||
hidden: !interpretation.access || !interpretation.access.update, | ||
style: 'margin-right: 5px;', | ||
@@ -844,3 +847,3 @@ listeners: { | ||
style: 'padding:6px; border-width:0 0 1px 0; border-style:solid;', | ||
hidden: displayingInterpretation || (!layout || layout.permission === "none"), | ||
hidden: displayingInterpretation || (!layout || !layout.canRead || !layout.canRead()), | ||
itemId: 'shareInterpretation', | ||
@@ -847,0 +850,0 @@ items: [{ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
338
3724852
48188