forked from getredash/redash
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow users to share aggregated usage information with us (getredash#…
…4108) * Initial commit of BeaconConsent component * Add comment about being able to change setting * Use <Text> correctly * Final version of consent screen * Show beacon consent message on homepage only if it wasn't enabled already. * Add consent setting to organization settings screen. * Add support for custom message in OrgSetting.save. * Implmenet consent saving. * If consent given, send extra data * Add HelpTrigger * Make CodeClimate happy * Wrap everything with DynamicComponent
- Loading branch information
1 parent
7f9bbd9
commit 51ad852
Showing
8 changed files
with
219 additions
and
34 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
import React, { useState } from 'react'; | ||
import { react2angular } from 'react2angular'; | ||
import Card from 'antd/lib/card'; | ||
import Button from 'antd/lib/button'; | ||
import Typography from 'antd/lib/typography'; | ||
import { clientConfig } from '@/services/auth'; | ||
import { HelpTrigger } from '@/components/HelpTrigger'; | ||
import DynamicComponent from '@/components/DynamicComponent'; | ||
import OrgSettings from '@/services/organizationSettings'; | ||
|
||
const Text = Typography.Text; | ||
|
||
export function BeaconConsent() { | ||
const [hide, setHide] = useState(false); | ||
|
||
if (!clientConfig.showBeaconConsentMessage || hide) { | ||
return null; | ||
} | ||
|
||
const hideConsentCard = () => { | ||
clientConfig.showBeaconConsentMessage = false; | ||
setHide(true); | ||
}; | ||
|
||
const confirmConsent = (confirm) => { | ||
let message = '🙏 Thank you.'; | ||
|
||
if (!confirm) { | ||
message = 'Settings Saved.'; | ||
} | ||
|
||
OrgSettings.save({ beacon_consent: confirm }, message) | ||
// .then(() => { | ||
// // const settings = get(response, 'settings'); | ||
// // this.setState({ settings, formValues: { ...settings } }); | ||
// }) | ||
.finally(hideConsentCard); | ||
}; | ||
|
||
return ( | ||
<DynamicComponent name="BeaconConsent"> | ||
<div className="m-t-10 tiled"> | ||
<Card | ||
title={( | ||
<> | ||
Would you be ok with sharing anonymous usage data with the Redash team?{' '} | ||
<HelpTrigger type="USAGE_DATA_SHARING" /> | ||
</> | ||
)} | ||
bordered={false} | ||
> | ||
<Text>Help Redash improve by automatically sending anonymous usage data:</Text> | ||
<div className="m-t-5"> | ||
<ul> | ||
<li> Number of users, queries, dashboards, alerts, widgets and visualizations.</li> | ||
<li> Types of data sources, alert destinations and visualizations.</li> | ||
</ul> | ||
</div> | ||
<Text>All data is aggregated and will never include any sensitive or private data.</Text> | ||
<div className="m-t-5"> | ||
<Button type="primary" className="m-r-5" onClick={() => confirmConsent(true)}> | ||
Yes | ||
</Button> | ||
<Button type="default" onClick={() => confirmConsent(false)}> | ||
No | ||
</Button> | ||
</div> | ||
<div className="m-t-15"> | ||
<Text type="secondary"> | ||
You can change this setting anytime from the <a href="settings/organization">Organization Settings</a> page. | ||
</Text> | ||
</div> | ||
</Card> | ||
</div> | ||
</DynamicComponent> | ||
); | ||
} | ||
|
||
export default function init(ngModule) { | ||
ngModule.component('beaconConsent', react2angular(BeaconConsent)); | ||
} | ||
|
||
init.init = true; |
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
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