Skip to content

Commit

Permalink
Add tag management view
Browse files Browse the repository at this point in the history
Signed-off-by: nscuro <nscuro@protonmail.com>
  • Loading branch information
nscuro committed Jun 26, 2024
1 parent 2905b8c commit 7f52816
Show file tree
Hide file tree
Showing 18 changed files with 364 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/containers/DefaultContainer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@ export default {
icon: 'fa fa-balance-scale',
permission: permissions.VIEW_PORTFOLIO,
},
{
name: 'Tags',
url: '/tags',
icon: 'fa fa-tag',
permission: permissions.VIEW_PORTFOLIO,
},
{
title: true,
name: this.$t('message.global_audit'),
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,7 @@
"password_unauthorized": "Überprüfen Sie die aktuellen Anmeldeinformationen und versuchen Sie es erneut",
"phone": "Telefon",
"policies": "Richtlinien",
"policies_tagged_with": "Richtlinien mit dem Tag {tag}",
"policy_created": "Richtlinie erstellt",
"policy_deleted": "Richtlinie gelöscht",
"policy_management": "Richtlinienverwaltung",
Expand Down Expand Up @@ -707,6 +708,7 @@
"project_vulnerabilities": "Projektschwachstellen",
"projects": "Projekte",
"projects_at_risk": "Gefährdete Projekte",
"projects_tagged_with": "Projekte mit dem Tag {tag}",
"properties": "Eigenschaften",
"property_created": "Eigenschaft erstellt",
"property_deleted": "Eigenschaft gelöscht",
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,7 @@
"password_unauthorized": "Check current login credentials and try again",
"phone": "Phone",
"policies": "Policies",
"policies_tagged_with": "Policies tagged with {tag}",
"policy_created": "Policy created",
"policy_deleted": "Policy deleted",
"policy_management": "Policy Management",
Expand Down Expand Up @@ -707,6 +708,7 @@
"project_vulnerabilities": "Project Vulnerabilities",
"projects": "Projects",
"projects_at_risk": "Projects at Risk",
"projects_tagged_with": "Projects tagged with {tag}",
"properties": "Properties",
"property_created": "Property created",
"property_deleted": "Property deleted",
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,7 @@
"password_unauthorized": "Verifique las credenciales de inicio de sesión actuales e inténtelo nuevamente",
"phone": "Teléfono",
"policies": "Políticas",
"policies_tagged_with": "Políticas etiquetadas con {tag}",
"policy_created": "Política creada",
"policy_deleted": "Política eliminada",
"policy_management": "Gestión de políticas",
Expand Down Expand Up @@ -707,6 +708,7 @@
"project_vulnerabilities": "Vulnerabilidades del proyecto",
"projects": "Proyectos",
"projects_at_risk": "Proyectos en riesgo",
"projects_tagged_with": "Proyectos etiquetados con {tag}",
"properties": "Propiedades",
"property_created": "Propiedad creada",
"property_deleted": "Propiedad eliminada",
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,7 @@
"password_unauthorized": "Vérifiez les informations de connexion actuelles et réessayez",
"phone": "Téléphone",
"policies": "Politiques",
"policies_tagged_with": "Règles marquées avec {tag}",
"policy_created": "Politique créée",
"policy_deleted": "Politique supprimée",
"policy_management": "Gestion des politiques",
Expand Down Expand Up @@ -707,6 +708,7 @@
"project_vulnerabilities": "Vulnérabilités du projet",
"projects": "Projets",
"projects_at_risk": "Projets à risque",
"projects_tagged_with": "Projets marqués avec {tag}",
"properties": "Propriétés",
"property_created": "Propriété créée",
"property_deleted": "Propriété supprimée",
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/locales/hi.json
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,7 @@
"password_unauthorized": "वर्तमान लॉगिन क्रेडेंशियल जांचें और पुनः प्रयास करें",
"phone": "फ़ोन",
"policies": "नीतियों",
"policies_tagged_with": "{tag} के साथ टैग की गईं नीतियां",
"policy_created": "नीति बनाई गई",
"policy_deleted": "नीति हटा दी गई",
"policy_management": "नीति प्रबंधन",
Expand Down Expand Up @@ -707,6 +708,7 @@
"project_vulnerabilities": "परियोजना की कमज़ोरियाँ",
"projects": "परियोजनाओं",
"projects_at_risk": "जोखिम में परियोजनाएँ",
"projects_tagged_with": "{tag} के साथ टैग किए गए प्रोजेक्ट",
"properties": "गुण",
"property_created": "संपत्ति बनाई गई",
"property_deleted": "संपत्ति हटा दी गई",
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/locales/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,7 @@
"password_unauthorized": "Controlla le credenziali di accesso attuali e riprova",
"phone": "Telefono",
"policies": "Politiche",
"policies_tagged_with": "Politiche contrassegnate con {tag}",
"policy_created": "Politica creata",
"policy_deleted": "Politica eliminata",
"policy_management": "Gestione delle politiche",
Expand Down Expand Up @@ -707,6 +708,7 @@
"project_vulnerabilities": "Vulnerabilità del progetto",
"projects": "Progetti",
"projects_at_risk": "Progetti a rischio",
"projects_tagged_with": "Progetti taggati con {tag}",
"properties": "Proprietà",
"property_created": "Proprietà creata",
"property_deleted": "Proprietà eliminata",
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/locales/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,7 @@
"password_unauthorized": "現在のログイン資格情報を確認して、もう一度お試しください",
"phone": "電話",
"policies": "ポリシー",
"policies_tagged_with": "{tag} でタグ付けされたポリシー",
"policy_created": "ポリシーが作成されました",
"policy_deleted": "ポリシーを削除しました",
"policy_management": "ポリシー管理",
Expand Down Expand Up @@ -707,6 +708,7 @@
"project_vulnerabilities": "プロジェクトの脆弱性",
"projects": "プロジェクト",
"projects_at_risk": "リスクのあるプロジェクト",
"projects_tagged_with": "{tag} でタグ付けされたプロジェクト",
"properties": "プロパティ",
"property_created": "プロパティが作成されました",
"property_deleted": "プロパティが削除されました",
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/locales/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,7 @@
"password_unauthorized": "Sprawdź aktualne dane logowania i spróbuj ponownie",
"phone": "Telefon",
"policies": "Zasady",
"policies_tagged_with": "Zasady oznaczone tagiem {tag}",
"policy_created": "Utworzono politykę",
"policy_deleted": "Polityka została usunięta",
"policy_management": "Zarządzanie polityką",
Expand Down Expand Up @@ -707,6 +708,7 @@
"project_vulnerabilities": "Luki w zabezpieczeniach projektu",
"projects": "Projektowanie",
"projects_at_risk": "Projekty zagrożone",
"projects_tagged_with": "Projekty oznaczone tagiem {tag}",
"properties": "Nieruchomości",
"property_created": "Właściwość utworzona",
"property_deleted": "Właściwość usunięta",
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/locales/pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,7 @@
"password_unauthorized": "Verifique as credenciais de login atuais e tente novamente",
"phone": "Telefone",
"policies": "Políticas",
"policies_tagged_with": "Políticas marcadas com {tag}",
"policy_created": "Política criada",
"policy_deleted": "Política excluída",
"policy_management": "Gerenciamento de Políticas",
Expand Down Expand Up @@ -707,6 +708,7 @@
"project_vulnerabilities": "Vulnerabilidades do projeto",
"projects": "Projetos",
"projects_at_risk": "Projetos em risco",
"projects_tagged_with": "Projetos marcados com {tag}",
"properties": "Propriedades",
"property_created": "Propriedade criada",
"property_deleted": "Propriedade excluída",
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/locales/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,7 @@
"password_unauthorized": "Verifique as credenciais de login atuais e tente novamente",
"phone": "Telefone",
"policies": "Políticas",
"policies_tagged_with": "Políticas marcadas com {tag}",
"policy_created": "Política criada",
"policy_deleted": "Política excluída",
"policy_management": "Gerenciamento de Políticas",
Expand Down Expand Up @@ -707,6 +708,7 @@
"project_vulnerabilities": "Vulnerabilidades do projeto",
"projects": "Projetos",
"projects_at_risk": "Projetos em risco",
"projects_tagged_with": "Projetos marcados com {tag}",
"properties": "Propriedades",
"property_created": "Propriedade criada",
"property_deleted": "Propriedade excluída",
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/locales/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,7 @@
"password_unauthorized": "Проверьте текущие учетные данные для входа и повторите попытку.",
"phone": "Телефон",
"policies": "Политика",
"policies_tagged_with": "Политики с тегом {tag}",
"policy_created": "Политика создана",
"policy_deleted": "Политика удалена.",
"policy_management": "Управление политиками",
Expand Down Expand Up @@ -707,6 +708,7 @@
"project_vulnerabilities": "Уязвимости проекта",
"projects": "Проекты",
"projects_at_risk": "Проекты под угрозой",
"projects_tagged_with": "Проекты с тегом {tag}",
"properties": "Характеристики",
"property_created": "Объект создан",
"property_deleted": "Ресурс удален.",
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/locales/uk-UA.json
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,7 @@
"password_unauthorized": "Перевірте поточні облікові дані для входу та повторіть спробу",
"phone": "Телефон",
"policies": "політики",
"policies_tagged_with": "Правила з тегом {tag}",
"policy_created": "Політика створена",
"policy_deleted": "Політику видалено",
"policy_management": "Управління політикою",
Expand Down Expand Up @@ -707,6 +708,7 @@
"project_vulnerabilities": "Уразливості проекту",
"projects": "Проекти",
"projects_at_risk": "Проекти під загрозою",
"projects_tagged_with": "Проекти з тегом {tag}",
"properties": "Властивості",
"property_created": "Власність створена",
"property_deleted": "Власність видалено",
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/locales/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,7 @@
"password_unauthorized": "检查当前登录凭据并重试",
"phone": "电话",
"policies": "策略",
"policies_tagged_with": "带有 {tag} 标记的政策",
"policy_created": "策略已创建",
"policy_deleted": "策略已删除",
"policy_management": "策略管理",
Expand Down Expand Up @@ -707,6 +708,7 @@
"project_vulnerabilities": "项目漏洞",
"projects": "项目",
"projects_at_risk": "面临风险的项目",
"projects_tagged_with": "带有 {tag} 标记的项目",
"properties": "属性",
"property_created": "创建的财产",
"property_deleted": "属性已删除",
Expand Down
12 changes: 12 additions & 0 deletions src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const DefaultContainer = () => import('@/containers/DefaultContainer');
// Views
const Dashboard = () => import('@/views/Dashboard');
const ProjectList = () => import('@/views/portfolio/projects/ProjectList');
const TagList = () => import('@/views/portfolio/tags/TagList.vue');
const ComponentSearch = () =>
import('@/views/portfolio/components/ComponentSearch');
const VulnerabilityList = () =>
Expand Down Expand Up @@ -264,6 +265,17 @@ function configRoutes() {
permission: 'VIEW_PORTFOLIO',
},
},
{
path: 'tags',
name: 'Tags',
component: TagList,
meta: {
title: i18n.t('message.tags'),
i18n: 'message.tags',
sectionPath: '/tags',
permission: 'VIEW_PORTFOLIO',
},
},
{
path: 'licenses',
name: 'Licenses',
Expand Down
136 changes: 136 additions & 0 deletions src/views/portfolio/tags/TagList.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
<template>
<div class="animated fadeIn" v-permission="PERMISSIONS.VIEW_PORTFOLIO">
<portfolio-widget-row :fetch="true" />
<bootstrap-table
ref="table"
:columns="columns"
:data="data"
:options="options"
@on-load-success="this.vueFormatterInit"
>
</bootstrap-table>
</div>
</template>

<script>
import common from '../../../shared/common';
import PortfolioWidgetRow from '../../dashboard/PortfolioWidgetRow';
import xssFilters from 'xss-filters';
import permissionsMixin from '../../../mixins/permissionsMixin';
import routerMixin from '../../../mixins/routerMixin';
import bootstrapTableMixin from '@/mixins/bootstrapTableMixin';
import TaggedPoliciesListModal from '@/views/portfolio/tags/TaggedPoliciesListModal.vue';
import TaggedProjectListModal from '@/views/portfolio/tags/TaggedProjectListModal.vue';
import i18n from '@/i18n';
export default {
mixins: [bootstrapTableMixin, permissionsMixin, routerMixin],
components: {
PortfolioWidgetRow,
},
methods: {
refreshTable: function () {
this.$refs.table.refresh({
url: `${this.$api.BASE_URL}/${this.$api.URL_TAG}`,
silent: true,
});
},
},
data() {
return {
columns: [
{
title: this.$t('message.name'),
field: 'name',
sortable: true,
formatter(value) {
return xssFilters.inHTMLData(common.valueWithDefault(value, ''));
},
},
{
title: this.$t('message.projects'),
field: 'projectCount',
sortable: true,
formatter: (value, row, index) => {
if (value === 0) {
return value;
}
return this.vueFormatter({
i18n,
components: {
TaggedProjectListModal,
},
mixins: [permissionsMixin],
template: `
<div>
<b-link v-b-modal="\`taggedProjectListModal-${index}\`">{{ value }}</b-link>
<tagged-project-list-modal :tag="tagName" :index="index"/>
</div>`,
data() {
return {
index: index,
tagName: row.name,
value: value,
};
},
});
},
},
{
title: this.$t('message.policies'),
field: 'policyCount',
sortable: true,
formatter: (value, row, index) => {
if (value === 0) {
return value;
}
return this.vueFormatter({
i18n,
components: {
TaggedPoliciesListModal,
},
mixins: [permissionsMixin],
template: `
<div>
<b-link v-b-modal="\`taggedPoliciesListModal-${index}\`">{{ value }}</b-link>
<tagged-policies-list-modal :tag="tagName" :index="index"/>
</div>`,
data() {
return {
index: index,
tagName: row.name,
value: value,
};
},
});
},
},
],
data: [],
options: {
search: true,
showColumns: true,
showRefresh: true,
pagination: true,
silentSort: false,
sidePagination: 'server',
queryParamsType: 'pageSize',
pageList: '[10, 25, 50, 100]',
pageSize: 10,
sortName: undefined,
sortOrder: undefined,
searchText: '',
icons: {
refresh: 'fa-refresh',
},
responseHandler: function (res, xhr) {
res.total = xhr.getResponseHeader('X-Total-Count');
return res;
},
url: `${this.$api.BASE_URL}/${this.$api.URL_TAG}`,
},
};
},
};
</script>
Loading

0 comments on commit 7f52816

Please sign in to comment.