efront 3.7.5 → 3.7.6

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.
@@ -4,7 +4,6 @@ var fields = refilm`
4
4
  服务器地址/host* select?a ${hosts}
5
5
  密码/password* password
6
6
  `;
7
- console.log(fields)
8
7
  function main() {
9
8
  var page = view();
10
9
  page.innerHTML = login;
@@ -1,5 +1,5 @@
1
1
  <div class="clusters">
2
- <a -repeat="(c,i) in clusters" @click="active(i)">
2
+ <a -repeat="(c,i) in clusters" ng-class="{current:i===index}" @click="active(i,c)">
3
3
  <span -text="c"></span>
4
4
  </a>
5
5
  </div>
@@ -7,6 +7,6 @@
7
7
  <padding>
8
8
  <span -text=c.id></span>
9
9
  <span class="time" -text=filterTime(c.optime)></span>
10
-
10
+
11
11
  </padding>
12
12
  </lattice>
@@ -3,21 +3,21 @@ function main() {
3
3
  page.innerHTML = template;
4
4
  renderWithDefaults(page, {
5
5
  async load() {
6
- var cs = this.clusters = data.from("cluster", { opt: "list" });
7
- await cs.loading_promise;
6
+ this.clusters = data.from("cluster", { opt: "list" });
7
+ await this.clusters;
8
8
  this.active();
9
9
  },
10
- index: 0,
10
+ index: data.getInstance("index").index || 0,
11
11
  clusters: [],
12
12
  filterTime(d) {
13
13
  return ((new Date - d) / 1000 | 0) + "秒";
14
14
  },
15
15
  clients: [],
16
- async active() {
17
- var index = this.index;
16
+ active(index = this.index) {
17
+ data.setInstance('index', { index });
18
18
  var clusters = this.clusters;
19
19
  if (index >= clusters.length) index = clusters.length - 1;
20
- this.clients = data.lazyInstance("cluster", { opt: "list", id: clusters[index] });
20
+ this.clients = data.from("cluster", { opt: "list", id: clusters[index] });
21
21
  },
22
22
  });
23
23
  page.$scope.load();
@@ -6,4 +6,9 @@
6
6
 
7
7
  .time {
8
8
  color: #bbb;
9
+ }
10
+
11
+ .button.current {
12
+ background: #28c;
13
+ color: #fff;
9
14
  }
@@ -0,0 +1,27 @@
1
+ // class LoadingArray extends Array {
2
+ // totalCount = 0;
3
+ // data = [];
4
+ // is_errored = null;
5
+ // error_message = null;
6
+ // is_loading = true;
7
+ // is_loaded = false;
8
+ // is_readonly = null;
9
+ // loading = null;
10
+ // loading_promise = null;
11
+ // then (ok, oh) {
12
+ // if (this.loading_promise) this.loading_promise.then(ok, oh);
13
+ // }
14
+ // }
15
+ function LoadingArray() {
16
+ var this0 = [];
17
+ this0.totalCount = 0;
18
+ this0.data = [];
19
+ this0.is_errored = null;
20
+ this0.error_message = null;
21
+ this0.is_loading = true;
22
+ this0.is_loaded = false;
23
+ this0.is_readonly = null;
24
+ this0.loading = null;
25
+ this0.loading_promise = null;
26
+ return this0;
27
+ };
@@ -402,6 +402,12 @@ function createApiMap(data) {
402
402
  }
403
403
  var _configfileurl;
404
404
  var configPormise;
405
+ function LoadingArray_then(ok, oh) {
406
+ if (this.loading_promise) this.loading_promise.then(ok, oh);
407
+ else if (this.is_errored) oh(this.error_message);
408
+ else ok();
409
+ }
410
+
405
411
  var privates = {
406
412
  loadAfterConfig(serviceId, params) {
407
413
  var promise = this.getApi(serviceId).then((api) => {
@@ -622,6 +628,7 @@ var data = {
622
628
  if (isObject(response)) {
623
629
  response.is_loaded = true;
624
630
  response.is_loading = false;
631
+ if (response.then === LoadingArray_then) delete response.then;
625
632
  }
626
633
  this.loading_count--;
627
634
  },
@@ -630,6 +637,7 @@ var data = {
630
637
  if (isObject(response)) {
631
638
  response.is_loaded = false;
632
639
  response.is_loading = true;
640
+ response.then = LoadingArray_then;
633
641
  }
634
642
  this.loading_count++;
635
643
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efront",
3
- "version": "3.7.5",
3
+ "version": "3.7.6",
4
4
  "description": "一个开发工具,开放源代码,自带组件库和编译环境,可以用来开发web组件,web应用或nodejs模块,或做为已有代码的加密工具,也可以做为静态页面服务器或跨域中转服务器使用",
5
5
  "main": "public/efront.js",
6
6
  "directories": {