diff --git a/packages/components/src/components/Trigger/Trigger.test.jsx b/packages/components/src/components/Trigger/Trigger.test.jsx
index 170b65b40..eff489ef2 100644
--- a/packages/components/src/components/Trigger/Trigger.test.jsx
+++ b/packages/components/src/components/Trigger/Trigger.test.jsx
@@ -1,5 +1,5 @@
/*
-Copyright 2019-2023 The Tekton Authors
+Copyright 2019-2024 The Tekton Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
@@ -284,7 +284,7 @@ describe('Trigger', () => {
expect(queryByText(/TriggerBindings/i)).toBeFalsy();
});
- it('handles embedded template spec', () => {
+ it('handles embedded template spec - resourcetemplates', () => {
const props = {
namespace: 'tekton-pipelines',
trigger: {
@@ -314,6 +314,36 @@ describe('Trigger', () => {
expect(getByText(/hello there/)).toBeTruthy();
});
+ it('handles embedded template spec - resourceTemplates', () => {
+ const props = {
+ namespace: 'tekton-pipelines',
+ trigger: {
+ ...fakeTrigger,
+ template: {
+ spec: {
+ params: [{ name: 'foo' }],
+ resourceTemplates: [
+ {
+ apiVersion: 'tekton.dev/v1beta1',
+ kind: 'TaskRun',
+ metadata: {
+ generateName: 'pr-run-'
+ },
+ spec: {
+ taskSpec: {
+ steps: [{ image: 'ubuntu', script: 'echo "hello there"' }]
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ };
+ const { getByText } = renderWithRouter();
+ expect(getByText(/hello there/)).toBeTruthy();
+ });
+
it('handles ClusterInterceptor', () => {
const clusterInterceptorName = 'fake_clusterInterceptorName';
const props = {
diff --git a/src/containers/TriggerTemplate/TriggerTemplate.jsx b/src/containers/TriggerTemplate/TriggerTemplate.jsx
index fff9df9da..212857bf3 100644
--- a/src/containers/TriggerTemplate/TriggerTemplate.jsx
+++ b/src/containers/TriggerTemplate/TriggerTemplate.jsx
@@ -1,5 +1,5 @@
/*
-Copyright 2019-2023 The Tekton Authors
+Copyright 2019-2024 The Tekton Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
@@ -73,7 +73,12 @@ export /* istanbul ignore next */ function TriggerTemplateContainer() {
return null;
}
- const { params, resourcetemplates } = triggerTemplate.spec;
+ const {
+ params,
+ resourceTemplates: newResourceTemplates,
+ resourcetemplates: oldResourceTemplates
+ } = triggerTemplate.spec;
+ const resourceTemplates = oldResourceTemplates || newResourceTemplates;
const headersForParameters = [
{
@@ -130,12 +135,12 @@ export /* istanbul ignore next */ function TriggerTemplateContainer() {
emptyTextAllNamespaces={emptyTextMessage}
emptyTextSelectedNamespace={emptyTextMessage}
/>
- {resourcetemplates && (
+ {resourceTemplates && (
// This is a very customised expandable table so intentionally not the one used elsewhere
// although it should look the same
({
+ rows={resourceTemplates.map((item, index) => ({
id: `${index}|${
item.metadata.name || item.metadata.generateName
}`,
@@ -191,9 +196,7 @@ export /* istanbul ignore next */ function TriggerTemplateContainer() {
{row.isExpanded && (
diff --git a/src/containers/TriggerTemplate/TriggerTemplate.test.jsx b/src/containers/TriggerTemplate/TriggerTemplate.test.jsx
index ead14502c..3c46551c0 100644
--- a/src/containers/TriggerTemplate/TriggerTemplate.test.jsx
+++ b/src/containers/TriggerTemplate/TriggerTemplate.test.jsx
@@ -1,5 +1,5 @@
/*
-Copyright 2019-2023 The Tekton Authors
+Copyright 2019-2024 The Tekton Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
@@ -115,7 +115,7 @@ const fakeTriggerTemplateWithLabels = {
},
{ description: 'The Content-Type of the event', name: 'contenttype' }
],
- resourcetemplates: [
+ resourceTemplates: [
resourceTemplate1Details,
{
apiVersion: 'tekton.dev/v1alpha1',