Skip to content

Commit 16dbdfd

Browse files
Bugfix estimation scales create (#795)
* Add department and team ids to poker settings and retro settings components in team page * Fix create estimation scale validation on input
1 parent a9a8490 commit 16dbdfd

File tree

4 files changed

+16
-27
lines changed

4 files changed

+16
-27
lines changed

ui/src/components/estimationscale/CreateEstimationScale.svelte

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -86,28 +86,20 @@
8686
const target = e.target as HTMLInputElement;
8787
const inputValue = target.value;
8888
89-
// Regex to validate the entire input string
90-
const validationRegex =
91-
/^[\p{L}\p{N}\p{Emoji}\p{Emoji_Component}_?]*[\p{L}\p{N}\p{Emoji}\p{Emoji_Component}?]+( *, *[\p{L}\p{N}\p{Emoji}\p{Emoji_Component}_?]*[\p{L}\p{N}\p{Emoji}\p{Emoji_Component}?]+)*$/u;
89+
// Regex to allow letters, numbers, commas, spaces, underscores, and emoji
90+
const allowedCharsRegex = /^[\p{L}\p{N}, _\p{Emoji}\p{Emoji_Component}]*$/u;
9291
93-
if (validationRegex.test(inputValue)) {
94-
// If the input is valid, split it into values
92+
if (allowedCharsRegex.test(inputValue)) {
9593
values = inputValue
9694
.split(',')
9795
.map(v => v.trim())
9896
.filter(v => v !== '');
99-
100-
// Update the input field with the cleaned values
101-
target.value = values.join(', ');
10297
} else {
103-
// If the input is not valid, don't update the values array
104-
// Optionally, you could provide feedback to the user here
10598
notifications.danger(
106-
'Invalid input. Please use only letters, numbers, and commas.',
99+
'Invalid input. Please use only letters, numbers, emojis, commas, spaces, and underscores.',
107100
);
108101
}
109102
}
110-
111103
let createDisabled = $derived(name === '' || scaleType === '' || values.length === 0);
112104
let isAdmin = $derived(validateUserIsAdmin($user));
113105
@@ -181,7 +173,7 @@
181173
</label>
182174
<TextInput
183175
value={values.join(', ')}
184-
on:input={handleValuesChange}
176+
oninput={handleValuesChange}
185177
placeholder={$LL.estimationScaleValuesPlaceholder()}
186178
id="scaleValues"
187179
name="scaleValues"

ui/src/components/estimationscale/EstimationScalesList.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import BooleanDisplay from '../global/BooleanDisplay.svelte';
1818
import TableFooter from '../table/TableFooter.svelte';
1919
20-
import type { NotificationService } from '../../types/notifications';
20+
import type { NotificationService } from '../../types/notifications';
2121
import type { ApiClient } from '../../types/apiclient';
2222
2323
interface Props {
@@ -58,7 +58,7 @@
5858
let showUpdateScale = $state(false);
5959
let updateScale = $state({});
6060
let showRemoveScale = $state(false);
61-
let removeScaleId = null;
61+
let removeScaleId = $state(null);
6262
6363
function handleCreateScale() {
6464
getScales();

ui/src/components/estimationscale/UpdateEstimationScale.svelte

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -94,24 +94,17 @@
9494
const target = e.target as HTMLInputElement;
9595
const inputValue = target.value;
9696
97-
// Regex to validate the entire input string
98-
const validationRegex =
99-
/^[\p{L}\p{N}\p{Emoji}\p{Emoji_Component}_?]*[\p{L}\p{N}\p{Emoji}\p{Emoji_Component}?]+( *, *[\p{L}\p{N}\p{Emoji}\p{Emoji_Component}_?]*[\p{L}\p{N}\p{Emoji}\p{Emoji_Component}?]+)*$/u;
97+
// Regex to allow letters, numbers, commas, spaces, underscores, and emoji
98+
const allowedCharsRegex = /^[\p{L}\p{N}, _\p{Emoji}\p{Emoji_Component}]*$/u;
10099
101-
if (validationRegex.test(inputValue)) {
102-
// If the input is valid, split it into values
100+
if (allowedCharsRegex.test(inputValue)) {
103101
values = inputValue
104102
.split(',')
105103
.map(v => v.trim())
106104
.filter(v => v !== '');
107-
108-
// Update the input field with the cleaned values
109-
target.value = values.join(', ');
110105
} else {
111-
// If the input is not valid, don't update the values array
112-
// Optionally, you could provide feedback to the user here
113106
notifications.danger(
114-
'Invalid input. Please use only letters, numbers, and commas.',
107+
'Invalid input. Please use only letters, numbers, emojis, commas, spaces, and underscores.',
115108
);
116109
}
117110
}
@@ -189,7 +182,7 @@
189182
</label>
190183
<TextInput
191184
value={values.join(', ')}
192-
on:input={handleValuesChange}
185+
oninput={handleValuesChange}
193186
placeholder={$LL.estimationScaleValuesPlaceholder()}
194187
id="scaleValues"
195188
name="scaleValues"

ui/src/pages/team/Team.svelte

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,8 @@
750750
isEntityAdmin={isAdmin}
751751
apiPrefix={teamOnlyPrefix}
752752
organizationId={organizationId}
753+
departmentId={departmentId}
754+
teamId={teamId}
753755
/>
754756
{:else}
755757
<FeatureSubscribeBanner
@@ -792,6 +794,8 @@
792794
isEntityAdmin={isAdmin}
793795
apiPrefix={teamOnlyPrefix}
794796
organizationId={organizationId}
797+
departmentId={departmentId}
798+
teamId={teamId}
795799
/>
796800
{:else}
797801
<FeatureSubscribeBanner

0 commit comments

Comments
 (0)