Skip to content

Commit f7ed7e2

Browse files
authored
Fix export button (#8298)
Signed-off-by: Anna Khismatullina <[email protected]>
1 parent 186e35c commit f7ed7e2

File tree

19 files changed

+203
-21
lines changed

19 files changed

+203
-21
lines changed

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

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

Diff for: models/all/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@
101101
"@hcengineering/model-love": "^0.6.0",
102102
"@hcengineering/model-server-love": "^0.6.0",
103103
"@hcengineering/model-print": "^0.6.0",
104+
"@hcengineering/model-export": "^0.6.0",
104105
"@hcengineering/model-questions": "^0.1.0",
105106
"@hcengineering/model-training": "^0.1.0",
106107
"@hcengineering/model-controlled-documents": "^0.1.0",

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

+2
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ import { serverGithubId, createModel as serverGithubModel } from '@hcengineering
8888
import { serverTimeId, createModel as serverTimeModel } from '@hcengineering/model-server-time'
8989
import love, { loveId, createModel as loveModel } from '@hcengineering/model-love'
9090
import { printId, createModel as printModel } from '@hcengineering/model-print'
91+
import { exportId, createModel as exportModel } from '@hcengineering/model-export'
9192
import { analyticsCollectorId, createModel as analyticsCollectorModel } from '@hcengineering/model-analytics-collector'
9293
import { serverLoveId, createModel as serverLoveModel } from '@hcengineering/model-server-love'
9394

@@ -361,6 +362,7 @@ export default function buildModel (enabled: string[] = ['*'], disabled: string[
361362
}
362363
],
363364
[printModel, printId],
365+
[exportModel, exportId],
364366
[aiBotModel, aiBotId],
365367
[
366368
cardModel,

Diff for: models/export/.eslintrc.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module.exports = {
2+
extends: ['./node_modules/@hcengineering/platform-rig/profiles/model/eslint.config.json'],
3+
parserOptions: {
4+
tsconfigRootDir: __dirname,
5+
project: './tsconfig.json'
6+
}
7+
}

Diff for: models/export/.npmignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
*
2+
!/lib/**
3+
!CHANGELOG.md
4+
/lib/**/__tests__/

Diff for: models/export/config/rig.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"$schema": "https://developer.microsoft.com/json-schemas/rig-package/rig.schema.json",
3+
"rigPackageName": "@hcengineering/platform-rig",
4+
"rigProfile": "model"
5+
}

Diff for: models/export/package.json

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"name": "@hcengineering/model-export",
3+
"version": "0.6.0",
4+
"main": "lib/index.js",
5+
"svelte": "src/index.ts",
6+
"types": "types/index.d.ts",
7+
"author": "Copyright © Hardcore Engineering Inc.",
8+
"template": "@hcengineering/model-package",
9+
"license": "EPL-2.0",
10+
"scripts": {
11+
"build": "compile",
12+
"build:watch": "compile",
13+
"format": "format src",
14+
"_phase:build": "compile transpile src",
15+
"_phase:format": "format src",
16+
"_phase:validate": "compile validate"
17+
},
18+
"devDependencies": {
19+
"@hcengineering/platform-rig": "^0.6.0",
20+
"@typescript-eslint/eslint-plugin": "^6.11.0",
21+
"eslint-plugin-import": "^2.26.0",
22+
"eslint-plugin-promise": "^6.1.1",
23+
"eslint-plugin-n": "^15.4.0",
24+
"eslint": "^8.54.0",
25+
"@typescript-eslint/parser": "^6.11.0",
26+
"eslint-config-standard-with-typescript": "^40.0.0",
27+
"prettier": "^3.1.0",
28+
"typescript": "^5.3.3"
29+
},
30+
"dependencies": {
31+
"@hcengineering/core": "^0.6.32",
32+
"@hcengineering/model-core": "^0.6.0",
33+
"@hcengineering/model": "^0.6.11",
34+
"@hcengineering/platform": "^0.6.11",
35+
"@hcengineering/ui": "^0.6.15",
36+
"@hcengineering/workbench": "^0.6.16",
37+
"@hcengineering/presentation": "^0.6.3",
38+
"@hcengineering/model-presentation": "^0.6.0",
39+
"@hcengineering/export-resources": "^0.6.0",
40+
"@hcengineering/export": "^0.6.0"
41+
}
42+
}

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

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
//
2+
// Copyright © 2025 Hardcore Engineering Inc.
3+
//
4+
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License. You may
6+
// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0
7+
//
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
//
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
//
15+
16+
import { type Builder } from '@hcengineering/model'
17+
import core from '@hcengineering/model-core'
18+
import presentation from '@hcengineering/model-presentation'
19+
import workbench from '@hcengineering/workbench'
20+
import exportPlugin from './plugin'
21+
22+
export { exportId } from '@hcengineering/export'
23+
export * from './migration'
24+
export default exportPlugin
25+
26+
export function createModel (builder: Builder): void {
27+
builder.createDoc(
28+
presentation.class.ComponentPointExtension,
29+
core.space.Model,
30+
{
31+
extension: workbench.extensions.SpecialViewAction,
32+
component: exportPlugin.component.ExportButton
33+
},
34+
exportPlugin.extensions.ExportButton
35+
)
36+
}

