Skip to content

Commit

Permalink
Apply review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
kelanik8 committed Oct 19, 2023
1 parent 520a7de commit 34d9abe
Show file tree
Hide file tree
Showing 15 changed files with 40 additions and 14 deletions.
4 changes: 2 additions & 2 deletions client/web/admin/src/views/Automation/Workflow/Editor.vue
Expand Up @@ -206,7 +206,6 @@ export default {
this.$AutomationAPI.workflowUndelete({ workflowID: this.workflowID })
.then(() => {
this.fetchWorkflow()
this.toastSuccess(this.$t('notification:workflow.undelete.success'))
})
.catch(this.toastErrorHandler(this.$t('notification:workflow.undelete.error')))
Expand All @@ -217,6 +216,7 @@ export default {
this.$AutomationAPI.workflowDelete({ workflowID: this.workflowID })
.then(() => {
this.fetchWorkflow()
this.workflow.deletedAt = new Date()
this.toastSuccess(this.$t('notification:workflow.delete.success'))
this.$router.push({ name: 'automation.workflow' })
Expand All @@ -236,7 +236,7 @@ export default {
checkUnsavedChanges (next, to) {
const isNewPage = this.$route.path.includes('/new') && to.name.includes('edit')
if (isNewPage) {
if (isNewPage || this.workflow.deletedAt) {
next(true)
} else if (!to.name.includes('edit')) {
next(!isEqual(this.workflow, this.initialWorkflowState) ? window.confirm(this.$t('general:editor.unsavedChanges')) : true)
Expand Down
4 changes: 3 additions & 1 deletion client/web/admin/src/views/Federation/Nodes/Editor.vue
Expand Up @@ -319,6 +319,8 @@ export default {
.then(() => {
this.fetchNode()
this.node.deletedAt = new Date()
this.toastSuccess(this.$t('notification:federation.delete.success'))
this.$router.push({ name: 'federation.nodes' })
})
Expand Down Expand Up @@ -369,7 +371,7 @@ export default {
checkUnsavedChanges (next, to) {
const isNewPage = this.$route.path.includes('/new') && to.name.includes('edit')
if (isNewPage) {
if (isNewPage || this.node.deletedAt) {
next(true)
} else if (!to.name.includes('edit')) {
next(!isEqual(this.node, this.initialNodeState) ? window.confirm(this.$t('general:editor.unsavedChanges')) : true)
Expand Down
4 changes: 3 additions & 1 deletion client/web/admin/src/views/System/Apigw/Editor.vue
Expand Up @@ -224,6 +224,8 @@ export default {
.then(() => {
this.fetchRoute()
this.route.deletedAt = new Date()
this.toastSuccess(this.$t('notification:gateway.delete.success'))
this.$router.push({ name: 'system.apigw' })
})
Expand Down Expand Up @@ -345,7 +347,7 @@ export default {
checkUnsavedChanges (next, to) {
const isNewPage = this.$route.path.includes('/new') && to.name.includes('edit')
if (isNewPage) {
if (isNewPage || this.route.deletedAt) {
next(true)
} else if (!to.name.includes('edit')) {
const routeState = !isEqual(this.route, this.initialRouteState)
Expand Down
4 changes: 3 additions & 1 deletion client/web/admin/src/views/System/Application/Editor.vue
Expand Up @@ -327,6 +327,8 @@ export default {
.then(() => {
this.fetchApplication()
this.application.deletedAt = new Date()
this.toastSuccess(this.$t('notification:application.delete.success'))
this.$router.push({ name: 'system.application' })
})
Expand All @@ -340,7 +342,7 @@ export default {
checkUnsavedChanges (next, to) {
const isNewPage = this.$route.path.includes('/new') && to.name.includes('edit')
if (isNewPage) {
if (isNewPage || this.application.deletedAt) {
next(true)
} else if (!to.name.includes('edit')) {
next(!isEqual(this.application, this.initialApplicationState) || this.unifyAssetStateChange ? window.confirm(this.$t('general:editor.unsavedChanges')) : true)
Expand Down
4 changes: 3 additions & 1 deletion client/web/admin/src/views/System/AuthClient/Editor.vue
Expand Up @@ -186,6 +186,8 @@ export default {
.then(() => {
this.fetchAuthclient()
this.authclient.deletedAt = new Date()
this.toastSuccess(this.$t('notification:authclient.delete.success'))
this.$router.push({ name: 'system.authClient' })
})
Expand Down Expand Up @@ -221,7 +223,7 @@ export default {
checkUnsavedChanges (next, to) {
const isNewPage = this.$route.path.includes('/new') && to.name.includes('edit')
if (isNewPage) {
if (isNewPage || this.authclient.deletedAt) {
next(true)
} else if (!to.name.includes('edit')) {
next(!isEqual(this.authclient, this.initialAuthclientState) ? window.confirm(this.$t('general:editor.unsavedChanges')) : true)
Expand Down
3 changes: 2 additions & 1 deletion client/web/admin/src/views/System/Connection/Editor.vue
Expand Up @@ -242,6 +242,7 @@ export default {
/**
* Resource deleted, move back to the list
*/
this.connection.deletedAt = new Date()
this.$router.push({ name: `system.connection` })
} else {
this.connection.deletedAt = null
Expand All @@ -256,7 +257,7 @@ export default {
checkUnsavedChanges (next, to) {
const isNewPage = this.$route.path.includes('/new') && to.name.includes('edit')
if (isNewPage) {
if (isNewPage || this.connection.deletedAt) {
next(true)
} else if (!to.name.includes('edit')) {
next(!isEqual(this.connection, this.initialConnectionState) ? window.confirm(this.$t('general:editor.unsavedChanges')) : true)
Expand Down
7 changes: 5 additions & 2 deletions client/web/admin/src/views/System/Queue/Editor.vue
Expand Up @@ -196,7 +196,10 @@ export default {
.then(() => {
this.fetchQueue()
this.toastSuccess(this.$t(`notification:queue.${event}.success`))
if (!deletedAt) this.$router.push({ name: 'system.queue' })
if (!deletedAt) {
this.queue.deletedAt = new Date()
this.$router.push({ name: 'system.queue' })
}
})
.catch(this.toastErrorHandler(this.$t(`notification:queue.${event}.error`)))
.finally(() => {
Expand All @@ -207,7 +210,7 @@ export default {
checkUnsavedChanges (next, to) {
const isNewPage = this.$route.path.includes('/new') && to.name.includes('edit')
if (isNewPage) {
if (isNewPage || this.queue.deletedAt) {
next(true)
} else if (!to.name.includes('edit')) {
next(!isEqual(this.queue, this.initialQueueState) ? window.confirm(this.$t('general:editor.unsavedChanges')) : true)
Expand Down
3 changes: 2 additions & 1 deletion client/web/admin/src/views/System/Role/Editor.vue
Expand Up @@ -228,6 +228,7 @@ export default {
.then(() => {
this.fetchRole()
this.role.deletedAt = new Date()
this.toastSuccess(this.$t('notification:role.delete.success'))
this.$router.push({ name: 'system.role' })
})
Expand Down Expand Up @@ -333,7 +334,7 @@ export default {
checkUnsavedChanges (next, to) {
const isNewPage = this.$route.path.includes('/new') && to.name.includes('edit')
if (isNewPage) {
if (isNewPage || this.role.deletedAt) {
next(true)
} else if (!to.name.includes('edit')) {
const isDirty = (this.roleMembers || []).some(m => m.dirty !== m.current) || !isEqual(this.role, this.initialRoleState)
Expand Down
Expand Up @@ -187,6 +187,7 @@ export default {
.then(() => {
this.fetchSensitivityLevel()
this.sensitivityLevel.deletedAt = new Date()
this.toastSuccess(this.$t('notification:sensitivityLevel.delete.success'))
this.$router.push({ name: 'system.sensitivityLevel' })
})
Expand All @@ -198,7 +199,7 @@ export default {
checkUnsavedChanges (next, to) {
const isNewPage = this.$route.path.includes('/new') && to.name.includes('edit')
if (isNewPage) {
if (isNewPage || this.sensitivityLevel.deletedAt) {
next(true)
} else if (!to.name.includes('edit')) {
next(!isEqual(this.sensitivityLevel, this.initialSensitivityLevelState) ? window.confirm(this.$t('general:editor.unsavedChanges')) : true)
Expand Down
3 changes: 2 additions & 1 deletion client/web/admin/src/views/System/Template/Editor.vue
Expand Up @@ -193,6 +193,7 @@ export default {
.then(() => {
this.fetchTemplate()
this.template.deletedAt = new Date()
this.toastSuccess(this.$t('notification:template.delete.success'))
this.$router.push({ name: 'system.template' })
})
Expand Down Expand Up @@ -239,7 +240,7 @@ export default {
checkUnsavedChanges (next, to) {
const isNewPage = this.$route.path.includes('/new') && to.name.includes('edit')
if (isNewPage) {
if (isNewPage || this.template.deletedAt) {
next(true)
} else if (!to.name.includes('edit')) {
next(!isEqual(this.template, this.initialTemplateState) ? window.confirm(this.$t('general:editor.unsavedChanges')) : true)
Expand Down
3 changes: 2 additions & 1 deletion client/web/admin/src/views/System/User/Editor.vue
Expand Up @@ -345,6 +345,7 @@ export default {
.then(() => {
this.fetchUser()
this.user.deletedAt = new Date()
this.toastSuccess(this.$t('notification:user.delete.success'))
this.$router.push({ name: 'system.user' })
})
Expand Down Expand Up @@ -516,7 +517,7 @@ export default {
checkUnsavedChanges (next, to) {
const isNewPage = this.$route.path.includes('/new') && to.name.includes('edit')
if (isNewPage) {
if (isNewPage || this.user.deletedAt) {
next(true)
} else if (!to.name.includes('edit')) {
let userChangesStatus = !isEqual(this.user, this.initialUserState)
Expand Down
1 change: 1 addition & 0 deletions client/web/reporter/src/mixins/report.js
Expand Up @@ -74,6 +74,7 @@ export default {

return this.$SystemAPI.reportDelete(this.report)
.then(() => {
this.report.deletedAt = new Date()
this.toastSuccess(this.$t('notification:report.delete'))
this.$router.push({ name: 'report.list' })
})
Expand Down
4 changes: 4 additions & 0 deletions client/web/reporter/src/views/Report/Builder.vue
Expand Up @@ -959,6 +959,10 @@ export default {
// Trigger browser dialog on page leave to prevent unsaved changes
checkUnsavedBlocks (next) {
if (this.report.deletedAt) {
return next(true)
}
next(!this.unsavedBlocks.size || window.confirm(this.$t('builder:unsaved-changes')))
},
Expand Down
4 changes: 4 additions & 0 deletions client/web/reporter/src/views/Report/Edit.vue
Expand Up @@ -295,6 +295,10 @@ export default {
},
checkUnsavedChart (next) {
if (this.report.deletedAt) {
return next(true)
}
const reportState = {
handle: this.report.handle,
meta: {
Expand Down
3 changes: 2 additions & 1 deletion client/web/workflow/src/views/Workflow/Editor.vue
Expand Up @@ -92,7 +92,7 @@ export default {
},
beforeRouteLeave (to, from, next) {
if (this.changeDetected) {
if (this.changeDetected && !this.workflow.deletedAt) {
next(window.confirm(this.$t('notification:confirm-unsaved-changes')))
} else {
window.onbeforeunload = null
Expand Down Expand Up @@ -193,6 +193,7 @@ export default {
.then(() => {
// Disable unsaved changes prompt
this.workflow = {}
this.workflow.deletedAt = new Date()
this.$router.push({ name: 'workflow.list' })
this.toastSuccess(this.$t('notification:delete.success'))
})
Expand Down

0 comments on commit 34d9abe

Please sign in to comment.