Skip to content

Commit 9ef9cb7

Browse files
jescaladavinayan3
authored andcommitted
Images UI Search fixes (#111)
* Fix off by one bugs in index range * Fix typos * Fix image blob data not refreshing on Search
1 parent dbf0f61 commit 9ef9cb7

File tree

11 files changed

+25
-22
lines changed

11 files changed

+25
-22
lines changed

src/src/components/AxesPropsPopover/AxesPropsPopover.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,14 +170,14 @@ function AxesPropsPopover({
170170
{
171171
errorCondition: (value: number) =>
172172
max === undefined ? false : value > max,
173-
errorText: `Value should be equal or smaller then ${max}`,
173+
errorText: `Value should be equal or smaller than ${max}`,
174174
},
175175
],
176176
max: (min?: number) => [
177177
{
178178
errorCondition: (value: number) =>
179179
min === undefined ? false : value < min,
180-
errorText: `Value should be equal or greater then ${min}`,
180+
errorText: `Value should be equal or greater than ${min}`,
181181
},
182182
],
183183
}),

src/src/components/ExportPreview/ExportPreview.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,11 +278,11 @@ function ExportPreview({
278278
(min: number, max: number) => [
279279
{
280280
errorCondition: (value: number) => value < min,
281-
errorText: `Value should be equal or greater then ${min}`,
281+
errorText: `Value should be equal or greater than ${min}`,
282282
},
283283
{
284284
errorCondition: (value: number) => value > max,
285-
errorText: `Value should be equal or smaller then ${max}`,
285+
errorText: `Value should be equal or smaller than ${max}`,
286286
},
287287
],
288288
[],

src/src/components/MediaList/ImageBox.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ const ImageBox = ({
3232
const { format, blob_uri } = data;
3333
const [isImageFullViewPopupOpened, setIsImageFullViewPopupOpened] =
3434
React.useState<boolean>(false);
35-
let [blobData, setBlobData] = React.useState<string>(
35+
const [blobData, setBlobData] = React.useState<string>(
3636
blobsURIModel.getState()[blob_uri] ?? null,
3737
);
3838

3939
React.useEffect(() => {
4040
let timeoutID: number;
4141
let subscription: any;
4242

43-
if (blobData === null) {
43+
if (!blobData) {
4444
// Get the formatted URI containing the run hash and experiment id
4545
const formattedUri = data.run.props.experiment.artifact_location
4646
? `${data.run.props.experiment.artifact_location}/${data.run.hash}/artifacts/${blob_uri}`

src/src/components/MediaPanel/MediaPanel.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,9 +200,11 @@ function MediaPanel({
200200
if (blobUriArray.current.includes(blobUrl)) {
201201
return;
202202
}
203+
/* jescalada: removing this refreshes the image when clicking Search
203204
if (processedBlobUriArray.current.includes(blobUrl)) {
204205
return;
205206
}
207+
*/
206208

207209
blobUriArray.current.push(blobUrl);
208210
getBatch();

src/src/components/RangePanel/RangePanel.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ function RangePanel({
2828
{items?.map((item) => {
2929
const rangeLength = _.range(
3030
item.rangeEndpoints?.[0] ?? 0,
31-
(item.rangeEndpoints?.[1] ?? 0) + 1,
31+
(item.rangeEndpoints?.[1] ?? 0) + 2,
3232
).length;
3333
return (
3434
<React.Fragment key={item.sliderName}>
@@ -40,7 +40,7 @@ function RangePanel({
4040
countTitleTooltip={item.inputTitleTooltip}
4141
sliderTitleTooltip={item.sliderTitleTooltip}
4242
min={item.rangeEndpoints?.[0]}
43-
max={item.rangeEndpoints?.[1]}
43+
max={item.rangeEndpoints?.[1] + 1}
4444
selectedRangeValue={item.selectedRangeValue}
4545
selectedCountValue={item.inputValue}
4646
onSearch={onApply}
@@ -54,13 +54,13 @@ function RangePanel({
5454
item?.inputValidationPatterns ?? [
5555
{
5656
errorCondition: (value: string | number) => +value <= 0,
57-
errorText: `Value should be greater then ${0}`,
57+
errorText: `Value should be greater than ${0}`,
5858
},
5959
{
6060
errorCondition: (value: string | number) => {
6161
return +value > rangeLength;
6262
},
63-
errorText: `Value should be smaller then ${
63+
errorText: `Value should be smaller than ${
6464
rangeLength + 1
6565
}`,
6666
},

src/src/components/kit/Input/Input.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ describe('<InputWrapper /> -', () => {
3232

3333
const minValidationPattern = {
3434
errorCondition: (value: any) => value < 10,
35-
errorText: `Value should be equal or greater then ${min}`,
35+
errorText: `Value should be equal or greater than ${min}`,
3636
};
3737

3838
const maxValidationPattern = {
3939
errorCondition: (value: any) => value > max,
40-
errorText: `Value should be equal or smaller then ${max}`,
40+
errorText: `Value should be equal or smaller than ${max}`,
4141
};
4242

4343
const zeroValidationPattern = {

src/src/modules/BaseExplorer/components/Controls/ConfigureAxes/Popover/AxesRange.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,14 @@ function AxesRange(props: IAxesRangeProps) {
9595
{
9696
errorCondition: (value: number) =>
9797
max === undefined ? false : value > max,
98-
errorText: `Value should be equal or smaller then ${max}`,
98+
errorText: `Value should be equal or smaller than ${max}`,
9999
},
100100
],
101101
max: (min?: number) => [
102102
{
103103
errorCondition: (value: number) =>
104104
min === undefined ? false : value < min,
105-
errorText: `Value should be equal or greater then ${min}`,
105+
errorText: `Value should be equal or greater than ${min}`,
106106
},
107107
],
108108
}),

src/src/modules/BaseExplorer/components/RangePanel/RangePanelItem.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,13 @@ const RangePanelItem = ({
6161
() => [
6262
{
6363
errorCondition: (value: string | number) => +value <= 0,
64-
errorText: `Value should be greater then ${0}`,
64+
errorText: `Value should be greater than ${0}`,
6565
},
6666
{
6767
errorCondition: (value: string | number) => {
6868
return +value > rangeLength;
6969
},
70-
errorText: `Value should be smaller then ${rangeLength + 1}`,
70+
errorText: `Value should be smaller than ${rangeLength + 1}`,
7171
},
7272
],
7373
[rangeLength],

src/src/modules/BaseExplorer/components/RangePanel/helpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export function getRangeAndDensityData(
2525
];
2626
// calculating the items count in range
2727
const rangeTotalCount = total[1] - total[0] === 0 ? 1 : total[1] - total[0];
28-
// checking if the previous density is bigger then the items in the total range.
28+
// checking if the previous density is bigger than the items in the total range.
2929
// setting the density value to the items count otherwise setting the the previous density.
3030
const density: number =
3131
prevDensity > rangeTotalCount ? rangeTotalCount : prevDensity;

src/src/services/models/imagesExplore/imagesExploreAppModel.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ function getImagesData(
366366
!_.isEmpty(indexSlice) &&
367367
!_.isNil(recordSlice?.[0]) &&
368368
!_.isNil(recordSlice[1])
369-
? `${indexSlice?.[0]}:${(indexSlice?.[1] || 0) + 1}`
369+
? `${indexSlice?.[0]}:${indexSlice?.[1] || 0}`
370370
: '',
371371
record_density:
372372
!_.isNil(recordDensity) && +recordDensity > 0 ? recordDensity : '',
@@ -682,8 +682,9 @@ function setModelData(rawData: any[], configData: IImagesExploreAppConfig) {
682682
ranges?.index_range_total[0] - 1,
683683
ranges?.index_range_total[1] + 1,
684684
)
685-
? ranges?.index_range_used[1] - 1
686-
: ranges?.index_range_total[1] - 1,
685+
? // jescalada: Removed the "-1" in order to match the backend behavior
686+
ranges?.index_range_used[1]
687+
: ranges?.index_range_total[1],
687688
];
688689
const recordRangeTotalCount =
689690
ranges?.record_range_total[1] - 1 - ranges?.record_range_total[0];

0 commit comments

Comments
 (0)