Commit 60b82d46 authored by Alexander Turinske's avatar Alexander Turinske

Add namespace to security orchestration strings

- move i18n strings out of vue template
parent 63bdd672
<script>
import { __ } from '~/locale';
import { s__ } from '~/locale';
export default {
props: {
......@@ -11,7 +11,9 @@ export default {
},
computed: {
statusLabel() {
return this.policy?.enabled ? __('Enabled') : __('Disabled');
return this.policy?.enabled
? s__('SecurityOrchestration|Enabled')
: s__('SecurityOrchestration|Disabled');
},
},
};
......
<script>
import { GlIntersperse } from '@gitlab/ui';
import { n__, s__ } from '~/locale';
import { removeUnnecessaryDashes } from '../../utils';
import { fromYaml, humanizeNetworkPolicy } from '../policy_editor/network_policy/lib';
import PolicyPreview from '../policy_editor/policy_preview.vue';
......@@ -7,6 +8,11 @@ import BasePolicy from './base_policy.vue';
import PolicyInfoRow from './policy_info_row.vue';
export default {
i18n: {
description: s__('SecurityOrchestration|Description'),
network: s__('NetworkPolicies|Network'),
status: s__('SecurityOrchestration|Status'),
},
components: {
GlIntersperse,
BasePolicy,
......@@ -40,34 +46,38 @@ export default {
environments() {
return this.policy.environments?.nodes ?? [];
},
environmentLabel() {
return n__('Environment', 'Environments', this.environments.length);
},
},
};
</script>
<template>
<base-policy :policy="policy">
<template #type>{{ s__('NetworkPolicies|Network') }}</template>
<template #type>{{ $options.i18n.network }}</template>
<template #default="{ statusLabel }">
<div v-if="parsedYaml">
<policy-info-row
v-if="parsedYaml.description"
data-testid="description"
:label="__('Description')"
>{{ parsedYaml.description }}</policy-info-row
:label="$options.i18n.description"
>
{{ parsedYaml.description }}
</policy-info-row>
<policy-info-row :label="__('Status')">{{ statusLabel }}</policy-info-row>
<policy-info-row :label="$options.i18n.status">{{ statusLabel }}</policy-info-row>
<policy-info-row
v-if="environments.length"
data-testid="environments"
:label="s__('SecurityPolicies|Environment(s)')"
:label="environmentLabel"
>
<gl-intersperse>
<span v-for="environment in environments" :key="environment.name">{{
environment.name
}}</span>
<span v-for="environment in environments" :key="environment.name">
{{ environment.name }}
</span>
</gl-intersperse>
</policy-info-row>
</div>
......
<script>
import { GlLink } from '@gitlab/ui';
import { s__ } from '~/locale';
import {
fromYaml,
humanizeActions,
......@@ -9,6 +10,15 @@ import BasePolicy from './base_policy.vue';
import PolicyInfoRow from './policy_info_row.vue';
export default {
i18n: {
action: s__('SecurityOrchestration|Action'),
description: s__('SecurityOrchestration|Description'),
latestScan: s__('SecurityOrchestration|Latest scan'),
rule: s__('SecurityOrchestration|Rule'),
scanExecution: s__('SecurityOrchestration|Scan execution'),
status: s__('SecurityOrchestration|Status'),
viewResults: s__('SecurityOrchestration|view results'),
},
components: {
GlLink,
BasePolicy,
......@@ -40,38 +50,38 @@ export default {
<template>
<base-policy :policy="policy">
<template #type>{{ s__('SecurityOrchestration|Scan execution') }}</template>
<template #type>{{ $options.i18n.scanExecution }}</template>
<template #default="{ statusLabel }">
<div v-if="parsedYaml">
<policy-info-row
v-if="parsedYaml.description"
data-testid="policy-description"
:label="s__('SecurityOrchestration|Description')"
:label="$options.i18n.description"
>
{{ parsedYaml.description }}
</policy-info-row>
<policy-info-row data-testid="policy-rules" :label="s__('SecurityOrchestration|Rule')">
<policy-info-row data-testid="policy-rules" :label="$options.i18n.rule">
<p v-for="rule in humanizedRules" :key="rule">{{ rule }}</p>
</policy-info-row>
<policy-info-row data-testid="policy-actions" :label="s__('SecurityOrchestration|Action')">
<policy-info-row data-testid="policy-actions" :label="$options.i18n.action">
<p v-for="action in humanizedActions" :key="action">{{ action }}</p>
</policy-info-row>
<policy-info-row :label="__('Status')">
<policy-info-row :label="$options.i18n.status">
{{ statusLabel }}
</policy-info-row>
<policy-info-row
v-if="policy.latestScan"
data-testid="policy-latest-scan"
:label="s__('SecurityOrchestration|Latest scan')"
:label="$options.i18n.latestScan"
>
{{ policy.latestScan.date }}
<gl-link :href="policy.latestScan.pipelineUrl">
{{ s__('SecurityOrchestration|view results') }}
{{ $options.i18n.viewResults }}
</gl-link></policy-info-row
>
</div>
......
......@@ -19,7 +19,9 @@ exports[`CiliumNetworkPolicy component supported YAML renders policy preview tab
data-testid="description"
label="Description"
>
test description
test description
</policy-info-row-stub>
<policy-info-row-stub
......
......@@ -95,7 +95,8 @@ describe('CiliumNetworkPolicy component', () => {
},
});
expect(findEnvironments().exists()).toBe(true);
expect(findEnvironments().text()).toBe('production, local');
expect(findEnvironments().text()).toContain('production');
expect(findEnvironments().text()).toContain('local');
});
it("does not render environments row if there aren't any", () => {
......
......@@ -12890,7 +12890,9 @@ msgid "Enterprise"
msgstr ""
msgid "Environment"
msgstr ""
msgid_plural "Environments"
msgstr[0] ""
msgstr[1] ""
msgid "Environment does not have deployments"
msgstr ""
......@@ -30239,12 +30241,18 @@ msgstr ""
msgid "SecurityOrchestration|Description"
msgstr ""
msgid "SecurityOrchestration|Disabled"
msgstr ""
msgid "SecurityOrchestration|Edit policy"
msgstr ""
msgid "SecurityOrchestration|Edit policy project"
msgstr ""
msgid "SecurityOrchestration|Enabled"
msgstr ""
msgid "SecurityOrchestration|Enforce security for this project. %{linkStart}More information.%{linkEnd}"
msgstr ""
......@@ -30314,6 +30322,9 @@ msgstr ""
msgid "SecurityOrchestration|Sorry, your filter produced no results."
msgstr ""
msgid "SecurityOrchestration|Status"
msgstr ""
msgid "SecurityOrchestration|There was a problem creating the new security policy"
msgstr ""
......
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