Update active nav item based on url

This commit is contained in:
Marliana Lara 2018-12-03 13:17:53 -05:00
parent 1e7ab9deed
commit 9341c4660c
No known key found for this signature in database
GPG Key ID: 38C73B40DFA809EE
3 changed files with 306 additions and 281 deletions

View File

@ -1,5 +1,8 @@
import React from 'react';
import { HashRouter as Router } from 'react-router-dom';
import { shallow, mount } from 'enzyme';
import { createMemoryHistory } from 'history'
import App from '../src/App';
import api from '../src/api';
import { API_LOGOUT } from '../src/endpoints';
@ -21,7 +24,7 @@ describe('<App />', () => {
api.isAuthenticated = jest.fn();
api.isAuthenticated.mockReturnValue(false);
const appWrapper = mount(<App />);
const appWrapper = mount(<Router><App /></Router>);
const login = appWrapper.find(Login);
expect(login.length).toBe(1);
@ -33,7 +36,7 @@ describe('<App />', () => {
api.isAuthenticated = jest.fn();
api.isAuthenticated.mockReturnValue(true);
const appWrapper = mount(<App />);
const appWrapper = mount(<Router><App /></Router>);
const dashboard = appWrapper.find(Dashboard);
expect(dashboard.length).toBe(1);
@ -42,39 +45,47 @@ describe('<App />', () => {
});
test('onNavSelect sets state.activeItem and state.activeGroup', () => {
const appWrapper = shallow(<App />);
appWrapper.instance().onNavSelect({ itemId: 'foo', groupId: 'bar' });
expect(appWrapper.state().activeItem).toBe('foo');
const history = createMemoryHistory('/jobs');
const appWrapper = shallow(<App.WrappedComponent history={history} />);
appWrapper.instance().onNavSelect({ groupId: 'bar' });
expect(appWrapper.state().activeGroup).toBe('bar');
});
test('onNavToggle sets state.isNavOpen to opposite', () => {
const appWrapper = shallow(<App />);
const history = createMemoryHistory('/jobs');
const appWrapper = shallow(<App.WrappedComponent history={history} />);
expect(appWrapper.state().isNavOpen).toBe(true);
appWrapper.instance().onNavToggle();
expect(appWrapper.state().isNavOpen).toBe(false);
});
test('onLogoClick sets selected nav back to defaults', () => {
const appWrapper = shallow(<App />);
const history = createMemoryHistory('/jobs');
const appWrapper = shallow(<App.WrappedComponent history={history} />);
appWrapper.setState({ activeGroup: 'foo', activeItem: 'bar' });
expect(appWrapper.state().activeItem).toBe('bar');
expect(appWrapper.state().activeGroup).toBe('foo');
appWrapper.instance().onLogoClick();
expect(appWrapper.state().activeItem).toBe(DEFAULT_ACTIVE_ITEM);
expect(appWrapper.state().activeGroup).toBe(DEFAULT_ACTIVE_GROUP);
});
test('api.logout called from logout button', async () => {
api.get = jest.fn().mockImplementation(() => Promise.resolve({}));
const appWrapper = mount(<App />);
const logoutButton = appWrapper.find('LogoutButton');
let appWrapper = mount(<Router><App /></Router>);
let logoutButton = appWrapper.find('LogoutButton');
logoutButton.props().onDevLogout();
appWrapper.setState({ activeGroup: 'foo', activeItem: 'bar' });
await asyncFlush();
expect(api.get).toHaveBeenCalledTimes(1);
expect(api.get).toHaveBeenCalledWith(API_LOGOUT);
await asyncFlush();
expect(appWrapper.state().activeItem).toBe(DEFAULT_ACTIVE_ITEM);
console.log(appWrapper.state());
expect(appWrapper.state().activeGroup).toBe(DEFAULT_ACTIVE_GROUP);
});
});

View File

@ -1,8 +1,8 @@
import React, { Fragment } from 'react';
import {
HashRouter as Router,
Redirect,
Switch,
withRouter
} from 'react-router-dom';
import {
@ -61,13 +61,11 @@ class App extends React.Component {
this.state = {
isNavOpen,
activeGroup: 'views_group',
activeItem: 'views_group_dashboard'
};
}
onNavSelect = result => {
this.setState({
activeItem: result.itemId,
activeGroup: result.groupId
});
};
@ -77,16 +75,31 @@ class App extends React.Component {
};
onLogoClick = () => {
this.setState({ activeGroup: 'views_group', activeItem: 'views_group_dashboard' });
this.setState({ activeGroup: 'views_group' });
}
onDevLogout = async () => {
console.log('called')
await api.get(API_LOGOUT);
this.setState({ activeGroup: 'views_group', activeItem: 'views_group_dashboard' });
console.log(this.state);
}
expand = (path, group) => {
const { history } = this.props;
const { activeGroup } = this.state;
const currentPath = history.location.pathname.split('/')[1];
if ((path === currentPath) && (group !== activeGroup)) {
this.setState({ activeGroup: group });
}
return (path === currentPath);
};
render () {
const { activeItem, activeGroup, isNavOpen } = this.state;
console.log('render');
const { activeGroup, isNavOpen } = this.state;
const { logo, loginInfo } = this.props;
const PageToolbar = (
@ -103,279 +116,277 @@ class App extends React.Component {
);
return (
<Router>
<Fragment>
<BackgroundImage
src={{
[BackgroundImageSrc.lg]: '/assets/images/pfbg_1200.jpg',
[BackgroundImageSrc.md]: '/assets/images/pfbg_992.jpg',
[BackgroundImageSrc.md2x]: '/assets/images/pfbg_992@2x.jpg',
[BackgroundImageSrc.sm]: '/assets/images/pfbg_768.jpg',
[BackgroundImageSrc.sm2x]: '/assets/images/pfbg_768@2x.jpg',
[BackgroundImageSrc.xl]: '/assets/images/pfbg_2000.jpg',
[BackgroundImageSrc.xs]: '/assets/images/pfbg_576.jpg',
[BackgroundImageSrc.xs2x]: '/assets/images/pfbg_576@2x.jpg',
[BackgroundImageSrc.filter]: '/assets/images/background-filter.svg'
}}
/>
<Switch>
<ConditionalRedirect shouldRedirect={() => api.isAuthenticated()} redirectPath="/" path="/login" component={() => <Login logo={logo} loginInfo={loginInfo} />} />
<Fragment>
<Page
header={(
<PageHeader
logo={<TowerLogo onClick={this.onLogoClick} />}
toolbar={PageToolbar}
showNavToggle
onNavToggle={this.onNavToggle}
/>
)}
sidebar={(
<PageSidebar
isNavOpen={isNavOpen}
nav={(
<Nav onSelect={this.onNavSelect} aria-label="Primary Navigation">
<NavList>
<NavExpandable
title="Views"
<Fragment>
<BackgroundImage
src={{
[BackgroundImageSrc.lg]: '/assets/images/pfbg_1200.jpg',
[BackgroundImageSrc.md]: '/assets/images/pfbg_992.jpg',
[BackgroundImageSrc.md2x]: '/assets/images/pfbg_992@2x.jpg',
[BackgroundImageSrc.sm]: '/assets/images/pfbg_768.jpg',
[BackgroundImageSrc.sm2x]: '/assets/images/pfbg_768@2x.jpg',
[BackgroundImageSrc.xl]: '/assets/images/pfbg_2000.jpg',
[BackgroundImageSrc.xs]: '/assets/images/pfbg_576.jpg',
[BackgroundImageSrc.xs2x]: '/assets/images/pfbg_576@2x.jpg',
[BackgroundImageSrc.filter]: '/assets/images/background-filter.svg'
}}
/>
<Switch>
<ConditionalRedirect shouldRedirect={() => api.isAuthenticated()} redirectPath="/" path="/login" component={() => <Login logo={logo} loginInfo={loginInfo} />} />
<Fragment>
<Page
header={(
<PageHeader
logo={<TowerLogo onClick={this.onLogoClick} />}
toolbar={PageToolbar}
showNavToggle
onNavToggle={this.onNavToggle}
/>
)}
sidebar={(
<PageSidebar
isNavOpen={isNavOpen}
nav={(
<Nav onSelect={this.onNavSelect} aria-label="Primary Navigation">
<NavList>
<NavExpandable
title="Views"
groupId="views_group"
isActive={activeGroup === 'views_group'}
isExpanded={activeGroup === 'views_group'}
>
<NavItem
to="#/home"
groupId="views_group"
isActive={activeGroup === 'views_group'}
isExpanded={activeGroup === 'views_group'}
itemId="views_group_dashboard"
isActive={this.expand('home', 'views_group')}
>
<NavItem
to="#/home"
groupId="views_group"
itemId="views_group_dashboard"
isActive={activeItem === 'views_group_dashboard'}
>
Dashboard
</NavItem>
<NavItem
to="#/jobs"
groupId="views_group"
itemId="views_group_jobs"
isActive={activeItem === 'views_group_jobs'}
>
Jobs
</NavItem>
<NavItem
to="#/schedules"
groupId="views_group"
itemId="views_group_schedules"
isActive={activeItem === 'views_group_schedules'}
>
Schedules
</NavItem>
<NavItem
to="#/portal"
groupId="views_group"
itemId="views_group_portal"
isActive={activeItem === 'views_group_portal'}
>
My View
</NavItem>
</NavExpandable>
<NavExpandable
title="Resources"
Dashboard
</NavItem>
<NavItem
to="#/jobs"
groupId="views_group"
itemId="views_group_jobs"
isActive={this.expand('jobs', 'views_group')}
>
Jobs
</NavItem>
<NavItem
to="#/schedules"
groupId="views_group"
itemId="views_group_schedules"
isActive={this.expand('schedules', 'views_group')}
>
Schedules
</NavItem>
<NavItem
to="#/portal"
groupId="views_group"
itemId="views_group_portal"
isActive={this.expand('portal', 'views_group')}
>
My View
</NavItem>
</NavExpandable>
<NavExpandable
title="Resources"
groupId="resources_group"
isActive={activeGroup === 'resources_group'}
isExpanded={activeGroup === 'resources_group'}
>
<NavItem
to="#/templates"
groupId="resources_group"
isActive={activeGroup === 'resources_group'}
isExpanded={activeGroup === 'resources_group'}
itemId="resources_group_templates"
isActive={this.expand('templates', 'resources_group')}
>
<NavItem
to="#/templates"
groupId="resources_group"
itemId="resources_group_templates"
isActive={activeItem === 'resources_group_templates'}
>
Templates
</NavItem>
<NavItem
to="#/credentials"
groupId="resources_group"
itemId="resources_group_credentials"
isActive={activeItem === 'resources_group_credentials'}
>
Credentials
</NavItem>
<NavItem
to="#/projects"
groupId="resources_group"
itemId="resources_group_projects"
isActive={activeItem === 'resources_group_projects'}
>
Projects
</NavItem>
<NavItem
to="#/inventories"
groupId="resources_group"
itemId="resources_group_inventories"
isActive={activeItem === 'resources_group_inventories'}
>
Inventories
</NavItem>
<NavItem
to="#/inventory_scripts"
groupId="resources_group"
itemId="resources_group_inventory_scripts"
isActive={activeItem === 'resources_group_inventory_scripts'}
>
Inventory Scripts
</NavItem>
</NavExpandable>
<NavExpandable
title="Access"
Templates
</NavItem>
<NavItem
to="#/credentials"
groupId="resources_group"
itemId="resources_group_credentials"
isActive={this.expand('credentials', 'resources_group')}
>
Credentials
</NavItem>
<NavItem
to="#/projects"
groupId="resources_group"
itemId="resources_group_projects"
isActive={this.expand('projects', 'resources_group')}
>
Projects
</NavItem>
<NavItem
to="#/inventories"
groupId="resources_group"
itemId="resources_group_inventories"
isActive={this.expand('inventories', 'resources_group')}
>
Inventories
</NavItem>
<NavItem
to="#/inventory_scripts"
groupId="resources_group"
itemId="resources_group_inventory_scripts"
isActive={this.expand('inventory_scripts', 'resources_group')}
>
Inventory Scripts
</NavItem>
</NavExpandable>
<NavExpandable
title="Access"
groupId="access_group"
isActive={activeGroup === 'access_group'}
isExpanded={activeGroup === 'access_group'}
>
<NavItem
to="#/organizations"
groupId="access_group"
isActive={activeGroup === 'access_group'}
isExpanded={activeGroup === 'access_group'}
itemId="access_group_organizations"
isActive={this.expand('organizations', 'access_group')}
>
<NavItem
to="#/organizations"
groupId="access_group"
itemId="access_group_organizations"
isActive={activeItem === 'access_group_organizations'}
>
Organizations
</NavItem>
<NavItem
to="#/users"
groupId="access_group"
itemId="access_group_users"
isActive={activeItem === 'access_group_users'}
>
Users
</NavItem>
<NavItem
to="#/teams"
groupId="access_group"
itemId="access_group_teams"
isActive={activeItem === 'access_group_teams'}
>
Teams
</NavItem>
</NavExpandable>
<NavExpandable
title="Administration"
Organizations
</NavItem>
<NavItem
to="#/users"
groupId="access_group"
itemId="access_group_users"
isActive={this.expand('users', 'access_group')}
>
Users
</NavItem>
<NavItem
to="#/teams"
groupId="access_group"
itemId="access_group_teams"
isActive={this.expand('teams', 'access_group')}
>
Teams
</NavItem>
</NavExpandable>
<NavExpandable
title="Administration"
groupId="administration_group"
isActive={activeGroup === 'administration_group'}
isExpanded={activeGroup === 'administration_group'}
>
<NavItem
to="#/credential_types"
groupId="administration_group"
isActive={activeGroup === 'administration_group'}
isExpanded={activeGroup === 'administration_group'}
itemId="administration_group_credential_types"
isActive={this.expand('credential_types', 'administration_group')}
>
<NavItem
to="#/credential_types"
groupId="administration_group"
itemId="administration_group_credential_types"
isActive={activeItem === 'administration_group_credential_types'}
>
Credential Types
</NavItem>
<NavItem
to="#/notification_templates"
groupId="administration_group"
itemId="administration_group_notification_templates"
isActive={activeItem === 'administration_group_notification_templates'}
>
Notification Templates
</NavItem>
<NavItem
to="#/management_jobs"
groupId="administration_group"
itemId="administration_group_management_jobs"
isActive={activeItem === 'administration_group_management_jobs'}
>
Management Jobs
</NavItem>
<NavItem
to="#/instance_groups"
groupId="administration_group"
itemId="administration_group_instance_groups"
isActive={activeItem === 'administration_group_instance_groups'}
>
Instance Groups
</NavItem>
<NavItem
to="#/applications"
groupId="administration_group"
itemId="administration_group_applications"
isActive={activeItem === 'administration_group_applications'}
>
Applications
</NavItem>
</NavExpandable>
<NavExpandable
title="Settings"
Credential Types
</NavItem>
<NavItem
to="#/notification_templates"
groupId="administration_group"
itemId="administration_group_notification_templates"
isActive={this.expand('notification_templates', 'administration_group')}
>
Notification Templates
</NavItem>
<NavItem
to="#/management_jobs"
groupId="administration_group"
itemId="administration_group_management_jobs"
isActive={this.expand('management_jobs', 'administration_group')}
>
Management Jobs
</NavItem>
<NavItem
to="#/instance_groups"
groupId="administration_group"
itemId="administration_group_instance_groups"
isActive={this.expand('instance_groups', 'administration_group')}
>
Instance Groups
</NavItem>
<NavItem
to="#/applications"
groupId="administration_group"
itemId="administration_group_applications"
isActive={this.expand('applications', 'administration_group')}
>
Applications
</NavItem>
</NavExpandable>
<NavExpandable
title="Settings"
groupId="settings_group"
isActive={activeGroup === 'settings_group'}
isExpanded={activeGroup === 'settings_group'}
>
<NavItem
to="#/auth_settings"
groupId="settings_group"
isActive={activeGroup === 'settings_group'}
isExpanded={activeGroup === 'settings_group'}
itemId="settings_group_auth"
isActive={this.expand('auth_settings', 'settings_group')}
>
<NavItem
to="#/auth_settings"
groupId="settings_group"
itemId="settings_group_auth"
isActive={activeItem === 'settings_group_auth'}
>
Authentication
</NavItem>
<NavItem
to="#/jobs_settings"
groupId="settings_group"
itemId="settings_group_jobs"
isActive={activeItem === 'settings_group_jobs'}
>
Jobs
</NavItem>
<NavItem
to="#/system_settings"
groupId="settings_group"
itemId="settings_group_system"
isActive={activeItem === 'settings_group_system'}
>
System
</NavItem>
<NavItem
to="#/ui_settings"
groupId="settings_group"
itemId="settings_group_ui"
isActive={activeItem === 'settings_group_ui'}
>
User Interface
</NavItem>
</NavExpandable>
</NavList>
</Nav>
)}
/>
)}
useCondensed
>
<ConditionalRedirect shouldRedirect={() => !api.isAuthenticated()} redirectPath="/login" exact path="/" component={() => (<Redirect to="/home" />)} />
<ConditionalRedirect shouldRedirect={() => !api.isAuthenticated()} redirectPath="/login" path="/home" component={Dashboard} />
<ConditionalRedirect shouldRedirect={() => !api.isAuthenticated()} redirectPath="/login" path="/jobs" component={Jobs} />
<ConditionalRedirect shouldRedirect={() => !api.isAuthenticated()} redirectPath="/login" path="/schedules" component={Schedules} />
<ConditionalRedirect shouldRedirect={() => !api.isAuthenticated()} redirectPath="/login" path="/portal" component={Portal} />
<ConditionalRedirect shouldRedirect={() => !api.isAuthenticated()} redirectPath="/login" path="/templates" component={Templates} />
<ConditionalRedirect shouldRedirect={() => !api.isAuthenticated()} redirectPath="/login" path="/credentials" component={Credentials} />
<ConditionalRedirect shouldRedirect={() => !api.isAuthenticated()} redirectPath="/login" path="/projects" component={Projects} />
<ConditionalRedirect shouldRedirect={() => !api.isAuthenticated()} redirectPath="/login" path="/inventories" component={Inventories} />
<ConditionalRedirect shouldRedirect={() => !api.isAuthenticated()} redirectPath="/login" path="/inventory_scripts" component={InventoryScripts} />
<ConditionalRedirect shouldRedirect={() => !api.isAuthenticated()} redirectPath="/login" path="/organizations" component={Organizations} />
<ConditionalRedirect shouldRedirect={() => !api.isAuthenticated()} redirectPath="/login" path="/users" component={Users} />
<ConditionalRedirect shouldRedirect={() => !api.isAuthenticated()} redirectPath="/login" path="/teams" component={Teams} />
<ConditionalRedirect shouldRedirect={() => !api.isAuthenticated()} redirectPath="/login" path="/credential_types" component={CredentialTypes} />
<ConditionalRedirect shouldRedirect={() => !api.isAuthenticated()} redirectPath="/login" path="/notification_templates" component={NotificationTemplates} />
<ConditionalRedirect shouldRedirect={() => !api.isAuthenticated()} redirectPath="/login" path="/management_jobs" component={ManagementJobs} />
<ConditionalRedirect shouldRedirect={() => !api.isAuthenticated()} redirectPath="/login" path="/instance_groups" component={InstanceGroups} />
<ConditionalRedirect shouldRedirect={() => !api.isAuthenticated()} redirectPath="/login" path="/applications" component={Applications} />
<ConditionalRedirect shouldRedirect={() => !api.isAuthenticated()} redirectPath="/login" path="/auth_settings" component={AuthSettings} />
<ConditionalRedirect shouldRedirect={() => !api.isAuthenticated()} redirectPath="/login" path="/jobs_settings" component={JobsSettings} />
<ConditionalRedirect shouldRedirect={() => !api.isAuthenticated()} redirectPath="/login" path="/system_settings" component={SystemSettings} />
<ConditionalRedirect shouldRedirect={() => !api.isAuthenticated()} redirectPath="/login" path="/ui_settings" component={UISettings} />
<ConditionalRedirect shouldRedirect={() => !api.isAuthenticated()} redirectPath="/login" path="/license" component={License} />
</Page>
</Fragment>
</Switch>
</Fragment>
</Router>
Authentication
</NavItem>
<NavItem
to="#/jobs_settings"
groupId="settings_group"
itemId="settings_group_jobs"
isActive={this.expand('jobs_settings', 'settings_group')}
>
Jobs
</NavItem>
<NavItem
to="#/system_settings"
groupId="settings_group"
itemId="settings_group_system"
isActive={this.expand('system_settings', 'settings_group')}
>
System
</NavItem>
<NavItem
to="#/ui_settings"
groupId="settings_group"
itemId="settings_group_ui"
isActive={this.expand('ui_settings', 'settings_group')}
>
User Interface
</NavItem>
</NavExpandable>
</NavList>
</Nav>
)}
/>
)}
useCondensed
>
<ConditionalRedirect shouldRedirect={() => !api.isAuthenticated()} redirectPath="/login" exact path="/" component={() => (<Redirect to="/home" />)} />
<ConditionalRedirect shouldRedirect={() => !api.isAuthenticated()} redirectPath="/login" path="/home" component={Dashboard} />
<ConditionalRedirect shouldRedirect={() => !api.isAuthenticated()} redirectPath="/login" path="/jobs" component={Jobs} />
<ConditionalRedirect shouldRedirect={() => !api.isAuthenticated()} redirectPath="/login" path="/schedules" component={Schedules} />
<ConditionalRedirect shouldRedirect={() => !api.isAuthenticated()} redirectPath="/login" path="/portal" component={Portal} />
<ConditionalRedirect shouldRedirect={() => !api.isAuthenticated()} redirectPath="/login" path="/templates" component={Templates} />
<ConditionalRedirect shouldRedirect={() => !api.isAuthenticated()} redirectPath="/login" path="/credentials" component={Credentials} />
<ConditionalRedirect shouldRedirect={() => !api.isAuthenticated()} redirectPath="/login" path="/projects" component={Projects} />
<ConditionalRedirect shouldRedirect={() => !api.isAuthenticated()} redirectPath="/login" path="/inventories" component={Inventories} />
<ConditionalRedirect shouldRedirect={() => !api.isAuthenticated()} redirectPath="/login" path="/inventory_scripts" component={InventoryScripts} />
<ConditionalRedirect shouldRedirect={() => !api.isAuthenticated()} redirectPath="/login" path="/organizations" component={Organizations} />
<ConditionalRedirect shouldRedirect={() => !api.isAuthenticated()} redirectPath="/login" path="/users" component={Users} />
<ConditionalRedirect shouldRedirect={() => !api.isAuthenticated()} redirectPath="/login" path="/teams" component={Teams} />
<ConditionalRedirect shouldRedirect={() => !api.isAuthenticated()} redirectPath="/login" path="/credential_types" component={CredentialTypes} />
<ConditionalRedirect shouldRedirect={() => !api.isAuthenticated()} redirectPath="/login" path="/notification_templates" component={NotificationTemplates} />
<ConditionalRedirect shouldRedirect={() => !api.isAuthenticated()} redirectPath="/login" path="/management_jobs" component={ManagementJobs} />
<ConditionalRedirect shouldRedirect={() => !api.isAuthenticated()} redirectPath="/login" path="/instance_groups" component={InstanceGroups} />
<ConditionalRedirect shouldRedirect={() => !api.isAuthenticated()} redirectPath="/login" path="/applications" component={Applications} />
<ConditionalRedirect shouldRedirect={() => !api.isAuthenticated()} redirectPath="/login" path="/auth_settings" component={AuthSettings} />
<ConditionalRedirect shouldRedirect={() => !api.isAuthenticated()} redirectPath="/login" path="/jobs_settings" component={JobsSettings} />
<ConditionalRedirect shouldRedirect={() => !api.isAuthenticated()} redirectPath="/login" path="/system_settings" component={SystemSettings} />
<ConditionalRedirect shouldRedirect={() => !api.isAuthenticated()} redirectPath="/login" path="/ui_settings" component={UISettings} />
<ConditionalRedirect shouldRedirect={() => !api.isAuthenticated()} redirectPath="/login" path="/license" component={License} />
</Page>
</Fragment>
</Switch>
</Fragment>
);
}
}
export default App;
export default withRouter(App);

View File

@ -1,6 +1,9 @@
import React from 'react';
import { render } from 'react-dom';
import {
HashRouter as Router
} from 'react-router-dom';
import App from './App';
import api from './api';
import { API_ROOT } from './endpoints';
@ -15,8 +18,8 @@ import './components/DataListToolbar/styles.scss';
const el = document.getElementById('app');
const main = async () => {
const { custom_logo, custom_login_info } = await api.get(API_ROOT);
render(<App logo={custom_logo} loginInfo={custom_login_info} />, el);
const { custom_logo, custom_login_info } = await api.get(API_ROOT);
render(<Router><App logo={custom_logo} loginInfo={custom_login_info} /></Router>, el);
};
main();