Skip to content

Commit 566a5c7

Browse files
committed
feat: check if the site exists before add/rename
1 parent c9c83c9 commit 566a5c7

File tree

16 files changed

+507
-216
lines changed

16 files changed

+507
-216
lines changed

frontend/src/api/domain.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ class Domain extends Curd {
2121
remove_auto_cert(domain: string) {
2222
return http.delete('auto_cert/' + domain)
2323
}
24+
25+
duplicate(name: string, data: any) {
26+
return http.post(this.baseUrl + '/' + name + '/duplicate', data)
27+
}
2428
}
2529

2630
const domain = new Domain('/domain')

frontend/src/components/StdDataDisplay/StdTable.vue

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ async function export_csv() {
359359
})
360360
361361
downloadCsv(header, data,
362-
`${$gettext('Export')}-${dayjs().format('YYYYMMDDHHmmss')}.csv`)
362+
`${$gettext('Export')}-${dayjs().format('YYYYMMDDHHmmss')}.csv`)
363363
}
364364
365365
const hasSelectedRow = computed(() => {
@@ -418,7 +418,7 @@ function initSortable() {
418418
const level: number = newRow.level
419419
420420
let currentRowIndex: number[] = [...rows_key_index_map.value?.
421-
[Number(table.children[Number(newIndex) + direction].dataset.rowKey)]]
421+
[Number(table.children[Number(newIndex) + direction].dataset.rowKey)]]
422422
let currentRow: any = getTargetData(data_source.value, currentRowIndex)
423423
// Reset parent
424424
currentRow.parent = newRow.parent = null
@@ -451,7 +451,7 @@ function initSortable() {
451451
processChanges(getTargetData(data_source.value, rowIndex))
452452
}
453453
console.log('Change row id', newRow.id, 'order', newRow.id, '=>', currentRow.id, ', direction: ', direction,
454-
', changes IDs:', changeIds)
454+
', changes IDs:', changeIds)
455455
456456
props.api!.update_order({
457457
target_id: newRow.id,
@@ -472,10 +472,10 @@ function initSortable() {
472472
<template>
473473
<div class="std-table">
474474
<std-data-entry
475-
v-if="!disable_search && searchColumns.length"
476-
:data-list="searchColumns"
477-
v-model:data-source="params"
478-
layout="inline"
475+
v-if="!disable_search && searchColumns.length"
476+
:data-list="searchColumns"
477+
v-model:data-source="params"
478+
layout="inline"
479479
>
480480
<template #action>
481481
<a-space class="action-btn">
@@ -492,39 +492,40 @@ function initSortable() {
492492
</template>
493493
</std-data-entry>
494494
<a-table
495-
:columns="pithyColumns"
496-
:data-source="data_source"
497-
:loading="loading"
498-
:pagination="false"
499-
:row-key="rowKey"
500-
:rowSelection="rowSelection"
501-
@change="stdChange"
502-
:scroll="{ x: scrollX }"
503-
:size="size"
504-
id="std-table"
505-
@expandedRowsChange="expandedTable"
506-
:expandedRowKeys="expand_keys_list"
495+
:columns="pithyColumns"
496+
:data-source="data_source"
497+
:loading="loading"
498+
:pagination="false"
499+
:row-key="rowKey"
500+
:rowSelection="rowSelection"
501+
@change="stdChange"
502+
:scroll="{ x: scrollX }"
503+
:size="size"
504+
id="std-table"
505+
@expandedRowsChange="expandedTable"
506+
:expandedRowKeys="expand_keys_list"
507507
>
508508
<template
509-
v-slot:bodyCell="{text, record, index, column}"
509+
v-slot:bodyCell="{text, record, index, column}"
510510
>
511511
<template v-if="column.handle === true">
512512
<span class="ant-table-drag-icon"><HolderOutlined/></span>
513513
{{ text }}
514514
</template>
515515
<template v-if="column.dataIndex === 'action'">
516-
<a v-if="props.editable" @click="$emit('clickEdit', record[props.rowKey], record)">
516+
<a-button type="link" size="small" v-if="props.editable"
517+
@click="$emit('clickEdit', record[props.rowKey], record)">
517518
{{ props.edit_text || $gettext('Modify') }}
518-
</a>
519+
</a-button>
519520
<slot name="actions" :record="record"/>
520521
<template v-if="props.deletable">
521522
<a-divider type="vertical"/>
522523
<a-popconfirm
523-
:cancelText="$gettext('No')"
524-
:okText="$gettext('OK')"
525-
:title="$gettext('Are you sure you want to delete?')"
526-
@confirm="destroy(record[rowKey])">
527-
<a v-translate>Delete</a>
524+
:cancelText="$gettext('No')"
525+
:okText="$gettext('OK')"
526+
:title="$gettext('Are you sure you want to delete?')"
527+
@confirm="destroy(record[rowKey])">
528+
<a-button type="link" size="small" v-translate>Delete</a-button>
528529
</a-popconfirm>
529530
</template>
530531
</template>

frontend/src/language/constants.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,7 @@ export const msg = [
2626
$gettext('Download latest release error'),
2727
$gettext('Performing core upgrade'),
2828
$gettext('Perform core upgrade error'),
29-
$gettext('Upgraded successfully')
29+
$gettext('Upgraded successfully'),
30+
31+
$gettext('File exists')
3032
]

0 commit comments

Comments
 (0)