Skip to content

Commit

Permalink
Merge pull request #586 from MAIF/darkmode
Browse files Browse the repository at this point in the history
Darkmode
  • Loading branch information
quentinovega authored Jul 31, 2023
2 parents 5156b40 + 28b3216 commit 6e07efa
Show file tree
Hide file tree
Showing 31 changed files with 10,800 additions and 10,438 deletions.
13 changes: 7 additions & 6 deletions daikoku/app/env/evolutions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -785,14 +785,15 @@ object evolution_1613_b extends EvolutionScript {
val motivation = (action \ "motivation").asOpt[String]

(for {
api <- OptionT(dataStore.apiRepo.forAllTenant().findById(apiId))
plan <- OptionT.fromOption[Future](api.possibleUsagePlans.find(_.id == planId))
api <- OptionT(dataStore.apiRepo.forAllTenant().findOneRaw(Json.obj("_id" -> apiId.asJson)))
plan <- OptionT.fromOption[Future]((api \ "possibleUsagePlans").as[JsArray].value.find(plan => (plan \ "_id").as[String] == planId.value))
demand = SubscriptionDemand(
id = SubscriptionDemandId(IdGenerator.token),
tenant = tenant,
api = api.id,
plan = plan.id,
steps = plan.subscriptionProcess.map(step => SubscriptionDemandStep(
api = apiId,
plan = (plan \ "_id").as(json.UsagePlanIdFormat),
steps = (plan \ "subscriptionProcess").as(json.SeqValidationStepFormat)
.map(step => SubscriptionDemandStep(
id = SubscriptionDemandStepId(IdGenerator.token),
state = SubscriptionDemandState.InProgress,
step = step,
Expand Down Expand Up @@ -823,7 +824,7 @@ object evolution_1613_b extends EvolutionScript {
motivation = motivation
)
)
_ <- OptionT.liftF(dataStore.notificationRepo.forTenant(demand.tenant).save(notif))
result <- OptionT.liftF(dataStore.notificationRepo.forTenant(demand.tenant).save(notif))
} yield ()).value
}
.runWith(Sink.ignore)(mat)
Expand Down
7 changes: 7 additions & 0 deletions daikoku/app/storage/api.scala
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ trait Repo[Of, Id <: ValueType] {
def findWithProjection(query: JsObject, projection: JsObject)(
implicit ec: ExecutionContext): Future[Seq[JsObject]]

def findOneRaw(query: JsObject)(
implicit ec: ExecutionContext): Future[Option[JsValue]]

def findOne(query: JsObject)(
implicit ec: ExecutionContext): Future[Option[Of]]

Expand Down Expand Up @@ -188,6 +191,10 @@ trait Repo[Of, Id <: ValueType] {
implicit ec: ExecutionContext): Future[Seq[Of]] =
find(query ++ Json.obj("_deleted" -> false), maxDocs = maxDocs, sort = sort)

def findOneNotDeletedRaw(query: JsObject)(
implicit ec: ExecutionContext): Future[Option[JsValue]] =
findOneRaw(query ++ Json.obj("_deleted" -> false))

def findOneNotDeleted(query: JsObject)(
implicit ec: ExecutionContext): Future[Option[Of]] =
findOne(query ++ Json.obj("_deleted" -> false))
Expand Down
9 changes: 9 additions & 0 deletions daikoku/app/storage/drivers/mongo/MongoDataStore.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1330,6 +1330,15 @@ abstract class CommonMongoRepo[Of, Id <: ValueType](
.flatMapConcat(res =>
Source(res.toList.map(format.reads).filter(_.isSuccess).map(_.get)))

override def findOneRaw(query: JsObject)(implicit ec: ExecutionContext): Future[Option[JsValue]] =
collection.flatMap {
col =>
logger.debug(s"$collectionName.findOne(${Json.prettyPrint(query)})")
col
.find(query, None)
.one[JsObject](ReadPreference.primaryPreferred)
}

override def findOne(query: JsObject)(
implicit ec: ExecutionContext): Future[Option[Of]] = collection.flatMap {
col =>
Expand Down
19 changes: 17 additions & 2 deletions daikoku/app/storage/drivers/postgres/PostgresDataStore.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1541,7 +1541,7 @@ abstract class CommonRepo[Of, Id <: ValueType](env: Env, reactivePg: ReactivePg)
Source
.future(
reactivePg
.querySeq(s"SELECT * FROM $tableName $selector") { row =>
.querySeq(s"SELECT * FROM $tableName $selector", params) { row =>
row.optJsObject("content")
}
)
Expand All @@ -1559,14 +1559,29 @@ abstract class CommonRepo[Of, Id <: ValueType](env: Env, reactivePg: ReactivePg)
Source
.future(
reactivePg
.querySeq(s"SELECT * FROM $tableName $selector") { row =>
.querySeq(s"SELECT * FROM $tableName $selector", params) { row =>
row.optJsObject("content")
}
)
.flatMapConcat(res =>
Source(res.toList.map(format.reads).filter(_.isSuccess).map(_.get)))
}

override def findOneRaw(query: JsObject)(implicit ec: ExecutionContext): Future[Option[JsValue]] = {
val (sql, params) = convertQuery(query)
logger.debug(s"$tableName.findOneRaw(${Json.prettyPrint(query)})")
logger.debug(s"[query] :: SELECT * FROM $tableName WHERE $sql LIMIT 1")
logger.debug(s"[PARAMS] :: ${params.mkString(" - ")}")

reactivePg
.queryOne(s"SELECT * FROM $tableName WHERE " + sql + " LIMIT 1", params) {
row =>
logger.debug(s"[ROW] :: ${row.deepToString()}")
logger.debug(s"[ROW] :: ${row.toJson}")
row.optJsObject("content")
}
}

override def findOne(query: JsObject)(
implicit ec: ExecutionContext): Future[Option[Of]] = {
val (sql, params) = convertQuery(query)
Expand Down
14 changes: 7 additions & 7 deletions daikoku/javascript/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion daikoku/javascript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"@dnd-kit/sortable": "7.0.1",
"@dnd-kit/utilities": "3.2.1",
"@fortawesome/fontawesome-free": "6.2.1",
"@maif/react-forms": "^1.4.0",
"@maif/react-forms": "^1.6.0",
"@popperjs/core": "^2.11.6",
"@tanstack/react-query": "4.20.2",
"@tanstack/react-table": "^8.7.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export const AuditTrailList = () => {
className="btn btn-sm btn-outline-primary"
onClick={() => alert({
title: translate('Event.details.modal.title'),
message: <pre style={{ backgroundColor: '#eeeeee', padding: 10 }}>
message: <pre style={{ backgroundColor: '#{"var(--section-bg-color, #f8f9fa)"}', color:'#{"var(--section-text-color, #6c757d)"}', padding: 10 }}>
{JSON.stringify(value, null, 2)}
</pre>
})}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ export const TeamApiDocumentation = (props: TeamApiDocumentationProps) => {
<div className="d-flex justify-content-between align-items-center">
<div className="btn-group ms-2">
<button onClick={addNewPage} type="button" className="btn btn-sm btn-outline-success">
<i className="fas fa-plus" />
Add page
</button>
{versions.length > 1 &&
<button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,8 @@ export const TeamBilling = () => {
<div className="row month__and__total">
<div className="col-12 month__selector d-flex align-items-center">
<MonthPicker updateDate={setDate} value={date} />
<button className="btn btn-sm btn-access-negative" onClick={sync}>
<i className="fas fa-sync-alt ms-1" />
<button className="btn btn-sm btn-access-negative ms-1" onClick={sync}>
<i className="fas fa-sync-alt" />
</button>
{getLastDate()}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export const TeamIncome = () => {
setDate(date);
getBillingData(date);
}} value={date} />
<button className="btn btn-sm btn-access-negative" onClick={sync}>
<button className="btn btn-sm btn-access-negative ms-1" onClick={sync}>
<i className="fas fa-sync-alt" />
</button>
{lastDate ? (<i className="ms-1">
Expand Down
38 changes: 10 additions & 28 deletions daikoku/javascript/src/components/frontend/api/StarsButton.tsx
Original file line number Diff line number Diff line change
@@ -1,41 +1,23 @@
import React from 'react';
import React from "react";

const StarsButton = ({
stars,
toggleStar,
starred,
connectedUser
}: any) => (
<div
className="d-flex flex-row"
style={{
borderRadius: '4px',
border: '1px solid',
overflow: 'hidden',
boxSizing: 'content-box',
borderColor: 'var(--btn-border-color, #97b0c7)',
backgroundColor: 'var(--btn-border-color, #fff)',
fontSize: '18px',
}}
>
const StarsButton = ({ stars, toggleStar, starred, connectedUser }: any) => (
<div className="d-flex flex-row star-button">
{connectedUser && !connectedUser.isGuest ? (
<>
<button
<>
<button
className="btn flex-row align-items-center pe-2"
style={{ color: 'var(--btn-bg-color, "#000")', padding: '0' }}
style={{ color: 'var(--btn-bg-color, "#000")', padding: "0" }}
onClick={toggleStar}
>
<i className={`${starred ? 'fas' : 'far'} fa-star ps-2`} />
<i className={`${starred ? "fas" : "far"} fa-star ps-2`} />
</button>
<div className="px-2 d-flex align-items-center" style={{ backgroundColor: '#fff' }}>
<span>{stars}</span>
</div>
<span className="btn btn-sm btn-access-negative">{stars}</span>
</>
) : (
stars > 0 && (
<div className="badge p-2" style={{ color: '#fff' }}>
<div className="badge p-2" style={{ color: "#fff" }}>
{stars}
<i className="fas fa-star ps-2" />
<i className="fas fa-star ps-2" />
</div>
)
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export function ApiIssues({
<div className="d-flex flex-column pt-3 mt-3">
{ filteredIssues.map(({ seqId, title, tags, by, createdDate, closedDate, open, apiVersion, _id, comments }) => (
<Link to={`${_id}`} className="me-2">
<div className="border-bottom py-3 d-flex align-items-center justify-content-between" key={`issue-${seqId}`} style={{ backgroundColor: '#fff' }}>
<div className="border-bottom py-3 d-flex align-items-center justify-content-between" key={`issue-${seqId}`} style={{ backgroundColor: '#{"var(--section-bg-color, #f8f9fa)"}', color:'#{"var(--section-text-color, #6c757d)"}' }}>
<div className="d-flex align-items-center">
<i className="fa fa-exclamation-circle mx-3" style={{ color: open ? 'green' : 'red' }}></i>
<div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { ModalContext } from '../../../../contexts';

const styles = {
commentHeader: {
backgroundColor: '#eee',
backgroundColor: 'var(--body-bg-color, #fff)',
borderTopLeftRadius: '8px',
borderTopRightRadius: '8px',
},
Expand All @@ -35,10 +35,10 @@ const styles = {
color: '#fff'
}),
commentBody: {
border: '1px solid #eee',
border: '1px solid var(--body-bg-color, #f8f9fa)',
borderBottomLeftRadius: '8px',
borderBottomRightRadius: '8px',
backgroundColor: '#fff',
backgroundColor: 'var(--section-bg-color, #f8f9fa)',
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ $focused-outline-color: #4c9ffe;
// border: none;
outline: none;
appearance: none;
background-color: transparent;
// background-color: transparent;
-webkit-tap-highlight-color: transparent;

@media (hover: hover) {
&:hover {
background-color: var(--action-background, rgba(0, 0, 0, 0.05));
}
}
// @media (hover: hover) {
// &:hover {
// background-color: var(--action-background, rgba(0, 0, 0, 0.05));
// }
// }

svg {
flex: 0 0 auto;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {Action, Props as ActionProps} from './Action';
export function Remove(props: ActionProps) {
return (
<Action
{...props} className="btn btn-sm btn-danger d-none remove-button">
{...props} className="btn btn-sm btn-outline-danger d-none remove-button">
<i className="fas fa-trash"></i>
</Action>
);
Expand Down
2 changes: 1 addition & 1 deletion daikoku/javascript/src/components/utils/multiStepForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ const Breadcrumb = <T,>({
token: {
colorPrimary: 'var(--success-color, red)',
colorInfo: 'var(--success-color, red)',
colorTextBase: 'var(--success-color, red)',
colorTextBase: 'var(--success-color, red)'
}
}}
>
Expand Down
5 changes: 1 addition & 4 deletions daikoku/javascript/src/components/utils/sidebar/SideBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,10 @@ export const SideBar = () => {
title="Daikoku home"
className="mb-3"
style={{
width: '40px',
width: '39px',
}}
>
<img
style={{
width: '40px',
}}
src={tenant.logo}
/>
</Link>
Expand Down
2 changes: 1 addition & 1 deletion daikoku/javascript/src/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@
"Cost per req.": "Cost per req.",
"Cost per request": "Cost per request",
"delete.plan.confirm": "Are you sure you want to delete this plan?",
"add a new plan": "New plan",
"add a new plan": "Add plan",
"import a plan": "Import a plan",
"Make default plan": "Make default plan",
"Make it private": "Make it private",
Expand Down
4 changes: 3 additions & 1 deletion daikoku/javascript/src/services/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1635,7 +1635,9 @@ export const graphql = {
code
}
type
subscriptionProcess
subscriptionProcess {
name
}
allowMultipleKeys
aggregationApiKeysSecurity
... on QuotasWithLimits {
Expand Down
8 changes: 7 additions & 1 deletion daikoku/javascript/src/style/components/breadcrumb.scss
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,14 @@

.ant-steps {
.ant-steps-item {
.ant-steps-item-title{
color: $aside-text-color !important;


}
.ant-steps-item-tail::after{
background-color: $aside-text-color !important;

}

.ant-steps-item-container {
color: $aside-text-color;
Expand Down
10 changes: 10 additions & 0 deletions daikoku/javascript/src/style/components/btn.scss
Original file line number Diff line number Diff line change
Expand Up @@ -161,3 +161,13 @@ button {
top: -30px;
}
}

.star-button{
border-radius: 4px;
border:'1px solid';
overflow: hidden;
box-sizing: content-box;
border-color: var(--btn-border-color, #97b0c7);
background-color: var(--btn-border-color, #fff);
font-size: 18px;
}
8 changes: 4 additions & 4 deletions daikoku/javascript/src/style/components/dragAndDropDoc.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
position: absolute;
top: -10px;
right: -10px;
color: $danger-color;
&:hover {
background-color: $danger-color;
}
// color: $danger-color;
// &:hover {
// background-color: $danger-color;
// }
}

&:hover {
Expand Down
Loading

0 comments on commit 6e07efa

Please sign in to comment.