namirasoft-account-react 1.4.19 → 1.4.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.template +10 -10
- package/config-overrides.js +72 -72
- package/dist/IEntityInfo.d.ts +11 -11
- package/dist/Messages.js.map +1 -1
- package/dist/NSARouterMaker.d.ts +0 -1
- package/dist/NSARouterMaker.js.map +1 -1
- package/dist/Router.d.ts +0 -1
- package/dist/components/NSAAccessListDialog.js.map +1 -1
- package/dist/components/NSAAccessListDialog.module.css +87 -0
- package/dist/components/NSABoxOTP.js.map +1 -1
- package/dist/components/NSABoxOTP.module.css +11 -0
- package/dist/components/NSAMessageListDialog.js.map +1 -1
- package/dist/components/NSAMessageListDialog.module.css +98 -0
- package/dist/components/NSAProductListDialog.js.map +1 -1
- package/dist/components/NSAProductListDialog.module.css +45 -0
- package/dist/components/NSAWorkspaceListDialog.js.map +1 -1
- package/dist/components/NSAWorkspaceListDialog.module.css +43 -0
- package/dist/index.js.map +1 -1
- package/dist/layouts/Actions.d.ts +2 -1
- package/dist/layouts/Actions.js +38 -17
- package/dist/layouts/Actions.js.map +1 -1
- package/dist/layouts/NSALayout.d.ts +2 -1
- package/dist/layouts/NSALayout.js +58 -37
- package/dist/layouts/NSALayout.js.map +1 -1
- package/dist/layouts/NSASectionEdit.d.ts +0 -1
- package/dist/layouts/NSASectionEdit.js +12 -8
- package/dist/layouts/NSASectionEdit.js.map +1 -1
- package/dist/layouts/NSASectionList.js +6 -4
- package/dist/layouts/NSASectionList.js.map +1 -1
- package/dist/layouts/NSASectionTabs.d.ts +0 -1
- package/dist/layouts/NSASectionTabs.js +4 -7
- package/dist/layouts/NSASectionTabs.js.map +1 -1
- package/dist/layouts/NSASectionView.js +4 -3
- package/dist/layouts/NSASectionView.js.map +1 -1
- package/dist/pages/NSAHomePage.module.css +23 -0
- package/dist/pages/NSALoginPage.module.css +20 -0
- package/dist/pages/NSAVerificationPage.module.css +23 -0
- package/package.json +70 -70
- package/public/index.html +21 -21
- package/src/App.css +31 -31
- package/src/App.tsx +18 -18
- package/src/IEntityInfo.ts +31 -31
- package/src/INSARouterMaker.ts +7 -7
- package/src/INSARouterProps.ts +17 -17
- package/src/INSARouterState.ts +5 -5
- package/src/Info.ts +20 -20
- package/src/Message.ts +6 -6
- package/src/Messages.ts +33 -33
- package/src/NSARouterMaker.tsx +142 -142
- package/src/Router.tsx +39 -39
- package/src/components/NSAAccessListDialog.module.css +86 -86
- package/src/components/NSAAccessListDialog.tsx +160 -160
- package/src/components/NSABoxOTP.module.css +10 -10
- package/src/components/NSABoxOTP.tsx +63 -63
- package/src/components/NSAMessageListDialog.module.css +97 -97
- package/src/components/NSAMessageListDialog.tsx +116 -116
- package/src/components/NSAProductListDialog.module.css +44 -44
- package/src/components/NSAProductListDialog.tsx +100 -100
- package/src/components/NSAWorkspaceListDialog.module.css +42 -42
- package/src/components/NSAWorkspaceListDialog.tsx +73 -73
- package/src/index.tsx +24 -24
- package/src/layouts/Actions.ts +147 -119
- package/src/layouts/Menus.ts +15 -15
- package/src/layouts/NSALayout.tsx +417 -387
- package/src/layouts/NSASectionEdit.tsx +144 -140
- package/src/layouts/NSASectionList.tsx +161 -158
- package/src/layouts/NSASectionTabs.tsx +152 -156
- package/src/layouts/NSASectionView.tsx +61 -60
- package/src/main.ts +19 -19
- package/src/pages/NSAHomePage.module.css +22 -22
- package/src/pages/NSAHomePage.tsx +27 -27
- package/src/pages/NSALoginPage.module.css +19 -19
- package/src/pages/NSALoginPage.tsx +65 -65
- package/src/pages/NSAVerificationPage.module.css +22 -22
- package/src/pages/NSAVerificationPage.tsx +59 -59
- package/tsconfig.json +43 -43
|
@@ -1,117 +1,117 @@
|
|
|
1
|
-
import { Component } from 'react';
|
|
2
|
-
import { EnvService, FilterItem, FilterItemOperator } from 'namirasoft-core';
|
|
3
|
-
import { NSButtonBlue, NSDialog, NSDialogProps, NSLoading, NSNoData } from "namirasoft-site-react";
|
|
4
|
-
import { MetaDatabase, MessageRow, NamirasoftMessageServer } from 'namirasoft-message';
|
|
5
|
-
import { INSARouterProps } from '../INSARouterProps';
|
|
6
|
-
import Styles from './NSAMessageListDialog.module.css';
|
|
7
|
-
|
|
8
|
-
export interface NSAMessageListDialogProps extends INSARouterProps, NSDialogProps
|
|
9
|
-
{
|
|
10
|
-
onClose: () => void;
|
|
11
|
-
onSeenAll: () => void;
|
|
12
|
-
onCountReceived: (count: number) => void;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export interface NSAMessageListDialogState
|
|
16
|
-
{
|
|
17
|
-
messages: MessageRow[] | null;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export class NSAMessageListDialog extends Component<NSAMessageListDialogProps, NSAMessageListDialogState>
|
|
21
|
-
{
|
|
22
|
-
|
|
23
|
-
constructor(props: NSAMessageListDialogProps)
|
|
24
|
-
{
|
|
25
|
-
super(props);
|
|
26
|
-
this.state = { messages: null };
|
|
27
|
-
}
|
|
28
|
-
override componentDidMount(): void
|
|
29
|
-
{
|
|
30
|
-
let REACT_APP_BASE_URL_MESSAGE = new EnvService("REACT_APP_BASE_URL_MESSAGE", true).getString();
|
|
31
|
-
let server = new NamirasoftMessageServer(REACT_APP_BASE_URL_MESSAGE, this.props.account.token_manager, this.props.notifier.onError);
|
|
32
|
-
let filters = [new FilterItem(MetaDatabase.main.message, MetaDatabase.main.message.columns.seen_at, false, FilterItemOperator.all.empty)];
|
|
33
|
-
server.message.List(filters, 1, 5).then(res =>
|
|
34
|
-
{
|
|
35
|
-
this.setState({ messages: res.rows });
|
|
36
|
-
this.props.onCountReceived(res.count);
|
|
37
|
-
}).catch(() => { });
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
override render()
|
|
41
|
-
{
|
|
42
|
-
let content = null;
|
|
43
|
-
if (this.state.messages === null)
|
|
44
|
-
{
|
|
45
|
-
content = <NSLoading />;
|
|
46
|
-
}
|
|
47
|
-
else if (this.state.messages.length === 0)
|
|
48
|
-
{
|
|
49
|
-
content = <NSNoData lable='No new message' />
|
|
50
|
-
}
|
|
51
|
-
else
|
|
52
|
-
content = this.state.messages.map(message =>
|
|
53
|
-
<div
|
|
54
|
-
className={Styles.nsa_body_green}
|
|
55
|
-
onClick={() =>
|
|
56
|
-
{
|
|
57
|
-
let filters: FilterItem[] = [];
|
|
58
|
-
filters.push(new FilterItem(MetaDatabase.main.message, MetaDatabase.main.message.columns.id, false, FilterItemOperator.all.equals, message.id));
|
|
59
|
-
let encoded = FilterItem.encode(filters);
|
|
60
|
-
window.open("http://message.namirasoft.com/message/list?filters=" + encoded, "_blank");
|
|
61
|
-
}}
|
|
62
|
-
>
|
|
63
|
-
<ul className={Styles.nsa_message_item_ul}>
|
|
64
|
-
<li className={`${Styles.nsa_message_item_title}`}>{message.title}</li>
|
|
65
|
-
</ul>
|
|
66
|
-
<p className={`${Styles.nsa_message_item_content} nsa_font_13_normal`}>{message.body}</p>
|
|
67
|
-
</div>
|
|
68
|
-
);
|
|
69
|
-
return (
|
|
70
|
-
<NSDialog {...this.props}>
|
|
71
|
-
<div className={Styles.nsa_toast}>
|
|
72
|
-
<div>
|
|
73
|
-
<div className={Styles.nsa_toast_header}>
|
|
74
|
-
<article className='d-flex flex-row justify-content-center align-item-center'
|
|
75
|
-
style={{ cursor: "pointer" }}>
|
|
76
|
-
<img
|
|
77
|
-
src="https://static.namirasoft.com/image/concept/mark-all/blue.svg"
|
|
78
|
-
alt="Message Header"
|
|
79
|
-
width={22}
|
|
80
|
-
/>
|
|
81
|
-
<span
|
|
82
|
-
className={`${Styles.nsa_message_title} ms-2`}
|
|
83
|
-
onClick={() =>
|
|
84
|
-
{
|
|
85
|
-
let REACT_APP_BASE_URL_MESSAGE = new EnvService("REACT_APP_BASE_URL_MESSAGE", true).getString();
|
|
86
|
-
let server = new NamirasoftMessageServer(REACT_APP_BASE_URL_MESSAGE, this.props.account.token_manager, this.props.notifier.onError);
|
|
87
|
-
server.message.SeenAll().then(() =>
|
|
88
|
-
{
|
|
89
|
-
this.props.onSeenAll();
|
|
90
|
-
this.props.onClose();
|
|
91
|
-
}).catch(() => { });
|
|
92
|
-
}}
|
|
93
|
-
>
|
|
94
|
-
Mark All As Read
|
|
95
|
-
</span>
|
|
96
|
-
</article>
|
|
97
|
-
</div>
|
|
98
|
-
<div className={Styles.nsa_toast_body}>
|
|
99
|
-
{content}
|
|
100
|
-
<div className='p-3 mx-0 d-flex justify-content-center'>
|
|
101
|
-
<NSButtonBlue
|
|
102
|
-
onClick={() =>
|
|
103
|
-
{
|
|
104
|
-
window.open("http://message.namirasoft.com/message/list", "_blank");
|
|
105
|
-
}}
|
|
106
|
-
title='View All'
|
|
107
|
-
/>
|
|
108
|
-
</div>
|
|
109
|
-
</div>
|
|
110
|
-
</div>
|
|
111
|
-
</div>
|
|
112
|
-
<div className={Styles.nsa_toast_background}>
|
|
113
|
-
</div>
|
|
114
|
-
</NSDialog >
|
|
115
|
-
);
|
|
116
|
-
}
|
|
1
|
+
import { Component } from 'react';
|
|
2
|
+
import { EnvService, FilterItem, FilterItemOperator } from 'namirasoft-core';
|
|
3
|
+
import { NSButtonBlue, NSDialog, NSDialogProps, NSLoading, NSNoData } from "namirasoft-site-react";
|
|
4
|
+
import { MetaDatabase, MessageRow, NamirasoftMessageServer } from 'namirasoft-message';
|
|
5
|
+
import { INSARouterProps } from '../INSARouterProps';
|
|
6
|
+
import Styles from './NSAMessageListDialog.module.css';
|
|
7
|
+
|
|
8
|
+
export interface NSAMessageListDialogProps extends INSARouterProps, NSDialogProps
|
|
9
|
+
{
|
|
10
|
+
onClose: () => void;
|
|
11
|
+
onSeenAll: () => void;
|
|
12
|
+
onCountReceived: (count: number) => void;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface NSAMessageListDialogState
|
|
16
|
+
{
|
|
17
|
+
messages: MessageRow[] | null;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export class NSAMessageListDialog extends Component<NSAMessageListDialogProps, NSAMessageListDialogState>
|
|
21
|
+
{
|
|
22
|
+
|
|
23
|
+
constructor(props: NSAMessageListDialogProps)
|
|
24
|
+
{
|
|
25
|
+
super(props);
|
|
26
|
+
this.state = { messages: null };
|
|
27
|
+
}
|
|
28
|
+
override componentDidMount(): void
|
|
29
|
+
{
|
|
30
|
+
let REACT_APP_BASE_URL_MESSAGE = new EnvService("REACT_APP_BASE_URL_MESSAGE", true).getString();
|
|
31
|
+
let server = new NamirasoftMessageServer(REACT_APP_BASE_URL_MESSAGE, this.props.account.token_manager, this.props.notifier.onError);
|
|
32
|
+
let filters = [new FilterItem(MetaDatabase.main.message, MetaDatabase.main.message.columns.seen_at, false, FilterItemOperator.all.empty)];
|
|
33
|
+
server.message.List(filters, 1, 5).then(res =>
|
|
34
|
+
{
|
|
35
|
+
this.setState({ messages: res.rows });
|
|
36
|
+
this.props.onCountReceived(res.count);
|
|
37
|
+
}).catch(() => { });
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
override render()
|
|
41
|
+
{
|
|
42
|
+
let content = null;
|
|
43
|
+
if (this.state.messages === null)
|
|
44
|
+
{
|
|
45
|
+
content = <NSLoading />;
|
|
46
|
+
}
|
|
47
|
+
else if (this.state.messages.length === 0)
|
|
48
|
+
{
|
|
49
|
+
content = <NSNoData lable='No new message' />
|
|
50
|
+
}
|
|
51
|
+
else
|
|
52
|
+
content = this.state.messages.map(message =>
|
|
53
|
+
<div
|
|
54
|
+
className={Styles.nsa_body_green}
|
|
55
|
+
onClick={() =>
|
|
56
|
+
{
|
|
57
|
+
let filters: FilterItem[] = [];
|
|
58
|
+
filters.push(new FilterItem(MetaDatabase.main.message, MetaDatabase.main.message.columns.id, false, FilterItemOperator.all.equals, message.id));
|
|
59
|
+
let encoded = FilterItem.encode(filters);
|
|
60
|
+
window.open("http://message.namirasoft.com/message/list?filters=" + encoded, "_blank");
|
|
61
|
+
}}
|
|
62
|
+
>
|
|
63
|
+
<ul className={Styles.nsa_message_item_ul}>
|
|
64
|
+
<li className={`${Styles.nsa_message_item_title}`}>{message.title}</li>
|
|
65
|
+
</ul>
|
|
66
|
+
<p className={`${Styles.nsa_message_item_content} nsa_font_13_normal`}>{message.body}</p>
|
|
67
|
+
</div>
|
|
68
|
+
);
|
|
69
|
+
return (
|
|
70
|
+
<NSDialog {...this.props}>
|
|
71
|
+
<div className={Styles.nsa_toast}>
|
|
72
|
+
<div>
|
|
73
|
+
<div className={Styles.nsa_toast_header}>
|
|
74
|
+
<article className='d-flex flex-row justify-content-center align-item-center'
|
|
75
|
+
style={{ cursor: "pointer" }}>
|
|
76
|
+
<img
|
|
77
|
+
src="https://static.namirasoft.com/image/concept/mark-all/blue.svg"
|
|
78
|
+
alt="Message Header"
|
|
79
|
+
width={22}
|
|
80
|
+
/>
|
|
81
|
+
<span
|
|
82
|
+
className={`${Styles.nsa_message_title} ms-2`}
|
|
83
|
+
onClick={() =>
|
|
84
|
+
{
|
|
85
|
+
let REACT_APP_BASE_URL_MESSAGE = new EnvService("REACT_APP_BASE_URL_MESSAGE", true).getString();
|
|
86
|
+
let server = new NamirasoftMessageServer(REACT_APP_BASE_URL_MESSAGE, this.props.account.token_manager, this.props.notifier.onError);
|
|
87
|
+
server.message.SeenAll().then(() =>
|
|
88
|
+
{
|
|
89
|
+
this.props.onSeenAll();
|
|
90
|
+
this.props.onClose();
|
|
91
|
+
}).catch(() => { });
|
|
92
|
+
}}
|
|
93
|
+
>
|
|
94
|
+
Mark All As Read
|
|
95
|
+
</span>
|
|
96
|
+
</article>
|
|
97
|
+
</div>
|
|
98
|
+
<div className={Styles.nsa_toast_body}>
|
|
99
|
+
{content}
|
|
100
|
+
<div className='p-3 mx-0 d-flex justify-content-center'>
|
|
101
|
+
<NSButtonBlue
|
|
102
|
+
onClick={() =>
|
|
103
|
+
{
|
|
104
|
+
window.open("http://message.namirasoft.com/message/list", "_blank");
|
|
105
|
+
}}
|
|
106
|
+
title='View All'
|
|
107
|
+
/>
|
|
108
|
+
</div>
|
|
109
|
+
</div>
|
|
110
|
+
</div>
|
|
111
|
+
</div>
|
|
112
|
+
<div className={Styles.nsa_toast_background}>
|
|
113
|
+
</div>
|
|
114
|
+
</NSDialog >
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
117
|
}
|
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
.nsa_product_list_container {
|
|
2
|
-
display: grid;
|
|
3
|
-
flex-direction: row;
|
|
4
|
-
grid-template-columns: repeat(3, 1fr);
|
|
5
|
-
align-items: flex-start;
|
|
6
|
-
justify-content: center;
|
|
7
|
-
width: 100%;
|
|
8
|
-
height: 400px;
|
|
9
|
-
overflow: auto;
|
|
10
|
-
margin-top: 16px;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
.nsa_product_list_container::-webkit-scrollbar {
|
|
14
|
-
width: 1rem;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
.nsa_product_list_container::-webkit-scrollbar-track {
|
|
18
|
-
box-shadow: inset 0 0 6px #E8EBF6;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.nsa_product_list_container::-webkit-scrollbar-thumb {
|
|
22
|
-
background-color: #A1A4B0;
|
|
23
|
-
border-radius: 8px;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.nsa_product_list {
|
|
27
|
-
display: flex;
|
|
28
|
-
flex-direction: column;
|
|
29
|
-
justify-content: center;
|
|
30
|
-
align-items: center;
|
|
31
|
-
text-align: center;
|
|
32
|
-
margin-top: 24px;
|
|
33
|
-
gap: 8px;
|
|
34
|
-
}
|
|
35
|
-
.nsa_product_list a{
|
|
36
|
-
text-decoration: none;
|
|
37
|
-
color: rgba(20, 27, 92, 1);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
.nsa_product_logo {
|
|
41
|
-
display: flex;
|
|
42
|
-
flex-direction: column;
|
|
43
|
-
justify-content: center;
|
|
44
|
-
align-items: center;
|
|
1
|
+
.nsa_product_list_container {
|
|
2
|
+
display: grid;
|
|
3
|
+
flex-direction: row;
|
|
4
|
+
grid-template-columns: repeat(3, 1fr);
|
|
5
|
+
align-items: flex-start;
|
|
6
|
+
justify-content: center;
|
|
7
|
+
width: 100%;
|
|
8
|
+
height: 400px;
|
|
9
|
+
overflow: auto;
|
|
10
|
+
margin-top: 16px;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.nsa_product_list_container::-webkit-scrollbar {
|
|
14
|
+
width: 1rem;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.nsa_product_list_container::-webkit-scrollbar-track {
|
|
18
|
+
box-shadow: inset 0 0 6px #E8EBF6;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.nsa_product_list_container::-webkit-scrollbar-thumb {
|
|
22
|
+
background-color: #A1A4B0;
|
|
23
|
+
border-radius: 8px;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.nsa_product_list {
|
|
27
|
+
display: flex;
|
|
28
|
+
flex-direction: column;
|
|
29
|
+
justify-content: center;
|
|
30
|
+
align-items: center;
|
|
31
|
+
text-align: center;
|
|
32
|
+
margin-top: 24px;
|
|
33
|
+
gap: 8px;
|
|
34
|
+
}
|
|
35
|
+
.nsa_product_list a{
|
|
36
|
+
text-decoration: none;
|
|
37
|
+
color: rgba(20, 27, 92, 1);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.nsa_product_logo {
|
|
41
|
+
display: flex;
|
|
42
|
+
flex-direction: column;
|
|
43
|
+
justify-content: center;
|
|
44
|
+
align-items: center;
|
|
45
45
|
}
|
|
@@ -1,101 +1,101 @@
|
|
|
1
|
-
import { Component } from 'react';
|
|
2
|
-
import { EnvService, CacheService, IStorageLocal, SearchOperation } from 'namirasoft-core';
|
|
3
|
-
import { NamirasoftAPIProductServer, ProductFullRow } from 'namirasoft-api-product';
|
|
4
|
-
import { NSBoxSearch, NSDialog, NSDialogProps, NSLoading } from 'namirasoft-site-react';
|
|
5
|
-
import { INSARouterProps } from '../INSARouterProps';
|
|
6
|
-
import Styles from './NSAProductListDialog.module.css';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export interface NSAProductListDialogProps extends INSARouterProps, NSDialogProps
|
|
10
|
-
{
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
interface NSAProductListState
|
|
14
|
-
{
|
|
15
|
-
products: ProductFullRow[] | null;
|
|
16
|
-
search: string;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export class NSAProductListDialog extends Component<NSAProductListDialogProps, NSAProductListState>
|
|
20
|
-
{
|
|
21
|
-
private cache: CacheService<{
|
|
22
|
-
rows: ProductFullRow[];
|
|
23
|
-
count: number;
|
|
24
|
-
}>;
|
|
25
|
-
|
|
26
|
-
constructor(props: NSAProductListDialogProps)
|
|
27
|
-
{
|
|
28
|
-
super(props);
|
|
29
|
-
this.state = { products: null, search: "" };
|
|
30
|
-
this.onSearchChange = this.onSearchChange.bind(this);
|
|
31
|
-
|
|
32
|
-
this.cache = new CacheService<{
|
|
33
|
-
rows: ProductFullRow[];
|
|
34
|
-
count: number;
|
|
35
|
-
}>("ns-products", 24 * 60, new IStorageLocal(), async () =>
|
|
36
|
-
{
|
|
37
|
-
let REACT_APP_BASE_URL_API_PRODUCT = new EnvService("REACT_APP_BASE_URL_API_PRODUCT", true).getString();
|
|
38
|
-
let server = new NamirasoftAPIProductServer(REACT_APP_BASE_URL_API_PRODUCT, props.notifier.onError);
|
|
39
|
-
return server.filter.ListProducts("Namirasoft Console", "Header", null, null, null);
|
|
40
|
-
}, () => { });
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
override componentDidMount(): void
|
|
44
|
-
{
|
|
45
|
-
this.cache.get().then((res) =>
|
|
46
|
-
{
|
|
47
|
-
this.setState({ products: res.rows });
|
|
48
|
-
}).catch(() => { });
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
private onSearchChange(e: NSBoxSearch)
|
|
52
|
-
{
|
|
53
|
-
this.setState({ search: e.getValue() });
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
override render()
|
|
57
|
-
{
|
|
58
|
-
let content = null;
|
|
59
|
-
if (this.state.products == null)
|
|
60
|
-
{
|
|
61
|
-
content = <NSLoading />;
|
|
62
|
-
} else
|
|
63
|
-
{
|
|
64
|
-
let products = SearchOperation.filter(this.state.products, p => p.name, this.state.search);
|
|
65
|
-
let getName = (name: string) =>
|
|
66
|
-
{
|
|
67
|
-
return name.replace("Namirasoft ", "").trim();
|
|
68
|
-
};
|
|
69
|
-
content = (
|
|
70
|
-
<div className={Styles.nsa_product_list_container}>
|
|
71
|
-
{
|
|
72
|
-
products.map((product) => (
|
|
73
|
-
<div key={product.id} className={Styles.nsa_product_list}>
|
|
74
|
-
<a href={product.link || ""} target='_blank' rel="noreferrer" >
|
|
75
|
-
<figure className={Styles.nsa_product_logo} key={product.id}>
|
|
76
|
-
<img src={`${product.logo}`} alt={product.name} width={64} height={64} />
|
|
77
|
-
<figcaption>{`${getName(product.name)}`}</figcaption>
|
|
78
|
-
</figure>
|
|
79
|
-
</a>
|
|
80
|
-
</div>
|
|
81
|
-
))
|
|
82
|
-
}
|
|
83
|
-
</div>
|
|
84
|
-
);
|
|
85
|
-
}
|
|
86
|
-
return (
|
|
87
|
-
<NSDialog {...this.props}>
|
|
88
|
-
<NSBoxSearch
|
|
89
|
-
title=""
|
|
90
|
-
required={false}
|
|
91
|
-
placeholder='Search your Product'
|
|
92
|
-
onChanged={(e) =>
|
|
93
|
-
{
|
|
94
|
-
this.setState({ search: e.getValue() });
|
|
95
|
-
}}
|
|
96
|
-
/>
|
|
97
|
-
{content}
|
|
98
|
-
</NSDialog>
|
|
99
|
-
);
|
|
100
|
-
}
|
|
1
|
+
import { Component } from 'react';
|
|
2
|
+
import { EnvService, CacheService, IStorageLocal, SearchOperation } from 'namirasoft-core';
|
|
3
|
+
import { NamirasoftAPIProductServer, ProductFullRow } from 'namirasoft-api-product';
|
|
4
|
+
import { NSBoxSearch, NSDialog, NSDialogProps, NSLoading } from 'namirasoft-site-react';
|
|
5
|
+
import { INSARouterProps } from '../INSARouterProps';
|
|
6
|
+
import Styles from './NSAProductListDialog.module.css';
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
export interface NSAProductListDialogProps extends INSARouterProps, NSDialogProps
|
|
10
|
+
{
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
interface NSAProductListState
|
|
14
|
+
{
|
|
15
|
+
products: ProductFullRow[] | null;
|
|
16
|
+
search: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export class NSAProductListDialog extends Component<NSAProductListDialogProps, NSAProductListState>
|
|
20
|
+
{
|
|
21
|
+
private cache: CacheService<{
|
|
22
|
+
rows: ProductFullRow[];
|
|
23
|
+
count: number;
|
|
24
|
+
}>;
|
|
25
|
+
|
|
26
|
+
constructor(props: NSAProductListDialogProps)
|
|
27
|
+
{
|
|
28
|
+
super(props);
|
|
29
|
+
this.state = { products: null, search: "" };
|
|
30
|
+
this.onSearchChange = this.onSearchChange.bind(this);
|
|
31
|
+
|
|
32
|
+
this.cache = new CacheService<{
|
|
33
|
+
rows: ProductFullRow[];
|
|
34
|
+
count: number;
|
|
35
|
+
}>("ns-products", 24 * 60, new IStorageLocal(), async () =>
|
|
36
|
+
{
|
|
37
|
+
let REACT_APP_BASE_URL_API_PRODUCT = new EnvService("REACT_APP_BASE_URL_API_PRODUCT", true).getString();
|
|
38
|
+
let server = new NamirasoftAPIProductServer(REACT_APP_BASE_URL_API_PRODUCT, props.notifier.onError);
|
|
39
|
+
return server.filter.ListProducts("Namirasoft Console", "Header", null, null, null);
|
|
40
|
+
}, () => { });
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
override componentDidMount(): void
|
|
44
|
+
{
|
|
45
|
+
this.cache.get().then((res) =>
|
|
46
|
+
{
|
|
47
|
+
this.setState({ products: res.rows });
|
|
48
|
+
}).catch(() => { });
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
private onSearchChange(e: NSBoxSearch)
|
|
52
|
+
{
|
|
53
|
+
this.setState({ search: e.getValue() });
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
override render()
|
|
57
|
+
{
|
|
58
|
+
let content = null;
|
|
59
|
+
if (this.state.products == null)
|
|
60
|
+
{
|
|
61
|
+
content = <NSLoading />;
|
|
62
|
+
} else
|
|
63
|
+
{
|
|
64
|
+
let products = SearchOperation.filter(this.state.products, p => p.name, this.state.search);
|
|
65
|
+
let getName = (name: string) =>
|
|
66
|
+
{
|
|
67
|
+
return name.replace("Namirasoft ", "").trim();
|
|
68
|
+
};
|
|
69
|
+
content = (
|
|
70
|
+
<div className={Styles.nsa_product_list_container}>
|
|
71
|
+
{
|
|
72
|
+
products.map((product) => (
|
|
73
|
+
<div key={product.id} className={Styles.nsa_product_list}>
|
|
74
|
+
<a href={product.link || ""} target='_blank' rel="noreferrer" >
|
|
75
|
+
<figure className={Styles.nsa_product_logo} key={product.id}>
|
|
76
|
+
<img src={`${product.logo}`} alt={product.name} width={64} height={64} />
|
|
77
|
+
<figcaption>{`${getName(product.name)}`}</figcaption>
|
|
78
|
+
</figure>
|
|
79
|
+
</a>
|
|
80
|
+
</div>
|
|
81
|
+
))
|
|
82
|
+
}
|
|
83
|
+
</div>
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
return (
|
|
87
|
+
<NSDialog {...this.props}>
|
|
88
|
+
<NSBoxSearch
|
|
89
|
+
title=""
|
|
90
|
+
required={false}
|
|
91
|
+
placeholder='Search your Product'
|
|
92
|
+
onChanged={(e) =>
|
|
93
|
+
{
|
|
94
|
+
this.setState({ search: e.getValue() });
|
|
95
|
+
}}
|
|
96
|
+
/>
|
|
97
|
+
{content}
|
|
98
|
+
</NSDialog>
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
101
|
}
|
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
.nsa_workspace_h2 {
|
|
2
|
-
color: rgba(3, 119, 255, 1);
|
|
3
|
-
text-align: center;
|
|
4
|
-
font-weight: 600;
|
|
5
|
-
font-size: 16px;
|
|
6
|
-
cursor: pointer;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.nsa_workspace_h6 {
|
|
10
|
-
color: rgba(20, 27, 92, 1);
|
|
11
|
-
text-align: center;
|
|
12
|
-
font-weight: 300;
|
|
13
|
-
font-size: 16px;
|
|
14
|
-
cursor: pointer;
|
|
15
|
-
margin: 0;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
.nsa_workspace_list {
|
|
19
|
-
overflow-y: auto;
|
|
20
|
-
height: 320px;
|
|
21
|
-
width: 275px;
|
|
22
|
-
scrollbar-width: none;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.nsa_workspace_border {
|
|
26
|
-
margin-top: 16px;
|
|
27
|
-
display: flex;
|
|
28
|
-
flex-direction: row;
|
|
29
|
-
justify-content: left;
|
|
30
|
-
align-items: center;
|
|
31
|
-
gap: 8px;
|
|
32
|
-
border-radius: 8px;
|
|
33
|
-
border: 1px solid gray;
|
|
34
|
-
padding: 8px;
|
|
35
|
-
transition: all .2s ease-in-out;
|
|
36
|
-
flex-wrap: wrap;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
.nsa_workspace_border:hover {
|
|
40
|
-
background-color: rgba(20, 27, 92, 0.3);
|
|
41
|
-
color: white;
|
|
42
|
-
cursor: pointer;
|
|
1
|
+
.nsa_workspace_h2 {
|
|
2
|
+
color: rgba(3, 119, 255, 1);
|
|
3
|
+
text-align: center;
|
|
4
|
+
font-weight: 600;
|
|
5
|
+
font-size: 16px;
|
|
6
|
+
cursor: pointer;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.nsa_workspace_h6 {
|
|
10
|
+
color: rgba(20, 27, 92, 1);
|
|
11
|
+
text-align: center;
|
|
12
|
+
font-weight: 300;
|
|
13
|
+
font-size: 16px;
|
|
14
|
+
cursor: pointer;
|
|
15
|
+
margin: 0;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.nsa_workspace_list {
|
|
19
|
+
overflow-y: auto;
|
|
20
|
+
height: 320px;
|
|
21
|
+
width: 275px;
|
|
22
|
+
scrollbar-width: none;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.nsa_workspace_border {
|
|
26
|
+
margin-top: 16px;
|
|
27
|
+
display: flex;
|
|
28
|
+
flex-direction: row;
|
|
29
|
+
justify-content: left;
|
|
30
|
+
align-items: center;
|
|
31
|
+
gap: 8px;
|
|
32
|
+
border-radius: 8px;
|
|
33
|
+
border: 1px solid gray;
|
|
34
|
+
padding: 8px;
|
|
35
|
+
transition: all .2s ease-in-out;
|
|
36
|
+
flex-wrap: wrap;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.nsa_workspace_border:hover {
|
|
40
|
+
background-color: rgba(20, 27, 92, 0.3);
|
|
41
|
+
color: white;
|
|
42
|
+
cursor: pointer;
|
|
43
43
|
}
|