From 45daa611f8d78c0e801d106c3b02461173ae4f96 Mon Sep 17 00:00:00 2001
From: jbarcia2019 <80538755+jbarcia2019@users.noreply.github.com>
Date: Sun, 31 May 2026 23:22:58 +0200
Subject: [PATCH] Add task template search
---
web/src/lang/en.js | 1 +
web/src/lang/es.js | 1 +
web/src/views/project/Templates.vue | 47 ++++++++++++++++++++++++++++-
3 files changed, 48 insertions(+), 1 deletion(-)
diff --git a/web/src/lang/en.js b/web/src/lang/en.js
index 467826b7e..7b044c6ba 100644
--- a/web/src/lang/en.js
+++ b/web/src/lang/en.js
@@ -145,6 +145,7 @@ export default {
title: 'Title *',
description: 'Description',
required: 'Required',
+ search: 'Search',
key: '{expr}',
surveyVariables: 'Survey Variables',
addVariable: 'Add variable',
diff --git a/web/src/lang/es.js b/web/src/lang/es.js
index 0125a6d16..968cdd8ba 100644
--- a/web/src/lang/es.js
+++ b/web/src/lang/es.js
@@ -129,6 +129,7 @@ export default {
title: 'Título *',
description: 'Descripción',
required: 'Requerido',
+ search: 'Buscar',
key: '{expr}',
surveyVariables: 'Variables de Encuesta',
addVariable: 'Agregar variable',
diff --git a/web/src/views/project/Templates.vue b/web/src/views/project/Templates.vue
index ea65edb22..5e31495d1 100644
--- a/web/src/views/project/Templates.vue
+++ b/web/src/views/project/Templates.vue
@@ -51,6 +51,18 @@
+
+
@@ -136,7 +148,7 @@
single-expand
show-expand
:headers="filteredHeaders"
- :items="items"
+ :items="searchedItems"
:items-per-page="Number.MAX_VALUE"
:expanded.sync="openedItems"
:style="{
@@ -257,6 +269,10 @@
padding-right: 0 !important;
}
+.templates-search {
+ max-width: 260px;
+}
+
@media #{map-get($display-breakpoints, 'sm-and-down')} {
.templates-table .v-data-table__mobile-row:first-child {
display: none !important;
@@ -311,6 +327,7 @@ export default {
viewTab: null,
apps: null,
itemApp: '',
+ search: '',
};
},
@@ -338,6 +355,15 @@ export default {
&& this.views
&& this.isAppsLoaded;
},
+
+ searchedItems() {
+ const search = (this.search || '').trim().toLowerCase();
+ if (!search) {
+ return this.items;
+ }
+
+ return (this.items || []).filter((item) => this.getTemplateSearchText(item).includes(search));
+ },
},
watch: {
async viewId() {
@@ -479,6 +505,25 @@ export default {
this.newTaskDialog = true;
},
+ getTemplateSearchText(item) {
+ const inventory = this.inventory?.find((x) => x.id === item.inventory_id)?.name || '';
+ const repository = this.repositories?.find((x) => x.id === item.repository_id)?.name || '';
+ const environments = Array.isArray(item.environment_ids)
+ ? item.environment_ids
+ .map((id) => this.environment?.find((x) => x.id === id)?.name || '')
+ .join(' ')
+ : '';
+
+ return [
+ item.name,
+ item.playbook,
+ item.description,
+ inventory,
+ repository,
+ environments,
+ ].filter(Boolean).join(' ').toLowerCase();
+ },
+
getHeaders() {
return [
{