Skip to content

Commit 0011d45

Browse files
committed
Merge branch '4.15' into main
2 parents 6581a1b + 8680f7d commit 0011d45

37 files changed

Lines changed: 2035 additions & 69 deletions

ui/public/locales/en.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,7 @@
617617
"label.copy": "Copy",
618618
"label.copy.clipboard": "Copy to clipboard",
619619
"label.copy.text": "Copy Text",
620+
"label.copy.setting.success": "Copy success, Please replace theme setting in public/config.js",
620621
"label.copyid": "Copy ID",
621622
"label.copying.iso": "Copying ISO",
622623
"label.corrections.saved": "Corrections saved",
@@ -669,6 +670,7 @@
669670
"label.daily": "Daily",
670671
"label.dashboard": "Dashboard",
671672
"label.dashboard.endpoint": "Dashboard endpoint",
673+
"label.dark.mode": "Dark mode",
672674
"label.data.disk": "Data Disk",
673675
"label.data.disk.offering": "Data Disk Offering",
674676
"label.date": "Date",
@@ -1831,6 +1833,7 @@
18311833
"label.reservedsystemnetmask": "Reserved system netmask",
18321834
"label.reservedsystemstartip": "Start Reserved system IP",
18331835
"label.reset": "Reset",
1836+
"label.reset.to.default": "Reset to default",
18341837
"label.reset.ssh.key.pair": "Reset SSH Key Pair",
18351838
"label.reset.ssh.key.pair.on.vm": "Reset SSH Key Pair on VM",
18361839
"label.reset.vpn.connection": "Reset VPN connection",
@@ -1902,6 +1905,7 @@
19021905
"label.save.and.continue": "Save and continue",
19031906
"label.save.changes": "Save changes",
19041907
"label.save.new.rule": "Save new Rule",
1908+
"label.save.setting": "Save setting",
19051909
"label.saving.processing": "Saving....",
19061910
"label.scale.vm": "Scale VM",
19071911
"label.scale.up.policy": "SCALE UP POLICY",
@@ -2151,9 +2155,28 @@
21512155
"label.template.select.existing": "Select an existing template",
21522156
"label.tftp.dir": "TFTP Directory",
21532157
"label.tftpdir": "Tftp root directory",
2158+
"label.theme.alert": "The settings panel is only visible in the development environment, please save for the changes to take effect.",
2159+
"label.theme.color": "Theme Color",
2160+
"label.theme.cyan": "Cyan",
2161+
"label.theme.dark": "Dark Style",
2162+
"label.theme.daybreak.blue": "Daybreak Blue",
21542163
"label.theme.default": "Default Theme",
2164+
"label.theme.dust.red": "Dust Red",
2165+
"label.theme.geek.blue": "Geek Blue",
2166+
"label.theme.golden.purple": "Golden Purple",
21552167
"label.theme.grey": "Custom - Grey",
2168+
"label.theme.light": "Light Style",
21562169
"label.theme.lightblue": "Custom - Light Blue",
2170+
"label.theme.navigation.bgColor": "Background Color",
2171+
"label.theme.navigation.setting": "Navigation setting",
2172+
"label.theme.navigation.txtColor": "Text Color",
2173+
"label.theme.page.style.setting": "Page style setting",
2174+
"label.theme.polar.green": "Polar Green",
2175+
"label.theme.project": "Project Style",
2176+
"label.theme.project.navigation.setting": "Project Navigation setting",
2177+
"label.theme.sunset.orange": "Sunset Orange",
2178+
"label.theme.volcano": "Volcano",
2179+
"label.theme.white": "White",
21572180
"label.threshold": "Threshold",
21582181
"label.thursday": "Thursday",
21592182
"label.tier.details": "Tier details",

