Skip to content

Commit

Permalink
Merge pull request #970 from matomo-org/PG-3897-change-notification-type
Browse files Browse the repository at this point in the history
Updating notification types to prevent them from displaying too long
  • Loading branch information
snake14 authored Jan 10, 2025
2 parents da09bde + c04c795 commit 002ddae
Show file tree
Hide file tree
Showing 9 changed files with 363 additions and 323 deletions.
589 changes: 308 additions & 281 deletions vue/dist/TagManager.umd.js

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions vue/dist/TagManager.umd.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion vue/src/Container/ContainerEdit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ export default defineComponent({
message,
context,
id: notificationId,
type: 'transient',
type: 'toast',
});
setTimeout(() => {
NotificationsStore.scrollToNotification(notificationInstanceId);
Expand Down
2 changes: 1 addition & 1 deletion vue/src/ImportVersion/ImportVersion.vue
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export default defineComponent({
const instanceId = NotificationsStore.show({
message,
context,
type: 'transient',
type: 'toast',
id: NOTIFICATION_ID,
});

Expand Down
19 changes: 11 additions & 8 deletions vue/src/Tag/TagEdit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -470,12 +470,13 @@ export default defineComponent({
NotificationsStore.remove(notificationId);
NotificationsStore.remove('ajaxHelper');
},
showNotification(message: string, context: NotificationType['context']) {
showNotification(message: string, context: NotificationType['context'],
type: null|NotificationType['type'] = null) {
const instanceId = NotificationsStore.show({
message,
context,
id: notificationId,
type: 'transient',
type: type !== null ? type : 'toast',
});

setTimeout(() => {
Expand Down Expand Up @@ -704,16 +705,17 @@ export default defineComponent({

setTimeout(() => {
const createdX = translate('TagManager_CreatedX', translate('TagManager_Tag'));
let wantToRedeploy = '';
if (this.hasPublishCapability()) {
wantToRedeploy = translate(
const wantToRedeploy = translate(
'TagManager_WantToDeployThisChangeCreateVersion',
'<a class="createNewVersionLink">',
'</a>',
);
this.showNotification(`${createdX} ${wantToRedeploy}`, 'success', 'transient');
return;
}

this.showNotification(`${createdX} ${wantToRedeploy}`, 'success');
this.showNotification(createdX, 'success');
}, 200);
});
}).finally(() => {
Expand Down Expand Up @@ -754,16 +756,17 @@ export default defineComponent({
this.cancel();

const updatedAt = translate('TagManager_UpdatedX', translate('TagManager_Tag'));
let wantToDeploy = '';
if (this.hasPublishCapability()) {
wantToDeploy = translate(
const wantToDeploy = translate(
'TagManager_WantToDeployThisChangeCreateVersion',
'<a class="createNewVersionLink">',
'</a>',
);
this.showNotification(`${updatedAt} ${wantToDeploy}`, 'success', 'transient');
return;
}

this.showNotification(`${updatedAt} ${wantToDeploy}`, 'success');
this.showNotification(updatedAt, 'success');
}).finally(() => {
this.isUpdatingTag = false;
});
Expand Down
12 changes: 7 additions & 5 deletions vue/src/Tag/TagList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -372,23 +372,25 @@ export default defineComponent({
showDeployNotification(type: string) {
const translatedString = type === 'pause' ? 'TagManager_PausedTag' : 'TagManager_ResumedTag';
const createdX = translate(translatedString, translate('TagManager_Tag'));
let wantToRedeploy = '';
if (this.hasPublishCapability()) {
wantToRedeploy = translate(
const wantToRedeploy = translate(
'TagManager_WantToDeployThisChangeCreateVersion',
'<a class="createNewVersionLink">',
'</a>',
);
this.showNotification(`${createdX} ${wantToRedeploy}`, 'success', 'transient');
return;
}

this.showNotification(`${createdX} ${wantToRedeploy}`, 'success');
this.showNotification(createdX, 'success');
},
showNotification(message: string, context: NotificationType['context']) {
showNotification(message: string, context: NotificationType['context'],
type: null|NotificationType['type'] = null) {
const instanceId = NotificationsStore.show({
message,
context,
id: notificationId,
type: 'transient',
type: type !== null ? type : 'toast',
});

setTimeout(() => {
Expand Down
19 changes: 11 additions & 8 deletions vue/src/Trigger/TriggerEdit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -378,12 +378,13 @@ export default defineComponent({
NotificationsStore.remove(notificationId);
NotificationsStore.remove('ajaxHelper');
},
showNotification(message: string, context: NotificationType['context']) {
showNotification(message: string, context: NotificationType['context'],
type: null|NotificationType['type'] = null) {
const notificationInstanceId = NotificationsStore.show({
message,
context,
id: notificationId,
type: 'transient',
type: type !== null ? type : 'toast',
});
setTimeout(() => {
NotificationsStore.scrollToNotification(notificationInstanceId);
Expand Down Expand Up @@ -560,16 +561,17 @@ export default defineComponent({

setTimeout(() => {
const createdX = translate('TagManager_CreatedX', translate('TagManager_Trigger'));
let wantToRedeploy = '';
if (this.hasPublishCapability()) {
wantToRedeploy = translate(
const wantToRedeploy = translate(
'TagManager_WantToDeployThisChangeCreateVersion',
'<a class="createNewVersionLink">',
'</a>',
);
this.showNotification(`${createdX} ${wantToRedeploy}`, 'success', 'transient');
return;
}

this.showNotification(`${createdX} ${wantToRedeploy}`, 'success');
this.showNotification(createdX, 'success');
}, 200);
});
}).finally(() => {
Expand Down Expand Up @@ -615,16 +617,17 @@ export default defineComponent({
this.cancel();

const updatedAt = translate('TagManager_UpdatedX', translate('TagManager_Trigger'));
let wantToDeploy = '';
if (this.hasPublishCapability()) {
wantToDeploy = translate(
const wantToDeploy = translate(
'TagManager_WantToDeployThisChangeCreateVersion',
'<a class="createNewVersionLink">',
'</a>',
);
this.showNotification(`${updatedAt} ${wantToDeploy}`, 'success', 'transient');
return;
}

this.showNotification(`${updatedAt} ${wantToDeploy}`, 'success');
this.showNotification(updatedAt, 'success');
}).finally(() => {
this.isUpdatingTrigger = false;
});
Expand Down
19 changes: 11 additions & 8 deletions vue/src/Variable/VariableEdit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -371,12 +371,13 @@ export default defineComponent({
NotificationsStore.remove(notificationId);
NotificationsStore.remove('ajaxHelper');
},
showNotification(message: string, context: NotificationType['context']) {
showNotification(message: string, context: NotificationType['context'],
type: null|NotificationType['type'] = null) {
const notificationInstanceId = NotificationsStore.show({
message,
context,
id: notificationId,
type: 'transient',
type: type !== null ? type : 'toast',
});
setTimeout(() => {
NotificationsStore.scrollToNotification(notificationInstanceId);
Expand Down Expand Up @@ -592,16 +593,17 @@ export default defineComponent({

setTimeout(() => {
const createdX = translate('TagManager_CreatedX', translate('TagManager_Variable'));
let wantToRedeploy = '';
if (this.hasPublishCapability()) {
wantToRedeploy = translate(
const wantToRedeploy = translate(
'TagManager_WantToDeployThisChangeCreateVersion',
'<a class="createNewVersionLink">',
'</a>',
);
this.showNotification(`${createdX} ${wantToRedeploy}`, 'success', 'transient');
return;
}

this.showNotification(`${createdX} ${wantToRedeploy}`, 'success');
this.showNotification(createdX, 'success');
}, 200);
});
}).finally(() => {
Expand Down Expand Up @@ -647,16 +649,17 @@ export default defineComponent({
this.cancel();

const updatedAt = translate('TagManager_UpdatedX', translate('TagManager_Variable'));
let wantToDeploy = '';
if (this.hasPublishCapability()) {
wantToDeploy = translate(
const wantToDeploy = translate(
'TagManager_WantToDeployThisChangeCreateVersion',
'<a class="createNewVersionLink">',
'</a>',
);
this.showNotification(`${updatedAt} ${wantToDeploy}`, 'success', 'transient');
return;
}

this.showNotification(`${updatedAt} ${wantToDeploy}`, 'success');
this.showNotification(updatedAt, 'success');
}).finally(() => {
this.isUpdatingVar = false;
});
Expand Down
12 changes: 7 additions & 5 deletions vue/src/Version/VersionEdit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -224,12 +224,13 @@ export default defineComponent({
NotificationsStore.remove(notificationId);
NotificationsStore.remove('ajaxHelper');
},
showNotification(message: string, context: NotificationType['context']) {
showNotification(message: string, context: NotificationType['context'],
type: null|NotificationType['type'] = null) {
const notificationInstanceId = NotificationsStore.show({
message,
context,
id: notificationId,
type: 'transient',
type: type !== null ? type : 'toast',
});
setTimeout(() => {
NotificationsStore.scrollToNotification(notificationInstanceId);
Expand Down Expand Up @@ -372,16 +373,17 @@ export default defineComponent({

setTimeout(() => {
const createdX = translate('TagManager_CreatedX', translate('TagManager_Version'));
let wantToRedeploy = '';
if (this.hasPublishCapability()) {
wantToRedeploy = translate(
const wantToRedeploy = translate(
'TagManager_WantToDeployThisChangeCreateVersion',
'<a class="createNewVersionLink">',
'</a>',
);
this.showNotification(`${createdX} ${wantToRedeploy}`, 'success', 'transient');
return;
}

this.showNotification(`${createdX} ${wantToRedeploy}`, 'success');
this.showNotification(createdX, 'success');
}, 200);
});
}).finally(() => {
Expand Down

0 comments on commit 002ddae

Please sign in to comment.