Skip to content

Commit 06fb92b

Browse files
akhismatlexiv0re
andauthored
Fix init workspace in dev (#8799)
Signed-off-by: Anna Khismatullina <[email protected]> Signed-off-by: Alexey Zinoviev <[email protected]> Co-authored-by: Alexey Zinoviev <[email protected]>
1 parent 874f4e3 commit 06fb92b

File tree

15 files changed

+419
-420
lines changed

15 files changed

+419
-420
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ _api-extractor-temp/
44
temp/
55
.idea
66
pods/workspace/init/
7+
pods/workspace/init-scripts/
78

89
# Logs
910
*.log

.vscode/launch.json

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -276,12 +276,14 @@
276276
"MINIO_ACCESS_KEY": "minioadmin",
277277
"MINIO_SECRET_KEY": "minioadmin",
278278
"MINIO_ENDPOINT": "localhost",
279-
"MODEL_VERSION": "v0.7.1",
279+
"MODEL_VERSION": "v0.7.75",
280280
"WS_OPERATION": "all+backup",
281281
"BACKUP_STORAGE": "minio|minio?accessKey=minioadmin&secretKey=minioadmin",
282-
"BACKUP_BUCKET": "dev-backups"
283-
// "INIT_REPO_DIR": "${workspaceRoot}/pods/workspace/init",
284-
// "INIT_WORKSPACE": "staging-dev"
282+
"BACKUP_BUCKET": "dev-backups",
283+
"INIT_REPO_DIR": "${workspaceRoot}/pods/workspace/init",
284+
"INIT_WORKSPACE": "staging-dev",
285+
"QUEUE_CONFIG": "huly.local:19092",
286+
"QUEUE_REGION": ""
285287
},
286288
"runtimeVersion": "20",
287289
"runtimeArgs": ["--nolazy", "-r", "ts-node/register"],
@@ -309,10 +311,11 @@
309311
"MINIO_ACCESS_KEY": "minioadmin",
310312
"MINIO_SECRET_KEY": "minioadmin",
311313
"MINIO_ENDPOINT": "localhost",
312-
"MODEL_VERSION": "0.7.1",
314+
"MODEL_VERSION": "0.7.75",
313315
"WS_OPERATION": "all+backup",
314316
"BACKUP_STORAGE": "minio|minio?accessKey=minioadmin&secretKey=minioadmin",
315-
"BACKUP_BUCKET": "dev-backups"
317+
"BACKUP_BUCKET": "dev-backups",
318+
"QUEUE_CONFIG": "huly.local:19092"
316319
// "INIT_REPO_DIR": "${workspaceRoot}/pods/workspace/init",
317320
// "INIT_WORKSPACE": "staging-dev"
318321
},

dev/docker-compose.min.yaml

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ services:
5353
- 9001:9001
5454
volumes:
5555
- files:/data
56+
healthcheck:
57+
test: ["CMD", "mc", "ready", "local"]
58+
interval: 5s
59+
retries: 10
5660
restart: unless-stopped
5761
elastic:
5862
image: 'elasticsearch:7.14.2'
@@ -143,7 +147,7 @@ services:
143147
- BACKUP_STORAGE=${BACKUP_STORAGE_CONFIG}
144148
- BACKUP_BUCKET=${BACKUP_BUCKET_NAME}
145149
- MAIL_URL=
146-
# - INIT_WORKSPACE=staging-dev
150+
- INIT_WORKSPACE=staging-dev
147151
restart: unless-stopped
148152
collaborator:
149153
image: hardcoreeng/collaborator
@@ -255,6 +259,30 @@ services:
255259
- STATS_URL=http://huly.local:4900
256260
- REKONI_URL=http://huly.local:4004
257261
- ACCOUNTS_URL=http://huly.local:3000
262+
datalake:
263+
image: hardcoreeng/datalake
264+
extra_hosts:
265+
- 'huly.local:host-gateway'
266+
depends_on:
267+
minio:
268+
condition: service_healthy
269+
cockroach:
270+
condition: service_started
271+
stats:
272+
condition: service_started
273+
account:
274+
condition: service_started
275+
ports:
276+
- 4030:4030
277+
environment:
278+
- PORT=4030
279+
- SECRET=secret
280+
- ACCOUNTS_URL=http://huly.local:3000
281+
- STATS_URL=http://huly.local:4900
282+
- STREAM_URL=http://huly.local:1080/recording
283+
- DB_URL=${DB_CR_URL}
284+
- BUCKETS=blobs,eu|http://minio:9000?accessKey=minioadmin&secretKey=minioadmin
285+
restart: unless-stopped
258286
volumes:
259287
db:
260288
dbpg:

