Skip to content

Commit

Permalink
feat: 历史版本
Browse files Browse the repository at this point in the history
  • Loading branch information
wangdan-fit2cloud committed Oct 22, 2024
1 parent 10f66a4 commit e4d9a49
Show file tree
Hide file tree
Showing 8 changed files with 326 additions and 20 deletions.
46 changes: 45 additions & 1 deletion ui/src/api/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,47 @@ const validatePassword: (application_id: string, password: string) => Promise<Re
return get(`/application/${application_id}/auth/${password}`, undefined)
}

/**
* workflow历史版本
*/
const getWorkFlowVersion: (
application_id: string,
loading?: Ref<boolean>
) => Promise<Result<any>> = (application_id, loading) => {
return get(`/application/${application_id}/work_flow_version`, undefined, loading)
}

/**
* workflow历史版本详情
*/
const getWorkFlowVersionDetail: (
application_id: string,
application_version_id: string,
loading?: Ref<boolean>
) => Promise<Result<any>> = (application_id, application_version_id, loading) => {
return get(
`/application/${application_id}/work_flow_version/${application_version_id}`,
undefined,
loading
)
}
/**
* 修改workflow历史版本
*/
const putWorkFlowVersion: (
application_id: string,
application_version_id: string,
data: any,
loading?: Ref<boolean>
) => Promise<Result<any>> = (application_id, application_version_id, data, loading) => {
return put(
`/application/${application_id}/work_flow_version/${application_version_id}`,
data,
undefined,
loading
)
}

export default {
getAllAppilcation,
getApplication,
Expand Down Expand Up @@ -429,5 +470,8 @@ export default {
getPlatformConfig,
updatePlatformConfig,
updatePlatformStatus,
validatePassword
validatePassword,
getWorkFlowVersion,
getWorkFlowVersionDetail,
putWorkFlowVersion
}
11 changes: 9 additions & 2 deletions ui/src/components/common-list/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
@click.prevent="clickHandle(item, index)"
:class="current === item[props.valueKey] ? 'active' : ''"
class="cursor"
@mouseenter="mouseenter(item)"
@mouseleave="mouseleave()"
@mouseenter.stop="mouseenter(item)"
@mouseleave.stop="mouseleave()"
>
<slot :row="item" :index="index"> </slot>
</li>
Expand Down Expand Up @@ -71,6 +71,13 @@ function clickHandle(row: any, index: number) {
border-radius: 4px;
color: var(--el-color-primary);
font-weight: 500;
&:hover {
background: var(--el-color-primary-light-9);
}
}
&:hover {
border-radius: 4px;
background: var(--app-text-color-light-1);
}
}
}
Expand Down
23 changes: 22 additions & 1 deletion ui/src/components/icons/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1227,5 +1227,26 @@ export const iconMap: any = {
)
])
}
}
},
// 'app-history-outlined': {
// iconReader: () => {
// return h('i', [
// h(
// 'svg',
// {
// style: { height: '100%', width: '100%' },
// viewBox: '0 0 1024 1024',
// version: '1.1',
// xmlns: 'http://www.w3.org/2000/svg'
// },
// [
// h('path', {
// d: 'M955.733333 512c0 235.648-191.018667 426.666667-426.666666 426.666667a425.898667 425.898667 0 0 1-334.677334-162.005334l67.797334-51.84a341.333333 341.333333 0 1 0-69.717334-269.653333h30.08c18.176-0.042667 29.013333 20.181333 18.944 35.328L170.24 597.333333a22.741333 22.741333 0 0 1-37.888 0l-71.253333-106.88a22.741333 22.741333 0 0 1 18.944-35.413333h26.112C133.973333 246.4 312.746667 85.333333 529.066667 85.333333c235.648 0 426.666667 191.018667 426.666666 426.666667z" p-id="16742"></path><path d="M554.666667 497.792V364.074667A22.741333 22.741333 0 0 0 531.925333 341.333333h-39.850666a22.741333 22.741333 0 0 0-22.741334 22.741334v196.266666c0 12.586667 10.197333 22.784 22.741334 22.784H674.133333a22.741333 22.741333 0 0 0 22.741334-22.784V520.533333a22.741333 22.741333 0 0 0-22.741334-22.741333H554.666667z',
// fill: 'currentColor'
// })
// ]
// )
// ])
// }
// }
}
5 changes: 4 additions & 1 deletion ui/src/styles/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ h5 {

/* tag */
.default-tag {
background: var(--el-color-primary-light-7);
background: var(--el-color-primary-light-8);
color: var(--el-color-primary);
border: none;
}
Expand Down Expand Up @@ -492,6 +492,9 @@ h5 {
.avatar-green {
background: #34c724;
}
.avatar-grey {
background: #bbbfc4;
}

.success {
color: var(--el-color-success);
Expand Down
130 changes: 130 additions & 0 deletions ui/src/views/application-workflow/component/PublishHistory.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
<template>
<div class="workflow-publish-history">
<h4 class="border-b p-16-24">发布历史</h4>
<div class="left-height pt-0">
<el-scrollbar>
<div class="p-8 pt-0">
<common-list
:data="LogData"
class="mt-8"
v-loading="loading"
@click="clickListHandle"
@mouseenter="mouseenter"
@mouseleave="mouseId = ''"
>
<template #default="{ row, index }">
<div class="flex-between">
<div>
<h5 :class="index === 0 ? 'primary' : ''" class="flex">
<ReadWrite
@change="editName($event, row.id)"
:data="row.name || datetimeFormat(row.create_time)"
:showEditIcon="true"
/>
<el-tag v-if="index === 0" class="default-tag ml-4">最近发布</el-tag>
</h5>
<el-text type="info" class="color-secondary flex mt-8">
<AppAvatar :size="20" class="avatar-grey mr-4">
<el-icon><UserFilled /></el-icon>
</AppAvatar>
XXX
</el-text>
</div>

<!-- <div @click.stop v-show="mouseId === row.id">
<el-dropdown trigger="click">
<el-button text>
<el-icon><MoreFilled /></el-icon>
</el-button>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item>
<el-icon><EditPen /></el-icon>
编辑
</el-dropdown-item>
<el-dropdown-item @click="refreshVersion(row)">
<el-icon><RefreshLeft /></el-icon>
恢复此版本
</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</div> -->
</div>
</template>

<template #empty>
<div class="text-center">
<el-text type="info">暂无历史记录</el-text>
</div>
</template>
</common-list>
</div>
</el-scrollbar>
</div>
</div>
</template>
<script setup lang="ts">
import { ref, onMounted, computed } from 'vue'
import { useRoute } from 'vue-router'
import applicationApi from '@/api/application'
import { datetimeFormat } from '@/utils/time'
import { MsgSuccess, MsgError } from '@/utils/message'
const route = useRoute()
const {
params: { id }
} = route as any
const emit = defineEmits(['click', 'refreshVersion'])
const loading = ref(false)
const LogData = ref([])
const mouseId = ref('')
function mouseenter(row: any) {
mouseId.value = row.id
}
function clickListHandle(item: any) {
emit('click', item)
}
function refreshVersion(item: any) {
emit('refreshVersion', item)
}
function editName(val: string, currentId: string) {
if (val) {
const obj = {
name: val
}
applicationApi.putWorkFlowVersion(id as string, currentId, obj, loading).then(() => {
MsgSuccess('修改成功')
getList()
})
} else {
MsgError('名字不能为空!')
}
}
function getList() {
applicationApi.getWorkFlowVersion(id, loading).then((res: any) => {
LogData.value = res.data
})
}
onMounted(() => {
getList()
})
</script>
<style lang="scss" scoped>
.workflow-publish-history {
width: 320px;
position: absolute;
right: 0;
top: 57px;
background: #ffffff;
height: calc(100vh - 57px);
z-index: 9;
}
</style>
Loading

0 comments on commit e4d9a49

Please sign in to comment.