Skip to content

Commit 47bc0ad

Browse files
committed
main migration stack added to dropdown, table-header added to empty state, css fix for empty state and dropdown
1 parent 1673b2c commit 47bc0ad

File tree

5 files changed

+61
-38
lines changed

5 files changed

+61
-38
lines changed

ui/src/components/ExecutionLogs/executionlog.interface.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@ export type LogEntry = {
88
export type StackIds = {
99
stackUid?: string;
1010
stackName?: string;
11+
isMigrated?: boolean;
1112
};
1213

14+
1315
export type DropdownOption = {
14-
label: string;
16+
label: string ;
1517
value: string;
1618
};
1719

ui/src/components/ExecutionLogs/index.scss

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
}
1313

1414
.dropdown-wrapper {
15-
display: flex;
16-
justify-content: center;
1715
margin-bottom: 8px;
1816
}
1917

@@ -31,6 +29,11 @@
3129
height: auto;
3230
}
3331

32+
.Table:has(.custom-empty-state) {
33+
height: 40.5rem;
34+
}
35+
36+
3437
.custom-empty-state {
3538
.Icon--original {
3639
width: 207px !important;

ui/src/components/ExecutionLogs/index.tsx

Lines changed: 43 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import React, { useEffect, useState } from 'react';
22
import { useSelector } from 'react-redux';
33
import {
44
InfiniteScrollTable,
5-
Dropdown,
65
Button,
76
EmptyState,
87
Select
@@ -17,7 +16,7 @@ import { getMigrationLogs } from '../../services/api/migration.service';
1716
const ExecutionLogs = ({ projectId }: { projectId: string }) => {
1817
const [data, setData] = useState<LogEntry[]>([]);
1918
const [loading, setLoading] = useState(true);
20-
const [totalCounts, setTotalCounts] = useState<number | 0>(0);
19+
const [totalCounts, setTotalCounts] = useState<number>(0);
2120
const [searchText, setSearchText] = useState<string>('');
2221
const [filterOption, setFilterOption] = useState<FilterOption[]>([]);
2322
const [isCursorInside, setIsCursorInside] = useState(false);
@@ -29,25 +28,42 @@ const ExecutionLogs = ({ projectId }: { projectId: string }) => {
2928
(state: RootState) => state?.authentication?.selectedOrganisation
3029
);
3130

32-
const stacks = useSelector((state: RootState) => state?.migration?.newMigrationData?.testStacks);
31+
const testStacks = useSelector(
32+
(state: RootState) => state?.migration?.newMigrationData?.testStacks
33+
);
34+
console.info(testStacks.length)
35+
const mainStack = useSelector(
36+
(state: RootState) => state?.migration?.newMigrationData?.stackDetails
37+
);
38+
const migrationCompleted = useSelector(
39+
(state: RootState) =>
40+
state?.migration?.newMigrationData?.migration_execution?.migrationCompleted
41+
);
3342

34-
const stackIds = stacks?.map((stack: StackIds) => ({
43+
const stackIds = testStacks?.map((stack: StackIds) => ({
3544
label: stack?.stackName,
3645
value: stack?.stackUid
3746
}));
3847

39-
const [selectedStackId, setSelectedStackId] = useState<string>(
40-
stackIds[stackIds.length - 1]?.value ?? ''
41-
);
42-
const [selectedStackName, setSelectedStackName] = useState<string>(
43-
stackIds[stackIds.length - 1]?.label ?? ''
48+
if (migrationCompleted) {
49+
stackIds?.push({
50+
label: mainStack?.label,
51+
value: mainStack?.value
52+
});
53+
}
54+
55+
const [selectedStack, setSelectedStack] = useState<DropdownOption>(
56+
{
57+
label: stackIds[stackIds.length - 1]?.label ?? '' ,
58+
value: stackIds[stackIds.length - 1]?.value ?? ''
59+
}
4460
);
4561

4662
useEffect(() => {
47-
if (selectedStackId) {
63+
if (selectedStack) {
4864
fetchData({});
4965
}
50-
}, [selectedStackId]);
66+
}, [selectedStack]);
5167

5268
const ColumnFilter = () => {
5369
const closeModal = () => {
@@ -224,7 +240,7 @@ const ExecutionLogs = ({ projectId }: { projectId: string }) => {
224240
}) => {
225241
searchText = searchText === '' ? 'null' : searchText;
226242

227-
if (!selectedStackId) {
243+
if (!selectedStack) {
228244
setLoading(false);
229245
return;
230246
}
@@ -234,7 +250,7 @@ const ExecutionLogs = ({ projectId }: { projectId: string }) => {
234250
const response = await getMigrationLogs(
235251
selectedOrganisation?.value || '',
236252
projectId,
237-
selectedStackId,
253+
selectedStack.value,
238254
skip,
239255
limit,
240256
startIndex,
@@ -265,7 +281,6 @@ const ExecutionLogs = ({ projectId }: { projectId: string }) => {
265281
<InfiniteScrollTable
266282
tableHeight={590}
267283
itemSize={60}
268-
TABLE_HEAD_HEIGHT={0}
269284
columns={columns}
270285
data={data}
271286
uniqueKey={'timestamp'}
@@ -275,7 +290,8 @@ const ExecutionLogs = ({ projectId }: { projectId: string }) => {
275290
rowPerPageOptions={[10, 30, 50, 100]}
276291
minBatchSizeToFetch={30}
277292
v2Features={{
278-
pagination: true
293+
pagination: true,
294+
isNewEmptyState : true
279295
}}
280296
isResizable={true}
281297
isRowSelect={false}
@@ -286,24 +302,18 @@ const ExecutionLogs = ({ projectId }: { projectId: string }) => {
286302
onSearchChangeEvent={(value: string) => setSearchText(value)}
287303
withExportCta={{
288304
component: (
289-
<Select
290-
width="250px"
291-
version="v2"
292-
value={selectedStackName}
293-
options={stackIds}
294-
placeholder={
295-
selectedStackName === ''
296-
? stackIds.length > 0
297-
? 'Select Stack Id'
298-
: 'No stack created'
299-
: selectedStackName
300-
}
301-
onChange={(s: DropdownOption) => {
302-
setSelectedStackId(s.value);
303-
setSelectedStackName(s.label);
304-
setSearchText('');
305-
}}
306-
/>
305+
<Select
306+
className='dropdown-wrapper'
307+
width="250px"
308+
version="v2"
309+
value={testStacks.length ? selectedStack : ''}
310+
options={stackIds}
311+
placeholder='Select a stack'
312+
onChange={(s: DropdownOption) => {
313+
setSelectedStack({label: s.label, value: s.value})
314+
setSearchText('');
315+
}}
316+
/>
307317
),
308318
showExportCta: true
309319
}}

ui/src/components/FilterModale/index.scss

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@
2727
padding: 8px 16px;
2828
}
2929

30+
.tableFilterModalStories__body{
31+
overflow: scroll;
32+
max-height: 250px;
33+
overflow-x: hidden;
34+
}
35+
3036
.Checkbox {
3137
display: flex;
3238
align-items: center;
@@ -65,10 +71,10 @@
6571
}
6672

6773
.close-btn:hover {
68-
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
74+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
6975
transform: scale(1.05);
7076
border-radius: 8px;
71-
background-color: #f0f1f3;
77+
background-color: #f0f1f3;
7278
cursor: pointer;
7379
transition:
7480
box-shadow 0.2s ease,

ui/src/components/FilterModale/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ const FilterModal = ({
3232
</div>
3333
</div>
3434
{/* Modal Body */}
35+
<div className="tableFilterModalStories__body">
3536
<ul>
3637
{data.map((item) => (
3738
<li key={item.value}>
@@ -49,6 +50,7 @@ const FilterModal = ({
4950
</li>
5051
))}
5152
</ul>
53+
</div>
5254

5355
{/* Modal Footer */}
5456
<div className="tableFilterModalStories__footer">

0 commit comments

Comments
 (0)