models/card/src/migration.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,11 @@ async function setParentInfo (client: MigrationClient): Promise<void> {
9696
)
9797
}
9898

99-
function extractObjectProps<T extends Doc> (doc: T): Data<T> {
99+
function extractObjectData<T extends Doc> (doc: T): Data<T> {
100+
const dataKeys = ['_id', 'space', 'modifiedOn', 'modifiedBy', 'createdBy', 'createdOn']
100101
const data: any = {}
101102
for (const key in doc) {
102-
if (key === '_id') {
103+
if (dataKeys.includes(key)) {
103104
continue
104105
}
105106
data[key] = doc[key]
@@ -114,8 +115,8 @@ async function migrateViewlets (client: Client): Promise<void> {
114115
const currentViewlets = await client.findAll(view.class.Viewlet, { attachTo: { $in: masterTags.map((p) => p._id) } })
115116
for (const masterTag of masterTags) {
116117
for (const viewlet of viewlets) {
117-
const base = extractObjectProps(viewlet)
118-
const resConfig = base.config
118+
const base = extractObjectData(viewlet)
119+
const resConfig = [...base.config]
119120
let index = -1
120121
if (viewlet.descriptor === view.viewlet.List) {
121122
index = viewlet.config.findIndex((p) => typeof p !== 'string' && p.displayProps?.grow === true)

models/contact/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
"@hcengineering/model-presentation": "^0.6.0",
4444
"@hcengineering/model-view": "^0.6.0",
4545
"@hcengineering/model-workbench": "^0.6.1",
46+
"@hcengineering/model-card": "^0.6.0",
4647
"@hcengineering/notification": "^0.6.23",
4748
"@hcengineering/platform": "^0.6.11",
4849
"@hcengineering/setting": "^0.6.17",

models/contact/src/index.ts

Lines changed: 12 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
//
1616

1717
import activity from '@hcengineering/activity'
18-
import card, { type Role, type Card } from '@hcengineering/card'
18+
import { type Role, type Card } from '@hcengineering/card'
1919
import {
2020
AvatarType,
2121
type UserRole,
@@ -36,7 +36,6 @@ import {
3636
} from '@hcengineering/contact'
3737
import {
3838
AccountRole,
39-
ClassifierKind,
4039
DOMAIN_MODEL,
4140
DateRangeMode,
4241
IndexKind,
@@ -52,6 +51,7 @@ import {
5251
type SocialIdType,
5352
type Timestamp
5453
} from '@hcengineering/core'
54+
import { createSystemType } from '@hcengineering/model-card'
5555
import {
5656
Collection as CollectionType,
5757
Hidden,
@@ -280,55 +280,6 @@ export class TUserRole extends TDoc implements UserRole {
280280
role!: Ref<Role>
281281
}
282282

283-
function createUserProfileTag (builder: Builder): void {
284-
builder.createDoc(
285-
card.class.MasterTag,
286-
core.space.Model,
287-
{
288-
extends: card.class.Card,
289-
label: contact.string.UserProfile,
290-
kind: ClassifierKind.CLASS,
291-
icon: contact.icon.Person
292-
},
293-
contact.class.UserProfile
294-
)
295-
296-
builder.createDoc(core.class.Attribute, core.space.Model, {
297-
attributeOf: contact.class.UserProfile,
298-
name: 'person',
299-
label: contact.string.Person,
300-
icon: contact.icon.Person,
301-
type: TypeRef(contact.class.Person),
302-
readonly: true
303-
})
304-
305-
builder.mixin(contact.class.UserProfile, core.class.Mixin, setting.mixin.Editable, {
306-
value: false
307-
})
308-
builder.mixin(contact.class.UserProfile, core.class.Mixin, setting.mixin.UserMixin, {})
309-
}
310-
311-
function createUserProfileViewlet (builder: Builder): void {
312-
builder.createDoc<Viewlet>(
313-
view.class.Viewlet,
314-
core.space.Model,
315-
{
316-
attachTo: contact.class.UserProfile,
317-
descriptor: view.viewlet.Table,
318-
config: [
319-
'',
320-
{ key: 'modifiedOn', displayProps: { key: 'modified', fixed: 'right' } },
321-
{ key: 'createdBy', displayProps: { fixed: 'left', key: 'app' } }
322-
],
323-
configOptions: {
324-
hiddenKeys: ['name'],
325-
sortable: true
326-
}
327-
},
328-
contact.viewlet.TableUserProfile
329-
)
330-
}
331-
332283
export function createModel (builder: Builder): void {
333284
builder.createModel(
334285
TAvatarProvider,
@@ -1319,6 +1270,14 @@ export function createModel (builder: Builder): void {
13191270
})
13201271

13211272
createAttributePresenter(builder, contact.component.SpaceMembersEditor, core.class.Space, 'members', 'array')
1322-
createUserProfileTag(builder)
1323-
createUserProfileViewlet(builder)
1273+
createSystemType(builder, contact.class.UserProfile, contact.icon.Person, contact.string.UserProfile)
1274+
builder.createDoc(core.class.Attribute, core.space.Model, {
1275+
attributeOf: contact.class.UserProfile,
1276+
name: 'person',
1277+
label: contact.string.Person,
1278+
icon: contact.icon.Person,
1279+
type: TypeRef(contact.class.Person),
1280+
isCustom: true,
1281+
readonly: true
1282+
})
13241283
}

packages/importer/src/huly/cards.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,10 @@ import * as yaml from 'js-yaml'
3232
import { contentType } from 'mime-types'
3333
import * as path from 'path'
3434
import { IntlString } from '../../../platform/types'
35-
import { Props, UnifiedDoc, UnifiedUpdate, UnifiedFile, UnifiedMixin } from '../types'
36-
import { MetadataRegistry, AssociationMetadata } from './registry'
37-
import { readMarkdownContent, readYamlHeader } from './parsing'
3835
import { Logger } from '../importer/logger'
39-
import { validateSchema } from './validation'
36+
import { Props, UnifiedDoc, UnifiedFile, UnifiedMixin, UnifiedUpdate } from '../types'
37+
import { UnifiedFormatParser } from './parser'
38+
import { AssociationMetadata, MetadataRegistry } from './registry'
4039
import {
4140
AssociationSchema,
4241
BaseFieldType,
@@ -51,6 +50,7 @@ import {
5150
StringFieldType,
5251
TagSchema
5352
} from './schema'
53+
import { validateSchema } from './validation'
5454

5555
export interface UnifiedDocProcessResult {
5656
docs: Map<string, Array<UnifiedDoc<Doc>>>
@@ -62,6 +62,7 @@ export interface UnifiedDocProcessResult {
6262
export class CardsProcessor {
6363
constructor (
6464
private readonly metadataRegistry: MetadataRegistry,
65+
private readonly parser: UnifiedFormatParser,
6566
private readonly logger: Logger
6667
) {}
6768

@@ -199,7 +200,7 @@ export class CardsProcessor {
199200
for (const entry of entries) {
200201
if (entry.isFile() && entry.name.endsWith('.md')) {
201202
const cardPath = path.join(currentPath, entry.name)
202-
const { class: cardType, ...cardProps } = await readYamlHeader(cardPath)
203+
const { class: cardType, ...cardProps } = this.parser.readYamlHeader(cardPath)
203204

204205
if (masterTagId !== undefined) {
205206
await this.processCard(result, cardPath, cardProps, masterTagId, masterTagAssociaions, masterTagAttributes)
@@ -231,7 +232,7 @@ export class CardsProcessor {
231232
for (const entry of entries) {
232233
if (entry.isFile() && entry.name.endsWith('.md')) {
233234
const cardPath = path.join(currentDir, entry.name)
234-
const { class: cardType, ...cardProps } = await readYamlHeader(cardPath)
235+
const { class: cardType, ...cardProps } = this.parser.readYamlHeader(cardPath)
235236

236237
if (cardType !== undefined && cardType.startsWith('card:types:') === false) {
237238
throw new Error('Unsupported card type: ' + cardType + ' in ' + cardPath)
@@ -310,7 +311,7 @@ export class CardsProcessor {
310311

311312
for (const entry of entries) {
312313
const childCardPath = path.join(cardDir, entry.name)
313-
const { class: cardClass, ...cardProps } = await readYamlHeader(childCardPath)
314+
const { class: cardClass, ...cardProps } = this.parser.readYamlHeader(childCardPath)
314315
await this.processCard(
315316
result,
316317
childCardPath,
@@ -594,7 +595,7 @@ export class CardsProcessor {
594595
{
595596
_class: masterTagId,
596597
collabField: 'content',
597-
contentProvider: () => readMarkdownContent(cardPath),
598+
contentProvider: () => Promise.resolve(this.parser.readMarkdownContent(cardPath)),
598599
props: cardProps as Props<Card>
599600
},
600601
...relations

0 commit comments

Comments
 (0)