Skip to content

Commit 99ffe69

Browse files
chore: minor fixes (#404)
1 parent 1671517 commit 99ffe69

File tree

9 files changed

+86
-21
lines changed

9 files changed

+86
-21
lines changed

src/ui/layouts/NonEditableConfig/index.tsx

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -410,20 +410,33 @@ export const NonEditableConfig: React.FC<{ details: any }> = ({ details }) => {
410410
}
411411
// const values = [...flavor?.config_schema?.properties];
412412

413-
// let result = Object.keys(flavor?.config_schema?.properties).reduce(function (
414-
// r: any,
415-
// name: any,
416-
// ) {
417-
// return (
418-
// (r[name] =
419-
// flavor?.config_schema?.properties[name].type === 'string' &&
420-
// flavor?.config_schema?.properties[name].default === undefined
421-
// ? ''
422-
// : flavor?.config_schema?.properties[name].default),
423-
// r
424-
// );
425-
// },
426-
// {});
413+
let result = Object.keys(flavor?.config_schema?.properties).reduce(function (
414+
r: any,
415+
name: any,
416+
) {
417+
return (
418+
(r[name] =
419+
flavor?.config_schema?.properties[name].type === 'string' &&
420+
flavor?.config_schema?.properties[name].default === undefined
421+
? ''
422+
: flavor?.config_schema?.properties[name].default),
423+
r
424+
);
425+
},
426+
{});
427+
428+
function replaceNullWithEmptyString(obj: any) {
429+
for (let prop in obj) {
430+
if (obj[prop] === null) {
431+
obj[prop] = '';
432+
} else if (typeof obj[prop] === 'object') {
433+
replaceNullWithEmptyString(obj[prop]);
434+
}
435+
}
436+
return obj;
437+
}
438+
439+
replaceNullWithEmptyString(details?.configuration);
427440
// let normalizeConfiguration = Object.keys(details?.configuration).reduce(
428441
// function (r: any, name: any) {
429442
// if (details?.configuration[name] === null) {
@@ -469,7 +482,7 @@ export const NonEditableConfig: React.FC<{ details: any }> = ({ details }) => {
469482
// {});
470483

471484
const mappedObject = {
472-
// ...result,
485+
...result,
473486
...details?.configuration,
474487
};
475488
console.log(

src/ui/layouts/common/CollapseTable/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@ export const CollapseTable: React.FC<TableProps & CollapseTableProps> = ({
1818
paginated,
1919
renderAfterRow,
2020
trOnClick,
21+
route,
2122
}) => {
2223
// console.log('activeSorting', activeSorting);
2324
return (
2425
<Table
26+
route={route}
2527
isExpended={isExpended}
2628
activeSorting={activeSorting}
2729
headerCols={headerCols}

src/ui/layouts/common/Table/index.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
// Paragraph,
1414
// icons,
1515
} from '../../../components';
16+
import { Link } from 'react-router-dom';
1617
// import { getPaginationData } from '../../../../utils/pagination';
1718
// import { Pagination } from '../Pagination';
1819
// import { usePaginationAsQueryParam } from '../../../hooks/usePaginationAsQueryParam';
@@ -29,6 +30,7 @@ export interface HeaderCol {
2930
}
3031

3132
export interface TableProps {
33+
route?: any;
3234
isExpended?: boolean;
3335
headerCols: HeaderCol[];
3436
tableRows: any[];
@@ -54,6 +56,7 @@ const createHeaders = (headers: any[]) => {
5456
};
5557

5658
export const Table: React.FC<TableProps> = ({
59+
route,
5760
isExpended,
5861
headerCols,
5962
tableRows,
@@ -453,7 +456,10 @@ export const Table: React.FC<TableProps> = ({
453456
style={{ textAlign: 'center', maxWidth: '700px', margin: '0 auto' }}
454457
paddingVertical="xxl"
455458
>
456-
<H3>{emptyState && emptyState.text}</H3>
459+
<H3>
460+
{emptyState && emptyState.text}{' '}
461+
{route && <Link to={route}>Click here to register new one.</Link>}
462+
</H3>
457463
</Box>
458464
)}
459465
/>

src/ui/layouts/connectors/Connectors/List/index.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ Props) => {
170170
return (
171171
<>
172172
<CollapseTable
173+
route={routePaths.connectors.connectorTypes(selectedWorkspace)}
173174
renderAfterRow={(connector: any) => (
174175
<>
175176
{/* <RunsForSecretTable
@@ -190,7 +191,15 @@ Props) => {
190191
filters={filter}
191192
headerCols={headerCols}
192193
tableRows={filteredConnectors}
193-
emptyState={{ text: translate('emptyState.text') }}
194+
emptyState={
195+
filter[0]?.value
196+
? {
197+
text: translate('emptyState.text'),
198+
}
199+
: {
200+
text: `Nothing to see here, it seems like no service connecter has been configured yet.`,
201+
}
202+
}
194203
trOnClick={openDetailPage}
195204
/>
196205
<If condition={connectorsPaginated.totalitem > 5}>

src/ui/layouts/pipelines/Pipelines/AllRuns/index.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,11 @@ export const AllRuns: React.FC<Props> = ({
3636
getSorted={getSorted}
3737
paginated={runsPaginated}
3838
fetching={fetching}
39-
emptyStateText={translate('emptyState.text')}
39+
emptyStateText={
40+
filter[0]?.value
41+
? translate('emptyState.text')
42+
: `Nothing to see here, it seems like no run has been configured yet.`
43+
}
4044
runIds={runIds}
4145
fromAllruns={true}
4246
filter={filter}

src/ui/layouts/pipelines/Pipelines/List/index.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,15 @@ export const List: React.FC<Props> = ({
138138
filters={filter}
139139
headerCols={headerCols}
140140
tableRows={filteredPipelines}
141-
emptyState={{ text: translate('emptyState.text') }}
141+
emptyState={
142+
filter[0]?.value
143+
? {
144+
text: translate('emptyState.text'),
145+
}
146+
: {
147+
text: `Nothing to see here, it seems like no pipeline has been configured yet.`,
148+
}
149+
}
142150
trOnClick={openDetailPage}
143151
/>
144152

src/ui/layouts/secrets/Secrets/List/index.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ Props) => {
167167
return (
168168
<>
169169
<CollapseTable
170+
route={routePaths.secrets.registerSecrets(selectedWorkspace)}
170171
renderAfterRow={(secret: any) => (
171172
<>
172173
{/* <RunsForSecretTable
@@ -187,7 +188,15 @@ Props) => {
187188
filters={filter}
188189
headerCols={headerCols}
189190
tableRows={filteredSecrets}
190-
emptyState={{ text: translate('emptyState.text') }}
191+
emptyState={
192+
filter[0]?.value
193+
? {
194+
text: translate('emptyState.text'),
195+
}
196+
: {
197+
text: `Nothing to see here, it seems like no secret has been configured yet.`,
198+
}
199+
}
191200
trOnClick={openDetailPage}
192201
/>
193202
<If condition={secretsPaginated.totalitem > 5}>

src/ui/layouts/stackComponents/Stacks/List/index.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,10 @@ Props) => {
134134
return (
135135
<>
136136
<CollapseTable
137+
route={routePaths.stackComponents.registerComponents(
138+
locationPath.split('/')[4],
139+
selectedWorkspace,
140+
)}
137141
renderAfterRow={(stack: TStack) => (
138142
<RunsForStackTable
139143
nestedRow={true}
@@ -255,6 +259,7 @@ Props) => {
255259
);
256260
}}
257261
>
262+
{selectedWorkspace}
258263
Register New Component
259264
</PrimaryButton>
260265
</Box>

src/ui/layouts/stacks/Stacks/List/index.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ export const List: React.FC<Props> = ({
178178
/>
179179
</>
180180
)}
181+
route={routePaths.stacks.createStack(selectedWorkspace)}
181182
activeSorting={
182183
activeSortingDirection?.toLowerCase() + ':' + activeSorting
183184
}
@@ -188,7 +189,15 @@ export const List: React.FC<Props> = ({
188189
filters={filter}
189190
headerCols={headerCols}
190191
tableRows={filteredStacks}
191-
emptyState={{ text: translate('emptyState.text') }}
192+
emptyState={
193+
filter[0]?.value
194+
? {
195+
text: translate('emptyState.text'),
196+
}
197+
: {
198+
text: `Nothing to see here, it seems like no stack has been configured yet.`,
199+
}
200+
}
192201
trOnClick={openDetailPage}
193202
/>
194203
<If condition={stacksPaginated.totalitem > 5}>

0 commit comments

Comments
 (0)