From 7fdf733a64670fceefc3ded35cfa581e1c458179 Mon Sep 17 00:00:00 2001 From: Einav Weiss Keidar Date: Tue, 20 Mar 2018 14:45:40 +0200 Subject: Adding Prettier and fixing up eslint version Issue-ID: SDC-1094 Change-Id: Ie83ad95a03899345dd90235daf0323cbe3bc6afd Signed-off-by: Einav Weiss Keidar --- .../versionsPage/components/PermissionsView.jsx | 141 ++++++++---- .../versionsPage/components/VersionList.jsx | 251 +++++++++++++-------- 2 files changed, 254 insertions(+), 138 deletions(-) (limited to 'openecomp-ui/src/sdc-app/onboarding/versionsPage/components') diff --git a/openecomp-ui/src/sdc-app/onboarding/versionsPage/components/PermissionsView.jsx b/openecomp-ui/src/sdc-app/onboarding/versionsPage/components/PermissionsView.jsx index 26f8450f4c..74d88f0b52 100644 --- a/openecomp-ui/src/sdc-app/onboarding/versionsPage/components/PermissionsView.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/versionsPage/components/PermissionsView.jsx @@ -22,61 +22,108 @@ import Tooltip from 'react-bootstrap/lib/Tooltip.js'; const maxContributors = 6; -function extraUsersTooltip (extraUsers) { - return ( - - {extraUsers.map(extraUser =>
{extraUser.fullName}
)} -
- ); +function extraUsersTooltip(extraUsers) { + return ( + + {extraUsers.map(extraUser => ( +
+ {extraUser.fullName} +
+ ))} +
+ ); } -const User = ({user, isCurrentUser, dataTestId}) => ( - +const User = ({ user, isCurrentUser, dataTestId }) => ( + ); -const Owner = ({owner, isCurrentUser}) => ( -
-
{i18n('Owner')}
- -
+const Owner = ({ owner, isCurrentUser }) => ( +
+
{i18n('Owner')}
+ +
); -const Contributors = ({contributors, owner, currentUser, onManagePermissions, isManual}) => { - let extraUsers = contributors.length - maxContributors; - return ( -
-
{i18n('Contributors')}
- {contributors.slice(0, maxContributors).map(contributor => - - )} - {extraUsers > 0 && - -
{`+${extraUsers}`}
-
- } - {currentUser.userId === owner.userId && !isManual && - - {i18n('Manage Permissions')} - - } -
- ); +const Contributors = ({ + contributors, + owner, + currentUser, + onManagePermissions, + isManual +}) => { + let extraUsers = contributors.length - maxContributors; + return ( +
+
{i18n('Contributors')}
+ {contributors + .slice(0, maxContributors) + .map(contributor => ( + + ))} + {extraUsers > 0 && ( + +
{`+${extraUsers}`}
+
+ )} + {currentUser.userId === owner.userId && + !isManual && ( + + {i18n('Manage Permissions')} + + )} +
+ ); }; -const PermissionsView = ({owner, contributors, currentUser = {}, onManagePermissions, isManual}) => ( -
-
{i18n('Permissions')}
-
-
- - -
-
-
+const PermissionsView = ({ + owner, + contributors, + currentUser = {}, + onManagePermissions, + isManual +}) => ( +
+
+ {i18n('Permissions')} +
+
+
+ + +
+
+
); export default PermissionsView; diff --git a/openecomp-ui/src/sdc-app/onboarding/versionsPage/components/VersionList.jsx b/openecomp-ui/src/sdc-app/onboarding/versionsPage/components/VersionList.jsx index 47255eb9dc..d74805eccc 100644 --- a/openecomp-ui/src/sdc-app/onboarding/versionsPage/components/VersionList.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/versionsPage/components/VersionList.jsx @@ -20,108 +20,177 @@ import Tooltip from 'react-bootstrap/lib/Tooltip.js'; import i18n from 'nfvo-utils/i18n/i18n.js'; import SVGIcon from 'sdc-ui/lib/react/SVGIcon.js'; -const formatTime = (time) => { - if (!time) { return ''; } +const formatTime = time => { + if (!time) { + return ''; + } - const date = new Date(time); - const options = { - year: 'numeric', - month: 'short', - day: 'numeric', - hour: '2-digit', - minute: '2-digit' - }; - const newDate = date.toLocaleTimeString('en-US', options); + const date = new Date(time); + const options = { + year: 'numeric', + month: 'short', + day: 'numeric', + hour: '2-digit', + minute: '2-digit' + }; + const newDate = date.toLocaleTimeString('en-US', options); - return newDate; + return newDate; }; const DescriptionField = ({ className, text, useTooltip }) => { - if (useTooltip) { - return ( -
- {text}}> -
{text}
-
-
- ); - } - return
{text}
; + if (useTooltip) { + return ( +
+ + {text} + + }> +
{text}
+
+
+ ); + } + return
{text}
; }; -const VersionListItem = ({ data, onSelectVersion, onNavigateToVersion, onCreateVersion, isHeader, isSelected, isCollaborator }) => { +const VersionListItem = ({ + data, + onSelectVersion, + onNavigateToVersion, + onCreateVersion, + isHeader, + isSelected, + isCollaborator +}) => { + let { modificationTime, name, status, description, additionalInfo } = data; + const modificationText = !isHeader + ? formatTime(modificationTime) + : i18n('Last Edited On'); - let {modificationTime, name, status, description, additionalInfo} = data; - const modificationText = !isHeader ? formatTime(modificationTime) : i18n('Last Edited On'); - - return ( -
{ - e.stopPropagation(); - onSelectVersion(); - onNavigateToVersion(); - }}> -
{name}
-
{status}
-
{modificationText}
- - - { - isHeader ? -
{i18n('Actions')}
- : -
-
- {e.stopPropagation(); onNavigateToVersion();}} - label={i18n('Go to this Version')} - labelPosition='right' /> -
-
- {!isHeader && isCollaborator && additionalInfo.OptionalCreationMethods.length > 0 && onCreateVersion && - { e.stopPropagation(); onCreateVersion(); }} - label={i18n('Create New Version')} - labelPosition='right' - disabled={!isCollaborator || !onCreateVersion} /> - } -
-
- } -
- ); + return ( +
{ + e.stopPropagation(); + onSelectVersion(); + onNavigateToVersion(); + }}> +
+ {name} +
+
+ {status} +
+
+ {modificationText} +
+ + {isHeader ? ( +
+ {i18n('Actions')} +
+ ) : ( +
+
+ { + e.stopPropagation(); + onNavigateToVersion(); + }} + label={i18n('Go to this Version')} + labelPosition="right" + /> +
+
+ {!isHeader && + isCollaborator && + additionalInfo.OptionalCreationMethods.length > 0 && + onCreateVersion && ( + { + e.stopPropagation(); + onCreateVersion(); + }} + label={i18n('Create New Version')} + labelPosition="right" + disabled={ + !isCollaborator || !onCreateVersion + } + /> + )} +
+
+ )} +
+ ); }; -const VersionList = ({ versions, onSelectVersion, onNavigateToVersion, onCreateVersion, selectedVersion, isCollaborator }) => ( -
- -
- {versions.map(version => - onSelectVersion({version})} - onNavigateToVersion={() => onNavigateToVersion({version})} - onCreateVersion={onCreateVersion ? () => onCreateVersion({version}) : false} - isSelected={selectedVersion === version.id} - isCollaborator={isCollaborator} /> - )} -
-
+const VersionList = ({ + versions, + onSelectVersion, + onNavigateToVersion, + onCreateVersion, + selectedVersion, + isCollaborator +}) => ( +
+ +
+ {versions.map(version => ( + onSelectVersion({ version })} + onNavigateToVersion={() => onNavigateToVersion({ version })} + onCreateVersion={ + onCreateVersion + ? () => onCreateVersion({ version }) + : false + } + isSelected={selectedVersion === version.id} + isCollaborator={isCollaborator} + /> + ))} +
+
); export default VersionList; -- cgit 1.2.3-korg