@enso-ui/notifications 2.0.15 → 2.0.19

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.15",
3
+ "version": "2.0.19",
4
4
  "description": "Basic notifications package",
5
5
  "main": "src/bulma/pages/Index.vue",
6
6
  "scripts": {
@@ -27,7 +27,7 @@
27
27
  "@enso-ui/ui": "^5.0",
28
28
  "@enso-ui/transitions": "^2.0",
29
29
  "@fortawesome/fontawesome-svg-core": "^1.2.2",
30
- "@fortawesome/free-solid-svg-icons": "^5.2.0",
30
+ "@fortawesome/free-solid-svg-icons": "^5.11.2",
31
31
  "@fortawesome/vue-fontawesome": "3.0.0-5",
32
32
  "favico.js": "^0.3.10",
33
33
  "lodash": "^4.17.20",
@@ -93,15 +93,15 @@ library.add(faClock, faBell, faCheck, faTrashAlt, faSpinner, faSync);
93
93
  export default {
94
94
  name: 'Index',
95
95
 
96
- inject: ['errorHandler', 'i18n', 'route', 'routerErrorHandler'],
96
+ components: { Fa, Fade },
97
+
98
+ inject: ['errorHandler', 'http', 'i18n', 'route', 'routerErrorHandler'],
97
99
 
98
100
  emits: [
99
101
  'read-notification', 'read-all-notifications',
100
102
  'destroy-notification', 'destroy-all-notification',
101
103
  ],
102
104
 
103
- components: { Fa, Fade },
104
-
105
105
  data: () => ({
106
106
  paginate: 200,
107
107
  notifications: [],
@@ -127,7 +127,7 @@ export default {
127
127
 
128
128
  this.loading = true;
129
129
 
130
- axios.get(this.route('core.notifications.index'), {
130
+ this.http.get(this.route('core.notifications.index'), {
131
131
  params: { offset: this.offset, paginate: this.paginate },
132
132
  }).then(({ data }) => {
133
133
  this.notifications = this.offset ? this.notifications.concat(data) : data;
@@ -136,7 +136,7 @@ export default {
136
136
  }).catch(this.errorHandler);
137
137
  },
138
138
  read(notification) {
139
- axios.patch(this.route('core.notifications.read', notification.id))
139
+ this.http.patch(this.route('core.notifications.read', notification.id))
140
140
  .then(({ data }) => {
141
141
  notification.read_at = data.read_at;
142
142
  eventBus.$emit('read-notification', notification);
@@ -148,7 +148,7 @@ export default {
148
148
  }).catch(this.errorHandler);
149
149
  },
150
150
  readAll() {
151
- axios.post(this.route('core.notifications.readAll'))
151
+ this.http.post(this.route('core.notifications.readAll'))
152
152
  .then(() => this.updateAll())
153
153
  .catch(this.errorHandler);
154
154
  },
@@ -162,13 +162,13 @@ export default {
162
162
  eventBus.$emit('read-all-notifications');
163
163
  },
164
164
  destroyAll() {
165
- axios.delete(this.route('core.notifications.destroyAll')).then(() => {
165
+ this.http.delete(this.route('core.notifications.destroyAll')).then(() => {
166
166
  this.notifications = [];
167
167
  eventBus.$emit('destroy-all-notifications');
168
168
  }).catch(this.errorHandler);
169
169
  },
170
170
  destroy(notification, index) {
171
- axios.delete(this.route('core.notifications.destroy', notification.id)).then(() => {
171
+ this.http.delete(this.route('core.notifications.destroy', notification.id)).then(() => {
172
172
  this.notifications.splice(index, 1);
173
173
  eventBus.$emit('destroy-notification', notification);
174
174
  }).catch(this.errorHandler);
@@ -2,5 +2,5 @@ import App from '@enso-ui/ui/src/core/app';
2
2
  import Notification from './components/navbar/Notifications.vue';
3
3
  import ToastPosition from './components/settings/ToastrPosition.vue';
4
4
 
5
- App.registerNavbarItem('navbar-notification', Notification, 300, 'core.notifications.count');
6
- App.registerSettingsItem('setting-toaster-position', ToastPosition, 300);
5
+ App.registerNavbarItem('notification', Notification, 300, 'core.notifications.count');
6
+ App.registerSettingsItem('toaster-position', ToastPosition, 300);
@@ -11,7 +11,7 @@ import formatDistance from '@enso-ui/ui/src/modules/plugins/date-fns/formatDista
11
11
  export default {
12
12
  name: 'Notifications',
13
13
 
14
- inject: ['errorHandler', 'route', 'routerErrorHandler', 'toastr'],
14
+ inject: ['errorHandler', 'http', 'route', 'routerErrorHandler', 'toastr'],
15
15
 
16
16
  props: {
17
17
  favicoAnimation: {
@@ -99,7 +99,7 @@ export default {
99
99
  }
100
100
  },
101
101
  count() {
102
- axios.get(this.route('core.notifications.count'))
102
+ this.http.get(this.route('core.notifications.count'))
103
103
  .then(({ data }) => (this.unread = data.count))
104
104
  .catch(this.errorHandler);
105
105
  },
@@ -130,7 +130,7 @@ export default {
130
130
 
131
131
  this.loading = true;
132
132
 
133
- axios.get(this.route('core.notifications.index'), {
133
+ this.http.get(this.route('core.notifications.index'), {
134
134
  params: { offset: this.offset, paginate: this.paginate },
135
135
  }).then(({ data }) => {
136
136
  this.notifications = this.offset ? this.notifications.concat(data) : data;
@@ -172,7 +172,7 @@ export default {
172
172
  return format(new Date());
173
173
  },
174
174
  read(notification) {
175
- axios.patch(this.route('core.notifications.read', notification.id))
175
+ this.http.patch(this.route('core.notifications.read', notification.id))
176
176
  .then(({ data }) => {
177
177
  this.unread = Math.max(--this.unread, 0);
178
178
  notification.read_at = data.read_at;
@@ -184,7 +184,7 @@ export default {
184
184
  }).catch(this.errorHandler);
185
185
  },
186
186
  readAll() {
187
- axios.post(this.route('core.notifications.readAll'))
187
+ this.http.post(this.route('core.notifications.readAll'))
188
188
  .then(this.updateAll)
189
189
  .catch(this.errorHandler);
190
190
  },
@@ -15,17 +15,11 @@ export default {
15
15
  ...mapGetters('preferences', ['toastrPosition']),
16
16
  },
17
17
 
18
- created() {
19
- if (this.toastrPosition) {
20
- this.toastr.position(this.toastrPosition).reset();
21
- }
22
- },
23
-
24
18
  methods: {
25
19
  ...mapActions('preferences', ['setToastrPosition']),
26
20
  update(position) {
27
21
  this.setToastrPosition(position);
28
- this.toastr.position(position).reset();
22
+ this.toastr.setup(position);
29
23
  },
30
24
  },
31
25