@projectcaluma/ember-analytics 11.1.0 → 11.1.1
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.
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
<table
|
|
2
|
-
class="uk-table uk-table-divider uk-table-hover"
|
|
3
|
-
uk-overflow-auto
|
|
4
|
-
{{did-insert this.setupUIkit}}
|
|
5
|
-
>
|
|
1
|
+
<table class="uk-table uk-table-divider uk-table-hover uk-overflow-auto">
|
|
6
2
|
<thead>
|
|
7
3
|
<tr>
|
|
8
4
|
<th></th>
|
|
@@ -18,20 +14,19 @@
|
|
|
18
14
|
</thead>
|
|
19
15
|
<tbody
|
|
20
16
|
data-test-field-list
|
|
21
|
-
uk-sortable="handle: .uk-sortable-handle;"
|
|
22
17
|
class="uk-list"
|
|
23
18
|
id="field-list"
|
|
19
|
+
{{sortable-group onChange=(perform this.reorderFields)}}
|
|
24
20
|
>
|
|
25
21
|
{{#each this.fields as |field|}}
|
|
26
22
|
{{#let (fn this.updateField field) as |update|}}
|
|
27
|
-
<tr
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
></span>
|
|
23
|
+
<tr
|
|
24
|
+
id={{field.id}}
|
|
25
|
+
class="uk-position-relative"
|
|
26
|
+
{{sortable-item model=field}}
|
|
27
|
+
>
|
|
28
|
+
<td data-test-sort-handle {{sortable-handle}}>
|
|
29
|
+
<span uk-icon="menu" role="button" class="uk-drag"></span>
|
|
35
30
|
</td>
|
|
36
31
|
<td>
|
|
37
32
|
{{field.dataSource}}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { action } from "@ember/object";
|
|
2
|
-
import { run } from "@ember/runloop";
|
|
3
2
|
import { inject as service } from "@ember/service";
|
|
4
3
|
import Component from "@glimmer/component";
|
|
4
|
+
import { tracked } from "@glimmer/tracking";
|
|
5
5
|
import { queryManager, getObservable } from "ember-apollo-client";
|
|
6
6
|
import { enqueueTask, restartableTask } from "ember-concurrency";
|
|
7
|
-
import UIkit from "uikit";
|
|
8
7
|
|
|
9
8
|
import removeAnalyticsFieldMutation from "@projectcaluma/ember-analytics/gql/mutations/remove-analytics-field.graphql";
|
|
10
9
|
import reorderAnalyticsFieldsMutation from "@projectcaluma/ember-analytics/gql/mutations/reorder-analytics-fields.graphql";
|
|
@@ -16,10 +15,13 @@ export default class CaFieldSelectorListComponent extends Component {
|
|
|
16
15
|
@service intl;
|
|
17
16
|
|
|
18
17
|
@enqueueTask saveField = saveAnalyticsField;
|
|
18
|
+
@tracked _fields;
|
|
19
19
|
|
|
20
20
|
get fields() {
|
|
21
21
|
return (
|
|
22
|
-
this.
|
|
22
|
+
this._fields ??
|
|
23
|
+
this.args.analyticsTable?.fields?.edges?.map((edge) => edge.node) ??
|
|
24
|
+
[]
|
|
23
25
|
);
|
|
24
26
|
}
|
|
25
27
|
|
|
@@ -57,13 +59,14 @@ export default class CaFieldSelectorListComponent extends Component {
|
|
|
57
59
|
|
|
58
60
|
@restartableTask
|
|
59
61
|
*reorderFields(fields) {
|
|
62
|
+
this._fields = fields;
|
|
60
63
|
try {
|
|
61
64
|
yield this.apollo.mutate({
|
|
62
65
|
mutation: reorderAnalyticsFieldsMutation,
|
|
63
66
|
variables: {
|
|
64
67
|
input: {
|
|
65
68
|
table: this.args.analyticsTable.id,
|
|
66
|
-
fields,
|
|
69
|
+
fields: fields.map((field) => field.id),
|
|
67
70
|
},
|
|
68
71
|
},
|
|
69
72
|
});
|
|
@@ -71,23 +74,11 @@ export default class CaFieldSelectorListComponent extends Component {
|
|
|
71
74
|
this.notification.success(
|
|
72
75
|
this.intl.t("caluma.analytics.notification.reorder-success")
|
|
73
76
|
);
|
|
77
|
+
this._fields = null;
|
|
74
78
|
} catch (e) {
|
|
75
79
|
this.notification.danger(
|
|
76
80
|
this.intl.t("caluma.analytics.notification.reorder-error")
|
|
77
81
|
);
|
|
78
82
|
}
|
|
79
83
|
}
|
|
80
|
-
|
|
81
|
-
_handleMoved({ detail: [sortable] }) {
|
|
82
|
-
const options = [...sortable.$el.children];
|
|
83
|
-
|
|
84
|
-
this.reorderFields.perform(options.map((option) => option.id));
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
@action
|
|
88
|
-
setupUIkit() {
|
|
89
|
-
UIkit.util.on("#field-list", "moved", (...args) =>
|
|
90
|
-
run(this, this._handleMoved, ...args)
|
|
91
|
-
);
|
|
92
|
-
}
|
|
93
84
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@projectcaluma/ember-analytics",
|
|
3
|
-
"version": "11.1.
|
|
3
|
+
"version": "11.1.1",
|
|
4
4
|
"description": "Ember addon for Caluma analytics.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"@ember/legacy-built-in-components": "^0.4.1",
|
|
19
19
|
"@glimmer/component": "^1.1.2",
|
|
20
20
|
"@glimmer/tracking": "^1.1.2",
|
|
21
|
-
"@projectcaluma/ember-core": "^11.1.
|
|
21
|
+
"@projectcaluma/ember-core": "^11.1.1",
|
|
22
22
|
"ember-apollo-client": "^4.0.2",
|
|
23
23
|
"ember-auto-import": "^2.6.1",
|
|
24
24
|
"ember-changeset": "^4.1.2",
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
"ember-intl": "^5.7.0",
|
|
33
33
|
"ember-power-select": "6.0.1",
|
|
34
34
|
"ember-resources": "^5.6.2",
|
|
35
|
+
"ember-sortable": "^5.0.0",
|
|
35
36
|
"ember-uikit": "^6.1.1",
|
|
36
37
|
"ember-validated-form": "^6.2.0",
|
|
37
38
|
"graphql": "^15.6.1"
|
|
@@ -47,7 +48,7 @@
|
|
|
47
48
|
"@ember/test-helpers": "2.7.0",
|
|
48
49
|
"@embroider/test-setup": "2.1.1",
|
|
49
50
|
"@faker-js/faker": "7.6.0",
|
|
50
|
-
"@projectcaluma/ember-testing": "11.1.
|
|
51
|
+
"@projectcaluma/ember-testing": "11.1.1",
|
|
51
52
|
"broccoli-asset-rev": "3.0.0",
|
|
52
53
|
"concurrently": "7.6.0",
|
|
53
54
|
"ember-cli": "4.9.2",
|
|
@@ -70,7 +71,7 @@
|
|
|
70
71
|
"qunit": "2.19.4",
|
|
71
72
|
"qunit-dom": "2.0.0",
|
|
72
73
|
"sass": "1.58.3",
|
|
73
|
-
"webpack": "5.
|
|
74
|
+
"webpack": "5.76.2"
|
|
74
75
|
},
|
|
75
76
|
"peerDependency": {
|
|
76
77
|
"ember-engines": ">= 0.8"
|