MCPcopy Create free account
hub / github.com/FeatureProbe/FeatureProbe / ProjectLayout

Function ProjectLayout

ui/src/layout/projectLayout.tsx:97–386  ·  view source on GitHub ↗
(props: IProps)

Source from the content-addressed store, hash-verified

95];
96
97const ProjectLayout = (props: IProps) => {
98 const { projectKey, environmentKey, toggleKey, segmentKey } = useParams<IRouterParams>();
99 const [ projectInfo, setProjectInfo ] = useState<IProject>({
100 name: '',
101 key: '',
102 description: '',
103 environments: [{
104 name: '',
105 key: '',
106 clientSdkKey: '',
107 serverSdkKey: ''
108 }]
109 });
110 const [ envIndex, setEnvIndex ] = useState<number>(0);
111 const [ toggleName, saveToggleName ] = useState<string>('');
112 const [ segmentName, setSegmentName ] = useState<string>('');
113 const [ tipVisible, saveTipVisible ] = useState<boolean>(false);
114 const [ isLoading, saveIsLoading ] = useState<boolean>(false);
115 const [ run, saveRun ] = useState<boolean>(false);
116 const [ stepIndex, saveStepIndex ] = useState<number>(0);
117 const history = useHistory();
118 const match = useRouteMatch();
119 const intl = useIntl();
120
121 useEffect(() => {
122 getProjectInfo<IProject>(projectKey).then(res => {
123 saveIsLoading(false);
124 if (res.success) {
125 const { data } = res;
126 if (data) {
127 setProjectInfo(data);
128 }
129 } else {
130 message.error(res.message || 'Get project information error!');
131 }
132 });
133 }, [projectKey]);
134
135 useEffect(() => {
136 if(segmentKey) {
137 getSegmentDetail<ISegmentInfo>(projectKey, segmentKey).then(res => {
138 saveIsLoading(false);
139 if (res.success) {
140 const { data } = res;
141 if (data) {
142 setSegmentName(data.name);
143 }
144 } else {
145 message.error(res.message || 'Error getting segment');
146 }
147 });
148 }
149 }, [projectKey, segmentKey]);
150
151 useEffect(() => {
152 if (!toggleKey) return;
153
154 getToggleInfo<IToggleInfo>(projectKey, environmentKey, toggleKey).then(res => {

Callers

nothing calls this directly

Calls 6

getProjectInfoFunction · 0.90
getSegmentDetailFunction · 0.90
getToggleInfoFunction · 0.90
getFromDictionaryFunction · 0.90
saveDictionaryFunction · 0.90
pushMethod · 0.65

Tested by

no test coverage detected