bug fix #1324 tree-orgchart

This commit is contained in:
João Mendes 2020-06-12 19:15:01 +01:00
parent c703110b5d
commit 46a0eff89c
3 changed files with 44 additions and 3179 deletions

3159
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -10111,8 +10111,7 @@
"ansi-regex": { "ansi-regex": {
"version": "2.1.1", "version": "2.1.1",
"bundled": true, "bundled": true,
"dev": true, "dev": true
"optional": true
}, },
"aproba": { "aproba": {
"version": "1.2.0", "version": "1.2.0",
@ -10133,14 +10132,12 @@
"balanced-match": { "balanced-match": {
"version": "1.0.0", "version": "1.0.0",
"bundled": true, "bundled": true,
"dev": true, "dev": true
"optional": true
}, },
"brace-expansion": { "brace-expansion": {
"version": "1.1.11", "version": "1.1.11",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"balanced-match": "^1.0.0", "balanced-match": "^1.0.0",
"concat-map": "0.0.1" "concat-map": "0.0.1"
@ -10155,20 +10152,17 @@
"code-point-at": { "code-point-at": {
"version": "1.1.0", "version": "1.1.0",
"bundled": true, "bundled": true,
"dev": true, "dev": true
"optional": true
}, },
"concat-map": { "concat-map": {
"version": "0.0.1", "version": "0.0.1",
"bundled": true, "bundled": true,
"dev": true, "dev": true
"optional": true
}, },
"console-control-strings": { "console-control-strings": {
"version": "1.1.0", "version": "1.1.0",
"bundled": true, "bundled": true,
"dev": true, "dev": true
"optional": true
}, },
"core-util-is": { "core-util-is": {
"version": "1.0.2", "version": "1.0.2",
@ -10285,8 +10279,7 @@
"inherits": { "inherits": {
"version": "2.0.4", "version": "2.0.4",
"bundled": true, "bundled": true,
"dev": true, "dev": true
"optional": true
}, },
"ini": { "ini": {
"version": "1.3.5", "version": "1.3.5",
@ -10298,7 +10291,6 @@
"version": "1.0.0", "version": "1.0.0",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"number-is-nan": "^1.0.0" "number-is-nan": "^1.0.0"
} }
@ -10313,7 +10305,6 @@
"version": "3.0.4", "version": "3.0.4",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"brace-expansion": "^1.1.7" "brace-expansion": "^1.1.7"
} }
@ -10321,14 +10312,12 @@
"minimist": { "minimist": {
"version": "0.0.8", "version": "0.0.8",
"bundled": true, "bundled": true,
"dev": true, "dev": true
"optional": true
}, },
"minipass": { "minipass": {
"version": "2.9.0", "version": "2.9.0",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"safe-buffer": "^5.1.2", "safe-buffer": "^5.1.2",
"yallist": "^3.0.0" "yallist": "^3.0.0"
@ -10347,7 +10336,6 @@
"version": "0.5.1", "version": "0.5.1",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"minimist": "0.0.8" "minimist": "0.0.8"
} }
@ -10437,8 +10425,7 @@
"number-is-nan": { "number-is-nan": {
"version": "1.0.1", "version": "1.0.1",
"bundled": true, "bundled": true,
"dev": true, "dev": true
"optional": true
}, },
"object-assign": { "object-assign": {
"version": "4.1.1", "version": "4.1.1",
@ -10450,7 +10437,6 @@
"version": "1.4.0", "version": "1.4.0",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"wrappy": "1" "wrappy": "1"
} }
@ -10536,8 +10522,7 @@
"safe-buffer": { "safe-buffer": {
"version": "5.1.2", "version": "5.1.2",
"bundled": true, "bundled": true,
"dev": true, "dev": true
"optional": true
}, },
"safer-buffer": { "safer-buffer": {
"version": "2.1.2", "version": "2.1.2",
@ -10573,7 +10558,6 @@
"version": "1.0.2", "version": "1.0.2",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"code-point-at": "^1.0.0", "code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0", "is-fullwidth-code-point": "^1.0.0",
@ -10593,7 +10577,6 @@
"version": "3.0.1", "version": "3.0.1",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"ansi-regex": "^2.0.0" "ansi-regex": "^2.0.0"
} }
@ -10637,14 +10620,12 @@
"wrappy": { "wrappy": {
"version": "1.0.2", "version": "1.0.2",
"bundled": true, "bundled": true,
"dev": true, "dev": true
"optional": true
}, },
"yallist": { "yallist": {
"version": "3.1.1", "version": "3.1.1",
"bundled": true, "bundled": true,
"dev": true, "dev": true
"optional": true
} }
} }
}, },

View File

