This is an automated email from the ASF dual-hosted git repository.

songjian pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git


The following commit(s) were added to refs/heads/dev by this push:
     new 05308ccfe6 feat: Added global trim method (#10975)
05308ccfe6 is described below

commit 05308ccfe6ebbe25eae95e332e6928fa4ea50b37
Author: labbomb <[email protected]>
AuthorDate: Thu Jul 14 20:44:41 2022 +0800

    feat: Added global trim method (#10975)
---
 dolphinscheduler-ui/src/main.ts                    |  2 ++
 dolphinscheduler-ui/src/{main.ts => utils/trim.ts} | 25 ++++------------------
 2 files changed, 6 insertions(+), 21 deletions(-)

diff --git a/dolphinscheduler-ui/src/main.ts b/dolphinscheduler-ui/src/main.ts
index a346c65655..5d3b31e3c6 100644
--- a/dolphinscheduler-ui/src/main.ts
+++ b/dolphinscheduler-ui/src/main.ts
@@ -25,6 +25,7 @@ import * as echarts from 'echarts'
 import 'echarts/theme/macarons'
 import 'echarts/theme/dark-bold'
 import './assets/styles/default.scss'
+import trim from './utils/trim'
 
 const app = createApp(App)
 const pinia = createPinia()
@@ -32,6 +33,7 @@ const pinia = createPinia()
 pinia.use(piniaPluginPersistedstate)
 
 app.config.globalProperties.echarts = echarts
+app.config.globalProperties.trim = trim
 
 app.use(router)
 app.use(pinia)
diff --git a/dolphinscheduler-ui/src/main.ts 
b/dolphinscheduler-ui/src/utils/trim.ts
similarity index 58%
copy from dolphinscheduler-ui/src/main.ts
copy to dolphinscheduler-ui/src/utils/trim.ts
index a346c65655..d7f731bcd2 100644
--- a/dolphinscheduler-ui/src/main.ts
+++ b/dolphinscheduler-ui/src/utils/trim.ts
@@ -15,25 +15,8 @@
  * limitations under the License.
  */
 
-import { createApp } from 'vue'
-import App from './App'
-import router from './router'
-import { createPinia } from 'pinia'
-import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'
-import i18n from '@/locales'
-import * as echarts from 'echarts'
-import 'echarts/theme/macarons'
-import 'echarts/theme/dark-bold'
-import './assets/styles/default.scss'
+const trim = (value: string) => {
+  return !value.startsWith(' ') && !value.endsWith(' ')
+}
 
-const app = createApp(App)
-const pinia = createPinia()
-
-pinia.use(piniaPluginPersistedstate)
-
-app.config.globalProperties.echarts = echarts
-
-app.use(router)
-app.use(pinia)
-app.use(i18n)
-app.mount('#app')
+export default trim

Reply via email to