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

[IMPROVE] Administration UI - React and Fuselage components #15452

Merged
merged 83 commits into from
Nov 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
4658208
Update Storybook
tassoevan Oct 15, 2019
5037589
Add some components of admin/info to Storybook
tassoevan Oct 15, 2019
c5afec2
Remove dangling line of code
tassoevan Oct 15, 2019
cb1b468
Prototype decoupling between template component and its hooks
tassoevan Oct 16, 2019
0cdf2a6
Remove unused style
tassoevan Oct 16, 2019
ee0486d
Add more routes to Storybook
tassoevan Oct 16, 2019
a81404f
Handle props variation on createTemplateForComponent helper
tassoevan Sep 24, 2019
14fd427
Remove undesired Tracker triggering on useReactiveValue
tassoevan Oct 16, 2019
2891c13
Fix URL resolution on Storybook
tassoevan Oct 16, 2019
4855833
Remove unused parameter on CachedCollection
tassoevan Oct 16, 2019
91bc363
Add cancel and nude variants to Button
tassoevan Oct 16, 2019
eadf03f
Add SetupWizard to Storybook
tassoevan Oct 16, 2019
3d0d5fb
Use development version of Fuselage
tassoevan Oct 17, 2019
38bd13f
Refactor providers and their hooks
tassoevan Oct 18, 2019
6188183
Apply Text.Skeleton from Fuselage
tassoevan Oct 18, 2019
ecac436
Add some helper components
tassoevan Oct 18, 2019
4e858b4
Update Icon component to handle SVG and font icons
tassoevan Oct 18, 2019
cc21727
Remove unused className
tassoevan Oct 18, 2019
228c10c
Add Header blocks
tassoevan Oct 18, 2019
3017cab
Use Fontello on Storybook
tassoevan Oct 18, 2019
b687fc3
Add Meteor.absoluteUrl() mock
tassoevan Oct 18, 2019
a97466c
Fix route component remounting
tassoevan Oct 18, 2019
3767a0a
Add SettingsRoute prototype
tassoevan Oct 18, 2019
d005d88
Apply Fuselage components to GroupPage
tassoevan Oct 21, 2019
646986a
Check tests
tassoevan Oct 21, 2019
8dae1d7
Update buttons
tassoevan Oct 21, 2019
a225914
Add Accordion
tassoevan Oct 21, 2019
be7a2af
Update dependency
tassoevan Oct 24, 2019
9658f9a
Move some classNames
tassoevan Oct 24, 2019
ff7c234
Add toast on save settings
tassoevan Oct 28, 2019
a066b0d
Handle untitled sections
tassoevan Oct 28, 2019
0ba1376
Implement some inputs
tassoevan Oct 28, 2019
f7adf26
Hide Reset Section Settings button when possible
tassoevan Oct 28, 2019
768389d
Center page content
tassoevan Oct 28, 2019
77793db
Update SetupWizard markup
tassoevan Oct 29, 2019
6861b1f
Update SetupWizard markup
tassoevan Oct 29, 2019
2aac28e
Optimize initial state
tassoevan Oct 29, 2019
c028bad
Rename EditingState as SettingsState
tassoevan Oct 30, 2019
9b8352f
Implement GroupState and SectionState
tassoevan Oct 30, 2019
4e50070
Implement SettingState
tassoevan Oct 30, 2019
d72b10e
Refactor SettingsState
tassoevan Oct 30, 2019
e052bf4
By-pass input styling for Fuselage components
tassoevan Oct 30, 2019
43c543e
Fix effects
tassoevan Oct 30, 2019
19d6d06
Fix sorting
tassoevan Oct 31, 2019
022d20f
Unify reduced states
tassoevan Nov 6, 2019
2a17b34
Add useLazyRef
tassoevan Nov 6, 2019
f56a27f
Dispatch state changes via event emitter
tassoevan Nov 6, 2019
2975bac
Remove GroupState
tassoevan Nov 6, 2019
a62b0e7
Remove SectionState
tassoevan Nov 6, 2019
b9d7bac
Remove SettingState
tassoevan Nov 6, 2019
05eedb3
Refactor SettingsState to reduce renders
tassoevan Nov 7, 2019
5f0e26a
Update icons
tassoevan Nov 11, 2019
4d01839
Update ResetSettingButton
tassoevan Nov 11, 2019
cc38273
Add data-qa attributes
tassoevan Nov 11, 2019
5d840b7
Handle groupId changes
tassoevan Nov 11, 2019
137e192
Add RelativeUrlSettingInput
tassoevan Nov 11, 2019
dcb8d1d
Add PasswordSettingInput
tassoevan Nov 11, 2019
433ecfd
Add IntSettingInput
tassoevan Nov 11, 2019
4474f68
Add SelectSettingInput
tassoevan Nov 11, 2019
53592d9
Add LanguageSettingInput
tassoevan Nov 11, 2019
6edb44d
Add ColorSettingInput
tassoevan Nov 11, 2019
bed6e65
Merge branch 'develop' of github.com:RocketChat/Rocket.Chat into impr…
ggazzo Nov 12, 2019
df935a6
Add FontSettingInput
tassoevan Nov 12, 2019
b4c20bf
Add ActionSettingInput
tassoevan Nov 12, 2019
1ae7cb3
Update tests
tassoevan Nov 13, 2019
e6a0b84
Merge branch 'develop' of github.com:RocketChat/Rocket.Chat into impr…
tassoevan Nov 13, 2019
55399d8
Add CodeSettingInput
tassoevan Nov 13, 2019
469c961
Merge branch 'develop' of github.com:RocketChat/Rocket.Chat into impr…
tassoevan Nov 13, 2019
4723797
Fix loading state
tassoevan Nov 13, 2019
cc3584e
Reduce complexity in Setting
tassoevan Nov 13, 2019
881dd28
Lazy load admin routes (#15784)
ggazzo Nov 13, 2019
e9bba5c
Merge branch 'develop' of github.com:RocketChat/Rocket.Chat into impr…
ggazzo Nov 14, 2019
5dfa7ce
Merge branch 'improve/admin' of github.com:RocketChat/Rocket.Chat int…
ggazzo Nov 14, 2019
3b3e651
Refactor SettingsState
tassoevan Nov 14, 2019
dbb2d72
Memoize Setting component
tassoevan Nov 14, 2019
b6deb1d
Add skeletons
tassoevan Nov 14, 2019
12e7a43
Fix context value updates
tassoevan Nov 15, 2019
604618e
Add AssetSettingInput
tassoevan Nov 18, 2019
083f7ff
Merge branch 'improve/admin' of github.com:RocketChat/Rocket.Chat int…
ggazzo Nov 18, 2019
f625ac0
Merge branch 'develop' of github.com:RocketChat/Rocket.Chat into impr…
ggazzo Nov 18, 2019
96980fe
Add RoomPickSettingInput
tassoevan Nov 18, 2019
b2bd310
Handle empty string as value for RoomPickSettingInput
tassoevan Nov 18, 2019
67f9ce7
Update Fuselage
tassoevan Nov 20, 2019
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
11 changes: 8 additions & 3 deletions .storybook/.babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,14 @@
{
"shippedProposals": true,
"useBuiltIns": "usage",
"corejs": "3"
"corejs": "3",
"modules": "commonjs",
}
],
"@babel/preset-react"
"@babel/preset-react",
"@babel/preset-flow"
],
"plugins": [
"@babel/plugin-proposal-class-properties"
]
}
}
2 changes: 2 additions & 0 deletions .storybook/addons.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
import '@storybook/addon-actions/register';
import '@storybook/addon-knobs/register';
import '@storybook/addon-links/register';
import '@storybook/addon-viewport/register';
48 changes: 47 additions & 1 deletion .storybook/config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,49 @@
import { configure } from '@storybook/react';
import { action } from '@storybook/addon-actions';
import { withKnobs }from '@storybook/addon-knobs';
import { MINIMAL_VIEWPORTS, INITIAL_VIEWPORTS } from '@storybook/addon-viewport/dist/defaults';
import { addDecorator, addParameters, configure } from '@storybook/react';
import React from 'react';

