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', () => {
...
@@ -13,6 +13,7 @@ document.addEventListener('DOMContentLoaded', () => {
if
(
el
&&
el
.
dataset
&&
el
.
dataset
.
apiUrl
)
{
if
(
el
&&
el
.
dataset
&&
el
.
dataset
.
apiUrl
)
{
const
store
=
createStore
();
const
store
=
createStore
();
store
.
dispatch
(
'
licenseManagement/setIsAdmin
'
,
Boolean
(
el
.
dataset
.
apiUrl
));
store
.
dispatch
(
'
licenseManagement/setIsAdmin
'
,
Boolean
(
el
.
dataset
.
apiUrl
));
store
.
dispatch
(
'
licenseManagement/setAPISettings
'
,
{
apiUrlManageLicenses
:
el
.
dataset
.
apiUrl
});
// eslint-disable-next-line no-new
// eslint-disable-next-line no-new
new
Vue
({
new
Vue
({
el
,
el
,
...
...
ee/app/assets/javascripts/project_licenses/components/app.vue
View file @
f4e8e16f
...
@@ -32,10 +32,6 @@ export default {
...
@@ -32,10 +32,6 @@ export default {
type
:
String
,
type
:
String
,
required
:
true
,
required
:
true
,
},
},
readLicensePoliciesEndpoint
:
{
type
:
String
,
required
:
true
,
},
},
},
data
()
{
data
()
{
return
{
return
{
...
@@ -120,7 +116,7 @@ export default {
...
@@ -120,7 +116,7 @@ export default {
<gl-badge
pill
>
{{
policyCount
}}
</gl-badge>
<gl-badge
pill
>
{{
policyCount
}}
</gl-badge>
</
template
>
</
template
>
<license-management
:api-url=
"readLicensePoliciesEndpoint"
/>
<license-management
/>
</gl-tab>
</gl-tab>
</gl-tabs>
</gl-tabs>
</template>
</template>
...
...
ee/app/assets/javascripts/project_licenses/index.js
View file @
f4e8e16f
...
@@ -14,6 +14,9 @@ export default () => {
...
@@ -14,6 +14,9 @@ export default () => {
}
=
el
.
dataset
;
}
=
el
.
dataset
;
const
store
=
createStore
();
const
store
=
createStore
();
store
.
dispatch
(
'
licenseManagement/setIsAdmin
'
,
Boolean
(
writeLicensePoliciesEndpoint
));
store
.
dispatch
(
'
licenseManagement/setIsAdmin
'
,
Boolean
(
writeLicensePoliciesEndpoint
));
store
.
dispatch
(
'
licenseManagement/setAPISettings
'
,
{
apiUrlManageLicenses
:
readLicensePoliciesEndpoint
,
});
store
.
dispatch
(
`
${
LICENSE_LIST
}
/setLicensesEndpoint`
,
projectLicensesEndpoint
);
store
.
dispatch
(
`
${
LICENSE_LIST
}
/setLicensesEndpoint`
,
projectLicensesEndpoint
);
return
new
Vue
({
return
new
Vue
({
...
@@ -27,7 +30,6 @@ export default () => {
...
@@ -27,7 +30,6 @@ export default () => {
props
:
{
props
:
{
emptyStateSvgPath
,
emptyStateSvgPath
,
documentationPath
,
documentationPath
,
readLicensePoliciesEndpoint
,
},
},
});
});
},
},
...
...
ee/app/assets/javascripts/vue_shared/license_management/license_management.vue
View file @
f4e8e16f
...
@@ -21,12 +21,6 @@ export default {
...
@@ -21,12 +21,6 @@ export default {
GlLoadingIcon
,
GlLoadingIcon
,
PaginatedList
,
PaginatedList
,
},
},
props
:
{
apiUrl
:
{
type
:
String
,
required
:
true
,
},
},
data
()
{
data
()
{
return
{
return
{
formIsOpen
:
false
,
formIsOpen
:
false
,
...
@@ -55,17 +49,10 @@ export default {
...
@@ -55,17 +49,10 @@ export default {
},
},
},
},
mounted
()
{
mounted
()
{
this
.
setAPISettings
({
apiUrlManageLicenses
:
this
.
apiUrl
,
});
this
.
fetchManagedLicenses
();
this
.
fetchManagedLicenses
();
},
},
methods
:
{
methods
:
{
...
mapActions
(
LICENSE_MANAGEMENT
,
[
...
mapActions
(
LICENSE_MANAGEMENT
,
[
'
fetchManagedLicenses
'
,
'
setLicenseApproval
'
]),
'
fetchManagedLicenses
'
,
'
setAPISettings
'
,
'
setLicenseApproval
'
,
]),
openAddLicenseForm
()
{
openAddLicenseForm
()
{
this
.
formIsOpen
=
true
;
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
...
@@ -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
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
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
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
'
;
import
{
approvedLicense
,
blacklistedLicense
}
from
'
./mock_data
'
;
Vue
.
use
(
Vuex
);
Vue
.
use
(
Vuex
);
let
wrapper
;
let
wrapper
;
const
apiUrl
=
`
${
TEST_HOST
}
/license_management`
;
const
managedLicenses
=
[
approvedLicense
,
blacklistedLicense
];
const
managedLicenses
=
[
approvedLicense
,
blacklistedLicense
];
const
PaginatedListMock
=
{
const
PaginatedListMock
=
{
...
@@ -50,7 +48,6 @@ const createComponent = ({ state, getters, props, actionMocks, isAdmin }) => {
...
@@ -50,7 +48,6 @@ const createComponent = ({ state, getters, props, actionMocks, isAdmin }) => {
},
},
actions
:
{
actions
:
{
fetchManagedLicenses
:
noop
,
fetchManagedLicenses
:
noop
,
setAPISettings
:
noop
,
setLicenseApproval
:
noop
,
setLicenseApproval
:
noop
,
...
actionMocks
,
...
actionMocks
,
},
},
...
@@ -60,7 +57,6 @@ const createComponent = ({ state, getters, props, actionMocks, isAdmin }) => {
...
@@ -60,7 +57,6 @@ const createComponent = ({ state, getters, props, actionMocks, isAdmin }) => {
wrapper
=
shallowMount
(
LicenseManagement
,
{
wrapper
=
shallowMount
(
LicenseManagement
,
{
propsData
:
{
propsData
:
{
apiUrl
,
...
props
,
...
props
,
},
},
stubs
:
{
stubs
:
{
...
@@ -106,27 +102,17 @@ describe('License Management', () => {
...
@@ -106,27 +102,17 @@ describe('License Management', () => {
});
});
});
});
it
(
'
should set api settings after mount and init API calls
'
,
()
=>
{
it
(
'
should mount and fetch licenses
'
,
()
=>
{
const
setAPISettingsMock
=
jest
.
fn
();
const
fetchManagedLicensesMock
=
jest
.
fn
();
const
fetchManagedLicensesMock
=
jest
.
fn
();
createComponent
({
createComponent
({
state
:
{
isLoadingManagedLicenses
:
false
},
state
:
{
isLoadingManagedLicenses
:
false
},
actionMocks
:
{
actionMocks
:
{
setAPISettings
:
setAPISettingsMock
,
fetchManagedLicenses
:
fetchManagedLicensesMock
,
fetchManagedLicenses
:
fetchManagedLicensesMock
,
},
},
isAdmin
,
isAdmin
,
});
});
expect
(
setAPISettingsMock
).
toHaveBeenCalledWith
(
expect
.
any
(
Object
),
{
apiUrlManageLicenses
:
apiUrl
,
},
undefined
,
);
expect
(
fetchManagedLicensesMock
).
toHaveBeenCalledWith
(
expect
(
fetchManagedLicensesMock
).
toHaveBeenCalledWith
(
expect
.
any
(
Object
),
expect
.
any
(
Object
),
undefined
,
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