ui/src/App.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,12 @@ export default {
3636
}
3737
},
3838
created () {
39-
window.less.modifyVars(this.$config.theme)
39+
const userThemeSetting = this.$store.getters.themeSetting || {}
40+
if (Object.keys(userThemeSetting).length === 0) {
41+
window.less.modifyVars(this.$config.theme)
42+
} else {
43+
window.less.modifyVars(userThemeSetting)
44+
}
4045
console.log('config and theme applied')
4146
}
4247
}

ui/src/assets/icons/dark.svg

Lines changed: 39 additions & 0 deletions
Loading

ui/src/assets/icons/light.svg

Lines changed: 40 additions & 0 deletions
Loading

ui/src/components/page/GlobalFooter.vue

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,8 @@ export default {
4949
5050
.line {
5151
margin-bottom: 8px;
52-
53-
a {
54-
color: rgba(0, 0, 0, .45);
55-
56-
&:hover {
57-
color: rgba(0, 0, 0, .65);
58-
}
59-
60-
}
6152
}
6253
.copyright {
63-
color: rgba(0, 0, 0, .45);
6454
font-size: 14px;
6555
}
6656
}

ui/src/components/page/GlobalLayout.vue

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,17 @@
6363
</a-drawer>
6464
</template>
6565

66+
<template>
67+
<drawer :visible="showSetting" placement="right">
68+
<div slot="handler">
69+
<a-button type="primary" size="large">
70+
<a-icon :type="showSetting ? 'close' : 'setting'"/>
71+
</a-button>
72+
</div>
73+
<setting slot="drawer" :visible="showSetting" />
74+
</drawer>
75+
</template>
76+
6677
<a-layout :class="[layoutMode, `content-width-${contentWidth}`]" :style="{ paddingLeft: contentPaddingLeft, minHeight: '100vh' }">
6778
<!-- layout header -->
6879
<global-header
@@ -94,19 +105,24 @@ import GlobalFooter from '@/components/page/GlobalFooter'
94105
import { triggerWindowResizeEvent } from '@/utils/util'
95106
import { mapState, mapActions } from 'vuex'
96107
import { mixin, mixinDevice } from '@/utils/mixin.js'
108+
import Drawer from '@/components/widgets/Drawer'
109+
import Setting from '@/components/view/Setting.vue'
97110
98111
export default {
99112
name: 'GlobalLayout',
100113
components: {
101114
SideMenu,
102115
GlobalHeader,
103-
GlobalFooter
116+
GlobalFooter,
117+
Drawer,
118+
Setting
104119
},
105120
mixins: [mixin, mixinDevice],
106121
data () {
107122
return {
108123
collapsed: false,
109-
menus: []
124+
menus: [],
125+
showSetting: false
110126
}
111127
},
112128
computed: {
@@ -129,13 +145,28 @@ export default {
129145
},
130146
mainMenu (newMenu) {
131147
this.menus = newMenu.find((item) => item.path === '/').children
148+
},
149+
'$store.getters.darkMode' (darkMode) {
150+
if (darkMode) {
151+
document.body.classList.add('dark-mode')
152+
} else {
153+
document.body.classList.remove('dark-mode')
154+
}
155+
}
156+
},
157+
provide: function () {
158+
return {
159+
parentToggleSetting: this.toggleSetting
132160
}
133161
},
134162
created () {
135163
this.menus = this.mainMenu.find((item) => item.path === '/').children
136164
this.collapsed = !this.sidebarOpened
137165
},
138166
mounted () {
167+
if (this.$store.getters.darkMode) {
168+
document.body.classList.add('dark-mode')
169+
}
139170
const userAgent = navigator.userAgent
140171
if (userAgent.indexOf('Edge') > -1) {
141172
this.$nextTick(() => {
@@ -146,6 +177,9 @@ export default {
146177
})
147178
}
148179
},
180+
beforeDestroy () {
181+
document.body.classList.remove('dark')
182+
},
149183
methods: {
150184
...mapActions(['setSidebar']),
151185
toggle () {
@@ -166,6 +200,9 @@ export default {
166200
if (!this.isDesktop()) {
167201
this.collapsed = false
168202
}
203+
},
204+
toggleSetting (showSetting) {
205+
this.showSetting = showSetting
169206
}
170207
}
171208
}

ui/src/components/view/DetailSettings.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,11 @@
4444
:dataSource="Object.keys(detailOptions)"
4545
:placeholder="$t('label.name')"
4646
@change="e => onAddInputChange(e, 'newKey')" />
47-
<a-input style=" width: 30px; border-left: 0; pointer-events: none; backgroundColor: #fff" placeholder="=" disabled />
47+
<a-input
48+
class="tag-disabled-input"
49+
style=" width: 30px; border-left: 0; pointer-events: none; text-align: center"
50+
placeholder="="
51+
disabled />
4852
<a-auto-complete
4953
class="detail-input"
5054
:filterOption="filterOption"

ui/src/components/view/InfoCard.vue

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -632,13 +632,21 @@
632632
@keyup.enter="handleInputConfirm"
633633
compact>
634634
<a-input ref="input" :value="inputKey" @change="handleKeyChange" style="width: 30%; text-align: center" :placeholder="$t('label.key')" />
635-
<a-input style=" width: 30px; border-left: 0; pointer-events: none; backgroundColor: #fff" placeholder="=" disabled />
635+
<a-input
636+
class="tag-disabled-input"
637+
style="width: 30px; border-left: 0; pointer-events: none; text-align: center"
638+
placeholder="="
639+
disabled />
636640
<a-input :value="inputValue" @change="handleValueChange" style="width: 30%; text-align: center; border-left: 0" :placeholder="$t('label.value')" />
637641
<tooltip-button :tooltip="$t('label.ok')" icon="check" size="small" @click="handleInputConfirm" />
638642
<tooltip-button :tooltip="$t('label.cancel')" icon="close" size="small" @click="inputVisible=false" />
639643
</a-input-group>
640644
</div>
641-
<a-tag @click="showInput" style="background: #fff; borderStyle: dashed;" v-else-if="isAdminOrOwner() && 'createTags' in $store.getters.apis">
645+
<a-tag
646+
@click="showInput"
647+
class="btn-add-tag"
648+
style="borderStyle: dashed;"
649+
v-else-if="isAdminOrOwner() && 'createTags' in $store.getters.apis">
642650
<a-icon type="plus" /> {{ $t('label.new.tag') }}
643651
</a-tag>
644652
</div>

ui/src/components/view/ListView.vue

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -604,14 +604,6 @@ export default {
604604
/deep/ .ant-table-small > .ant-table-content > .ant-table-body {
605605
margin: 0;
606606
}
607-
608-
/deep/ .light-row {
609-
background-color: #fff;
610-
}
611-
612-
/deep/ .dark-row {
613-
background-color: #f9f9f9;
614-
}
615607
</style>
616608

617609
<style scoped lang="scss">

ui/src/components/view/SearchView.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,11 @@
7474
size="small"
7575
compact>
7676
<a-input ref="input" :value="inputKey" @change="e => inputKey = e.target.value" style="width: 50px; text-align: center" :placeholder="$t('label.key')" />
77-
<a-input style=" width: 20px; border-left: 0; pointer-events: none; backgroundColor: #fff" placeholder="=" disabled />
77+
<a-input
78+
class="tag-disabled-input"
79+
style=" width: 20px; border-left: 0; pointer-events: none; text-align: center"
80+
placeholder="="
81+
disabled />
7882
<a-input :value="inputValue" @change="handleValueChange" style="width: 50px; text-align: center; border-left: 0" :placeholder="$t('label.value')" />
7983
<tooltip-button :tooltip="$t('label.clear')" icon="close" size="small" @click="inputKey = inputValue = ''" />
8084
</a-input-group>

0 commit comments

Comments
 (0)