@enso-ui/notifications 2.0.5 → 2.0.9

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": "@enso-ui/notifications",
3
- "version": "2.0.5",
3
+ "version": "2.0.9",
4
4
  "description": "Basic notifications package",
5
5
  "main": "src/bulma/pages/Index.vue",
6
6
  "scripts": {
@@ -28,6 +28,7 @@
28
28
  "@fortawesome/fontawesome-svg-core": "^1.2.2",
29
29
  "@fortawesome/free-solid-svg-icons": "^5.2.0",
30
30
  "@fortawesome/vue-fontawesome": "3.0.0-5",
31
+ "animate.css": "^4.0.0",
31
32
  "favico.js": "^0.3.10",
32
33
  "lodash": "^4.17.20",
33
34
  "vue": "^3.0",
@@ -40,7 +41,7 @@
40
41
  "autoprefixer": "^9.6.1",
41
42
  "babel-eslint": "^10.0.1",
42
43
  "cross-env": "^6.0.0",
43
- "eslint": "^8.0.0",
44
+ "eslint": "^7.0.0",
44
45
  "eslint-import-resolver-alias": "^1.1.2",
45
46
  "eslint-plugin-vue": "^8.0.0"
46
47
  }
@@ -13,7 +13,7 @@
13
13
  </a>
14
14
  </div>
15
15
  <div class="level-item">
16
- <a :class="['button animated fadeIn', {'is-loading': loading}]"
16
+ <a :class="['button animate__animated animate__fadeIn', {'is-loading': loading}]"
17
17
  @click="fetch">
18
18
  <span>{{ i18n('Reload') }}</span>
19
19
  <span class="icon is-small">
@@ -74,6 +74,7 @@
74
74
  </template>
75
75
 
76
76
  <script>
77
+ import 'animate.css';
77
78
  import debounce from 'lodash/debounce';
78
79
  import { mapState } from 'vuex';
79
80
  import { FontAwesomeIcon as Fa } from '@fortawesome/vue-fontawesome';
@@ -81,6 +82,7 @@ import { library } from '@fortawesome/fontawesome-svg-core';
81
82
  import {
82
83
  faClock, faBell, faCheck, faTrashAlt, faSpinner, faSync,
83
84
  } from '@fortawesome/free-solid-svg-icons';
85
+ import eventBus from '@enso-ui/ui/src/core/services/eventBus';
84
86
  import format from '@enso-ui/ui/src/modules/plugins/date-fns/format';
85
87
  import formatDistance from '@enso-ui/ui/src/modules/plugins/date-fns/formatDistance';
86
88
 
@@ -130,7 +132,7 @@ export default {
130
132
  axios.patch(this.route('core.notifications.read', notification.id))
131
133
  .then(({ data }) => {
132
134
  notification.read_at = data.read_at;
133
- this.$root.$emit('read-notification', notification);
135
+ eventBus.$emit('read-notification', notification);
134
136
 
135
137
  if (notification.data.path && notification.data.path !== '#') {
136
138
  this.$router.push({ path: notification.data.path })
@@ -150,18 +152,18 @@ export default {
150
152
 
151
153
  this.unreadCount = 0;
152
154
 
153
- this.$root.$emit('read-all-notifications');
155
+ eventBus.$emit('read-all-notifications');
154
156
  },
155
157
  destroyAll() {
156
158
  axios.delete(this.route('core.notifications.destroyAll')).then(() => {
157
159
  this.notifications = [];
158
- this.$root.$emit('destroy-all-notifications');
160
+ eventBus.$emit('destroy-all-notifications');
159
161
  }).catch(this.errorHandler);
160
162
  },
161
163
  destroy(notification, index) {
162
164
  axios.delete(this.route('core.notifications.destroy', notification.id)).then(() => {
163
165
  this.notifications.splice(index, 1);
164
- this.$root.$emit('destroy-notification', notification);
166
+ eventBus.$emit('destroy-notification', notification);
165
167
  }).catch(this.errorHandler);
166
168
  },
167
169
  timeFromNow(date) {
@@ -4,6 +4,7 @@ import {
4
4
  mapState, mapGetters, mapActions,
5
5
  } from 'vuex';
6
6
  import Favico from 'favico.js';
7
+ import eventBus from '@enso-ui/ui/src/core/services/eventBus';
7
8
  import format from '@enso-ui/ui/src/modules/plugins/date-fns/format';
8
9
  import formatDistance from '@enso-ui/ui/src/modules/plugins/date-fns/formatDistance';
9
10
 
@@ -58,7 +59,7 @@ export default {
58
59
  methods: {
59
60
  ...mapActions('websockets', ['connect']),
60
61
  addBusListeners() {
61
- this.$root.$on('read-notification', notification => {
62
+ eventBus.$on('read-notification', notification => {
62
63
  this.unread = Math.max(--this.unread, 0);
63
64
  const existing = this.notifications
64
65
  .find(({ id }) => id === notification.id);
@@ -68,9 +69,9 @@ export default {
68
69
  }
69
70
  });
70
71
 
71
- this.$root.$on('read-all-notifications', () => this.updateAll());
72
+ eventBus.$on('read-all-notifications', () => this.updateAll());
72
73
 
73
- this.$root.$on('destroy-notification', notification => {
74
+ eventBus.$on('destroy-notification', notification => {
74
75
  if (!notification.read_at) {
75
76
  this.unread = Math.max(--this.unread, 0);
76
77
  }
@@ -83,7 +84,7 @@ export default {
83
84
  }
84
85
  });
85
86
 
86
- this.$root.$on('destroy-all-notifications', () => {
87
+ eventBus.$on('destroy-all-notifications', () => {
87
88
  this.notifications = [];
88
89
  this.unread = 0;
89
90
  });
@@ -18,7 +18,6 @@ export default {
18
18
  created() {
19
19
  if (this.toastrPosition) {
20
20
  this.toastr.defaults({ position: this.toastrPosition }).reset();
21
- this.$toastr.defaults({ position: this.toastrPosition }).reset();
22
21
  }
23
22
  },
24
23
 
@@ -27,7 +26,6 @@ export default {
27
26
  update(position) {
28
27
  this.setToastrPosition(position);
29
28
  this.toastr.defaults({ position }).reset();
30
- this.$toastr.defaults({ position }).reset();
31
29
  },
32
30
  },
33
31