Skip to content

Commit 4f691f2

Browse files
fn-faisalfaisal154
andauthored
* Refactor 1 * revert package.json * fixed settings. * client settings screen Co-authored-by: Faisal Nadeem <[email protected]>
1 parent 58dba76 commit 4f691f2

9 files changed

+1841
-1531
lines changed

package-lock.json

Lines changed: 1274 additions & 1098 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import React from 'react';
2+
3+
import Fieldset from 'components/Fieldset/Fieldset.react';
4+
import Field from 'components/Field/Field.react';
5+
import Label from 'components/Label/Label.react';
6+
import TextInput from 'components/TextInput/TextInput.react';
7+
import {
8+
DEFAULT_SETTINGS_LABEL_WIDTH
9+
} from 'dashboard/Settings/Fields/Constants';
10+
11+
export const AppInformationFields = ({
12+
appName,
13+
setAppName,
14+
inProduction,
15+
setInProduction,
16+
iTunesURL,
17+
setiTunesURL,
18+
googlePlayURL,
19+
setGooglePlayURL,
20+
windowsAppStoreURL,
21+
setWindowsAppStoreURL,
22+
webAppURL,
23+
setWebAppURL,
24+
otherURL,
25+
setOtherURL,
26+
}) => <Fieldset
27+
legend='App Information'
28+
description='Update general information about your app.'>
29+
<Field
30+
labelWidth={DEFAULT_SETTINGS_LABEL_WIDTH}
31+
label={<Label text='App name' />}
32+
input={<TextInput
33+
value={appName}
34+
onChange={setAppName} />
35+
} />
36+
</Fieldset>;
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import React from 'react';
2+
import Collaborators from 'dashboard/Settings/Collaborators.react';
3+
4+
export const CollaboratorsFields = ({
5+
collaborators,
6+
waiting_collaborators,
7+
ownerEmail,
8+
viewerEmail,
9+
addCollaborator,
10+
removeCollaborator,
11+
editCollaborator,
12+
}) => <Collaborators
13+
legend='Collaborators'
14+
description='Team up and work together with other people.'
15+
collaborators={collaborators}
16+
waiting_collaborators={waiting_collaborators}
17+
owner_email={ownerEmail}
18+
viewer_email={viewerEmail}
19+
onAdd={addCollaborator}
20+
onRemove={removeCollaborator}
21+
onEdit={editCollaborator} />;
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
export const DEFAULT_SETTINGS_LABEL_WIDTH = 55;
2+
export const numJobsFromRequestLimit = (limit) => Math.floor((limit-10)/20);
3+
4+
export const defaultParseOptions = {
5+
accountLockout: {
6+
duration: 5, // duration policy setting determines the number of minutes that a locked-out account remains locked out before automatically becoming unlocked. Set it to a value greater than 0 and less than 100000.
7+
threshold: 3, // threshold policy setting determines the number of failed sign-in attempts that will cause a user account to be locked. Set it to an integer value greater than 0 and less than 1000.
8+
},
9+
// optional settings to enforce password policies
10+
passwordPolicy: {
11+
// Two optional settings to enforce strong passwords. Either one or both can be specified.
12+
// If both are specified, both checks must pass to accept the password
13+
// 1. a RegExp object or a regex string representing the pattern to enforce
14+
validatorPattern: /^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.{8,})/, // enforce password with at least 8 char with at least 1 lower case, 1 upper case and 1 digit
15+
// 2. a callback function to be invoked to validate the password
16+
validationError: 'Password must contain at least 1 digit.', // optional error message to be sent instead of the default "Password does not meet the Password Policy requirements." message.
17+
doNotAllowUsername: true, // optional setting to disallow username in passwords
18+
maxPasswordAge: 90, // optional setting in days for password expiry. Login fails if user does not reset the password within this period after signup/last reset.
19+
maxPasswordHistory: 5, // optional setting to prevent reuse of previous n passwords. Maximum value that can be specified is 20. Not specifying it or specifying 0 will not enforce history.
20+
//optional setting to set a validity duration for password reset links (in seconds)
21+
resetTokenValidityDuration: 24*60*60, // expire after 24 hours
22+
}
23+
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import React from 'react';
2+
3+
import Fieldset from 'components/Fieldset/Fieldset.react';
4+
import Field from 'components/Field/Field.react';
5+
import Label from 'components/Label/Label.react';
6+
import Range from 'components/Range/Range.react';
7+
import { cost, features } from 'dashboard/Settings/GeneralSettings.scss';
8+
import {
9+
numJobsFromRequestLimit, DEFAULT_SETTINGS_LABEL_WIDTH
10+
} from 'dashboard/Settings/Fields/Constants';
11+
12+
export const CurrentPlan = ({requestLimit}) => {
13+
let costString = requestLimit === 30 ?
14+
'Free' :
15+
'$' + ((requestLimit-30) * 10).toString();
16+
return (
17+
<div>
18+
<div className={cost}>{costString}</div>
19+
<div className={features}>{requestLimit.toString() + ' requests per second'}<br/>{numJobsFromRequestLimit(requestLimit).toString() + ' background job' + (numJobsFromRequestLimit(requestLimit) > 1 ? 's' : '')}</div>
20+
</div>
21+
)};
22+
23+
export const CurrentPlanFields = ({
24+
visible,
25+
requestLimit,
26+
setRequestLimit,
27+
}) => visible ? <Fieldset
28+
legend='Current Plan'
29+
description={'Adjust your pricing and your app\u2019s request limit'}>
30+
<Field
31+
labelWidth={40}
32+
label={<Label
33+
text='Scale your app'
34+
description='This will take effect as soon as you save your changes.' />}
35+
input={<Range
36+
min={0}
37+
max={600}
38+
step={10}
39+
color='#169CEE'
40+
value={requestLimit}
41+
track={true}
42+
units={value => {
43+
let numJobs = numJobsFromRequestLimit(value);
44+
return value + 'req/s & ' + numJobs + ' job' + (numJobs == 1 ? '' : 's')
45+
}}
46+
width={220}
47+
onChange={limit => {
48+
if (limit < 30) {
49+
limit = 30;
50+
}
51+
setRequestLimit(limit);
52+
}} />} />
53+
<Field
54+
labelWidth={DEFAULT_SETTINGS_LABEL_WIDTH}
55+
label={<Label text='Your plan' />}
56+
input={<CurrentPlan requestLimit={requestLimit} />} />
57+
</Fieldset> : <noscript/>;

0 commit comments

Comments
 (0)