Skip to content

Commit

Permalink
feat: edit-site collapsible locations #65, #30
Browse files Browse the repository at this point in the history
  • Loading branch information
0xJacky committed Jan 28, 2023
1 parent f8488a1 commit b89d962
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 34 deletions.
2 changes: 2 additions & 0 deletions frontend/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ declare module '@vue/runtime-core' {
AButton: typeof import('ant-design-vue/es')['Button']
ACard: typeof import('ant-design-vue/es')['Card']
ACol: typeof import('ant-design-vue/es')['Col']
ACollapse: typeof import('ant-design-vue/es')['Collapse']
ACollapsePanel: typeof import('ant-design-vue/es')['CollapsePanel']
AConfigProvider: typeof import('ant-design-vue/es')['ConfigProvider']
ADivider: typeof import('ant-design-vue/es')['Divider']
ADrawer: typeof import('ant-design-vue/es')['Drawer']
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/views/dashboard/DashBoard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ onMounted(() => {
disk_io_analytic[0].data = disk_io_analytic[0].data.concat(r.disk_io.writes)
disk_io_analytic[1].data = disk_io_analytic[1].data.concat(r.disk_io.reads)
websocket = ws('api/analytic')
websocket = ws('/api/analytic')
websocket.onmessage = wsOnMessage
})
Expand Down
78 changes: 45 additions & 33 deletions frontend/src/views/domain/ngx_conf/LocationEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,43 +40,48 @@ function remove(index: number) {
<h2 v-translate>Locations</h2>
<a-empty v-if="!locations"/>
<draggable
v-else
:list="locations"
item-key="name"
class="list-group"
ghost-class="ghost"
handle=".ant-card-head"
handle=".ant-collapse-header"
>
<template #item="{ element: v, index }">
<a-card :key="index" size="small">
<template #title>
<HolderOutlined/>
{{ $gettext('Location') }}
</template>
<template #extra v-if="!readonly">
<a-popconfirm @confirm="remove(index)"
:title="$gettext('Are you sure you want to remove this location?')"
:ok-text="$gettext('Yes')"
:cancel-text="$gettext('No')">
<a-button type="text">
<template #icon>
<DeleteOutlined style="font-size: 14px;"/>
</template>
</a-button>
</a-popconfirm>
</template>

<a-form layout="vertical">
<a-form-item :label="$gettext('Comments')">
<a-textarea v-model:value="v.comments" :bordered="false"/>
</a-form-item>
<a-form-item :label="$gettext('Path')">
<a-input addon-before="location" v-model:value="v.path"/>
</a-form-item>
<a-form-item :label="$gettext('Content')">
<code-editor v-model:content="v.content" default-height="200px" style="width: 100%;"/>
</a-form-item>
</a-form>
</a-card>
<a-collapse :bordered="false">
<a-collapse-panel>
<template #header>
<div>
<HolderOutlined/>
{{ $gettext('Location') }}
{{ v.path }}
</div>
</template>
<template #extra v-if="!readonly">
<a-popconfirm @confirm="remove(index)"
:title="$gettext('Are you sure you want to remove this location?')"
:ok-text="$gettext('Yes')"
:cancel-text="$gettext('No')">
<a-button type="text" size="small">
<template #icon>
<DeleteOutlined style="font-size: 14px;"/>
</template>
</a-button>
</a-popconfirm>
</template>
<a-form layout="vertical">
<a-form-item :label="$gettext('Comments')">
<a-textarea v-model:value="v.comments" :bordered="false"/>
</a-form-item>
<a-form-item :label="$gettext('Path')">
<a-input addon-before="location" v-model:value="v.path"/>
</a-form-item>
<a-form-item :label="$gettext('Content')">
<code-editor v-model:content="v.content" default-height="200px" style="width: 100%;"/>
</a-form-item>
</a-form>
</a-collapse-panel>
</a-collapse>
</template>
</draggable>

Expand All @@ -100,8 +105,15 @@ function remove(index: number) {
</template>

<style lang="less" scoped>
.ant-card {
.ant-collapse {
margin: 10px 0;
box-shadow: unset;
}
.ant-collapse-item {
border: 0 !important;
}
.ant-collapse-header {
align-items: center;
}
</style>

0 comments on commit b89d962

Please sign in to comment.