Skip to content
This repository has been archived by the owner on Jun 10, 2021. It is now read-only.

Commit

Permalink
Deprecate flags 2_factor, audit_webhooks, edit_account,fine_permissio…
Browse files Browse the repository at this point in the history
…ns, manage_chargebee, segments, webhooks
  • Loading branch information
kyle-ssg committed Jul 12, 2020
1 parent 678d360 commit b087e1e
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 116 deletions.
12 changes: 4 additions & 8 deletions common/providers/Permission.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,17 @@ const Permission = class extends Component {
}

componentDidMount() {
if (this.props.hasFeature('fine_permissions')) {
const isLoading = !PermissionsStore.getPermissions(this.props.id, this.props.level) || !Object.keys(PermissionsStore.getPermissions(this.props.id, this.props.level)).length;
if (isLoading) {
AppActions.getPermissions(this.props.id, this.props.level);
}
const isLoading = !PermissionsStore.getPermissions(this.props.id, this.props.level) || !Object.keys(PermissionsStore.getPermissions(this.props.id, this.props.level)).length;
if (isLoading) {
AppActions.getPermissions(this.props.id, this.props.level);
}
this.listenTo(PermissionsStore, 'change', () => {
this.forceUpdate();
});
}

render() {
if (!this.props.hasFeature('fine_permissions')) {
return this.props.children({ permission: true });
}
return this.props.children({ permission: true });
const permission = PermissionsStore.getPermission(this.props.id, this.props.level, this.props.permission);
const isLoading = !PermissionsStore.getPermissions(this.props.id, this.props.level) || !Object.keys(PermissionsStore.getPermissions(this.props.id, this.props.level)).length;
return this.props.children({ permission, isLoading }) || <div/>;
Expand Down
2 changes: 1 addition & 1 deletion web/components/modals/CreateFlag.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ const CreateFlag = class extends Component {
placeholder="e.g. 'This determines what size the header is' "
/>
</FormGroup>
{hasFeature('segments') && !identity && isEdit && (
{!identity && isEdit && (
<Permission level="project" permission="ADMIN" id={this.props.projectId}>
{({ permission: projectAdmin }) => projectAdmin && (

Expand Down
2 changes: 0 additions & 2 deletions web/components/pages/AccountSettingsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,7 @@ class TheComponent extends PureComponent {
</p>
</div>
<div className="col-md-6">
{this.props.hasFeature('2_factor') && (
<TwoFactor/>
) }
</div>
</div>
</div>
Expand Down
162 changes: 79 additions & 83 deletions web/components/pages/EnvironmentSettingsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ const EnvironmentSettingsPage = class extends Component {

componentDidMount = () => {
API.trackPage(Constants.pages.ENVIRONMENT_SETTINGS);
if (this.props.hasFeature('webhooks')) {
this.props.getWebhooks();
}
this.props.getWebhooks();
};

onSave = () => {
Expand Down Expand Up @@ -168,94 +166,92 @@ const EnvironmentSettingsPage = class extends Component {
<FormGroup className="mt-1">
<EditPermissions id={this.props.match.params.environmentId} level="environment"/>
</FormGroup>
{this.props.hasFeature('webhooks') && (
<FormGroup className="m-y-3">
<Row className="mb-3" space>
<div className="col-md-8 pl-0">
<h3 className="m-b-0">Feature Webhooks</h3>
<p>
<FormGroup className="m-y-3">
<Row className="mb-3" space>
<div className="col-md-8 pl-0">
<h3 className="m-b-0">Feature Webhooks</h3>
<p>
Feature webhooks let you know when features have changed, you can configure 1 or more feature webhooks per environment.
{' '}
<ButtonLink href="https://docs.bullet-train.io/system-administration/">Learn about feature webhooks.</ButtonLink>
</p>
</div>
<div className="col-md-4 pr-0">
<Button className="float-right" onClick={this.createWebhook}>
{' '}
<ButtonLink href="https://docs.bullet-train.io/system-administration/">Learn about feature webhooks.</ButtonLink>
</p>
</div>
<div className="col-md-4 pr-0">
<Button className="float-right" onClick={this.createWebhook}>
Create feature webhook
</Button>
</div>
</Row>
{webhooksLoading && !webhooks ? (
<Loader/>
) : (
<PanelSearch
id="webhook-list"
title={(
<Tooltip
title={<h6 className="mb-0">Webhooks <span className="icon ion-ios-information-circle"/></h6>}
place="right"
>
{Constants.strings.WEBHOOKS_DESCRIPTION}
</Tooltip>
</Button>
</div>
</Row>
{webhooksLoading && !webhooks ? (
<Loader/>
) : (
<PanelSearch
id="webhook-list"
title={(
<Tooltip
title={<h6 className="mb-0">Webhooks <span className="icon ion-ios-information-circle"/></h6>}
place="right"
>
{Constants.strings.WEBHOOKS_DESCRIPTION}
</Tooltip>
)}
className="no-pad"
icon="ion-md-cloud"
items={webhooks}
renderRow={webhook => (
<Row
onClick={() => {
this.editWebhook(webhook);
}} space className="list-item clickable cursor-pointer"
key={webhook.id}
>
<div>
<ButtonLink>
{webhook.url}
</ButtonLink>
<div className="list-item-footer faint">
className="no-pad"
icon="ion-md-cloud"
items={webhooks}
renderRow={webhook => (
<Row
onClick={() => {
this.editWebhook(webhook);
}} space className="list-item clickable cursor-pointer"
key={webhook.id}
>
<div>
<ButtonLink>
{webhook.url}
</ButtonLink>
<div className="list-item-footer faint">
Created
{' '}
{moment(webhook.created_date).format('DD/MMM/YYYY')}
</div>
</div>
<Row>
<Switch checked={webhook.enabled}/>
<button
id="delete-invite"
type="button"
onClick={(e) => {
e.stopPropagation();
e.preventDefault();
this.deleteWebhook(webhook);
}}
className="btn btn--with-icon ml-auto btn--remove"
>
<RemoveIcon/>
</button>
</Row>
</Row>
)}
renderNoResults={(
<Panel
id="users-list"
icon="ion-md-cloud"
title={(
<Tooltip
title={<h6 className="mb-0">Webhooks <span className="icon ion-ios-information-circle"/></h6>}
place="right"
>
{Constants.strings.WEBHOOKS_DESCRIPTION}
</Tooltip>
)}
{' '}
{moment(webhook.created_date).format('DD/MMM/YYYY')}
</div>
</div>
<Row>
<Switch checked={webhook.enabled}/>
<button
id="delete-invite"
type="button"
onClick={(e) => {
e.stopPropagation();
e.preventDefault();
this.deleteWebhook(webhook);
}}
className="btn btn--with-icon ml-auto btn--remove"
>
<RemoveIcon/>
</button>
</Row>
</Row>
)}
renderNoResults={(
<Panel
id="users-list"
icon="ion-md-cloud"
title={(
<Tooltip
title={<h6 className="mb-0">Webhooks <span className="icon ion-ios-information-circle"/></h6>}
place="right"
>
{Constants.strings.WEBHOOKS_DESCRIPTION}
</Tooltip>
)}
>
You currently have no webhooks configured for this environment.
</Panel>
)}
isLoading={this.props.webhookLoading}
/>
</Panel>
)}
</FormGroup>
isLoading={this.props.webhookLoading}
/>
)}
</FormGroup>

<FormGroup className="m-y-3">
<Row>
Expand Down
28 changes: 6 additions & 22 deletions web/components/pages/OrganisationSettingsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,7 @@ const OrganisationSettingsPage = class extends Component {
manageSubscriptionLoaded: true,
};
AppActions.getOrganisation(AccountStore.getOrganisation().id);
// todo could be a provider
const org = AccountStore.getOrganisation();
if (props.hasFeature('manage_chargbee') && org.subscription) {
this.state.manageSubscriptionLoaded = false;
data.get(`${Project.api}organisations/${org.id}/portal-url/`)
.then((res) => {
this.setState({
manageSubscriptionLoaded: true,
chargebeeURL: res.url,
});
});
}
if (this.props.hasFeature('audit_webhooks')) {
this.props.getWebhooks();
}
this.props.getWebhooks();
}

componentDidMount = () => {
Expand Down Expand Up @@ -432,7 +418,6 @@ const OrganisationSettingsPage = class extends Component {
</OrganisationProvider>
</div>
</FormGroup>
{this.props.hasFeature('audit_webhooks') && (
<div className="col-md-12">

<FormGroup className="m-y-3">
Expand All @@ -445,7 +430,7 @@ const OrganisationSettingsPage = class extends Component {
<p>
Audit webhooks let you know when audit logs occur, you can configure 1 or more audit webhooks per organisation.
{' '}
<ButtonLink href="https://docs.bullet-train.io/system-administration/">Learn about audit webhooks.</ButtonLink>
<ButtonLink href="https://docs.bullet-train.io/system-administration/">Learn about audit webhooks.</ButtonLink>
</p>
{webhooksLoading && !webhooks ? (
<Loader/>
Expand Down Expand Up @@ -486,10 +471,10 @@ const OrganisationSettingsPage = class extends Component {
id="delete-invite"
type="button"
onClick={(e) => {
e.stopPropagation();
e.preventDefault();
this.deleteWebhook(webhook);
}}
e.stopPropagation();
e.preventDefault();
this.deleteWebhook(webhook);
}}
className="btn btn--with-icon ml-auto btn--remove"
>
<RemoveIcon/>
Expand Down Expand Up @@ -518,7 +503,6 @@ const OrganisationSettingsPage = class extends Component {
)}
</FormGroup>
</div>
)}
<FormGroup className="mt-5">
<Row>
<Column className="d-flex pl-3">
Expand Down

0 comments on commit b087e1e

Please sign in to comment.