Skip to content

Commit bf89357

Browse files
authored
Merge pull request #2 from ryoldash/u-yasir
U yasir
2 parents 3ff7628 + 7728bcb commit bf89357

34 files changed

+1198
-127
lines changed

reactjs/.env.development

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
REACT_APP_API_URL="http://localhost:21021/"
1+
REACT_APP_API_URL="http://localhost:21021/api/"

reactjs/src/App.tsx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,26 @@ import * as React from 'react';
22
import './App.css';
33

44
import * as abpUserConfiguration from './services/abpUserConfigurationService';
5-
import { withRouter } from 'react-router-dom';
5+
import { withRouter, Switch, Route } from 'react-router-dom';
66
import Layout from './scenes/Layout';
7+
8+
import Login from "./scenes/Login"
79
class App extends React.Component {
810
componentDidMount() {
911
console.log(abpUserConfiguration.initialize());
1012
}
1113
public render() {
12-
return <Layout />;
14+
return (
15+
<Switch>
16+
<Route path="/dashboard" component={Layout} />
17+
<Route path="/users" component={Layout} />
18+
<Route path="/tenants" component={Layout} />
19+
<Route path="/roles" component={Layout} />
20+
<Route path="/about" component={Layout} />
21+
<Route path="/login" component={Login } />
22+
<Route path="/" component={Login } />
23+
</Switch>
24+
)
1325
}
1426
}
1527

reactjs/src/components/Header/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import * as React from 'react';
22
import { Col, Icon, Layout, Avatar, Menu, Dropdown, Badge } from 'antd';
3+
import { Link } from 'react-router-dom';
34

