fix(editor): Prevent keyboard shortcuts to edit workflows in readonly mode (#6613)
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
import { defineComponent } from 'vue';
|
||||
import { mapStores } from 'pinia';
|
||||
import dateformat from 'dateformat';
|
||||
|
||||
import { VIEWS } from '@/constants';
|
||||
import { useToast } from '@/composables';
|
||||
import { useSourceControlStore } from '@/stores';
|
||||
|
||||
export const genericHelpers = defineComponent({
|
||||
setup() {
|
||||
@@ -17,11 +18,15 @@ export const genericHelpers = defineComponent({
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapStores(useSourceControlStore),
|
||||
isReadOnlyRoute(): boolean {
|
||||
return ![VIEWS.WORKFLOW, VIEWS.NEW_WORKFLOW, VIEWS.LOG_STREAMING_SETTINGS].includes(
|
||||
this.$route.name as VIEWS,
|
||||
);
|
||||
},
|
||||
readOnlyEnv(): boolean {
|
||||
return this.sourceControlStore.preferences.branchReadOnly;
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
displayTimer(msPassed: number, showMs = false): string {
|
||||
@@ -49,21 +54,6 @@ export const genericHelpers = defineComponent({
|
||||
const [date, time] = formattedDate.split('#');
|
||||
return { date, time };
|
||||
},
|
||||
editAllowedCheck(): boolean {
|
||||
if (this.isReadOnlyRoute) {
|
||||
this.showMessage({
|
||||
// title: 'Workflow can not be changed!',
|
||||
title: this.$locale.baseText('genericHelpers.showMessage.title'),
|
||||
message: this.$locale.baseText('genericHelpers.showMessage.message'),
|
||||
type: 'info',
|
||||
duration: 0,
|
||||
dangerouslyUseHTMLString: true,
|
||||
});
|
||||
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
|
||||
/**
|
||||
* @note Loading helpers extracted as composable in useLoadingService
|
||||
|
||||
Reference in New Issue
Block a user