Diff for: models/export/src/migration.ts

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//
2+
// Copyright © 2025 Hardcore Engineering Inc.
3+
//
4+
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License. You may
6+
// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0
7+
//
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
//
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
//
15+
16+
import { type MigrateOperation, type MigrationClient, type MigrationUpgradeClient } from '@hcengineering/model'
17+
18+
export const loveOperation: MigrateOperation = {
19+
async migrate (client: MigrationClient): Promise<void> {},
20+
async upgrade (state: Map<string, Set<string>>, client: () => Promise<MigrationUpgradeClient>): Promise<void> {}
21+
}

Diff for: models/export/src/plugin.ts

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
//
2+
// Copyright © 2025 Hardcore Engineering Inc.
3+
//
4+
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License. You may
6+
// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0
7+
//
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
//
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
//
15+
16+
import { mergeIds } from '@hcengineering/platform'
17+
import { exportId } from '@hcengineering/export'
18+
import { type ComponentPointExtension } from '@hcengineering/presentation'
19+
import { type Ref } from '@hcengineering/core'
20+
import exportPlugin from '@hcengineering/export-resources/src/plugin'
21+
22+
export default mergeIds(exportId, exportPlugin, {
23+
extensions: {
24+
ExportButton: '' as Ref<ComponentPointExtension>
25+
}
26+
})

