@social-mail/social-mail-client 1.9.35 → 1.9.37

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@social-mail/social-mail-client",
3
- "version": "1.9.35",
3
+ "version": "1.9.37",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -9,8 +9,14 @@ import EditDomainPage from "./edit/EditDomainPage";
9
9
  import { HostedDomain, IHostedDomain } from "../../../model/model";
10
10
  import AdminCommands from "../../commands/AdminCommands";
11
11
  import EntityService from "../../../services/EntityService";
12
+ import InfiniteRepeater from "../../../common/controls/repeater/InfiniteRepeater";
13
+ import Bind from "@web-atoms/core/dist/core/Bind";
14
+ import { Sql } from "../../../common/Sql";
15
+ import MasterDetailPage from "@web-atoms/web-controls/dist/mobile-app/MasterDetailPage";
12
16
 
13
- export default class DomainListPage extends ContentPage {
17
+ export default class DomainListPage extends MasterDetailPage {
18
+
19
+ search = "";
14
20
 
15
21
  @InjectProperty
16
22
  private adminDomainService: AdminDomainService;
@@ -23,17 +29,24 @@ export default class DomainListPage extends ContentPage {
23
29
  async init() {
24
30
 
25
31
  this.title = "Domains";
26
- this.domains = await this.adminDomainService.list();
27
32
 
28
33
  this.actionRenderer = () => <i data-click-event="add-domain" class="fas fa-plus"/>;
29
34
 
35
+ this.headerRenderer = () => <div>
36
+ <input type="search" value={Bind.twoWaysImmediate(() => this.search)}/>
37
+ </div>;
38
+
30
39
  this.renderer = <div>
31
40
  <AtomRepeater
41
+ data-layout="data-grid"
32
42
  items={this.domains}
43
+ selectOnClick={true}
44
+ data-selection-updated-event="item-selected"
45
+ { ... InfiniteRepeater.pagedItems((start) => (c, e, cancelToken) =>
46
+ this.loadItems({ search: this.search, start, cancelToken })
47
+ )}
33
48
  itemRenderer={(domain) => <div>
34
- <a
35
- data-click-event="route"
36
- href={AdminCommands.openDomain.displayRoute(domain)}>{domain.domain.name}</a>
49
+ <label>{domain.domain.name}</label>
37
50
 
38
51
  <i
39
52
  data-click-event="delete-item"
@@ -44,10 +57,35 @@ export default class DomainListPage extends ContentPage {
44
57
  </div>;
45
58
  }
46
59
 
60
+ async loadItems({ search, start, cancelToken }) {
61
+ let q = this.entityService.query(HostedDomain);
62
+ if (search) {
63
+ search = `${search}%`.toLowerCase();
64
+ q = q.where({ search }, (p) => (x) => Sql.text.like(x.domain.name, p.search));
65
+ }
66
+ return q
67
+ .include((x) => x.domain)
68
+ .orderBy((x) => x.domain.name)
69
+ .toPagedList({
70
+ start,
71
+ size: 10,
72
+ cancelToken
73
+ });
74
+ }
75
+
47
76
  @Action({ onEvent: "add-domain"})
48
77
  async addDomain() {
49
- const domain = await PageNavigator.pushPageForResult(EditDomainPage, {});
78
+ const domain = HostedDomain.create({});
50
79
  this.domains.add(domain);
80
+ this.openDetail(EditDomainPage, { model: domain });
81
+ }
82
+
83
+ @Action({ onEvent: "item-selected" , defer: 10 })
84
+ itemSelected([domain]) {
85
+ if (!domain) {
86
+ return;
87
+ }
88
+ this.openDetail(EditDomainPage, { model: domain });
51
89
  }
52
90
 
53
91
  @Action({
@@ -9,8 +9,10 @@ import CommonCommands from "../../commands/CommonCommands";
9
9
  import DnsZoneService from "./DnsZoneService";
10
10
  import { HostedZone, IHostedZone } from "../../../model/model";
11
11
  import Bind from "@web-atoms/core/dist/core/Bind";
12
+ import MasterDetailPage from "@web-atoms/web-controls/dist/mobile-app/MasterDetailPage";
13
+ import DnsZoneEditorPage from "./edit/DnsZoneEditorPage";
12
14
 
13
- export default class DnsZoneListPage extends ContentPage {
15
+ export default class DnsZoneListPage extends MasterDetailPage {
14
16
 
15
17
  start = 0;
16
18
  size = 100;
@@ -32,6 +34,8 @@ export default class DnsZoneListPage extends ContentPage {
32
34
  this.renderer = <div>
33
35
  <AtomRepeater
34
36
  data-layout="data-grid"
37
+ data-selection-updated-event="item-selected"
38
+ selectOnClick={true}
35
39
  items={this.zones}
36
40
  { ... InfiniteRepeater.pagedItems((start) =>
37
41
  (c, e, cancelToken) =>
@@ -42,9 +46,7 @@ export default class DnsZoneListPage extends ContentPage {
42
46
  version: this.version
43
47
  }))}
44
48
  itemRenderer={(item: IHostedZone) => <div>
45
- <a
46
- data-click-event="route"
47
- href={CommonCommands.editDnsZone.displayRoute({ zoneID: item.zoneID})}
49
+ <label
48
50
  text={item.domain.name}/>
49
51
  {/* <i
50
52
  title="View DS Records"
@@ -75,6 +77,14 @@ export default class DnsZoneListPage extends ContentPage {
75
77
  this.version++;
76
78
  }
77
79
 
80
+ @Action({ onEvent: "item-selected", defer: 10})
81
+ async itemSelected([domain]) {
82
+ if (!domain) {
83
+ return;
84
+ }
85
+ this.openDetail(DnsZoneEditorPage, domain);
86
+ }
87
+
78
88
  @Action({ onEvent: "view-zone"})
79
89
  async viewZone(zone: IHostedZone) {
80
90
  await PopupService.alert({