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" >
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}
0 commit comments