Skip to content

Commit da7d164

Browse files
authored
Merge pull request #6 from ryoldash/u-yasirCodeRefactoring
refactoring is done
2 parents 4ef67cc + 858cba7 commit da7d164

22 files changed

+677
-574
lines changed

reactjs/src/images/401.png

19.4 KB
Loading

reactjs/src/images/404.png

25.5 KB
Loading

reactjs/src/images/500.png

21.5 KB
Loading
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
.errorAvatar {
2+
height: 360px;
3+
width: 430px;
4+
}
5+
6+
.errorTitle {
7+
color: #434e59;
8+
font-size: 72px;
9+
font-weight: 600;
10+
line-height: 72px;
11+
margin-bottom: 24px;
12+
}
13+
.errorDescription {
14+
color: rgba(0, 0, 0, 0.45);
15+
font-size: 20px;
16+
line-height: 28px;
17+
margin-bottom: 16px;
18+
}
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
2+
3+
4+
5+
import error404 from 'src/images/404.png';
6+
import error401 from 'src/images/401.png';
7+
import error500 from 'src/images/500.png';
8+
import { Link } from 'react-router-dom';
9+
10+
import './index.css';
11+
import * as React from 'react';
12+
import { Row, Col, Avatar, Button } from 'antd';
13+
14+
15+
const exception = [
16+
{
17+
errorCode: '404',
18+
errorImg: error404,
19+
errorDescription: 'Sorry, the page you visited does not exist',
20+
},
21+
{
22+
errorCode: '401',
23+
errorImg: error401,
24+
errorDescription: 'Kardeş, Nere gidiyon',
25+
},
26+
{
27+
errorCode: '500',
28+
errorImg: error500,
29+
errorDescription: 'Kardeş yavas , Sunucu Gitti',
30+
},
31+
];
32+
33+
class Exception extends React.Component<any, any> {
34+
constructor(props: any) {
35+
super(props);
36+
}
37+
38+
public render() {
39+
let params = new URLSearchParams(this.props.location.search);
40+
const test = params.get('type');
41+
42+
var error = exception.find(x => x.errorCode === test);
43+
44+
if (error == null) {
45+
error = exception[0];
46+
}
47+
48+
return (
49+
<Row style={{ marginTop: 150 }}>
50+
<Col
51+
xs={{ span: 7, offset: 1 }}
52+
sm={{ span: 7, offset: 1 }}
53+
md={{ span: 7, offset: 1 }}
54+
lg={{ span: 5, offset: 8 }}
55+
xl={{ span: 5, offset: 8 }}
56+
xxl={{ span: 5, offset: 8 }}
57+
>
58+
<Avatar shape="square" className={'errorAvatar'} src={error!.errorImg} />
59+
</Col>
60+
<Col
61+
xs={{ span: 7, offset: 1 }}
62+
sm={{ span: 7, offset: 1 }}
63+
md={{ span: 7, offset: 1 }}
64+
lg={{ span: 5, offset: 1 }}
65+
xl={{ span: 5, offset: 1 }}
66+
xxl={{ span: 5, offset: 1 }}
67+
style={{ marginTop: 75 }}
68+
>
69+
<Col
70+
xs={{ span: 24, offset: 0 }}
71+
sm={{ span: 24, offset: 0 }}
72+
md={{ span: 24, offset: 0 }}
73+
lg={{ span: 24, offset: 0 }}
74+
xl={{ span: 24, offset: 0 }}
75+
xxl={{ span: 24, offset: 0 }}
76+
>
77+
<h1 className={'errorTitle'}>{error!.errorCode}</h1>
78+
</Col>
79+
<Col
80+
xs={{ span: 24, offset: 0 }}
81+
sm={{ span: 24, offset: 0 }}
82+
md={{ span: 24, offset: 0 }}
83+
lg={{ span: 24, offset: 0 }}
84+
xl={{ span: 24, offset: 0 }}
85+
xxl={{ span: 24, offset: 0 }}
86+
>
87+
<h5 className={'errorDescription'}> {error!.errorDescription}</h5>
88+
</Col>
89+
<Col
90+
xs={{ span: 24, offset: 0 }}
91+
sm={{ span: 24, offset: 0 }}
92+
md={{ span: 24, offset: 0 }}
93+
lg={{ span: 24, offset: 0 }}
94+
xl={{ span: 24, offset: 0 }}
95+
xxl={{ span: 24, offset: 0 }}
96+
>
97+
<Button type={'primary'}>
98+
<Link
99+
to={{
100+
pathname: '/dashboard',
101+
}}
102+
>
103+
Back to Home
104+
</Link>
105+
</Button>
106+
</Col>
107+
</Col>
108+
<Col />
109+
</Row>
110+
);
111+
}
112+
}
113+
114+
export default Exception;

