Add relations export and remote full backup/restore.
Expose GET/POST /api/v1/export/ for server dumps and add import UI for relations (CSV/JSON) plus remote backup controls. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
<select :id="inputId" :value="modelValue" class="form-control" @change="onChange">
|
||||
<option value="csv">CSV (.csv)</option>
|
||||
<option value="json">JSON (.json)</option>
|
||||
<option value="vcf">vCard (.vcf)</option>
|
||||
<option v-if="variant === 'contacts'" value="vcf">vCard (.vcf)</option>
|
||||
</select>
|
||||
</div>
|
||||
<button
|
||||
@@ -20,26 +20,29 @@
|
||||
<div v-if="result" class="alert" :class="result.error ? 'alert-error' : 'alert-success'" style="margin-top:12px;">
|
||||
<span v-if="result.error">{{ result.error }}</span>
|
||||
<span v-else>
|
||||
Экспортировано контактов: <strong>{{ result.count }}</strong>
|
||||
Экспортировано {{ entityLabel }}: <strong>{{ result.count }}</strong>
|
||||
({{ result.formatLabel }}).
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { useId } from 'vue'
|
||||
import { computed, useId } from 'vue'
|
||||
|
||||
defineProps({
|
||||
const props = defineProps({
|
||||
modelValue: { type: String, default: 'csv' },
|
||||
exporting: { type: Boolean, default: false },
|
||||
disabled: { type: Boolean, default: false },
|
||||
result: { type: Object, default: null },
|
||||
buttonLabel: { type: String, default: 'Экспортировать' },
|
||||
variant: { type: String, default: 'contacts' },
|
||||
})
|
||||
|
||||
const emit = defineEmits(['update:modelValue', 'export'])
|
||||
const inputId = useId()
|
||||
|
||||
const entityLabel = computed(() => (props.variant === 'relations' ? 'связей' : 'контактов'))
|
||||
|
||||
function onChange(event) {
|
||||
emit('update:modelValue', event.target.value)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user