mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core&ui: move domain_delete to domain_dashboard page
This commit is contained in:
3 files changed
+24
-22
No files matched your search
@@ -99,14 +99,6 @@ class DomainEditHandler extends ManageHandler {
|
|||||||
await domain.edit(args.domainId, $set);
|
await domain.edit(args.domainId, $set);
|
||||||
this.response.redirect = this.url('domain_dashboard');
|
this.response.redirect = this.url('domain_dashboard');
|
||||||
}
|
}
|
||||||
|
|
||||||
@requireSudo
|
|
||||||
async postDelete({ domainId }) {
|
|
||||||
if (domainId === 'system') throw new CannotDeleteSystemDomainError();
|
|
||||||
if (this.domain.owner !== this.user._id) throw new OnlyOwnerCanDeleteDomainError();
|
|
||||||
await domain.del(domainId);
|
|
||||||
this.response.redirect = this.url('home_domain', { domainId: 'system' });
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class DomainDashboardHandler extends ManageHandler {
|
class DomainDashboardHandler extends ManageHandler {
|
||||||
@@ -129,6 +121,14 @@ class DomainDashboardHandler extends ManageHandler {
|
|||||||
}
|
}
|
||||||
this.back();
|
this.back();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@requireSudo
|
||||||
|
async postDelete({ domainId }) {
|
||||||
|
if (domainId === 'system') throw new CannotDeleteSystemDomainError();
|
||||||
|
if (this.domain.owner !== this.user._id) throw new OnlyOwnerCanDeleteDomainError();
|
||||||
|
await domain.del(domainId);
|
||||||
|
this.response.redirect = this.url('home_domain', { domainId: 'system' });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class DomainUserHandler extends ManageHandler {
|
class DomainUserHandler extends ManageHandler {
|
||||||
|
|||||||
@@ -26,4 +26,20 @@
|
|||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{% if handler.user._id == owner._id %}
|
||||||
|
<div class="section">
|
||||||
|
<div class="section__header">
|
||||||
|
<h1 class="section__title" data-heading>{{ _('Delete Domain') }}</h1>
|
||||||
|
<div class="section__tools">
|
||||||
|
<form method="POST">
|
||||||
|
<div>
|
||||||
|
<input type="hidden" name="operation" value="delete">
|
||||||
|
<input type="submit" value="{{ _('Delete Domain') }}" class="rounded primary button">
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="section__body"></div>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
@@ -3,18 +3,4 @@
|
|||||||
<div class="section">
|
<div class="section">
|
||||||
{% include "partials/setting.html" %}
|
{% include "partials/setting.html" %}
|
||||||
</div>
|
</div>
|
||||||
<div class="section">
|
|
||||||
<div class="section__header">
|
|
||||||
<h1 class="section__title" data-heading>{{ _('Delete Domain') }}</h1>
|
|
||||||
<div class="section__tools">
|
|
||||||
<form method="POST">
|
|
||||||
<div>
|
|
||||||
<input type="hidden" name="operation" value="delete">
|
|
||||||
<input type="submit" value="{{ _('Delete Domain') }}" class="rounded primary button">
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="section__body"></div>
|
|
||||||
</div>
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
Reference in new issue
Block a user