Skip to content

Commit 41ac1aa

Browse files
committed
Merge branch 'develop' into feature-2645/feedback-request-add-ability-to-request-feedback-from-external-source
2 parents a13ed8c + 4f35e49 commit 41ac1aa

File tree

15 files changed

+300
-123
lines changed

15 files changed

+300
-123
lines changed

server/src/main/java/com/objectcomputing/checkins/services/settings/SettingOption.java

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,28 +16,26 @@
1616
@JsonDeserialize(using = SettingOptionDeserializer.class)
1717
public enum SettingOption {
1818
LOGO_URL("The logo url", Category.THEME, Type.FILE),
19-
PULSE_EMAIL_FREQUENCY("The Pulse Email Frequency (weekly, bi-weekly, monthly)", Category.CHECK_INS, Type.STRING);
19+
PULSE_EMAIL_FREQUENCY("The Pulse Email Frequency", Category.CHECK_INS, Type.STRING, List.of("weekly", "bi-weekly", "monthly"));
2020

2121
private final String description;
2222
private final Category category;
2323
private final Type type;
24+
private final List<String> values;
2425

2526
SettingOption(String description, Category category, Type type) {
2627
this.description = description;
2728
this.category = category;
2829
this.type = type;
30+
this.values = List.of();
2931
}
3032

31-
public String getDescription() {
32-
return description;
33-
}
34-
35-
public Category getCategory() {
36-
return category;
37-
}
38-
39-
public Type getType() {
40-
return type;
33+
SettingOption(String description, Category category, Type type,
34+
List<String> values) {
35+
this.description = description;
36+
this.category = category;
37+
this.type = type;
38+
this.values = values;
4139
}
4240

4341
public static List<SettingOption> getOptions(){

server/src/main/java/com/objectcomputing/checkins/services/settings/SettingOptionSerializer.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
66

77
import java.io.IOException;
8+
import java.util.List;
89

910
public class SettingOptionSerializer extends StdSerializer<SettingOption> {
1011

@@ -28,6 +29,15 @@ public void serialize(
2829
generator.writeString(settingOption.getCategory().name());
2930
generator.writeFieldName("type");
3031
generator.writeString(settingOption.getType().name());
32+
List<String> values = settingOption.getValues();
33+
if (!values.isEmpty()) {
34+
generator.writeFieldName("values");
35+
generator.writeStartArray(values.size());
36+
for(String value : values) {
37+
generator.writeString(value);
38+
}
39+
generator.writeEndArray();
40+
}
3141
generator.writeEndObject();
3242
}
33-
}
43+
}

server/src/main/java/com/objectcomputing/checkins/services/settings/SettingsController.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,8 @@ public SettingsResponseDTO findByName(@PathVariable @NotNull String name) {
7676
public List<SettingsResponseDTO> getOptions() {
7777
List<SettingOption> options = SettingOption.getOptions();
7878
return options.stream().map(option -> {
79-
// Default to an empty value and "invalid" UUID.
80-
// This can be used by the client to determine pre-existance.
8179
String value = "";
82-
UUID uuid = new UUID(0, 0);
80+
UUID uuid = null;
8381
try {
8482
Setting s = settingsServices.findByName(option.name());
8583
uuid = s.getId();
@@ -89,6 +87,7 @@ public List<SettingsResponseDTO> getOptions() {
8987
return new SettingsResponseDTO(
9088
uuid, option.name(), option.getDescription(),
9189
option.getCategory(), option.getType(),
90+
option.getValues(),
9291
value);
9392
}).toList();
9493
}
@@ -150,6 +149,7 @@ private SettingsResponseDTO fromEntity(Setting entity) {
150149
dto.setDescription(option.getDescription());
151150
dto.setCategory(option.getCategory());
152151
dto.setType(option.getType());
152+
dto.setValues(option.getValues());
153153
dto.setValue(entity.getValue());
154154
return dto;
155155
}

server/src/main/java/com/objectcomputing/checkins/services/settings/SettingsResponseDTO.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import lombok.Setter;
1010

1111
import java.util.UUID;
12+
import java.util.List;
1213

1314
@Setter
1415
@Getter
@@ -36,6 +37,10 @@ public class SettingsResponseDTO {
3637
@Schema(description = "type of the setting")
3738
private SettingOption.Type type;
3839

40+
@NotNull
41+
@Schema(description = "possible values for the setting")
42+
private List<String> values;
43+
3944
@NotBlank
4045
@Schema(description = "value of the setting")
4146
private String value;

web-ui/src/components/admin/users/Users.css

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -4,44 +4,6 @@
44
justify-content: flex-end;
55
}
66

7-
.add-member-modal {
8-
position: absolute;
9-
min-width: 400px;
10-
max-width: 600px;
11-
background-color: #fff;
12-
top: 50%;
13-
left: 50%;
14-
padding: 0.5rem;
15-
transform: translate(-50%, -50%);
16-
border: 2px solid #fff;
17-
}
18-
19-
.add-member-modal h2 {
20-
margin-block-end: 0rem;
21-
margin-left: 0.5rem;
22-
}
23-
24-
.add-member-modal-actions {
25-
margin-top: 1rem;
26-
width: calc(100% - 1rem);
27-
display: flex;
28-
flex-direction: row;
29-
justify-content: flex-end;
30-
}
31-
32-
.add-member-modal .MuiTextField-root.fullWidth {
33-
width: calc(100% - 1rem);
34-
}
35-
36-
.add-member-modal .MuiTextField-root.halfWidth {
37-
width: calc(50% - 0.5rem);
38-
}
39-
40-
.add-member-modal .MuiTextField-root {
41-
margin: 0.5rem;
42-
width: 25ch;
43-
}
44-
457
.user-page {
468
padding: 12px;
479
}

web-ui/src/components/edit_skills/EditSkills.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
position: absolute;
33
min-width: 400px;
44
max-width: 600px;
5-
background-color: #fff;
5+
background-color: var(--checkins-palette-background-default);
66
top: 50%;
77
left: 50%;
88
padding: 0.5rem;
@@ -40,7 +40,7 @@
4040
position: absolute;
4141
min-width: 400px;
4242
max-width: 600px;
43-
background-color: #fff;
43+
background-color: var(--checkins-palette-background-default);
4444
top: 50%;
4545
left: 50%;
4646
padding: 0.5rem;

web-ui/src/components/settings/types/number.jsx

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
import React from 'react';
2-
import { Input, Typography } from '@mui/material';
2+
import {
3+
Select,
4+
MenuItem,
5+
ListItemText,
6+
Input,
7+
Typography
8+
} from '@mui/material';
39
import { createLabelId } from '../../../helpers/strings.js';
410

511
/**
@@ -13,7 +19,7 @@ import { createLabelId } from '../../../helpers/strings.js';
1319
* @param {function} props.handleChange - The callback function to handle value changes.
1420
* @returns {JSX.Element} - The rendered component.
1521
*/
16-
const SettingsNumber = ({ name, description, value, handleChange }) => {
22+
const SettingsNumber = ({ name, description, values, value, handleChange }) => {
1723
const labelId = createLabelId(name);
1824

1925
return (
@@ -24,13 +30,25 @@ const SettingsNumber = ({ name, description, value, handleChange }) => {
2430
</Typography>
2531
</label>
2632
{description && <p>{description}</p>}
33+
{values && values.length > 0 ?
34+
<Select
35+
labelId={labelId}
36+
value={value}
37+
onChange={handleChange}
38+
>
39+
{values.map((option) => (
40+
<MenuItem key={option} value={option}>
41+
<ListItemText primary={option} />
42+
</MenuItem>
43+
))}
44+
</Select> :
2745
<Input
2846
id={labelId}
2947
className="settings-control"
3048
type="number"
3149
value={value}
3250
onChange={handleChange}
33-
/>
51+
/>}
3452
</div>
3553
);
3654
};

web-ui/src/components/settings/types/string.jsx

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
import React from 'react';
2-
import { Input, Typography } from '@mui/material';
2+
import {
3+
Select,
4+
MenuItem,
5+
ListItemText,
6+
Input,
7+
Typography
8+
} from '@mui/material';
39
import { createLabelId } from '../../../helpers/strings.js';
410

511
/**
@@ -17,6 +23,7 @@ import { createLabelId } from '../../../helpers/strings.js';
1723
const SettingsString = ({
1824
name,
1925
description,
26+
values,
2027
value,
2128
placeholder,
2229
handleChange
@@ -31,14 +38,26 @@ const SettingsString = ({
3138
</Typography>
3239
</label>
3340
{description && <p>{description}</p>}
41+
{values && values.length > 0 ?
42+
<Select
43+
labelId={labelId}
44+
value={value}
45+
onChange={handleChange}
46+
>
47+
{values.map((option) => (
48+
<MenuItem key={option} value={option}>
49+
<ListItemText primary={option} />
50+
</MenuItem>
51+
))}
52+
</Select> :
3453
<Input
3554
id={labelId}
3655
className="settings-control"
3756
type="text"
3857
value={value}
3958
placeholder={placeholder ?? `Enter ${name}`}
4059
onChange={handleChange}
41-
/>
60+
/>}
4261
</div>
4362
);
4463
};

web-ui/src/components/skills/SkillSection.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
position: absolute;
2727
min-width: 400px;
2828
max-width: 600px;
29-
background-color: #fff;
29+
background-color: var(--checkins-palette-background-default);
3030
top: 50%;
3131
left: 50%;
3232
padding: 0.5rem;

web-ui/src/pages/CheckinsPage.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
position: absolute;
1010
min-width: 400px;
1111
max-width: 600px;
12-
background-color: #fff;
12+
background-color: var(--checkins-palette-background-default);
1313
top: 50%;
1414
left: 50%;
1515
padding: 0.5rem;

0 commit comments

Comments
 (0)