Skip to content

Commit

Permalink
[AMSA-33] add accordion to logs list
Browse files Browse the repository at this point in the history
  • Loading branch information
NaLLiFFuNT committed Apr 17, 2019
1 parent c840bb2 commit e7bf585
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 21 deletions.
7 changes: 6 additions & 1 deletion package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@
"raven-js": "^3.27.0",
"react": "^16.8.3",
"react-dom": "^16.8.3",
"react-tiny-accordion": "^2.0.4",
"semver": "^6.0.0",
"uuid": "^3.3.2",
"winston": "^3.2.1",
Expand Down
1 change: 1 addition & 0 deletions src/core/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ export class Store {
percent: (pEvent.synced + pEvent.failed) / pEvent.total * 100,
lastEvent: event.type
};
this.pushLogs(account);
return this.fireSyncUpdated();
case SyncEventsTypes.Stopped:
delete this.state.syncProgress[event.accountId];
Expand Down
2 changes: 1 addition & 1 deletion src/core/sync-apps/sync-stats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export class SyncStats {
if (this.affectedApps.created.some(v => v.id === app.id)) {
return;
}
this.affectedApps.updated = this.affectedApps.updated.filter(v => v.id !== app.id);
this.affectedApps.updated.push(app);
}

appDeleted (app: AppodealApp) {
Expand Down
18 changes: 9 additions & 9 deletions src/ui/components/log-list/LogList.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@
overflow-y: auto;
overflow-x: hidden;

&:not(:empty) {
margin-block-start: 10px;
}
}
> div {
display: block;
background-color: #212225;

.line-wrapper {
display: block;
background-color: #212225;
&:nth-child(2n) {
background-color: #2B2C2F;
}
}

&:nth-child(2n) {
background-color: #2B2C2F;
&:not(:empty) {
margin-block-start: 10px;
}
}

Expand Down
21 changes: 11 additions & 10 deletions src/ui/components/log-list/LogListComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {ActionTypes, LogAction} from 'lib/actions';
import {classNames, singleEvent} from 'lib/dom';
import {sendToMain} from 'lib/messages';
import React from 'react';
import Accordion from 'react-tiny-accordion';
import {TextToClipboard} from 'ui/components/text-to-clipboard/TextToClipboardComponent';
import style from './LogList.scss';

Expand Down Expand Up @@ -98,10 +99,11 @@ export class LogListComponent extends React.Component<LogListComponentProps> {
}

render (): React.ReactNode {
return <div className={style.list}>

return <Accordion className={style.list}>
{this.props.historyInfo.syncs.map(
syncInfo =>
<div className={style['line-wrapper']} key={syncInfo.id}>
<div key={syncInfo.id} data-header={
<div className={style.line}>
<div className={style.iconsGroup}>
<div className={style.icon}>
Expand All @@ -126,14 +128,13 @@ export class LogListComponent extends React.Component<LogListComponentProps> {
</button>
</div>
</div>
{this.affectedAppsCount(syncInfo) && <div>
{this.appList('Apps created', syncInfo.affectedApps.created)}
{this.appList('Apps updated', syncInfo.affectedApps.updated)}
{this.appList('Apps deleted', syncInfo.affectedApps.deleted)}
</div>
}
}
>
{this.appList('Apps created', syncInfo.affectedApps.created)}
{this.appList('Apps updated', syncInfo.affectedApps.updated)}
{this.appList('Apps deleted', syncInfo.affectedApps.deleted)}
</div>
)}
</div>;
</Accordion>;
}
};
}

0 comments on commit e7bf585

Please sign in to comment.