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 Jan 26, 2021
1 parent 3711e1e commit c0e6ef9
Show file tree
Hide file tree
Showing 18 changed files with 1,715 additions and 1,703 deletions.
7 changes: 5 additions & 2 deletions daikoku/app/controllers/UsersController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ class UsersController(DaikokuAction: DaikokuAction,

def allTenantUsers() = DaikokuAction.async { ctx =>
TenantAdminOnly(
AuditTrailEvent("@{user.name} has accessed all users list"))(ctx.tenant.id.value, ctx) { (_, _) =>
AuditTrailEvent("@{user.name} has accessed all users list"))(
ctx.tenant.id.value,
ctx) { (_, _) =>
env.dataStore.userRepo.findAllNotDeleted().map { users =>
Ok(JsArray(users.map(_.asSimpleJson)))
}
Expand Down Expand Up @@ -59,7 +61,8 @@ class UsersController(DaikokuAction: DaikokuAction,
Conflict(Json.obj("error" -> "user have already this status")))
case Some(user) =>
val userToSave = user.copy(isDaikokuAdmin = isDaikokuAdmin)
env.dataStore.userRepo.save(userToSave)
env.dataStore.userRepo
.save(userToSave)
.map(_ => Ok(userToSave.asJson))
case None =>
FastFuture.successful(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,13 @@ export class TeamApiInfo extends Component {
type: 'markdown',
props: {
label: t('Custom header', this.props.currentLanguage),
help: t('api.custom.header.help', this.props.currentLanguage, false, `Use {{title}} to insert API title, {{ description }} to insert API small description.
Add "btn-edit" class to link to admin API edition admin page.`)
help: t(
'api.custom.header.help',
this.props.currentLanguage,
false,
`Use {{title}} to insert API title, {{ description }} to insert API small description.
Add "btn-edit" class to link to admin API edition admin page.`
),
},
},
currentVersion: {
Expand Down
39 changes: 21 additions & 18 deletions daikoku/javascript/src/components/frontend/api/ApiHome.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,35 +32,36 @@ const ApiDescription = ({ api }) => {
);
};

const ApiHeader = ({api, ownerTeam, editUrl, history}) => {
const ApiHeader = ({ api, ownerTeam, editUrl, history }) => {
const handleBtnEditClick = () => history.push(editUrl);

useEffect(() => {
//fo custom header component
var els = document.querySelectorAll('.btn-edit');

if (els.length) {
els.forEach(el => el.addEventListener('click', handleBtnEditClick, false));
els.forEach((el) => el.addEventListener('click', handleBtnEditClick, false));
return () => {
els.forEach(el => el.removeEventListener('click', handleBtnEditClick, false));
els.forEach((el) => el.removeEventListener('click', handleBtnEditClick, false));
};
}
}, []);


const EditButton = () => <Can I={manage} a={API} team={ownerTeam}>
<Link to={editUrl} className="team__settings ml-2">
<button type="button" className="btn btn-sm btn-access-negative">
<i className="fas fa-edit" />
</button>
</Link>
</Can>;
const EditButton = () => (
<Can I={manage} a={API} team={ownerTeam}>
<Link to={editUrl} className="team__settings ml-2">
<button type="button" className="btn btn-sm btn-access-negative">
<i className="fas fa-edit" />
</button>
</Link>
</Can>
);

if (api.header) {
const apiHeader = api.header
.replace('{{title}}', api.name)
.replace('{{description}}', api.smallDescription);

return (
<section className="api__header col-12 mb-4">
<div
Expand Down Expand Up @@ -115,7 +116,7 @@ const ApiHomeComponent = ({
Services.getVisibleApi(apiId),
Services.getMySubscriptions(apiId),
Services.myTeams(),
]).then(([api, {subscriptions, requests}, teams]) => {
]).then(([api, { subscriptions, requests }, teams]) => {
if (api.error) {
setError({ error: { status: 404, message: api.error } });
} else {
Expand Down Expand Up @@ -171,8 +172,10 @@ const ApiHomeComponent = ({
};

const editUrl = (api) => {
return Option(myTeams.find((team) => api.team === team._id))
.fold(() => '#', adminTeam => `/${adminTeam._humanReadableId}/settings/apis/${api._humanReadableId}`);
return Option(myTeams.find((team) => api.team === team._id)).fold(
() => '#',
(adminTeam) => `/${adminTeam._humanReadableId}/settings/apis/${api._humanReadableId}`
);
};

if (!api || !ownerTeam) {
Expand All @@ -190,7 +193,7 @@ const ApiHomeComponent = ({

return (
<main role="main" className="row">
<ApiHeader api={api} ownerTeam={ownerTeam} editUrl={editUrl(api)} history={history}/>
<ApiHeader api={api} ownerTeam={ownerTeam} editUrl={editUrl(api)} history={history} />
<div className="container">
<div className="row">
<div className="col mt-3 onglets">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ Proin vehicula ligula vel enim euismod, sed congue mi egestas. Nullam varius ut
return (
<div className="d-flex flex-column">
<label htmlFor={`input-${props.label}`} className="col-form-label d-flex align-items-center">
<Help place="right" text={props.help} label={props.label}/>
<Help place="right" text={props.help} label={props.label} />
</label>
<div
style={{
Expand Down
2 changes: 1 addition & 1 deletion daikoku/javascript/src/components/utils/BeautifulTitle.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import ReactToolTip from 'react-tooltip';
import {v4 as uuid} from 'uuid';
import { v4 as uuid } from 'uuid';

export const BeautifulTitle = ({ title, children, place, ...props }) => {
const id = uuid();
Expand Down
Loading

0 comments on commit c0e6ef9

Please sign in to comment.