Skip to content

Commit 6755d2c

Browse files
authored
Merge pull request #6320 from FlowFuse/ui-update-scheduled-maintenance
Add Scheduled Maintenance pill to Overview
2 parents bf0357f + 65e73bc commit 6755d2c

4 files changed

Lines changed: 59 additions & 19 deletions

File tree

forge/ee/routes/autoUpdateStacks/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ module.exports = async function (app) {
3535
* @memberof forge.routes.api.project
3636
*/
3737
app.get('/', {
38-
preHandler: app.needsPermission('project:edit'),
38+
preHandler: app.needsPermission('project:read'),
3939
schema: {
4040
summary: 'Returns when a Instance allowed to be restarted ',
4141
tags: ['Instances'],

frontend/src/components/expert/resources/FlowResourceCard.vue

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22
<div class="flex flex-col gap-3 p-3 bg-white border border-gray-200 rounded-lg">
33
<div class="flex items-start gap-2">
44
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="none" viewBox="0 0 24 24" class="flex-shrink-0 w-4 h-4 mt-0.5">
5-
<rect width="24" height="24" fill="gray" rx="4" />
6-
<g clip-path="url(#a)">
7-
<path fill="#fff" d="M0 12v-1.647c5.09 0 5.81-.9 6.44-1.695.72-.9 1.46-1.6 3.88-1.6v1.648c-1.76 0-2.04.354-2.51.948C6.79 10.937 5.5 12 0 12Z" />
8-
<path fill="#fff" d="M8.6 16.941c-2.9 0-3.47-1.513-3.88-2.614C4.25 13.072 3.85 12 0 12v-1.647c4.67 0 5.67 1.618 6.34 3.419.38 1.015.57 1.522 2.26 1.522v1.647Z" />
9-
<path fill="#fff" d="M16.78 19H9.9c-.95 0-1.72-.737-1.72-1.647v-2.47c0-.91.77-1.648 1.72-1.648h6.88c.95 0 1.72.738 1.72 1.647v2.47c0 .91-.77 1.648-1.72 1.648Zm0-4.118H9.9v2.47h6.88v-2.47Zm1.5-4.117H11.4c-.95 0-1.72-.738-1.72-1.647v-2.47c0-.91.77-1.648 1.72-1.648h6.88c.95 0 1.72.737 1.72 1.647v2.47c0 .91-.77 1.648-1.72 1.648Zm0-4.118H11.4v2.47h6.88v-2.47Z" />
10-
</g>
11-
<defs>
12-
<clipPath id="a">
13-
<path fill="#fff" d="M0 5h20v14H0z" />
14-
</clipPath>
15-
</defs>
16-
</svg>
5+
<rect width="24" height="24" fill="gray" rx="4" />
6+
<g clip-path="url(#a)">
7+
<path fill="#fff" d="M0 12v-1.647c5.09 0 5.81-.9 6.44-1.695.72-.9 1.46-1.6 3.88-1.6v1.648c-1.76 0-2.04.354-2.51.948C6.79 10.937 5.5 12 0 12Z" />
8+
<path fill="#fff" d="M8.6 16.941c-2.9 0-3.47-1.513-3.88-2.614C4.25 13.072 3.85 12 0 12v-1.647c4.67 0 5.67 1.618 6.34 3.419.38 1.015.57 1.522 2.26 1.522v1.647Z" />
9+
<path fill="#fff" d="M16.78 19H9.9c-.95 0-1.72-.737-1.72-1.647v-2.47c0-.91.77-1.648 1.72-1.648h6.88c.95 0 1.72.738 1.72 1.647v2.47c0 .91-.77 1.648-1.72 1.648Zm0-4.118H9.9v2.47h6.88v-2.47Zm1.5-4.117H11.4c-.95 0-1.72-.738-1.72-1.647v-2.47c0-.91.77-1.648 1.72-1.648h6.88c.95 0 1.72.737 1.72 1.647v2.47c0 .91-.77 1.648-1.72 1.648Zm0-4.118H11.4v2.47h6.88v-2.47Z" />
10+
</g>
11+
<defs>
12+
<clipPath id="a">
13+
<path fill="#fff" d="M0 5h20v14H0z" />
14+
</clipPath>
15+
</defs>
16+
</svg>
1717
<div class="flex-1 flex flex-col gap-1 min-w-0">
1818
<div class="flex items-start justify-between gap-2">
1919
<div class="text-sm font-medium text-gray-900 overflow-hidden text-ellipsis whitespace-nowrap flex-1 min-w-0">{{ flow.title }}</div>

frontend/src/pages/instance/Overview.vue

Lines changed: 45 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
<table class="table-fixed w-full border border-separate rounded">
99
<tr class="border-b">
10-
<td class="w-40 font-medium">Editor</td>
10+
<td class="w-48 font-medium">Editor</td>
1111
<td>
1212
<div v-if="editorAvailable">
1313
<div v-if="isVisitingAdmin || instance.settings.disableEditor" class="my-2">
@@ -65,7 +65,29 @@
6565
<template v-else>
6666
None
6767
</template>
68-
<router-link class="mt-0.5 ml-3" :to="{ name: 'instance-settings-security' }"><LinkIcon class="w-4" /></router-link>
68+
<router-link v-if="canEditProject" class="mt-0.5 ml-3" :to="{ name: 'instance-settings-security' }"><LinkIcon class="w-4" /></router-link>
69+
</div>
70+
</td>
71+
</tr>
72+
<tr class="border-b">
73+
<td class="font-medium">Scheduled Maintenance</td>
74+
<td class="py-2">
75+
<div class="flex">
76+
<template v-if="autoStackUpgrade">
77+
<StatusBadge
78+
class="forge-status-running hover:text-blue-600"
79+
status="Enabled"
80+
/>
81+
</template>
82+
<template v-else>
83+
<StatusBadge
84+
class="text-gray-400 hover:text-blue-600"
85+
status="Disabled"
86+
/>
87+
</template>
88+
<router-link v-if="canEditProject" :to="{ name: 'instance-settings-maintenance' }" @click.stop>
89+
<LinkIcon class="mt-0.5 ml-3 w-4" />
90+
</router-link>
6991
</div>
7092
</td>
7193
</tr>
@@ -148,14 +170,18 @@ export default {
148170
}
149171
},
150172
setup () {
151-
const { isVisitingAdmin } = usePermissions()
173+
const { hasPermission, isVisitingAdmin } = usePermissions()
152174
153-
return { isVisitingAdmin }
175+
return {
176+
hasPermission,
177+
isVisitingAdmin
178+
}
154179
},
155180
data () {
156181
return {
157182
auditLog: [],
158-
loading: true
183+
loading: true,
184+
autoStackUpgrade: false
159185
}
160186
},
161187
computed: {
@@ -173,15 +199,20 @@ export default {
173199
return this.instance.settings.httpNodeAuth.type
174200
}
175201
return this.instance.template.settings.httpNodeAuth?.type
202+
},
203+
canEditProject () {
204+
return this.hasPermission('project:edit', { application: this.instance.application })
176205
}
177206
},
178207
watch: {
179208
'instance.id': function (old, news) {
180209
this.loadLogs()
210+
this.getUpdateSchedule(this.instance.id)
181211
}
182212
},
183213
mounted () {
184214
this.loadLogs()
215+
this.getUpdateSchedule(this.instance.id)
185216
},
186217
methods: {
187218
loadLogs () {
@@ -202,6 +233,15 @@ export default {
202233
},
203234
loadItems: async function (instanceId, cursor) {
204235
return await InstanceApi.getInstanceAuditLog(instanceId, null, cursor, 4)
236+
},
237+
getUpdateSchedule: async function (instanceId) {
238+
try {
239+
await InstanceApi.getUpdateSchedule(instanceId)
240+
this.autoStackUpgrade = true
241+
return
242+
} catch (error) {
243+
}
244+
this.autoStackUpgrade = false
205245
}
206246
}
207247
}

frontend/src/pages/instance/Settings/Maintenance.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
Apply upgrades when available
88
<template #description>
99
<p>
10-
Select the day of the week and the hour during which the automatic upgrade will occur. The
10+
Select the day of the week and the hour during which the automatic upgrade will occur if available. The
1111
upgrade will start within the selected hour.
1212
</p>
1313
<p class="my-3"><span class="font-bold">Note:</span> All times are stated in UTC.</p>

0 commit comments

Comments
 (0)