MCPcopy
hub / github.com/chartbrew/chartbrew / ProjectSettings

Function ProjectSettings

client/src/containers/ProjectSettings.jsx:26–347  ·  view source on GitHub ↗
(props)

Source from the content-addressed store, hash-verified

24 Project settings page
25*/
26function ProjectSettings(props) {
27 const {
28 user, cleanErrors, style,
29 } = props;
30
31 const [projectName, setProjectName] = useState("");
32 const [nameError, setNameError] = useState(false);
33 const [loading, setLoading] = useState(false);
34 const [removeModal, setRemoveModal] = useState(false);
35 const [removeLoading, setRemoveLoading] = useState(false);
36 const [removeError, setRemoveError] = useState(false);
37 const [projectTimezone, setProjectTimezone] = useState("");
38 const [loadingTimezone, setLoadingTimezone] = useState(false);
39 const { contains } = useFilter({ sensitivity: "base" });
40 const [projectDescription, setProjectDescription] = useState("");
41 const [loadingDescription, setLoadingDescription] = useState(false);
42
43 const team = useSelector(selectTeam);
44 const project = useSelector(selectProject);
45
46 const navigate = useNavigate();
47 const dispatch = useDispatch();
48
49 useEffect(() => {
50 cleanErrors();
51 }, []);
52
53 const _onSaveName = () => {
54 if (!projectName) {
55 setNameError(true);
56 return;
57 }
58
59 setLoading(true);
60
61 dispatch(updateProject({ project_id: project.id, data: { name: projectName } }))
62 .then((data) => {
63 if (data.error) {
64 throw new Error(data.error);
65 }
66 setLoading(false);
67 dispatch(changeActiveProject(project.id));
68 toast.success("Dashboard name updated!");
69 })
70 .catch(() => {
71 setLoading(false);
72 toast.error("There was a problem updating the dashboard name. Please try again.");
73 });
74 };
75
76 const _onRemoveConfirmation = () => {
77 setRemoveModal(true);
78 };
79
80 const _onRemove = () => {
81 setRemoveLoading(true);
82 setRemoveError(false);
83 dispatch(removeProject({ project_id: project.id }))

Callers

nothing calls this directly

Calls 5

cleanErrorsFunction · 0.90
_onSaveNameFunction · 0.85
_onGetMachineTimezoneFunction · 0.85
_onSaveTimezoneFunction · 0.85
_canAccessFunction · 0.70

Tested by

no test coverage detected