forked from gitlabhq/gitlabhq
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add latest changes from gitlab-org/gitlab@master
- Loading branch information
GitLab Bot
committed
Sep 2, 2020
1 parent
4b9ace6
commit 4fa04f7
Showing
131 changed files
with
1,699 additions
and
610 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
12dcff902c9a2178fa6f4992d9d562ad9b422dd2 | ||
12d115c50517935dc8e7e2e1248aa450bf00710e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
135 changes: 96 additions & 39 deletions
135
app/assets/javascripts/issuables_list/service_desk_helper.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,111 @@ | ||
import { __ } from '~/locale'; | ||
|
||
/** | ||
* Generates empty state messages for Service Desk issues list. | ||
* | ||
* @param {emptyStateMeta} emptyStateMeta - Meta data used to generate empty state messages | ||
* @returns {Object} Object containing empty state messages generated using the meta data. | ||
*/ | ||
export function generateMessages(emptyStateMeta) { | ||
const { | ||
svgPath, | ||
serviceDeskHelpPage, | ||
serviceDeskAddress, | ||
editProjectPage, | ||
incomingEmailHelpPage, | ||
} = emptyStateMeta; | ||
|
||
const serviceDeskSupportedTitle = __( | ||
'Use Service Desk to connect with your users (e.g. to offer customer support) through email right inside GitLab', | ||
); | ||
|
||
const serviceDeskSupportedMessage = __( | ||
'Those emails automatically become issues (with the comments becoming the email conversation) listed here.', | ||
); | ||
|
||
const commonDescription = ` | ||
<span>${serviceDeskSupportedMessage}</span> | ||
<a href="${serviceDeskHelpPage}">${__('Read more')}</a>`; | ||
|
||
return { | ||
serviceDeskEnabledAndCanEditProjectSettings: { | ||
title: serviceDeskSupportedTitle, | ||
svgPath, | ||
description: `<p>${__('Have your users email')} | ||
<code>${serviceDeskAddress}</code> | ||
</p> | ||
${commonDescription}`, | ||
}, | ||
serviceDeskEnabledAndCannotEditProjectSettings: { | ||
title: serviceDeskSupportedTitle, | ||
svgPath, | ||
description: commonDescription, | ||
}, | ||
serviceDeskDisabledAndCanEditProjectSettings: { | ||
title: serviceDeskSupportedTitle, | ||
svgPath, | ||
description: commonDescription, | ||
primaryLink: editProjectPage, | ||
primaryText: __('Turn on Service Desk'), | ||
}, | ||
serviceDeskDisabledAndCannotEditProjectSettings: { | ||
title: serviceDeskSupportedTitle, | ||
svgPath, | ||
description: commonDescription, | ||
}, | ||
serviceDeskIsNotSupported: { | ||
title: __('Service Desk is not supported'), | ||
svgPath, | ||
description: __( | ||
'In order to enable Service Desk for your instance, you must first set up incoming email.', | ||
), | ||
primaryLink: incomingEmailHelpPage, | ||
primaryText: __('More information'), | ||
}, | ||
serviceDeskIsNotEnabled: { | ||
title: __('Service Desk is not enabled'), | ||
svgPath, | ||
description: __( | ||
'For help setting up the Service Desk for your instance, please contact an administrator.', | ||
), | ||
}, | ||
}; | ||
} | ||
|
||
/** | ||
* Returns the attributes used for gl-empty-state in the Service Desk issues list. | ||
* | ||
* @param {Object} emptyStateMeta - Meta data used to generate empty state messages | ||
* @returns {Object} | ||
*/ | ||
export function emptyStateHelper(emptyStateMeta) { | ||
const { isServiceDeskSupported, svgPath, serviceDeskHelpPage } = emptyStateMeta; | ||
const messages = generateMessages(emptyStateMeta); | ||
|
||
const { isServiceDeskSupported, canEditProjectSettings, isServiceDeskEnabled } = emptyStateMeta; | ||
|
||
if (isServiceDeskSupported) { | ||
const title = __( | ||
'Use Service Desk to connect with your users (e.g. to offer customer support) through email right inside GitLab', | ||
); | ||
const commonMessage = __( | ||
'Those emails automatically become issues (with the comments becoming the email conversation) listed here.', | ||
); | ||
const commonDescription = ` | ||
<span>${commonMessage}</span> | ||
<a href="${serviceDeskHelpPage}">${__('Read more')}</a>`; | ||
|
||
if (emptyStateMeta.canEditProjectSettings && emptyStateMeta.isServiceDeskEnabled) { | ||
return { | ||
title, | ||
svgPath, | ||
description: `<p>${__('Have your users email')} <code>${ | ||
emptyStateMeta.serviceDeskAddress | ||
}</code></p> ${commonDescription}`, | ||
}; | ||
if (isServiceDeskEnabled && canEditProjectSettings) { | ||
return messages.serviceDeskEnabledAndCanEditProjectSettings; | ||
} | ||
|
||
if (emptyStateMeta.canEditProjectSettings && !emptyStateMeta.isServiceDeskEnabled) { | ||
return { | ||
title, | ||
svgPath, | ||
description: commonDescription, | ||
primaryLink: emptyStateMeta.editProjectPage, | ||
primaryText: __('Turn on Service Desk'), | ||
}; | ||
if (isServiceDeskEnabled && !canEditProjectSettings) { | ||
return messages.serviceDeskEnabledAndCannotEditProjectSettings; | ||
} | ||
|
||
return { | ||
title, | ||
svgPath, | ||
description: commonDescription, | ||
}; | ||
// !isServiceDeskEnabled && canEditProjectSettings | ||
if (canEditProjectSettings) { | ||
return messages.serviceDeskDisabledAndCanEditProjectSettings; | ||
} | ||
|
||
// !isServiceDeskEnabled && !canEditProjectSettings | ||
return messages.serviceDeskDisabledAndCannotEditProjectSettings; | ||
} | ||
|
||
return { | ||
title: __('Service Desk is enabled but not yet active'), | ||
svgPath, | ||
description: __('You must set up incoming email before it becomes active.'), | ||
primaryLink: emptyStateMeta.incomingEmailHelpPage, | ||
primaryText: __('More information'), | ||
}; | ||
// !serviceDeskSupported && canEditProjectSettings | ||
if (canEditProjectSettings) { | ||
return messages.serviceDeskIsNotSupported; | ||
} | ||
|
||
// !serviceDeskSupported && !canEditProjectSettings | ||
return messages.serviceDeskIsNotEnabled; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.