reactjs/src/scenes/Roles/components/createOrUpdateRoles.tsx

Lines changed: 52 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,32 @@
11
import * as React from 'react';
2-
import { Form, Input, Checkbox, Row } from 'antd';
2+
import { Form, Input, Checkbox, Modal, Tabs } from 'antd';
33
import FormItem from 'antd/lib/form/FormItem';
44

5+
import CheckboxGroup from 'antd/lib/checkbox/Group';
6+
import { GetAllPermissionsOutput } from 'src/services/role/dto/getAllPermissionsOutput';
7+
import { L } from 'src/lib/abpUtility';
8+
9+
10+
11+
const TabPane = Tabs.TabPane;
512
class CreateOrUpdateRoles extends React.Component<any> {
613
constructor(props: any) {
714
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-
}
2015
}
2116

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-
}
17+
state = {
18+
confirmDirty: false,
19+
};
20+
2921
render() {
22+
debugger;
23+
const { permission } = this.props;
24+
debugger;
25+
const options = permission.map((x: GetAllPermissionsOutput) => {
26+
var test = { label: x.displayName, value: x.name };
27+
return test;
28+
});
29+
3030
const formItemLayout = {
3131
labelCol: {
3232
xs: { span: 6 },
@@ -64,41 +64,38 @@ state = {
6464
},
6565
};
6666
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-
)
67+
return <Modal
68+
visible={this.props.visible}
69+
cancelText={L('Cancel')}
70+
okText={L('OK')}
71+
onCancel={this.props.onCancel}
72+
title={L('Role')}
73+
onOk={this.props.onOk}>
74+
<Tabs defaultActiveKey={'Role'} size={'small'} tabBarGutter={64}>
75+
<TabPane tab={L('RoleDetails')} key={'role'}>
76+
<FormItem label={L('RoleName')} {...formItemLayout}>
77+
{getFieldDecorator('name', { rules: [{ required: true, message: 'Please input your name!' }] })(<Input />)}
78+
</FormItem>
79+
<FormItem label={L('DisplayName')} {...formItemLayout}>
80+
{getFieldDecorator('displayName', { rules: [{ required: true, message: 'Please input your surname!' }] })(<Input />)}
81+
</FormItem>
82+
<FormItem label={L('Description')} {...formItemLayout}>
83+
{getFieldDecorator('description', { rules: [{ required: true, message: 'Please input your username!' }] })(<Input />)}
84+
</FormItem>
85+
<FormItem label={L('IsActive')} {...tailFormItemLayout}>
86+
{getFieldDecorator('isStatic', {
87+
rules: [{ required: true, message: 'Please input your username!' }],
88+
valuePropName: 'checked',
89+
})(<Checkbox>Aktif</Checkbox>)}
90+
</FormItem>
91+
</TabPane>
92+
<TabPane tab={L('RolePermission')} key={'permission'}>
93+
<FormItem {...tailFormItemLayout}>
94+
{getFieldDecorator('permissions', { valuePropName: 'value' })(<CheckboxGroup options={options} />)}
95+
</FormItem>
96+
</TabPane>
97+
</Tabs>
98+
</Modal>;
10299
}
103100
}
104101

0 commit comments

Comments
 (0)