Skip to content

Commit ae60ab3

Browse files
Improve support worksapce (hcengineering#6360)
Signed-off-by: Kristina Fefelova <[email protected]>
1 parent 0fe88a8 commit ae60ab3

File tree

57 files changed

+1140
-425
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+1140
-425
lines changed

Diff for: .vscode/launch.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@
351351
"request": "launch",
352352
"args": ["src/index.ts"],
353353
"env": {
354-
"PORT": "4077",
354+
"PORT": "4007",
355355
"SECRET": "secret",
356356
"MONGO_URL": "mongodb://localhost:27017",
357357
"MINIO_ENDPOINT": "localhost",

Diff for: common/config/rush/pnpm-lock.yaml

+59-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: desktop/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@
200200
"@hcengineering/products-resources": "^0.1.0",
201201
"@hcengineering/analytics-collector": "^0.6.0",
202202
"@hcengineering/analytics-collector-assets": "^0.6.0",
203+
"@hcengineering/analytics-collector-resources": "^0.6.0",
203204
"electron-squirrel-startup": "~1.0.0",
204205
"dotenv": "~16.0.0",
205206
"electron-context-menu": "^4.0.1",

Diff for: desktop/src/ui/platform.ts

+1
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ export async function configurePlatform (): Promise<void> {
274274
addLocation(notificationId, async () => await import('@hcengineering/notification-resources'))
275275
addLocation(tagsId, async () => await import('@hcengineering/tags-resources'))
276276
addLocation(calendarId, async () => await import('@hcengineering/calendar-resources'))
277+
addLocation(analyticsCollectorId, async () => await import('@hcengineering/analytics-collector-resources'))
277278

278279
addLocation(trackerId, async () => await import('@hcengineering/tracker-resources'))
279280
addLocation(boardId, async () => await import('@hcengineering/board-resources'))

Diff for: dev/docker-compose.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ services:
110110
- GITHUB_URL=http://localhost:3500
111111
- PRINT_URL=http://localhost:4005
112112
- SIGN_URL=http://localhost:4006
113-
- ANALYTICS_COLLECTOR_URL=http://localhost:4077
113+
- ANALYTICS_COLLECTOR_URL=http://localhost:4007
114114
- DESKTOP_UPDATES_URL=https://dist.huly.io
115115
- DESKTOP_UPDATES_CHANNEL=dev
116116
- BRANDING_URL=http://localhost:8087/branding.json
@@ -200,7 +200,7 @@ services:
200200
image: hardcoreeng/analytics-collector
201201
restart: unless-stopped
202202
ports:
203-
- 4077:4007
203+
- 4007:4007
204204
environment:
205205
- SECRET=secret
206206
- PORT=4007

Diff for: dev/local-mongo/docker-compose.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ services:
9797
- GITHUB_URL=http://localhost:3500
9898
- PRINT_URL=http://localhost:4005
9999
- SIGN_URL=http://localhost:4006
100-
- ANALYTICS_COLLECTOR_URL=http://localhost:4077
100+
- ANALYTICS_COLLECTOR_URL=http://localhost:4007
101101
- DESKTOP_UPDATES_URL=https://dist.huly.io
102102
- DESKTOP_UPDATES_CHANNEL=dev
103103
- BRANDING_URL=http://localhost:8087/branding.json
@@ -187,7 +187,7 @@ services:
187187
image: hardcoreeng/analytics-collector
188188
restart: unless-stopped
189189
ports:
190-
- 4077:4007
190+
- 4007:4007
191191
environment:
192192
- SECRET=secret
193193
- PORT=4007

Diff for: dev/prod/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@
216216
"@hcengineering/uploader-resources": "^0.6.0",
217217
"@hcengineering/analytics-collector": "^0.6.0",
218218
"@hcengineering/analytics-collector-assets": "^0.6.0",
219+
"@hcengineering/analytics-collector-resources": "^0.6.0",
219220
"@hcengineering/controlled-documents": "^0.1.0",
220221
"@hcengineering/controlled-documents-assets": "^0.1.0",
221222
"@hcengineering/controlled-documents-resources": "^0.1.0",

Diff for: dev/prod/public/config.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"LAST_NAME_FIRST": "true",
1313
"PRINT_URL": "http://localhost:4005",
1414
"SIGN_URL": "http://localhost:4006",
15-
"ANALYTICS_COLLECTOR_URL": "http://localhost:4077",
15+
"ANALYTICS_COLLECTOR_URL": "http://localhost:4007",
1616
"BRANDING_URL": "/branding.json",
1717
"VERSION": null,
1818
"MODEL_VERSION": null

Diff for: dev/prod/src/platform.ts

+1
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,7 @@ export async function configurePlatform() {
364364
addLocation(diffviewId, () => import(/* webpackChunkName: "diffview" */ '@hcengineering/diffview-resources'))
365365
addLocation(timeId, () => import(/* webpackChunkName: "time" */ '@hcengineering/time-resources'))
366366
addLocation(desktopPreferencesId, () => import(/* webpackChunkName: "desktop-preferences" */ '@hcengineering/desktop-preferences-resources'))
367+
addLocation(analyticsCollectorId, async () => await import('@hcengineering/analytics-collector-resources'))
367368

368369
addLocation(trackerId, () => import(/* webpackChunkName: "tracker" */ '@hcengineering/tracker-resources'))
369370
addLocation(boardId, () => import(/* webpackChunkName: "board" */ '@hcengineering/board-resources'))

Diff for: models/all/src/index.ts

+11-1
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,17 @@ export default function buildModel (enabled: string[] = ['*'], disabled: string[
249249
[uploaderModel, uploaderId],
250250
[notificationModel, notificationId],
251251
[preferenceModel, preferenceId],
252+
[
253+
analyticsCollectorModel,
254+
analyticsCollectorId,
255+
{
256+
label: inventory.string.ConfigLabel,
257+
description: inventory.string.ConfigDescription,
258+
enabled: false,
259+
beta: false,
260+
classFilter: defaultFilter
261+
}
262+
],
252263
[
253264
hrModel,
254265
hrId,
@@ -348,7 +359,6 @@ export default function buildModel (enabled: string[] = ['*'], disabled: string[
348359
}
349360
],
350361
[printModel, printId],
351-
[analyticsCollectorModel, analyticsCollectorId],
352362
[driveModel, driveId],
353363
[
354364
documentsModel,

Diff for: models/analytics-collector/package.json

+4-3
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,19 @@
2828
"typescript": "^5.3.3"
2929
},
3030
"dependencies": {
31+
"@hcengineering/activity": "^0.6.0",
32+
"@hcengineering/analytics-collector": "^0.6.0",
3133
"@hcengineering/attachment": "^0.6.14",
3234
"@hcengineering/chunter": "^0.6.20",
3335
"@hcengineering/core": "^0.6.32",
3436
"@hcengineering/model": "^0.6.11",
3537
"@hcengineering/model-activity": "^0.6.0",
36-
"@hcengineering/model-notification": "^0.6.0",
3738
"@hcengineering/model-chunter": "^0.6.0",
3839
"@hcengineering/model-core": "^0.6.0",
40+
"@hcengineering/model-notification": "^0.6.0",
3941
"@hcengineering/model-view": "^0.6.0",
4042
"@hcengineering/platform": "^0.6.11",
4143
"@hcengineering/ui": "^0.6.15",
42-
"@hcengineering/view": "^0.6.13",
43-
"@hcengineering/analytics-collector": "^0.6.0"
44+
"@hcengineering/view": "^0.6.13"
4445
}
4546
}

Diff for: models/analytics-collector/src/index.ts

+63-7
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,79 @@
1313
// limitations under the License.
1414
//
1515

16-
import { type Builder, Mixin } from '@hcengineering/model'
17-
import { type AnalyticsChannel } from '@hcengineering/analytics-collector'
16+
import { type Builder, Model, Prop, ReadOnly, TypeString, UX } from '@hcengineering/model'
17+
import { type OnboardingChannel } from '@hcengineering/analytics-collector'
1818
import chunter from '@hcengineering/chunter'
1919
import { TChannel } from '@hcengineering/model-chunter'
20+
import activity, { type ActivityMessageControl } from '@hcengineering/activity'
21+
import core from '@hcengineering/core'
2022

2123
import analyticsCollector from './plugin'
2224

2325
export { analyticsCollectorId } from '@hcengineering/analytics-collector'
2426
export { analyticsCollectorOperation } from './migration'
2527
export default analyticsCollector
2628

27-
@Mixin(analyticsCollector.mixin.AnalyticsChannel, chunter.class.Channel)
28-
export class TAnalyticsChannel extends TChannel implements AnalyticsChannel {
29-
workspace!: string
30-
email!: string
29+
@Model(analyticsCollector.class.OnboardingChannel, chunter.class.Channel)
30+
@UX(
31+
analyticsCollector.string.OnboardingChannel,
32+
chunter.icon.Hashtag,
33+
undefined,
34+
undefined,
35+
undefined,
36+
analyticsCollector.string.OnboardingChannels
37+
)
38+
export class TOnboardingChannel extends TChannel implements OnboardingChannel {
39+
@Prop(TypeString(), analyticsCollector.string.UserName)
40+
@ReadOnly()
41+
userName!: string
42+
43+
@Prop(TypeString(), analyticsCollector.string.Email)
44+
@ReadOnly()
45+
email!: string
46+
47+
@Prop(TypeString(), analyticsCollector.string.WorkspaceName)
48+
@ReadOnly()
49+
workspaceName!: string
50+
51+
@Prop(TypeString(), analyticsCollector.string.WorkspaceUrl)
52+
@ReadOnly()
53+
workspaceUrl!: string
54+
55+
@Prop(TypeString(), analyticsCollector.string.WorkspaceId)
56+
@ReadOnly()
57+
workspaceId!: string
3158
}
3259

3360
export function createModel (builder: Builder): void {
34-
builder.createModel(TAnalyticsChannel)
61+
builder.createModel(TOnboardingChannel)
62+
63+
builder.createDoc(activity.class.ActivityExtension, core.space.Model, {
64+
ofClass: analyticsCollector.class.OnboardingChannel,
65+
components: { input: chunter.component.ChatMessageInput }
66+
})
67+
68+
builder.createDoc<ActivityMessageControl<OnboardingChannel>>(
69+
activity.class.ActivityMessageControl,
70+
core.space.Model,
71+
{
72+
objectClass: analyticsCollector.class.OnboardingChannel,
73+
skip: [
74+
{ _class: core.class.TxMixin },
75+
{ _class: core.class.TxCreateDoc, objectClass: { $ne: analyticsCollector.class.OnboardingChannel } },
76+
{ _class: core.class.TxRemoveDoc }
77+
],
78+
allowedFields: ['members']
79+
}
80+
)
81+
82+
builder.createDoc(activity.class.DocUpdateMessageViewlet, core.space.Model, {
83+
objectClass: analyticsCollector.class.OnboardingChannel,
84+
action: 'update',
85+
config: {
86+
members: {
87+
presenter: chunter.activity.MembersChangedMessage
88+
}
89+
}
90+
})
3591
}

Diff for: models/analytics-collector/src/migration.ts

+6-8
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,13 @@ import {
1919
type MigrationUpgradeClient,
2020
tryMigrate
2121
} from '@hcengineering/model'
22-
import analyticsCollector, { analyticsCollectorId } from '@hcengineering/analytics-collector'
22+
import { analyticsCollectorId } from '@hcengineering/analytics-collector'
2323
import { DOMAIN_SPACE } from '@hcengineering/model-core'
2424
import { DOMAIN_DOC_NOTIFY, DOMAIN_NOTIFICATION } from '@hcengineering/model-notification'
2525
import { DOMAIN_ACTIVITY } from '@hcengineering/model-activity'
2626

27-
async function removeAnalyticsChannels (client: MigrationClient): Promise<void> {
28-
const channels = await client.find(DOMAIN_SPACE, {
29-
[`${analyticsCollector.mixin.AnalyticsChannel}`]: { $exists: true }
30-
})
27+
async function removeOnboardingChannels (client: MigrationClient): Promise<void> {
28+
const channels = await client.find(DOMAIN_SPACE, { 'analytics:mixin:AnalyticsChannel': { $exists: true } })
3129

3230
if (channels.length === 0) {
3331
return
@@ -40,15 +38,15 @@ async function removeAnalyticsChannels (client: MigrationClient): Promise<void>
4038
await client.deleteMany(DOMAIN_ACTIVITY, { attachedTo: { $in: channelsIds } })
4139
await client.deleteMany(DOMAIN_NOTIFICATION, { docNotifyContext: { $in: contextsIds } })
4240
await client.deleteMany(DOMAIN_DOC_NOTIFY, { _id: { $in: contextsIds } })
43-
await client.deleteMany(DOMAIN_SPACE, { [`${analyticsCollector.mixin.AnalyticsChannel}`]: { $exists: true } })
41+
await client.deleteMany(DOMAIN_SPACE, { _id: { $in: channelsIds } })
4442
}
4543

4644
export const analyticsCollectorOperation: MigrateOperation = {
4745
async migrate (client: MigrationClient): Promise<void> {
4846
await tryMigrate(client, analyticsCollectorId, [
4947
{
50-
state: 'remove-analytics-channels-v1',
51-
func: removeAnalyticsChannels
48+
state: 'remove-analytics-channels-v3',
49+
func: removeOnboardingChannels
5250
}
5351
])
5452
},

0 commit comments

Comments
 (0)