Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
Frontend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Package Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
HUB Terra
SMS
Frontend
Commits
b20cbf01
Commit
b20cbf01
authored
4 years ago
by
Marc Hanisch
Browse files
Options
Downloads
Patches
Plain Diff
allow to and href properties in tabs
parent
595b6085
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!90
Draft: restructure frontend properties 2
,
!82
Restructure frontend
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
components/AppBarTabsExtension.vue
+38
-6
38 additions, 6 deletions
components/AppBarTabsExtension.vue
models/TabItemConfiguration.ts
+11
-0
11 additions, 0 deletions
models/TabItemConfiguration.ts
store/appbar.ts
+5
-3
5 additions, 3 deletions
store/appbar.ts
with
54 additions
and
9 deletions
components/AppBarTabsExtension.vue
+
38
−
6
View file @
b20cbf01
...
...
@@ -34,12 +34,31 @@ permissions and limitations under the Licence.
background-color=
"grey lighten-3"
@
change=
"changeTab"
>
<
v-tab
<
template
v-for=
"(tab, index) in tabs"
:key=
"index"
>
{{
tab
}}
</v-tab>
<v-tab
v-if=
"isString(tab)"
:key=
"index"
>
{{
tab
}}
</v-tab>
<v-tab
v-else-if=
"isRoute(tab)"
:key=
"index"
nuxt
:to=
"tab.to"
>
{{
tab
.
name
}}
</v-tab>
<v-tab
v-else-if=
"isLink(tab)"
:key=
"index"
:href=
"tab.href"
>
{{
tab
.
name
}}
</v-tab>
</
template
>
</v-tabs>
</template>
...
...
@@ -49,6 +68,7 @@ permissions and limitations under the Licence.
* @author <marc.hanisch@gfz-potsdam.de>
*/
import
{
Vue
,
Component
,
Prop
}
from
'
nuxt-property-decorator
'
import
{
TabItemConfiguration
}
from
'
@/models/TabItemConfiguration
'
/**
* A class component to provide tabs to an app-bar extension
...
...
@@ -71,11 +91,11 @@ export default class AppBarTabsExtension extends Vue {
* an array of tabs
*/
@
Prop
({
default
:
()
=>
[],
default
:
()
=>
[]
as
TabItemConfiguration
[]
,
type
:
Array
})
// @ts-ignore
readonly
tabs
:
string
[]
readonly
tabs
:
TabItemConfiguration
[]
/**
* changes the current tab
...
...
@@ -91,5 +111,17 @@ export default class AppBarTabsExtension extends Vue {
*/
this
.
$emit
(
'
change
'
,
tab
)
}
isRoute
(
tab
:
TabItemConfiguration
):
boolean
{
return
typeof
tab
===
'
object
'
&&
'
to
'
in
tab
}
isLink
(
tab
:
TabItemConfiguration
):
boolean
{
return
typeof
tab
===
'
object
'
&&
'
href
'
in
tab
}
isString
(
tab
:
TabItemConfiguration
):
boolean
{
return
typeof
tab
===
'
string
'
}
}
</
script
>
This diff is collapsed.
Click to expand it.
models/TabItemConfiguration.ts
0 → 100644
+
11
−
0
View file @
b20cbf01
export
interface
ITabItemRoute
{
name
:
string
to
:
string
}
export
interface
ITabItemLink
{
name
:
string
href
:
string
}
export
type
TabItemConfiguration
=
string
|
ITabItemRoute
|
ITabItemLink
This diff is collapsed.
Click to expand it.
store/appbar.ts
+
5
−
3
View file @
b20cbf01
...
...
@@ -29,13 +29,15 @@
* implied. See the Licence for the specific language governing
* permissions and limitations under the Licence.
*/
import
{
TabItemConfiguration
}
from
'
@/models/TabItemConfiguration
'
export
interface
IAppbarStore
{
activeTab
:
null
|
number
,
cancelBtnDisabled
:
boolean
,
cancelBtnHidden
:
boolean
,
saveBtnDisabled
:
boolean
,
saveBtnHidden
:
boolean
,
tabs
:
string
[],
tabs
:
TabItemConfiguration
[],
title
:
string
}
...
...
@@ -51,7 +53,7 @@ export const state = (): IAppbarStore => {
cancelBtnHidden
:
true
,
saveBtnDisabled
:
false
,
saveBtnHidden
:
true
,
tabs
:
[],
tabs
:
[]
as
TabItemConfiguration
[]
,
title
:
''
}
}
...
...
@@ -75,7 +77,7 @@ export const mutations = {
* @param {IAppbarStore} state - the current state
* @param {string[]} tabs - the tabs to set
*/
setTabs
(
state
:
IAppbarStore
,
tabs
:
string
[]):
void
{
setTabs
(
state
:
IAppbarStore
,
tabs
:
TabItemConfiguration
[]):
void
{
state
.
tabs
=
tabs
state
.
activeTab
=
tabs
.
length
>
0
?
0
:
null
},
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment