Able to list records from abstract services
This commit is contained in:
parent
9aa57bcae3
commit
12d9acd368
|
@ -198,11 +198,11 @@ func axfrDomain(opts *config.Options, req *RequestResources, body io.Reader) Res
|
|||
}
|
||||
}
|
||||
|
||||
var ret []map[string]interface{}
|
||||
var ret []serviceRecord
|
||||
for _, rr := range rrs {
|
||||
ret = append(ret, map[string]interface{}{
|
||||
"string": rr.String(),
|
||||
"fields": rr,
|
||||
ret = append(ret, serviceRecord{
|
||||
String: rr.String(),
|
||||
Fields: &rr,
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -247,8 +247,9 @@ func addRR(opts *config.Options, req *RequestResources, body io.Reader) Response
|
|||
}
|
||||
|
||||
return APIResponse{
|
||||
response: map[string]interface{}{
|
||||
"string": rr.String(),
|
||||
response: serviceRecord{
|
||||
String: rr.String(),
|
||||
Fields: &rr,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
20
api/zones.go
20
api/zones.go
|
@ -456,6 +456,11 @@ func deleteZoneService(opts *config.Options, req *RequestResources, body io.Read
|
|||
}
|
||||
}
|
||||
|
||||
type serviceRecord struct {
|
||||
String string `json:"string"`
|
||||
Fields *dns.RR `json:"fields,omitempty"`
|
||||
}
|
||||
|
||||
func getServiceRecords(opts *config.Options, req *RequestResources, body io.Reader) Response {
|
||||
serviceid, err := hex.DecodeString(req.Ps.ByName("serviceid"))
|
||||
if err != nil {
|
||||
|
@ -471,7 +476,20 @@ func getServiceRecords(opts *config.Options, req *RequestResources, body io.Read
|
|||
}
|
||||
}
|
||||
|
||||
subdomain := req.Ps.ByName("subdomain")
|
||||
if subdomain == "" {
|
||||
subdomain = "@"
|
||||
}
|
||||
|
||||
var ret []serviceRecord
|
||||
for _, rr := range svc.GenRRs(subdomain, 3600, req.Domain.DomainName) {
|
||||
ret = append(ret, serviceRecord{
|
||||
String: rr.String(),
|
||||
Fields: &rr,
|
||||
})
|
||||
}
|
||||
|
||||
return APIResponse{
|
||||
response: svc.GenRRs(req.Ps.ByName("subdomain"), 3600, req.Domain.DomainName),
|
||||
response: ret,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,8 +32,8 @@
|
|||
-->
|
||||
|
||||
<template>
|
||||
<component :is="displayCard ? 'b-card' : 'b-list-group'" :class="displayCard ? 'card-hover' : ''" :style="displayCard ? 'width: 32%; min-width: 225px; margin-bottom: 1em; cursor: pointer;' : ''" no-body>
|
||||
<b-card-body v-if="displayCard" @click="$emit('showServiceWindow', service)">
|
||||
<component :is="displayFormat === 'grid' ? 'b-card' : 'b-list-group'" :class="displayFormat !== 'list' ? 'card-hover' : ''" :style="displayFormat === 'grid' ? 'width: 32%; min-width: 225px; margin-bottom: 1em; cursor: pointer;' : displayFormat === 'records' ? 'margin-bottom: .5em; cursor: pointer;' : ''" no-body>
|
||||
<b-card-body v-if="displayFormat === 'grid'" @click="$emit('showServiceWindow', service)">
|
||||
<b-badge v-for="(categorie, idcat) in services[service._svctype].categories" :key="idcat" variant="gray" class="float-right ml-1">
|
||||
{{ categorie }}
|
||||
</b-badge>
|
||||
|
@ -47,7 +47,8 @@
|
|||
<span v-if="service._comment">{{ service._comment }}</span>
|
||||
</b-card-text>
|
||||
</b-card-body>
|
||||
<b-list-group-item v-else button @click="toogleShowDetails()">
|
||||
|
||||
<b-list-group-item v-else-if="displayFormat === 'list'" button @click="toogleShowDetails()">
|
||||
<strong :title="services[service._svctype].description">{{ services[service._svctype].name }}</strong> <span v-if="service._comment" class="text-muted">{{ service._comment }}</span>
|
||||
<span v-if="services[service._svctype].comment" class="text-muted">{{ services[service._svctype].comment }}</span>
|
||||
<b-badge v-for="(categorie, idcat) in services[service._svctype].categories" :key="idcat" variant="gray" class="float-right ml-1">
|
||||
|
@ -57,21 +58,39 @@
|
|||
<b-list-group-item v-if="showDetails">
|
||||
<h-editable-service edit-toolbar :origin="origin" :service="service" :services="services" :zone-id="zoneId" @updateMyServices="$emit('updateMyServices', $event)" />
|
||||
</b-list-group-item>
|
||||
|
||||
<b-list-group-item v-else-if="displayFormat === 'records'" @click="$emit('showServiceWindow', service)">
|
||||
<strong :title="services[service._svctype].description">{{ services[service._svctype].name }}</strong> <span v-if="service._comment" class="text-muted">{{ service._comment }}</span>
|
||||
<span v-if="services[service._svctype].comment" class="text-muted">{{ services[service._svctype].comment }}</span>
|
||||
<b-badge v-for="(categorie, idcat) in services[service._svctype].categories" :key="idcat" variant="gray" class="float-right ml-1">
|
||||
{{ categorie }}
|
||||
</b-badge>
|
||||
</b-list-group-item>
|
||||
<b-list-group-item v-if="displayFormat === 'records' && serviceRecords" class="p-0">
|
||||
<table class="table table-hover table-bordered table-striped table-sm m-0">
|
||||
<tbody>
|
||||
<h-record v-for="(rr, irr) in serviceRecords" :key="irr" :record="rr" />
|
||||
</tbody>
|
||||
</table>
|
||||
</b-list-group-item>
|
||||
</component>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import ZoneApi from '@/services/ZoneApi'
|
||||
|
||||
export default {
|
||||
name: 'HDomainService',
|
||||
|
||||
components: {
|
||||
hEditableService: () => import('@/components/hEditableService')
|
||||
hEditableService: () => import('@/components/hEditableService'),
|
||||
hRecord: () => import('@/components/hRecord')
|
||||
},
|
||||
|
||||
props: {
|
||||
displayCard: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
displayFormat: {
|
||||
type: String,
|
||||
default: 'grid'
|
||||
},
|
||||
origin: {
|
||||
type: String,
|
||||
|
@ -93,11 +112,33 @@ export default {
|
|||
|
||||
data: function () {
|
||||
return {
|
||||
serviceRecords: null,
|
||||
showDetails: false
|
||||
}
|
||||
},
|
||||
|
||||
watch: {
|
||||
displayFormat: function (df) {
|
||||
if (df === 'records' && !this.serviceRecords) {
|
||||
this.getServiceRecords()
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
mounted () {
|
||||
if (this.displayFormat === 'records') {
|
||||
this.getServiceRecords()
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
getServiceRecords () {
|
||||
ZoneApi.getServiceRecords(this.origin, this.zoneId, this.service)
|
||||
.then(response => {
|
||||
this.serviceRecords = response.data
|
||||
})
|
||||
},
|
||||
|
||||
toogleShowDetails () {
|
||||
this.showDetails = !this.showDetails
|
||||
}
|
||||
|
|
|
@ -105,7 +105,7 @@ export default {
|
|||
methods: {
|
||||
toogleRR () {
|
||||
this.expand = !this.expand
|
||||
},
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -85,8 +85,8 @@
|
|||
{{ $t('domains.add-a-subdomain') }}
|
||||
</b-button>
|
||||
</h2>
|
||||
<div v-show="showResources" :class="showResources && displayCard ? 'd-flex justify-content-around flex-wrap' : ''">
|
||||
<h-domain-service v-for="(svc, idx) in zoneServices" :key="idx" :display-card="displayCard" :origin="origin" :service="svc" :services="services" :zone-id="zoneId" @showServiceWindow="$emit('showServiceWindow', $event)" @updateMyServices="$emit('updateMyServices', $event)" />
|
||||
<div v-show="showResources" :class="showResources && displayFormat === 'grid' ? 'd-flex justify-content-around flex-wrap' : ''">
|
||||
<h-domain-service v-for="(svc, idx) in zoneServices" :key="idx" :display-format="displayFormat" :origin="origin" :service="svc" :services="services" :zone-id="zoneId" @showServiceWindow="$emit('showServiceWindow', $event)" @updateMyServices="$emit('updateMyServices', $event)" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -107,9 +107,9 @@ export default {
|
|||
type: Array,
|
||||
required: true
|
||||
},
|
||||
displayCard: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
displayFormat: {
|
||||
type: String,
|
||||
default: 'grid'
|
||||
},
|
||||
dn: {
|
||||
type: String,
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
<template>
|
||||
<div v-if="!isLoading" class="pt-3">
|
||||
<h-subdomain-item v-for="(dn, index) in sortedDomains" :key="index" :display-card="displayCard" :dn="dn" :origin="domain.domain" :services="services" :zone-services="myServices.services[dn]===undefined?[]:myServices.services[dn]" :aliases="aliases[dn]===undefined?[]:aliases[dn]" :zone-id="zoneId" @showServiceWindow="showServiceWindow" @updateMyServices="updateMyServices" @addSubdomain="addSubdomain" @addNewAlias="addNewAlias" @addNewService="addNewService" />
|
||||
<h-subdomain-item v-for="(dn, index) in sortedDomains" :key="index" :display-format="displayFormat" :dn="dn" :origin="domain.domain" :services="services" :zone-services="myServices.services[dn]===undefined?[]:myServices.services[dn]" :aliases="aliases[dn]===undefined?[]:aliases[dn]" :zone-id="zoneId" @showServiceWindow="showServiceWindow" @updateMyServices="updateMyServices" @addSubdomain="addSubdomain" @addNewAlias="addNewAlias" @addNewService="addNewService" />
|
||||
|
||||
<b-modal id="modal-addSvc" :size="modal && modal.step === 2 ? 'lg' : ''" scrollable @ok="handleModalSvcOk">
|
||||
<template v-slot:modal-title>
|
||||
|
@ -154,9 +154,9 @@ export default {
|
|||
type: Object,
|
||||
required: true
|
||||
},
|
||||
displayCard: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
displayFormat: {
|
||||
type: String,
|
||||
default: 'grid'
|
||||
},
|
||||
zoneId: {
|
||||
type: Number,
|
||||
|
|
|
@ -108,7 +108,10 @@
|
|||
"list": {
|
||||
"title": "List view (fastest)"
|
||||
},
|
||||
"source-parameters": "Hosting parameters"
|
||||
"source-parameters": "Hosting parameters",
|
||||
"records": {
|
||||
"title": "List records (advanced)"
|
||||
}
|
||||
}
|
||||
},
|
||||
"email":{
|
||||
|
|
|
@ -53,6 +53,9 @@
|
|||
<b-button size="sm" :variant="displayFormat === 'list' ? 'secondary' : 'outline-secondary'" :title="$t('domains.views.list')" @click="toogleListView()">
|
||||
<b-icon icon="list-ul" aria-hidden="true" />
|
||||
</b-button>
|
||||
<b-button size="sm" :variant="displayFormat === 'records' ? 'secondary' : 'outline-secondary'" :title="$t('domains.views.records')" @click="toogleRecordsView()">
|
||||
<b-icon icon="list-ul" aria-hidden="true" />
|
||||
</b-button>
|
||||
</b-button-group>
|
||||
</b-col>
|
||||
<b-col cols="auto" class="text-right ml-auto">
|
||||
|
@ -70,7 +73,7 @@
|
|||
</b-button>
|
||||
</b-col>
|
||||
</b-row>
|
||||
<h-subdomain-list :display-card="displayCard" :domain="domain" :zone-id="selectedHistory" />
|
||||
<h-subdomain-list :display-format="displayFormat" :domain="domain" :zone-id="selectedHistory" />
|
||||
</div>
|
||||
|
||||
<b-modal id="modal-viewZone" :title="$t('domains.view.title')" size="lg" scrollable ok-only :ok-disabled="zoneContent === null">
|
||||
|
@ -136,7 +139,7 @@ export default {
|
|||
|
||||
data: function () {
|
||||
return {
|
||||
displayCard: true,
|
||||
displayFormat: 'grid',
|
||||
importInProgress: false,
|
||||
selectedHistory: null,
|
||||
zoneContent: null,
|
||||
|
@ -152,8 +155,8 @@ export default {
|
|||
},
|
||||
|
||||
created () {
|
||||
if (localStorage && localStorage.getItem('displayCard')) {
|
||||
this.displayCard = localStorage.getItem('displayCard') === 'true'
|
||||
if (localStorage && localStorage.getItem('displayFormat')) {
|
||||
this.displayFormat = localStorage.getItem('displayFormat')
|
||||
}
|
||||
if (this.domain !== undefined && this.domain.domain !== undefined) {
|
||||
this.pullDomain()
|
||||
|
@ -236,16 +239,23 @@ export default {
|
|||
},
|
||||
|
||||
toogleGridView () {
|
||||
this.displayCard = true
|
||||
this.displayFormat = 'grid'
|
||||
if (localStorage) {
|
||||
localStorage.setItem('displayCard', true)
|
||||
localStorage.setItem('displayFormat', 'grid')
|
||||
}
|
||||
},
|
||||
|
||||
toogleListView () {
|
||||
this.displayCard = false
|
||||
this.displayFormat = 'list'
|
||||
if (localStorage) {
|
||||
localStorage.setItem('displayCard', false)
|
||||
localStorage.setItem('displayFormat', 'list')
|
||||
}
|
||||
},
|
||||
|
||||
toogleRecordsView () {
|
||||
this.displayFormat = 'records'
|
||||
if (localStorage) {
|
||||
localStorage.setItem('displayFormat', 'records')
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<h-record v-for="(rr, index) in rrsFiltered" act-btn :record="rr" :key="index" @save-rr="newRR(index)" @delete-rr="deleteRR(index)" />
|
||||
<h-record v-for="(rr, index) in rrsFiltered" :key="index" act-btn :record="rr" @save-rr="newRR(index)" @delete-rr="deleteRR(index)" />
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
@ -75,7 +75,6 @@
|
|||
|
||||
<script>
|
||||
import axios from 'axios'
|
||||
import Vue from 'vue'
|
||||
|
||||
export default {
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user