Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
dashboard
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AURA
dashboard
Commits
de26eb39
Commit
de26eb39
authored
1 year ago
by
Konrad Mohrfeldt
Browse files
Options
Downloads
Patches
Plain Diff
refactor: move useSelectedShow helper function for better TS DX
parent
78ec46fb
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/util.ts
+14
-0
14 additions, 0 deletions
src/util.ts
src/utilities.js
+1
-13
1 addition, 13 deletions
src/utilities.js
with
15 additions
and
13 deletions
src/util.ts
+
14
−
0
View file @
de26eb39
...
...
@@ -2,6 +2,8 @@ import { cloneDeep, isEqual } from 'lodash'
import
{
computed
,
ComputedGetter
,
ComputedRef
,
readonly
,
Ref
,
ref
,
watch
,
watchEffect
}
from
'
vue
'
import
{
formatISO
,
parseISO
}
from
'
date-fns
'
import
DOMPurify
from
'
dompurify
'
import
{
useStore
}
from
'
vuex
'
import
{
Show
}
from
'
@/types
'
export
function
computedIter
<
T
>
(
fn
:
ComputedGetter
<
Iterable
<
T
>>
):
ComputedRef
<
T
[]
>
{
return
computed
(()
=>
Array
.
from
(
fn
()))
...
...
@@ -120,3 +122,15 @@ export function sanitizeHTML(
return
DOMPurify
.
sanitize
(
html
,
{
ALLOWED_TAGS
:
[]
})
}
export
function
useSelectedShow
()
{
const
store
=
useStore
()
return
computed
<
Show
>
({
get
()
{
return
store
.
state
.
shows
.
shows
[
store
.
state
.
shows
.
selected
.
index
]
},
set
(
show
)
{
store
.
commit
(
'
shows/switchShowById
'
,
show
.
id
)
},
})
}
This diff is collapsed.
Click to expand it.
src/utilities.js
+
1
−
13
View file @
de26eb39
import
{
useStore
}
from
'
vuex
'
import
{
computed
}
from
'
vue
'
export
{
useSelectedShow
}
from
'
./util
'
export
function
uppercaseFirst
(
string
=
''
)
{
return
string
.
charAt
(
0
).
toUpperCase
()
+
string
.
slice
(
1
)
...
...
@@ -33,17 +32,6 @@ export function getTimeString(date, withSeconds = false) {
return
`
${
hours
}
:
${
minutes
}${
withSeconds
?
`:
${
seconds
}
`
:
''
}
`
}
export
function
useSelectedShow
()
{
const
store
=
useStore
()
return
computed
({
get
()
{
return
store
.
state
.
shows
.
shows
[
store
.
state
.
shows
.
selected
.
index
]
},
set
(
show
)
{
store
.
commit
(
'
shows/switchShowById
'
,
show
.
id
)
},
})
}
export
function
shouldLog
(
message
,
instance
,
trace
)
{
// don’t log any Bootstrap-Vue warnings
if
(
/^B
[
A-Z
]
/
.
test
(
instance
?.
$options
?.
name
??
''
))
{
...
...
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