mirror of
https://github.com/simon987/sist2.git
synced 2025-04-18 01:36:42 +00:00
Remove default tags, add configurable featured line
This commit is contained in:
parent
1e6e24111b
commit
20adcce4a9
@ -191,30 +191,6 @@ class Sist2Api {
|
||||
setHitTags(hit: EsHit): void {
|
||||
const tags = [] as Tag[];
|
||||
|
||||
const mimeCategory = hit._source.mime == null ? null : hit._source.mime.split("/")[0];
|
||||
|
||||
switch (mimeCategory) {
|
||||
case "image":
|
||||
case "video":
|
||||
if ("videoc" in hit._source && hit._source.videoc) {
|
||||
tags.push({
|
||||
style: "video",
|
||||
text: hit._source.videoc.replace(" ", ""),
|
||||
userTag: false
|
||||
} as Tag);
|
||||
}
|
||||
break
|
||||
case "audio":
|
||||
if ("audioc" in hit._source && hit._source.audioc) {
|
||||
tags.push({
|
||||
style: "audio",
|
||||
text: hit._source.audioc,
|
||||
userTag: false
|
||||
} as Tag);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// User tags
|
||||
if ("tag" in hit._source) {
|
||||
hit._source.tag.forEach(tag => {
|
||||
|
@ -27,6 +27,11 @@
|
||||
<DocFileTitle :doc="doc"></DocFileTitle>
|
||||
</div>
|
||||
|
||||
<!-- Featured line -->
|
||||
<div style="display: flex">
|
||||
<FeaturedFieldsLine :doc="doc"></FeaturedFieldsLine>
|
||||
</div>
|
||||
|
||||
<!-- Tags -->
|
||||
<div class="card-text">
|
||||
<TagContainer :hit="doc"></TagContainer>
|
||||
@ -43,10 +48,11 @@ import DocFileTitle from "@/components/DocFileTitle.vue";
|
||||
import DocInfoModal from "@/components/DocInfoModal.vue";
|
||||
import ContentDiv from "@/components/ContentDiv.vue";
|
||||
import FullThumbnail from "@/components/FullThumbnail";
|
||||
import FeaturedFieldsLine from "@/components/FeaturedFieldsLine";
|
||||
|
||||
|
||||
export default {
|
||||
components: {FullThumbnail, ContentDiv, DocInfoModal, DocFileTitle, TagContainer},
|
||||
components: {FeaturedFieldsLine, FullThumbnail, ContentDiv, DocInfoModal, DocFileTitle, TagContainer},
|
||||
props: ["doc", "width"],
|
||||
data() {
|
||||
return {
|
||||
@ -133,8 +139,4 @@ export default {
|
||||
.sub-document .fit {
|
||||
padding: 4px 4px 0 4px;
|
||||
}
|
||||
|
||||
.featured-line {
|
||||
font-size: 92%;
|
||||
}
|
||||
</style>
|
@ -50,6 +50,11 @@
|
||||
<span v-if="doc._source.author && doc._source.pages" class="mx-1">-</span>
|
||||
<span v-if="doc._source.author">{{ doc._source.author }}</span>
|
||||
</div>
|
||||
|
||||
<!-- Featured line -->
|
||||
<div style="display: flex">
|
||||
<FeaturedFieldsLine :doc="doc"></FeaturedFieldsLine>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</b-list-group-item>
|
||||
@ -61,10 +66,11 @@ import DocFileTitle from "@/components/DocFileTitle";
|
||||
import DocInfoModal from "@/components/DocInfoModal";
|
||||
import ContentDiv from "@/components/ContentDiv";
|
||||
import FileIcon from "@/components/icons/FileIcon";
|
||||
import FeaturedFieldsLine from "@/components/FeaturedFieldsLine";
|
||||
|
||||
export default {
|
||||
name: "DocListItem",
|
||||
components: {FileIcon, ContentDiv, DocInfoModal, DocFileTitle, TagContainer},
|
||||
components: {FileIcon, ContentDiv, DocInfoModal, DocFileTitle, TagContainer, FeaturedFieldsLine},
|
||||
props: ["doc"],
|
||||
data() {
|
||||
return {
|
||||
|
42
sist2-vue/src/components/FeaturedFieldsLine.vue
Normal file
42
sist2-vue/src/components/FeaturedFieldsLine.vue
Normal file
@ -0,0 +1,42 @@
|
||||
<template>
|
||||
<div class="featured-line" v-html="featuredLineHtml"></div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {humanDate, humanFileSize} from "@/util";
|
||||
|
||||
function scopedEval(context, expr) {
|
||||
const evaluator = Function.apply(null, [...Object.keys(context), "expr", "return eval(expr)"]);
|
||||
return evaluator.apply(null, [...Object.values(context), expr]);
|
||||
}
|
||||
|
||||
|
||||
export default {
|
||||
name: "FeaturedFieldsLine",
|
||||
props: ["doc"],
|
||||
computed: {
|
||||
featuredLineHtml() {
|
||||
const scope = {doc: this.doc._source, humanDate: humanDate, humanFileSize: humanFileSize};
|
||||
|
||||
return this.$store.getters.optFeaturedFields
|
||||
.replaceAll(/\$\{([^}]*)}/g, (match, g1) => {
|
||||
return scopedEval(scope, g1);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
.featured-line {
|
||||
font-size: 90%;
|
||||
font-family: 'Source Sans Pro', 'Helvetica Neue', Arial, sans-serif;
|
||||
color: #424242;
|
||||
padding-left: 2px;
|
||||
}
|
||||
|
||||
.theme-black .featured-line {
|
||||
color: #bebebe;
|
||||
}
|
||||
</style>
|
@ -40,6 +40,7 @@
|
||||
|
||||
|
||||
<template v-for="tag in hit._tags">
|
||||
<!-- User tag-->
|
||||
<div v-if="tag.userTag" :key="tag.rawText" style="display: inline-block">
|
||||
<span
|
||||
:id="hit._id+tag.rawText"
|
||||
@ -51,7 +52,7 @@
|
||||
>{{ tag.text.split(".").pop() }}</span>
|
||||
|
||||
<b-popover :target="hit._id+tag.rawText" triggers="focus blur" placement="top">
|
||||
<b-button variant="danger" @click="onTagDeleteClick(tag, $event)">{{$t("deleteTag")}}</b-button>
|
||||
<b-button variant="danger" @click="onTagDeleteClick(tag, $event)">{{ $t("deleteTag") }}</b-button>
|
||||
</b-popover>
|
||||
</div>
|
||||
|
||||
@ -66,7 +67,7 @@
|
||||
<small v-if="showAddButton" class="badge add-tag-button" @click="tagAdd()">{{$t("addTag")}}</small>
|
||||
|
||||
<!-- Size tag-->
|
||||
<small v-else class="text-muted badge-size">{{
|
||||
<small v-else class="text-muted badge-size" style="padding-left: 2px">{{
|
||||
humanFileSize(hit._source.size)
|
||||
}}</small>
|
||||
</div>
|
||||
@ -211,7 +212,7 @@ export default Vue.extend({
|
||||
|
||||
return matches.sort().map(match => {
|
||||
return {
|
||||
title: match.split(".").slice(0,-1).join("."),
|
||||
title: match.split(".").slice(0, -1).join("."),
|
||||
id: match
|
||||
}
|
||||
});
|
||||
|
@ -8,7 +8,7 @@ export default {
|
||||
advanced: "Advanced search",
|
||||
fuzzy: "Fuzzy"
|
||||
},
|
||||
addTag: "Add",
|
||||
addTag: "Tag",
|
||||
deleteTag: "Delete",
|
||||
download: "Download",
|
||||
and: "and",
|
||||
@ -17,6 +17,7 @@ export default {
|
||||
mimeTypes: "Media types",
|
||||
tags: "Tags",
|
||||
tagFilter: "Filter tags",
|
||||
forExample: "For example:",
|
||||
help: {
|
||||
simpleSearch: "Simple search",
|
||||
advancedSearch: "Advanced search",
|
||||
@ -75,7 +76,9 @@ export default {
|
||||
useDatePicker: "Use a Date Picker component rather than a slider",
|
||||
vidPreviewInterval: "Video preview frame duration in ms",
|
||||
simpleLightbox: "Disable animations in image viewer",
|
||||
showTagPickerFilter: "Display the tag filter bar"
|
||||
showTagPickerFilter: "Display the tag filter bar",
|
||||
featuredFields: "Featured fields Javascript template string. Will appear in the search results.",
|
||||
featuredFieldsList: "Available variables"
|
||||
},
|
||||
queryMode: {
|
||||
simple: "Simple",
|
||||
@ -178,7 +181,7 @@ export default {
|
||||
advanced: "Erweiterte Suche",
|
||||
fuzzy: "Fuzzy"
|
||||
},
|
||||
addTag: "Hinzufügen",
|
||||
addTag: "Tag",
|
||||
deleteTag: "Löschen",
|
||||
download: "Herunterladen",
|
||||
and: "und",
|
||||
@ -187,6 +190,7 @@ export default {
|
||||
mimeTypes: "Medientypen",
|
||||
tags: "Tags",
|
||||
tagFilter: "Tags filtern",
|
||||
forExample: "Zum Beispiel:",
|
||||
help: {
|
||||
simpleSearch: "Einfache Suche",
|
||||
advancedSearch: "Erweiterte Suche",
|
||||
@ -245,7 +249,9 @@ export default {
|
||||
useDatePicker: "Benutze Datumswähler statt Schieber",
|
||||
vidPreviewInterval: "Videovorschau Framedauer in ms",
|
||||
simpleLightbox: "Schalte Animationen im Image-Viewer ab",
|
||||
showTagPickerFilter: "Zeige die Tag-Filter-Leiste"
|
||||
showTagPickerFilter: "Zeige die Tag-Filter-Leiste",
|
||||
featuredFields: "Ausgewählte Felder Javascript Vorlage String. Wird in den Suchergebnissen angezeigt.",
|
||||
featuredFieldsList: "Verfügbare Variablen"
|
||||
},
|
||||
queryMode: {
|
||||
simple: "Einfach",
|
||||
@ -348,7 +354,7 @@ export default {
|
||||
advanced: "Recherche avancée",
|
||||
fuzzy: "Approximatif"
|
||||
},
|
||||
addTag: "Ajouter",
|
||||
addTag: "Taguer",
|
||||
deleteTag: "Supprimer",
|
||||
download: "Télécharger",
|
||||
and: "et",
|
||||
@ -357,6 +363,7 @@ export default {
|
||||
mimeTypes: "Types de médias",
|
||||
tags: "Tags",
|
||||
tagFilter: "Filtrer les tags",
|
||||
forExample: "Par exemple:",
|
||||
help: {
|
||||
simpleSearch: "Recherche simple",
|
||||
advancedSearch: "Recherche avancée",
|
||||
@ -416,7 +423,9 @@ export default {
|
||||
useDatePicker: "Afficher un composant « Date Picker » plutôt qu'un slider",
|
||||
vidPreviewInterval: "Durée des images d'aperçu video en millisecondes",
|
||||
simpleLightbox: "Désactiver les animations du visualiseur d'images",
|
||||
showTagPickerFilter: "Afficher le filtre dans l'onglet Tags"
|
||||
showTagPickerFilter: "Afficher le filtre dans l'onglet Tags",
|
||||
featuredFields: "Expression Javascript pour les variables mises en évidence. Sera affiché dans les résultats de recherche.",
|
||||
featuredFieldsList: "Variables disponibles"
|
||||
},
|
||||
queryMode: {
|
||||
simple: "Simple",
|
||||
@ -520,7 +529,7 @@ export default {
|
||||
advanced: "高级搜索",
|
||||
fuzzy: "模糊搜索"
|
||||
},
|
||||
addTag: "添加",
|
||||
addTag: "签条",
|
||||
deleteTag: "删除",
|
||||
download: "下载",
|
||||
and: "与",
|
||||
@ -529,6 +538,7 @@ export default {
|
||||
mimeTypes: "文件类型",
|
||||
tags: "标签",
|
||||
tagFilter: "筛选标签",
|
||||
forExample: "例如:",
|
||||
help: {
|
||||
simpleSearch: "简易搜索",
|
||||
advancedSearch: "高级搜索",
|
||||
@ -587,7 +597,9 @@ export default {
|
||||
useDatePicker: "使用日期选择器组件而不是滑块",
|
||||
vidPreviewInterval: "视频预览帧的持续时间,以毫秒为单位",
|
||||
simpleLightbox: "在图片查看器中,禁用动画",
|
||||
showTagPickerFilter: "显示标签过滤栏"
|
||||
showTagPickerFilter: "显示标签过滤栏",
|
||||
featuredFields: "特色领域的Javascript模板字符串。将出现在搜索结果中。",
|
||||
featuredFieldsList: "可利用的变量"
|
||||
},
|
||||
queryMode: {
|
||||
simple: "简单",
|
||||
|
@ -33,6 +33,7 @@ export default new Vuex.Store({
|
||||
optHideDuplicates: true,
|
||||
optTheme: "light",
|
||||
optDisplay: "grid",
|
||||
optFeaturedFields: "",
|
||||
|
||||
optSize: 60,
|
||||
optHighlight: true,
|
||||
@ -158,6 +159,7 @@ export default new Vuex.Store({
|
||||
setOptQueryMode: (state, val) => state.optQueryMode = val,
|
||||
setOptResultSize: (state, val) => state.optSize = val,
|
||||
setOptTagOrOperator: (state, val) => state.optTagOrOperator = val,
|
||||
setOptFeaturedFields: (state, val) => state.optFeaturedFields = val,
|
||||
|
||||
setOptTreemapType: (state, val) => state.optTreemapType = val,
|
||||
setOptTreemapTiling: (state, val) => state.optTreemapTiling = val,
|
||||
@ -413,5 +415,6 @@ export default new Vuex.Store({
|
||||
optVidPreviewInterval: state => state.optVidPreviewInterval,
|
||||
optSimpleLightbox: state => state.optSimpleLightbox,
|
||||
optShowTagPickerFilter: state => state.optShowTagPickerFilter,
|
||||
optFeaturedFields: state => state.optFeaturedFields,
|
||||
}
|
||||
})
|
@ -16,7 +16,9 @@
|
||||
|
||||
<b-card>
|
||||
|
||||
<label><LanguageIcon/><span style="vertical-align: middle"> {{ $t("opt.lang") }}</span></label>
|
||||
<label>
|
||||
<LanguageIcon/>
|
||||
<span style="vertical-align: middle"> {{ $t("opt.lang") }}</span></label>
|
||||
<b-form-select :options="langOptions" :value="optLang" @input="setOptLang"></b-form-select>
|
||||
|
||||
<label>{{ $t("opt.theme") }}</label>
|
||||
@ -55,6 +57,62 @@
|
||||
$t("opt.showTagPickerFilter")
|
||||
}}
|
||||
</b-form-checkbox>
|
||||
|
||||
<br/>
|
||||
<label>{{ $t("opt.featuredFields") }}</label>
|
||||
|
||||
<br>
|
||||
<b-button v-b-toggle.collapse-1 variant="secondary" class="dropdown-toggle">{{
|
||||
$t("opt.featuredFieldsList")
|
||||
}}
|
||||
</b-button>
|
||||
<b-collapse id="collapse-1" class="mt-2">
|
||||
<ul>
|
||||
<li><code>doc.checksum</code></li>
|
||||
<li><code>doc.path</code></li>
|
||||
<li><code>doc.mime</code></li>
|
||||
<li><code>doc.videoc</code></li>
|
||||
<li><code>doc.audioc</code></li>
|
||||
<li><code>doc.pages</code></li>
|
||||
<li><code>doc.mtime</code></li>
|
||||
<li><code>doc.font_name</code></li>
|
||||
<li><code>doc.album</code></li>
|
||||
<li><code>doc.artist</code></li>
|
||||
<li><code>doc.title</code></li>
|
||||
<li><code>doc.genre</code></li>
|
||||
<li><code>doc.album_artist</code></li>
|
||||
<li><code>doc.exif_make</code></li>
|
||||
<li><code>doc.exif_model</code></li>
|
||||
<li><code>doc.exif_software</code></li>
|
||||
<li><code>doc.exif_exposure_time</code></li>
|
||||
<li><code>doc.exif_fnumber</code></li>
|
||||
<li><code>doc.exif_iso_speed_ratings</code></li>
|
||||
<li><code>doc.exif_focal_length</code></li>
|
||||
<li><code>doc.exif_user_comment</code></li>
|
||||
<li><code>doc.exif_user_comment</code></li>
|
||||
<li><code>doc.exif_gps_longitude_ref</code></li>
|
||||
<li><code>doc.exif_gps_longitude_dms</code></li>
|
||||
<li><code>doc.exif_gps_longitude_dec</code></li>
|
||||
<li><code>doc.exif_gps_latitude_ref</code></li>
|
||||
<li><code>doc.exif_gps_latitude_dec</code></li>
|
||||
<li><code>humanDate()</code></li>
|
||||
<li><code>humanFileSize()</code></li>
|
||||
</ul>
|
||||
|
||||
<p>{{ $t("forExample") }}</p>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<code><b>${humanDate(doc.mtime)}</b> • ${doc.videoc || ''}</code>
|
||||
</li>
|
||||
<li>
|
||||
<code>${doc.pages ? (doc.pages + ' pages') : ''}</code>
|
||||
</li>
|
||||
</ul>
|
||||
</b-collapse>
|
||||
<br/>
|
||||
<br/>
|
||||
<b-textarea rows="3" :value="optFeaturedFields" @input="setOptFeaturedFields"></b-textarea>
|
||||
</b-card>
|
||||
|
||||
<br/>
|
||||
@ -252,6 +310,7 @@ export default {
|
||||
"optVidPreviewInterval",
|
||||
"optSimpleLightbox",
|
||||
"optShowTagPickerFilter",
|
||||
"optFeaturedFields",
|
||||
]),
|
||||
clientWidth() {
|
||||
return window.innerWidth;
|
||||
@ -295,6 +354,7 @@ export default {
|
||||
"setOptVidPreviewInterval",
|
||||
"setOptSimpleLightbox",
|
||||
"setOptShowTagPickerFilter",
|
||||
"setOptFeaturedFields",
|
||||
]),
|
||||
onResetClick() {
|
||||
localStorage.removeItem("sist2_configuration");
|
||||
|
@ -49,7 +49,7 @@
|
||||
#include <ctype.h>
|
||||
#include "git_hash.h"
|
||||
|
||||
#define VERSION "2.14.0"
|
||||
#define VERSION "2.14.1"
|
||||
static const char *const Version = VERSION;
|
||||
|
||||
#ifndef SIST_PLATFORM
|
||||
|
Loading…
x
Reference in New Issue
Block a user