Skip to content
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

Not operators #546

Merged
merged 4 commits into from
Dec 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 21 additions & 8 deletions frontend/common/project.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,31 @@
// Dev is unused
// module.exports = global.Project = {
// api: 'https://api-dev.flagsmith.com/api/v1/',
// flagsmithClientAPI: 'https://api.flagsmith.com/api/v1/',
// flagsmith: '8KzETdDeMY7xkqkSkY3Gsg', // This is our Bullet Train API key - Bullet Train runs on Bullet Train!
// debug: false,
// env: 'dev', // This is used for Sentry tracking
// maintenance: false, // trigger maintenance mode
// demoAccount: {
// email: '[email protected]',
// password: 'demo_account',
// },
// chargebee: {
// site: 'flagsmith-test',
// },
// };

module.exports = global.Project = {
api: 'https://api.flagsmith.com/api/v1/',
api: 'https://api-staging.flagsmith.com/api/v1/',
flagsmithClientAPI: 'https://api.flagsmith.com/api/v1/',
flagsmith: '4vfqhypYjcPoGGu8ByrBaj', // This is our Bullet Train API key - Bullet Train runs on Bullet Train!
env: 'prod', // This is used for Sentry tracking
sentry: 'https://[email protected]/5666694',
flagsmith: 'ENktaJnfLVbLifybz34JmX', // This is our Bullet Train API key - Bullet Train runs on Bullet Train!
env: 'staging', // This is used for Sentry tracking
maintenance: false, // trigger maintenance mode
cookieDomain: '.flagsmith.com',
excludeAnalytics: '[email protected]',
demoAccount: {
email: '[email protected]',
password: 'demo_account',
},
chargebee: {
site: 'flagsmith',
site: 'flagsmith-test',
},
assetUrl: 'https://cdn.flagsmith.com', // Location of the static files from build/, should contain a directory called static/
};
49 changes: 37 additions & 12 deletions frontend/web/components/modals/CreateSegment.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ const CreateSegment = class extends Component {
});
}

addRule = () => {
addRule = (type = 'ANY') => {
const rules = this.state.rules;
rules[0].rules = rules[0].rules.concat({
type: 'ANY',
type,
conditions: [
{ ...Constants.defaultRule },
],
Expand Down Expand Up @@ -127,7 +127,7 @@ const CreateSegment = class extends Component {
{i > 0 && (
<Row className="and-divider">
<Flex className="and-divider__line"/>
AND
{rule.type === 'ANY' ? 'AND' : 'AND NOT'}
<Flex className="and-divider__line"/>
</Row>
)}
Expand All @@ -144,16 +144,41 @@ const CreateSegment = class extends Component {
</div>
))}
</FormGroup>
{!readOnly && (
<div
onClick={this.addRule} style={{ marginTop: 20 }}
className="text-center"
>
<ButtonOutline data-test="add-rule" type="button">
<Row className="justify-content-center">
{!readOnly && (
<div
onClick={() => this.addRule('ANY')} style={{ marginTop: 20 }}
className="text-center"
>
<ButtonOutline data-test="add-rule" type="button">
Add AND Condition
</ButtonOutline>
</div>
)}
</ButtonOutline>
</div>
)}
{!readOnly && this.props.hasFeature('not_operator') && (
<div
onClick={() => this.addRule('NOT')} style={{ marginTop: 20 }}
className="text-center"
>
{
this.props.getValue('not_operator') ? (
<Tooltip title={(
<ButtonOutline className="ml-2 btn--outline-danger" data-test="add-rule" type="button">
Add AND NOT Condition
</ButtonOutline>
)}
>
{`Note: If using clientside evaluations on your SDK, this feature is only supported by the following SDKs: ${JSON.parse(flagsmith.getValue('not_operator'))}`}
</Tooltip>
) : (
<ButtonOutline className="ml-2 btn--outline-danger" data-test="add-rule" type="button">
Add AND NOT Condition
</ButtonOutline>
)
}
</div>
)}
</Row>
</div>
</div>
);
Expand Down
26 changes: 16 additions & 10 deletions frontend/web/components/pages/HomePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ const HomePage = class extends React.Component {
const { email, password, organisation_name, first_name, last_name } = this.state;
const redirect = Utils.fromParam().redirect ? `?redirect=${Utils.fromParam().redirect}` : '';
const isInvite = document.location.href.indexOf('invite') != -1;
const isSignup = (isInvite && document.location.href.indexOf('login') === -1) || document.location.href.indexOf('signup') != -1;
const isSignup = !projectOverrides.preventSignup && ((isInvite && document.location.href.indexOf('login') === -1) || document.location.href.indexOf('signup') != -1);
const disableSignup = Project.preventSignup && !isInvite && isSignup;
const oauths = [];
if (this.props.getValue('oauth_github')) {
Expand Down Expand Up @@ -298,15 +298,21 @@ const HomePage = class extends React.Component {
</AccountProvider>
</Card>

<Row className="justify-content-center mt-2">
Not got an account?{' '}
<Link id="existing-member-btn" to={`/signup${redirect}`}>
<ButtonLink className="ml-1" buttonText=" Sign up" />
</Link>
</Row>
<div className="mt-5 text-center text-small text-muted">
By signing up you agree to our <a style={{opacity:0.8}} target="_blank" className="text-small" href="https://flagsmith.com/terms-of-service/">Terms of Service</a> and <a style={{opacity:0.8}} target="_blank" className="text-small" href="https://flagsmith.com/privacy-policy/">Privacy Policy</a>
</div>
{!projectOverrides.preventSignup && (

<div>
<Row className="justify-content-center mt-2">
Not got an account?{' '}
<Link id="existing-member-btn" to={`/signup${redirect}`}>
<ButtonLink className="ml-1" buttonText=" Sign up" />
</Link>
</Row>
<div className="mt-5 text-center text-small text-muted">
By signing up you agree to our <a style={{opacity:0.8}} target="_blank" className="text-small" href="https://flagsmith.com/terms-of-service/">Terms of Service</a> and <a style={{opacity:0.8}} target="_blank" className="text-small" href="https://flagsmith.com/privacy-policy/">Privacy Policy</a>
</div>
</div>

)}
</React.Fragment>
) : (
<React.Fragment>
Expand Down
10 changes: 10 additions & 0 deletions frontend/web/styles/project/_buttons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ a, .btn, button{
&:hover {
background-color: darken($body-bg-dark,2);
}

&-danger {
border-color: $alert-danger-bg !important;
color: $alert-danger-bg !important;
}
}
&--with-icon {
background: none !important;
Expand Down Expand Up @@ -129,6 +134,11 @@ a, .btn, button{
&:hover {
background-color: white;
}

&-danger {
border-color: $alert-danger-bg !important;
color: $alert-danger-bg !important;
}
}

&--small {
Expand Down