feat: remove extractors from ui

This commit is contained in:
fiftin 2024-03-06 15:01:48 +01:00
parent 3f8af892e5
commit 1b3a6e1659
11 changed files with 20 additions and 225 deletions

View File

@ -108,19 +108,13 @@ export default {
}
return this.$route.params.integrationId;
},
extractorId() {
if (/^-?\d+$/.test(this.$route.params.extractorId)) {
return parseInt(this.$route.params.extractorId, 10);
}
return this.$route.params.extractorId;
},
},
methods: {
getItemsUrl() {
return `/api/project/${this.projectId}/integrations/${this.integrationId}/extractors/${this.extractorId}/values`;
return `/api/project/${this.projectId}/integrations/${this.integrationId}/values`;
},
getSingleItemUrl() {
return `/api/project/${this.projectId}/integrations/${this.integrationId}/extractors/${this.extractorId}/values/${this.itemId}`;
return `/api/project/${this.projectId}/integrations/${this.integrationId}/values/${this.itemId}`;
},
},
};

View File

@ -1,5 +0,0 @@
export default {
props: {
extractorId: Number,
},
};

View File

@ -4,7 +4,6 @@ import { getErrorMessage } from '@/lib/error';
export default {
props: {
integrationId: [Number, String],
extractorId: [Number, String],
},
methods: {
/**

View File

@ -33,10 +33,10 @@ export default {
},
methods: {
getItemsUrl() {
return `/api/project/${this.projectId}/integrations/${this.integrationId}/extractors`;
return `/api/project/${this.projectId}/integrations`;
},
getSingleItemUrl() {
return `/api/project/${this.projectId}/integrations/${this.integrationId}/extractors/${this.itemId}`;
return `/api/project/${this.projectId}/integrations/${this.integrationId}`;
},
},
};

View File

@ -132,10 +132,10 @@ export default {
},
methods: {
getItemsUrl() {
return `/api/project/${this.projectId}/integrations/${this.integrationId}/extractors/${this.extractorId}/matchers`;
return `/api/project/${this.projectId}/integrations/${this.integrationId}/matchers`;
},
getSingleItemUrl() {
return `/api/project/${this.projectId}/integrations/${this.integrationId}/extractors/${this.extractorId}/matchers/${this.itemId}`;
return `/api/project/${this.projectId}/integrations/${this.integrationId}/matchers/${this.itemId}`;
},
},
};

View File

@ -15,8 +15,6 @@ import Auth from '../views/Auth.vue';
import New from '../views/project/New.vue';
import Integrations from '../views/project/Integrations.vue';
import IntegrationExtractors from '../views/project/IntegrationExtractors.vue';
import IntegrationExtractor from '../views/project/IntegrationExtractor.vue';
Vue.use(VueRouter);
@ -76,10 +74,6 @@ const routes = [
},
{
path: '/project/:projectId/integration/:integrationId',
component: IntegrationExtractors,
},
{
path: '/project/:projectId/integration/:integrationId/extractor/:extractorId',
component: IntegrationExtractor,
},
{

View File

@ -10,7 +10,7 @@
>
<template v-slot:form="{ onSave, onError, needSave, needReset }">
<IntegrationExtractValueForm
:extractor-id="extractorId"
:integration-id="integrationId"
:item-id="itemId"
:project-id="projectId"
@save="onSave"
@ -24,7 +24,7 @@
<ObjectRefsDialog
object-title="extractvalue"
:object-refs="itemRefs"
:extractor-id="extractorId"
:integration-id="integrationId"
v-model="itemRefsDialog"
/>
@ -91,12 +91,11 @@
import ItemListPageBase from '@/components/ItemListPageBase';
import IntegrationExtractorsBase from '@/components/IntegrationExtractorsBase';
import IntegrationExtractorBase from '@/components/IntegrationExtractorBase';
import IntegrationExtractValueForm from '@/components/IntegrationExtractValueForm.vue';
export default {
mixins: [ItemListPageBase, IntegrationExtractorsBase, IntegrationExtractorBase],
mixins: [ItemListPageBase, IntegrationExtractorsBase],
components: { IntegrationExtractValueForm },
computed: {
@ -112,12 +111,6 @@ export default {
}
return this.$route.params.integrationId;
},
extractorId() {
if (/^-?\d+$/.test(this.$route.params.extractorId)) {
return parseInt(this.$route.params.extractorId, 10);
}
return this.$route.params.extractorId;
},
},
methods: {
@ -158,10 +151,10 @@ export default {
}];
},
getItemsUrl() {
return `/api/project/${this.projectId}/integrations/${this.integrationId}/extractors/${this.extractorId}/values`;
return `/api/project/${this.projectId}/integrations/${this.integrationId}/values`;
},
getSingleItemUrl() {
return `/api/project/${this.projectId}/integrations/${this.integrationId}/extractors/${this.extractorId}/values/${this.itemId}`;
return `/api/project/${this.projectId}/integrations/${this.integrationId}/values/${this.itemId}`;
},
getEventName() {
return 'w-integration-extract-value';

View File

@ -7,14 +7,12 @@
</template>
<script>
import IntegrationExtractorsBase from '@/components/IntegrationExtractorsBase';
import IntegrationExtractorBase from '@/components/IntegrationExtractorBase';
import IntegrationExtractValue from './IntegrationExtractValue.vue';
import IntegrationMatcher from './IntegrationMatcher.vue';
import IntegrationExtractorCrumb from './IntegrationExtractorCrumb.vue';
export default {
mixins: [IntegrationExtractorsBase, IntegrationExtractorBase],
mixins: [IntegrationExtractorsBase],
components: { IntegrationMatcher, IntegrationExtractValue, IntegrationExtractorCrumb },
computed: {
integrationId() {
@ -23,12 +21,6 @@ export default {
}
return this.$route.params.integrationId;
},
extractorId() {
if (/^-?\d+$/.test(this.$route.params.extractorId)) {
return parseInt(this.$route.params.extractorId, 10);
}
return this.$route.params.extractorId;
},
},
methods: {
allowActions() {

View File

@ -24,10 +24,9 @@ import axios from 'axios';
import ItemListPageBase from '@/components/ItemListPageBase';
import IntegrationExtractorsBase from '@/components/IntegrationExtractorsBase';
import IntegrationExtractorBase from '@/components/IntegrationExtractorBase';
export default {
mixins: [ItemListPageBase, IntegrationExtractorsBase, IntegrationExtractorBase],
mixins: [ItemListPageBase, IntegrationExtractorsBase],
components: { },
data() {
return {
@ -44,7 +43,7 @@ export default {
this.extractor = (await axios({
method: 'get',
url: `/api/project/${this.projectId}/integrations/${this.integrationId}/extractors/${this.extractorId}`,
url: `/api/project/${this.projectId}/integrations/${this.integrationId}`,
responseType: 'json',
})).data;
},
@ -80,7 +79,7 @@ export default {
return `/api/project/${this.projectId}/integrations/${this.integrationId}/extractors`;
},
getSingleItemUrl() {
return `/api/project/${this.projectId}/integrations/${this.integrationId}/extractors/${this.extractorId}`;
return `/api/project/${this.projectId}/integrations/${this.integrationId}`;
},
getEventName() {
return 'w-integration-matcher';

View File

@ -1,164 +0,0 @@
<template xmlns:v-slot="http://www.w3.org/1999/XSL/Transform">
<div v-if="items != null && integration != null">
<EditDialog
v-model="editDialog"
:save-button-text="itemId === 'new' ? 'Create' : 'Save'"
:title="`${itemId === 'new' ? 'New' : 'Edit'} Integration Extractor`"
:max-width="450"
@save="loadItems"
>
<template v-slot:form="{ onSave, onError, needSave, needReset }">
<IntegrationExtractorForm
:integration-id="integrationId"
:project-id="projectId"
:item-id="itemId"
@save="onSave"
@error="onError"
:need-save="needSave"
:need-reset="needReset"
/>
</template>
</EditDialog>
<ObjectRefsDialog
object-title="extractor"
:object-refs="itemRefs"
:integration-id="integrationId"
v-model="itemRefsDialog"
/>
<YesNoDialog
title="Delete Integration Extractor"
text="Are you sure you want to delete this Integration Extractor?"
v-model="deleteItemDialog"
@yes="deleteItem(itemId)"
/>
<v-toolbar flat >
<v-app-bar-nav-icon @click="showDrawer()"></v-app-bar-nav-icon>
<v-toolbar-title class="breadcrumbs">
<router-link
class="breadcrumbs__item breadcrumbs__item--link"
:to="`/project/${projectId}/integrations/`"
>
Integrations
</router-link>
<v-icon>mdi-chevron-right</v-icon>
<span class="breadcrumbs__item">{{ integration.name }}</span>
<v-icon>mdi-chevron-right</v-icon>
<span class="breadcrumbs__item">Extractors</span>
</v-toolbar-title>
<v-spacer></v-spacer>
<v-btn
color="primary"
@click="editItem('new')"
>New Extractor</v-btn>
</v-toolbar>
<v-data-table
:headers="headers"
:items="items"
class="mt-4"
:items-per-page="Number.MAX_VALUE"
>
<template v-slot:item.name="{ item }">
<router-link
:to="`/project/${projectId}/integration/${integrationId}/extractor/${item.id}`"
>{{ item.name }}
</router-link>
</template>
<template v-slot:item.actions="{ item }">
<div style="white-space: nowrap">
<v-btn
icon
class="mr-1"
@click="askDeleteItem(item.id)"
>
<v-icon>mdi-delete</v-icon>
</v-btn>
<v-btn
icon
class="mr-1"
@click="editItem(item.id)"
>
<v-icon>mdi-pencil</v-icon>
</v-btn>
</div>
</template>
</v-data-table>
</div>
</template>
<script>
/* eslint-disable vue/no-unused-components */
import axios from 'axios';
import { USER_PERMISSIONS } from '@/lib/constants';
import ItemListPageBase from '@/components/ItemListPageBase';
import IntegrationExtractorForm from '@/components/IntegrationExtractorForm.vue';
import IntegrationExtractorsBase from '@/components/IntegrationExtractorsBase';
export default {
mixins: [ItemListPageBase, IntegrationExtractorsBase],
components: { IntegrationExtractorForm },
data() {
return {
integration: null,
};
},
async created() {
this.integration = (await axios({
method: 'get',
url: `/api/project/${this.projectId}/integrations/${this.integrationId}`,
responseType: 'json',
})).data;
},
computed: {
projectId() {
if (/^-?\d+$/.test(this.$route.params.projectId)) {
return parseInt(this.$route.params.projectId, 10);
}
return this.$route.params.projectId;
},
integrationId() {
if (/^-?\d+$/.test(this.$route.params.integrationId)) {
return parseInt(this.$route.params.integrationId, 10);
}
return this.$route.params.integrationId;
},
},
methods: {
allowActions() {
return this.can(USER_PERMISSIONS.updateProject);
},
getHeaders() {
return [{
text: 'Name',
value: 'name',
width: '33.33%',
sortable: true,
},
{
text: 'Actions',
value: 'actions',
sortable: false,
}];
},
getItemsUrl() {
return `/api/project/${this.projectId}/integrations/${this.integrationId}/extractors`;
},
getSingleItemUrl() {
return `/api/project/${this.projectId}/integrations/${this.integrationId}/extractors/${this.itemId}`;
},
getEventName() {
return 'w-integration-extractor';
},
},
};
</script>

View File

@ -10,7 +10,7 @@
>
<template v-slot:form="{ onSave, onError, needSave, needReset }">
<IntegrationMatcherForm
:extractor-id="extractorId"
:integration-id="integrationId"
:item-id="itemId"
@save="onSave"
@error="onError"
@ -23,7 +23,7 @@
<ObjectRefsDialog
object-title="matcher"
:object-refs="itemRefs"
:extractor-id="extractorId"
:integration-id="integrationId"
v-model="itemRefsDialog"
/>
@ -95,12 +95,11 @@
import ItemListPageBase from '@/components/ItemListPageBase';
import IntegrationExtractorsBase from '@/components/IntegrationExtractorsBase';
import IntegrationExtractorBase from '@/components/IntegrationExtractorBase';
import IntegrationMatcherForm from '@/components/IntegrationMatcherForm.vue';
export default {
mixins: [ItemListPageBase, IntegrationExtractorsBase, IntegrationExtractorBase],
mixins: [ItemListPageBase, IntegrationExtractorsBase],
components: { IntegrationMatcherForm },
computed: {
projectId() {
@ -115,12 +114,6 @@ export default {
}
return this.$route.params.integrationId;
},
extractorId() {
if (/^-?\d+$/.test(this.$route.params.extractorId)) {
return parseInt(this.$route.params.extractorId, 10);
}
return this.$route.params.extractorId;
},
},
methods: {
allowActions() {
@ -164,10 +157,10 @@ export default {
}];
},
getItemsUrl() {
return `/api/project/${this.projectId}/integrations/${this.integrationId}/extractors/${this.extractorId}/matchers`;
return `/api/project/${this.projectId}/integrations/${this.integrationId}/matchers`;
},
getSingleItemUrl() {
return `/api/project/${this.projectId}/integrations/${this.integrationId}/extractors/${this.extractorId}/matchers/${this.itemId}`;
return `/api/project/${this.projectId}/integrations/${this.integrationId}/matchers/${this.itemId}`;
},
getEventName() {
return 'w-integration-matcher';