Diff for: models/export/tsconfig.json

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"extends": "./node_modules/@hcengineering/platform-rig/profiles/model/tsconfig.json",
3+
4+
"compilerOptions": {
5+
"rootDir": "./src",
6+
"outDir": "./lib",
7+
"declarationDir": "./types",
8+
"tsBuildInfoFile": ".build/build.tsbuildinfo"
9+
}
10+
}

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,8 @@ export function createModel (builder: Builder): void {
187187
createLabel: recruit.string.TalentCreateLabel,
188188
createComponent: recruit.component.CreateCandidate,
189189
createComponentProps: { shouldSaveDraft: false },
190-
exportVisible: true,
191-
exportConfig: {
190+
actionVisible: true,
191+
actionConfig: {
192192
skipAttributes: ['_class', 'avatarType', 'space'],
193193
attributeKeyMap: { city: 'location' },
194194
attributeTransforms: {

Diff for: plugins/export-resources/src/plugin.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ export default mergeIds(exportId, exportPlugin, {
3636
ExportRequestSuccess: '' as IntlString,
3737
ExportRequestSuccessMessage: '' as IntlString,
3838
ExportRequestFailed: '' as IntlString,
39-
ExportRequestFailedMessage: '' as IntlString,
40-
ExportCompleted: '' as IntlString,
41-
ExportFailed: '' as IntlString
39+
ExportRequestFailedMessage: '' as IntlString
4240
}
4341
})

Diff for: plugins/export/src/plugin.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ export const exportId = 'export' as Plugin
2020

2121
export const exportPlugin = plugin(exportId, {
2222
string: {
23-
Export: '' as IntlString // todo: remove?
23+
Export: '' as IntlString,
24+
ExportCompleted: '' as IntlString,
25+
ExportFailed: '' as IntlString
2426
},
2527
component: {
2628
ExportButton: '' as AnyComponent,

Diff for: plugins/workbench-resources/package.json

-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@
5757
"@hcengineering/support": "^0.6.5",
5858
"@hcengineering/support-resources": "^0.6.0",
5959
"@hcengineering/view-resources": "^0.6.0",
60-
"@hcengineering/export": "^0.6.0",
6160
"fast-copy": "^3.0.2",
6261
"@hcengineering/analytics": "^0.6.0"
6362
}

Diff for: plugins/workbench-resources/src/components/SpecialView.svelte

+8-6
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<script lang="ts">
1616
import { Class, Doc, DocumentQuery, FindOptions, Ref, Space, WithLookup } from '@hcengineering/core'
1717
import { Asset, IntlString } from '@hcengineering/platform'
18-
import { getClient } from '@hcengineering/presentation'
18+
import { getClient, ComponentExtensions } from '@hcengineering/presentation'
1919
import {
2020
AnyComponent,
2121
Breadcrumb,
@@ -38,8 +38,7 @@
3838
ViewletSelector,
3939
ViewletSettingButton
4040
} from '@hcengineering/view-resources'
41-
import { ParentsNavigationModel } from '@hcengineering/workbench'
42-
import exportPlugin, { type TransformConfig } from '@hcengineering/export'
41+
import workbench, { ParentsNavigationModel } from '@hcengineering/workbench'
4342
import ComponentNavigator from './ComponentNavigator.svelte'
4443
4544
export let _class: Ref<Class<Doc>>
@@ -56,8 +55,8 @@
5655
export let baseQuery: DocumentQuery<Doc> | undefined = undefined
5756
export let modes: IModeSelector<any> | undefined = undefined
5857
export let navigationModel: ParentsNavigationModel | undefined = undefined
59-
export let exportVisible: boolean = false
60-
export let exportConfig: TransformConfig = {}
58+
export let actionConfig: Record<string, any> = {}
59+
export let actionVisible: boolean = false
6160
6261
const client = getClient()
6362
const hierarchy = client.getHierarchy()
@@ -132,7 +131,10 @@
132131
<FilterButton {_class} bind:visible={filterVisible} />
133132
</svelte:fragment>
134133
<svelte:fragment slot="actions">
135-
<exportPlugin.component.ExportButton {_class} visible={exportVisible} query={resultQuery} config={exportConfig} />
134+
<ComponentExtensions
135+
extension={workbench.extensions.SpecialViewAction}
136+
props={{ _class, visible: actionVisible, query: resultQuery, config: actionConfig }}
137+
/>
136138
{#if createLabel && createComponent}
137139
<Button
138140
icon={IconAdd}

Diff for: plugins/workbench/src/index.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,8 @@ export default plugin(workbenchId, {
276276
},
277277
extensions: {
278278
WorkbenchExtensions: '' as ComponentExtensionId,
279-
WorkbenchTabExtensions: '' as ComponentExtensionId
279+
WorkbenchTabExtensions: '' as ComponentExtensionId,
280+
SpecialViewAction: '' as ComponentExtensionId
280281
},
281282
function: {
282283
CreateWidgetTab: '' as Resource<(widget: Widget, tab: WidgetTab, newTab: boolean) => Promise<void>>,

Diff for: rush.json

+5
Original file line numberDiff line numberDiff line change
@@ -1888,6 +1888,11 @@
18881888
"projectFolder": "models/print",
18891889
"shouldPublish": false
18901890
},
1891+
{
1892+
"packageName": "@hcengineering/model-export",
1893+
"projectFolder": "models/export",
1894+
"shouldPublish": false
1895+
},
18911896
{
18921897
"packageName": "@hcengineering/export",
18931898
"projectFolder": "plugins/export",

Diff for: services/export/pod-export/src/server.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import core, {
3030
} from '@hcengineering/core'
3131
import drive, { createFile, Drive } from '@hcengineering/drive'
3232
import notification from '@hcengineering/notification'
33-
import { Asset, IntlString, setMetadata } from '@hcengineering/platform'
33+
import { setMetadata } from '@hcengineering/platform'
3434
import { createClient, getTransactorEndpoint } from '@hcengineering/server-client'
3535
import { initStatisticsContext, StorageAdapter, StorageConfiguration } from '@hcengineering/server-core'
3636
import { buildStorageFromConfig } from '@hcengineering/server-storage'
@@ -47,7 +47,7 @@ import { v4 as uuid } from 'uuid'
4747
import WebSocket from 'ws'
4848
import { ApiError } from './error'
4949
import { ExportFormat, WorkspaceExporter } from './exporter'
50-
import { type TransformConfig } from '@hcengineering/export'
50+
import exportPlugin, { type TransformConfig } from '@hcengineering/export'
5151

5252
const extractCookieToken = (cookie?: string): string | null => {
5353
if (cookie === undefined || cookie === null) {
@@ -400,8 +400,8 @@ async function sendSuccessNotification (
400400
user: account,
401401
objectId: exportDrive,
402402
objectClass: drive.class.Drive,
403-
icon: 'setting:icon:Export' as Asset,
404-
message: 'setting:string:ExportCompleted' as IntlString,
403+
icon: exportPlugin.icon.Export,
404+
message: exportPlugin.string.ExportCompleted,
405405
props: {
406406
fileName: archiveName
407407
},
@@ -425,8 +425,8 @@ async function sendFailureNotification (client: TxOperations, account: Ref<Accou
425425
user: account,
426426
objectId: account,
427427
objectClass: core.class.Account,
428-
icon: 'setting:icon:Export' as Asset,
429-
message: 'setting:string:ExportFailed' as IntlString,
428+
icon: exportPlugin.icon.Export,
429+
message: exportPlugin.string.ExportFailed,
430430
props: {
431431
error
432432
},

0 commit comments

Comments
 (0)