Skip to content

Commit

Permalink
Merge pull request mozilla#2 from Avey777/dev
Browse files Browse the repository at this point in the history
Code optimization
  • Loading branch information
Avey777 authored Jun 13, 2023
2 parents ace1f8a + 8a45385 commit e417302
Showing 1 changed file with 16 additions and 36 deletions.
52 changes: 16 additions & 36 deletions client/app/pages/dashboards/components/ShareDashboardDialog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,52 +94,32 @@ class ShareDashboardDialog extends React.Component {
};

render() {
const { dialog, dashboard, hasOnlySafeQueries } = this.props;
const headerContent = this.constructor.headerContent;
const { dialog, dashboard } = this.props;

return (
<Modal {...dialog.props} title={headerContent} footer={null}>
<Modal {...dialog.props} title={this.constructor.headerContent} footer={null}>
<Form layout="horizontal">
{!hasOnlySafeQueries && (
{!this.props.hasOnlySafeQueries && (
<Form.Item>
<Alert
message="For your security, sharing is currently not supported for dashboards containing queries with text parameters. Consider changing the text parameters in your query to a different type."
type="error"
/>
</Form.Item>
)}

{this.enabled && (
<Form.Item label="Allow public access" {...this.formItemProps}>
<Switch
checked={dashboard.publicAccessEnabled}
onChange={this.onChange}
loading={this.state.saving}
data-test="PublicAccessEnabled"
/>
</Form.Item>
)}

<Form.Item label="Allow public access" {...this.formItemProps}>
<Switch
checked={dashboard.publicAccessEnabled}
onChange={this.onChange}
loading={this.state.saving}
disabled={!this.enabled}
data-test="PublicAccessEnabled"
/>
</Form.Item>
{dashboard.public_url && (
<>
<Form.Item>
<Alert
message={
<div>
Custom rule for hiding filter components when sharing links:
<br />
You can hide filter components by appending `&hide_filter={"{{"} component_name{"}}"}` to thesharing URL.
<br />
Example: http://{"{{"}ip{"}}"}:{"{{"}port{"}}"}/public/dashboards/{"{{"}id{"}}"}?p_country=ghana&p_site=10&hide_filter=country
</div>
}
type="warning"
/>
</Form.Item>

<Form.Item label="Secret address" {...this.formItemProps}>
<InputWithCopy value={dashboard.public_url} data-test="SecretAddress" />
</Form.Item>
</>
<Form.Item label="Secret address" {...this.formItemProps}>
<InputWithCopy value={dashboard.public_url} data-test="SecretAddress" />
</Form.Item>
)}
</Form>
</Modal>
Expand Down

0 comments on commit e417302

Please sign in to comment.