mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-22 08:28:35 +00:00
gds permission check (#7350)
This commit is contained in:
parent
83dc36f7ab
commit
8552307b45
1 changed files with 13 additions and 9 deletions
|
|
@ -13,6 +13,7 @@ import { Col, Container, Row } from 'react-bootstrap';
|
|||
import { useDataQueriesActions } from '@/_stores/dataQueriesStore';
|
||||
import { useQueryPanelActions } from '@/_stores/queryPanelStore';
|
||||
import { Tooltip } from 'react-tooltip';
|
||||
import { authenticationService } from '@/_services';
|
||||
|
||||
function DataSourcePicker({ dataSources, staticDataSources, darkMode, globalDataSources }) {
|
||||
const allUserDefinedSources = [...dataSources, ...globalDataSources];
|
||||
|
|
@ -21,6 +22,7 @@ function DataSourcePicker({ dataSources, staticDataSources, darkMode, globalData
|
|||
const navigate = useNavigate();
|
||||
const { createDataQuery } = useDataQueriesActions();
|
||||
const { setPreviewData } = useQueryPanelActions();
|
||||
const { admin } = authenticationService.currentSessionValue;
|
||||
|
||||
const handleChangeDataSource = (source) => {
|
||||
createDataQuery(source);
|
||||
|
|
@ -83,15 +85,17 @@ function DataSourcePicker({ dataSources, staticDataSources, darkMode, globalData
|
|||
<label className="form-label py-1" style={{ width: 'auto' }} data-cy={`label-avilable-ds`}>
|
||||
{`Available Datasources ${!isEmpty(allUserDefinedSources) ? '(' + allUserDefinedSources.length + ')' : 0}`}
|
||||
</label>
|
||||
<ButtonSolid
|
||||
size="sm"
|
||||
variant="ghostBlue"
|
||||
onClick={handleAddClick}
|
||||
data-cy={`landing-page-add-new-ds-button`}
|
||||
>
|
||||
<Plus style={{ height: '16px' }} fill="var(--indigo9)" />
|
||||
Add new
|
||||
</ButtonSolid>
|
||||
{admin && (
|
||||
<ButtonSolid
|
||||
size="sm"
|
||||
variant="ghostBlue"
|
||||
onClick={handleAddClick}
|
||||
data-cy={`landing-page-add-new-ds-button`}
|
||||
>
|
||||
<Plus style={{ height: '16px' }} fill="var(--indigo9)" />
|
||||
Add new
|
||||
</ButtonSolid>
|
||||
)}
|
||||
</div>
|
||||
{isEmpty(allUserDefinedSources) ? (
|
||||
<EmptyDataSourceBanner />
|
||||
|
|
|
|||
Loading…
Reference in a new issue