also rename t/k/v to e/a/v in ui
parent
ce36c97f2a
commit
2c5a824d4a
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<router-link :to="{name: 'Inspect', params: {'address': result.target}}" class="search-result">
|
||||
<router-link :to="{name: 'Inspect', params: {'address': result.entity}}" class="search-result">
|
||||
<div class="search-result-container">
|
||||
<div class="search-result-key">{{ result.key }}</div>
|
||||
<div class="search-result-attribute">{{ result.attribute }}</div>
|
||||
<div class="search-result-value">{{ result.value.c }}</div>
|
||||
</div>
|
||||
</router-link>
|
||||
|
@ -40,7 +40,7 @@ export default defineComponent({
|
|||
margin: .5rem 0;
|
||||
}
|
||||
|
||||
.search-result-key {
|
||||
.search-result-attribute {
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,8 +2,8 @@ export type Address = string;
|
|||
export type VALUE_TYPE = "Value" | "Address" | "Invalid";
|
||||
|
||||
export interface IEntry {
|
||||
target: Address,
|
||||
key: string,
|
||||
entity: Address,
|
||||
attribute: string,
|
||||
value: {t: VALUE_TYPE, c: string}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<div class="inspect">
|
||||
<h2>
|
||||
<Address :address="address" :is-file="backlinks.some(([_, e]) => e.key === 'FILE_IS')"/>
|
||||
<Address :address="address" :is-file="backlinks.some(([_, e]) => e.attribute === 'FILE_IS')"/>
|
||||
</h2>
|
||||
<div v-if="!error">
|
||||
<template v-if="attributes.length">
|
||||
|
@ -9,14 +9,14 @@
|
|||
<table>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>Key name</th>
|
||||
<th>Attribute name</th>
|
||||
<th>Value</th>
|
||||
</tr>
|
||||
<tr v-for="[id, entry] in attributes">
|
||||
<tr v-for="[id, entry] in attributes" :key=id>
|
||||
<td>
|
||||
<sl-icon-button name="x-circle" @click="removeEntry(id)"/>
|
||||
</td>
|
||||
<td>{{ entry.key }}</td>
|
||||
<td>{{ entry.attribute }}</td>
|
||||
<td>
|
||||
<Address link v-if="entry.value.t === 'Address'" :address="entry.value.c"/>
|
||||
<template v-else>
|
||||
|
@ -29,7 +29,7 @@
|
|||
<sl-icon-button name="plus-circle" @click="addEntry()"/>
|
||||
</td>
|
||||
<td>
|
||||
<sl-input v-sl-model:newEntryKey/>
|
||||
<sl-input v-sl-model:newEntryAttribute/>
|
||||
</td>
|
||||
<td>
|
||||
<sl-input v-sl-model:newEntryValue/>
|
||||
|
@ -41,15 +41,15 @@
|
|||
<h3>Referred to ({{ backlinks.length }})</h3>
|
||||
<table>
|
||||
<tr>
|
||||
<th>Targets</th>
|
||||
<th>Key names</th>
|
||||
<th>Entities</th>
|
||||
<th>Attribute names</th>
|
||||
</tr>
|
||||
<tr v-for="[id, entry] in backlinks">
|
||||
<td>
|
||||
<Address link :address="entry.target"/>
|
||||
<Address link :address="entry.entity"/>
|
||||
</td>
|
||||
<td>
|
||||
{{ entry.key }}
|
||||
{{ entry.attribute }}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
@ -81,7 +81,7 @@ export default defineComponent({
|
|||
},
|
||||
data: () => {
|
||||
return {
|
||||
newEntryKey: "",
|
||||
newEntryAttribute: "",
|
||||
newEntryValue: ""
|
||||
};
|
||||
},
|
||||
|
@ -92,16 +92,16 @@ export default defineComponent({
|
|||
return entries
|
||||
.sort(([_, a], [__, b]) => a.value.c.localeCompare(b.value.c))
|
||||
.sort(([_, a], [__, b]) => a.value.t.localeCompare(b.value.t))
|
||||
.sort(([_, a], [__, b]) => a.key.localeCompare(b.key));
|
||||
.sort(([_, a], [__, b]) => a.attribute.localeCompare(b.attribute));
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
},
|
||||
attributes(): [string, IEntry][] {
|
||||
return this.objectEntries.filter(([_, e]) => e.target === this.address);
|
||||
return this.objectEntries.filter(([_, e]) => e.entity === this.address);
|
||||
},
|
||||
backlinks(): [string, IEntry][] {
|
||||
return this.objectEntries.filter(([_, e]) => e.target !== this.address);
|
||||
return this.objectEntries.filter(([_, e]) => e.entity !== this.address);
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
@ -116,8 +116,8 @@ export default defineComponent({
|
|||
method: "PUT",
|
||||
headers: {"Content-Type": "application/json"},
|
||||
body: JSON.stringify({
|
||||
target: this.address,
|
||||
key: this.newEntryKey,
|
||||
entity: this.address,
|
||||
attribute: this.newEntryAttribute,
|
||||
value: {
|
||||
t: "Value",
|
||||
c: this.newEntryValue
|
||||
|
@ -127,7 +127,7 @@ export default defineComponent({
|
|||
|
||||
await this.mutate();
|
||||
|
||||
this.newEntryKey = "";
|
||||
this.newEntryAttribute = "";
|
||||
this.newEntryValue = "";
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue