Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NEW] Admin view-logs page #17276

Merged
merged 43 commits into from
Apr 22, 2020
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
9315e3b
Remove unused props in StringSettingInput
tassoevan Apr 1, 2020
e9f7651
Softly deprecate Paragraph
tassoevan Apr 1, 2020
b1792bd
Remove props from createTemplateForComponent
tassoevan Apr 2, 2020
51080ff
Simplify createTemplateForComponent
tassoevan Apr 2, 2020
ee7aaa0
Add renderRouteComponent
tassoevan Apr 2, 2020
e1c79df
Fix concurrency issues with FlowRouter
tassoevan Apr 2, 2020
0e03026
Update Engagement Dashboard routes
tassoevan Apr 2, 2020
b0a7c8d
Update createTemplateForComponent
tassoevan Apr 3, 2020
f2d586e
Refactor ModalBlock
tassoevan Apr 4, 2020
60e41d0
Refactor MessageBlock
tassoevan Apr 4, 2020
22bb34e
Remove unused modules
tassoevan Apr 4, 2020
78038e2
Refactor RoomForeword
tassoevan Apr 4, 2020
50f7f15
Merge branch 'develop' of github.com:RocketChat/Rocket.Chat into feat…
tassoevan Apr 4, 2020
bbd0dad
Fix some container views
tassoevan Apr 4, 2020
6cce911
Merge branch 'develop' into feat/react-root
ggazzo Apr 6, 2020
d2cbd60
creating viewlogs component
dudizilla Apr 13, 2020
8fcc8c2
creating viewlogs component
dudizilla Apr 13, 2020
2aa265a
Merge branch 'develop' into view-logs
dudizilla Apr 13, 2020
8816458
resolving import errors
dudizilla Apr 13, 2020
396f91a
Merge branch 'view-logs' into view-logs
dudizilla Apr 13, 2020
52d34f6
resolving lint errors
dudizilla Apr 13, 2020
41f0195
moving view-logs to the correct folder
dudizilla Apr 13, 2020
960d7dd
Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat i…
dudizilla Apr 16, 2020
f4a93a1
Merge branch 'develop' into view-logs
ggazzo Apr 16, 2020
28656d9
help
ggazzo Apr 16, 2020
584d60e
Merge branch 'view-logs' of https://github.com/RocketChat/Rocket.Chat…
dudizilla Apr 17, 2020
7da2e2f
Update routes.js
ggazzo Apr 17, 2020
69ca252
Update ViewLogsRoute.js
ggazzo Apr 17, 2020
29683da
Update viewLogs.js
ggazzo Apr 17, 2020
68342c7
Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat i…
dudizilla Apr 20, 2020
556f995
Tasso changes
dudizilla Apr 20, 2020
9ca4379
Upadted meteor Streamer mock
dudizilla Apr 20, 2020
b1f3439
Rewriting JS view-logs functions
dudizilla Apr 20, 2020
6ea7f63
Adding decorators on ViewLogs.stories
dudizilla Apr 20, 2020
7dd9ff9
refatoring canAccess permission
dudizilla Apr 20, 2020
902da54
Resolving layout issues on Page component
dudizilla Apr 20, 2020
c690660
removing unused files
dudizilla Apr 21, 2020
e2293ca
refactoring index.js
dudizilla Apr 21, 2020
f20af41
Index.js renamed to ViewLogs.js
dudizilla Apr 21, 2020
7ee174f
moving viewlogs stories
dudizilla Apr 21, 2020
2a42362
removing unused variables
dudizilla Apr 21, 2020
949ae85
Merge branch 'view-logs' of https://github.com/RocketChat/Rocket.Chat…
dudizilla Apr 21, 2020
41c002c
Merge branch 'develop' into view-logs
tassoevan Apr 21, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions app/logger/client/components/ViewLogs/ViewLogs.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React from 'react';

import { ViewLogs } from '.';

export default {
title: 'admin/pages/ViewLogs',
component: ViewLogs,
// decorators: [
// (storyFn) => <SettingsState>
// {storyFn()}
// </SettingsState>,
// ],
};

export const _default = () =>
<ViewLogs />;
11 changes: 11 additions & 0 deletions app/logger/client/components/ViewLogs/ViewLogsRoute.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from 'react';

import { NotAuthorizedPage } from '../../../../ui-admin/client/components/settings/NotAuthorizedPage';
import { usePermission } from '../../../../../client/contexts/AuthorizationContext';

import { ViewLogs } from '.';

export default function ViewLogsRoute() {
const canViewLogs = usePermission('view-logs');
return canViewLogs ? <ViewLogs/> : <NotAuthorizedPage/>;
}
34 changes: 34 additions & 0 deletions app/logger/client/components/ViewLogs/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { Meteor } from 'meteor/meteor';
import React, { useEffect, useState } from 'react';
import { Box } from '@rocket.chat/fuselage';

import { useTranslation } from '../../../../../client/contexts/TranslationContext';
import { Page } from '../../../../../client/components/basic/Page';
import { ansispan } from '../../ansispan';
import { APIClient } from '../../../../utils/client';

export function ViewLogs() {
const [stdout, setStdout] = useState([]);
useEffect(() => {
(async () => {
const data = await APIClient.v1.get('stdout.queue');

setStdout(data.queue);
})();

const stdoutStreamer = new Meteor.Streamer('stdout');

stdoutStreamer.on('stdout', (item) => stdout.push(item));
dudizilla marked this conversation as resolved.
Show resolved Hide resolved

return () => {
stdoutStreamer.removeListener('stdout');
};
}, []);

const t = useTranslation();

return <Page _id='viewlogs' i18nLabel='ViewLogs'>
<Page.Header title={t('View Logs')}></Page.Header>
<Box componentClassName='view-logs__terminal' width='full' height='full' dangerouslySetInnerHTML={{ __html: stdout.map(({ string }) => ansispan(string)).join('\n') }} />
</Page>;
}
10 changes: 1 addition & 9 deletions app/logger/client/viewLogs.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,5 @@ Meteor.startup(function() {

registerAdminRoute('/view-logs', {
name: 'admin-view-logs',
async action() {
await import('./views/viewLogs');
return BlazeLayout.render('main', {
center: 'pageSettingsContainer',
pageTitle: t('View_Logs'),
pageTemplate: 'viewLogs',
noScroll: true,
});
},
lazyRouteComponent: () => import('./components/ViewLogs/ViewLogsRoute'),
});
10 changes: 5 additions & 5 deletions package-lock.json

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