-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added bookmarks for project and table pages, refactored landing…
… page (#3850)
- Loading branch information
Showing
10 changed files
with
151 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<template> | ||
<q-icon | ||
:name="name" | ||
:color="color" | ||
:title="$t(title)" | ||
size="sm" | ||
class="on-right" | ||
@click="authStore.toggleBookmark(props.resource)" | ||
/> | ||
</template> | ||
|
||
|
||
<script lang="ts"> | ||
import { defineComponent } from 'vue'; | ||
export default defineComponent({ | ||
name: 'BookmarkIcon', | ||
}); | ||
</script> | ||
<script setup lang="ts"> | ||
interface BookmarkIconProps { | ||
resource: string; | ||
} | ||
const props = defineProps<BookmarkIconProps>(); | ||
const authStore = useAuthStore(); | ||
const name = computed(() => authStore.isBookmarked(props.resource) ? 'star' : 'star_outline'); | ||
const color = computed(() => authStore.isBookmarked(props.resource) ? 'warning' : 'grey-5'); | ||
const title = computed(() => authStore.isBookmarked(props.resource) ? 'bookmarked_item' : 'bookmark_item'); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<template> | ||
<q-list separator v-if="bookmarks.length"> | ||
<q-item-label header class="text-uppercase">{{ $t('bookmarks') }}</q-item-label> | ||
<q-item | ||
v-for="bookmark in bookmarks" | ||
:key="bookmark.link" | ||
> | ||
<q-item-section> | ||
<q-item-label><router-link :to="bookmark.link">{{ bookmark.title }}</router-link></q-item-label> | ||
<q-item-label caption lines="2">{{ bookmark.caption }}</q-item-label> | ||
</q-item-section> | ||
</q-item> | ||
</q-list> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { BookmarkDto, BookmarkDto_ResourceType } from 'src/models/Opal'; | ||
import { defineComponent } from 'vue'; | ||
export default defineComponent({ | ||
name: 'BookmarksList', | ||
}); | ||
</script> | ||
<script setup lang="ts"> | ||
const authStore = useAuthStore(); | ||
const bookmarks = computed(() => authStore.bookmarks.map((bookmark) => ({ | ||
title: getTitle(bookmark), | ||
caption: bookmark.type, | ||
link: getLink(bookmark) | ||
}))); | ||
function getTitle(bookmark: BookmarkDto) { | ||
const title = bookmark.links.find((link) => link.rel === bookmark.resource).link; | ||
if (bookmark.type === BookmarkDto_ResourceType.TABLE) { | ||
const dsName = bookmark.links.find((link) => link.rel !== bookmark.resource).link; | ||
return `${dsName}.${title}`; | ||
} | ||
return title; | ||
} | ||
function getLink(bookmark: BookmarkDto) { | ||
const link = bookmark.resource; | ||
if (bookmark.type === BookmarkDto_ResourceType.TABLE) | ||
return link.replace(/\/datasource\//g, '/project/') | ||
return link; | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters