Skip to content

Commit

Permalink
Merge branch 'develop' into feature-2645/feedback-request-add-ability…
Browse files Browse the repository at this point in the history
…-to-request-feedback-from-external-source
  • Loading branch information
Luch76 committed Oct 22, 2024
2 parents a13ed8c + 4f35e49 commit 41ac1aa
Show file tree
Hide file tree
Showing 15 changed files with 300 additions and 123 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,26 @@
@JsonDeserialize(using = SettingOptionDeserializer.class)
public enum SettingOption {
LOGO_URL("The logo url", Category.THEME, Type.FILE),
PULSE_EMAIL_FREQUENCY("The Pulse Email Frequency (weekly, bi-weekly, monthly)", Category.CHECK_INS, Type.STRING);
PULSE_EMAIL_FREQUENCY("The Pulse Email Frequency", Category.CHECK_INS, Type.STRING, List.of("weekly", "bi-weekly", "monthly"));

private final String description;
private final Category category;
private final Type type;
private final List<String> values;

SettingOption(String description, Category category, Type type) {
this.description = description;
this.category = category;
this.type = type;
this.values = List.of();
}

public String getDescription() {
return description;
}

public Category getCategory() {
return category;
}

public Type getType() {
return type;
SettingOption(String description, Category category, Type type,
List<String> values) {
this.description = description;
this.category = category;
this.type = type;
this.values = values;
}

public static List<SettingOption> getOptions(){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.fasterxml.jackson.databind.ser.std.StdSerializer;

import java.io.IOException;
import java.util.List;

public class SettingOptionSerializer extends StdSerializer<SettingOption> {

Expand All @@ -28,6 +29,15 @@ public void serialize(
generator.writeString(settingOption.getCategory().name());
generator.writeFieldName("type");
generator.writeString(settingOption.getType().name());
List<String> values = settingOption.getValues();
if (!values.isEmpty()) {
generator.writeFieldName("values");
generator.writeStartArray(values.size());
for(String value : values) {
generator.writeString(value);
}
generator.writeEndArray();
}
generator.writeEndObject();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,8 @@ public SettingsResponseDTO findByName(@PathVariable @NotNull String name) {
public List<SettingsResponseDTO> getOptions() {
List<SettingOption> options = SettingOption.getOptions();
return options.stream().map(option -> {
// Default to an empty value and "invalid" UUID.
// This can be used by the client to determine pre-existance.
String value = "";
UUID uuid = new UUID(0, 0);
UUID uuid = null;
try {
Setting s = settingsServices.findByName(option.name());
uuid = s.getId();
Expand All @@ -89,6 +87,7 @@ public List<SettingsResponseDTO> getOptions() {
return new SettingsResponseDTO(
uuid, option.name(), option.getDescription(),
option.getCategory(), option.getType(),
option.getValues(),
value);
}).toList();
}
Expand Down Expand Up @@ -150,6 +149,7 @@ private SettingsResponseDTO fromEntity(Setting entity) {
dto.setDescription(option.getDescription());
dto.setCategory(option.getCategory());
dto.setType(option.getType());
dto.setValues(option.getValues());
dto.setValue(entity.getValue());
return dto;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import lombok.Setter;

import java.util.UUID;
import java.util.List;

@Setter
@Getter
Expand Down Expand Up @@ -36,6 +37,10 @@ public class SettingsResponseDTO {
@Schema(description = "type of the setting")
private SettingOption.Type type;

@NotNull
@Schema(description = "possible values for the setting")
private List<String> values;

@NotBlank
@Schema(description = "value of the setting")
private String value;
Expand Down
38 changes: 0 additions & 38 deletions web-ui/src/components/admin/users/Users.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,44 +4,6 @@
justify-content: flex-end;
}

.add-member-modal {
position: absolute;
min-width: 400px;
max-width: 600px;
background-color: #fff;
top: 50%;
left: 50%;
padding: 0.5rem;
transform: translate(-50%, -50%);
border: 2px solid #fff;
}

.add-member-modal h2 {
margin-block-end: 0rem;
margin-left: 0.5rem;
}

.add-member-modal-actions {
margin-top: 1rem;
width: calc(100% - 1rem);
display: flex;
flex-direction: row;
justify-content: flex-end;
}

.add-member-modal .MuiTextField-root.fullWidth {
width: calc(100% - 1rem);
}

.add-member-modal .MuiTextField-root.halfWidth {
width: calc(50% - 0.5rem);
}

.add-member-modal .MuiTextField-root {
margin: 0.5rem;
width: 25ch;
}

.user-page {
padding: 12px;
}
4 changes: 2 additions & 2 deletions web-ui/src/components/edit_skills/EditSkills.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
position: absolute;
min-width: 400px;
max-width: 600px;
background-color: #fff;
background-color: var(--checkins-palette-background-default);
top: 50%;
left: 50%;
padding: 0.5rem;
Expand Down Expand Up @@ -40,7 +40,7 @@
position: absolute;
min-width: 400px;
max-width: 600px;
background-color: #fff;
background-color: var(--checkins-palette-background-default);
top: 50%;
left: 50%;
padding: 0.5rem;
Expand Down
24 changes: 21 additions & 3 deletions web-ui/src/components/settings/types/number.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import React from 'react';
import { Input, Typography } from '@mui/material';
import {
Select,
MenuItem,
ListItemText,
Input,
Typography
} from '@mui/material';
import { createLabelId } from '../../../helpers/strings.js';

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

return (
Expand All @@ -24,13 +30,25 @@ const SettingsNumber = ({ name, description, value, handleChange }) => {
</Typography>
</label>
{description && <p>{description}</p>}
{values && values.length > 0 ?
<Select
labelId={labelId}
value={value}
onChange={handleChange}
>
{values.map((option) => (
<MenuItem key={option} value={option}>
<ListItemText primary={option} />
</MenuItem>
))}
</Select> :
<Input
id={labelId}
className="settings-control"
type="number"
value={value}
onChange={handleChange}
/>
/>}
</div>
);
};
Expand Down
23 changes: 21 additions & 2 deletions web-ui/src/components/settings/types/string.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import React from 'react';
import { Input, Typography } from '@mui/material';
import {
Select,
MenuItem,
ListItemText,
Input,
Typography
} from '@mui/material';
import { createLabelId } from '../../../helpers/strings.js';

/**
Expand All @@ -17,6 +23,7 @@ import { createLabelId } from '../../../helpers/strings.js';
const SettingsString = ({
name,
description,
values,
value,
placeholder,
handleChange
Expand All @@ -31,14 +38,26 @@ const SettingsString = ({
</Typography>
</label>
{description && <p>{description}</p>}
{values && values.length > 0 ?
<Select
labelId={labelId}
value={value}
onChange={handleChange}
>
{values.map((option) => (
<MenuItem key={option} value={option}>
<ListItemText primary={option} />
</MenuItem>
))}
</Select> :
<Input
id={labelId}
className="settings-control"
type="text"
value={value}
placeholder={placeholder ?? `Enter ${name}`}
onChange={handleChange}
/>
/>}
</div>
);
};
Expand Down
2 changes: 1 addition & 1 deletion web-ui/src/components/skills/SkillSection.css
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
position: absolute;
min-width: 400px;
max-width: 600px;
background-color: #fff;
background-color: var(--checkins-palette-background-default);
top: 50%;
left: 50%;
padding: 0.5rem;
Expand Down
2 changes: 1 addition & 1 deletion web-ui/src/pages/CheckinsPage.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
position: absolute;
min-width: 400px;
max-width: 600px;
background-color: #fff;
background-color: var(--checkins-palette-background-default);
top: 50%;
left: 50%;
padding: 0.5rem;
Expand Down
2 changes: 1 addition & 1 deletion web-ui/src/pages/ErrorBoundaryPage.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
position: absolute;
min-width: 400px;
max-width: 600px;
background-color: #fff;
background-color: var(--checkins-palette-background-default);
top: 50%;
left: 50%;
padding: 0.5rem;
Expand Down
44 changes: 0 additions & 44 deletions web-ui/src/pages/PeoplePage.css
Original file line number Diff line number Diff line change
@@ -1,47 +1,3 @@
.add-member {
align-items: center;
display: flex;
justify-content: flex-end;
}

.add-member-modal {
position: absolute;
min-width: 400px;
max-width: 600px;
background-color: #fff;
top: 50%;
left: 50%;
padding: 0.5rem;
transform: translate(-50%, -50%);
border: 2px solid #fff;
}

.add-member-modal h2 {
margin-block-end: 0rem;
margin-left: 0.5rem;
}

.add-member-modal-actions {
margin-top: 1rem;
width: calc(100% - 1rem);
display: flex;
flex-direction: row;
justify-content: flex-end;
}

.add-member-modal .MuiTextField-root.fullWidth {
width: calc(100% - 1rem);
}

.add-member-modal .MuiTextField-root.halfWidth {
width: calc(50% - 0.5rem);
}

.add-member-modal .MuiTextField-root {
margin: 0.5rem;
width: 25ch;
}

.people-page {
padding: 12px;
}
Loading

0 comments on commit 41ac1aa

Please sign in to comment.