diff --git a/ee/app/assets/javascripts/ai/duo_agents_platform/graphql/queries/get_agent_flows.query.graphql b/ee/app/assets/javascripts/ai/duo_agents_platform/graphql/queries/get_agent_flows.query.graphql
index 7c1e9338c1144558af7ed6f811859b773f0dbc52..f909f3b2731e2fba8aea1528a081591c04b89cdb 100644
--- a/ee/app/assets/javascripts/ai/duo_agents_platform/graphql/queries/get_agent_flows.query.graphql
+++ b/ee/app/assets/javascripts/ai/duo_agents_platform/graphql/queries/get_agent_flows.query.graphql
@@ -6,7 +6,9 @@ query getAgentFlows(
$before: String
$first: Int
$last: Int
+ $search: String
$sort: DuoWorkflowsWorkflowSort
+ $statusGroup: DuoWorkflowStatusGroup
$type: String
) {
project(fullPath: $projectPath) {
@@ -17,7 +19,9 @@ query getAgentFlows(
after: $after
last: $last
before: $before
+ search: $search
sort: $sort
+ statusGroup: $statusGroup
type: $type
) {
pageInfo {
diff --git a/ee/app/assets/javascripts/ai/duo_agents_platform/graphql/queries/get_user_agent_flow.query.graphql b/ee/app/assets/javascripts/ai/duo_agents_platform/graphql/queries/get_user_agent_flow.query.graphql
index 29887605e22699c529e50db43f840cb717a2f73e..7df2cc564d57c9551e148b12d291ff3513153a53 100644
--- a/ee/app/assets/javascripts/ai/duo_agents_platform/graphql/queries/get_user_agent_flow.query.graphql
+++ b/ee/app/assets/javascripts/ai/duo_agents_platform/graphql/queries/get_user_agent_flow.query.graphql
@@ -6,7 +6,9 @@ query getUserAgentFlows(
$first: Int
$last: Int
$excludeTypes: [String!]
+ $search: String
$sort: DuoWorkflowsWorkflowSort
+ $statusGroup: DuoWorkflowStatusGroup
$type: String
) {
duoWorkflowWorkflows(
@@ -15,7 +17,9 @@ query getUserAgentFlows(
last: $last
before: $before
excludeTypes: $excludeTypes
+ search: $search
sort: $sort
+ statusGroup: $statusGroup
type: $type
) {
pageInfo {
diff --git a/ee/app/assets/javascripts/ai/duo_agents_platform/namespace/project/project_agents_platform_index.vue b/ee/app/assets/javascripts/ai/duo_agents_platform/namespace/project/project_agents_platform_index.vue
index 502e9af02d4333468bb48bbb9214ac48c124f605..741b4d097175a47365342fd3e5492eabdf041b57 100644
--- a/ee/app/assets/javascripts/ai/duo_agents_platform/namespace/project/project_agents_platform_index.vue
+++ b/ee/app/assets/javascripts/ai/duo_agents_platform/namespace/project/project_agents_platform_index.vue
@@ -56,21 +56,10 @@ export default {
},
},
methods: {
- handleSort(sortBy) {
- this.currentSort = sortBy;
-
- this.resetPagination();
- },
- handleFilters(filters) {
+ handleVariablesUpdate({ sort, pagination, filters }) {
+ this.currentSort = sort;
+ this.paginationVariables = pagination;
this.filterVariables = filters;
-
- this.resetPagination();
- },
- handlePagination(paginationVars) {
- this.paginationVariables = paginationVars;
- },
- resetPagination() {
- this.handlePagination(DEFAULT_AGENT_PLATFORM_PAGINATION_VARIABLES);
},
},
};
@@ -82,8 +71,6 @@ export default {
:is-loading-workflows="isLoadingWorkflows"
:workflows="workflows"
:workflows-page-info="workflowsPageInfo"
- @update-sort="handleSort"
- @update-pagination="handlePagination"
- @update-filters="handleFilters"
+ @variables-updated="handleVariablesUpdate"
/>
diff --git a/ee/app/assets/javascripts/ai/duo_agents_platform/namespace/user/user_agents_platform_index.vue b/ee/app/assets/javascripts/ai/duo_agents_platform/namespace/user/user_agents_platform_index.vue
index 8fbb68834b9ca7826694bc12572251ec6c773091..6827814f7d90ab1b67dcde6209df13afc95f4db3 100644
--- a/ee/app/assets/javascripts/ai/duo_agents_platform/namespace/user/user_agents_platform_index.vue
+++ b/ee/app/assets/javascripts/ai/duo_agents_platform/namespace/user/user_agents_platform_index.vue
@@ -56,21 +56,10 @@ export default {
},
},
methods: {
- handleSort(sortBy) {
- this.currentSort = sortBy;
-
- this.resetPagination();
- },
- handleFilters(filters) {
+ handleVariablesUpdate({ sort, pagination, filters }) {
+ this.currentSort = sort;
+ this.paginationVariables = pagination;
this.filterVariables = filters;
-
- this.resetPagination();
- },
- handlePagination(paginationVars) {
- this.paginationVariables = paginationVars;
- },
- resetPagination() {
- this.handlePagination(DEFAULT_AGENT_PLATFORM_PAGINATION_VARIABLES);
},
},
};
@@ -83,8 +72,6 @@ export default {
:workflows="workflows"
:workflows-page-info="workflowsPageInfo"
class="gl-min-w-full"
- @update-sort="handleSort"
- @update-pagination="handlePagination"
- @update-filters="handleFilters"
+ @variables-updated="handleVariablesUpdate"
/>
diff --git a/ee/app/assets/javascripts/ai/duo_agents_platform/pages/index/duo_agents_platform_index.vue b/ee/app/assets/javascripts/ai/duo_agents_platform/pages/index/duo_agents_platform_index.vue
index 4d3dc570c7aeab37acf05dfc51ac694d855a3ba1..5e31a436f83a92be0de87d97a1aa909d66efedb4 100644
--- a/ee/app/assets/javascripts/ai/duo_agents_platform/pages/index/duo_agents_platform_index.vue
+++ b/ee/app/assets/javascripts/ai/duo_agents_platform/pages/index/duo_agents_platform_index.vue
@@ -1,22 +1,21 @@
@@ -157,19 +194,6 @@ export default {
-
- {{
- s__(
- 'DuoAgentsPlatform|Raw text search is not currently supported. Please use the available search tokens.',
- )
- }}
-
{
let wrapper;
@@ -34,7 +30,6 @@ describe('AgentsPlatformIndex', () => {
...provide,
},
});
-
return waitForPromises();
};
@@ -43,7 +38,6 @@ describe('AgentsPlatformIndex', () => {
const findPageHeading = () => wrapper.findComponent(PageHeading);
const findExperimentBadge = () => wrapper.findComponent(GlExperimentBadge);
const findFilteredSearchBar = () => wrapper.findComponent(FilteredSearchBar);
- const findAlert = () => wrapper.findComponent(GlAlert);
afterEach(() => {
jest.clearAllMocks();
@@ -115,6 +109,12 @@ describe('AgentsPlatformIndex', () => {
await createWrapper();
});
+ const expectVariablesUpdatedEvent = (expectedPayload) => {
+ const emittedEvents = wrapper.emitted('variables-updated');
+ expect(emittedEvents).toHaveLength(2);
+ expect(emittedEvents[1]).toEqual([expectedPayload]);
+ };
+
it('renders the filtered search bar with correct props', () => {
expect(findFilteredSearchBar().exists()).toBe(true);
expect(findFilteredSearchBar().props()).toMatchObject({
@@ -144,13 +144,21 @@ describe('AgentsPlatformIndex', () => {
ascending: 'UPDATED_ASC',
},
},
+ {
+ id: 3,
+ title: 'Status',
+ sortDirection: {
+ descending: 'STATUS_DESC',
+ ascending: 'STATUS_ASC',
+ },
+ },
]);
});
it('renders the filtered search bar with filter tokens', () => {
const tokens = findFilteredSearchBar().props('tokens');
- expect(tokens).toHaveLength(1);
+ expect(tokens).toHaveLength(2);
expect(tokens[0]).toMatchObject({
type: 'flow-name',
@@ -162,6 +170,21 @@ describe('AgentsPlatformIndex', () => {
{ value: 'software_development', title: 'Software Development' },
{ value: 'convert_to_gitlab_ci', title: 'Convert to gitlab ci' },
]);
+
+ expect(tokens[1]).toMatchObject({
+ type: 'flow-status-group',
+ title: 'Status Group',
+ icon: 'status-success',
+ unique: true,
+ });
+ expect(tokens[1].options).toEqual([
+ { value: 'ACTIVE', title: 'Active' },
+ { value: 'PAUSED', title: 'Paused' },
+ { value: 'AWAITING_INPUT', title: 'Awaiting Input' },
+ { value: 'COMPLETED', title: 'Completed' },
+ { value: 'FAILED', title: 'Failed' },
+ { value: 'CANCELED', title: 'Canceled' },
+ ]);
});
describe('when hasInitialWorkflows is false', () => {
@@ -175,71 +198,72 @@ describe('AgentsPlatformIndex', () => {
});
describe('when sorting', () => {
- it('emits update-sort event when onSort is triggered', () => {
+ it('emits variables-updated event when onSort is triggered', () => {
findFilteredSearchBar().vm.$emit('onSort', 'UPDATED_DESC');
- expect(wrapper.emitted('update-sort')).toEqual([['UPDATED_DESC']]);
+ expectVariablesUpdatedEvent({
+ sort: 'UPDATED_DESC',
+ pagination: { before: null, after: null, first: 20, last: null },
+ filters: {},
+ });
});
});
describe('when filtering', () => {
describe('with valid flow-name token', () => {
- it('emits update-filters event with processed filter parameters', () => {
+ it('emits variables-updated event with processed filter parameters', () => {
const filters = [{ type: 'flow-name', value: { data: 'convert_to_gitlab_ci' } }];
findFilteredSearchBar().vm.$emit('onFilter', filters);
- expect(wrapper.emitted('update-filters')).toEqual([[{ type: 'convert_to_gitlab_ci' }]]);
+ expectVariablesUpdatedEvent({
+ sort: 'UPDATED_DESC',
+ pagination: { before: null, after: null, first: 20, last: null },
+ filters: { type: 'convert_to_gitlab_ci' },
+ });
});
+ });
- it('hides alert when valid filters are applied', () => {
- const filters = [{ type: 'flow-name', value: { data: 'software_development' } }];
+ describe('with valid flow-status-group token', () => {
+ it('emits variables-updated event with processed filter parameters', () => {
+ const filters = [{ type: 'flow-status-group', value: { data: 'PAUSED' } }];
findFilteredSearchBar().vm.$emit('onFilter', filters);
- expect(findAlert().exists()).toBe(false);
+ expectVariablesUpdatedEvent({
+ sort: 'UPDATED_DESC',
+ pagination: { before: null, after: null, first: 20, last: null },
+ filters: { statusGroup: 'PAUSED' },
+ });
});
});
describe('with unsupported free text search', () => {
- it('shows alert and does not emit update-filters', async () => {
+ it('emits variables-updated event with processed filter parameters', () => {
const filters = [{ type: 'filtered-search-term', value: { data: 'software dev' } }];
findFilteredSearchBar().vm.$emit('onFilter', filters);
- await nextTick();
- expect(findAlert().exists()).toBe(true);
- expect(findAlert().props('variant')).toBe('warning');
- expect(findAlert().text()).toContain('Raw text search is not currently supported');
- expect(wrapper.emitted('update-filters')).toBeUndefined();
+ expectVariablesUpdatedEvent({
+ sort: 'UPDATED_DESC',
+ pagination: { before: null, after: null, first: 20, last: null },
+ filters: { search: 'software dev' },
+ });
});
});
describe('when filters are cleared', () => {
- it('emits update-filters event with empty filters', () => {
+ it('emits variables-updated event with empty filters', () => {
findFilteredSearchBar().vm.$emit('onFilter', []);
- expect(wrapper.emitted('update-filters')).toEqual([[{}]]);
+ expectVariablesUpdatedEvent({
+ sort: 'UPDATED_DESC',
+ pagination: { before: null, after: null, first: 20, last: null },
+ filters: {},
+ });
});
});
});
-
- describe('alert dismissal', () => {
- beforeEach(() => {
- // Trigger alert by using unsupported search
- const filters = [{ type: 'filtered-search-term', value: { data: 'test' } }];
- findFilteredSearchBar().vm.$emit('onFilter', filters);
- });
-
- it('hides alert when dismissed', async () => {
- expect(findAlert().exists()).toBe(true);
-
- findAlert().vm.$emit('dismiss');
- await nextTick();
-
- expect(findAlert().exists()).toBe(false);
- });
- });
});
describe('pagination', () => {
@@ -248,16 +272,20 @@ describe('AgentsPlatformIndex', () => {
});
describe('when next page is requested', () => {
- it('emits update-pagination event with correct parameters', () => {
+ it('emits variables-updated event with correct parameters', () => {
findWorkflowsList().vm.$emit('next-page');
- expect(wrapper.emitted('update-pagination')).toEqual([
+ expect(wrapper.emitted('variables-updated')).toEqual([
[
{
- before: null,
- after: 'asdf',
- first: 20,
- last: null,
+ sort: 'UPDATED_DESC',
+ pagination: {
+ before: null,
+ after: 'asdf',
+ first: 20,
+ last: null,
+ },
+ filters: {},
},
],
]);
@@ -265,16 +293,20 @@ describe('AgentsPlatformIndex', () => {
});
describe('when previous page is requested', () => {
- it('emits update-pagination event with correct parameters', () => {
+ it('emits variables-updated event with correct parameters', () => {
findWorkflowsList().vm.$emit('prev-page');
- expect(wrapper.emitted('update-pagination')).toEqual([
+ expect(wrapper.emitted('variables-updated')).toEqual([
[
{
- after: null,
- before: 'asdf',
- first: null,
- last: 20,
+ sort: 'UPDATED_DESC',
+ pagination: {
+ after: null,
+ before: 'asdf',
+ first: null,
+ last: 20,
+ },
+ filters: {},
},
],
]);
diff --git a/locale/gitlab.pot b/locale/gitlab.pot
index bda25e7094aceeab8293bfa9d38c5ad5bc025f60..f5d7f0748a266ec1817d468ea9a8ed386c8b1df2 100644
--- a/locale/gitlab.pot
+++ b/locale/gitlab.pot
@@ -9940,6 +9940,9 @@ msgstr ""
msgid "Avg"
msgstr ""
+msgid "Awaiting Input"
+msgstr ""
+
msgid "Awaiting user signup"
msgstr ""
@@ -12933,6 +12936,9 @@ msgstr ""
msgid "Cancel, keep project"
msgstr ""
+msgid "Canceled"
+msgstr ""
+
msgid "Canceled deployment to"
msgstr ""
@@ -24953,9 +24959,6 @@ msgstr ""
msgid "DuoAgentsPlatform|Prompt"
msgstr ""
-msgid "DuoAgentsPlatform|Raw text search is not currently supported. Please use the available search tokens."
-msgstr ""
-
msgid "DuoAgentsPlatform|Read file"
msgstr ""
@@ -25001,6 +25004,9 @@ msgstr ""
msgid "DuoAgentsPlatform|Start agent session"
msgstr ""
+msgid "DuoAgentsPlatform|Status Group"
+msgstr ""
+
msgid "DuoAgentsPlatform|The flow trigger could not be created. Try again."
msgstr ""