Skip to content

Commit 63e6173

Browse files
components: styling and placement refactoring
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
1 parent d039366 commit 63e6173

File tree

8 files changed

+139
-184
lines changed

8 files changed

+139
-184
lines changed

ui/src/components/header/ProjectMenu.vue

Lines changed: 18 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -16,49 +16,27 @@
1616
// under the License.
1717

1818
<template>
19-
<a-popover
20-
class="project"
21-
v-model="visible"
22-
trigger="click"
23-
placement="bottom"
24-
:autoAdjustOverflow="true"
25-
:arrowPointAtCenter="true">
26-
<template slot="content">
27-
<a-menu style="margin: -12px -16px">
28-
<a-menu-item>
29-
<a-icon class="project-icon" type="login" />
30-
<a-select
31-
class="project-select"
32-
size="default"
33-
defaultValue="Default View"
34-
:value="selectedProject"
35-
:disabled="isDisabled()"
36-
:filterOption="filterProject"
37-
@change="changeProject"
38-
showSearch>
39-
<a-select-option v-for="(project, index) in projects" :key="index">
40-
{{ project.displaytext || project.name }}
41-
</a-select-option>
42-
</a-select>
43-
</a-menu-item>
44-
<a-menu-item>
45-
<router-link :to="{ path: '/project' }">
46-
<a-icon class="project-icon" type="project" />
47-
{{ $t('Projects') }}
48-
</router-link>
49-
</a-menu-item>
50-
</a-menu>
51-
</template>
52-
<span @click="visible = !visible" class="header-notice-opener">
53-
<a-icon class="project-icon" type="project" />
54-
</span>
55-
</a-popover>
19+
<span class="header-notice-opener">
20+
<a-select
21+
class="project-select"
22+
defaultValue="Default View"
23+
:value="selectedProject"
24+
:disabled="isDisabled()"
25+
:filterOption="filterProject"
26+
@change="changeProject"
27+
showSearch>
28+
<a-icon slot="suffixIcon" style="font-size:14px" type="project" />
29+
<a-select-option v-for="(project, index) in projects" :key="index">
30+
{{ project.displaytext || project.name }}
31+
</a-select-option>
32+
</a-select>
33+
</span>
5634
</template>
5735