import { ConnectionStatusProvider } from '../client/components/providers/ConnectionStatusProvider.mock';
import { TranslationProvider } from '../client/components/providers/TranslationProvider.mock';

addParameters({
viewport: {
viewports: {
...MINIMAL_VIEWPORTS,
...INITIAL_VIEWPORTS,
},
defaultViewport: 'responsive',
},
})

addDecorator(function RocketChatDecorator(fn) {
const linkElement = document.getElementById('theme-styles') || document.createElement('link');
if (linkElement.id !== 'theme-styles') {
require('../app/theme/client/main.css');
require('../app/theme/client/vendor/fontello/css/fontello.css');
require('../client/RocketChat.font.css');
linkElement.setAttribute('id', 'theme-styles');
linkElement.setAttribute('rel', 'stylesheet');
linkElement.setAttribute('href', 'https://open.rocket.chat/theme.css');
document.head.appendChild(linkElement);
}

return <ConnectionStatusProvider connected status='connected' reconnect={action('reconnect')}>
<TranslationProvider>
<style>{`
body {
background-color: white;
}
`}</style>
<div dangerouslySetInnerHTML={{ __html: require('!!raw-loader!../private/public/icons.svg').default }} />
<div className='global-font-family color-primary-font-color'>
{fn()}
</div>
</TranslationProvider>
</ConnectionStatusProvider>;
});

