feat: dynamic-dag-sidebar-change (#14244)

This commit is contained in:
pppppjcc 2023-06-19 14:28:53 +08:00 committed by GitHub
parent f840b17cfb
commit 906353bbaf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 172 additions and 100 deletions

View File

@ -14,7 +14,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { useCustomParams, useNamespace, useCustomLabels, useNodeSelectors } from '.'
import {
useCustomParams,
useNamespace,
useCustomLabels,
useNodeSelectors
} from '.'
import type { IJsonItem } from '../types'
import { useI18n } from 'vue-i18n'
@ -75,8 +80,16 @@ export function useK8s(model: { [field: string]: any }): IJsonItem[] {
placeholder: t('project.node.args_tips')
}
},
...useCustomLabels({ model, field: 'customizedLabels', name: 'custom_labels' }),
...useNodeSelectors( { model, field: 'nodeSelectors', name: 'node_selectors' }),
...useCustomLabels({
model,
field: 'customizedLabels',
name: 'custom_labels'
}),
...useNodeSelectors({
model,
field: 'nodeSelectors',
name: 'node_selectors'
}),
...useCustomParams({ model, field: 'localParams', isSimple: true })
]
}

View File

@ -23,7 +23,7 @@ export function useNodeSelectors({
field,
name,
span = 24
}: {
}: {
model: { [field: string]: any }
field: string
name?: string
@ -71,7 +71,7 @@ export function useNodeSelectors({
field: 'operator',
span: 4,
options: OPERATOR_LIST,
value: 'In',
value: 'In'
},
{
type: 'input',

View File

@ -15,9 +15,38 @@
* limitations under the License.
*/
.task-item {
cursor: pointer;
height: 20px;
width: 100px;
border: 1px solid #1890ff;
.sidebar {
}
.draggable {
color: #000;
border: 1px solid #00000040;
display: flex;
align-items: center;
width: 130px;
justify-content: space-around;
border-radius: 5px;
height: 30px;
margin-bottom: 10px;
margin-right: 20px;
}
.fav {
width: 18px;
height: 18px;
}
.draggable {
&:hover {
color: blue;
border: 1px dashed blue;
background-color: #fff;
}
}
.sidebar-icon {
display: block;
width: 18px;
height: 18px;
background-size: 100% 100%;
background-color: #fafafa;
}

View File

@ -18,6 +18,8 @@
import { defineComponent, onMounted, toRefs } from 'vue'
import { useSidebar } from './use-sidebar'
import styles from './dag-sidebar.module.scss'
import { NEllipsis, NIcon } from 'naive-ui'
import { StarFilled, StarOutlined } from '@vicons/antd'
const DagSidebar = defineComponent({
name: 'DagSidebar',
@ -29,26 +31,54 @@ const DagSidebar = defineComponent({
context.emit('Dragstart', task)
}
const handleCollection = () => {}
onMounted(() => {
getTaskList()
})
return {
...toRefs(variables),
handleDragstart
handleDragstart,
handleCollection
}
},
render() {
return (
<div>
<div class={styles.sidebar}>
{this.taskList.map((task: any) => {
return (
<div
class={styles['task-item']}
class={styles['draggable']}
draggable='true'
onDragstart={() => this.handleDragstart(task)}
>
{task.name}
<em
class={styles['sidebar-icon']}
style={{ backgroundImage: task.icon }}
></em>
<NEllipsis style={{ width: '60px' }}>{task.name}</NEllipsis>
<div
class={styles.stars}
onMouseenter={() => {
task.starHover = true
}}
onMouseleave={() => {
task.starHover = false
}}
onClick={() => this.handleCollection()}
>
<div class={styles.fav}>
<NIcon
size='18'
color={
task.collection || task.starHover ? '#288FFF' : '#ccc'
}
>
{task.collection ? <StarFilled /> : <StarOutlined />}
</NIcon>
</div>
</div>
</div>
)
})}