Skip to content

Commit

Permalink
* Add possibility to limit policites to latest project versions
Browse files Browse the repository at this point in the history
* Add translation

Signed-off-by: Ralf King <[email protected]>
  • Loading branch information
rkg-mm committed Sep 27, 2024
1 parent 697d2e9 commit 8d6fbce
Show file tree
Hide file tree
Showing 14 changed files with 85 additions and 44 deletions.
5 changes: 4 additions & 1 deletion src/i18n/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,10 @@
"weakness": "Schwäche",
"will_not_fix": "Wird nicht repariert",
"workaround_available": "Problemumgehung verfügbar",
"x_trust_boundary": "Vertrauensgrenzen überschreiten"
"x_trust_boundary": "Vertrauensgrenzen überschreiten",
"latest": "Aktuellste",
"policy_is_only_for_latest_project_version": "Auf als aktuellste gekennzeichnete Projektversionen limitieren",
"project_is_latest": "Ist aktuellste Version"
},
"operator": {
"contains_all": "enthält alle",
Expand Down
1 change: 1 addition & 0 deletions src/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -694,6 +694,7 @@
"policies_tagged_with": "Policies tagged with {tag}",
"policy_created": "Policy created",
"policy_deleted": "Policy deleted",
"policy_is_only_for_latest_project_version": "Limit to project versions marked as latest",
"policy_management": "Policy Management",
"policy_name": "Policy Name",
"policy_violations": "Policy Violations",
Expand Down
5 changes: 4 additions & 1 deletion src/i18n/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,10 @@
"weakness": "Debilidad",
"will_not_fix": "No se reparara",
"workaround_available": "Solución alternativa disponible",
"x_trust_boundary": "Cruzar el límite de confianza"
"x_trust_boundary": "Cruzar el límite de confianza",
"latest": "El último",
"policy_is_only_for_latest_project_version": "Limitar a las versiones del proyecto marcadas como más recientes",
"project_is_latest": "es la ultima version"
},
"operator": {
"contains_all": "contiene todo",
Expand Down
5 changes: 4 additions & 1 deletion src/i18n/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,10 @@
"weakness": "Faiblesse",
"will_not_fix": "Ne sera pas corrigée",
"workaround_available": "Solution de contournement disponible",
"x_trust_boundary": "Limte de confiance mutuelle"
"x_trust_boundary": "Limte de confiance mutuelle",
"latest": "Dernier",
"policy_is_only_for_latest_project_version": "Limité aux versions de projet marquées comme les plus récentes",
"project_is_latest": "Est la dernière version"
},
"operator": {
"contains_all": "contient tous",
Expand Down
5 changes: 4 additions & 1 deletion src/i18n/locales/hi.json
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,10 @@
"weakness": "कमजोरी",
"will_not_fix": "ठीक नहीं होगा",
"workaround_available": "वैकल्पिक उपाय उपलब्ध है",
"x_trust_boundary": "क्रॉस ट्रस्ट सीमा"
"x_trust_boundary": "क्रॉस ट्रस्ट सीमा",
"latest": "नवीनतम",
"policy_is_only_for_latest_project_version": "नवीनतम के रूप में चिह्नित प्रोजेक्ट संस्करणों तक सीमित रहें",
"project_is_latest": "नवीनतम संस्करण है"
},
"operator": {
"contains_all": "इसमें सभी शामिल हैं",
Expand Down
5 changes: 4 additions & 1 deletion src/i18n/locales/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,10 @@
"weakness": "Debolezza",
"will_not_fix": "Non risolverà",
"workaround_available": "Soluzione disponibile",
"x_trust_boundary": "Confine di fiducia incrociata"
"x_trust_boundary": "Confine di fiducia incrociata",
"latest": "Ultimo",
"policy_is_only_for_latest_project_version": "Limita alle versioni del progetto contrassegnate come più recenti",
"project_is_latest": "È l'ultima versione"
},
"operator": {
"contains_all": "contiene tutto",
Expand Down
5 changes: 4 additions & 1 deletion src/i18n/locales/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,10 @@
"weakness": "弱点",
"will_not_fix": "修正しない",
"workaround_available": "回避策あり",
"x_trust_boundary": "信頼境界を越える"
"x_trust_boundary": "信頼境界を越える",
"latest": "最新",
"policy_is_only_for_latest_project_version": "最新としてマークされたプロジェクト バージョンに制限する",
"project_is_latest": "最新バージョンです"
},
"operator": {
"contains_all": "すべてを含む",
Expand Down
5 changes: 4 additions & 1 deletion src/i18n/locales/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,10 @@
"weakness": "Słabość",
"will_not_fix": "Nie naprawi",
"workaround_available": "Dostępne obejście",
"x_trust_boundary": "Granica zaufania krzyżowego"
"x_trust_boundary": "Granica zaufania krzyżowego",
"latest": "Najnowszy",
"policy_is_only_for_latest_project_version": "Ogranicz do wersji projektu oznaczonych jako najnowsze",
"project_is_latest": "Jest najnowszą wersją"
},
"operator": {
"contains_all": "zawiera wszystko",
Expand Down
5 changes: 4 additions & 1 deletion src/i18n/locales/pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,10 @@
"weakness": "Fraqueza",
"will_not_fix": "Não irá corrigir",
"workaround_available": "Solução alternativa disponível",
"x_trust_boundary": "Limite de confiança cruzada"
"x_trust_boundary": "Limite de confiança cruzada",
"latest": "Mais recente",
"policy_is_only_for_latest_project_version": "Limitar às versões do projeto marcadas como mais recentes",
"project_is_latest": "É a versão mais recente"
},
"operator": {
"contains_all": "contém tudo",
Expand Down
5 changes: 4 additions & 1 deletion src/i18n/locales/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,10 @@
"weakness": "Fraqueza",
"will_not_fix": "Não irá corrigir",
"workaround_available": "Solução alternativa disponível",
"x_trust_boundary": "Limite de confiança cruzada"
"x_trust_boundary": "Limite de confiança cruzada",
"latest": "Mais recente",
"policy_is_only_for_latest_project_version": "Limitar às versões do projeto marcadas como mais recentes",
"project_is_latest": "É a versão mais recente"
},
"operator": {
"contains_all": "contém tudo",
Expand Down
5 changes: 4 additions & 1 deletion src/i18n/locales/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,10 @@
"weakness": "Слабость",
"will_not_fix": "Не будет исправлено",
"workaround_available": "Доступное решение",
"x_trust_boundary": "Пересечение границы доверия"
"x_trust_boundary": "Пересечение границы доверия",
"latest": "Последний",
"policy_is_only_for_latest_project_version": "Ограничить версии проекта, помеченные как последние.",
"project_is_latest": "Последняя версия"
},
"operator": {
"contains_all": "содержит все",
Expand Down
5 changes: 4 additions & 1 deletion src/i18n/locales/uk-UA.json
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,10 @@
"weakness": "Слабкість",
"will_not_fix": "Не виправить",
"workaround_available": "Доступний обхідний шлях",
"x_trust_boundary": "Перетнути кордон довіри"
"x_trust_boundary": "Перетнути кордон довіри",
"latest": "Останній",
"policy_is_only_for_latest_project_version": "Обмеження версіями проекту, позначеними як останні",
"project_is_latest": "Остання версія"
},
"operator": {
"contains_all": "містить усе",
Expand Down
5 changes: 4 additions & 1 deletion src/i18n/locales/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,10 @@
"weakness": "弱点",
"will_not_fix": "不会修复",
"workaround_available": "有解决方法",
"x_trust_boundary": "跨越信任边界"
"x_trust_boundary": "跨越信任边界",
"latest": "最新的",
"policy_is_only_for_latest_project_version": "限制标记为最新的项目版本",
"project_is_latest": "是最新版本"
},
"operator": {
"contains_all": "包含全部",
Expand Down
68 changes: 36 additions & 32 deletions src/views/policy/PolicyList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,12 @@ import PolicyCondition from './PolicyCondition';
import BToggleableDisplayButton from '@/views/components/BToggleableDisplayButton';
import SelectProjectModal from '@/views/portfolio/projects/SelectProjectModal';
import SelectTagModal from '@/views/portfolio/tags/SelectTagModal';
import { Switch as cSwitch } from '@coreui/vue';
import BInputGroupFormSwitch from "@/forms/BInputGroupFormSwitch.vue";
export default {
mixins: [permissionsMixin, bootstrapTableMixin, routerMixin],
components: {
BInputGroupFormSwitch,
CreatePolicyModal,
},
mounted() {
Expand Down Expand Up @@ -152,8 +153,22 @@ export default {
</div>
</b-form-group>
<div v-if="limitToVisible === true" style="margin-bottom: 1.5rem">
<c-switch id="isNotifyChildrenEnabled" color="primary" v-model="includeChildren" label v-bind="labelIcon"/>
{{ $t('admin.include_children') }}
<b-row>
<b-col cols="auto">
<b-input-group-form-switch
id="isNotifyChildrenEnabled"
:label="$t('admin.include_children')"
v-model="includeChildren"
/>
</b-col>
<b-col>
<b-input-group-form-switch
id="isOnlyForLatestProjectVersion"
:label="$t('message.policy_is_only_for_latest_project_version')"
v-model="onlyForLatestProjectVersion"
/>
</b-col>
</b-row>
</div>
<b-form-group v-if="limitToVisible === true" id="tagLimitsList" :label="this.$t('admin.limit_to_tags')">
<div class="list-group">
Expand Down Expand Up @@ -183,7 +198,7 @@ export default {
SelectProjectModal,
SelectTagModal,
PolicyCondition,
cSwitch,
BInputGroupFormSwitch,
},
data() {
return {
Expand All @@ -205,10 +220,7 @@ export default {
limitToVisible: false,
tags: row.tags,
includeChildren: row.includeChildren,
labelIcon: {
dataOn: '\u2713',
dataOff: '\u2715',
},
onlyForLatestProjectVersion: row.onlyForLatestProjectVersion,
};
},
methods: {
Expand Down Expand Up @@ -243,21 +255,26 @@ export default {
},
updatePolicy: function () {
let url = `${this.$api.BASE_URL}/${this.$api.URL_POLICY}`;
let refreshTableRow = (this.policy.uuid === null || this.name !== this.policy.name);
this.axios
.post(url, {
uuid: this.policy.uuid,
name: this.name,
operator: this.operator,
violationState: this.violationState,
includeChildren: this.includeChildren,
onlyForLatestProjectVersion: this.onlyForLatestProjectVersion,
})
.then((response) => {
this.policy = response.data;
EventBus.$emit(
'policyManagement:policies:rowUpdate',
index,
this.policy,
);
// prevent that "limit to" details are hidden after updates where table does not need to refresh
if(refreshTableRow) {
this.policy = response.data;
EventBus.$emit(
'policyManagement:policies:rowUpdate',
index,
this.policy,
);
}
this.$toastr.s(this.$t('message.updated'));
})
.catch((error) => {
Expand Down Expand Up @@ -286,6 +303,7 @@ export default {
this.violationState = policy.violationState;
this.conditions = policy.policyConditions;
this.includeChildren = policy.includeChildren;
this.onlyForLatestProjectVersion = policy.onlyForLatestProjectVersion;
},
deleteProjectLimiter: function (projectUuid) {
let url = `${this.$api.BASE_URL}/${this.$api.URL_POLICY}/${this.policy.uuid}/project/${projectUuid}`;
Expand Down Expand Up @@ -366,23 +384,6 @@ export default {
this.$toastr.s(this.$t('message.updated'));
});
},
updateIncludeChildren: function () {
let url = `${this.$api.BASE_URL}/${this.$api.URL_POLICY}`;
this.axios
.post(url, {
uuid: this.policy.uuid,
name: this.name,
operator: this.operator,
violationState: this.violationState,
includeChildren: this.includeChildren,
})
.then((response) => {
this.$toastr.s(this.$t('message.updated'));
})
.catch((error) => {
this.$toastr.w(this.$t('condition.unsuccessful_action'));
});
},
},
watch: {
operator() {
Expand All @@ -392,7 +393,10 @@ export default {
this.updatePolicy();
},
includeChildren() {
this.updateIncludeChildren();
this.updatePolicy();
},
onlyForLatestProjectVersion() {
this.updatePolicy();
},
},
});
Expand Down

0 comments on commit 8d6fbce

Please sign in to comment.