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
f4e8e16f
Commit
f4e8e16f
authored
Mar 14, 2020
by
Fernando
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor mount hooks for license compliance
Update existing tests
parent
62945ef8
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
7 additions
and
35 deletions
+7
-35
ee/app/assets/javascripts/pages/projects/settings/ci_cd/show/index.js
...s/javascripts/pages/projects/settings/ci_cd/show/index.js
+1
-0
ee/app/assets/javascripts/project_licenses/components/app.vue
...pp/assets/javascripts/project_licenses/components/app.vue
+1
-5
ee/app/assets/javascripts/project_licenses/index.js
ee/app/assets/javascripts/project_licenses/index.js
+3
-1
ee/app/assets/javascripts/vue_shared/license_management/license_management.vue
...ipts/vue_shared/license_management/license_management.vue
+1
-14
ee/spec/frontend/license_management/license_management_spec.js
...ec/frontend/license_management/license_management_spec.js
+1
-15
No files found.
ee/app/assets/javascripts/pages/projects/settings/ci_cd/show/index.js
View file @
f4e8e16f
...
...
@@ -13,6 +13,7 @@ document.addEventListener('DOMContentLoaded', () => {
if
(
el
&&
el
.
dataset
&&
el
.
dataset
.
apiUrl
)
{
const
store
=
createStore
();
store
.
dispatch
(
'
licenseManagement/setIsAdmin
'
,
Boolean
(
el
.
dataset
.
apiUrl
));
store
.
dispatch
(
'
licenseManagement/setAPISettings
'
,
{
apiUrlManageLicenses
:
el
.
dataset
.
apiUrl
});
// eslint-disable-next-line no-new
new
Vue
({
el
,
...
...
ee/app/assets/javascripts/project_licenses/components/app.vue
View file @
f4e8e16f
...
...
@@ -32,10 +32,6 @@ export default {
type
:
String
,
required
:
true
,
},
readLicensePoliciesEndpoint
:
{
type
:
String
,
required
:
true
,
},
},
data
()
{
return
{
...
...
@@ -120,7 +116,7 @@ export default {
<gl-badge
pill
>
{{
policyCount
}}
</gl-badge>
</
template
>
<license-management
:api-url=
"readLicensePoliciesEndpoint"
/>
<license-management
/>
</gl-tab>
</gl-tabs>
</template>
...
...
ee/app/assets/javascripts/project_licenses/index.js
View file @
f4e8e16f
...
...
@@ -14,6 +14,9 @@ export default () => {
}
=
el
.
dataset
;
const
store
=
createStore
();
store
.
dispatch
(
'
licenseManagement/setIsAdmin
'
,
Boolean
(
writeLicensePoliciesEndpoint
));
store
.
dispatch
(
'
licenseManagement/setAPISettings
'
,
{
apiUrlManageLicenses
:
readLicensePoliciesEndpoint
,
});
store
.
dispatch
(
`
${
LICENSE_LIST
}
/setLicensesEndpoint`
,
projectLicensesEndpoint
);
return
new
Vue
({
...
...
@@ -27,7 +30,6 @@ export default () => {
props
:
{
emptyStateSvgPath
,
documentationPath
,
readLicensePoliciesEndpoint
,
},
});
},
...
...
ee/app/assets/javascripts/vue_shared/license_management/license_management.vue
View file @
f4e8e16f
...
...
@@ -21,12 +21,6 @@ export default {
GlLoadingIcon
,
PaginatedList
,
},
props
:
{
apiUrl
:
{
type
:
String
,
required
:
true
,
},
},
data
()
{
return
{
formIsOpen
:
false
,
...
...
@@ -55,17 +49,10 @@ export default {
},
},
mounted
()
{
this
.
setAPISettings
({
apiUrlManageLicenses
:
this
.
apiUrl
,
});
this
.
fetchManagedLicenses
();
},
methods
:
{
...
mapActions
(
LICENSE_MANAGEMENT
,
[
'
fetchManagedLicenses
'
,
'
setAPISettings
'
,
'
setLicenseApproval
'
,
]),
...
mapActions
(
LICENSE_MANAGEMENT
,
[
'
fetchManagedLicenses
'
,
'
setLicenseApproval
'
]),
openAddLicenseForm
()
{
this
.
formIsOpen
=
true
;
},
...
...
ee/spec/frontend/license_management/license_management_spec.js
View file @
f4e8e16f
...
...
@@ -7,14 +7,12 @@ import AdminLicenseManagementRow from 'ee/vue_shared/license_management/componen
import
LicenseManagementRow
from
'
ee/vue_shared/license_management/components/license_management_row.vue
'
;
import
AddLicenseForm
from
'
ee/vue_shared/license_management/components/add_license_form.vue
'
;
import
DeleteConfirmationModal
from
'
ee/vue_shared/license_management/components/delete_confirmation_modal.vue
'
;
import
{
TEST_HOST
}
from
'
helpers/test_constants
'
;
import
{
approvedLicense
,
blacklistedLicense
}
from
'
./mock_data
'
;
Vue
.
use
(
Vuex
);
let
wrapper
;
const
apiUrl
=
`
${
TEST_HOST
}
/license_management`
;
const
managedLicenses
=
[
approvedLicense
,
blacklistedLicense
];
const
PaginatedListMock
=
{
...
...
@@ -50,7 +48,6 @@ const createComponent = ({ state, getters, props, actionMocks, isAdmin }) => {
},
actions
:
{
fetchManagedLicenses
:
noop
,
setAPISettings
:
noop
,
setLicenseApproval
:
noop
,
...
actionMocks
,
},
...
...
@@ -60,7 +57,6 @@ const createComponent = ({ state, getters, props, actionMocks, isAdmin }) => {
wrapper
=
shallowMount
(
LicenseManagement
,
{
propsData
:
{
apiUrl
,
...
props
,
},
stubs
:
{
...
...
@@ -106,27 +102,17 @@ describe('License Management', () => {
});
});
it
(
'
should set api settings after mount and init API calls
'
,
()
=>
{
const
setAPISettingsMock
=
jest
.
fn
();
it
(
'
should mount and fetch licenses
'
,
()
=>
{
const
fetchManagedLicensesMock
=
jest
.
fn
();
createComponent
({
state
:
{
isLoadingManagedLicenses
:
false
},
actionMocks
:
{
setAPISettings
:
setAPISettingsMock
,
fetchManagedLicenses
:
fetchManagedLicensesMock
,
},
isAdmin
,
});
expect
(
setAPISettingsMock
).
toHaveBeenCalledWith
(
expect
.
any
(
Object
),
{
apiUrlManageLicenses
:
apiUrl
,
},
undefined
,
);
expect
(
fetchManagedLicensesMock
).
toHaveBeenCalledWith
(
expect
.
any
(
Object
),
undefined
,
...
...
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