addDecorator(withKnobs);

configure(require.context('../client', true, /\.stories\.js$/), module);
1 change: 1 addition & 0 deletions .storybook/empty.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default {};
45 changes: 1 addition & 44 deletions .storybook/helpers.js
Original file line number Diff line number Diff line change
@@ -1,44 +1 @@
import { action } from '@storybook/addon-actions';
import '@rocket.chat/icons/dist/font/RocketChat.minimal.css';
import React from 'react';

import '../app/theme/client/main.css';
import { ConnectionStatusProvider } from '../client/components/providers/ConnectionStatusProvider.mock';
import { TranslationProvider } from '../client/components/providers/TranslationProvider.mock';

export const rocketChatWrapper = (fn) =>
<ConnectionStatusProvider connected status='connected' reconnect={action('reconnect')}>
<TranslationProvider>
<style>{`
body {
background-color: white;
}

.global-font-family {
font-family:
-apple-system,
BlinkMacSystemFont,
'Segoe UI',
Roboto,
Oxygen,
Ubuntu,
Cantarell,
'Helvetica Neue',
'Apple Color Emoji',
'Segoe UI Emoji',
'Segoe UI Symbol',
'Meiryo UI',
Arial,
sans-serif;
}

.color-primary-font-color {
color: #444;
}
`}</style>
<div dangerouslySetInnerHTML={{__html: require('!!raw-loader!../private/public/icons.svg').default}} />
<div className='global-font-family color-primary-font-color'>
{fn()}
</div>
</TranslationProvider>
</ConnectionStatusProvider>;
export const dummyDate = new Date(2015, 4, 19);
74 changes: 74 additions & 0 deletions .storybook/meteor.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
export const Meteor = {
isClient: true,
isServer: false,
_localStorage: window.localStorage,
absoluteUrl: () => {},
userId: () => {},
Streamer: () => {},
startup: () => {},
methods: () => {},
call: () => {},
};

Meteor.absoluteUrl.defaultOptions = {};

export const Tracker = {
autorun: () => ({
stop: () => {},
}),
nonreactive: (fn) => fn(),
Dependency: () => {},
};

export const Accounts = {};

export const Mongo = {
Collection: () => ({
find: () => ({
observe: () => {},
fetch: () => [],
})
}),
};

export const ReactiveVar = () => ({
get: () => {},
set: () => {},
});

export const ReactiveDict = () => ({
get: () => {},
set: () => {},
all: () => {},
});

export const Template = () => ({
onCreated: () => {},
onRendered: () => {},
onDestroyed: () => {},
helpers: () => {},
events: () => {},
});

Template.registerHelper = () => {};
Template.__checkName = () => {};

export const Blaze = {
Template,
registerHelper: () => {},
};

window.Blaze = Blaze;

export const check = () => {};

export const FlowRouter = {
route: () => {}
};

export const BlazeLayout = {};

export const Session = {
get: () => {},
set: () => {},
};
44 changes: 35 additions & 9 deletions .storybook/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,48 @@
'use strict';

