Skip to content

Commit

Permalink
Update BigQueryConnectionModal to handle different storage bucket con…
Browse files Browse the repository at this point in the history
…figurations
  • Loading branch information
delfrrr committed Sep 2, 2024
1 parent 3619ff6 commit 7097089
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
17 changes: 14 additions & 3 deletions src/client/ConnectionModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ function SnowflakeConnectionModal ({ form }) {
}
function BigQueryConnectionModal ({ form }) {
const { dialog, projects } = useSelector(state => state.connection)
const env = useSelector(state => state.env)
const { DEKART_STORAGE } = env.variables
const { id, loading } = dialog
const dispatch = useDispatch()
const connection = useSelector(state => state.connection.list.find(s => s.id === id))
Expand Down Expand Up @@ -163,9 +165,18 @@ function BigQueryConnectionModal ({ form }) {
<Form.Item label='Connection Name' required name='connectionName'>
<Input />
</Form.Item>
<Form.Item label='Optional: Storage Bucket' extra={<>Google Cloud Storage bucket to permanently cache query results. Required to share map with other users.</>} name='cloudStorageBucket'>
<Input placeholder='my-gcs-bucket' disabled={nameChangeOnly} />
</Form.Item>
{DEKART_STORAGE === 'USER'
? (
<Form.Item label='Optional: Storage Bucket' extra={<>Google Cloud Storage bucket to permanently cache query results. Required to share map with other users.</>} name='cloudStorageBucket'>
<Input placeholder='my-gcs-bucket' disabled={nameChangeOnly} />
</Form.Item>
)
: (
<Form.Item label='Storage Bucket' required extra={<>Google Cloud Storage bucket to permanently cache query results.</>} name='cloudStorageBucket'>
<Input placeholder='my-gcs-bucket' disabled={nameChangeOnly} />
</Form.Item>
)}

</Form>
</div>
</Modal>
Expand Down
4 changes: 2 additions & 2 deletions src/server/dekart/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func (s Server) TestConnection(ctx context.Context, req *proto.TestConnectionReq
if !res.Success {
return res, nil
}
if req.Connection.CloudStorageBucket == "" {
if req.Connection.CloudStorageBucket == "" && os.Getenv("DEKART_STORAGE") == "USER" {
// if no bucket is provided, temp storage is used
return &proto.TestConnectionResponse{
Success: true,
Expand Down Expand Up @@ -440,7 +440,7 @@ func (s Server) ArchiveConnection(ctx context.Context, req *proto.ArchiveConnect
`update connections set
archived=true,
updated_at=now()
where id=$1 and author_email=$2`,
where id=$1`,
req.ConnectionId,
claims.Email,
)
Expand Down
1 change: 0 additions & 1 deletion src/server/dekart/report.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ func newUUID() string {
// getReport returns report by id, checks if user has access to it
func (s Server) getReport(ctx context.Context, reportID string) (*proto.Report, error) {
claims := user.GetClaims(ctx)
log.Debug().Interface("claims", claims).Msg("getReport")
if claims == nil {
log.Fatal().Msg("getReport require claims")
return nil, nil
Expand Down

0 comments on commit 7097089

Please sign in to comment.