File tree Expand file tree Collapse file tree 2 files changed +49
-4
lines changed
pgmanage/app/static/pgmanage_frontend/src Expand file tree Collapse file tree 2 files changed +49
-4
lines changed Original file line number Diff line number Diff line change 3434 v-html =" tab.icon"
3535 >
3636 </span >
37- <span class =" omnidb__tab-menu__link-name" >
38- <span >{{ tab.name }}</span >
37+ <span
38+ v-if =" tab.name.length > 11"
39+ class =" omnidb__tab-menu__link-name"
40+ :data-content-start =" `${splitStringInHalf(tab.name)[0]}`"
41+ :data-content-end =" `${splitStringInHalf(tab.name)[1]}`"
42+ >
43+ </span >
44+ <span v-else class =" omnidb__tab-menu__link-name" >
45+ {{ tab.name }}
3946 </span >
4047 </span >
4148 <i
@@ -70,6 +77,7 @@ import { colorLabelMap } from "../constants";
7077import WelcomeScreen from " ./WelcomeScreen.vue" ;
7178import SnippetPanel from " ./SnippetPanel.vue" ;
7279import TabsUtils from " ../mixins/tabs_utils_mixin.js" ;
80+ import { splitStringInHalf } from " ../utils.js" ;
7381
7482export default {
7583 name: " SideBarTabs" ,
@@ -114,7 +122,31 @@ export default {
114122 if (connection) {
115123 return colorLabelMap[connection .color_label ].class || ' '
116124 }
117- }
125+ },
126+ splitStringInHalf,
118127 },
119128};
120129< / script>
130+
131+ < style lang= " scss" scoped>
132+ span .omnidb__tab - menu__link- name {
133+ & :: before,
134+ & :: after {
135+ display: inline- block;
136+ max- width: 50 % ;
137+ overflow: hidden;
138+ white- space: pre;
139+ }
140+
141+ & :: before {
142+ content: attr (data- content- start);
143+ text- overflow: ellipsis;
144+ }
145+
146+ & :: after {
147+ content: attr (data- content- end);
148+ text- overflow: clip;
149+ direction: rtl;
150+ }
151+ }
152+ < / style>
Original file line number Diff line number Diff line change @@ -51,4 +51,17 @@ function findChild(node, type) {
5151 return ( node . children || [ ] ) . find ( ( child ) => child . data ?. type === type ) ;
5252}
5353
54- export { truncateText , extractOrderByClause , findChild , findNode } ;
54+ function splitStringInHalf ( str ) {
55+ const middleIndex = Math . ceil ( str . length / 2 ) ;
56+ const firstHalf = str . slice ( 0 , middleIndex ) ;
57+ const secondHalf = str . slice ( middleIndex ) ;
58+ return [ firstHalf , secondHalf ] ;
59+ }
60+
61+ export {
62+ truncateText ,
63+ extractOrderByClause ,
64+ findChild ,
65+ findNode ,
66+ splitStringInHalf ,
67+ } ;
You can’t perform that action at this time.
0 commit comments