Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions forge/ee/lib/billing/trialTask.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ module.exports.init = function (app) {
await sendTrialEmail(subscription.Team, 'TrialTeamSuspended', {
teamSettingsURL: `${app.config.base_url}/team/${subscription.Team.slug}/billing`
})
await sendTrialSuspendedNotification(subscription.Team, 'TrialTeamEnded')
}

// We have dealt with this team
Expand Down Expand Up @@ -113,6 +114,16 @@ module.exports.init = function (app) {
}
}

async function sendTrialSuspendedNotification (team) {
const owners = await team.getOwners()
for (const user of owners) {
const { id, TeamTypeId, ...teamPayload } = team.toJSON()
app.notifications.send(user, 'team-trial-suspended', {
team: teamPayload
})
}
}

async function suspendAllProjects (team) {
const projects = await team.getProjects()
for (const project of projects) {
Expand Down
12 changes: 10 additions & 2 deletions frontend/src/components/notifications/Generic.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
</template>

<script>
import { defineAsyncComponent } from 'vue'
import { defineAsyncComponent, markRaw } from 'vue'

import IconDeviceSolid from '../../components/icons/DeviceSolid.js'
import IconNodeRedSolid from '../../components/icons/NodeRedSolid.js'
Expand Down Expand Up @@ -64,6 +64,11 @@ export default {
icon: 'instance',
title: 'Node-RED Instance Memory Usage',
message: 'Memory usage of "<i>{{instance.name}}</i>" has spent more than 5 minutes at more than 75% of memory limit. This instance may benefit from being upgraded to a larger Instance type'
},
'team-trial-suspended': {
icon: 'UserGroupIcon',
title: 'Trial Period Ended',
message: 'Your trial period for <i>{{team.name}}</i> has ended. Please upgrade to a paid plan to continue using this team.'
}
}
}
Expand All @@ -90,6 +95,9 @@ export default {
case typeof this.notification.data?.url === 'string':
return { url: this.notification.data.url }

case this.notification.type === 'team-trial-suspended':
return { name: 'Billing', params: { team_slug: this.notification.data.team.slug } }

default:
return null // no link
}
Expand All @@ -112,7 +120,7 @@ export default {
} else if (event.icon === 'device') {
event.iconComponent = IconDeviceSolid
} else {
event.iconComponent = defineAsyncComponent(() => import('@heroicons/vue/solid').then(x => x[event.icon] || x.BellIcon))
event.iconComponent = markRaw(defineAsyncComponent(() => import('@heroicons/vue/solid').then(x => x[event.icon] || x.BellIcon)))
}

// Perform known substitutions
Expand Down
1 change: 1 addition & 0 deletions frontend/src/stylesheets/components/notifications.scss
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ $ff-notifications-drawer-side-padding: 6px;
align-items: center;
height: 100%;
width: 100%;
padding: 0 !important;

> .header {
border-bottom: 1px solid $ff-grey-300;
Expand Down
Loading