Skip to content

Commit 499ac5d

Browse files
committed
Frontend: Tighten Photo numeric caps and reveal inline errors photoprism#5584
ISO, F Number, and Focal Length on the Edit Dialog and Camera popover previously capped at 1048576, much wider than the backend's SetExposure clamps (ISO and FocalLength <= 128000, FNumber <= 256). The looser caps let the rule pass values the server then quietly rejects. Tightens each to match the backend, adds Exposure: 64 to PhotoMaxLength, and routes the Exposure rule through PhotoMaxLength.Exposure instead of a hardcoded literal. Drops the bare hide-details attribute from Country, Altitude, ISO, Exposure, F Number, and Focal Length on both surfaces so the rule's inline error renders below the input on overflow. Date/time inputs (Day/Month/Year/Time autocompletes + the standalone DateTime dialog) stay as-is: autocompletes can only emit valid items, the Time field combines rules.time() with the :error="invalidDate" visual cue and the form-validate save gate.
1 parent 04f5dd9 commit 499ac5d

6 files changed

Lines changed: 14 additions & 18 deletions

File tree

frontend/src/component/meta/camera/dialog.vue

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,58 +58,54 @@
5858
<v-col cols="6">
5959
<v-text-field
6060
v-model="iso"
61-
hide-details
6261
autocomplete="off"
6362
autocorrect="off"
6463
autocapitalize="none"
6564
label="ISO"
6665
placeholder=""
6766
density="comfortable"
6867
validate-on="input"
69-
:rules="rules.number(false, 0, 1048576)"
68+
:rules="rules.number(false, 0, 128000)"
7069
class="input-iso"
7170
></v-text-field>
7271
</v-col>
7372
<v-col cols="6">
7473
<v-text-field
7574
v-model="exposure"
76-
hide-details
7775
autocomplete="off"
7876
autocorrect="off"
7977
autocapitalize="none"
8078
:label="$gettext('Exposure')"
8179
placeholder=""
8280
density="comfortable"
8381
validate-on="input"
84-
:rules="rules.text(false, 0, 64)"
82+
:rules="rules.text(false, 0, PhotoMaxLength.Exposure, $gettext('Exposure'))"
8583
class="input-exposure"
8684
></v-text-field>
8785
</v-col>
8886
<v-col cols="6">
8987
<v-text-field
9088
v-model="fNumber"
91-
hide-details
9289
autocomplete="off"
9390
autocorrect="off"
9491
autocapitalize="none"
9592
:label="$gettext('F Number')"
9693
placeholder=""
9794
density="comfortable"
9895
validate-on="input"
99-
:rules="rules.number(false, 0, 1048576)"
96+
:rules="rules.number(false, 0, 256)"
10097
class="input-fnumber"
10198
></v-text-field>
10299
</v-col>
103100
<v-col cols="6">
104101
<v-text-field
105102
v-model="focalLength"
106-
hide-details
107103
autocomplete="off"
108104
:label="$gettext('Focal Length')"
109105
placeholder=""
110106
density="comfortable"
111107
validate-on="input"
112-
:rules="rules.number(false, 0, 1048576)"
108+
:rules="rules.number(false, 0, 128000)"
113109
class="input-focal-length"
114110
></v-text-field>
115111
</v-col>
@@ -128,6 +124,7 @@
128124
</template>
129125

