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
1a4260c5
Commit
1a4260c5
authored
2 years ago
by
Tim Eder
Browse files
Options
Downloads
Patches
Plain Diff
unified eports in store
parent
03f66000
No related branches found
Branches containing commit
No related tags found
Tags containing commit
3 merge requests
!296
Merge develop for staging release
,
!230
Draft: Vuex store refactoring suggestions
,
!225
Draft: Resolve "[Refactoring] Improve vuex store usage"
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
store/appbar.ts
+10
-3
10 additions, 3 deletions
store/appbar.ts
store/contacts.ts
+14
-4
14 additions, 4 deletions
store/contacts.ts
store/files.ts
+1
-0
1 addition, 0 deletions
store/files.ts
store/snackbar.ts
+8
-2
8 additions, 2 deletions
store/snackbar.ts
with
33 additions
and
9 deletions
store/appbar.ts
+
10
−
3
View file @
1a4260c5
...
@@ -47,7 +47,7 @@ export interface IAppbarStore {
...
@@ -47,7 +47,7 @@ export interface IAppbarStore {
*
*
* @return {IAppbarStore} the state object
* @return {IAppbarStore} the state object
*/
*/
export
const
state
=
():
IAppbarStore
=>
{
const
state
=
():
IAppbarStore
=>
{
return
{
return
{
activeTab
:
null
,
activeTab
:
null
,
cancelBtnDisabled
:
false
,
cancelBtnDisabled
:
false
,
...
@@ -59,7 +59,7 @@ export const state = (): IAppbarStore => {
...
@@ -59,7 +59,7 @@ export const state = (): IAppbarStore => {
}
}
}
}
export
const
mutations
=
{
const
mutations
=
{
/**
/**
* Sets the title of the AppBar
* Sets the title of the AppBar
*
*
...
@@ -141,7 +141,7 @@ type StoreContext = {
...
@@ -141,7 +141,7 @@ type StoreContext = {
dispatch
:
(
action
:
string
,
payload
:
any
)
=>
void
dispatch
:
(
action
:
string
,
payload
:
any
)
=>
void
}
}
export
const
actions
=
{
const
actions
=
{
/**
/**
* initializes the Appbar
* initializes the Appbar
*
*
...
@@ -452,3 +452,10 @@ export const actions = {
...
@@ -452,3 +452,10 @@ export const actions = {
context
.
dispatch
(
'
init
'
,
state
())
context
.
dispatch
(
'
init
'
,
state
())
}
}
}
}
export
default
{
namespaced
:
true
,
state
,
actions
,
mutations
}
This diff is collapsed.
Click to expand it.
store/contacts.ts
+
14
−
4
View file @
1a4260c5
...
@@ -46,7 +46,7 @@ interface contactsState {
...
@@ -46,7 +46,7 @@ interface contactsState {
totalPages
:
number
totalPages
:
number
}
}
export
const
state
=
()
=>
({
const
state
=
()
=>
({
contacts
:
[],
contacts
:
[],
contact
:
null
,
contact
:
null
,
configurationContacts
:
[],
configurationContacts
:
[],
...
@@ -54,7 +54,8 @@ export const state = () => ({
...
@@ -54,7 +54,8 @@ export const state = () => ({
pageNumber
:
1
,
pageNumber
:
1
,
pageSize
:
20
pageSize
:
20
})
})
export
const
getters
=
{
const
getters
=
{
searchContacts
:
(
state
:
contactsState
)
=>
{
searchContacts
:
(
state
:
contactsState
)
=>
{
return
state
.
contacts
.
filter
((
c
:
Contact
)
=>
!
state
.
configurationContacts
.
find
((
rc
:
Contact
)
=>
rc
.
id
===
c
.
id
))
return
state
.
contacts
.
filter
((
c
:
Contact
)
=>
!
state
.
configurationContacts
.
find
((
rc
:
Contact
)
=>
rc
.
id
===
c
.
id
))
},
},
...
@@ -68,7 +69,7 @@ export const getters = {
...
@@ -68,7 +69,7 @@ export const getters = {
}
}
// @ts-ignore
// @ts-ignore
export
const
actions
:
{
const
actions
:
{
[
key
:
string
]:
any
;
[
key
:
string
]:
any
;
$api
:
Api
$api
:
Api
}
=
{
}
=
{
...
@@ -126,7 +127,8 @@ export const actions: {
...
@@ -126,7 +127,8 @@ export const actions: {
return
this
.
$api
.
contacts
.
save
(
contact
)
return
this
.
$api
.
contacts
.
save
(
contact
)
}
}
}
}
export
const
mutations
=
{
const
mutations
=
{
setContacts
(
state
:
contactsState
,
contacts
:
Contact
[])
{
setContacts
(
state
:
contactsState
,
contacts
:
Contact
[])
{
state
.
contacts
=
contacts
state
.
contacts
=
contacts
},
},
...
@@ -143,3 +145,11 @@ export const mutations = {
...
@@ -143,3 +145,11 @@ export const mutations = {
state
.
totalPages
=
count
state
.
totalPages
=
count
}
}
}
}
export
default
{
namespaced
:
true
,
state
,
getters
,
actions
,
mutations
}
This diff is collapsed.
Click to expand it.
store/files.ts
+
1
−
0
View file @
1a4260c5
...
@@ -33,6 +33,7 @@
...
@@ -33,6 +33,7 @@
import
{
Commit
}
from
'
vuex
'
import
{
Commit
}
from
'
vuex
'
import
{
IUploadResult
}
from
'
@/services/sms/UploadApi
'
import
{
IUploadResult
}
from
'
@/services/sms/UploadApi
'
import
{
Api
}
from
'
@/services/Api
'
import
{
Api
}
from
'
@/services/Api
'
const
state
=
()
=>
({})
const
state
=
()
=>
({})
const
getters
=
{}
const
getters
=
{}
...
...
This diff is collapsed.
Click to expand it.
store/snackbar.ts
+
8
−
2
View file @
1a4260c5
...
@@ -34,14 +34,14 @@ export interface ISnackbarStore {
...
@@ -34,14 +34,14 @@ export interface ISnackbarStore {
success
:
string
success
:
string
}
}
export
const
state
=
()
=>
{
const
state
=
()
=>
{
return
{
return
{
error
:
''
,
error
:
''
,
success
:
''
success
:
''
}
}
}
}
export
const
mutations
=
{
const
mutations
=
{
setError
(
state
:
ISnackbarStore
,
error
:
string
)
{
setError
(
state
:
ISnackbarStore
,
error
:
string
)
{
state
.
error
=
error
state
.
error
=
error
},
},
...
@@ -55,3 +55,9 @@ export const mutations = {
...
@@ -55,3 +55,9 @@ export const mutations = {
state
.
success
=
''
state
.
success
=
''
}
}
}
}
export
default
{
namespaced
:
true
,
state
,
mutations
}
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