feat: Add various source control improvements (#6533)

* feat: update source control notice wording

* feat: update source control paywall state

* fix: remove source control git repository ssh input hint

* feat: hide tags, variables, and credentials from push modal

* feat: add status colors and current workflow marking and sorting

* feat: add select all workflows to push modal

* fix: push everything besides current workflow with push workflow action

* feat: add source control pull modal

* feat: add updatedAt integration

* fix: add time to last updated

* fix: fix sorting, taking deleted into account

* fix: update 409 pull workflow test

* fix: add status priority sorting

* fix: fix linting issue
This commit is contained in:
Alex Grozav
2023-06-28 14:59:07 +03:00
committed by GitHub
parent 42721dba80
commit 68fdc20789
12 changed files with 385 additions and 70 deletions

View File

@@ -4,12 +4,16 @@ import { useRouter } from 'vue-router/composables';
import { createEventBus } from 'n8n-design-system/utils';
import { useI18n, useLoadingService, useMessage, useToast } from '@/composables';
import { useUIStore, useSourceControlStore } from '@/stores';
import { SOURCE_CONTROL_PUSH_MODAL_KEY, VIEWS } from '@/constants';
import { SOURCE_CONTROL_PULL_MODAL_KEY, SOURCE_CONTROL_PUSH_MODAL_KEY, VIEWS } from '@/constants';
const props = defineProps<{
isCollapsed: boolean;
}>();
const responseStatuses = {
CONFLICT: 409,
};
const router = useRouter();
const loadingService = useLoadingService();
const uiStore = useUIStore();
@@ -47,28 +51,17 @@ async function pushWorkfolder() {
async function pullWorkfolder() {
loadingService.startLoading();
loadingService.setLoadingText(i18n.baseText('settings.sourceControl.loading.pull'));
try {
await sourceControlStore.pullWorkfolder(false);
} catch (error) {
const errorResponse = error.response;
if (errorResponse?.status === 409) {
const confirm = await message.confirm(
i18n.baseText('settings.sourceControl.modals.pull.description'),
i18n.baseText('settings.sourceControl.modals.pull.title'),
{
confirmButtonText: i18n.baseText('settings.sourceControl.modals.pull.buttons.save'),
cancelButtonText: i18n.baseText('settings.sourceControl.modals.pull.buttons.cancel'),
},
);
try {
if (confirm === 'confirm') {
await sourceControlStore.pullWorkfolder(true);
}
} catch (error) {
toast.showError(error, 'Error');
}
if (errorResponse?.status === responseStatuses.CONFLICT) {
uiStore.openModalWithData({
name: SOURCE_CONTROL_PULL_MODAL_KEY,
data: { eventBus, status: errorResponse.data.data },
});
} else {
toast.showError(error, 'Error');
}