Skip to content

Commit 7a89084

Browse files
committed
user ,role ant tenant index is done,Delete action is done
1 parent fc297c7 commit 7a89084

33 files changed

+1166
-90
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: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,25 @@ 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+
</Switch>
23+
)
1324
}
1425
}
1526

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: 3 additions & 3 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';
@@ -54,7 +54,7 @@ class LayoutComponent extends React.Component<any> {
5454
<Icon type="user" />
5555
<span>Users</span>
5656
</Menu.Item>
57-
<Menu.Item onClick={() => this.props.history.push('/rules')} key="4">
57+
<Menu.Item onClick={() => this.props.history.push('/roles')} key="4">
5858
<Icon type="tags" />
5959
<span>Rules</span>
6060
</Menu.Item>
@@ -130,7 +130,7 @@ class LayoutComponent extends React.Component<any> {
130130
<Route path="/dashboard" component={Dashboard} />
131131
<Route path="/users" component={Users} />
132132
<Route path="/tenants" component={Tenants} />
133-
<Route path="/rules" component={Rules} />
133+
<Route path="/roles" component={Roles} />
134134
<Route path="/about" component={About} />
135135
</Switch>
136136
</div>

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;

reactjs/src/scenes/Roles/index.tsx

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
import { Card, Col, Row, Modal, Button, Table, Dropdown, Menu } from 'antd';
2+
import 'antd/dist/antd.css';
3+
import *as React from 'react';
4+
import { EntityDto } from 'src/services/dto/entityDto';
5+
import CreateOrUpdateRules from "./components/createOrUpdateRoles"
6+
import { observer, inject } from 'mobx-react';
7+
8+
9+
@inject('RoleStores')
10+
@observer
11+
class Role extends React.Component<any> {
12+
constructor(props: any) {
13+
super(props);
14+
}
15+
state = {
16+
modalVisible: false,
17+
maxResultCount: 10,
18+
skipCount:0
19+
};
20+
21+
async componentWillMount() {
22+
await this.getAll();
23+
}
24+
25+
async getAll() {
26+
await this.props.RoleStores.getAll({ maxResultCount: this.state.maxResultCount, skipCount: this.state.skipCount });
27+
}
28+
handleTableChange = (pagination: any) => {
29+
30+
this.setState({ skipCount: (pagination.current - 1) * this.state.maxResultCount! }, async () => await this.getAll());
31+
};
32+
Modal = () => {
33+
this.setState({
34+
modalVisible: !this.state.modalVisible,
35+
});
36+
};
37+
38+
createOrUpdateModalOpen(entityDto: EntityDto) {
39+
// if (entityDto.id == 0) {
40+
// this.props.UserStores.onCreate();
41+
// } else {
42+
// this.props.UserStores.getUserForEdit(entityDto);
43+
// }
44+
this.Modal();
45+
}
46+
47+
delete(input: EntityDto) {
48+
debugger;
49+
this.props.RoleStores.delete(input);
50+
}
51+
public render() {
52+
const { roles } = this.props.RoleStores;
53+
;
54+
const columns = [
55+
{ title: 'Role Name', dataIndex: 'name', key: 'name', width: 150, render: (text: string) => <div>{text}</div> },
56+
{ title: 'Display Name', dataIndex: 'displayName', key: 'displayName', width: 150, render: (text: string) => <div>{text}</div> },
57+
{
58+
title: 'Actions',
59+
width: 150,
60+
render: (text: string, item: any) => (
61+
<div>
62+
<Dropdown
63+
trigger={['click']}
64+
overlay={
65+
<Menu>
66+
<Menu.Item>
67+
<a onClick={() => this.createOrUpdateModalOpen({ id: item.id })}>Düzenle</a>
68+
</Menu.Item>
69+
<Menu.Item>
70+
<a onClick={() => this.delete({ id: item.id })}>Sil</a>
71+
</Menu.Item>
72+
</Menu>
73+
}
74+
placement="bottomLeft"
75+
>
76+
<Button type="primary" icon="setting">
77+
işlemler
78+
</Button>
79+
</Dropdown>
80+
</div>
81+
),
82+
},
83+
];
84+
return <Card>
85+
<Row>
86+
<Col xs={{ span: 4, offset: 0 }} sm={{ span: 4, offset: 0 }} md={{ span: 4, offset: 0 }} lg={{ span: 2, offset: 0 }} xl={{ span: 2, offset: 0 }} xxl={{ span: 2, offset: 0 }}>
87+
<h2>Roles</h2>
88+
</Col>
89+
<Col xs={{ span: 14, offset: 0 }} sm={{ span: 15, offset: 0 }} md={{ span: 15, offset: 0 }} lg={{ span: 1, offset: 21 }} xl={{ span: 1, offset: 21 }} xxl={{ span: 1, offset: 21 }}>
90+
<Button type="primary" shape="circle" icon="plus" onClick={() => this.createOrUpdateModalOpen({ id: 0 })} />
91+
</Col>
92+
</Row>
93+
<Row style={{ marginTop: 20 }}>
94+
<Col xs={{ span: 24, offset: 0 }} sm={{ span: 24, offset: 0 }} md={{ span: 24, offset: 0 }} lg={{ span: 24, offset: 0 }} xl={{ span: 24, offset: 0 }} xxl={{ span: 24, offset: 0 }}>
95+
<Table size={'default'} bordered={true} pagination={{ pageSize: this.state.maxResultCount, total: roles == undefined ? 0 : roles.totalCount, defaultCurrent: 1 }} columns={columns} loading={roles == undefined ? true : false} dataSource={roles == undefined ? [] : roles.items} onChange={this.handleTableChange} />
96+
</Col>
97+
</Row>
98+
<Modal visible={this.state.modalVisible} onCancel={() => this.setState({ modalVisible: false })} title={'User'} width={550}>
99+
<CreateOrUpdateRules />
100+
</Modal>
101+
</Card>;
102+
}
103+
}
104+
105+
export default Role;

reactjs/src/scenes/Rules/index.tsx

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)