forked from Sunbird-Obsrv/obsrv-web-console
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'enterprise-features' into release-enterprise
- Loading branch information
Showing
39 changed files
with
3,048 additions
and
187 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { createProxyMiddleware } from 'http-proxy-middleware'; | ||
import appConfig from '../../shared/resources/appConfig'; | ||
import { onError, onProxyReq, onProxyRes } from '../helpers/proxy'; | ||
import promEntities from '../resources/prometheusEntities' | ||
|
||
const entity = promEntities.config; | ||
const baseURL = appConfig.BASE_URL; | ||
|
||
export default { | ||
path: `${baseURL}/configV1`, | ||
name: 'config_ext', | ||
handler() { | ||
return createProxyMiddleware({ | ||
target: appConfig.CONFIG_API_EXT.URL, | ||
changeOrigin: true, | ||
pathRewrite: function (path: string, req: any) { return path.replace(`${baseURL}/configV1`, '') }, | ||
onProxyReq: onProxyReq({ entity }), | ||
onProxyRes: onProxyRes({ entity }), | ||
onError: onError({ entity }) | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
134 changes: 134 additions & 0 deletions
134
web-console-v2/src/components/ExpandingTable/ExpandingTableV1.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
import React from 'react'; | ||
import { Fragment } from 'react'; | ||
import * as _ from "lodash"; | ||
import { checkForMustFixConflict } from 'services/json-schema'; | ||
import { TableContainer, Table, TableBody, TableCell, TableHead, TableRow, Typography, Skeleton } from '@mui/material'; | ||
import { useTable, useFilters, Column, useExpanded } from 'react-table'; | ||
import MainCard from 'components/MainCard'; | ||
import ScrollX from 'components/ScrollX'; | ||
import HtmlTooltip from '../HtmlTooltip'; | ||
|
||
interface Props { | ||
columns: Column[]; | ||
data: []; | ||
updateMyData: (rowIndex: number, columnId: any, value: any) => void; | ||
skipPageReset: boolean; | ||
limitHeight: boolean; | ||
tHeadHeight?: number; | ||
renderRowSubComponent: any; | ||
showSearchBar: boolean, | ||
styles?: any; | ||
context?: Record<string, any> | ||
} | ||
|
||
function ReactTable({ columns, data, updateMyData, skipPageReset, limitHeight, tHeadHeight, renderRowSubComponent, showSearchBar, styles = {}, context = {} }: Props) { | ||
const tableSx = limitHeight ? { height: 'auto', overflowY: 'scroll' } : {}; | ||
const { disableRowColor = false } = context; | ||
const { | ||
getTableProps, | ||
getTableBodyProps, | ||
headerGroups, | ||
prepareRow, | ||
rows, | ||
visibleColumns, | ||
} = useTable( | ||
{ | ||
columns, | ||
data, | ||
getSubRows: (row: any) => row.subRows, | ||
}, | ||
useExpanded | ||
); | ||
|
||
return ( | ||
<TableContainer sx={tableSx}> | ||
<Table stickyHeader sx={{ borderCollapse: 'collapse' }} size="small" {...getTableProps()}> | ||
<TableHead sx={tHeadHeight ? { height: tHeadHeight } : {}}> | ||
{headerGroups.map((headerGroup, i) => ( | ||
<TableRow {...headerGroup.getHeaderGroupProps()} key={i}> | ||
{headerGroup.headers.map((column: any) => ( | ||
<HtmlTooltip | ||
disableFocusListener | ||
disableTouchListener | ||
title={ | ||
<> | ||
<Typography color="inherit">{column.render('tipText')}</Typography> | ||
<em>{"Editable - "}</em> <b>{`${column.render('editable')}`}</b> | ||
</> | ||
} | ||
key={i} | ||
placement="top-start" | ||
arrow | ||
> | ||
<TableCell sx={{ p: 0.5, ...styles }} {...column.getHeaderProps()}> | ||
<Typography variant="h5" textTransform='capitalize'>{column.render('Header')}</Typography> | ||
</TableCell> | ||
</HtmlTooltip> | ||
))} | ||
</TableRow> | ||
))} | ||
</TableHead> | ||
<TableBody {...getTableBodyProps()}> | ||
{headerGroups.map((group: any, i) => ( | ||
<TableRow {...group.getHeaderGroupProps()} key={i}> | ||
{group.headers.map((column: any, i:any) => ( | ||
<TableCell sx={{ ...styles }}{...column.getHeaderProps([{ className: column.className }])} key={i}> | ||
{column.canFilter ? column.render('Filter') : null} | ||
</TableCell> | ||
))} | ||
</TableRow> | ||
))} | ||
{rows.map((row: any, i: number) => { | ||
prepareRow(row); | ||
const [hasSevereConflict, areAllConflictsResolved] = checkForMustFixConflict(_.get(row, 'original')); | ||
|
||
const bgColor = () => { | ||
if (hasSevereConflict && !areAllConflictsResolved) return { bgcolor: `#FFEEEE` }; | ||
else if (hasSevereConflict && areAllConflictsResolved) return { bgcolor: `#EAFBEE` }; | ||
else if (row?.original?.isNewlyAdded) return { bgcolor: `#EAFBEE` }; | ||
else return {}; | ||
} | ||
|
||
return ( | ||
<Fragment key={i}> | ||
<TableRow {...row.getRowProps()} sx={{ ...(!disableRowColor && bgColor()) }}> | ||
{ | ||
row.cells.map((cell: any) => ( | ||
<TableCell sx={cell.column.errorBg ? { p: 0.5, ...styles } : { p: 0.5, ...styles }} {...cell.getCellProps()} key={i}> | ||
{cell.render('Cell')} | ||
</TableCell> | ||
)) | ||
} | ||
</TableRow> | ||
</Fragment> | ||
); | ||
})} | ||
</TableBody> | ||
</Table> | ||
</TableContainer> | ||
); | ||
} | ||
|
||
const ExpandingTable = ({ columns, data, updateMyData, skipPageReset, limitHeight, tHeadHeight, showSearchBar = true, styles = {}, context = {} }: any) => { | ||
|
||
return ( | ||
<MainCard content={false}> | ||
<ScrollX> | ||
<ReactTable | ||
columns={columns} | ||
data={data} | ||
updateMyData={updateMyData} | ||
renderRowSubComponent={null} | ||
skipPageReset={skipPageReset} | ||
limitHeight={limitHeight} | ||
tHeadHeight={tHeadHeight} | ||
showSearchBar={showSearchBar} | ||
styles={styles} | ||
context={context} | ||
/> | ||
</ScrollX> | ||
</MainCard> | ||
); | ||
}; | ||
|
||
export default ExpandingTable; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
import React from 'react'; | ||
// material-ui | ||
import { styled } from '@mui/material/styles'; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
web-console-v2/src/pages/Dataset/wizard/components/WizardNavigator.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import React from 'react'; | ||
import { DownloadOutlined } from '@ant-design/icons'; | ||
import _ from 'lodash'; | ||
import { Stack, Typography, Box, Button } from '@mui/material'; | ||
|
||
import AnimateButton from 'components/@extended/AnimateButton'; | ||
import { StandardWidthButton } from 'components/Styled/Buttons'; | ||
|
||
const WizardNavigator = ({ showPrevious, gotoPreviousSection, gotoNextSection, enableDownload, handleDownload, master, section = undefined, nextDisabled = false, edit }: any) => { | ||
|
||
return <Stack direction="row" justifyContent={showPrevious ? 'space-between' : 'flex-end'} mx={6}> | ||
|
||
{showPrevious && gotoPreviousSection && | ||
<Button | ||
variant="outlined" | ||
type="button" | ||
onClick={gotoPreviousSection} | ||
> | ||
<Typography variant="buttonSecondaryCTA">Previous</Typography> | ||
</Button> | ||
} | ||
|
||
<Box display="flex" justifyContent="space-evenly" alignItems="center"> | ||
{enableDownload && handleDownload && | ||
<Button | ||
startIcon={<DownloadOutlined style={{ fontSize: '1.25rem' }} />} | ||
sx={{ width: 'auto' }} | ||
type="button" | ||
onClick={handleDownload} | ||
variant='outlined' | ||
> | ||
<Typography variant="buttonSecondaryCTA">Download JSON Schema</Typography> | ||
</Button> | ||
} | ||
|
||
{gotoNextSection && | ||
<Button | ||
variant="contained" | ||
type="button" | ||
onClick={gotoNextSection} | ||
disabled={nextDisabled}> | ||
<Typography variant="button">Proceed</Typography> | ||
</Button> | ||
} | ||
</Box> | ||
</Stack> | ||
}; | ||
|
||
export default WizardNavigator; |
Oops, something went wrong.