MCPcopy Create free account
hub / github.com/chartbrew/chartbrew / ProjectBoard

Function ProjectBoard

client/src/containers/ProjectBoard/ProjectBoard.jsx:24–112  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

22 The project screen where the dashboard, builder, etc. are
23*/
24function ProjectBoard() {
25 const [loading, setLoading] = useState(true);
26 const [setUpdate] = useState({});
27
28 const team = useSelector(selectTeam);
29 const project = useSelector(selectProject) || {};
30 const user = useSelector(selectUser);
31
32 const params = useParams();
33 const dispatch = useDispatch();
34 const initRef = useRef(null);
35
36 useEffect(() => {
37 if (params.projectId && !initRef.current && team?.id) {
38 initRef.current = true;
39
40 _init();
41
42 checkForUpdates()
43 .then((release) => {
44 if (release && release.upToDate) return true;
45
46 setUpdate(release);
47 return release;
48 });
49 }
50 }, [params, team]);
51
52 const _init = (id) => {
53 _getProject(id);
54 dispatch(getProjectCharts({ project_id: id || params.projectId }));
55 window.localStorage.setItem("__cb_active_team", team.id);
56 };
57
58 const _getProject = (id) => {
59 let { projectId } = params;
60 if (id) projectId = id;
61
62 dispatch(getTeam(team.id))
63 .then(() => {
64 dispatch(getTeamMembers({ team_id: team.id }));
65 dispatch(getProjects({ team_id: team.id }));
66 window.localStorage.setItem("__cb_active_team", team.id);
67 return dispatch(getProject({ project_id: projectId }));
68 })
69 .then(() => {
70 return dispatch(changeActiveProject(projectId));
71 })
72 .then(() => {
73 setLoading(false);
74 })
75 .catch(() => {
76 setLoading(false);
77 });
78 };
79
80 const _canAccess = (role) => {
81 return canAccess(role, user.id, team.TeamRoles);

Callers

nothing calls this directly

Calls 2

checkForUpdatesFunction · 0.85
_initFunction · 0.70

Tested by

no test coverage detected