Skip to content

Commit

Permalink
Added linkding widget
Browse files Browse the repository at this point in the history
  • Loading branch information
m42e committed Feb 13, 2023
1 parent f7d1eef commit 2b943ce
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
58 changes: 58 additions & 0 deletions src/components/Widgets/Linkding.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<template>
<div class="linkding-outer-wrapper">
<div class="linkding-wrapper" v-if="links">
<ul>
<li
v-for="link in links"
v-bind:key="link.id"
class="lingkding-link"
v-tooltip="mvgTooltipConnection(connection)"
>
<a href="link.url"><span class="linktext" v-tooltip="link.description">{{link.text}}</span></a>
</li>
</ul>
</div>
</div>
</template>

<script>
import WidgetMixin from '@/mixins/WidgetMixin';
import { widgetApiEndpoints } from '@/utils/defaults';
export default {
mixins: [WidgetMixin],
components: {},
data() {
return {
links: null,
};
},
computed: {
endpoint() {
if (!this.options.host) this.error('linkgding Host is required');
return `${this.options.host}/api/bookmarks`;
},
},
methods: {
update() {
this.startLoading();
this.fetchData();
this.finishLoading();
},
fetchData() {
this.makeRequest(this.endpoint()).then(
(response) => { this.processData(response); },
);
}
},
processData(data) {
this.links = data.results;
},
},
};
</script>

<style scoped lang="scss">
.linkdign-wrapper {
}
</style>
1 change: 1 addition & 0 deletions src/components/Widgets/WidgetBase.vue
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ const COMPAT = {
joke: 'Jokes',
'mullvad-status': 'MullvadStatus',
mvg: 'Mvg',
linkding: 'Linkding',
'mvg-connection': 'MvgConnection',
'nd-cpu-history': 'NdCpuHistory',
'nd-load-history': 'NdLoadHistory',
Expand Down

0 comments on commit 2b943ce

Please sign in to comment.