feat(link shares): allows switching the initial view by passing a query parameter
This commit is contained in:
parent
63f5f446fd
commit
d3171b59be
3 changed files with 48 additions and 11 deletions
|
@ -83,6 +83,7 @@
|
||||||
<th>{{ $t('list.share.attributes.name') }}</th>
|
<th>{{ $t('list.share.attributes.name') }}</th>
|
||||||
<th>{{ $t('list.share.attributes.sharedBy') }}</th>
|
<th>{{ $t('list.share.attributes.sharedBy') }}</th>
|
||||||
<th>{{ $t('list.share.attributes.right') }}</th>
|
<th>{{ $t('list.share.attributes.right') }}</th>
|
||||||
|
<th>{{ $t('list.share.links.view') }}</th>
|
||||||
<th>{{ $t('list.share.attributes.delete') }}</th>
|
<th>{{ $t('list.share.attributes.delete') }}</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
@ -92,7 +93,7 @@
|
||||||
<div class="field has-addons no-input-mobile">
|
<div class="field has-addons no-input-mobile">
|
||||||
<div class="control">
|
<div class="control">
|
||||||
<input
|
<input
|
||||||
:value="getShareLink(s.hash)"
|
:value="getShareLink(s.hash, selectedView[s.id])"
|
||||||
class="input"
|
class="input"
|
||||||
readonly
|
readonly
|
||||||
type="text"
|
type="text"
|
||||||
|
@ -100,7 +101,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="control">
|
<div class="control">
|
||||||
<x-button
|
<x-button
|
||||||
@click="copy(getShareLink(s.hash))"
|
@click="copy(getShareLink(s.hash, selectedView[s.id]))"
|
||||||
:shadow="false"
|
:shadow="false"
|
||||||
v-tooltip="$t('misc.copy')"
|
v-tooltip="$t('misc.copy')"
|
||||||
>
|
>
|
||||||
|
@ -140,6 +141,24 @@
|
||||||
{{ $t('list.share.right.read') }}
|
{{ $t('list.share.right.read') }}
|
||||||
</template>
|
</template>
|
||||||
</td>
|
</td>
|
||||||
|
<td>
|
||||||
|
<div class="select">
|
||||||
|
<select v-model="selectedView[s.id]" id="linkShareView">
|
||||||
|
<option value="list">
|
||||||
|
{{ $t('list.list.title') }}
|
||||||
|
</option>
|
||||||
|
<option value="gantt">
|
||||||
|
{{ $t('list.gantt.title') }}
|
||||||
|
</option>
|
||||||
|
<option value="table">
|
||||||
|
{{ $t('list.table.title') }}
|
||||||
|
</option>
|
||||||
|
<option value="kanban">
|
||||||
|
{{ $t('list.kanban.title') }}
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
<td class="actions">
|
<td class="actions">
|
||||||
<x-button
|
<x-button
|
||||||
@click="
|
@click="
|
||||||
|
@ -207,6 +226,11 @@ const showDeleteModal = ref(false)
|
||||||
const linkIdToDelete = ref(0)
|
const linkIdToDelete = ref(0)
|
||||||
const showNewForm = ref(false)
|
const showNewForm = ref(false)
|
||||||
|
|
||||||
|
interface SelectedViewMapper {
|
||||||
|
[listId: number]: string,
|
||||||
|
}
|
||||||
|
const selectedView = ref<SelectedViewMapper>({})
|
||||||
|
|
||||||
const copy = useCopyToClipboard()
|
const copy = useCopyToClipboard()
|
||||||
watch(
|
watch(
|
||||||
() => props.listId,
|
() => props.listId,
|
||||||
|
@ -223,7 +247,11 @@ async function load(listId: IList['id']) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
linkShares.value = await linkShareService.getAll({listId})
|
const links = await linkShareService.getAll({listId})
|
||||||
|
links.forEach((l: ILinkShare) => {
|
||||||
|
selectedView.value[l.id] = 'list'
|
||||||
|
})
|
||||||
|
linkShares.value = links
|
||||||
}
|
}
|
||||||
|
|
||||||
async function add(listId: IList['id']) {
|
async function add(listId: IList['id']) {
|
||||||
|
@ -255,8 +283,8 @@ async function remove(listId: IList['id']) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getShareLink(hash: string) {
|
function getShareLink(hash: string, view: string = 'list') {
|
||||||
return frontendUrl.value + 'share/' + hash + '/auth'
|
return frontendUrl.value + 'share/' + hash + '/auth?view=' + view
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -242,7 +242,8 @@
|
||||||
"remove": "Remove a link share",
|
"remove": "Remove a link share",
|
||||||
"removeText": "Are you sure you want to remove this link share? It will no longer be possible to access this list with this link share. This cannot be undone!",
|
"removeText": "Are you sure you want to remove this link share? It will no longer be possible to access this list with this link share. This cannot be undone!",
|
||||||
"createSuccess": "The link share was successfully created.",
|
"createSuccess": "The link share was successfully created.",
|
||||||
"deleteSuccess": "The link share was successfully deleted"
|
"deleteSuccess": "The link share was successfully deleted",
|
||||||
|
"view": "View"
|
||||||
},
|
},
|
||||||
"userTeam": {
|
"userTeam": {
|
||||||
"typeUser": "user | users",
|
"typeUser": "user | users",
|
||||||
|
|
|
@ -79,7 +79,15 @@ function useAuth() {
|
||||||
? route.query.logoVisible === 'true'
|
? route.query.logoVisible === 'true'
|
||||||
: true
|
: true
|
||||||
store.commit(LOGO_VISIBLE, logoVisible)
|
store.commit(LOGO_VISIBLE, logoVisible)
|
||||||
router.push({name: 'list.list', params: {listId}})
|
|
||||||
|
let view = 'list'
|
||||||
|
if (route.query.view &&
|
||||||
|
(route.query.view === 'gantt' ||
|
||||||
|
route.query.view === 'kanban' ||
|
||||||
|
route.query.view === 'table')) {
|
||||||
|
view = route.query.view
|
||||||
|
}
|
||||||
|
router.push({name: `list.${view}`, params: {listId}})
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
if (e.response?.data?.code === 13001) {
|
if (e.response?.data?.code === 13001) {
|
||||||
authenticateWithPassword.value = true
|
authenticateWithPassword.value = true
|
||||||
|
|
Loading…
Reference in a new issue