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
06bb4eba
Commit
06bb4eba
authored
Mar 10, 2020
by
GitLab Bot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add latest changes from gitlab-org/gitlab@master
parent
219eead2
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
144 additions
and
104 deletions
+144
-104
app/assets/javascripts/confirm_modal.js
app/assets/javascripts/confirm_modal.js
+1
-32
app/assets/javascripts/editor/editor_lite.js
app/assets/javascripts/editor/editor_lite.js
+1
-0
app/assets/javascripts/vue_shared/components/confirm_modal.vue
...ssets/javascripts/vue_shared/components/confirm_modal.vue
+27
-31
app/assets/stylesheets/framework.scss
app/assets/stylesheets/framework.scss
+1
-0
app/assets/stylesheets/framework/editor-lite.scss
app/assets/stylesheets/framework/editor-lite.scss
+5
-0
app/controllers/dashboard/projects_controller.rb
app/controllers/dashboard/projects_controller.rb
+2
-3
changelogs/unreleased/fix-missing-rss-feed-events.yml
changelogs/unreleased/fix-missing-rss-feed-events.yml
+5
-0
doc/user/clusters/applications.md
doc/user/clusters/applications.md
+1
-1
spec/controllers/dashboard/projects_controller_spec.rb
spec/controllers/dashboard/projects_controller_spec.rb
+49
-2
spec/frontend/confirm_modal_spec.js
spec/frontend/confirm_modal_spec.js
+3
-4
spec/frontend/vue_shared/components/confirm_modal_spec.js
spec/frontend/vue_shared/components/confirm_modal_spec.js
+49
-31
No files found.
app/assets/javascripts/confirm_modal.js
View file @
06bb4eba
...
...
@@ -3,40 +3,9 @@ import ConfirmModal from '~/vue_shared/components/confirm_modal.vue';
const
mountConfirmModal
=
()
=>
{
return
new
Vue
({
data
()
{
return
{
path
:
''
,
method
:
''
,
modalAttributes
:
null
,
showModal
:
false
,
};
},
mounted
()
{
document
.
querySelectorAll
(
'
.js-confirm-modal-button
'
).
forEach
(
button
=>
{
button
.
addEventListener
(
'
click
'
,
e
=>
{
e
.
preventDefault
();
this
.
path
=
button
.
dataset
.
path
;
this
.
method
=
button
.
dataset
.
method
;
this
.
modalAttributes
=
JSON
.
parse
(
button
.
dataset
.
modalAttributes
);
this
.
showModal
=
true
;
});
});
},
methods
:
{
dismiss
()
{
this
.
showModal
=
false
;
},
},
render
(
h
)
{
return
h
(
ConfirmModal
,
{
props
:
{
path
:
this
.
path
,
method
:
this
.
method
,
modalAttributes
:
this
.
modalAttributes
,
showModal
:
this
.
showModal
,
},
on
:
{
dismiss
:
this
.
dismiss
},
props
:
{
selector
:
'
.js-confirm-modal-button
'
},
});
},
}).
$mount
();
...
...
app/assets/javascripts/editor/editor_lite.js
View file @
06bb4eba
...
...
@@ -11,6 +11,7 @@ export default class Editor {
this
.
instance
=
null
;
this
.
model
=
null
;
this
.
options
=
{
extraEditorClassName
:
'
gl-editor-lite
'
,
...
defaultEditorOptions
,
...
options
,
};
...
...
app/assets/javascripts/vue_shared/components/confirm_modal.vue
View file @
06bb4eba
<
script
>
import
{
GlModal
}
from
'
@gitlab/ui
'
;
import
csrf
from
'
~/lib/utils/csrf
'
;
import
{
uniqueId
}
from
'
lodash
'
;
export
default
{
components
:
{
GlModal
,
},
props
:
{
modalAttributes
:
{
type
:
Object
,
required
:
false
,
default
:
()
=>
{
return
{};
},
},
path
:
{
type
:
String
,
required
:
false
,
default
:
''
,
},
method
:
{
selector
:
{
type
:
String
,
required
:
false
,
default
:
''
,
},
showModal
:
{
type
:
Boolean
,
required
:
false
,
default
:
false
,
required
:
true
,
},
},
watch
:
{
showModal
(
val
)
{
if
(
val
)
{
// Wait for v-if to render
this
.
$nextTick
(()
=>
{
this
.
openModal
();
});
}
},
data
()
{
return
{
modalId
:
uniqueId
(
'
confirm-modal-
'
),
path
:
''
,
method
:
''
,
modalAttributes
:
{},
};
},
mounted
()
{
document
.
querySelectorAll
(
this
.
selector
).
forEach
(
button
=>
{
button
.
addEventListener
(
'
click
'
,
e
=>
{
e
.
preventDefault
();
this
.
path
=
button
.
dataset
.
path
;
this
.
method
=
button
.
dataset
.
method
;
this
.
modalAttributes
=
JSON
.
parse
(
button
.
dataset
.
modalAttributes
);
this
.
openModal
();
});
});
},
methods
:
{
openModal
()
{
this
.
$refs
.
modal
.
show
();
},
closeModal
()
{
this
.
$refs
.
modal
.
hide
();
},
submitModal
()
{
this
.
$refs
.
form
.
submit
();
},
...
...
@@ -54,11 +50,11 @@ export default {
<
template
>
<gl-modal
v-if=
"showModal"
ref=
"modal"
:modal-id=
"modalId"
v-bind=
"modalAttributes"
@
primary=
"submitModal"
@
cancel
ed=
"$emit('dismiss')
"
@
cancel
=
"closeModal
"
>
<form
ref=
"form"
:action=
"path"
method=
"post"
>
<!-- Rails workaround for
<form
method=
"delete"
/>
...
...
app/assets/stylesheets/framework.scss
View file @
06bb4eba
...
...
@@ -70,3 +70,4 @@
@import
'framework/system_messages'
;
@import
"framework/spinner"
;
@import
'framework/card'
;
@import
'framework/editor-lite'
;
app/assets/stylesheets/framework/editor-lite.scss
0 → 100644
View file @
06bb4eba
.monaco-editor.gl-editor-lite
{
.line-numbers
{
@include
gl-pt-0
;
}
}
app/controllers/dashboard/projects_controller.rb
View file @
06bb4eba
...
...
@@ -33,7 +33,7 @@ class Dashboard::ProjectsController < Dashboard::ApplicationController
# rubocop: disable CodeReuse/ActiveRecord
def
starred
@projects
=
load_projects
(
params
.
merge
(
starred:
true
))
.
includes
(
:forked_from_project
,
:tags
)
.
includes
(
:forked_from_project
,
:tags
)
.
page
(
params
[
:page
])
@groups
=
[]
...
...
@@ -51,7 +51,7 @@ class Dashboard::ProjectsController < Dashboard::ApplicationController
private
def
projects
@projects
||=
load_projects
(
params
.
merge
(
non_public:
true
))
@projects
||=
load_projects
(
params
.
merge
(
non_public:
true
))
.
page
(
params
[
:page
])
end
def
render_projects
...
...
@@ -73,7 +73,6 @@ class Dashboard::ProjectsController < Dashboard::ApplicationController
.
execute
.
includes
(
:route
,
:creator
,
:group
,
namespace:
[
:route
,
:owner
])
.
preload
(
:project_feature
)
.
page
(
finder_params
[
:page
])
prepare_projects_for_rendering
(
projects
)
end
...
...
changelogs/unreleased/fix-missing-rss-feed-events.yml
0 → 100644
View file @
06bb4eba
---
title
:
Fix missing RSS feed events
merge_request
:
19524
author
:
type
:
fixed
doc/user/clusters/applications.md
View file @
06bb4eba
...
...
@@ -680,7 +680,7 @@ available configuration options.
[
Cilium
](
https://cilium.io/
)
is a networking plugin for Kubernetes
that you can use to implement support for
[
NetworkPolicy
](
https://kubernetes.io/docs/concepts/services-networking/network-policies/
)
resources.
resources.
For more information on
[
Network Policies
](
../../topics/autodevops/index.md#network-policy
)
, see the documentation.
Enable Cilium in the
`.gitlab/managed-apps/config.yaml`
file to install it:
...
...
spec/controllers/dashboard/projects_controller_spec.rb
View file @
06bb4eba
...
...
@@ -86,11 +86,58 @@ describe Dashboard::ProjectsController do
end
describe
'GET /starred.json'
do
subject
{
get
:starred
,
format: :json
}
let
(
:projects
)
{
create_list
(
:project
,
2
,
creator:
user
)
}
before
do
get
:starred
,
format: :json
allow
(
Kaminari
.
config
).
to
receive
(
:default_per_page
).
and_return
(
1
)
projects
.
each
do
|
project
|
project
.
add_developer
(
user
)
create
(
:users_star_project
,
project_id:
project
.
id
,
user_id:
user
.
id
)
end
end
it
{
is_expected
.
to
respond_with
(
:success
)
}
it
'returns success'
do
subject
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
it
'paginates the records'
do
subject
expect
(
assigns
(
:projects
).
count
).
to
eq
(
1
)
end
end
end
context
'atom requests'
do
let
(
:user
)
{
create
(
:user
)
}
before
do
sign_in
(
user
)
end
describe
'#index'
do
context
'project pagination'
do
let
(
:projects
)
{
create_list
(
:project
,
2
,
creator:
user
)
}
before
do
allow
(
Kaminari
.
config
).
to
receive
(
:default_per_page
).
and_return
(
1
)
projects
.
each
do
|
project
|
project
.
add_developer
(
user
)
end
end
it
'does not paginate projects, even if page number is passed'
do
get
:index
,
format: :atom
expect
(
assigns
(
:events
).
count
).
to
eq
(
2
)
end
end
end
end
end
spec/frontend/confirm_modal_spec.js
View file @
06bb4eba
...
...
@@ -8,7 +8,6 @@ describe('ConfirmModal', () => {
path
:
`
${
TEST_HOST
}
/1`
,
method
:
'
delete
'
,
modalAttributes
:
{
modalId
:
'
geo-entry-removal-modal
'
,
title
:
'
Remove tracking database entry
'
,
message
:
'
Tracking database entry will be removed. Are you sure?
'
,
okVariant
:
'
danger
'
,
...
...
@@ -19,7 +18,6 @@ describe('ConfirmModal', () => {
path
:
`
${
TEST_HOST
}
/1`
,
method
:
'
post
'
,
modalAttributes
:
{
modalId
:
'
geo-entry-removal-modal
'
,
title
:
'
Update tracking database entry
'
,
message
:
'
Tracking database entry will be updated. Are you sure?
'
,
okVariant
:
'
success
'
,
...
...
@@ -53,6 +51,7 @@ describe('ConfirmModal', () => {
const
findModalOkButton
=
(
modal
,
variant
)
=>
modal
.
querySelector
(
`.modal-footer .btn-
${
variant
}
`
);
const
findModalCancelButton
=
modal
=>
modal
.
querySelector
(
'
.modal-footer .btn-secondary
'
);
const
modalIsHidden
=
()
=>
findModal
().
getAttribute
(
'
aria-hidden
'
)
===
'
true
'
;
const
serializeModal
=
(
modal
,
buttonIndex
)
=>
{
const
{
modalAttributes
}
=
buttons
[
buttonIndex
];
...
...
@@ -61,7 +60,6 @@ describe('ConfirmModal', () => {
path
:
modal
.
querySelector
(
'
form
'
).
action
,
method
:
modal
.
querySelector
(
'
input[name="_method"]
'
).
value
,
modalAttributes
:
{
modalId
:
modal
.
id
,
title
:
modal
.
querySelector
(
'
.modal-title
'
).
innerHTML
,
message
:
modal
.
querySelector
(
'
.modal-body div
'
).
innerHTML
,
okVariant
:
[...
findModalOkButton
(
modal
,
modalAttributes
.
okVariant
).
classList
]
...
...
@@ -92,6 +90,7 @@ describe('ConfirmModal', () => {
describe
(
'
GlModal
'
,
()
=>
{
it
(
'
is rendered
'
,
()
=>
{
expect
(
findModal
()).
toExist
();
expect
(
modalIsHidden
()).
toBe
(
false
);
});
describe
(
'
Cancel Button
'
,
()
=>
{
...
...
@@ -102,7 +101,7 @@ describe('ConfirmModal', () => {
});
it
(
'
closes the modal
'
,
()
=>
{
expect
(
findModal
()).
not
.
toExist
(
);
expect
(
modalIsHidden
()).
toBe
(
true
);
});
});
});
...
...
spec/frontend/vue_shared/components/confirm_modal_spec.js
View file @
06bb4eba
...
...
@@ -6,11 +6,10 @@ import ConfirmModal from '~/vue_shared/components/confirm_modal.vue';
jest
.
mock
(
'
~/lib/utils/csrf
'
,
()
=>
({
token
:
'
test-csrf-token
'
}));
describe
(
'
vue_shared/components/confirm_modal
'
,
()
=>
{
const
testModalProps
=
{
const
MOCK_MODAL_DATA
=
{
path
:
`
${
TEST_HOST
}
/1`
,
method
:
'
delete
'
,
modalAttributes
:
{
modalId
:
'
test-confirm-modal
'
,
title
:
'
Are you sure?
'
,
message
:
'
This will remove item 1
'
,
okVariant
:
'
danger
'
,
...
...
@@ -18,8 +17,13 @@ describe('vue_shared/components/confirm_modal', () => {
},
};
const
defaultProps
=
{
selector
:
'
.test-button
'
,
};
const
actionSpies
=
{
openModal
:
jest
.
fn
(),
closeModal
:
jest
.
fn
(),
};
let
wrapper
;
...
...
@@ -27,7 +31,7 @@ describe('vue_shared/components/confirm_modal', () => {
const
createComponent
=
(
props
=
{})
=>
{
wrapper
=
shallowMount
(
ConfirmModal
,
{
propsData
:
{
...
testModal
Props
,
...
default
Props
,
...
props
,
},
methods
:
{
...
...
@@ -48,28 +52,18 @@ describe('vue_shared/components/confirm_modal', () => {
.
wrappers
.
map
(
x
=>
({
name
:
x
.
attributes
(
'
name
'
),
value
:
x
.
attributes
(
'
value
'
)
}));
describe
(
'
template
'
,
()
=>
{
describe
(
'
when
showModal is false
'
,
()
=>
{
describe
(
'
when
modal data is set
'
,
()
=>
{
beforeEach
(()
=>
{
createComponent
();
wrapper
.
vm
.
modalAttributes
=
MOCK_MODAL_DATA
.
modalAttributes
;
});
it
(
'
does not render GlModal
'
,
()
=>
{
expect
(
findModal
().
exists
()).
toBeFalsy
();
});
});
describe
(
'
when showModal is true
'
,
()
=>
{
beforeEach
(()
=>
{
createComponent
({
showModal
:
true
});
});
it
(
'
renders GlModal
'
,
()
=>
{
it
(
'
renders GlModal wtih data
'
,
()
=>
{
expect
(
findModal
().
exists
()).
toBeTruthy
();
expect
(
findModal
().
attributes
()).
toEqual
(
expect
.
objectContaining
({
modalid
:
testModalProps
.
modalAttributes
.
modalId
,
oktitle
:
testModalProps
.
modalAttributes
.
okTitle
,
okvariant
:
testModalProps
.
modalAttributes
.
okVariant
,
oktitle
:
MOCK_MODAL_DATA
.
modalAttributes
.
okTitle
,
okvariant
:
MOCK_MODAL_DATA
.
modalAttributes
.
okVariant
,
}),
);
});
...
...
@@ -77,25 +71,49 @@ describe('vue_shared/components/confirm_modal', () => {
});
describe
(
'
methods
'
,
()
=>
{
beforeEach
(()
=>
{
createComponent
({
showModal
:
true
});
});
describe
(
'
submitModal
'
,
()
=>
{
beforeEach
(()
=>
{
createComponent
();
wrapper
.
vm
.
path
=
MOCK_MODAL_DATA
.
path
;
wrapper
.
vm
.
method
=
MOCK_MODAL_DATA
.
method
;
});
it
(
'
does not submit form
'
,
()
=>
{
expect
(
findForm
().
element
.
submit
).
not
.
toHaveBeenCalled
();
});
describe
(
'
when modal submitted
'
,
()
=>
{
beforeEach
(()
=>
{
findModal
().
vm
.
$emit
(
'
primary
'
);
});
it
(
'
does not submit form
'
,
()
=>
{
expect
(
findForm
().
element
.
submit
).
not
.
toHaveBeenCalled
();
it
(
'
submits form
'
,
()
=>
{
expect
(
findFormData
()).
toEqual
([
{
name
:
'
_method
'
,
value
:
MOCK_MODAL_DATA
.
method
},
{
name
:
'
authenticity_token
'
,
value
:
'
test-csrf-token
'
},
]);
expect
(
findForm
().
element
.
submit
).
toHaveBeenCalled
();
});
});
});
describe
(
'
when modal submitted
'
,
()
=>
{
describe
(
'
closeModal
'
,
()
=>
{
beforeEach
(()
=>
{
findModal
().
vm
.
$emit
(
'
primary
'
);
createComponent
(
);
});
it
(
'
submits form
'
,
()
=>
{
expect
(
findFormData
()).
toEqual
([
{
name
:
'
_method
'
,
value
:
testModalProps
.
method
},
{
name
:
'
authenticity_token
'
,
value
:
'
test-csrf-token
'
},
]);
expect
(
findForm
().
element
.
submit
).
toHaveBeenCalled
();
it
(
'
does not close modal
'
,
()
=>
{
expect
(
actionSpies
.
closeModal
).
not
.
toHaveBeenCalled
();
});
describe
(
'
when modal closed
'
,
()
=>
{
beforeEach
(()
=>
{
findModal
().
vm
.
$emit
(
'
cancel
'
);
});
it
(
'
closes modal
'
,
()
=>
{
expect
(
actionSpies
.
closeModal
).
toHaveBeenCalled
();
});
});
});
});
...
...
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