Improve zone diff display
This commit is contained in:
parent
c3c484deac
commit
11d9719351
|
@ -281,10 +281,7 @@ func diffZones(c *gin.Context) {
|
||||||
rrCorected = append(rrCorected, c.Msg)
|
rrCorected = append(rrCorected, c.Msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
c.JSON(http.StatusOK, gin.H{
|
c.JSON(http.StatusOK, rrCorected)
|
||||||
"toAdd": rrCorected,
|
|
||||||
"toDel": nil,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func applyZone(c *gin.Context) {
|
func applyZone(c *gin.Context) {
|
||||||
|
|
|
@ -133,32 +133,25 @@
|
||||||
</i18n>
|
</i18n>
|
||||||
</template>
|
</template>
|
||||||
<template #modal-footer="{ ok, cancel }">
|
<template #modal-footer="{ ok, cancel }">
|
||||||
<div v-if="zoneDiffAdd || zoneDiffDel">
|
<div v-if="zoneDiff">
|
||||||
<span v-if="zoneDiffAdd" class="text-success">
|
<span v-if="zoneDiff" class="text-success">
|
||||||
{{ $tc('domains.apply.additions', (zoneDiffAdd || []).length) }}
|
{{ $tc('domains.apply.additions', (zoneDiff || []).length) }}
|
||||||
</span>
|
|
||||||
–
|
|
||||||
<span class="text-danger">
|
|
||||||
{{ $tc('domains.apply.deletions', (zoneDiffDel || []).length) }}
|
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<b-button variant="secondary" @click="cancel()">
|
<b-button variant="secondary" @click="cancel()">
|
||||||
{{ $t('common.cancel') }}
|
{{ $t('common.cancel') }}
|
||||||
</b-button>
|
</b-button>
|
||||||
<b-button variant="success" :disabled="propagationInProgress || (zoneDiffAdd === null && zoneDiffDel === null)" @click="ok()">
|
<b-button variant="success" :disabled="propagationInProgress || zoneDiff === null" @click="ok()">
|
||||||
<b-spinner v-if="propagationInProgress" label="Spinning" />
|
<b-spinner v-if="propagationInProgress" label="Spinning" />
|
||||||
{{ $t('domains.apply.button') }}
|
{{ $t('domains.apply.button') }}
|
||||||
</b-button>
|
</b-button>
|
||||||
</template>
|
</template>
|
||||||
<div v-if="zoneDiffAdd === null && zoneDiffDel === null" class="my-2 text-center">
|
<div v-if="zoneDiff === null" class="my-2 text-center">
|
||||||
<b-spinner label="Spinning" />
|
<b-spinner label="Spinning" />
|
||||||
<p>{{ $t('wait.exporting') }}</p>
|
<p>{{ $t('wait.exporting') }}</p>
|
||||||
</div>
|
</div>
|
||||||
<div v-for="(line, n) in zoneDiffAdd" :key="'a' + n" class="text-monospace text-success" style="white-space: nowrap">
|
<div v-for="(line, n) in zoneDiffAnalyzed" :key="'diff' + n" :class="'text-monospace ' + line.className" style="padding-left: 1em; text-indent: -1em;">
|
||||||
+{{ line }}
|
{{ line.msg }}
|
||||||
</div>
|
|
||||||
<div v-for="(line, n) in zoneDiffDel" :key="'d' + n" class="text-monospace text-danger" style="white-space: nowrap">
|
|
||||||
-{{ line }}
|
|
||||||
</div>
|
</div>
|
||||||
</b-modal>
|
</b-modal>
|
||||||
</b-container>
|
</b-container>
|
||||||
|
@ -181,8 +174,7 @@ export default {
|
||||||
propagationInProgress: false,
|
propagationInProgress: false,
|
||||||
selectedHistory: null,
|
selectedHistory: null,
|
||||||
zoneContent: null,
|
zoneContent: null,
|
||||||
zoneDiffAdd: null,
|
zoneDiff: null
|
||||||
zoneDiffDel: null
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -191,6 +183,32 @@ export default {
|
||||||
return this.domains_getDetailed[this.$route.params.domain]
|
return this.domains_getDetailed[this.$route.params.domain]
|
||||||
},
|
},
|
||||||
|
|
||||||
|
zoneDiffAnalyzed () {
|
||||||
|
if (!this.zoneDiff) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.zoneDiff.map(
|
||||||
|
(msg) => {
|
||||||
|
var className = ''
|
||||||
|
if (/^MODIFY/.test(msg)) {
|
||||||
|
className = 'text-warning'
|
||||||
|
} else if (/^CREATE/.test(msg)) {
|
||||||
|
className = 'text-success'
|
||||||
|
} else if (/^DELETE/.test(msg)) {
|
||||||
|
className = 'text-danger'
|
||||||
|
} else if (/^REFRESH/.test(msg)) {
|
||||||
|
className = 'text-info'
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
className,
|
||||||
|
msg
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
},
|
||||||
|
|
||||||
...mapGetters('domains', ['domains_getDetailed', 'sortedDomains']),
|
...mapGetters('domains', ['domains_getDetailed', 'sortedDomains']),
|
||||||
...mapGetters('providers', ['providers_getAll'])
|
...mapGetters('providers', ['providers_getAll'])
|
||||||
},
|
},
|
||||||
|
@ -299,18 +317,16 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
showDiff () {
|
showDiff () {
|
||||||
this.zoneDiffAdd = null
|
this.zoneDiff = null
|
||||||
this.zoneDiffDel = null
|
|
||||||
this.$bvModal.show('modal-applyZone')
|
this.$bvModal.show('modal-applyZone')
|
||||||
ZonesApi.diffZone(this.domain.domain, '@', this.selectedHistory)
|
ZonesApi.diffZone(this.domain.domain, '@', this.selectedHistory)
|
||||||
.then(
|
.then(
|
||||||
(response) => {
|
(response) => {
|
||||||
if (response.data.toAdd == null && response.data.toDel == null) {
|
if (response.data == null) {
|
||||||
this.$bvModal.hide('modal-applyZone')
|
this.$bvModal.hide('modal-applyZone')
|
||||||
this.$bvModal.msgBoxOk(this.$t('domains.apply.nochange'))
|
this.$bvModal.msgBoxOk(this.$t('domains.apply.nochange'))
|
||||||
} else {
|
} else {
|
||||||
this.zoneDiffAdd = response.data.toAdd
|
this.zoneDiff = response.data
|
||||||
this.zoneDiffDel = response.data.toDel
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
(error) => {
|
(error) => {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user