Skip to content

Commit 7d72649

Browse files
authored
Merge pull request #7 from ryoldash/u-yasirCodeRefactoring
Exception page bug fixed and Delete confirm added
2 parents 23a687b + 7195328 commit 7d72649

File tree

9 files changed

+63
-46
lines changed

9 files changed

+63
-46
lines changed

reactjs/src/scenes/Exception/index.tsx

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,30 +7,17 @@ import './index.css';
77
import * as React from 'react';
88
import { Row, Col, Avatar, Button } from 'antd';
99

10-
const exception = [
11-
{
12-
errorCode: '404',
13-
errorImg: error404,
14-
errorDescription: 'Sorry, the page you visited does not exist',
15-
},
16-
{
17-
errorCode: '401',
18-
errorImg: error401,
19-
errorDescription: 'Kardeş, Nere gidiyon',
20-
},
21-
{
22-
errorCode: '500',
23-
errorImg: error500,
24-
errorDescription: 'Kardeş yavas , Sunucu Gitti',
25-
},
26-
];
10+
2711

2812
class Exception extends React.Component<any, any> {
2913
constructor(props: any) {
3014
super(props);
3115
}
3216

3317
public render() {
18+
const exception = [{ errorCode: '404', errorImg: error404, errorDescription: 'Sorry, the page you visited does not exist' }, {
19+
errorCode: '401', errorImg: error401, errorDescription: 'Sorry, you dont have access to this page' },
20+
{ errorCode: '500', errorImg: error500, errorDescription: 'Sorry, the server is reporting an error' }];
3421
let params = new URLSearchParams(this.props.location.search);
3522
const test = params.get('type');
3623

@@ -46,9 +33,9 @@ class Exception extends React.Component<any, any> {
4633
xs={{ span: 7, offset: 1 }}
4734
sm={{ span: 7, offset: 1 }}
4835
md={{ span: 7, offset: 1 }}
49-
lg={{ span: 5, offset: 8 }}
50-
xl={{ span: 5, offset: 8 }}
51-
xxl={{ span: 5, offset: 8 }}
36+
lg={{ span: 10, offset: 4 }}
37+
xl={{ span: 10, offset: 4 }}
38+
xxl={{ span: 10, offset: 4 }}
5239
>
5340
<Avatar shape="square" className={'errorAvatar'} src={error!.errorImg} />
5441
</Col>

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ class CreateOrUpdateRoles extends React.Component<any> {
1919
};
2020

2121
render() {
22-
debugger;
22+
2323
const { permission } = this.props;
24-
debugger;
24+
2525
const options = permission.map((x: GetAllPermissionsOutput) => {
2626
var test = { label: x.displayName, value: x.name };
2727
return test;

reactjs/src/scenes/Roles/index.tsx

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Card, Col, Row, Button, Table, Dropdown, Menu } from 'antd';
1+
import { Card, Col, Row, Button, Table, Dropdown, Menu, Modal } from 'antd';
22
import 'antd/dist/antd.css';
33
import * as React from 'react';
44
import { EntityDto } from 'src/services/dto/entityDto';
@@ -18,7 +18,7 @@ export interface IRoleState {
1818
maxResultCount: number;
1919
skipCount: number;
2020
}
21-
21+
const confirm = Modal.confirm;
2222
@inject(Stores.RoleStore)
2323
@observer
2424
class Role extends AppComponentBase<any> {
@@ -39,7 +39,7 @@ class Role extends AppComponentBase<any> {
3939
}
4040

4141
async getAll() {
42-
debugger;
42+
4343
await this.props.roleStore.getAll({ maxResultCount: this.state.maxResultCount, skipCount: this.state.skipCount });
4444
}
4545

@@ -68,20 +68,30 @@ class Role extends AppComponentBase<any> {
6868
this.setState({ roleId: entityDto.id })
6969
this.Modal();
7070

71-
debugger;
71+
7272
this.formRef.props.form.setFieldsValue({
7373
...this.props.roleStore.roleForEdit.role,
7474
permissions: this.props.roleStore.roleForEdit.grantedPermissionNames,
7575
});
7676
}
7777

7878
delete(input: EntityDto) {
79-
this.props.roleStore.delete(input);
79+
const self = this;
80+
confirm({
81+
title: 'Do you Want to delete these items?',
82+
onOk() {
83+
self.props.roleStore.delete(input);
84+
},
85+
onCancel() {
86+
console.log('Cancel');
87+
},
88+
});
89+
8090
}
8191
handleCreate = () => {
8292
const form = this.formRef.props.form;
8393
form.validateFields(async (err: any, values: any) => {
84-
debugger;
94+
8595
if (err) {
8696
return;
8797
}

reactjs/src/scenes/Tenants/components/createOrUpdateTenant.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,14 @@ class CreateOrUpdateTenant extends React.Component<any> {
5555
return <Modal visible={visible} onCancel={onCancel} onOk={onCreate} title={'User'} width={550}>
5656
<Form>
5757
<FormItem label={L('TenancyName')} {...formItemLayout}>
58-
{this.props.form.getFieldDecorator('tenancyName', { rules: [{ required: true, message: 'Please input your name!' }] })(<Input />)}
58+
{this.props.form.getFieldDecorator('tenancyName', { rules: [{ required: true, message: 'Please input TenancyName!' }] })(<Input />)}
5959
</FormItem>
6060
<FormItem label={L('Name')} {...formItemLayout}>
61-
{getFieldDecorator('name', { rules: [{ required: true, message: 'Please input your surname!' }] })(<Input />)}
61+
{getFieldDecorator('name', { rules: [{ required: true, message: 'Please input your name!' }] })(<Input />)}
6262
</FormItem>
6363
{this.props.modalType == 'edit' ? <FormItem label={L('AdminEmailAddress')} {...formItemLayout}>
6464
{getFieldDecorator('adminEmailAddress', {
65-
rules: [{ type: 'email', required: true, message: 'Please input your username!' }],
65+
rules: [{ type: 'email', required: true, message: 'Please input your email!' }],
6666
})(<Input />)}
6767
</FormItem> : null}
6868
{this.props.modalType == 'edit' ? <FormItem label={L('DatabaseConnectionString')} {...formItemLayout}>

reactjs/src/scenes/Tenants/index.tsx

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Card, Col, Row, Button, Table, Tag, Dropdown, Menu } from 'antd';
1+
import { Card, Col, Row, Button, Table, Tag, Dropdown, Menu, Modal } from 'antd';
22
import 'antd/dist/antd.css';
33
import *as React from 'react';
44
import { EntityDto } from 'src/services/dto/entityDto';
@@ -12,7 +12,7 @@ import { L } from 'src/lib/abpUtility';
1212
export interface ITenantProps {
1313
tenantStore: TenantStore;
1414
}
15-
15+
const confirm = Modal.confirm;
1616
@inject(Stores.TenantStore)
1717
@observer
1818
class Tenant extends React.Component<any> {
@@ -61,8 +61,18 @@ class Tenant extends React.Component<any> {
6161
});
6262
}
6363

64-
delete(input: EntityDto) {
65-
this.props.tenantStore.delete(input);
64+
delete (input: EntityDto) {
65+
const self=this;
66+
confirm({
67+
title: 'Do you Want to delete these items?',
68+
onOk() {
69+
self.props.tenantStore.delete(input);
70+
},
71+
onCancel() {
72+
console.log('Cancel');
73+
},
74+
});
75+
6676
}
6777

6878
handleCreate = () => {

reactjs/src/scenes/Users/components/createOrUpdateUser.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class CreateOrUpdateUser extends React.Component<any> {
3232
};
3333
render() {
3434
const { roles}=this.props
35-
debugger;
35+
3636
const formItemLayout = {
3737
labelCol: {
3838
xs: { span: 6 },

reactjs/src/scenes/Users/index.tsx

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Card, Col, Row, Button, Table, Tag, Dropdown, Menu } from 'antd';
1+
import { Card, Col, Row, Button, Table, Tag, Dropdown, Menu, Modal } from 'antd';
22
import 'antd/dist/antd.css';
33
import *as React from 'react';
44
import CreateOrUpdateUser from './components/createOrUpdateUser';
@@ -12,7 +12,7 @@ import { L } from 'src/lib/abpUtility';
1212
export interface IUserProps {
1313
userStore: UserStore;
1414
}
15-
15+
const confirm = Modal.confirm;
1616
@inject(Stores.UserStore)
1717
@observer
1818
class User extends React.Component<any> {
@@ -56,19 +56,29 @@ class User extends React.Component<any> {
5656
this.setState({ userId: entityDto.id });
5757
this.Modal();
5858

59-
debugger;
59+
6060
this.formRef.props.form.setFieldsValue({ ...this.props.userStore.editUser, roleNames: this.props.userStore.editUser.roleNames });
6161
}
6262

6363
delete(input: EntityDto) {
64-
this.props.userStore.delete(input);
64+
const self = this;
65+
confirm({
66+
title: 'Do you Want to delete these items?',
67+
onOk() {
68+
self.props.userStore.delete(input);
69+
},
70+
onCancel() {
71+
console.log('Cancel');
72+
},
73+
});
74+
6575
}
6676
handleCreate = () => {
67-
debugger;
77+
6878
const form = this.formRef.props.form;
6979

7080
form.validateFields(async (err: any, values: any) => {
71-
debugger;
81+
7282
if (err) {
7383
return;
7484
} else {
@@ -88,7 +98,7 @@ class User extends React.Component<any> {
8898
this.formRef = formRef;
8999
};
90100
public render() {
91-
debugger;
101+
92102
const { users } = this.props.userStore;
93103
const columns = [{ title: L('UserName'), dataIndex: 'userName', key: 'userName', width: 150, render: (text: string) => <div>
94104
{text}

reactjs/src/stores/roleStore.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class RoleStore {
1818
allPermissions: GetAllPermissionsOutput[]=[];
1919

2020
@action async create(createRoleInput:CreateRoleInput){
21-
debugger;
21+
2222

2323
console.log(JSON.stringify(createRoleInput));
2424
var result=await roleService.create(createRoleInput);

reactjs/src/stores/userStore.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ class UserStore {
1515

1616
@action
1717
async create(createUserInput: CreateOrUpdateUserInput) {
18-
debugger;
18+
1919
var result = await userService.create(createUserInput);
2020
console.log(result);
2121
this.users.items.push(result);
2222
}
2323

2424
@action
2525
async update(updateUserInput: UpdateUserInput) {
26-
debugger;
26+
2727
var result = await userService.update(updateUserInput);
2828
console.log(result);
2929
this.users.items = this.users.items.map((x: GetUserOutput) => {

0 commit comments

Comments
 (0)