Skip to content

Commit

Permalink
Update documentation before release
Browse files Browse the repository at this point in the history
  • Loading branch information
daikoku-github-actions committed Nov 24, 2020
1 parent 761417a commit edaef50
Show file tree
Hide file tree
Showing 28 changed files with 351 additions and 289 deletions.
3 changes: 2 additions & 1 deletion daikoku/app/env/env.scala
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@ class Config(val underlying: Configuration) {

lazy val tenantJwtAlgo: Algorithm = Algorithm.HMAC512(signingKey)

lazy val tenantJwtVerifier: JWTVerifier = JWT.require(tenantJwtAlgo).acceptLeeway(10).build()
lazy val tenantJwtVerifier: JWTVerifier =
JWT.require(tenantJwtAlgo).acceptLeeway(10).build()

lazy val isProd: Boolean = mode == DaikokuMode.Prod
lazy val isDev: Boolean = mode == DaikokuMode.Dev
Expand Down
3 changes: 2 additions & 1 deletion daikoku/app/login/otoroshi.scala
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ object OtoroshiIdentityFilter {
val claimHeaderName =
tenant.authProviderSettings.\("claimHeaderName").as[String]
val otoroshiJwtAlgo = Algorithm.HMAC512(claimSecret)
val otoroshiJwtVerifier = JWT.require(otoroshiJwtAlgo).acceptLeeway(10).build()
val otoroshiJwtVerifier =
JWT.require(otoroshiJwtAlgo).acceptLeeway(10).build()

request.headers.get(claimHeaderName) match {
case None =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -510,9 +510,9 @@ export class TenantEditComponent extends Component {
type: 'markdown',
props: { label: t('Footer', this.props.currentLanguage) },
},
'defaultMessage': {
defaultMessage: {
type: 'markdown',
props: { label: t('Default message', this.props.currentLanguage) }
props: { label: t('Default message', this.props.currentLanguage) },
},
isPrivate: {
type: 'bool',
Expand Down Expand Up @@ -775,10 +775,8 @@ export class TenantEditComponent extends Component {
});
} else {
return Services.saveTenant(this.state.tenant)
.then(this.props.updateTenant)
.then(() =>
toastr.success(t('Tenant updated successfully', this.props.currentLanguage))
);
.then(this.props.updateTenant)
.then(() => toastr.success(t('Tenant updated successfully', this.props.currentLanguage)));
}
};

Expand Down Expand Up @@ -868,7 +866,7 @@ const mapStateToProps = (state) => ({

const mapDispatchToProps = {
openSaveOrCancelModal: (modalProps) => openSaveOrCancelModal(modalProps),
updateTenant: (t) => updateTenant(t)
updateTenant: (t) => updateTenant(t),
};

export const TenantEdit = connect(mapStateToProps, mapDispatchToProps)(TenantEditComponent);
58 changes: 32 additions & 26 deletions daikoku/javascript/src/components/backoffice/TeamBackOffice.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,32 +209,38 @@ class TeamBackOfficeComponent extends Component {
)}
</h6>
<ul className="nav flex-column mt-3">
{(!this.props.tenant.creationSecurity || this.props.currentTeam.apisCreationPermission) &&
<Can I={read} a={api} team={this.props.currentTeam}>
<li className="nav-item">
<Link
className={`nav-link ${tab === 'Apis' ? 'active' : ''}`}
to={`/${currentTeam._humanReadableId}/settings/apis`}>
<i className="fas fa-atlas" />
<Translation i18nkey="Team Apis" language={this.props.currentLanguage}>
Team Apis
</Translation>
</Link>
</li>
</Can>}
{(!this.props.tenant.creationSecurity || this.props.currentTeam.apisCreationPermission) &&
<Can I={read} a={api} team={this.props.currentTeam}>
<li className="nav-item">
<Link
className={`nav-link ${tab === 'Income' ? 'active' : ''}`}
to={`/${currentTeam._humanReadableId}/settings/income`}>
<i className="fas fa-file-invoice-dollar" />
<Translation i18nkey="Team Income" language={this.props.currentLanguage}>
Team Income
</Translation>
</Link>
</li>
</Can>}
{(!this.props.tenant.creationSecurity ||
this.props.currentTeam.apisCreationPermission) && (
<Can I={read} a={api} team={this.props.currentTeam}>
<li className="nav-item">
<Link
className={`nav-link ${tab === 'Apis' ? 'active' : ''}`}
to={`/${currentTeam._humanReadableId}/settings/apis`}>
<i className="fas fa-atlas" />
<Translation i18nkey="Team Apis" language={this.props.currentLanguage}>
Team Apis
</Translation>
</Link>
</li>
</Can>
)}
{(!this.props.tenant.creationSecurity ||
this.props.currentTeam.apisCreationPermission) && (
<Can I={read} a={api} team={this.props.currentTeam}>
<li className="nav-item">
<Link
className={`nav-link ${tab === 'Income' ? 'active' : ''}`}
to={`/${currentTeam._humanReadableId}/settings/income`}>
<i className="fas fa-file-invoice-dollar" />
<Translation
i18nkey="Team Income"
language={this.props.currentLanguage}>
Team Income
</Translation>
</Link>
</li>
</Can>
)}
<Can I={read} a={apikey} team={this.props.currentTeam}>
<li className="nav-item">
<Link
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class TeamApiKeysForApiComponent extends Component {
'rotation.error.message',
this.props.currentLanguage,
false,
'You can\'t toggle rotation because of plan rotation is forced to enabled'
"You can't toggle rotation because of plan rotation is forced to enabled"
)
);
}
Expand Down Expand Up @@ -139,14 +139,14 @@ class TeamApiKeysForApiComponent extends Component {
searched === ''
? this.state.subscriptions
: this.state.subscriptions.filter((subs) => {
if (subs.customName && subs.customName.toLowerCase().includes(searched)) {
return true;
} else if (subs.apiKey.clientId.toLowerCase().includes(searched)) {
return true;
} else {
return formatPlanType(this.currentPlan(subs)).toLowerCase().includes(searched);
}
});
if (subs.customName && subs.customName.toLowerCase().includes(searched)) {
return true;
} else if (subs.apiKey.clientId.toLowerCase().includes(searched)) {
return true;
} else {
return formatPlanType(this.currentPlan(subs)).toLowerCase().includes(searched);
}
});
const sortedApiKeys = _.sortBy(filteredApiKeys, ['plan', 'customName']);

