|
@@ -21,22 +21,12 @@
|
|
|
{{ t(`workflow.blocks.base.findElement.options.${type}`) }}
|
|
|
</option>
|
|
|
</ui-select>
|
|
|
- <ui-button
|
|
|
- v-tooltip.group="t('workflow.blocks.base.element.select')"
|
|
|
- icon
|
|
|
- class="mr-2"
|
|
|
- @click="selectElement"
|
|
|
- >
|
|
|
- <v-remixicon name="riFocus3Line" />
|
|
|
- </ui-button>
|
|
|
- <ui-button
|
|
|
- v-tooltip.group="t('workflow.blocks.base.element.verify')"
|
|
|
- :disabled="!data.selector"
|
|
|
- icon
|
|
|
- @click="verifySelector"
|
|
|
- >
|
|
|
- <v-remixicon name="riCheckDoubleLine" />
|
|
|
- </ui-button>
|
|
|
+ <SharedElSelectorActions
|
|
|
+ :find-by="data.findBy"
|
|
|
+ :selector="data.selector"
|
|
|
+ :multiple="data.multiple"
|
|
|
+ @update:selector="updateData({ selector: $event })"
|
|
|
+ />
|
|
|
</div>
|
|
|
<edit-autocomplete v-if="!hideSelector" class="mb-1">
|
|
|
<ui-input
|
|
@@ -105,8 +95,7 @@
|
|
|
<script setup>
|
|
|
import { onMounted } from 'vue';
|
|
|
import { useI18n } from 'vue-i18n';
|
|
|
-import { useToast } from 'vue-toastification';
|
|
|
-import elementSelector from '@/newtab/utils/elementSelector';
|
|
|
+import SharedElSelectorActions from '@/components/newtab/shared/SharedElSelectorActions.vue';
|
|
|
import EditAutocomplete from './EditAutocomplete.vue';
|
|
|
|
|
|
const props = defineProps({
|
|
@@ -135,7 +124,6 @@ const props = defineProps({
|
|
|
const emit = defineEmits(['update:data', 'change']);
|
|
|
|
|
|
const { t } = useI18n();
|
|
|
-const toast = useToast();
|
|
|
|
|
|
const selectorTypes = ['cssSelector', 'xpath'];
|
|
|
|
|
@@ -145,21 +133,6 @@ function updateData(value) {
|
|
|
emit('update:data', payload);
|
|
|
emit('change', payload);
|
|
|
}
|
|
|
-function selectElement() {
|
|
|
- elementSelector.selectElement().then((selector) => {
|
|
|
- updateData({ selector });
|
|
|
- });
|
|
|
-}
|
|
|
-function verifySelector() {
|
|
|
- const { selector, multiple, findBy } = props.data;
|
|
|
- elementSelector
|
|
|
- .verifySelector({ selector, multiple, findBy })
|
|
|
- .then((result) => {
|
|
|
- if (!result.notFound) return;
|
|
|
-
|
|
|
- toast.error('Element not found');
|
|
|
- });
|
|
|
-}
|
|
|
|
|
|
onMounted(() => {
|
|
|
if (!props.data.findBy) {
|