45
export interface LayoutHeaderProps {
56
collapsed?: any;
@@ -10,7 +11,7 @@ const userDropdownMenu = (
1011
<Menu>
1112
<Menu.Item key="2">
1213
<Icon type="logout" />
13-
<span>Logout</span>
14+
<span> <Link to="/login">Logout</Link></span>
1415
</Menu.Item>
1516
</Menu>
1617
);

reactjs/src/index.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,17 @@ import * as ReactDOM from "react-dom";
44
import "./index.css";
55
import registerServiceWorker from "./registerServiceWorker";
66
import App from "./App";
7-
import AuthenticationStores from "./stores/authenticationStore";
7+
import AuthenticationStores from "./stores/tokenAuthStore";
88
import { Provider } from "mobx-react";
99
import { HashRouter } from "react-router-dom";
10+
import RoleStores from "./stores/roleStore"
11+
import TenantStores from './stores/tenantStore';
12+
import UserStores from "./stores/userStore"
1013
const stores = {
11-
AuthenticationStores
14+
AuthenticationStores,
15+
RoleStores,
16+
TenantStores,
17+
UserStores,
1218
};
1319

1420
ReactDOM.render(

reactjs/src/scenes/Layout/index.tsx

Lines changed: 21 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import './index.css';
44
import { Route, Switch, withRouter } from 'react-router';
55
import Users from '../Users';
66
import Tenants from '../Tenants';
7-
import Rules from '../Rules';
7+
import Roles from '../Roles';
88
import SubMenu from 'antd/lib/menu/SubMenu';
99
import AbpLogo from 'src/images/abp-logo-long.png';
1010
import About from '../About';
@@ -28,58 +28,45 @@ class LayoutComponent extends React.Component<any> {
2828
};
2929

3030
render() {
31-
return (
32-
<Layout style={{ minHeight: '100vh' }}>
31+
const {path} = this.props.match;
32+
33+
return <Layout style={{ minHeight: '100vh' }}>
3334
<Sider trigger={null} className={'sidebar'} width={256} collapsible collapsed={this.state.collapsed} onCollapse={this.onCollapse}>
34-
{this.state.collapsed ? (
35-
<Col style={{ textAlign: 'center', marginTop: 15, marginBottom: 10 }}>
35+
{this.state.collapsed ? <Col style={{ textAlign: 'center', marginTop: 15, marginBottom: 10 }}>
3636
<Avatar shape="square" style={{ height: 27, width: 64 }} src={AbpLogo} />
37-
</Col>
38-
) : (
39-
<Col style={{ textAlign: 'center', marginTop: 15, marginBottom: 10 }}>
37+
</Col> : <Col style={{ textAlign: 'center', marginTop: 15, marginBottom: 10 }}>
4038
<Avatar shape="square" style={{ height: 54, width: 128 }} src={AbpLogo} />
41-
</Col>
42-
)}
39+
</Col>}
4340

44-
<Menu theme="dark" mode="inline" defaultSelectedKeys={['1']}>
45-
<Menu.Item onClick={() => this.props.history.push('/dashboard')} key="1">
41+
<Menu theme="dark" mode="inline" defaultSelectedKeys={path}>
42+
<Menu.Item key={'/dashboard'} onClick={() => this.props.history.push('/dashboard')}>
4643
<Icon type="home" />
4744
<span>Home</span>
4845
</Menu.Item>
49-
<Menu.Item onClick={() => this.props.history.push('/tenants')} key="2">
46+
<Menu.Item key={'/tenants'} onClick={() => this.props.history.push('/tenants')}>
5047
<Icon type="appstore" />
5148
<span>Tenants</span>
5249
</Menu.Item>
53-
<Menu.Item onClick={() => this.props.history.push('/users')} key="3">
50+
<Menu.Item key={'/users'} onClick={() => this.props.history.push('/users')}>
5451
<Icon type="user" />
5552
<span>Users</span>
5653
</Menu.Item>
57-
<Menu.Item onClick={() => this.props.history.push('/rules')} key="4">
54+
<Menu.Item key={'/roles'} onClick={() => this.props.history.push('/roles')}>
5855
<Icon type="tags" />
5956
<span>Rules</span>
6057
</Menu.Item>
61-
<Menu.Item onClick={() => this.props.history.push('/about')} key="5">
58+
<Menu.Item key={'/about'} onClick={() => this.props.history.push('/about')}>
6259
<Icon type="info-circle" />
6360
<span>About</span>
6461
</Menu.Item>
65-
<SubMenu
66-
key="6"
67-
title={
68-
<span>
62+
<SubMenu key="6" title={<span>
6963
<Icon type="bars" />
7064
<span>Multi Level Menu</span>
71-
</span>
72-
}
73-
>
74-
<SubMenu
75-
key="7"
76-
title={
77-
<span>
65+
</span>}>
66+
<SubMenu key="7" title={<span>
7867
<Icon type="bars" />
7968
<span>ASP.NET Boilerplate</span>
80-
</span>
81-
}
82-
>
69+
</span>}>
8370
<Menu.Item key="8">
8471
<span>Home</span>
8572
</Menu.Item>
@@ -93,15 +80,10 @@ class LayoutComponent extends React.Component<any> {
9380
<span>Documents</span>
9481
</Menu.Item>
9582
</SubMenu>
96-
<SubMenu
97-
key="12"
98-
title={
99-
<span>
83+
<SubMenu key="12" title={<span>
10084
<Icon type="bars" />
10185
<span>ASP.NET Zero</span>
102-
</span>
103-
}
104-
>
86+
</span>}>
10587
<Menu.Item key="13">
10688
<span>Home</span>
10789
</Menu.Item>
@@ -130,7 +112,7 @@ class LayoutComponent extends React.Component<any> {
130112
<Route path="/dashboard" component={Dashboard} />
131113
<Route path="/users" component={Users} />
132114
<Route path="/tenants" component={Tenants} />
133-
<Route path="/rules" component={Rules} />
115+
<Route path="/roles" component={Roles} />
134116
<Route path="/about" component={About} />
135117
</Switch>
136118
</div>
@@ -139,8 +121,7 @@ class LayoutComponent extends React.Component<any> {
139121
Asp.Net Boilerplate - React ©2018 <a href="https://github.com/ryoldash/module-zero-core-template">Github Page</a>
140122
</Layout.Footer>
141123
</Layout>
142-
</Layout>
143-
);
124+
</Layout>;
144125
}
145126
}
146127

reactjs/src/scenes/Login/index.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Form, Col, Input, Icon, Row, Checkbox, Button } from "antd";
1+
import { Form, Col, Input, Icon, Row, Checkbox, Button, Card } from "antd";
22
import * as React from "react";
33
import { inject, observer } from "mobx-react";
44
import { withRouter } from "react-router";
@@ -38,7 +38,7 @@ class Login extends React.Component<any, any> {
3838
e.preventDefault();
3939
this.props.form.validateFields((err: any, values: any) => {
4040
if (!err) {
41-
debugger;
41+
4242
this.props.AuthenticationStores.Login(values).then(console.log("TRUE"));
4343
}
4444
});
@@ -47,7 +47,7 @@ class Login extends React.Component<any, any> {
4747
public render() {
4848
const { getFieldDecorator } = this.props.form;
4949
return (
50-
<div>
50+
<Card>
5151
<Row>
5252
<Col
5353
xs={{ span: 20, offset: 2 }}
@@ -146,7 +146,7 @@ class Login extends React.Component<any, any> {
146146
</Form>
147147
</Col>
148148
</Row>
149-
</div>
149+
</Card>
150150
);
151151
}
152152
}
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
import * as React from 'react';
2+
import { Form, Input, Checkbox, Row } from 'antd';
3+
import FormItem from 'antd/lib/form/FormItem';
4+
5+
class CreateOrUpdateRoles extends React.Component<any> {
6+
constructor(props: any) {
7+
super(props);
8+
9+
}
10+
state = {
11+
confirmDirty: false,
12+
}
13+
compareToFirstPassword = (rule:any, value:any, callback:any) => {
14+
const form = this.props.form;
15+
if (value && value !== form.getFieldValue('password')) {
16+
callback('Two passwords that you enter is inconsistent!');
17+
} else {
18+
callback();
19+
}
20+
}
21+
22+
validateToNextPassword = (rule:any, value:any, callback:any) => {
23+
const form = this.props.form;
24+
if (value && this.state.confirmDirty) {
25+
form.validateFields(['confirm'], { force: true });
26+
}
27+
callback();
28+
}
29+
render() {
30+
const formItemLayout = {
31+
labelCol: {
32+
xs: { span: 6 },
33+
sm: { span: 6 },
34+
md: { span: 6 },
35+
lg: { span: 6 },
36+
xl: { span: 6 },
37+
xxl: { span: 6 },
38+
},
39+
wrapperCol: {
40+
xs: { span: 18 },
41+
sm: { span: 18 },
42+
md: { span: 18 },
43+
lg: { span: 18 },
44+
xl: { span: 18 },
45+
xxl: { span: 18 },
46+
},
47+
};
48+
const tailFormItemLayout = {
49+
labelCol: {
50+
xs: { span: 6 },
51+
sm: { span: 6 },
52+
md: { span: 6 },
53+
lg: { span: 6 },
54+
xl: { span: 6 },
55+
xxl: { span: 6 },
56+
},
57+
wrapperCol: {
58+
xs: { span: 18 },
59+
sm: { span: 18 },
60+
md: { span: 18 },
61+
lg: { span: 18 },
62+
xl: { span: 18 },
63+
xxl: { span: 18 },
64+
},
65+
};
66+
const { getFieldDecorator } = this.props.form;
67+
return (
68+
69+
<Row>
70+
<FormItem label={'Role Name'} {...formItemLayout}>
71+
{getFieldDecorator('roleName', {
72+
rules: [{ required: true, message: 'Please input your name!' }],
73+
})(
74+
<Input />)}
75+
</FormItem>
76+
<FormItem label={'Display Name'} {...formItemLayout}>
77+
{getFieldDecorator('displayName', {
78+
rules: [{ required: true, message: 'Please input your surname!' }],
79+
})(
80+
<Input />)}
81+
</FormItem>
82+
<FormItem label={'Role Description'} {...formItemLayout}>
83+
{getFieldDecorator('roleDescription', {
84+
rules: [{ required: true, message: 'Please input your username!' }],
85+
})(
86+
<Input />)}
87+
</FormItem>
88+
89+
<FormItem label={'isActive'} {...tailFormItemLayout}>
90+
91+
{getFieldDecorator('password(repeat)', {
92+
rules: [{ required: true, message: 'Please input your username!' }],
93+
})(
94+
95+
<Checkbox >
96+
Aktif
97+
</Checkbox>)}
98+
</FormItem>
99+
100+
</Row>
101+
)
102+
}
103+
}
104+
105+
const nwUserInfoCreateOrEdit = Form.create()(CreateOrUpdateRoles);
106+
export default nwUserInfoCreateOrEdit;

0 commit comments

Comments
 (0)