module.exports = async ({ config, mode }) => {
const cssRule = config.module.rules.find(({ test }) => test.test('index.css'));
cssRule.use[1].options.url = (url, resourcePath) => {
if (/^(\.\/)?images\//.test(url)) {
return false;
}
const path = require('path');

const webpack = require('webpack');

return true;
};
module.exports = async ({ config }) => {
const cssRule = config.module.rules.find(({ test }) => test.test('index.css'));

cssRule.use[2].options.plugins = [
require('postcss-custom-properties')({ preserve: true }),
require('postcss-media-minmax')(),
require('postcss-selector-not')(),
require('postcss-nested')(),
require('autoprefixer')(),
require('postcss-url')({ url: ({ absolutePath, relativePath, url }) => {
const absoluteDir = absolutePath.slice(0, -relativePath.length);
const relativeDir = path.relative(absoluteDir, path.resolve(__dirname, '../public'));
const newPath = path.join(relativeDir, url);
return newPath;
} }),
];

return config;
config.module.rules.push({
test: /\.info$/,
type: 'json',
});

config.module.rules.push({
test: /\.html$/,
use: '@settlin/spacebars-loader',
});

config.plugins.push(new webpack.NormalModuleReplacementPlugin(
/^meteor/,
require.resolve('./meteor.js'),
));

config.plugins.push(new webpack.NormalModuleReplacementPlugin(
/\.\/server\/index.js/,
require.resolve('./empty.js'),
));

config.mode = 'development';
config.optimization.usedExports = true;

return config;
};
11 changes: 11 additions & 0 deletions app/apps/client/admin/views.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import './modalTemplates/iframeModal.html';
import './modalTemplates/iframeModal';
import './marketplace';
import './apps';
import './appInstall.html';
import './appInstall';
import './appLogs.html';
import './appLogs';
import './appManage';
import './appWhatIsIt.html';
import './appWhatIsIt';
11 changes: 0 additions & 11 deletions app/apps/client/index.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
import './admin/modalTemplates/iframeModal.html';
import './admin/modalTemplates/iframeModal';
import './admin/marketplace';
import './admin/apps';
import './admin/appInstall.html';
import './admin/appInstall';
import './admin/appLogs.html';
import './admin/appLogs';
import './admin/appManage';
import './admin/appWhatIsIt.html';
import './admin/appWhatIsIt';
import './routes';

export { Apps } from './orchestrator';
2 changes: 2 additions & 0 deletions app/apps/client/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ FlowRouter.route('/admin/apps/what-is-it', {
name: 'apps-what-is-it',
action: async () => {
// TODO: render loading indicator
await import('./admin/views');
if (await Apps.isEnabled()) {
FlowRouter.go('apps');
} else {
Expand All @@ -18,6 +19,7 @@ FlowRouter.route('/admin/apps/what-is-it', {
const createAppsRouteAction = (centerTemplate) => async () => {
// TODO: render loading indicator
if (await Apps.isEnabled()) {
await import('./admin/views');
BlazeLayout.render('main', { center: centerTemplate, old: true }); // TODO remove old
} else {
FlowRouter.go('apps-what-is-it');
Expand Down
4 changes: 0 additions & 4 deletions app/authorization/client/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ import './usersNameChanged';
import './requiresPermission.html';
import './route';
import './startup';
import './views/permissions.html';
import './views/permissions';
import './views/permissionsRole.html';
import './views/permissionsRole';

export {
hasAllPermission,
Expand Down
9 changes: 6 additions & 3 deletions app/authorization/client/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import { t } from '../../utils/client';

FlowRouter.route('/admin/permissions', {
name: 'admin-permissions',
action(/* params*/) {
async action(/* params*/) {
await import('./views');
return BlazeLayout.render('main', {
center: 'permissions',
pageTitle: t('Permissions'),
Expand All @@ -15,7 +16,8 @@ FlowRouter.route('/admin/permissions', {

FlowRouter.route('/admin/permissions/:name?/edit', {
name: 'admin-permissions-edit',
action(/* params*/) {
async action(/* params*/) {
await import('./views');
return BlazeLayout.render('main', {
center: 'pageContainer',
pageTitle: t('Role_Editing'),
Expand All @@ -26,7 +28,8 @@ FlowRouter.route('/admin/permissions/:name?/edit', {

FlowRouter.route('/admin/permissions/new', {
name: 'admin-permissions-new',
action(/* params*/) {
async action(/* params*/) {
await import('./views');
return BlazeLayout.render('main', {
center: 'pageContainer',
pageTitle: t('Role_Editing'),
Expand Down
4 changes: 4 additions & 0 deletions app/authorization/client/views/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import './permissions.html';
import './permissions';
import './permissionsRole.html';
import './permissionsRole';
2 changes: 1 addition & 1 deletion app/callbacks/lib/callbacks.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const createCallbackTimed = (hook, callbacks) =>
const create = (hook, cbs) =>
(timed ? createCallbackTimed(hook, cbs) : createCallback(hook, cbs));
const combinedCallbacks = new Map();
this.combinedCallbacks = combinedCallbacks;

/*
* Callback priorities
*/
Expand Down
2 changes: 2 additions & 0 deletions app/cloud/client/admin/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import './cloud';
import './callback';
9 changes: 4 additions & 5 deletions app/cloud/client/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import './admin/callback';
import './admin/cloud';

import { BlazeLayout } from 'meteor/kadira:blaze-layout';
import { FlowRouter } from 'meteor/kadira:flow-router';

Expand All @@ -9,14 +6,16 @@ import { hasAtLeastOnePermission } from '../../authorization';

FlowRouter.route('/admin/cloud', {
name: 'cloud-config',
action() {
async action() {
await import('./admin');
BlazeLayout.render('main', { center: 'cloud', old: true });
},
});

FlowRouter.route('/admin/cloud/oauth-callback', {
name: 'cloud-oauth-callback',
action() {
async action() {
await import('./admin');
BlazeLayout.render('main', { center: 'cloudCallback', old: true });
},
});
Expand Down
3 changes: 2 additions & 1 deletion app/custom-sounds/client/admin/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ FlowRouter.route('/admin/custom-sounds', {
subscriptions(/* params, queryParams*/) {
this.register('customSounds', Meteor.subscribe('customSounds'));
},
action(/* params*/) {
async action(/* params*/) {
await import('./views');
BlazeLayout.render('main', { center: 'adminSounds' });
},
});
Loading