Commit 0c6c39b4 authored by Illya Klymov's avatar Illya Klymov

Merge branch 'djadmin-v-html-service-credentials' into 'master'

Refactor help text in AWS cluster form

See merge request gitlab-org/gitlab!69829
parents 5cb9bcd5 42cb7b42
<script> <script>
import { GlButton, GlFormGroup, GlFormInput, GlIcon, GlLink, GlSprintf, GlAlert } from '@gitlab/ui'; import { GlButton, GlFormGroup, GlFormInput, GlIcon, GlLink, GlSprintf, GlAlert } from '@gitlab/ui';
import { escape } from 'lodash';
import { mapState, mapActions } from 'vuex'; import { mapState, mapActions } from 'vuex';
import { sprintf, s__, __ } from '~/locale'; import { s__, __ } from '~/locale';
import ClipboardButton from '~/vue_shared/components/clipboard_button.vue'; import ClipboardButton from '~/vue_shared/components/clipboard_button.vue';
import { DEFAULT_REGION } from '../constants'; import { DEFAULT_REGION } from '../constants';
...@@ -37,6 +36,9 @@ export default { ...@@ -37,6 +36,9 @@ export default {
regionHelpText: s__( regionHelpText: s__(
'ClusterIntegration|Select the region you want to create the new cluster in. Make sure you have access to this region for your role to be able to authenticate. If no region is selected, we will use %{codeStart}DEFAULT_REGION%{codeEnd}. Learn more about %{linkStart}Regions%{linkEnd}.', 'ClusterIntegration|Select the region you want to create the new cluster in. Make sure you have access to this region for your role to be able to authenticate. If no region is selected, we will use %{codeStart}DEFAULT_REGION%{codeEnd}. Learn more about %{linkStart}Regions%{linkEnd}.',
), ),
accountAndExternalIdsHelpText: s__(
'ClusterIntegration|The Amazon Resource Name (ARN) associated with your role. If you do not have a provisioned role, first create one on %{awsLinkStart}Amazon Web Services %{awsLinkEnd} using the above account and external IDs. %{moreInfoStart}More information%{moreInfoEnd}',
),
regionHelpTextDefaultRegion: DEFAULT_REGION, regionHelpTextDefaultRegion: DEFAULT_REGION,
}, },
data() { data() {
...@@ -55,39 +57,8 @@ export default { ...@@ -55,39 +57,8 @@ export default {
? __('Authenticating') ? __('Authenticating')
: s__('ClusterIntegration|Authenticate with AWS'); : s__('ClusterIntegration|Authenticate with AWS');
}, },
accountAndExternalIdsHelpText() { awsHelpLink() {
const escapedUrl = escape(this.accountAndExternalIdsHelpPath); return 'https://console.aws.amazon.com/iam/home?#roles';
return sprintf(
s__(
'ClusterIntegration|Create a provision role on %{startAwsLink}Amazon Web Services %{externalLinkIcon}%{endLink} using the account and external ID above. %{startMoreInfoLink}More information%{endLink}',
),
{
startAwsLink:
'<a href="https://console.aws.amazon.com/iam/home?#roles" target="_blank" rel="noopener noreferrer">',
startMoreInfoLink: `<a href="${escapedUrl}" target="_blank" rel="noopener noreferrer">`,
externalLinkIcon: this.externalLinkIcon,
endLink: '</a>',
},
false,
);
},
provisionRoleArnHelpText() {
const escapedUrl = escape(this.createRoleArnHelpPath);
return sprintf(
s__(
'ClusterIntegration|The Amazon Resource Name (ARN) associated with your role. If you do not have a provisioned role, first create one on %{startAwsLink}Amazon Web Services %{externalLinkIcon}%{endLink} using the above account and external IDs. %{startMoreInfoLink}More information%{endLink}',
),
{
startAwsLink:
'<a href="https://console.aws.amazon.com/iam/home?#roles" target="_blank" rel="noopener noreferrer">',
startMoreInfoLink: `<a href="${escapedUrl}" target="_blank" rel="noopener noreferrer">`,
externalLinkIcon: this.externalLinkIcon,
endLink: '</a>',
},
false,
);
}, },
}, },
methods: { methods: {
...@@ -141,19 +112,41 @@ export default { ...@@ -141,19 +112,41 @@ export default {
</div> </div>
</div> </div>
<div class="col-12 mb-3 mt-n3"> <div class="col-12 mb-3 mt-n3">
<p <p class="form-text text-muted">
class="form-text text-muted" <gl-sprintf :message="$options.i18n.accountAndExternalIdsHelpText">
v-html="accountAndExternalIdsHelpText /* eslint-disable-line vue/no-v-html */" <template #awsLink="{ content }">
></p> <gl-link :href="awsHelpLink" target="_blank">
{{ content }}
<gl-icon name="external-link" class="gl-vertical-align-middle" />
</gl-link>
</template>
<template #moreInfo="{ content }">
<gl-link :href="accountAndExternalIdsHelpPath" target="_blank">
{{ content }}
</gl-link>
</template>
</gl-sprintf>
</p>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="eks-provision-role-arn">{{ s__('ClusterIntegration|Provision Role ARN') }}</label> <label for="eks-provision-role-arn">{{ s__('ClusterIntegration|Provision Role ARN') }}</label>
<gl-form-input id="eks-provision-role-arn" v-model="roleArn" /> <gl-form-input id="eks-provision-role-arn" v-model="roleArn" />
<p <p class="form-text text-muted">
class="form-text text-muted" <gl-sprintf :message="$options.i18n.accountAndExternalIdsHelpText">
v-html="provisionRoleArnHelpText /* eslint-disable-line vue/no-v-html */" <template #awsLink="{ content }">
></p> <gl-link :href="awsHelpLink" target="_blank">
{{ content }}
<gl-icon name="external-link" class="gl-vertical-align-middle" />
</gl-link>
</template>
<template #moreInfo="{ content }">
<gl-link :href="accountAndExternalIdsHelpPath" target="_blank">
{{ content }}
</gl-link>
</template>
</gl-sprintf>
</p>
</div> </div>
<gl-form-group :label="$options.i18n.regionInputLabel"> <gl-form-group :label="$options.i18n.regionInputLabel">
......
...@@ -7462,9 +7462,6 @@ msgstr "" ...@@ -7462,9 +7462,6 @@ msgstr ""
msgid "ClusterIntegration|Create Kubernetes cluster" msgid "ClusterIntegration|Create Kubernetes cluster"
msgstr "" msgstr ""
msgid "ClusterIntegration|Create a provision role on %{startAwsLink}Amazon Web Services %{externalLinkIcon}%{endLink} using the account and external ID above. %{startMoreInfoLink}More information%{endLink}"
msgstr ""
msgid "ClusterIntegration|Create cluster on" msgid "ClusterIntegration|Create cluster on"
msgstr "" msgstr ""
...@@ -7897,7 +7894,7 @@ msgstr "" ...@@ -7897,7 +7894,7 @@ msgstr ""
msgid "ClusterIntegration|Subnets" msgid "ClusterIntegration|Subnets"
msgstr "" msgstr ""
msgid "ClusterIntegration|The Amazon Resource Name (ARN) associated with your role. If you do not have a provisioned role, first create one on %{startAwsLink}Amazon Web Services %{externalLinkIcon}%{endLink} using the above account and external IDs. %{startMoreInfoLink}More information%{endLink}" msgid "ClusterIntegration|The Amazon Resource Name (ARN) associated with your role. If you do not have a provisioned role, first create one on %{awsLinkStart}Amazon Web Services %{awsLinkEnd} using the above account and external IDs. %{moreInfoStart}More information%{moreInfoEnd}"
msgstr "" msgstr ""
msgid "ClusterIntegration|The Kubernetes certificate used to authenticate to the cluster." msgid "ClusterIntegration|The Kubernetes certificate used to authenticate to the cluster."
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment