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
004dbe1c
Commit
004dbe1c
authored
Feb 24, 2020
by
Alishan Ladhani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add ability to delete a serverless domain
- Create route for destroy - Create destroy action
parent
2d242119
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
71 additions
and
2 deletions
+71
-2
app/controllers/admin/serverless/domains_controller.rb
app/controllers/admin/serverless/domains_controller.rb
+9
-1
config/routes/admin.rb
config/routes/admin.rb
+1
-1
locale/gitlab.pot
locale/gitlab.pot
+3
-0
spec/controllers/admin/serverless/domains_controller_spec.rb
spec/controllers/admin/serverless/domains_controller_spec.rb
+58
-0
No files found.
app/controllers/admin/serverless/domains_controller.rb
View file @
004dbe1c
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
class
Admin::Serverless::DomainsController
<
Admin
::
ApplicationController
class
Admin::Serverless::DomainsController
<
Admin
::
ApplicationController
before_action
:check_feature_flag
before_action
:check_feature_flag
before_action
:domain
,
only:
[
:update
,
:verify
]
before_action
:domain
,
only:
[
:update
,
:verify
,
:destroy
]
def
index
def
index
@domain
=
PagesDomain
.
instance_serverless
.
first_or_initialize
@domain
=
PagesDomain
.
instance_serverless
.
first_or_initialize
...
@@ -30,6 +30,14 @@ class Admin::Serverless::DomainsController < Admin::ApplicationController
...
@@ -30,6 +30,14 @@ class Admin::Serverless::DomainsController < Admin::ApplicationController
end
end
end
end
def
destroy
domain
.
destroy!
redirect_to
admin_serverless_domains_path
,
status: :found
,
notice:
_
(
'Domain was successfully deleted.'
)
end
def
verify
def
verify
result
=
VerifyPagesDomainService
.
new
(
domain
).
execute
result
=
VerifyPagesDomainService
.
new
(
domain
).
execute
...
...
config/routes/admin.rb
View file @
004dbe1c
...
@@ -33,7 +33,7 @@ namespace :admin do
...
@@ -33,7 +33,7 @@ namespace :admin do
resources
:gitaly_servers
,
only:
[
:index
]
resources
:gitaly_servers
,
only:
[
:index
]
namespace
:serverless
do
namespace
:serverless
do
resources
:domains
,
only:
[
:index
,
:create
,
:update
]
do
resources
:domains
,
only:
[
:index
,
:create
,
:update
,
:destroy
]
do
member
do
member
do
post
'/verify'
,
to:
'domains#verify'
post
'/verify'
,
to:
'domains#verify'
end
end
...
...
locale/gitlab.pot
View file @
004dbe1c
...
@@ -6886,6 +6886,9 @@ msgstr ""
...
@@ -6886,6 +6886,9 @@ msgstr ""
msgid "Domain was successfully created."
msgid "Domain was successfully created."
msgstr ""
msgstr ""
msgid "Domain was successfully deleted."
msgstr ""
msgid "Domain was successfully updated."
msgid "Domain was successfully updated."
msgstr ""
msgstr ""
...
...
spec/controllers/admin/serverless/domains_controller_spec.rb
View file @
004dbe1c
...
@@ -295,4 +295,62 @@ describe Admin::Serverless::DomainsController do
...
@@ -295,4 +295,62 @@ describe Admin::Serverless::DomainsController do
end
end
end
end
end
end
describe
'#destroy'
do
let!
(
:domain
)
{
create
(
:pages_domain
,
:instance_serverless
)
}
context
'non-admin user'
do
before
do
sign_in
(
user
)
end
it
'responds with 404'
do
delete
:destroy
,
params:
{
id:
domain
.
id
}
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
context
'admin user'
do
before
do
sign_in
(
admin
)
end
context
'with serverless_domain feature disabled'
do
before
do
stub_feature_flags
(
serverless_domain:
false
)
end
it
'responds with 404'
do
delete
:destroy
,
params:
{
id:
domain
.
id
}
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
context
'when domain exists'
do
context
'and is not associated to any clusters'
do
it
'deletes the domain'
do
expect
{
delete
:destroy
,
params:
{
id:
domain
.
id
}
}
.
to
change
{
PagesDomain
.
count
}.
from
(
1
).
to
(
0
)
expect
(
response
).
to
have_gitlab_http_status
(
:found
)
expect
(
flash
[
:notice
]).
to
include
(
'Domain was successfully deleted.'
)
end
end
end
context
'when domain does not exist'
do
before
do
domain
.
destroy!
end
it
'responds with 404'
do
delete
:destroy
,
params:
{
id:
domain
.
id
}
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
end
end
end
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