Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
228d6d45
Commit
228d6d45
authored
May 07, 2020
by
Fernando
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor license compliance query into constants
* Swap out hard coded strings for constsnta
parent
201d7f9a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
8 deletions
+20
-8
ee/app/assets/javascripts/license_compliance/store/modules/list/actions.js
...ascripts/license_compliance/store/modules/list/actions.js
+3
-3
ee/app/assets/javascripts/license_compliance/store/modules/list/constants.js
...cripts/license_compliance/store/modules/list/constants.js
+8
-0
ee/spec/frontend/license_compliance/store/modules/list/actions_spec.js
...end/license_compliance/store/modules/list/actions_spec.js
+9
-5
No files found.
ee/app/assets/javascripts/license_compliance/store/modules/list/actions.js
View file @
228d6d45
...
...
@@ -3,7 +3,7 @@ import axios from '~/lib/utils/axios_utils';
import
createFlash
from
'
~/flash
'
;
import
{
__
}
from
'
~/locale
'
;
import
{
FETCH_ERROR_MESSAGE
}
from
'
./constants
'
;
import
{
FETCH_ERROR_MESSAGE
,
SORT_BY
,
SORT_ORDER
}
from
'
./constants
'
;
import
*
as
types
from
'
./mutation_types
'
;
export
const
setLicensesEndpoint
=
({
commit
},
endpoint
)
=>
...
...
@@ -21,8 +21,8 @@ export const fetchLicenses = ({ state, dispatch }, params = {}) => {
params
:
{
per_page
:
10
,
page
:
state
.
pageInfo
.
page
||
1
,
sort_by
:
'
classification
'
,
sort_direction
:
'
desc
'
,
sort_by
:
SORT_BY
.
CLASSIFICATION
,
sort_direction
:
SORT_ORDER
.
DESC
,
...
params
,
},
})
...
...
ee/app/assets/javascripts/license_compliance/store/modules/list/constants.js
View file @
228d6d45
...
...
@@ -11,3 +11,11 @@ export const REPORT_STATUS = {
export
const
FETCH_ERROR_MESSAGE
=
s__
(
'
Licenses|Error fetching the license list. Please check your network connection and try again.
'
,
);
export
const
SORT_BY
=
{
CLASSIFICATION
:
'
classification
'
,
};
export
const
SORT_ORDER
=
{
DESC
:
'
desc
'
,
};
ee/spec/frontend/license_compliance/store/modules/list/actions_spec.js
View file @
228d6d45
...
...
@@ -6,7 +6,11 @@ import * as actions from 'ee/license_compliance/store/modules/list/actions';
import
*
as
types
from
'
ee/license_compliance/store/modules/list/mutation_types
'
;
import
getInitialState
from
'
ee/license_compliance/store/modules/list/state
'
;
import
{
FETCH_ERROR_MESSAGE
}
from
'
ee/license_compliance/store/modules/list/constants
'
;
import
{
FETCH_ERROR_MESSAGE
,
SORT_BY
,
SORT_ORDER
,
}
from
'
ee/license_compliance/store/modules/list/constants
'
;
import
createFlash
from
'
~/flash
'
;
import
mockLicensesResponse
from
'
./data/mock_licenses.json
'
;
...
...
@@ -141,8 +145,8 @@ describe('Licenses actions', () => {
const
paramsDefault
=
{
page
:
state
.
pageInfo
.
page
,
per_page
:
10
,
sort_by
:
'
classification
'
,
sort_direction
:
'
desc
'
,
sort_by
:
SORT_BY
.
CLASSIFICATION
,
sort_direction
:
SORT_ORDER
.
DESC
,
};
mock
...
...
@@ -176,8 +180,8 @@ describe('Licenses actions', () => {
const
paramsSent
=
{
...
paramsGiven
,
per_page
:
10
,
sort_by
:
'
classification
'
,
sort_direction
:
'
desc
'
,
sort_by
:
SORT_BY
.
CLASSIFICATION
,
sort_direction
:
SORT_ORDER
.
DESC
,
};
beforeEach
(()
=>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment