Merge pull request #3955 from dataease/pr@dev_memory_component

Pr@dev memory component
This commit is contained in:
taojinlong 2022-11-30 13:43:32 +08:00 committed by GitHub
commit ae43683a5b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 137 additions and 99 deletions

View File

@ -372,7 +372,7 @@ export default {
]) ])
}, },
mounted() { mounted() {
if (navigator.platform.indexOf('Mac') == -1) { if (navigator.platform.indexOf('Mac') === -1) {
this.systemOS = 'Other' this.systemOS = 'Other'
} }
this.initCurFields() this.initCurFields()

View File

@ -17,8 +17,7 @@
v-if="curComponent.type != 'custom-button'" v-if="curComponent.type != 'custom-button'"
icon="el-icon-document-copy" icon="el-icon-document-copy"
@click.native="copy" @click.native="copy"
><span>{{ $t('panel.copy') }}(<span v-show="systemOS==='Mac'"><i class="icon iconfont icon-command" ><span>{{ $t('panel.copy') }}(<span v-show="systemOS==='Mac'"><i class="icon iconfont icon-command" />+ D</span> <span v-show="systemOS!=='Mac'">Control + D</span>)</span>
/>+ D</span> <span v-show="systemOS!=='Mac'">Control + D</span>)</span>
</el-dropdown-item> </el-dropdown-item>
<el-dropdown-item <el-dropdown-item
icon="el-icon-delete" icon="el-icon-delete"
@ -210,7 +209,7 @@ export default {
]) ])
}, },
mounted() { mounted() {
if (navigator.platform.indexOf('Mac') == -1) { if (navigator.platform.indexOf('Mac') === -1) {
this.systemOS = 'Other' this.systemOS = 'Other'
} }
}, },

View File

@ -112,9 +112,9 @@ export default {
} }
} }
//eslint-disable-next-line // eslint-disable-next-line
this.showPrevMore = showPrevMore this.showPrevMore = showPrevMore
//eslint-disable-next-line // eslint-disable-next-line
this.showNextMore = showNextMore this.showNextMore = showNextMore
return array return array

View File

@ -1,12 +1,12 @@
<template> <template>
<el-input <el-input
v-count="value" v-count="{value, maxlength}"
:placeholder="$t('fu.search_bar.please_input')" :placeholder="$t('fu.search_bar.please_input')"
show-word-limit show-word-limit
:disabled="disabled" :disabled="disabled"
:value="value" :value="value"
type="textarea" type="textarea"
maxlength="200" :maxlength="maxlength"
@input="handleChange" @input="handleChange"
/> />
</template> </template>
@ -16,14 +16,14 @@ export default {
directives: { directives: {
count: { count: {
update: function(el, binding) { update: function(el, binding) {
const lg = binding.value?.length || 0 const lg = binding.value.value?.length || 0
const count = el.querySelector('.el-input__count') const count = el.querySelector('.el-input__count')
if (!count) return if (!count) return
if (!lg) { if (!lg) {
if (count?.classList?.contains('no-zore')) { if (count?.classList?.contains('no-zore')) {
count.classList.remove('no-zore') count.classList.remove('no-zore')
} }
count.innerHTML = '0/200' count.innerHTML = `0/${binding.value.maxlength || 200}`
return return
} }
if (el.querySelector('.no-zore')) { if (el.querySelector('.no-zore')) {
@ -34,7 +34,7 @@ export default {
const num = document.createElement('span') const num = document.createElement('span')
const total = document.createElement('span') const total = document.createElement('span')
num.style.color = '#1F2329' num.style.color = '#1F2329'
total.innerHTML = '/200' total.innerHTML = `/${binding.value.maxlength || 200}`
num.innerHTML = lg num.innerHTML = lg
if (!newCount) return if (!newCount) return
newCount.classList.add('el-input__count', 'no-zore') newCount.classList.add('el-input__count', 'no-zore')
@ -46,7 +46,11 @@ export default {
}, },
props: { props: {
disabled: Boolean, disabled: Boolean,
value: String value: String,
maxlength: {
type: Number,
default: 200
}
}, },
methods: { methods: {
handleChange(val) { handleChange(val) {

View File

@ -108,13 +108,16 @@ service.interceptors.response.use(response => {
const headers = error.response && error.response.headers || error.response || config.headers const headers = error.response && error.response.headers || error.response || config.headers
config.loading && tryHideLoading(store.getters.currentPath) config.loading && tryHideLoading(store.getters.currentPath)
let msg let msg = ''
if (error.response) { if (error.response) {
checkAuth(error.response) checkAuth(error.response)
msg = error.response.data.message || error.response.data msg = error.response.data.message || error.response.data
} else { } else {
msg = error.message msg = error.message
} }
if (msg.length > 600) {
msg = msg.slice(0, 600)
}
!config.hideMsg && (!headers['authentication-status']) && $error(msg) !config.hideMsg && (!headers['authentication-status']) && $error(msg)
return Promise.reject(config.url === '/dataset/table/sqlPreview' ? msg : error) return Promise.reject(config.url === '/dataset/table/sqlPreview' ? msg : error)
}) })

View File

@ -380,8 +380,8 @@ export default {
if (!viewSave) return if (!viewSave) return
viewEditSave(this.panelInfo.id, viewSave).then(() => { viewEditSave(this.panelInfo.id, viewSave).then(() => {
this.chart.title = this.chartTitleUpdate this.chart.title = this.chartTitleUpdate
bus.$emit('aside-set-title', this.chart.title)
}) })
bus.$emit('title-name', this.chart.title, chartView.id)
bus.$emit('view-in-cache', { bus.$emit('view-in-cache', {
type: 'styleChange', type: 'styleChange',
viewId: chartView.id, viewId: chartView.id,

View File

@ -1934,7 +1934,8 @@ export default {
}, },
methods: { methods: {
setTitle(title) { setTitle(title, id) {
if (this.view.id !== id) return
this.view.customStyle.text = { ...this.view.customStyle.text, title } this.view.customStyle.text = { ...this.view.customStyle.text, title }
this.view.title = title this.view.title = title
this.view.name = title this.view.name = title

View File

@ -860,8 +860,8 @@ export default {
item.dateFormat = item.dateFormatType item.dateFormat = item.dateFormatType
} }
} }
if(item.dateFormatType === 'custom' && !item.dateFormat){ if (item.dateFormatType === 'custom' && !item.dateFormat) {
return; return
} }
post('/dataset/field/save', item) post('/dataset/field/save', item)
.then((response) => { .then((response) => {

View File

@ -861,7 +861,7 @@ export default {
}, },
disableExec(task) { disableExec(task) {
return ( return (
(task.status === 'Stopped' && task.rate !== 'SIMPLE') || task.status === 'Pending' || task.status ==='Exec' || !hasDataPermission('manage', task.privileges) (task.status === 'Stopped' && task.rate !== 'SIMPLE') || task.status === 'Pending' || task.status === 'Exec' || !hasDataPermission('manage', task.privileges)
) )
}, },
disableDelete(task) { disableDelete(task) {

View File

@ -1,8 +1,8 @@
<template> <template>
<el-row <el-row
v-loading="$store.getters.loadingMap[$store.getters.currentPath]"
style="text-align: left" style="text-align: left"
class="de-search-table" class="de-search-table"
v-loading="$store.getters.loadingMap[$store.getters.currentPath]"
> >
<el-row class="top-operate"> <el-row class="top-operate">
<el-col :span="12"> <el-col :span="12">
@ -36,8 +36,8 @@
icon="iconfont icon-icon-filter" icon="iconfont icon-icon-filter"
@click="filterShow" @click="filterShow"
>{{ >{{
$t('user.filter') $t('user.filter')
}} }}
<template v-if="filterTexts.length"> <template v-if="filterTexts.length">
({{ cacheCondition.length }}) ({{ cacheCondition.length }})
</template> </template>
@ -50,7 +50,7 @@
> >
<span class="sum">{{ paginationConfig.total }}</span> <span class="sum">{{ paginationConfig.total }}</span>
<span class="title">{{ $t('user.result_one') }}</span> <span class="title">{{ $t('user.result_one') }}</span>
<el-divider direction="vertical"/> <el-divider direction="vertical" />
<i <i
v-if="showScroll" v-if="showScroll"
class="el-icon-arrow-left arrow-filter" class="el-icon-arrow-left arrow-filter"
@ -63,9 +63,9 @@
class="text" class="text"
> >
{{ ele }} <i {{ ele }} <i
class="el-icon-close" class="el-icon-close"
@click="clearOneFilter(index)" @click="clearOneFilter(index)"
/> />
</p> </p>
</div> </div>
<i <i
@ -180,11 +180,11 @@
<!--导入templatedialog--> <!--导入templatedialog-->
<el-dialog <el-dialog
v-loading="$store.getters.loadingMap[$store.getters.currentPath]"
:title="$t('app_template.log_delete_tips')" :title="$t('app_template.log_delete_tips')"
:visible.sync="deleteConfirmDialog" :visible.sync="deleteConfirmDialog"
:show-close="true" :show-close="true"
width="420px" width="420px"
v-loading="$store.getters.loadingMap[$store.getters.currentPath]"
> >
<el-row> <el-row>
<el-checkbox <el-checkbox

View File

@ -820,7 +820,7 @@ export default {
bus.$off('change_panel_right_draw', this.changeRightDrawOpen) bus.$off('change_panel_right_draw', this.changeRightDrawOpen)
bus.$off('delete-condition', this.deleteCustomComponent) bus.$off('delete-condition', this.deleteCustomComponent)
bus.$off('current-component-change', this.asideRefresh) bus.$off('current-component-change', this.asideRefresh)
bus.$off('aside-set-title', this.asideSetTitle) bus.$off('title-name', this.asideSetTitle)
const elx = this.$refs.rightPanel const elx = this.$refs.rightPanel
elx && elx.remove() elx && elx.remove()
}, },
@ -851,16 +851,16 @@ export default {
bus.$on('change_panel_right_draw', this.changeRightDrawOpen) bus.$on('change_panel_right_draw', this.changeRightDrawOpen)
bus.$on('delete-condition', this.deleteCustomComponent) bus.$on('delete-condition', this.deleteCustomComponent)
bus.$on('current-component-change', this.asideRefresh) bus.$on('current-component-change', this.asideRefresh)
bus.$on('aside-set-title', this.asideSetTitle) bus.$on('title-name', this.asideSetTitle)
}, },
asideRefresh() { asideRefresh() {
if (this.$refs['chartEditRef']) { if (this.$refs['chartEditRef']) {
this.$refs['chartEditRef'].resetChartData() this.$refs['chartEditRef'].resetChartData()
} }
}, },
asideSetTitle(val) { asideSetTitle(val, id) {
if (this.$refs['chartEditRef']) { if (this.$refs['chartEditRef']) {
this.$refs['chartEditRef'].setTitle(val) this.$refs['chartEditRef'].setTitle(val, id)
} }
}, },
deleteCustomComponent(param) { deleteCustomComponent(param) {

View File

@ -182,6 +182,7 @@
> >
<deTextarea <deTextarea
v-model="form.desc" v-model="form.desc"
:maxlength="50"
class="w100-textarea" class="w100-textarea"
/> />
</el-form-item> </el-form-item>

View File

@ -255,15 +255,15 @@
v-dialogDrag v-dialogDrag
:title="$t('datasource.create')" :title="$t('datasource.create')"
:visible.sync="dsTypeRelate" :visible.sync="dsTypeRelate"
width="1200px" width="1005px"
class="de-dialog-form none-scroll-bar" class="de-dialog-form none-scroll-bar"
append-to-body append-to-body
> >
<el-tabs v-model="tabActive"> <el-tabs
<el-tab-pane v-model="tabActive"
:label="$t('datasource.all')" class="de-tabs"
name="all" @tab-click="handleClick"
/> >
<el-tab-pane <el-tab-pane
:label="$t('datasource.relational_database')" :label="$t('datasource.relational_database')"
name="RDBMS" name="RDBMS"
@ -278,24 +278,36 @@
/> />
</el-tabs> </el-tabs>
<div class="db-container"> <div class="db-container">
<div <template v-for="(list, idx) in databaseList">
v-for="(db, index) in databaseList" <div
:key="db.type" :key="nameMap[idx]"
class="db-card" :class="typeList[idx]"
:class="[{ marLeft: index % 4 === 0 }]" class="name"
@click="addDb(db)" >{{ $t(`datasource.${nameMap[idx]}`) }}</div>
> <div
<img :key="nameMap[idx] + 'cont'"
v-if="!db.isPlugin" class="item-container"
:src="require('../../../assets/datasource/' + db.type + '.jpg')"
alt=""
> >
<img <div
v-if="db.isPlugin" v-for="(db, index) in list"
:src="`/api/pluginCommon/staticInfo/${db.type}/jpg`" :key="db.type"
> class="db-card"
<p class="db-name">{{ db.name }}</p> :class="[{ marLeft: index % 5 === 0 }]"
</div> @click="addDb(db)"
>
<img
v-if="!db.isPlugin"
:src="require('../../../assets/datasource/' + db.type + '.jpg')"
alt=""
>
<img
v-if="db.isPlugin"
:src="`/api/pluginCommon/staticInfo/${db.type}/jpg`"
>
<p class="db-name">{{ db.name }}</p>
</div>
</div>
</template>
</div> </div>
</el-dialog> </el-dialog>
</el-col> </el-col>
@ -329,11 +341,14 @@ export default {
}, },
data() { data() {
return { return {
tabActive: 'all', tabActive: 'RDBMS',
databaseList: [],
currentNodeId: '', currentNodeId: '',
dsTypeRelate: false, dsTypeRelate: false,
expandedArray: [], expandedArray: [],
tData: [], tData: [],
nameMap: ['relational_database', 'non_relational_database', 'other'],
typeList: ['RDBMS', 'NORDBMS', 'OTHER'],
treeLoading: false, treeLoading: false,
dsTypes: [], dsTypes: [],
dsTypesForDriver: [], dsTypesForDriver: [],
@ -386,15 +401,7 @@ export default {
} }
}, },
computed: { computed: {
...mapGetters(['user']), ...mapGetters(['user'])
databaseList() {
if (this.tabActive === 'all') {
return this.dsTypes
}
return this.dsTypes.filter(
(ele) => ele.databaseClassification === this.tabActive
)
}
}, },
watch: { watch: {
key(val) { key(val) {
@ -406,6 +413,9 @@ export default {
this.datasourceTypes() this.datasourceTypes()
}, },
methods: { methods: {
handleClick() {
document.querySelector(`.${this.tabActive}`).scrollIntoView()
},
createDriveOrDs() { createDriveOrDs() {
if (this.showView === 'Driver') { if (this.showView === 'Driver') {
this.addDriver() this.addDriver()
@ -478,11 +488,17 @@ export default {
datasourceTypes() { datasourceTypes() {
listDatasourceType().then((res) => { listDatasourceType().then((res) => {
this.dsTypes = res.data this.dsTypes = res.data
const databaseList = [[], [], []]
this.dsTypes.forEach((item) => { this.dsTypes.forEach((item) => {
const index = this.typeList.findIndex(ele => ele === item.databaseClassification)
if (index !== -1) {
databaseList[index].push(item)
}
if (item.isJdbc) { if (item.isJdbc) {
this.dsTypesForDriver.push(item) this.dsTypesForDriver.push(item)
} }
}) })
this.databaseList = databaseList
}) })
}, },
refreshType(datasource) { refreshType(datasource) {
@ -802,24 +818,38 @@ export default {
width: 100%; width: 100%;
max-height: 65vh; max-height: 65vh;
overflow-y: auto; overflow-y: auto;
display: flex; margin-top: 3px;
flex-wrap: wrap;
margin-top: -3px;
position: relative; position: relative;
z-index: 10; z-index: 10;
.name {
margin: 16px 0;
font-family: PingFang SC;
font-size: 16px;
font-weight: 500;
line-height: 24px;
color: var(--deTextPrimary, #1F2329);
}
.item-container {
display: flex;
width: 100%;
flex-wrap: wrap;
}
.db-card { .db-card {
height: 193px; height: 141px;
width: 270px; width: 177.6px;
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
background: #ffffff; background: #ffffff;
border: 1px solid #dee0e3; border: 1px solid #dee0e3;
border-radius: 4px; border-radius: 4px;
margin-bottom: 24px; margin-bottom: 16px;
margin-left: 22px; margin-left: 16px;
img { img {
width: 100%; width: 100%;
height: 154.58px; height: 102px;
border-top-left-radius: 4px; border-top-left-radius: 4px;
border-top-right-radius: 4px; border-top-right-radius: 4px;
} }

View File

@ -36,8 +36,8 @@
icon="iconfont icon-icon-filter" icon="iconfont icon-icon-filter"
@click="filterShow" @click="filterShow"
>{{ >{{
$t("user.filter") $t("user.filter")
}} }}
<template v-if="filterTexts.length"> <template v-if="filterTexts.length">
({{ filterTexts.length }}) ({{ filterTexts.length }})
</template> </template>
@ -83,7 +83,7 @@
> >
<span class="sum">{{ paginationConfig.total }}</span> <span class="sum">{{ paginationConfig.total }}</span>
<span class="title">{{ $t("user.result_one") }}</span> <span class="title">{{ $t("user.result_one") }}</span>
<el-divider direction="vertical"/> <el-divider direction="vertical" />
<i <i
v-if="showScroll" v-if="showScroll"
class="el-icon-arrow-left arrow-filter" class="el-icon-arrow-left arrow-filter"
@ -96,9 +96,9 @@
class="text" class="text"
> >
{{ ele }} <i {{ ele }} <i
class="el-icon-close" class="el-icon-close"
@click="clearOneFilter(index)" @click="clearOneFilter(index)"
/> />
</p> </p>
</div> </div>
<i <i
@ -162,14 +162,14 @@
> >
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="scope.row.rate === 'SIMPLE'">{{ <span v-if="scope.row.rate === 'SIMPLE'">{{
$t("dataset.execute_once") $t("dataset.execute_once")
}}</span> }}</span>
<span v-if="scope.row.rate === 'CRON'">{{ <span v-if="scope.row.rate === 'CRON'">{{
$t("dataset.cron_config") $t("dataset.cron_config")
}}</span> }}</span>
<span v-if="scope.row.rate === 'SIMPLE_CRON'">{{ <span v-if="scope.row.rate === 'SIMPLE_CRON'">{{
$t("dataset.simple_cron") $t("dataset.simple_cron")
}}</span> }}</span>
</template> </template>
</el-table-column> </el-table-column>
@ -197,8 +197,8 @@
v-if="scope.row.lastExecStatus" v-if="scope.row.lastExecStatus"
:class="[`de-${scope.row.lastExecStatus}-pre`, 'de-status']" :class="[`de-${scope.row.lastExecStatus}-pre`, 'de-status']"
>{{ >{{
$t(`dataset.${scope.row.lastExecStatus.toLocaleLowerCase()}`) $t(`dataset.${scope.row.lastExecStatus.toLocaleLowerCase()}`)
}} }}
<svg-icon <svg-icon
v-if="scope.row.lastExecStatus === 'Error'" v-if="scope.row.lastExecStatus === 'Error'"
style="cursor: pointer;" style="cursor: pointer;"
@ -333,18 +333,18 @@
secondary secondary
@click="show_error_massage = false" @click="show_error_massage = false"
>{{ >{{
$t("dataset.close") $t("dataset.close")
}}</deBtn> }}</deBtn>
</span> </span>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
<script> <script>
import {columnOptions} from './options' import { columnOptions } from './options'
import {formatOrders} from '@/utils/index' import { formatOrders } from '@/utils/index'
import {datasetTaskList, post} from '@/api/dataset/dataset' import { datasetTaskList, post } from '@/api/dataset/dataset'
import {hasDataPermission} from '@/utils/permission' import { hasDataPermission } from '@/utils/permission'
import GridTable from '@/components/gridTable/index.vue' import GridTable from '@/components/gridTable/index.vue'
import filterUser from './FilterUser.vue' import filterUser from './FilterUser.vue'
import msgCfm from '@/components/msgCfm/index' import msgCfm from '@/components/msgCfm/index'
@ -353,7 +353,7 @@ import keyEnter from '@/components/msgCfm/keyEnter.js'
export default { export default {
name: 'DatasetTaskList', name: 'DatasetTaskList',
components: {GridTable, filterUser}, components: { GridTable, filterUser },
mixins: [msgCfm, keyEnter], mixins: [msgCfm, keyEnter],
props: { props: {
transCondition: { transCondition: {
@ -396,7 +396,7 @@ export default {
} }
}, },
created() { created() {
const {taskId, name} = this.transCondition const { taskId, name } = this.transCondition
if (taskId) { if (taskId) {
this.nickName = name this.nickName = name
} }
@ -427,7 +427,7 @@ export default {
document.querySelector('#resize-for-filter') document.querySelector('#resize-for-filter')
) )
}, },
layoutResize: _.debounce(function () { layoutResize: _.debounce(function() {
this.getScrollStatus() this.getScrollStatus()
}, 200), }, 200),
scrollPre() { scrollPre() {
@ -501,7 +501,7 @@ export default {
this.handleCurrentChange(1) this.handleCurrentChange(1)
}, },
search(showLoading = true) { search(showLoading = true) {
const {taskId, name} = this.transCondition const { taskId, name } = this.transCondition
const param = { const param = {
orders: formatOrders(this.orderConditions), orders: formatOrders(this.orderConditions),
conditions: [...this.cacheCondition] conditions: [...this.cacheCondition]
@ -520,7 +520,7 @@ export default {
field: 'dataset_table_task.id' field: 'dataset_table_task.id'
}) })
} }
const {currentPage, pageSize} = this.paginationConfig const { currentPage, pageSize } = this.paginationConfig
datasetTaskList(currentPage, pageSize, param, showLoading).then( datasetTaskList(currentPage, pageSize, param, showLoading).then(
(response) => { (response) => {
const multipleSelection = this.multipleSelection.map(ele => ele.id) const multipleSelection = this.multipleSelection.map(ele => ele.id)
@ -568,7 +568,7 @@ export default {
}) })
}, },
changeTaskStatus(task) { changeTaskStatus(task) {
const {status} = task const { status } = task
if (!['Pending', 'Underway'].includes(status)) { if (!['Pending', 'Underway'].includes(status)) {
return return
} }
@ -613,7 +613,7 @@ export default {
}, },
selectDataset(row) { selectDataset(row) {
if (row) { if (row) {
const {datasetName, id, tableId} = row const { datasetName, id, tableId } = row
this.$router.push({ this.$router.push({
path: '/task-ds-form', path: '/task-ds-form',
query: { query: {
@ -634,7 +634,7 @@ export default {
) )
}, },
disableExec(task) { disableExec(task) {
return ((task.status === 'Stopped' && task.rate !== 'SIMPLE') || task.status === 'Pending' || task.status ==='Exec' || !hasDataPermission('manage', task.privileges)) return ((task.status === 'Stopped' && task.rate !== 'SIMPLE') || task.status === 'Pending' || task.status === 'Exec' || !hasDataPermission('manage', task.privileges))
}, },
disableDelete(task) { disableDelete(task) {
return false return false