From fb59e8c7ccdb58b1a5e23e4a558415575d50f58a Mon Sep 17 00:00:00 2001
From: jbarcia2019 <80538755+jbarcia2019@users.noreply.github.com>
Date: Tue, 2 Jun 2026 21:00:48 +0200
Subject: [PATCH 1/2] 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 d0bc49e3bd..f8759b3176 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 0125a6d166..968cdd8ba1 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 ea65edb22f..5e31495d1b 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 [
{
From 33cd8fb9836770e54c5d272ac0e72ac39ca9f504 Mon Sep 17 00:00:00 2001
From: jbarcia2019 <80538755+jbarcia2019@users.noreply.github.com>
Date: Tue, 2 Jun 2026 21:13:28 +0200
Subject: [PATCH 2/2] feat: enhance template search functionality with resource
name mapping
---
web/src/views/project/Templates.vue | 33 +++++++++++++++++++++++++----
1 file changed, 29 insertions(+), 4 deletions(-)
diff --git a/web/src/views/project/Templates.vue b/web/src/views/project/Templates.vue
index 5e31495d1b..75650bf985 100644
--- a/web/src/views/project/Templates.vue
+++ b/web/src/views/project/Templates.vue
@@ -356,13 +356,34 @@ export default {
&& this.isAppsLoaded;
},
+ inventoryNameById() {
+ return this.getResourceNameMap(this.inventory);
+ },
+
+ repositoryNameById() {
+ return this.getResourceNameMap(this.repositories);
+ },
+
+ environmentNameById() {
+ return this.getResourceNameMap(this.environment);
+ },
+
+ templateSearchIndex() {
+ return (this.items || []).map((item) => ({
+ item,
+ searchText: this.getTemplateSearchText(item),
+ }));
+ },
+
searchedItems() {
const search = (this.search || '').trim().toLowerCase();
if (!search) {
return this.items;
}
- return (this.items || []).filter((item) => this.getTemplateSearchText(item).includes(search));
+ return this.templateSearchIndex
+ .filter(({ searchText }) => searchText.includes(search))
+ .map(({ item }) => item);
},
},
watch: {
@@ -505,12 +526,16 @@ export default {
this.newTaskDialog = true;
},
+ getResourceNameMap(resources) {
+ return new Map((resources || []).map(({ id, name }) => [id, name]));
+ },
+
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 inventory = this.inventoryNameById.get(item.inventory_id) || '';
+ const repository = this.repositoryNameById.get(item.repository_id) || '';
const environments = Array.isArray(item.environment_ids)
? item.environment_ids
- .map((id) => this.environment?.find((x) => x.id === id)?.name || '')
+ .map((id) => this.environmentNameById.get(id) || '')
.join(' ')
: '';