-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add --disable-admin-operations
flag in Compactor UI and Bucket UI
#6604
Changes from 2 commits
ff9612d
9096d15
dae9fbc
35c2658
bd1c4cb
a76bd25
7458b34
5a54e3c
ae25455
50db859
c10e213
394ef36
e57f82a
e37a913
9a7e8d0
ae665ab
14b27c5
680772b
d8a6064
e8aab6e
d5d92c8
e746386
69adc1a
b614c7c
dfa6093
f52b6e0
1222e87
af9dd43
89d9c40
61e6cb1
e7e0689
3b9a02e
4020bc4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -112,13 +112,14 @@ type bucketLsConfig struct { | |||||
} | ||||||
|
||||||
type bucketWebConfig struct { | ||||||
webRoutePrefix string | ||||||
webExternalPrefix string | ||||||
webPrefixHeaderName string | ||||||
webDisableCORS bool | ||||||
interval time.Duration | ||||||
label string | ||||||
timeout time.Duration | ||||||
webRoutePrefix string | ||||||
webExternalPrefix string | ||||||
webPrefixHeaderName string | ||||||
webDisableCORS bool | ||||||
interval time.Duration | ||||||
label string | ||||||
timeout time.Duration | ||||||
disableAdminOperations bool | ||||||
} | ||||||
|
||||||
type bucketReplicateConfig struct { | ||||||
|
@@ -203,6 +204,8 @@ func (tbc *bucketWebConfig) registerBucketWebFlag(cmd extkingpin.FlagClause) *bu | |||||
cmd.Flag("timeout", "Timeout to download metadata from remote storage").Default("5m").DurationVar(&tbc.timeout) | ||||||
|
||||||
cmd.Flag("label", "External block label to use as group title").StringVar(&tbc.label) | ||||||
|
||||||
cmd.Flag("disable-admin-operations", "Restrict access to Block Mark deletion and no compaction").Default("false").BoolVar(&tbc.disableAdminOperations) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto
Suggested change
|
||||||
return tbc | ||||||
} | ||||||
|
||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,8 @@ import styles from './blocks.module.css'; | |
import moment from 'moment'; | ||
import { Button, Modal, ModalBody, Form, Input, ModalHeader, ModalFooter } from 'reactstrap'; | ||
import { download } from './helpers'; | ||
import { FlagMap } from '../../../pages/flags/Flags'; | ||
import { useFetch } from '../../../hooks/useFetch'; | ||
|
||
export interface BlockDetailsProps { | ||
block: Block | undefined; | ||
|
@@ -40,6 +42,9 @@ export const BlockDetails: FC<BlockDetailsProps> = ({ block, selectBlock }) => { | |
} | ||
}; | ||
|
||
const { response: flagsRes } = useFetch<FlagMap>(`/api/v1/status/flags`); | ||
const disableAdminOperations = flagsRes?.data?.['disable-admin-operations'] || false; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's actually call this in BlocksContent and pass it to BlocksDetails as a prop, that way we won't be calling this every time we open a block detail page. This also won't change from block to block. |
||
|
||
return ( | ||
<div className={`${styles.blockDetails} ${block && styles.open}`}> | ||
{block && ( | ||
|
@@ -100,26 +105,30 @@ export const BlockDetails: FC<BlockDetailsProps> = ({ block, selectBlock }) => { | |
<Button>Download meta.json</Button> | ||
</a> | ||
</div> | ||
<div style={{ marginTop: '12px' }}> | ||
<Button | ||
onClick={() => { | ||
setModalAction('DELETION'); | ||
setDetailValue(''); | ||
}} | ||
> | ||
Mark Deletion | ||
</Button> | ||
</div> | ||
<div style={{ marginTop: '12px' }}> | ||
<Button | ||
onClick={() => { | ||
setModalAction('NO_COMPACTION'); | ||
setDetailValue(''); | ||
}} | ||
> | ||
Mark No Compaction | ||
</Button> | ||
</div> | ||
{!disableAdminOperations && ( | ||
<div style={{ marginTop: '12px' }}> | ||
<Button | ||
onClick={() => { | ||
setModalAction('DELETION'); | ||
setDetailValue(''); | ||
}} | ||
> | ||
Mark Deletion | ||
</Button> | ||
</div> | ||
)} | ||
{!disableAdminOperations && ( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can probably render both buttons, under a single conditional? |
||
<div style={{ marginTop: '12px' }}> | ||
<Button | ||
onClick={() => { | ||
setModalAction('NO_COMPACTION'); | ||
setDetailValue(''); | ||
}} | ||
> | ||
Mark No Compaction | ||
</Button> | ||
</div> | ||
)} | ||
<Modal isOpen={!!modalAction}> | ||
<ModalBody> | ||
<ModalHeader toggle={() => setModalAction('')}> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's make description a bit clearer.