Skip to content

Commit 3f30249

Browse files
fixed navigation after creating stack
1 parent 9e3d0a0 commit 3f30249

File tree

5 files changed

+43
-14
lines changed

5 files changed

+43
-14
lines changed

src/api/stacks/getMyStacksApi.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const getMyStacksApi = ({
1111
page,
1212
size,
1313
filtersParam,
14+
id,
1415
authenticationToken,
1516
}: {
1617
component_id?: any;
@@ -20,6 +21,7 @@ const getMyStacksApi = ({
2021
page: number;
2122
size: number;
2223
filtersParam?: object;
24+
id?: any;
2325
authenticationToken: string;
2426
}): Promise<TStack> =>
2527
fetchApiWithAuthRequest({
@@ -31,6 +33,7 @@ const getMyStacksApi = ({
3133
page,
3234
size,
3335
...filtersParam,
36+
id,
3437
},
3538
method: httpMethods.get,
3639
authenticationToken,

src/redux/actions/stacks/getMyStacksAction.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export const getMyStacksAction = ({
1010
name,
1111
size,
1212
filtersParam,
13+
id,
1314
onSuccess,
1415
onFailure,
1516
}: {
@@ -21,6 +22,7 @@ export const getMyStacksAction = ({
2122
page?: number;
2223
size?: number;
2324
filtersParam?: object;
25+
id?: any;
2426
onSuccess?: () => void;
2527
onFailure?: () => void;
2628
}): TRequestAction => ({
@@ -39,6 +41,7 @@ export const getMyStacksAction = ({
3941
page,
4042
size,
4143
filtersParam,
44+
id,
4245
},
4346
onSuccess,
4447
onFailure,

src/ui/layouts/stacks/CreateStack/ListForAll/index.tsx

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { SidePopup } from './SidePopup';
1616
import {
1717
showToasterAction,
1818
stackComponentsActions,
19+
stacksActions,
1920
} from '../../../../../redux/actions';
2021
import axios from 'axios';
2122
import { toasterTypes } from '../../../../../constants';
@@ -121,9 +122,28 @@ export const ListForAll: React.FC<Props> = () => {
121122
type: toasterTypes.success,
122123
}),
123124
);
125+
dispatch(
126+
stacksActions.getMy({
127+
page: 1,
128+
size: 1,
129+
id: response.data.id,
130+
workspace: selectedWorkspace,
131+
onSuccess: () => {
132+
history.push(
133+
routePaths.stack.configuration(
134+
response.data.id,
135+
selectedWorkspace,
136+
),
137+
);
138+
},
139+
onFailure: () => {},
140+
}),
141+
);
124142
// dispatchStackData(1, 10);
125-
history.push(routePaths.stacks.base);
126-
// history.push(routePaths.stack.configuration(selectedWorkspace, id));
143+
// history.push(routePaths.stacks.base);
144+
history.push(
145+
routePaths.stack.configuration(response.data.id, selectedWorkspace),
146+
);
127147
// dispatchStackComponentsData(1, 10);
128148

129149
// history.push(

src/ui/layouts/stacks/StackDetail/index.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import { List } from '../Stacks/List';
2525

2626
import logo from '../../../assets/logo.svg';
2727
import { GetFlavorsListForLogo } from '../../stackComponents/Stacks/List/GetFlavorsListForLogo';
28+
import { FullWidthSpinner } from '../../../components';
2829

2930
const FilterWrapperForRun = () => {
3031
const locationPath = useLocationPath();
@@ -151,7 +152,9 @@ export const StackDetail: React.FC = () => {
151152
// });
152153

153154
const selectedWorkspace = useSelector(workspaceSelectors.selectedWorkspace);
154-
155+
if (Object.keys(stack).length === 0) {
156+
return <FullWidthSpinner color="black" size="md" />;
157+
}
155158
if (flavourList?.length > 1) {
156159
for (const [key] of Object.entries(stack?.components)) {
157160
const { logo_url }: any = flavourList.find(

src/ui/layouts/stacks/Stacks/useService.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,17 @@ export const useService = (): ServiceInterface => {
2121
useEffect(() => {
2222
setFetching(true);
2323
console.log('locationPath111', locationPath);
24-
dispatch(
25-
stacksActions.getMy({
26-
sort_by: 'desc:created',
27-
logical_operator: 'and',
28-
page: 1,
29-
size: ITEMS_PER_PAGE ? ITEMS_PER_PAGE : DEFAULT_ITEMS_PER_PAGE,
30-
workspace: selectedWorkspace,
31-
onSuccess: () => setFetching(false),
32-
onFailure: () => setFetching(false),
33-
}),
34-
);
24+
// dispatch(
25+
// stacksActions.getMy({
26+
// sort_by: 'desc:created',
27+
// logical_operator: 'and',
28+
// page: 1,
29+
// size: ITEMS_PER_PAGE ? ITEMS_PER_PAGE : DEFAULT_ITEMS_PER_PAGE,
30+
// workspace: selectedWorkspace,
31+
// onSuccess: () => setFetching(false),
32+
// onFailure: () => setFetching(false),
33+
// }),
34+
// );
3535
}, [locationPath, selectedWorkspace]);
3636

3737
const setFetching = (fetching: boolean) => {

0 commit comments

Comments
 (0)