@ -114,12 +114,15 @@ export default class TreeOrgChart extends React.Component<
let spUser: IPersonaSharedProps = {}; let spUser: IPersonaSharedProps = {};
// Get User Properties // Get User Properties
const managerProperties = await this.SPService.getUserProperties(manager); const managerProperties = await this.SPService.getUserProperties(manager);
const imageInitials: string[] = managerProperties.DisplayName.split(" ");
let imageInitials: string[] = managerProperties.DisplayName.split(" ");
// Persona Card Properties // Persona Card Properties
spUser.imageUrl = `/_layouts/15/userphoto.aspx?size=L&username=${managerProperties.Email}`; spUser.imageUrl = `/_layouts/15/userphoto.aspx?size=L&username=${managerProperties.Email}`;
spUser.imageInitials = `${imageInitials[0] spUser.imageInitials = imageInitials && imageInitials.length > 0 ? `${imageInitials[0]
.substring(0, 1) .substring(0, 1)
.toUpperCase()}${imageInitials[1].substring(0, 1).toUpperCase()}`; .toUpperCase()}${imageInitials[1] ? imageInitials[1].substring(0, 1).toUpperCase():''}` : '';
spUser.text = managerProperties.DisplayName; spUser.text = managerProperties.DisplayName;
spUser.tertiaryText = managerProperties.Email; spUser.tertiaryText = managerProperties.Email;
spUser.secondaryText = managerProperties.Title; spUser.secondaryText = managerProperties.Title;
@ -157,9 +160,9 @@ export default class TreeOrgChart extends React.Component<
const imageInitials: string[] = managerProperties.DisplayName.split(" "); const imageInitials: string[] = managerProperties.DisplayName.split(" ");
spUser.imageUrl = `/_layouts/15/userphoto.aspx?size=L&username=${managerProperties.Email}`; spUser.imageUrl = `/_layouts/15/userphoto.aspx?size=L&username=${managerProperties.Email}`;
spUser.imageInitials = `${imageInitials[0] spUser.imageInitials = imageInitials && imageInitials.length > 0 ? `${imageInitials[0]
.substring(0, 1) .substring(0, 1)
.toUpperCase()}${imageInitials[1].substring(0, 1).toUpperCase()}`; .toUpperCase()}${imageInitials[1] ? imageInitials[1].substring(0, 1).toUpperCase(): ''}` : '';
spUser.text = managerProperties.DisplayName; spUser.text = managerProperties.DisplayName;
spUser.tertiaryText = managerProperties.Email; spUser.tertiaryText = managerProperties.Email;
spUser.secondaryText = managerProperties.Title; spUser.secondaryText = managerProperties.Title;
@ -207,7 +210,7 @@ export default class TreeOrgChart extends React.Component<
// PersonaCard Props // PersonaCard Props
manager.imageUrl = `/_layouts/15/userphoto.aspx?size=L&username=${managerProperties.Email}`; manager.imageUrl = `/_layouts/15/userphoto.aspx?size=L&username=${managerProperties.Email}`;
if (imageInitials) if (imageInitials)
manager.imageInitials = `${imageInitials[0]}${imageInitials[1]}`.toUpperCase(); manager.imageInitials = `${imageInitials[0]}${imageInitials[1] ? imageInitials[1]: ''}`.toUpperCase();
manager.text = managerProperties.DisplayName; manager.text = managerProperties.DisplayName;
manager.tertiaryText = managerProperties.Email; manager.tertiaryText = managerProperties.Email;
manager.secondaryText = managerProperties.Title; manager.secondaryText = managerProperties.Title;
@ -227,9 +230,9 @@ export default class TreeOrgChart extends React.Component<
" " " "
); );
me.imageUrl = `/_layouts/15/userphoto.aspx?size=L&username=${currentUserProperties.Email}`; me.imageUrl = `/_layouts/15/userphoto.aspx?size=L&username=${currentUserProperties.Email}`;
me.imageInitials = `${meImageInitials[0] me.imageInitials = me.imageInitials && me.imageInitials.length > 0 ?`${meImageInitials[0]
.substring(0, 1) .substring(0, 1)
.toUpperCase()}${meImageInitials[1].substring(0, 1).toUpperCase()}`; .toUpperCase()}${meImageInitials[1] ? meImageInitials[1].substring(0, 1).toUpperCase():''}` : '';
me.text = currentUserProperties.DisplayName; me.text = currentUserProperties.DisplayName;
me.tertiaryText = currentUserProperties.Email; me.tertiaryText = currentUserProperties.Email;
me.secondaryText = currentUserProperties.Title; me.secondaryText = currentUserProperties.Title;
@ -256,9 +259,9 @@ export default class TreeOrgChart extends React.Component<
const peerProperties = await this.SPService.getUserProperties(userPeer); const peerProperties = await this.SPService.getUserProperties(userPeer);
imageInitials = peerProperties.DisplayName.split(" "); imageInitials = peerProperties.DisplayName.split(" ");
peer.imageUrl = `/_layouts/15/userphoto.aspx?size=L&username=${peerProperties.Email}`; peer.imageUrl = `/_layouts/15/userphoto.aspx?size=L&username=${peerProperties.Email}`;
peer.imageInitials = `${imageInitials[0] peer.imageInitials = peer.imageInitials && peer.imageInitials.length>0 ? `${imageInitials[0]
.substring(0, 1) .substring(0, 1)
.toUpperCase()}${imageInitials[1].substring(0, 1).toUpperCase()}`; .toUpperCase()}${imageInitials[1] ? imageInitials[1].substring(0, 1).toUpperCase():''}` : '';
peer.text = peerProperties.DisplayName; peer.text = peerProperties.DisplayName;
peer.tertiaryText = peerProperties.Email; peer.tertiaryText = peerProperties.Email;
peer.secondaryText = peerProperties.Title; peer.secondaryText = peerProperties.Title;