@steedos/ee_branding 2.2.52-beta.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,11 @@
1
+ <!--
2
+ * @Author: sunhaolin@hotoa.com
3
+ * @Date: 2022-07-01 13:18:46
4
+ * @LastEditors: sunhaolin@hotoa.com
5
+ * @LastEditTime: 2022-07-01 13:19:34
6
+ * @Description:
7
+ -->
8
+
9
+ # branding 品牌
10
+
11
+ 企业版,工作区自定义品牌相关设置
@@ -0,0 +1,38 @@
1
+ /*
2
+ * @Author: sunhaolin@hotoa.com
3
+ * @Date: 2022-07-01 14:07:26
4
+ * @LastEditors: sunhaolin@hotoa.com
5
+ * @LastEditTime: 2022-07-01 14:30:18
6
+ * @Description:
7
+ */
8
+ 'use strict'
9
+
10
+ const { isPlatformEnterPrise } = require('@steedos/license')
11
+ const LOGO_FIELDS = ['account_logo', 'avatar_dark', 'avatar_square', 'avatar', 'background', 'favicon']
12
+
13
+ /**
14
+ * 只有企业版才能更改Logo
15
+ * @param {*} triggerContext
16
+ */
17
+ async function checkIsEnterprise(triggerContext) {
18
+ const { doc, spaceId } = triggerContext;
19
+ if (spaceId) {
20
+ let needToCheck = false
21
+ for (const fieldName of LOGO_FIELDS) {
22
+ if (doc[fieldName]) {
23
+ needToCheck = true
24
+ break
25
+ }
26
+ }
27
+ if (needToCheck) {
28
+ const allow = await isPlatformEnterPrise(spaceId)
29
+ if (!allow) {
30
+ throw new Error('need_platfrom_enterprise');
31
+ }
32
+ }
33
+ }
34
+ }
35
+
36
+ module.exports = {
37
+ checkIsEnterprise
38
+ }
@@ -0,0 +1,30 @@
1
+ name: spaces
2
+ fields:
3
+ avatar:
4
+ label: Logo
5
+ help:
6
+ description:
7
+ avatar_square:
8
+ label: Square Logo
9
+ help:
10
+ description:
11
+ avatar_dark:
12
+ label: Dark Logo
13
+ help:
14
+ description:
15
+ account_logo:
16
+ label: Account logo
17
+ help:
18
+ description:
19
+ background:
20
+ label: Background
21
+ help:
22
+ description:
23
+ favicon:
24
+ label: Favicon
25
+ help:
26
+ description:
27
+ groups:
28
+ branding: Branding
29
+ CustomLabels:
30
+ need_platfrom_enterprise: Only the enterprise version can change the logo
@@ -0,0 +1,30 @@
1
+ name: spaces
2
+ fields:
3
+ avatar:
4
+ label: Logo
5
+ help:
6
+ description:
7
+ avatar_square:
8
+ label: 正方形Logo
9
+ help:
10
+ description:
11
+ avatar_dark:
12
+ label: 深色Logo
13
+ help:
14
+ description:
15
+ account_logo:
16
+ label: 登录页Logo
17
+ help:
18
+ description:
19
+ background:
20
+ label: 登录页背景图
21
+ help:
22
+ description:
23
+ favicon:
24
+ label: 浏览器标签页图标
25
+ help:
26
+ description:
27
+ groups:
28
+ branding: 自定义品牌
29
+ CustomLabels:
30
+ need_platfrom_enterprise: 只有企业版才能更改Logo
@@ -0,0 +1,4 @@
1
+ name: account_logo
2
+ label: Account logo
3
+ type: avatar
4
+ group: branding
@@ -0,0 +1,4 @@
1
+ name: avatar
2
+ label: Logo
3
+ type: avatar
4
+ group: branding
@@ -0,0 +1,6 @@
1
+ # avatar_dark旧版本的wokflow中在用,所以隐藏掉,暂时不能删除
2
+ name: avatar_dark
3
+ label: Dark Logo
4
+ type: avatar
5
+ hidden: true
6
+ group: branding
@@ -0,0 +1,5 @@
1
+ name: avatar_square
2
+ label: Square Logo
3
+ type: avatar
4
+ hidden: true
5
+ group: branding
@@ -0,0 +1,4 @@
1
+ name: background
2
+ label: Background
3
+ type: avatar
4
+ group: branding
@@ -0,0 +1,5 @@
1
+ # 后续用于自定义浏览器图标
2
+ name: favicon
3
+ label: Favicon
4
+ type: avatar
5
+ group: branding
@@ -0,0 +1,2 @@
1
+ extend: spaces
2
+ name: spaces
@@ -0,0 +1,23 @@
1
+ /*
2
+ * @Author: sunhaolin@hotoa.com
3
+ * @Date: 2022-07-01 14:05:45
4
+ * @LastEditors: sunhaolin@hotoa.com
5
+ * @LastEditTime: 2022-07-01 14:40:48
6
+ * @Description:
7
+ */
8
+
9
+ const {
10
+ checkIsEnterprise
11
+ } = require('../manager/spaces')
12
+
13
+ module.exports = {
14
+ listenTo: "spaces",
15
+
16
+ beforeInsert: async function () {
17
+ await checkIsEnterprise(this)
18
+ },
19
+
20
+ beforeUpdate: async function () {
21
+ await checkIsEnterprise(this)
22
+ }
23
+ }
package/package.json ADDED
@@ -0,0 +1,14 @@
1
+ {
2
+ "name": "@steedos/ee_branding",
3
+ "version": "2.2.52-beta.22",
4
+ "main": "package.service.js",
5
+ "scripts": {},
6
+ "license": "MIT",
7
+ "private": false,
8
+ "publishConfig": {
9
+ "access": "public"
10
+ },
11
+ "dependencies": {
12
+ "@steedos/license": "2.2.5"
13
+ }
14
+ }
@@ -0,0 +1,80 @@
1
+ /*
2
+ * @Author: sunhaolin@hotoa.com
3
+ * @Date: 2022-05-03 10:29:51
4
+ * @LastEditors: sunhaolin@hotoa.com
5
+ * @LastEditTime: 2022-07-01 13:20:01
6
+ * @Description:
7
+ */
8
+ "use strict";
9
+ const project = require('./package.json');
10
+ const packageName = project.name;
11
+ const packageLoader = require('@steedos/service-package-loader');
12
+
13
+ /**
14
+ * @typedef {import('moleculer').Context} Context Moleculer's Context
15
+ */
16
+ module.exports = {
17
+ name: packageName,
18
+ namespace: "steedos",
19
+ mixins: [packageLoader],
20
+ /**
21
+ * Settings
22
+ */
23
+ settings: {
24
+ packageInfo: {
25
+ path: __dirname,
26
+ name: packageName
27
+ },
28
+ },
29
+
30
+ /**
31
+ * Dependencies
32
+ */
33
+ dependencies: ['~packages-standard-objects'],
34
+
35
+ /**
36
+ * Actions
37
+ */
38
+ actions: {
39
+
40
+ },
41
+
42
+ /**
43
+ * Events
44
+ */
45
+ events: {
46
+
47
+ },
48
+
49
+ /**
50
+ * Methods
51
+ */
52
+ methods: {
53
+
54
+ },
55
+
56
+ merged(schema) {
57
+
58
+ },
59
+
60
+ /**
61
+ * Service created lifecycle event handler
62
+ */
63
+ async created() {
64
+
65
+ },
66
+
67
+ /**
68
+ * Service started lifecycle event handler
69
+ */
70
+ async started() {
71
+
72
+ },
73
+
74
+ /**
75
+ * Service stopped lifecycle event handler
76
+ */
77
+ async stopped() {
78
+
79
+ }
80
+ };