return (
Expand Down Expand Up @@ -281,7 +281,7 @@ const ApiKeyCard = ({

useEffect(() => {
if (rotationEvery < 0) {
setError({ ...error, rotationEvery: 'value can\'t be negative' });
setError({ ...error, rotationEvery: "value can't be negative" });
} else {
delete error.rotationEvery;
setError(error);
Expand All @@ -290,9 +290,9 @@ const ApiKeyCard = ({

useEffect(() => {
if (gracePeriod < 0) {
setError({ ...error, gracePeriod: 'value can\'t be negative' });
setError({ ...error, gracePeriod: "value can't be negative" });
} else if (gracePeriod > rotationEvery) {
setError({ ...error, gracePeriod: 'value can\'t be bigger than rotationEvery' });
setError({ ...error, gracePeriod: "value can't be bigger than rotationEvery" });
} else {
delete error.gracePeriod;
setError(error);
Expand Down Expand Up @@ -331,14 +331,17 @@ const ApiKeyCard = ({
{!settingMode &&
(!editMode ? (
<>
<BeautifulTitle title={customName} style={{
wordBreak: 'break-all',
marginBlockEnd: '0',
whiteSpace: 'nowrap',
maxWidth: '85%',
overflow: 'hidden',
textOverflow: 'ellipsis',
}} className="plan-name">
<BeautifulTitle
title={customName}
style={{
wordBreak: 'break-all',
marginBlockEnd: '0',
whiteSpace: 'nowrap',
maxWidth: '85%',
overflow: 'hidden',
textOverflow: 'ellipsis',
}}
className="plan-name">
{customName}
</BeautifulTitle>
<button
Expand All @@ -350,26 +353,26 @@ const ApiKeyCard = ({
</button>
</>
) : (
<div className="input-group">
<input
type="text"
className="form-control"
value={customName}
ref={inputRef}
onChange={(e) => setCustomName(e.target.value)}
/>
<div className="input-group-append">
<span
className="input-group-text cursor-pointer"
onClick={handleCustomNameChange}>
<i className="fas fa-check accept" />
</span>
<span className="input-group-text cursor-pointer" onClick={abortCustomNameEdit}>
<i className="fas fa-times escape a-fake" />
</span>
</div>
<div className="input-group">
<input
type="text"
className="form-control"
value={customName}
ref={inputRef}
onChange={(e) => setCustomName(e.target.value)}
/>
<div className="input-group-append">
<span
className="input-group-text cursor-pointer"
onClick={handleCustomNameChange}>
<i className="fas fa-check accept" />
</span>
<span className="input-group-text cursor-pointer" onClick={abortCustomNameEdit}>
<i className="fas fa-times escape a-fake" />
</span>
</div>
))}
</div>
))}
{settingMode && (
<h3>
<Translation i18nkey="ApiKey rotation" language={currentLanguage}>
Expand Down
32 changes: 16 additions & 16 deletions daikoku/javascript/src/components/backoffice/me/MyProfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -334,21 +334,20 @@ class MyProfileComponent extends Component {
if (this.state.user.name && this.state.user.email && this.state.user.picture) {
const emailValidation = ValidateEmail(this.state.user.email);
if (emailValidation.ok) {
Services.updateUserById(this.state.user)
.then((user) => {
this.setState({ user }, () => {
this.props.updateUser(user);
toastr.success(
t(
'user.updated.success',
this.props.currentLanguage,
false,
'user successfully updated',
user.name
)
);
});
Services.updateUserById(this.state.user).then((user) => {
this.setState({ user }, () => {
this.props.updateUser(user);
toastr.success(
t(
'user.updated.success',
this.props.currentLanguage,
false,
'user successfully updated',
user.name
)
);
});
});
} else {
toastr.error(emailValidation.error);
}
Expand Down Expand Up @@ -397,8 +396,9 @@ class MyProfileComponent extends Component {
marginBottom: 20,
}}>
<img
src={`${this.state.user.picture}${this.state.user.picture.startsWith('http') ? '' : `?${Date.now()}`
}`}
src={`${this.state.user.picture}${
this.state.user.picture.startsWith('http') ? '' : `?${Date.now()}`
}`}
style={{
width: 200,
borderRadius: '50%',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export class ApiCartidge extends Component {
</ActionWithTeamSelector>
</Can>
)}

{defaultPlan && !defaultPlan.otoroshiTarget && (
<small className="mt-5">
<Translation i18nkey="api not linked" language={this.props.currentLanguage}>
Expand Down
Loading

0 comments on commit edaef50

Please sign in to comment.