130126
<script>
127+
import { MaxLength as PhotoMaxLength } from "model/photo";
131128
import { rules } from "common/form";
132129
133130
export default {
@@ -146,6 +143,7 @@ export default {
146143
data() {
147144
return {
148145
rules,
146+
PhotoMaxLength,
149147
cameraID: 0,
150148
lensID: 0,
151149
iso: "",

frontend/src/component/photo/edit/details.vue

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,6 @@
157157
:disabled="disabled"
158158
:readonly="!!(view.model.Lat || view.model.Lng)"
159159
:label="$gettext('Country')"
160-
hide-details
161160
hide-no-data
162161
autocomplete="off"
163162
item-value="Code"
@@ -174,7 +173,6 @@
174173
<v-text-field
175174
v-model="view.model.Altitude"
176175
:disabled="disabled"
177-
hide-details
178176
flat
179177
autocomplete="off"
180178
autocorrect="off"
@@ -211,31 +209,29 @@
211209
<v-text-field
212210
v-model="view.model.Iso"
213211
:disabled="disabled"
214-
hide-details
215212
autocomplete="off"
216213
autocorrect="off"
217214
autocapitalize="none"
218215
label="ISO"
219216
placeholder=""
220217
density="comfortable"
221218
validate-on="input"
222-
:rules="rules.number(false, 0, 1048576)"
219+
:rules="rules.number(false, 0, 128000)"
223220
class="input-iso"
224221
></v-text-field>
225222
</v-col>
226223
<v-col cols="6" md="3">
227224
<v-text-field
228225
v-model="view.model.Exposure"
229226
:disabled="disabled"
230-
hide-details
231227
autocomplete="off"
232228
autocorrect="off"
233229
autocapitalize="none"
234230
:label="$gettext('Exposure')"
235231
placeholder=""
236232
density="comfortable"
237233
validate-on="input"
238-
:rules="rules.text(false, 0, 64)"
234+
:rules="rules.text(false, 0, PhotoMaxLength.Exposure, $gettext('Exposure'))"
239235
class="input-exposure"
240236
></v-text-field>
241237
</v-col>
@@ -261,29 +257,27 @@
261257
<v-text-field
262258
v-model="view.model.FNumber"
263259
:disabled="disabled"
264-
hide-details
265260
autocomplete="off"
266261
autocorrect="off"
267262
autocapitalize="none"
268263
:label="$gettext('F Number')"
269264
placeholder=""
270265
density="comfortable"
271266
validate-on="input"
272-
:rules="rules.number(false, 0, 1048576)"
267+
:rules="rules.number(false, 0, 256)"
273268
class="input-fnumber"
274269
></v-text-field>
275270
</v-col>
276271
<v-col cols="6" md="3">
277272
<v-text-field
278273
v-model="view.model.FocalLength"
279274
:disabled="disabled"
280-
hide-details
281275
autocomplete="off"
282276
:label="$gettext('Focal Length')"
283277
placeholder=""
284278
density="comfortable"
285279
validate-on="input"
286-
:rules="rules.number(false, 0, 1048576)"
280+
:rules="rules.number(false, 0, 128000)"
287281
class="input-focal-length"
288282
></v-text-field>
289283
</v-col>

frontend/src/model/photo.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export const MaxLength = Object.freeze({
3535
License: 1024,
3636
Keywords: 2048,
3737
Notes: 2048,
38+
Exposure: 64,
3839
});
3940

4041
// Photo models core metadata for images and videos shown in the UI.

frontend/tests/vitest/component/photo/batch-edit.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -778,6 +778,7 @@ describe("component/photo/batch-edit", () => {
778778
License: 1024,
779779
Keywords: 2048,
780780
Notes: 2048,
781+
Exposure: 64,
781782
});
782783

783784
const cases = [

frontend/tests/vitest/component/photo/edit/details.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,7 @@ describe("component/photo/edit/details", () => {
506506
License: 1024,
507507
Keywords: 2048,
508508
Notes: 2048,
509+
Exposure: 64,
509510
});
510511

511512
const cases = [

frontend/tests/vitest/model/photo.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ describe("model/photo", () => {
2222
License: 1024,
2323
Keywords: 2048,
2424
Notes: 2048,
25+
Exposure: 64,
2526
});
2627
// Frozen so consumers can't accidentally mutate per-field caps.
2728
expect(Object.isFrozen(MaxLength)).toBe(true);

0 commit comments

Comments
 (0)