5836
<script>
5937
import Vue from 'vue'
60-
import { api } from '@/api'
6138
import store from '@/store'
39+
import { api } from '@/api'
6240
import { CURRENT_PROJECT } from '@/store/mutation-types'
6341
6442
export default {
@@ -73,8 +51,6 @@ export default {
7351
mounted () {
7452
this.fetchData()
7553
},
76-
computed: {
77-
},
7854
methods: {
7955
fetchData () {
8056
if (this.isDisabled()) {
@@ -130,11 +106,11 @@ export default {
130106
<style lang="less" scoped>
131107
.project {
132108
&-select {
133-
width: 200px;
109+
width: 40%;
134110
}
135111
136112
&-icon {
137-
font-size: 18px;
113+
font-size: 20px;
138114
line-height: 1;
139115
padding-top: 5px;
140116
padding-right: 5px;

ui/src/components/header/UserMenu.vue

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
<template>
1919
<div class="user-menu">
2020

21-
<project-menu class="action"/>
2221
<translation-menu class="action"/>
2322
<header-notice class="action"/>
2423
<a-dropdown>
@@ -60,14 +59,12 @@
6059
<script>
6160
import config from '@/config/settings'
6261
import HeaderNotice from './HeaderNotice'
63-
import ProjectMenu from './ProjectMenu'
6462
import TranslationMenu from './TranslationMenu'
6563
import { mapActions, mapGetters } from 'vuex'
6664
6765
export default {
6866
name: 'UserMenu',
6967
components: {
70-
ProjectMenu,
7168
TranslationMenu,
7269
HeaderNotice
7370
},

ui/src/components/page/GlobalHeader.vue

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
class="trigger"
2929
:type="collapsed ? 'menu-unfold' : 'menu-fold'"
3030
@click="toggle"/>
31-
<breadcrumb v-if="device !== 'mobile'" />
31+
<project-menu v-if="device !== 'mobile'" />
3232
<user-menu></user-menu>
3333
</div>
3434
<div v-else :class="['top-nav-header-index', theme]">
@@ -47,8 +47,8 @@
4747
:type="collapsed ? 'menu-fold' : 'menu-unfold'"
4848
@click="toggle"></a-icon>
4949
</div>
50-
<breadcrumb v-if="device !== 'mobile'" />
51-
<user-menu class="header-index-right"></user-menu>
50+
<project-menu v-if="device !== 'mobile'" />
51+
<user-menu></user-menu>
5252
</div>
5353
</div>
5454

@@ -59,6 +59,7 @@
5959
import Breadcrumb from '@/components/widgets/Breadcrumb'
6060
import Logo from '../header/Logo'
6161
import SMenu from '../menu/'
62+
import ProjectMenu from '../header/ProjectMenu'
6263
import UserMenu from '../header/UserMenu'
6364
6465
import { mixin } from '@/utils/mixin.js'
@@ -69,6 +70,7 @@ export default {
6970
Breadcrumb,
7071
Logo,
7172
SMenu,
73+
ProjectMenu,
7274
UserMenu
7375
},
7476
mixins: [mixin],

ui/src/components/view/DetailSettings.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
<a-icon type="check-circle" theme="twoTone" twoToneColor="#52c41a" style="font-size: 24px"/>
5353
</a-button>
5454
<a-button shape="circle" size="small" @click="hideEditDetail(index)" style="margin: 2px">
55-
<a-icon type="close-circle" theme="twoTone" twoToneColor="#eb2f96" style="font-size: 24px"/>
55+
<a-icon type="close-circle" theme="twoTone" twoToneColor="#f5222d" style="font-size: 24px"/>
5656
</a-button>
5757
</span>
5858
<span v-else>{{ item.value }}</span>

ui/src/components/widgets/Breadcrumb.vue

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,25 @@
2727
</router-link>
2828
<span v-else-if="$route.params.id">
2929
{{ $route.params.id }}
30-
<a-button shape="circle" type="dashed" size="small" v-clipboard:copy="$route.params.id">
31-
<a-icon type="copy" style="margin-left: -1px; margin-top: 1px"/>
32-
</a-button>
3330
</span>
34-
<span v-else>{{ $t(item.meta.title) }}</span>
31+
<span v-else>
32+
{{ $t(item.meta.title) }}
33+
</span>
34+
<a-tooltip v-if="index === (breadList.length - 1)" placement="bottom">
35+
<template slot="title">
36+
{{ "Refresh" }}
37+
</template>
38+
<a-button
39+
shape="circle"
40+
style="margin-left: 8px"
41+
@click="$emit('refresh')" >
42+
<a-icon
43+
type="reload"
44+
style="margin-left: 0px"
45+
@click="$emit('refresh')"
46+
/>
47+
</a-button>
48+
</a-tooltip>
3549
</a-breadcrumb-item>
3650
</a-breadcrumb>
3751
</template>

ui/src/layouts/ResourceLayout.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
// under the License.
1717

1818
<template>
19-
<div style="padding-top: 12px" class="page-header-index-wide page-header-wrapper-grid-content-main">
19+
<div class="page-header-index-wide page-header-wrapper-grid-content-main">
2020
<a-row :gutter="12">
2121
<a-col :md="24" :lg="9" style="margin-bottom: 12px">
2222
<slot name="left">

ui/src/views/AutogenView.vue

Lines changed: 62 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -17,93 +17,67 @@
1717

1818
<template>
1919
<div>
20-
<a-card class="mobile-breadcrumb" v-if="device === 'mobile'">
21-
<breadcrumb />
22-
</a-card>
23-
<a-row>
24-
<a-col :span="18">
25-
<span
26-
v-for="(action, actionIndex) in actions"
27-
:key="actionIndex">
28-
<a-tooltip
29-
placement="bottom"
30-
v-if="action.api in $store.getters.apis &&
31-
((!dataView && (action.listView || action.groupAction && selectedRowKeys.length > 0)) ||
32-
(dataView && action.dataView && ('show' in action ? action.show(resource) : true)))">
33-
<template slot="title">
34-
{{ $t(action.label) }}
35-
</template>
36-
<a-button
37-
:icon="action.icon"
38-
:type="action.icon === 'delete' ? 'danger' : (action.icon === 'plus' ? 'primary' : 'default')"
39-
shape="circle"
40-
style="margin-right: 5px"
41-
@click="execAction(action)"
42-
>
43-
</a-button>
44-
</a-tooltip>
45-
</span>
46-
<span v-if="!dataView" style="float: right; padding-right: 8px; margin-top: -2px">
47-
<a-tooltip placement="bottom">
48-
<template slot="title">
49-
{{ "Auto-Refresh" }}
50-
</template>
51-
<a-switch
52-
style="margin: 8px;"
53-
:loading="loading"
54-
:checked="autoRefresh"
55-
@change="toggleAutoRefresh"
56-
/>
57-
</a-tooltip>
58-
<a-tooltip placement="bottom">
59-
<template slot="title">
60-
{{ "Refresh" }}
61-
</template>
62-
<a-button
63-
@click="fetchData()"
64-
:loading="loading"
65-
shape="circle"
66-
icon="reload"
67-
/>
68-
</a-tooltip>
69-
</span>
70-
</a-col>
71-
<a-col :span="6">
72-
<a-tooltip placement="bottom" v-if="dataView">
73-
<template slot="title">
74-
{{ "Refresh" }}
75-
</template>
76-
<a-button
77-
style="float: right"
78-
@click="fetchData()"
79-
:loading="loading"
80-
shape="circle"
81-
icon="reload"
82-
/>
83-
</a-tooltip>
84-
<a-tooltip placement="bottom" v-if="dataView">
85-
<template slot="title">
86-
{{ "Auto-Refresh" }}
87-
</template>
88-
<a-switch
89-
v-if="dataView"
90-
style="float: right; margin: 5px;"
91-
:loading="loading"
92-
:checked="autoRefresh"
93-
@change="toggleAutoRefresh"
94-
/>
95-
</a-tooltip>
20+
<a-card class="mobile-breadcrumb">
21+
<a-row>
22+
<a-col :span="24" style="display: inline-flex">
23+
<breadcrumb style="margin-right: 10px; width: 100%" @refresh="fetchData()" />
24+
<span
25+
v-for="(action, actionIndex) in actions"
26+
:key="actionIndex">
27+
<a-tooltip
28+
placement="bottom"
29+
v-if="action.api in $store.getters.apis &&
30+
((!dataView && (action.listView || action.groupAction && selectedRowKeys.length > 0)) ||
31+
(dataView && action.dataView && ('show' in action ? action.show(resource) : true)))">
32+
<template slot="title">
33+
{{ $t(action.label) }}
34+
</template>
35+
<a-button
36+
:icon="action.icon"
37+
:type="action.icon === 'delete' ? 'danger' : (action.icon === 'plus' ? 'primary' : 'default')"
38+
shape="circle"
39+
style="margin-right: 5px"
40+
@click="execAction(action)"
41+
>
42+
</a-button>
43+
</a-tooltip>
44+
</span>
9645

97-
<a-input-search
98-
size="default"
99-
placeholder="Search"
100-
v-model="searchQuery"
101-
v-if="!dataView"
102-
@search="onSearch"
103-
>
104-
</a-input-search>
105-
</a-col>
106-
</a-row>
46+
<a-input-search
47+
style="width: 100%; padding-left: 5px"
48+
size="default"
49+
placeholder="Search"
50+
v-model="searchQuery"
51+
v-if="!dataView"
52+
@search="onSearch"
53+
>
54+
</a-input-search>
55+
</a-col>
56+
<a-col :span="24" v-if="false">
57+
<span
58+
v-for="(action, actionIndex) in actions"
59+
:key="actionIndex">
60+
<a-tooltip
61+
placement="bottom"
62+
v-if="action.api in $store.getters.apis &&
63+
((!dataView && (action.listView || action.groupAction && selectedRowKeys.length > 0)) ||
64+
(dataView && action.dataView && ('show' in action ? action.show(resource) : true)))">
65+
<template slot="title">
66+
{{ $t(action.label) }}
67+
</template>
68+
<a-button
69+
:icon="action.icon"
70+
:type="action.icon === 'delete' ? 'danger' : (action.icon === 'plus' ? 'primary' : 'default')"
71+
shape="circle"
72+
style="margin-right: 5px"
73+
@click="execAction(action)"
74+
>
75+
</a-button>
76+
</a-tooltip>
77+
</span>
78+
</a-col>
79+
</a-row>
80+
</a-card>
10781

10882
<div v-show="showAction">
10983
<keep-alive v-if="currentAction.component">
@@ -244,7 +218,6 @@ export default {
244218
return {
245219
apiName: '',
246220
loading: false,
247-
autoRefresh: false,
248221
columns: [],
249222
items: [],
250223
itemCount: 0,
@@ -418,21 +391,6 @@ export default {
418391
this.searchQuery = value
419392
this.fetchData()
420393
},
421-
toggleAutoRefresh () {
422-
this.autoRefresh = !this.autoRefresh
423-
this.doRefresh()
424-
},
425-
doRefresh () {
426-
if (!this.autoRefresh) {
427-
return
428-
}
429-
const doRefresh = this.doRefresh
430-
const fetchData = this.fetchData
431-
setTimeout(function () {
432-
fetchData()
433-
doRefresh()
434-
}, 5000)
435-
},
436394
closeAction () {
437395
this.currentAction.loading = false
438396
this.showAction = false
@@ -626,8 +584,8 @@ export default {
626584
<style scoped>
627585
628586
.mobile-breadcrumb {
629-
margin-left: -16px;
630-
margin-right: -16px;
587+
margin-left: -24px;
588+
margin-right: -24px;
631589
margin-top: -16px;
632590
margin-bottom: 12px;
633591
}

0 commit comments

Comments
 (0)