refactor(webui): use new query api
ci/woodpecker/push/woodpecker Pipeline failed Details

feat/selector-improvements
Tomáš Mládek 2023-11-11 11:28:08 +01:00
parent 209c0eeb40
commit efb5ad2295
3 changed files with 13 additions and 10 deletions

View File

@ -8,6 +8,7 @@
import { Query } from "@upnd/upend";
import { ATTR_IN } from "@upnd/upend/constants";
import { createEventDispatcher } from "svelte";
import { Any } from "@upnd/upend/query";
const dispatch = createEventDispatcher();
export let spec: string;
@ -69,8 +70,8 @@
const included = includedGroups.length
? (
await api.query(
new Query().matches(
undefined,
Query.matches(
Any,
ATTR_IN,
includedGroups.map((g) => `@${g}`),
),
@ -80,8 +81,8 @@
const required = requiredGroups.length
? (
await api.query(
new Query().matches(
undefined,
Query.matches(
Any,
ATTR_IN,
requiredGroups.map((g) => `@${g}`),
),
@ -91,8 +92,8 @@
const excluded = excludedGroups.length
? (
await api.query(
new Query().matches(
undefined,
Query.matches(
Any,
ATTR_IN,
excludedGroups.map((g) => `@${g}`),
),

View File

@ -4,6 +4,7 @@
import { i18n } from "../i18n";
import { Query, UpListing } from "@upnd/upend";
import EntitySetEditor from "./EntitySetEditor.svelte";
import { Any } from "@upnd/upend/query";
export let entities: string[];
@ -12,10 +13,10 @@
async function updateGroups() {
const currentEntities = entities.concat();
const allGroups = await api.query(
new Query().matches(
Query.matches(
currentEntities.map((e) => `@${e}`),
ATTR_IN,
undefined,
Any,
),
);

View File

@ -17,6 +17,7 @@
import api from "../../lib/api";
import { ATTR_IN, ATTR_LABEL, HIER_ROOT_ADDR } from "@upnd/upend/constants";
import { selected } from "../EntitySelect.svelte";
import { Any } from "@upnd/upend/query";
const dispatch = createEventDispatcher();
@ -87,12 +88,12 @@
let current = address;
while (levels < backpath && current !== HIER_ROOT_ADDR) {
const parent = await api.query(
new Query().matches(`@${current}`, ATTR_IN, undefined),
Query.matches(`@${current}`, ATTR_IN, Any),
);
if (parent.entries.length) {
current = parent.entries[0].value.c as string;
const label = await api.query(
new Query().matches(`@${current}`, ATTR_LABEL, undefined),
Query.matches(`@${current}`, ATTR_LABEL, Any),
);
if (label.entries.length) {
resolvedBackpath = [