@parca/profile 0.19.62 → 0.19.64
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist/MatchersInput/SuggestionsList.d.ts +2 -1
- package/dist/MatchersInput/SuggestionsList.d.ts.map +1 -1
- package/dist/MatchersInput/SuggestionsList.js +42 -17
- package/dist/MatchersInput/index.d.ts +1 -0
- package/dist/MatchersInput/index.d.ts.map +1 -1
- package/dist/MatchersInput/index.js +12 -4
- package/dist/SimpleMatchers/Select.d.ts +2 -3
- package/dist/SimpleMatchers/Select.d.ts.map +1 -1
- package/dist/SimpleMatchers/Select.js +12 -11
- package/dist/SimpleMatchers/index.d.ts.map +1 -1
- package/dist/SimpleMatchers/index.js +4 -3
- package/dist/contexts/MatchersInputLabelsContext.d.ts +1 -0
- package/dist/contexts/MatchersInputLabelsContext.d.ts.map +1 -1
- package/dist/contexts/MatchersInputLabelsContext.js +3 -1
- package/dist/contexts/SimpleMatchersLabelContext.d.ts +2 -1
- package/dist/contexts/SimpleMatchersLabelContext.d.ts.map +1 -1
- package/dist/contexts/SimpleMatchersLabelContext.js +15 -5
- package/dist/styles.css +1 -1
- package/package.json +2 -2
- package/src/MatchersInput/SuggestionsList.tsx +109 -39
- package/src/MatchersInput/index.tsx +18 -3
- package/src/SimpleMatchers/Select.tsx +54 -48
- package/src/SimpleMatchers/index.tsx +9 -3
- package/src/contexts/MatchersInputLabelsContext.tsx +8 -6
- package/src/contexts/SimpleMatchersLabelContext.tsx +36 -16
|
@@ -172,6 +172,7 @@ const SimpleMatchers = ({
|
|
|
172
172
|
},
|
|
173
173
|
{meta: metadata}
|
|
174
174
|
).response;
|
|
175
|
+
console.log('Fetched label values:', response.labelValues);
|
|
175
176
|
const sanitizedValues = sanitizeLabelValue(response.labelValues);
|
|
176
177
|
return sanitizedValues;
|
|
177
178
|
}
|
|
@@ -203,7 +204,12 @@ const SimpleMatchers = ({
|
|
|
203
204
|
[setMatchersString]
|
|
204
205
|
);
|
|
205
206
|
|
|
206
|
-
const {
|
|
207
|
+
const {
|
|
208
|
+
labelNameOptions,
|
|
209
|
+
isLoading: labelNamesLoading,
|
|
210
|
+
refetchLabelValues,
|
|
211
|
+
refetchLabelNames,
|
|
212
|
+
} = useLabels();
|
|
207
213
|
|
|
208
214
|
// Helper to ensure selected label name is in the options (for page load before API returns)
|
|
209
215
|
const getLabelNameOptionsWithSelected = useCallback(
|
|
@@ -451,6 +457,7 @@ const SimpleMatchers = ({
|
|
|
451
457
|
loading={labelNamesLoading}
|
|
452
458
|
searchable={true}
|
|
453
459
|
{...testId(TEST_IDS.LABEL_NAME_SELECT)}
|
|
460
|
+
refetchValues={refetchLabelNames}
|
|
454
461
|
/>
|
|
455
462
|
<Select
|
|
456
463
|
items={operatorOptions}
|
|
@@ -478,9 +485,8 @@ const SimpleMatchers = ({
|
|
|
478
485
|
onButtonClick={() => handleLabelValueClick(index)}
|
|
479
486
|
editable={isRowRegex(row)}
|
|
480
487
|
{...testId(TEST_IDS.LABEL_VALUE_SELECT)}
|
|
481
|
-
|
|
488
|
+
refetchValues={() => refetchLabelValues(row.labelName)}
|
|
482
489
|
showLoadingInButton={true}
|
|
483
|
-
hasRefreshButton={true}
|
|
484
490
|
/>
|
|
485
491
|
<button
|
|
486
492
|
onClick={() => removeRow(index)}
|
|
@@ -33,6 +33,7 @@ interface LabelsContextType {
|
|
|
33
33
|
setCurrentLabelName: (name: string | null) => void;
|
|
34
34
|
shouldHandlePrefixes: boolean;
|
|
35
35
|
refetchLabelValues: () => void;
|
|
36
|
+
refetchLabelNames: () => void;
|
|
36
37
|
}
|
|
37
38
|
|
|
38
39
|
const LabelsContext = createContext<LabelsContextType | null>(null);
|
|
@@ -57,12 +58,11 @@ export function LabelsProvider({
|
|
|
57
58
|
const [currentLabelName, setCurrentLabelName] = React.useState<string | null>(null);
|
|
58
59
|
const utilizationLabels = useUtilizationLabels();
|
|
59
60
|
|
|
60
|
-
const {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
);
|
|
61
|
+
const {
|
|
62
|
+
result: labelNamesResponse,
|
|
63
|
+
loading: isLabelNamesLoading,
|
|
64
|
+
refetch: refetchLabelNames,
|
|
65
|
+
} = useLabelNames(queryClient, profileType, start, end);
|
|
66
66
|
|
|
67
67
|
const labelNamesFromAPI = useMemo(() => {
|
|
68
68
|
return (labelNamesResponse.error === undefined || labelNamesResponse.error == null) &&
|
|
@@ -114,6 +114,7 @@ export function LabelsProvider({
|
|
|
114
114
|
setCurrentLabelName,
|
|
115
115
|
shouldHandlePrefixes,
|
|
116
116
|
refetchLabelValues,
|
|
117
|
+
refetchLabelNames,
|
|
117
118
|
}),
|
|
118
119
|
[
|
|
119
120
|
labelNames,
|
|
@@ -124,6 +125,7 @@ export function LabelsProvider({
|
|
|
124
125
|
currentLabelName,
|
|
125
126
|
shouldHandlePrefixes,
|
|
126
127
|
refetchLabelValues,
|
|
128
|
+
refetchLabelNames,
|
|
127
129
|
]
|
|
128
130
|
);
|
|
129
131
|
|
|
@@ -31,7 +31,8 @@ interface LabelContextValue {
|
|
|
31
31
|
labelNameOptions: LabelNameSection[];
|
|
32
32
|
isLoading: boolean;
|
|
33
33
|
error: Error | null;
|
|
34
|
-
refetchLabelValues: () => void;
|
|
34
|
+
refetchLabelValues: (labelName?: string) => void;
|
|
35
|
+
refetchLabelNames: () => void;
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
const LabelContext = createContext<LabelContextValue | null>(null);
|
|
@@ -58,7 +59,11 @@ export function LabelProvider({
|
|
|
58
59
|
}: LabelProviderProps): JSX.Element {
|
|
59
60
|
const reactQueryClient = useQueryClient();
|
|
60
61
|
const utilizationLabelResponse = useUtilizationLabels();
|
|
61
|
-
const {
|
|
62
|
+
const {
|
|
63
|
+
loading,
|
|
64
|
+
result,
|
|
65
|
+
refetch: refetchLabelNamesQuery,
|
|
66
|
+
} = useLabelNames(queryClient, profileType, start, end);
|
|
62
67
|
|
|
63
68
|
const profileValues = useMemo(() => {
|
|
64
69
|
const profileLabelNames =
|
|
@@ -135,26 +140,41 @@ export function LabelProvider({
|
|
|
135
140
|
};
|
|
136
141
|
}, [profileValues, utilizationValues, labelNameFromMatchers]);
|
|
137
142
|
|
|
138
|
-
const refetchLabelValues = useCallback(
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
143
|
+
const refetchLabelValues = useCallback(
|
|
144
|
+
(labelName?: string) => {
|
|
145
|
+
void reactQueryClient.refetchQueries({
|
|
146
|
+
predicate: query => {
|
|
147
|
+
const key = query.queryKey;
|
|
148
|
+
const matchesStructure =
|
|
149
|
+
Array.isArray(key) &&
|
|
150
|
+
key.length === 4 &&
|
|
151
|
+
typeof key[0] === 'string' &&
|
|
152
|
+
key[1] === profileType;
|
|
153
|
+
|
|
154
|
+
if (!matchesStructure) return false;
|
|
155
|
+
|
|
156
|
+
if (labelName !== undefined && labelName !== '') {
|
|
157
|
+
return key[0] === labelName;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
return true;
|
|
161
|
+
},
|
|
162
|
+
});
|
|
163
|
+
},
|
|
164
|
+
[reactQueryClient, profileType]
|
|
165
|
+
);
|
|
166
|
+
|
|
167
|
+
const refetchLabelNames = useCallback(() => {
|
|
168
|
+
refetchLabelNamesQuery();
|
|
169
|
+
}, [refetchLabelNamesQuery]);
|
|
151
170
|
|
|
152
171
|
const contextValue = useMemo(
|
|
153
172
|
() => ({
|
|
154
173
|
...value,
|
|
155
174
|
refetchLabelValues,
|
|
175
|
+
refetchLabelNames,
|
|
156
176
|
}),
|
|
157
|
-
[value, refetchLabelValues]
|
|
177
|
+
[value, refetchLabelValues, refetchLabelNames]
|
|
158
178
|
);
|
|
159
179
|
|
|
160
180
|
return <LabelContext.Provider value={contextValue}>{children}</LabelContext.Provider>;
|