Skip to content

Commit 7a5a363

Browse files
authored
feat: Add ClusterAttributeScope and ClusterAttributeName to visibility query suggestions (#1094)
* Add ClusterAttributeScope and ClusterAttributeName to visibility query suggestions Signed-off-by: Tim Li <ltim@uber.com>
1 parent 992c152 commit 7a5a363

File tree

3 files changed

+33
-3
lines changed

3 files changed

+33
-3
lines changed

src/route-handlers/get-search-attributes/get-search-attributes.constants.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* System attributes as defined by Cadence.
33
* These are built-in attributes that are automatically indexed by the system.
4-
* https://github.com/cadence-workflow/cadence/blob/b9e01ea9b881daff690434419b253d1d36fc486a/common/definition/indexedKeys.go#L92
4+
* https://github.com/cadence-workflow/cadence/blob/5c79d73b2bd31ae492c84d780b5b4fb7afdc2417/common/definition/indexedKeys.go#L94
55
*/
66
export const SYSTEM_SEARCH_ATTRIBUTES: Set<string> = new Set([
77
'DomainID',
@@ -17,4 +17,6 @@ export const SYSTEM_SEARCH_ATTRIBUTES: Set<string> = new Set([
1717
'IsCron',
1818
'NumClusters',
1919
'UpdateTime',
20+
'ClusterAttributeScope',
21+
'ClusterAttributeName',
2022
]);

src/views/shared/workflows-header/workflows-query-input/helpers/__tests__/get-autocomplete-suggestions.test.ts

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,12 @@ describe('getAutocompleteSuggestions', () => {
2323
const suggestionsAfterSpace = getAutocompleteSuggestions(
2424
'WorkflowID = "test" AND c'
2525
);
26-
expect(suggestionsAfterSpace).toEqual(['CloseTime', 'CloseStatus']);
26+
expect(suggestionsAfterSpace).toEqual([
27+
'CloseTime',
28+
'ClusterAttributeScope',
29+
'ClusterAttributeName',
30+
'CloseStatus',
31+
]);
2732
});
2833

2934
it('suggests logical operators after a complete WorkflowID value', () => {
@@ -67,6 +72,16 @@ describe('getAutocompleteSuggestions', () => {
6772
expect(suggestionsRunID).toEqual(['""']);
6873
});
6974

75+
it('suggests empty quotes after ClusterAttributeScope', () => {
76+
const suggestions = getAutocompleteSuggestions('ClusterAttributeScope =');
77+
expect(suggestions).toEqual(['""']);
78+
});
79+
80+
it('suggests empty quotes after ClusterAttributeName', () => {
81+
const suggestions = getAutocompleteSuggestions('ClusterAttributeName !=');
82+
expect(suggestions).toEqual(['""']);
83+
});
84+
7085
it('suggests status values after CloseStatus', () => {
7186
const suggestions = getAutocompleteSuggestions('CloseStatus =');
7287
expect(suggestions).toEqual(STATUSES);
@@ -105,6 +120,12 @@ describe('getAutocompleteSuggestions', () => {
105120
expect(suggestionsCase).toContain('CloseTime');
106121
});
107122

123+
it('handles partial attribute matching for Cluster attributes', () => {
124+
const suggestions = getAutocompleteSuggestions('Cluster');
125+
expect(suggestions).toContain('ClusterAttributeScope');
126+
expect(suggestions).toContain('ClusterAttributeName');
127+
});
128+
108129
it('suggests logical operators after complete complex query', () => {
109130
const complexQuery =
110131
'WorkflowID = "test" AND StartTime >= "2023-01-01T00:00:00Z"';
@@ -116,6 +137,11 @@ describe('getAutocompleteSuggestions', () => {
116137
const complexQuery =
117138
'WorkflowID = "test" AND StartTime >= "2023-01-01T00:00:00Z" AND c';
118139
const suggestions = getAutocompleteSuggestions(complexQuery);
119-
expect(suggestions).toEqual(['CloseTime', 'CloseStatus']);
140+
expect(suggestions).toEqual([
141+
'CloseTime',
142+
'ClusterAttributeScope',
143+
'ClusterAttributeName',
144+
'CloseStatus',
145+
]);
120146
});
121147
});

src/views/shared/workflows-header/workflows-query-input/workflows-query-input.constants.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ export const ID_ATTRIBUTES = [
1212
'RolloutID',
1313
'RunID',
1414
'TaskList',
15+
'ClusterAttributeScope',
16+
'ClusterAttributeName',
1517
];
1618

1719
export const CLOSE_STATUS_ATTRIBUTE = 'CloseStatus';

0 commit comments

Comments
 (0)