@memberjunction/ng-artifacts 6.1.4 → 6.2.0-edge.1
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/dist/lib/components/artifact-message-card.component.d.ts +60 -8
- package/dist/lib/components/artifact-message-card.component.d.ts.map +1 -1
- package/dist/lib/components/artifact-message-card.component.js +135 -39
- package/dist/lib/components/artifact-message-card.component.js.map +1 -1
- package/dist/lib/components/artifact-type-plugin-viewer.component.d.ts +58 -6
- package/dist/lib/components/artifact-type-plugin-viewer.component.d.ts.map +1 -1
- package/dist/lib/components/artifact-type-plugin-viewer.component.js +113 -35
- package/dist/lib/components/artifact-type-plugin-viewer.component.js.map +1 -1
- package/dist/lib/components/artifact-version-download.d.ts +5 -3
- package/dist/lib/components/artifact-version-download.d.ts.map +1 -1
- package/dist/lib/components/artifact-version-download.js +11 -7
- package/dist/lib/components/artifact-version-download.js.map +1 -1
- package/dist/lib/components/artifact-version-history.component.d.ts +74 -8
- package/dist/lib/components/artifact-version-history.component.d.ts.map +1 -1
- package/dist/lib/components/artifact-version-history.component.js +152 -34
- package/dist/lib/components/artifact-version-history.component.js.map +1 -1
- package/dist/lib/components/artifact-viewer-panel.component.d.ts +328 -35
- package/dist/lib/components/artifact-viewer-panel.component.d.ts.map +1 -1
- package/dist/lib/components/artifact-viewer-panel.component.js +701 -213
- package/dist/lib/components/artifact-viewer-panel.component.js.map +1 -1
- package/dist/lib/components/file-artifact-toolbar.component.d.ts +112 -10
- package/dist/lib/components/file-artifact-toolbar.component.d.ts.map +1 -1
- package/dist/lib/components/file-artifact-toolbar.component.js +197 -23
- package/dist/lib/components/file-artifact-toolbar.component.js.map +1 -1
- package/dist/lib/components/plugins/audio-artifact-viewer.component.d.ts +9 -1
- package/dist/lib/components/plugins/audio-artifact-viewer.component.d.ts.map +1 -1
- package/dist/lib/components/plugins/audio-artifact-viewer.component.js +20 -4
- package/dist/lib/components/plugins/audio-artifact-viewer.component.js.map +1 -1
- package/dist/lib/components/plugins/code-artifact-viewer.component.d.ts +23 -5
- package/dist/lib/components/plugins/code-artifact-viewer.component.d.ts.map +1 -1
- package/dist/lib/components/plugins/code-artifact-viewer.component.js +69 -31
- package/dist/lib/components/plugins/code-artifact-viewer.component.js.map +1 -1
- package/dist/lib/components/plugins/component-artifact-viewer.component.d.ts +136 -18
- package/dist/lib/components/plugins/component-artifact-viewer.component.d.ts.map +1 -1
- package/dist/lib/components/plugins/component-artifact-viewer.component.js +285 -97
- package/dist/lib/components/plugins/component-artifact-viewer.component.js.map +1 -1
- package/dist/lib/components/plugins/component-feedback-panel/component-feedback-panel.component.d.ts +2 -2
- package/dist/lib/components/plugins/component-feedback-panel/component-feedback-panel.component.js +7 -7
- package/dist/lib/components/plugins/component-feedback-panel/component-feedback-panel.component.js.map +1 -1
- package/dist/lib/components/plugins/component-permission-evaluation.d.ts +2 -0
- package/dist/lib/components/plugins/component-permission-evaluation.d.ts.map +1 -1
- package/dist/lib/components/plugins/component-permission-evaluation.js +6 -2
- package/dist/lib/components/plugins/component-permission-evaluation.js.map +1 -1
- package/dist/lib/components/plugins/data-artifact-viewer.component.d.ts +17 -6
- package/dist/lib/components/plugins/data-artifact-viewer.component.d.ts.map +1 -1
- package/dist/lib/components/plugins/data-artifact-viewer.component.js +32 -22
- package/dist/lib/components/plugins/data-artifact-viewer.component.js.map +1 -1
- package/dist/lib/components/plugins/data-requirements-viewer/data-requirements-viewer.component.d.ts +56 -4
- package/dist/lib/components/plugins/data-requirements-viewer/data-requirements-viewer.component.d.ts.map +1 -1
- package/dist/lib/components/plugins/data-requirements-viewer/data-requirements-viewer.component.js +142 -36
- package/dist/lib/components/plugins/data-requirements-viewer/data-requirements-viewer.component.js.map +1 -1
- package/dist/lib/components/plugins/docx-artifact-viewer.component.d.ts +14 -2
- package/dist/lib/components/plugins/docx-artifact-viewer.component.d.ts.map +1 -1
- package/dist/lib/components/plugins/docx-artifact-viewer.component.js +32 -8
- package/dist/lib/components/plugins/docx-artifact-viewer.component.js.map +1 -1
- package/dist/lib/components/plugins/html-artifact-viewer.component.d.ts +17 -3
- package/dist/lib/components/plugins/html-artifact-viewer.component.d.ts.map +1 -1
- package/dist/lib/components/plugins/html-artifact-viewer.component.js +36 -8
- package/dist/lib/components/plugins/html-artifact-viewer.component.js.map +1 -1
- package/dist/lib/components/plugins/image-artifact-viewer.component.d.ts +41 -5
- package/dist/lib/components/plugins/image-artifact-viewer.component.d.ts.map +1 -1
- package/dist/lib/components/plugins/image-artifact-viewer.component.js +102 -30
- package/dist/lib/components/plugins/image-artifact-viewer.component.js.map +1 -1
- package/dist/lib/components/plugins/json-artifact-viewer.component.d.ts +33 -5
- package/dist/lib/components/plugins/json-artifact-viewer.component.d.ts.map +1 -1
- package/dist/lib/components/plugins/json-artifact-viewer.component.js +89 -33
- package/dist/lib/components/plugins/json-artifact-viewer.component.js.map +1 -1
- package/dist/lib/components/plugins/markdown-artifact-viewer.component.d.ts +12 -2
- package/dist/lib/components/plugins/markdown-artifact-viewer.component.d.ts.map +1 -1
- package/dist/lib/components/plugins/markdown-artifact-viewer.component.js +28 -8
- package/dist/lib/components/plugins/markdown-artifact-viewer.component.js.map +1 -1
- package/dist/lib/components/plugins/ml-experiment-results-viewer.component.d.ts +4 -0
- package/dist/lib/components/plugins/ml-experiment-results-viewer.component.d.ts.map +1 -1
- package/dist/lib/components/plugins/ml-experiment-results-viewer.component.js +14 -6
- package/dist/lib/components/plugins/ml-experiment-results-viewer.component.js.map +1 -1
- package/dist/lib/components/plugins/pdf-artifact-viewer.component.d.ts +47 -5
- package/dist/lib/components/plugins/pdf-artifact-viewer.component.d.ts.map +1 -1
- package/dist/lib/components/plugins/pdf-artifact-viewer.component.js +129 -45
- package/dist/lib/components/plugins/pdf-artifact-viewer.component.js.map +1 -1
- package/dist/lib/components/plugins/save-query-dialog.component.d.ts +5 -1
- package/dist/lib/components/plugins/save-query-dialog.component.d.ts.map +1 -1
- package/dist/lib/components/plugins/save-query-dialog.component.js +12 -4
- package/dist/lib/components/plugins/save-query-dialog.component.js.map +1 -1
- package/dist/lib/components/plugins/svg-artifact-viewer.component.d.ts +17 -3
- package/dist/lib/components/plugins/svg-artifact-viewer.component.d.ts.map +1 -1
- package/dist/lib/components/plugins/svg-artifact-viewer.component.js +36 -8
- package/dist/lib/components/plugins/svg-artifact-viewer.component.js.map +1 -1
- package/dist/lib/components/plugins/video-artifact-viewer.component.d.ts +9 -1
- package/dist/lib/components/plugins/video-artifact-viewer.component.d.ts.map +1 -1
- package/dist/lib/components/plugins/video-artifact-viewer.component.js +20 -4
- package/dist/lib/components/plugins/video-artifact-viewer.component.js.map +1 -1
- package/dist/lib/components/plugins/xlsx-artifact-viewer.component.d.ts +28 -4
- package/dist/lib/components/plugins/xlsx-artifact-viewer.component.d.ts.map +1 -1
- package/dist/lib/components/plugins/xlsx-artifact-viewer.component.js +64 -16
- package/dist/lib/components/plugins/xlsx-artifact-viewer.component.js.map +1 -1
- package/dist/lib/components/previews/audio-artifact-preview.component.d.ts +9 -1
- package/dist/lib/components/previews/audio-artifact-preview.component.d.ts.map +1 -1
- package/dist/lib/components/previews/audio-artifact-preview.component.js +20 -4
- package/dist/lib/components/previews/audio-artifact-preview.component.js.map +1 -1
- package/dist/lib/components/previews/image-artifact-preview.component.d.ts +16 -2
- package/dist/lib/components/previews/image-artifact-preview.component.d.ts.map +1 -1
- package/dist/lib/components/previews/image-artifact-preview.component.js +35 -7
- package/dist/lib/components/previews/image-artifact-preview.component.js.map +1 -1
- package/dist/lib/components/previews/video-artifact-preview.component.d.ts +9 -1
- package/dist/lib/components/previews/video-artifact-preview.component.d.ts.map +1 -1
- package/dist/lib/components/previews/video-artifact-preview.component.js +20 -4
- package/dist/lib/components/previews/video-artifact-preview.component.js.map +1 -1
- package/dist/lib/interfaces/artifact-viewer-plugin.interface.js.map +1 -1
- package/dist/lib/services/artifact-file.service.d.ts +8 -0
- package/dist/lib/services/artifact-file.service.d.ts.map +1 -1
- package/dist/lib/services/artifact-file.service.js +22 -6
- package/dist/lib/services/artifact-file.service.js.map +1 -1
- package/dist/lib/services/artifact-icon.service.d.ts +2 -0
- package/dist/lib/services/artifact-icon.service.d.ts.map +1 -1
- package/dist/lib/services/artifact-icon.service.js +5 -1
- package/dist/lib/services/artifact-icon.service.js.map +1 -1
- package/dist/lib/services/artifact-preview-resolver.service.d.ts +2 -0
- package/dist/lib/services/artifact-preview-resolver.service.d.ts.map +1 -1
- package/dist/lib/services/artifact-preview-resolver.service.js +5 -1
- package/dist/lib/services/artifact-preview-resolver.service.js.map +1 -1
- package/dist/lib/snapshot-helpers.d.ts +10 -0
- package/dist/lib/snapshot-helpers.d.ts.map +1 -1
- package/dist/lib/snapshot-helpers.js +25 -5
- package/dist/lib/snapshot-helpers.js.map +1 -1
- package/package.json +21 -21
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"artifact-version-download.js","sourceRoot":"","sources":["../../../src/lib/components/artifact-version-download.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AASH;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,oBAAoB,CAClC,OAAe,EACf,QAAmC,EACnC,YAAuC,EACvC,aAAwC,EACxC,QAAwB;IAExB,MAAM,OAAO,GAAG,+BAA+B,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;IACrE,IAAI,OAAO,EAAE,CAAC;QACZ,MAAM,CAAC,EAAE,WAAW,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC;QACxC,6FAA6F;QAC7F,6FAA6F;QAC7F,sEAAsE;QACtE,IAAI,MAAM,GAAkB,IAAI,CAAC;QACjC,IAAI,CAAC;YACH,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC;QACxB,CAAC;QAAC,MAAM,CAAC;YACP,MAAM,GAAG,IAAI,CAAC;QAChB,CAAC;QACD,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;YACpB,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YAC5C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;gBACvC,KAAK,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;YAClC,CAAC;YACD,OAAO;gBACL,IAAI,EAAE,KAAK;gBACX,QAAQ,EAAE,WAAW;gBACrB,yFAAyF;gBACzF,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,GAAG,YAAY,IAAI,UAAU,KAAK,aAAa,IAAI,CAAC,EAAE;aACrF,CAAC;QACJ,CAAC;QACD,0FAA0F;QAC1F,8BAA8B;IAChC,CAAC;IAED,iGAAiG;IACjG,OAAO;QACL,IAAI,EAAE,OAAO;QACb,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,YAAY;QAC1C,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,GAAG,YAAY,IAAI,UAAU,KAAK,aAAa,IAAI,CAAC,MAAM;KACzF,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Preparing an artifact version for download.\n *\n * Kept separate from the component so the decoding rules are unit-testable without Angular.\n */\n\n/** What the browser should be handed: the bytes (or text), its MIME type, and a filename. */\nexport interface VersionDownload {\n
|
|
1
|
+
{"version":3,"file":"artifact-version-download.js","sourceRoot":"","sources":["../../../src/lib/components/artifact-version-download.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AASH;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,oBAAoB,CAClC,OAAe,EACf,QAAmC,EACnC,YAAuC,EACvC,aAAwC,EACxC,QAAwB;IAExB,MAAM,OAAO,GAAG,+BAA+B,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;IACrE,IAAI,OAAO,EAAE,CAAC;QACZ,MAAM,CAAC,EAAE,WAAW,EAAE,MAAM,CAAC,GAAG,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cesContent":["/**\n * Preparing an artifact version for download.\n *\n * Kept separate from the component so the decoding rules are unit-testable without Angular.\n */\n\n/** What the browser should be handed: the bytes (or text), its MIME type, and a filename. */\nexport interface VersionDownload {\n Data: BlobPart;\n MimeType: string;\n FileName: string;\n}\n\n/**\n * Turn a version's stored `Content` into a real download.\n *\n * An artifact version holding a FILE stores it as a `data:<mime>;base64,...` URI (see\n * `AgentRunner.createInlineFileArtifact`, used whenever no file storage account is configured).\n * Writing that string out verbatim as `text/plain` named `<name>.txt` — which is what this did —\n * produced a text file containing base64, so opening the \"downloaded document\" gave an invalid\n * file format. The bytes were always correct; only the download was wrong.\n *\n * A data URI is therefore decoded to bytes and given its real MIME type and filename. Text\n * content (Markdown, JSON, code) keeps the previous behaviour.\n *\n * @param content the version's `Content`\n * @param fileName the version's `FileName`, when it has one\n * @param artifactName fallback name\n * @param versionNumber used only in the fallback name\n * @param mimeType the version's `MimeType`, used when the content is not a data URI\n */\nexport function BuildVersionDownload(\n content: string,\n fileName: string | null | undefined,\n artifactName: string | null | undefined,\n versionNumber: number | null | undefined,\n mimeType?: string | null\n): VersionDownload {\n const dataUri = /^data:([^;,]+);base64,(.*)$/is.exec(content.trim());\n if (dataUri) {\n const [, uriMimeType, base64] = dataUri;\n // `atob` throws on malformed base64 that still matched the pattern. The caller only logs, so\n // an unguarded throw turns \"download\" into a click that does nothing at all; falling through\n // to the text path at least hands the user the bytes that are stored.\n let binary: string | null = null;\n try {\n binary = atob(base64);\n } catch {\n binary = null;\n }\n if (binary !== null) {\n const bytes = new Uint8Array(binary.length);\n for (let i = 0; i < binary.length; i++) {\n bytes[i] = binary.charCodeAt(i);\n }\n return {\n Data: bytes,\n MimeType: uriMimeType,\n // The stored FileName already carries the correct extension; only fall back when absent.\n FileName: fileName?.trim() || `${artifactName ?? 'artifact'}_v${versionNumber ?? 1}`,\n };\n }\n // Fall through to the text path below: a click that hands over the stored bytes beats one\n // that silently does nothing.\n }\n\n // Text content — unchanged from the original behaviour, but honour a real filename when present.\n return {\n Data: content,\n MimeType: mimeType?.trim() || 'text/plain',\n FileName: fileName?.trim() || `${artifactName ?? 'artifact'}_v${versionNumber ?? 1}.txt`,\n };\n}\n\n/** @deprecated Use {@link BuildVersionDownload}. */\nexport function buildVersionDownload(\n content: string,\n fileName: string | null | undefined,\n artifactName: string | null | undefined,\n versionNumber: number | null | undefined,\n mimeType?: string | null\n): VersionDownload {\n return BuildVersionDownload(content, fileName, artifactName, versionNumber, mimeType);\n}\n"]}
|
|
@@ -5,26 +5,92 @@ import { UserInfo } from '@memberjunction/core';
|
|
|
5
5
|
import * as i0 from "@angular/core";
|
|
6
6
|
export declare class ArtifactVersionHistoryComponent extends BaseAngularComponent implements OnInit {
|
|
7
7
|
private confirmService;
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
Artifact: MJArtifactEntity;
|
|
9
|
+
/** @deprecated Use {@link Artifact}. */
|
|
10
|
+
set artifact(value: MJArtifactEntity);
|
|
11
|
+
/** @deprecated Use {@link Artifact}. */
|
|
12
|
+
get artifact(): MJArtifactEntity;
|
|
13
|
+
CurrentUser: UserInfo;
|
|
14
|
+
/** @deprecated Use {@link CurrentUser}. */
|
|
15
|
+
set currentUser(value: UserInfo);
|
|
16
|
+
/** @deprecated Use {@link CurrentUser}. */
|
|
17
|
+
get currentUser(): UserInfo;
|
|
18
|
+
Closed: EventEmitter<void>;
|
|
19
|
+
/**
|
|
20
|
+
* @deprecated Use {@link Closed}.
|
|
21
|
+
*
|
|
22
|
+
* The same emitter under the old binding name, so a template still binding
|
|
23
|
+
* (closed) keeps working. Must stay AFTER Closed: class fields
|
|
24
|
+
* initialise in order, and the other way round this captures undefined.
|
|
25
|
+
*/
|
|
10
26
|
closed: EventEmitter<void>;
|
|
27
|
+
VersionRestored: EventEmitter<number>;
|
|
28
|
+
/**
|
|
29
|
+
* @deprecated Use {@link VersionRestored}.
|
|
30
|
+
*
|
|
31
|
+
* The same emitter under the old binding name, so a template still binding
|
|
32
|
+
* (versionRestored) keeps working. Must stay AFTER VersionRestored: class fields
|
|
33
|
+
* initialise in order, and the other way round this captures undefined.
|
|
34
|
+
*/
|
|
11
35
|
versionRestored: EventEmitter<number>;
|
|
36
|
+
VersionSelected: EventEmitter<number>;
|
|
37
|
+
/**
|
|
38
|
+
* @deprecated Use {@link VersionSelected}.
|
|
39
|
+
*
|
|
40
|
+
* The same emitter under the old binding name, so a template still binding
|
|
41
|
+
* (versionSelected) keeps working. Must stay AFTER VersionSelected: class fields
|
|
42
|
+
* initialise in order, and the other way round this captures undefined.
|
|
43
|
+
*/
|
|
12
44
|
versionSelected: EventEmitter<number>;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
45
|
+
Versions: MJArtifactVersionEntity[];
|
|
46
|
+
/** @deprecated Use {@link Versions}. */
|
|
47
|
+
get versions(): MJArtifactVersionEntity[];
|
|
48
|
+
/** @deprecated Use {@link Versions}. */
|
|
49
|
+
set versions(value: MJArtifactVersionEntity[]);
|
|
50
|
+
SelectedVersion: number | null;
|
|
51
|
+
/** @deprecated Use {@link SelectedVersion}. */
|
|
52
|
+
get selectedVersion(): number | null;
|
|
53
|
+
/** @deprecated Use {@link SelectedVersion}. */
|
|
54
|
+
set selectedVersion(value: number | null);
|
|
55
|
+
ShowDiff: boolean;
|
|
56
|
+
/** @deprecated Use {@link ShowDiff}. */
|
|
57
|
+
get showDiff(): boolean;
|
|
58
|
+
/** @deprecated Use {@link ShowDiff}. */
|
|
59
|
+
set showDiff(value: boolean);
|
|
60
|
+
CurrentVersionContent: string;
|
|
61
|
+
/** @deprecated Use {@link CurrentVersionContent}. */
|
|
62
|
+
get currentVersionContent(): string;
|
|
63
|
+
/** @deprecated Use {@link CurrentVersionContent}. */
|
|
64
|
+
set currentVersionContent(value: string);
|
|
65
|
+
PreviousVersionContent: string;
|
|
66
|
+
/** @deprecated Use {@link PreviousVersionContent}. */
|
|
67
|
+
get previousVersionContent(): string;
|
|
68
|
+
/** @deprecated Use {@link PreviousVersionContent}. */
|
|
69
|
+
set previousVersionContent(value: string);
|
|
18
70
|
ngOnInit(): void;
|
|
19
71
|
private loadVersions;
|
|
72
|
+
OnSelectVersion(version: MJArtifactVersionEntity): void;
|
|
73
|
+
/** @deprecated Use {@link OnSelectVersion}. */
|
|
20
74
|
onSelectVersion(version: MJArtifactVersionEntity): void;
|
|
75
|
+
OnRestoreVersion(version: MJArtifactVersionEntity): Promise<void>;
|
|
76
|
+
/** @deprecated Use {@link OnRestoreVersion}. */
|
|
21
77
|
onRestoreVersion(version: MJArtifactVersionEntity): Promise<void>;
|
|
78
|
+
OnCompareVersion(version: MJArtifactVersionEntity): Promise<void>;
|
|
79
|
+
/** @deprecated Use {@link OnCompareVersion}. */
|
|
22
80
|
onCompareVersion(version: MJArtifactVersionEntity): Promise<void>;
|
|
81
|
+
OnDownloadVersion(version: MJArtifactVersionEntity): void;
|
|
82
|
+
/** @deprecated Use {@link OnDownloadVersion}. */
|
|
23
83
|
onDownloadVersion(version: MJArtifactVersionEntity): void;
|
|
84
|
+
GetContentSize(content: string | null): string;
|
|
85
|
+
/** @deprecated Use {@link GetContentSize}. */
|
|
24
86
|
getContentSize(content: string | null): string;
|
|
87
|
+
GetDiffSummary(): string;
|
|
88
|
+
/** @deprecated Use {@link GetDiffSummary}. */
|
|
25
89
|
getDiffSummary(): string;
|
|
90
|
+
OnClose(): void;
|
|
91
|
+
/** @deprecated Use {@link OnClose}. */
|
|
26
92
|
onClose(): void;
|
|
27
93
|
static ɵfac: i0.ɵɵFactoryDeclaration<ArtifactVersionHistoryComponent, never>;
|
|
28
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<ArtifactVersionHistoryComponent, "mj-artifact-version-history", never, { "artifact": { "alias": "artifact"; "required": false; }; "currentUser": { "alias": "currentUser"; "required": false; }; }, { "closed": "closed"; "versionRestored": "versionRestored"; "versionSelected": "versionSelected"; }, never, never, false, never>;
|
|
94
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ArtifactVersionHistoryComponent, "mj-artifact-version-history", never, { "Artifact": { "alias": "Artifact"; "required": false; }; "artifact": { "alias": "artifact"; "required": false; }; "CurrentUser": { "alias": "CurrentUser"; "required": false; }; "currentUser": { "alias": "currentUser"; "required": false; }; }, { "Closed": "Closed"; "closed": "closed"; "VersionRestored": "VersionRestored"; "versionRestored": "versionRestored"; "VersionSelected": "VersionSelected"; "versionSelected": "versionSelected"; }, never, never, false, never>;
|
|
29
95
|
}
|
|
30
96
|
//# sourceMappingURL=artifact-version-history.component.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"artifact-version-history.component.d.ts","sourceRoot":"","sources":["../../../src/lib/components/artifact-version-history.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,YAAY,EAAE,MAAM,EAAU,MAAM,eAAe,CAAC;AACvF,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAErE,OAAO,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAC1F,OAAO,EAAE,QAAQ,EAAW,MAAM,sBAAsB,CAAC;;AAGzD,qBAuGa,+BAAgC,SAAQ,oBAAqB,YAAW,MAAM;IACzF,OAAO,CAAC,cAAc,CAA4B;IAEzC,QAAQ,EAAG,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"artifact-version-history.component.d.ts","sourceRoot":"","sources":["../../../src/lib/components/artifact-version-history.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,YAAY,EAAE,MAAM,EAAU,MAAM,eAAe,CAAC;AACvF,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAErE,OAAO,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAC1F,OAAO,EAAE,QAAQ,EAAW,MAAM,sBAAsB,CAAC;;AAGzD,qBAuGa,+BAAgC,SAAQ,oBAAqB,YAAW,MAAM;IACzF,OAAO,CAAC,cAAc,CA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;IACD,sDAAsD;IACtD,IAAW,sBAAsB,CAAC,KAAK,EAAE,MAAM,EAE9C;IAED,QAAQ;YAIM,YAAY;IAkB1B,eAAe,CAAC,OAAO,EAAE,uBAAuB,GAAG,IAAI;IAKvD,+CAA+C;IAC/C,eAAe,CAAC,OAAO,EAAE,uBAAuB,GAAG,IAAI;IAIjD,gBAAgB,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,IAAI,CAAC;IAavE,gDAAgD;IAC1C,gBAAgB,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,IAAI,CAAC;IAIjE,gBAAgB,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,IAAI,CAAC;IAqBvE,gDAAgD;IAC1C,gBAAgB,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,IAAI,CAAC;IAIvE,iBAAiB,CAAC,OAAO,EAAE,uBAAuB,GAAG,IAAI;IAiBzD,iDAAiD;IACjD,iBAAiB,CAAC,OAAO,EAAE,uBAAuB,GAAG,IAAI;IAIzD,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM;IAQ9C,8CAA8C;IAC9C,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM;IAI9C,cAAc,IAAI,MAAM;IAYxB,8CAA8C;IAC9C,cAAc,IAAI,MAAM;IAIxB,OAAO,IAAI,IAAI;IAIf,uCAAuC;IACvC,OAAO,IAAI,IAAI;yCA/OJ,+BAA+B;2CAA/B,+BAA+B;CAkP3C"}
|
|
@@ -2,7 +2,7 @@ import { Component, Input, Output, EventEmitter, inject } from '@angular/core';
|
|
|
2
2
|
import { BaseAngularComponent } from '@memberjunction/ng-base-types';
|
|
3
3
|
import { MJConfirmService } from '@memberjunction/ng-ui-components';
|
|
4
4
|
import { RunView } from '@memberjunction/core';
|
|
5
|
-
import {
|
|
5
|
+
import { BuildVersionDownload } from './artifact-version-download.js';
|
|
6
6
|
import * as i0 from "@angular/core";
|
|
7
7
|
import * as i1 from "@memberjunction/ng-ui-components";
|
|
8
8
|
import * as i2 from "@angular/common";
|
|
@@ -77,16 +77,96 @@ function ArtifactVersionHistoryComponent_Conditional_10_Template(rf, ctx) { if (
|
|
|
77
77
|
} }
|
|
78
78
|
export class ArtifactVersionHistoryComponent extends BaseAngularComponent {
|
|
79
79
|
confirmService = inject(MJConfirmService);
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
80
|
+
Artifact;
|
|
81
|
+
/** @deprecated Use {@link Artifact}. */
|
|
82
|
+
set artifact(value) {
|
|
83
|
+
this.Artifact = value;
|
|
84
|
+
}
|
|
85
|
+
/** @deprecated Use {@link Artifact}. */
|
|
86
|
+
get artifact() {
|
|
87
|
+
return this.Artifact;
|
|
88
|
+
}
|
|
89
|
+
CurrentUser;
|
|
90
|
+
/** @deprecated Use {@link CurrentUser}. */
|
|
91
|
+
set currentUser(value) {
|
|
92
|
+
this.CurrentUser = value;
|
|
93
|
+
}
|
|
94
|
+
/** @deprecated Use {@link CurrentUser}. */
|
|
95
|
+
get currentUser() {
|
|
96
|
+
return this.CurrentUser;
|
|
97
|
+
}
|
|
98
|
+
Closed = new EventEmitter();
|
|
99
|
+
/**
|
|
100
|
+
* @deprecated Use {@link Closed}.
|
|
101
|
+
*
|
|
102
|
+
* The same emitter under the old binding name, so a template still binding
|
|
103
|
+
* (closed) keeps working. Must stay AFTER Closed: class fields
|
|
104
|
+
* initialise in order, and the other way round this captures undefined.
|
|
105
|
+
*/
|
|
106
|
+
closed = this.Closed;
|
|
107
|
+
VersionRestored = new EventEmitter();
|
|
108
|
+
/**
|
|
109
|
+
* @deprecated Use {@link VersionRestored}.
|
|
110
|
+
*
|
|
111
|
+
* The same emitter under the old binding name, so a template still binding
|
|
112
|
+
* (versionRestored) keeps working. Must stay AFTER VersionRestored: class fields
|
|
113
|
+
* initialise in order, and the other way round this captures undefined.
|
|
114
|
+
*/
|
|
115
|
+
versionRestored = this.VersionRestored;
|
|
116
|
+
VersionSelected = new EventEmitter();
|
|
117
|
+
/**
|
|
118
|
+
* @deprecated Use {@link VersionSelected}.
|
|
119
|
+
*
|
|
120
|
+
* The same emitter under the old binding name, so a template still binding
|
|
121
|
+
* (versionSelected) keeps working. Must stay AFTER VersionSelected: class fields
|
|
122
|
+
* initialise in order, and the other way round this captures undefined.
|
|
123
|
+
*/
|
|
124
|
+
versionSelected = this.VersionSelected;
|
|
125
|
+
Versions = [];
|
|
126
|
+
/** @deprecated Use {@link Versions}. */
|
|
127
|
+
get versions() {
|
|
128
|
+
return this.Versions;
|
|
129
|
+
}
|
|
130
|
+
/** @deprecated Use {@link Versions}. */
|
|
131
|
+
set versions(value) {
|
|
132
|
+
this.Versions = value;
|
|
133
|
+
}
|
|
134
|
+
SelectedVersion = null;
|
|
135
|
+
/** @deprecated Use {@link SelectedVersion}. */
|
|
136
|
+
get selectedVersion() {
|
|
137
|
+
return this.SelectedVersion;
|
|
138
|
+
}
|
|
139
|
+
/** @deprecated Use {@link SelectedVersion}. */
|
|
140
|
+
set selectedVersion(value) {
|
|
141
|
+
this.SelectedVersion = value;
|
|
142
|
+
}
|
|
143
|
+
ShowDiff = false;
|
|
144
|
+
/** @deprecated Use {@link ShowDiff}. */
|
|
145
|
+
get showDiff() {
|
|
146
|
+
return this.ShowDiff;
|
|
147
|
+
}
|
|
148
|
+
/** @deprecated Use {@link ShowDiff}. */
|
|
149
|
+
set showDiff(value) {
|
|
150
|
+
this.ShowDiff = value;
|
|
151
|
+
}
|
|
152
|
+
CurrentVersionContent = '';
|
|
153
|
+
/** @deprecated Use {@link CurrentVersionContent}. */
|
|
154
|
+
get currentVersionContent() {
|
|
155
|
+
return this.CurrentVersionContent;
|
|
156
|
+
}
|
|
157
|
+
/** @deprecated Use {@link CurrentVersionContent}. */
|
|
158
|
+
set currentVersionContent(value) {
|
|
159
|
+
this.CurrentVersionContent = value;
|
|
160
|
+
}
|
|
161
|
+
PreviousVersionContent = '';
|
|
162
|
+
/** @deprecated Use {@link PreviousVersionContent}. */
|
|
163
|
+
get previousVersionContent() {
|
|
164
|
+
return this.PreviousVersionContent;
|
|
165
|
+
}
|
|
166
|
+
/** @deprecated Use {@link PreviousVersionContent}. */
|
|
167
|
+
set previousVersionContent(value) {
|
|
168
|
+
this.PreviousVersionContent = value;
|
|
169
|
+
}
|
|
90
170
|
ngOnInit() {
|
|
91
171
|
this.loadVersions();
|
|
92
172
|
}
|
|
@@ -95,28 +175,32 @@ export class ArtifactVersionHistoryComponent extends BaseAngularComponent {
|
|
|
95
175
|
const rv = RunView.FromMetadataProvider(this.ProviderToUse);
|
|
96
176
|
const result = await rv.RunView({
|
|
97
177
|
EntityName: 'MJ: Artifact Versions',
|
|
98
|
-
ExtraFilter: `ArtifactID='${this.
|
|
178
|
+
ExtraFilter: `ArtifactID='${this.Artifact.ID}'`,
|
|
99
179
|
OrderBy: 'VersionNumber DESC',
|
|
100
180
|
ResultType: 'entity_object'
|
|
101
|
-
}, this.
|
|
181
|
+
}, this.CurrentUser);
|
|
102
182
|
if (result.Success) {
|
|
103
|
-
this.
|
|
183
|
+
this.Versions = result.Results || [];
|
|
104
184
|
}
|
|
105
185
|
}
|
|
106
186
|
catch (error) {
|
|
107
187
|
console.error('Failed to load version history:', error);
|
|
108
188
|
}
|
|
109
189
|
}
|
|
190
|
+
OnSelectVersion(version) {
|
|
191
|
+
this.SelectedVersion = version.VersionNumber;
|
|
192
|
+
this.VersionSelected.emit(version.VersionNumber);
|
|
193
|
+
}
|
|
194
|
+
/** @deprecated Use {@link OnSelectVersion}. */
|
|
110
195
|
onSelectVersion(version) {
|
|
111
|
-
this.
|
|
112
|
-
this.versionSelected.emit(version.VersionNumber);
|
|
196
|
+
return this.OnSelectVersion(version);
|
|
113
197
|
}
|
|
114
|
-
async
|
|
198
|
+
async OnRestoreVersion(version) {
|
|
115
199
|
if (!(await this.confirmService.Confirm({ title: 'Restore version', message: `Restore to version ${version.VersionNumber}?`, detail: 'This will create a new version.' })))
|
|
116
200
|
return;
|
|
117
201
|
try {
|
|
118
202
|
// Restoring creates a new version with the old content
|
|
119
|
-
this.
|
|
203
|
+
this.VersionRestored.emit(version.VersionNumber);
|
|
120
204
|
alert(`Version ${version.VersionNumber} has been restored as the latest version`);
|
|
121
205
|
}
|
|
122
206
|
catch (error) {
|
|
@@ -124,18 +208,22 @@ export class ArtifactVersionHistoryComponent extends BaseAngularComponent {
|
|
|
124
208
|
alert('Failed to restore version');
|
|
125
209
|
}
|
|
126
210
|
}
|
|
127
|
-
|
|
211
|
+
/** @deprecated Use {@link OnRestoreVersion}. */
|
|
212
|
+
async onRestoreVersion(version) {
|
|
213
|
+
return this.OnRestoreVersion(version);
|
|
214
|
+
}
|
|
215
|
+
async OnCompareVersion(version) {
|
|
128
216
|
if (version.VersionNumber === 1) {
|
|
129
217
|
alert('Cannot compare: this is the first version');
|
|
130
218
|
return;
|
|
131
219
|
}
|
|
132
220
|
try {
|
|
133
|
-
this.
|
|
221
|
+
this.CurrentVersionContent = version.Content || '';
|
|
134
222
|
// Load previous version
|
|
135
|
-
const previousVersion = this.
|
|
223
|
+
const previousVersion = this.Versions.find(v => v.VersionNumber === version.VersionNumber - 1);
|
|
136
224
|
if (previousVersion) {
|
|
137
|
-
this.
|
|
138
|
-
this.
|
|
225
|
+
this.PreviousVersionContent = previousVersion.Content || '';
|
|
226
|
+
this.ShowDiff = true;
|
|
139
227
|
}
|
|
140
228
|
}
|
|
141
229
|
catch (error) {
|
|
@@ -143,15 +231,19 @@ export class ArtifactVersionHistoryComponent extends BaseAngularComponent {
|
|
|
143
231
|
alert('Failed to compare versions');
|
|
144
232
|
}
|
|
145
233
|
}
|
|
146
|
-
|
|
234
|
+
/** @deprecated Use {@link OnCompareVersion}. */
|
|
235
|
+
async onCompareVersion(version) {
|
|
236
|
+
return this.OnCompareVersion(version);
|
|
237
|
+
}
|
|
238
|
+
OnDownloadVersion(version) {
|
|
147
239
|
try {
|
|
148
240
|
const content = version.Content || '';
|
|
149
|
-
const download =
|
|
150
|
-
const blob = new Blob([download.
|
|
241
|
+
const download = BuildVersionDownload(content, version.FileName, this.Artifact.Name, version.VersionNumber, version.MimeType);
|
|
242
|
+
const blob = new Blob([download.Data], { type: download.MimeType });
|
|
151
243
|
const url = window.URL.createObjectURL(blob);
|
|
152
244
|
const link = document.createElement('a');
|
|
153
245
|
link.href = url;
|
|
154
|
-
link.download = download.
|
|
246
|
+
link.download = download.FileName;
|
|
155
247
|
link.click();
|
|
156
248
|
window.URL.revokeObjectURL(url);
|
|
157
249
|
}
|
|
@@ -160,7 +252,11 @@ export class ArtifactVersionHistoryComponent extends BaseAngularComponent {
|
|
|
160
252
|
alert('Failed to download version');
|
|
161
253
|
}
|
|
162
254
|
}
|
|
163
|
-
|
|
255
|
+
/** @deprecated Use {@link OnDownloadVersion}. */
|
|
256
|
+
onDownloadVersion(version) {
|
|
257
|
+
return this.OnDownloadVersion(version);
|
|
258
|
+
}
|
|
259
|
+
GetContentSize(content) {
|
|
164
260
|
if (!content)
|
|
165
261
|
return '0 B';
|
|
166
262
|
const bytes = new Blob([content]).size;
|
|
@@ -170,20 +266,32 @@ export class ArtifactVersionHistoryComponent extends BaseAngularComponent {
|
|
|
170
266
|
return `${(bytes / 1024).toFixed(1)} KB`;
|
|
171
267
|
return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
|
|
172
268
|
}
|
|
173
|
-
|
|
269
|
+
/** @deprecated Use {@link GetContentSize}. */
|
|
270
|
+
getContentSize(content) {
|
|
271
|
+
return this.GetContentSize(content);
|
|
272
|
+
}
|
|
273
|
+
GetDiffSummary() {
|
|
174
274
|
// Simple line-based diff summary
|
|
175
|
-
const currentLines = this.
|
|
176
|
-
const previousLines = this.
|
|
275
|
+
const currentLines = this.CurrentVersionContent.split('\n');
|
|
276
|
+
const previousLines = this.PreviousVersionContent.split('\n');
|
|
177
277
|
const added = currentLines.length - previousLines.length;
|
|
178
278
|
const summary = `Lines: ${previousLines.length} → ${currentLines.length} (${added > 0 ? '+' : ''}${added})\n\n`;
|
|
179
279
|
// Show a simple comparison
|
|
180
280
|
return summary + '(Full diff view would require a diff library)';
|
|
181
281
|
}
|
|
282
|
+
/** @deprecated Use {@link GetDiffSummary}. */
|
|
283
|
+
getDiffSummary() {
|
|
284
|
+
return this.GetDiffSummary();
|
|
285
|
+
}
|
|
286
|
+
OnClose() {
|
|
287
|
+
this.Closed.emit();
|
|
288
|
+
}
|
|
289
|
+
/** @deprecated Use {@link OnClose}. */
|
|
182
290
|
onClose() {
|
|
183
|
-
this.
|
|
291
|
+
return this.OnClose();
|
|
184
292
|
}
|
|
185
293
|
static ɵfac = /*@__PURE__*/ (() => { let ɵArtifactVersionHistoryComponent_BaseFactory; return function ArtifactVersionHistoryComponent_Factory(__ngFactoryType__) { return (ɵArtifactVersionHistoryComponent_BaseFactory || (ɵArtifactVersionHistoryComponent_BaseFactory = i0.ɵɵgetInheritedFactory(ArtifactVersionHistoryComponent)))(__ngFactoryType__ || ArtifactVersionHistoryComponent); }; })();
|
|
186
|
-
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: ArtifactVersionHistoryComponent, selectors: [["mj-artifact-version-history"]], inputs: { artifact: "artifact", currentUser: "currentUser" }, outputs: { closed: "closed", versionRestored: "versionRestored", versionSelected: "versionSelected" }, standalone: false, features: [i0.ɵɵInheritDefinitionFeature], decls: 11, vars: 2, consts: [[1, "version-history"], [1, "history-header"], ["title", "Close", 1, "btn-close", 3, "click"], [1, "fas", "fa-times"], [1, "version-list"], ["Icon", "fa-solid fa-clock-rotate-left", "Title", "No version history available", "Size", "compact"], [1, "version-item", 3, "selected"], [1, "diff-panel"], [1, "version-item", 3, "click"], [1, "version-header"], [1, "version-info"], [1, "version-number"], [1, "version-date"], [1, "version-meta"], [1, "version-size"], [1, "version-actions"], [1, "btn-action", 3, "click"], [1, "fas", "fa-undo"], [1, "fas", "fa-code-compare"], [1, "fas", "fa-download"], [1, "diff-header"], [1, "btn-close-diff", 3, "click"], [1, "diff-content"]], template: function ArtifactVersionHistoryComponent_Template(rf, ctx) { if (rf & 1) {
|
|
294
|
+
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: ArtifactVersionHistoryComponent, selectors: [["mj-artifact-version-history"]], inputs: { Artifact: "Artifact", artifact: "artifact", CurrentUser: "CurrentUser", currentUser: "currentUser" }, outputs: { Closed: "Closed", closed: "closed", VersionRestored: "VersionRestored", versionRestored: "versionRestored", VersionSelected: "VersionSelected", versionSelected: "versionSelected" }, standalone: false, features: [i0.ɵɵInheritDefinitionFeature], decls: 11, vars: 2, consts: [[1, "version-history"], [1, "history-header"], ["title", "Close", 1, "btn-close", 3, "click"], [1, "fas", "fa-times"], [1, "version-list"], ["Icon", "fa-solid fa-clock-rotate-left", "Title", "No version history available", "Size", "compact"], [1, "version-item", 3, "selected"], [1, "diff-panel"], [1, "version-item", 3, "click"], [1, "version-header"], [1, "version-info"], [1, "version-number"], [1, "version-date"], [1, "version-meta"], [1, "version-size"], [1, "version-actions"], [1, "btn-action", 3, "click"], [1, "fas", "fa-undo"], [1, "fas", "fa-code-compare"], [1, "fas", "fa-download"], [1, "diff-header"], [1, "btn-close-diff", 3, "click"], [1, "diff-content"]], template: function ArtifactVersionHistoryComponent_Template(rf, ctx) { if (rf & 1) {
|
|
187
295
|
i0.ɵɵelementStart(0, "div", 0)(1, "div", 1)(2, "h3");
|
|
188
296
|
i0.ɵɵtext(3, "Version History");
|
|
189
297
|
i0.ɵɵelementEnd();
|
|
@@ -273,14 +381,24 @@ export class ArtifactVersionHistoryComponent extends BaseAngularComponent {
|
|
|
273
381
|
}
|
|
274
382
|
</div>
|
|
275
383
|
`, styles: ["\n .version-history { display: flex; flex-direction: column; height: 100%; background: white; }\n .history-header { padding: 16px; border-bottom: 1px solid #D9D9D9; display: flex; justify-content: space-between; align-items: center; }\n .history-header h3 { margin: 0; font-size: 16px; }\n .btn-close { padding: 6px; background: transparent; border: none; cursor: pointer; border-radius: 3px; color: #666; }\n .btn-close:hover { background: rgba(0,0,0,0.1); }\n\n .version-list { flex: 1; overflow-y: auto; }\n .version-item { padding: 16px; border-bottom: 1px solid #E8E8E8; cursor: pointer; transition: background 150ms ease; }\n .version-item:hover { background: #F9F9F9; }\n .version-item.selected { background: #E3F2FD; border-left: 3px solid #1976D2; }\n\n .version-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }\n .version-info { display: flex; flex-direction: column; gap: 4px; }\n .version-number { font-size: 14px; font-weight: 600; }\n .version-date { font-size: 12px; color: #666; }\n .version-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: 12px; color: #666; }\n .version-author { display: flex; align-items: center; gap: 4px; }\n .version-size { color: #999; }\n\n .version-notes { font-size: 13px; color: #333; margin-bottom: 8px; }\n\n .version-actions { display: flex; gap: 8px; margin-top: 12px; }\n .btn-action { padding: 6px 12px; background: #0076B6; color: white; border: none; border-radius: 4px; cursor: pointer; font-size: 12px; display: flex; align-items: center; gap: 6px; }\n .btn-action:hover { background: #005A8C; }\n\n .diff-panel { border-top: 2px solid #D9D9D9; max-height: 50%; overflow: hidden; display: flex; flex-direction: column; }\n .diff-header { padding: 12px 16px; background: #F8F8F8; border-bottom: 1px solid #D9D9D9; display: flex; justify-content: space-between; align-items: center; }\n .diff-header h4 { margin: 0; font-size: 13px; font-weight: 600; }\n .btn-close-diff { padding: 4px; background: transparent; border: none; cursor: pointer; border-radius: 3px; color: #666; }\n .btn-close-diff:hover { background: rgba(0,0,0,0.1); }\n .diff-content { flex: 1; overflow-y: auto; padding: 16px; }\n .diff-content pre { margin: 0; font-family: 'Courier New', monospace; font-size: 12px; white-space: pre-wrap; }\n "] }]
|
|
276
|
-
}], null, {
|
|
384
|
+
}], null, { Artifact: [{
|
|
385
|
+
type: Input
|
|
386
|
+
}], artifact: [{
|
|
387
|
+
type: Input
|
|
388
|
+
}], CurrentUser: [{
|
|
277
389
|
type: Input
|
|
278
390
|
}], currentUser: [{
|
|
279
391
|
type: Input
|
|
392
|
+
}], Closed: [{
|
|
393
|
+
type: Output
|
|
280
394
|
}], closed: [{
|
|
281
395
|
type: Output
|
|
396
|
+
}], VersionRestored: [{
|
|
397
|
+
type: Output
|
|
282
398
|
}], versionRestored: [{
|
|
283
399
|
type: Output
|
|
400
|
+
}], VersionSelected: [{
|
|
401
|
+
type: Output
|
|
284
402
|
}], versionSelected: [{
|
|
285
403
|
type: Output
|
|
286
404
|
}] }); })();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"artifact-version-history.component.js","sourceRoot":"","sources":["../../../src/lib/components/artifact-version-history.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,YAAY,EAAU,MAAM,EAAE,MAAM,eAAe,CAAC;AACvF,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAEpE,OAAO,EAAY,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;;;;;IAgB5D,oCAGmB;;;;IAqBb,AADF,+BAA6B,iBAC8D;IAA9D,2OAAS,mCAAyB,wBAAE,wBAAwB,KAAC;IACtF,wBAA2B;IAAC,yBAC9B;IAAA,iBAAS;IACT,kCAAyF;IAA9D,2OAAS,mCAAyB,wBAAE,wBAAwB,KAAC;IACtF,wBAAmC;IAAC,yBACtC;IAAA,iBAAS;IACT,kCAA0F;IAA/D,2OAAS,oCAA0B,wBAAE,wBAAwB,KAAC;IACvF,wBAA+B;IAAC,0BAClC;IACF,AADE,iBAAS,EACL;;;;IA1BV,8BAGqC;IAAnC,qNAAS,kCAAwB,KAAC;IAG9B,AADF,AADF,8BAA4B,cACA,eACK;IAAA,YAA4B;IAAA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AC,CAAC,CAAC,EAAE,GAAG,KAAK,OAAO,CAAC;QAEhH,2BAA2B;QAC3B,OAAO,OAAO,GAAG,+CAA+C,CAAC;IACnE,CAAC;IAED,OAAO;QACL,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;IACrB,CAAC;ySApHU,+BAA+B,yBAA/B,+BAA+B;6DAA/B,+BAA+B;YAjGpC,AADF,AADF,8BAA6B,aACC,SACtB;YAAA,+BAAe;YAAA,iBAAK;YACxB,iCAA4D;YAAlC,4GAAS,aAAS,IAAC;YAC3C,uBAA4B;YAEhC,AADE,iBAAS,EACL;YAEN,8BAA0B;YACxB,4GAA6B;YAO7B,qHA8BC;YACH,iBAAM;YAEN,mGAAsF;YAaxF,iBAAM;;YArDF,eAKC;YALD,oDAKC;YAED,cA8BC;YA9BD,2BA8BC;YAGH,eAYC;YAZD,0HAYC;;;iFAsCM,+BAA+B;cAvG3C,SAAS;6BACI,KAAK,YACP,6BAA6B,YAC7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAgEP;;kBAuCF,KAAK;;kBACL,KAAK;;kBAEL,MAAM;;kBACN,MAAM;;kBACN,MAAM;;kFARI,+BAA+B","sourcesContent":["import { Component, Input, Output, EventEmitter, OnInit, inject } from '@angular/core';\nimport { BaseAngularComponent } from '@memberjunction/ng-base-types';\nimport { MJConfirmService } from '@memberjunction/ng-ui-components';\nimport { MJArtifactEntity, MJArtifactVersionEntity } from '@memberjunction/core-entities';\nimport { UserInfo, RunView } from '@memberjunction/core';\nimport { buildVersionDownload } from './artifact-version-download.js';\n\n@Component({\n standalone: false,\n selector: 'mj-artifact-version-history',\n template: `\n <div class=\"version-history\">\n <div class=\"history-header\">\n <h3>Version History</h3>\n <button class=\"btn-close\" (click)=\"onClose()\" title=\"Close\">\n <i class=\"fas fa-times\"></i>\n </button>\n </div>\n \n <div class=\"version-list\">\n @if (versions.length === 0) {\n <mj-empty-state\n Icon=\"fa-solid fa-clock-rotate-left\"\n Title=\"No version history available\"\n Size=\"compact\" />\n }\n \n @for (version of versions; track version) {\n <div\n class=\"version-item\"\n [class.selected]=\"version.VersionNumber === selectedVersion\"\n (click)=\"onSelectVersion(version)\">\n <div class=\"version-header\">\n <div class=\"version-info\">\n <span class=\"version-number\">v{{ version.VersionNumber }}</span>\n <span class=\"version-date\">{{ version.__mj_CreatedAt | date:'short' }}</span>\n </div>\n <div class=\"version-meta\">\n <span class=\"version-size\">\n {{ getContentSize(version.Content) }}\n </span>\n </div>\n </div>\n @if (version.VersionNumber === selectedVersion) {\n <div class=\"version-actions\">\n <button class=\"btn-action\" (click)=\"onRestoreVersion(version); $event.stopPropagation()\">\n <i class=\"fas fa-undo\"></i> Restore\n </button>\n <button class=\"btn-action\" (click)=\"onCompareVersion(version); $event.stopPropagation()\">\n <i class=\"fas fa-code-compare\"></i> Compare\n </button>\n <button class=\"btn-action\" (click)=\"onDownloadVersion(version); $event.stopPropagation()\">\n <i class=\"fas fa-download\"></i> Download\n </button>\n </div>\n }\n </div>\n }\n </div>\n \n @if (showDiff && currentVersionContent && previousVersionContent && selectedVersion) {\n <div class=\"diff-panel\">\n <div class=\"diff-header\">\n <h4>Changes from v{{ (selectedVersion || 1) - 1 }} to v{{ selectedVersion }}</h4>\n <button class=\"btn-close-diff\" (click)=\"showDiff = false\">\n <i class=\"fas fa-times\"></i>\n </button>\n </div>\n <div class=\"diff-content\">\n <pre>{{ getDiffSummary() }}</pre>\n </div>\n </div>\n }\n </div>\n `,\n styles: [`\n .version-history { display: flex; flex-direction: column; height: 100%; background: white; }\n .history-header { padding: 16px; border-bottom: 1px solid #D9D9D9; display: flex; justify-content: space-between; align-items: center; }\n .history-header h3 { margin: 0; font-size: 16px; }\n .btn-close { padding: 6px; background: transparent; border: none; cursor: pointer; border-radius: 3px; color: #666; }\n .btn-close:hover { background: rgba(0,0,0,0.1); }\n\n .version-list { flex: 1; overflow-y: auto; }\n .version-item { padding: 16px; border-bottom: 1px solid #E8E8E8; cursor: pointer; transition: background 150ms ease; }\n .version-item:hover { background: #F9F9F9; }\n .version-item.selected { background: #E3F2FD; border-left: 3px solid #1976D2; }\n\n .version-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }\n .version-info { display: flex; flex-direction: column; gap: 4px; }\n .version-number { font-size: 14px; font-weight: 600; }\n .version-date { font-size: 12px; color: #666; }\n .version-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: 12px; color: #666; }\n .version-author { display: flex; align-items: center; gap: 4px; }\n .version-size { color: #999; }\n\n .version-notes { font-size: 13px; color: #333; margin-bottom: 8px; }\n\n .version-actions { display: flex; gap: 8px; margin-top: 12px; }\n .btn-action { padding: 6px 12px; background: #0076B6; color: white; border: none; border-radius: 4px; cursor: pointer; font-size: 12px; display: flex; align-items: center; gap: 6px; }\n .btn-action:hover { background: #005A8C; }\n\n .diff-panel { border-top: 2px solid #D9D9D9; max-height: 50%; overflow: hidden; display: flex; flex-direction: column; }\n .diff-header { padding: 12px 16px; background: #F8F8F8; border-bottom: 1px solid #D9D9D9; display: flex; justify-content: space-between; align-items: center; }\n .diff-header h4 { margin: 0; font-size: 13px; font-weight: 600; }\n .btn-close-diff { padding: 4px; background: transparent; border: none; cursor: pointer; border-radius: 3px; color: #666; }\n .btn-close-diff:hover { background: rgba(0,0,0,0.1); }\n .diff-content { flex: 1; overflow-y: auto; padding: 16px; }\n .diff-content pre { margin: 0; font-family: 'Courier New', monospace; font-size: 12px; white-space: pre-wrap; }\n `]\n})\nexport class ArtifactVersionHistoryComponent extends BaseAngularComponent implements OnInit {\n private confirmService = inject(MJConfirmService);\n\n @Input() artifact!: MJArtifactEntity;\n @Input() currentUser!: UserInfo;\n\n @Output() closed = new EventEmitter<void>();\n @Output() versionRestored = new EventEmitter<number>();\n @Output() versionSelected = new EventEmitter<number>();\n\n public versions: MJArtifactVersionEntity[] = [];\n public selectedVersion: number | null = null;\n public showDiff: boolean = false;\n public currentVersionContent: string = '';\n public previousVersionContent: string = '';\n\n ngOnInit() {\n this.loadVersions();\n }\n\n private async loadVersions(): Promise<void> {\n try {\n const rv = RunView.FromMetadataProvider(this.ProviderToUse);\n const result = await rv.RunView<MJArtifactVersionEntity>({\n EntityName: 'MJ: Artifact Versions',\n ExtraFilter: `ArtifactID='${this.artifact.ID}'`,\n OrderBy: 'VersionNumber DESC',\n ResultType: 'entity_object'\n }, this.currentUser);\n\n if (result.Success) {\n this.versions = result.Results || [];\n }\n } catch (error) {\n console.error('Failed to load version history:', error);\n }\n }\n\n onSelectVersion(version: MJArtifactVersionEntity): void {\n this.selectedVersion = version.VersionNumber;\n this.versionSelected.emit(version.VersionNumber);\n }\n\n async onRestoreVersion(version: MJArtifactVersionEntity): Promise<void> {\n if (!(await this.confirmService.Confirm({ title: 'Restore version', message: `Restore to version ${version.VersionNumber}?`, detail: 'This will create a new version.' }))) return;\n\n try {\n // Restoring creates a new version with the old content\n this.versionRestored.emit(version.VersionNumber);\n alert(`Version ${version.VersionNumber} has been restored as the latest version`);\n } catch (error) {\n console.error('Failed to restore version:', error);\n alert('Failed to restore version');\n }\n }\n\n async onCompareVersion(version: MJArtifactVersionEntity): Promise<void> {\n if (version.VersionNumber === 1) {\n alert('Cannot compare: this is the first version');\n return;\n }\n\n try {\n this.currentVersionContent = version.Content || '';\n\n // Load previous version\n const previousVersion = this.versions.find(v => v.VersionNumber === version.VersionNumber - 1);\n if (previousVersion) {\n this.previousVersionContent = previousVersion.Content || '';\n this.showDiff = true;\n }\n } catch (error) {\n console.error('Failed to load version for comparison:', error);\n alert('Failed to compare versions');\n }\n }\n\n onDownloadVersion(version: MJArtifactVersionEntity): void {\n try {\n const content = version.Content || '';\n const download = buildVersionDownload(content, version.FileName, this.artifact.Name, version.VersionNumber, version.MimeType);\n const blob = new Blob([download.data], { type: download.mimeType });\n const url = window.URL.createObjectURL(blob);\n const link = document.createElement('a');\n link.href = url;\n link.download = download.fileName;\n link.click();\n window.URL.revokeObjectURL(url);\n } catch (error) {\n console.error('Failed to download version:', error);\n alert('Failed to download version');\n }\n }\n\n getContentSize(content: string | null): string {\n if (!content) return '0 B';\n const bytes = new Blob([content]).size;\n if (bytes < 1024) return `${bytes} B`;\n if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;\n return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;\n }\n\n getDiffSummary(): string {\n // Simple line-based diff summary\n const currentLines = this.currentVersionContent.split('\\n');\n const previousLines = this.previousVersionContent.split('\\n');\n\n const added = currentLines.length - previousLines.length;\n const summary = `Lines: ${previousLines.length} → ${currentLines.length} (${added > 0 ? '+' : ''}${added})\\n\\n`;\n\n // Show a simple comparison\n return summary + '(Full diff view would require a diff library)';\n }\n\n onClose(): void {\n this.closed.emit();\n }\n}"]}
|
|
1
|
+
{"version":3,"file":"artifact-version-history.component.js","sourceRoot":"","sources":["../../../src/lib/components/artifact-version-history.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,YAAY,EAAU,MAAM,EAAE,MAAM,eAAe,CAAC;AACvF,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAEpE,OAAO,EAAY,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;;;;;IAgB5D,oCAGmB;;;;IAqBb,AADF,+BAA6B,iBAC8D;IAA9D,2OAAS,mCAAyB,wBAAE,wBAAwB,KAAC;IACtF,wBAA2B;IAAC,yBAC9B;IAAA,iBAAS;IACT,kCAAyF;IAA9D,2OAAS,mCAAyB,wBAAE,wBAAwB,KAAC;IACtF,wBAAmC;IAAC,yBACtC;IAAA,iBAAS;IACT,kCAA0F;IAA/D,2OAAS,oCAA0B,wBAAE,wBAAwB,KAAC;IACvF,wBAA+B;IAAC,0BAClC;IAC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,CAAC,OAAO,EAAE,CAAC;IACxB,CAAC;ySAjPU,+BAA+B,yBAA/B,+BAA+B;6DAA/B,+BAA+B;YAjGpC,AADF,AADF,8BAA6B,aACC,SACtB;YAAA,+BAAe;YAAA,iBAAK;YACxB,iCAA4D;YAAlC,4GAAS,aAAS,IAAC;YAC3C,uBAA4B;YAEhC,AADE,iBAAS,EACL;YAEN,8BAA0B;YACxB,4GAA6B;YAO7B,qHA8BC;YACH,iBAAM;YAEN,mGAAsF;YAaxF,iBAAM;;YArDF,eAKC;YALD,oDAKC;YAED,cA8BC;YA9BD,2BA8BC;YAGH,eAYC;YAZD,0HAYC;;;iFAsCM,+BAA+B;cAvG3C,SAAS;6BACI,KAAK,YACP,6BAA6B,YAC7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAgEP;;kBAuCF,KAAK;;kBAGL,KAAK;;kBAOL,KAAK;;kBAGL,KAAK;;kBAQL,MAAM;;kBASN,MAAM;;kBACN,MAAM;;kBASN,MAAM;;kBACN,MAAM;;kBASN,MAAM;;kFArDI,+BAA+B","sourcesContent":["import { Component, Input, Output, EventEmitter, OnInit, inject } from '@angular/core';\nimport { BaseAngularComponent } from '@memberjunction/ng-base-types';\nimport { MJConfirmService } from '@memberjunction/ng-ui-components';\nimport { MJArtifactEntity, MJArtifactVersionEntity } from '@memberjunction/core-entities';\nimport { UserInfo, RunView } from '@memberjunction/core';\nimport { BuildVersionDownload } from './artifact-version-download.js';\n\n@Component({\n standalone: false,\n selector: 'mj-artifact-version-history',\n template: `\n <div class=\"version-history\">\n <div class=\"history-header\">\n <h3>Version History</h3>\n <button class=\"btn-close\" (click)=\"onClose()\" title=\"Close\">\n <i class=\"fas fa-times\"></i>\n </button>\n </div>\n \n <div class=\"version-list\">\n @if (versions.length === 0) {\n <mj-empty-state\n Icon=\"fa-solid fa-clock-rotate-left\"\n Title=\"No version history available\"\n Size=\"compact\" />\n }\n \n @for (version of versions; track version) {\n <div\n class=\"version-item\"\n [class.selected]=\"version.VersionNumber === selectedVersion\"\n (click)=\"onSelectVersion(version)\">\n <div class=\"version-header\">\n <div class=\"version-info\">\n <span class=\"version-number\">v{{ version.VersionNumber }}</span>\n <span class=\"version-date\">{{ version.__mj_CreatedAt | date:'short' }}</span>\n </div>\n <div class=\"version-meta\">\n <span class=\"version-size\">\n {{ getContentSize(version.Content) }}\n </span>\n </div>\n </div>\n @if (version.VersionNumber === selectedVersion) {\n <div class=\"version-actions\">\n <button class=\"btn-action\" (click)=\"onRestoreVersion(version); $event.stopPropagation()\">\n <i class=\"fas fa-undo\"></i> Restore\n </button>\n <button class=\"btn-action\" (click)=\"onCompareVersion(version); $event.stopPropagation()\">\n <i class=\"fas fa-code-compare\"></i> Compare\n </button>\n <button class=\"btn-action\" (click)=\"onDownloadVersion(version); $event.stopPropagation()\">\n <i class=\"fas fa-download\"></i> Download\n </button>\n </div>\n }\n </div>\n }\n </div>\n \n @if (showDiff && currentVersionContent && previousVersionContent && selectedVersion) {\n <div class=\"diff-panel\">\n <div class=\"diff-header\">\n <h4>Changes from v{{ (selectedVersion || 1) - 1 }} to v{{ selectedVersion }}</h4>\n <button class=\"btn-close-diff\" (click)=\"showDiff = false\">\n <i class=\"fas fa-times\"></i>\n </button>\n </div>\n <div class=\"diff-content\">\n <pre>{{ getDiffSummary() }}</pre>\n </div>\n </div>\n }\n </div>\n `,\n styles: [`\n .version-history { display: flex; flex-direction: column; height: 100%; background: white; }\n .history-header { padding: 16px; border-bottom: 1px solid #D9D9D9; display: flex; justify-content: space-between; align-items: center; }\n .history-header h3 { margin: 0; font-size: 16px; }\n .btn-close { padding: 6px; background: transparent; border: none; cursor: pointer; border-radius: 3px; color: #666; }\n .btn-close:hover { background: rgba(0,0,0,0.1); }\n\n .version-list { flex: 1; overflow-y: auto; }\n .version-item { padding: 16px; border-bottom: 1px solid #E8E8E8; cursor: pointer; transition: background 150ms ease; }\n .version-item:hover { background: #F9F9F9; }\n .version-item.selected { background: #E3F2FD; border-left: 3px solid #1976D2; }\n\n .version-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }\n .version-info { display: flex; flex-direction: column; gap: 4px; }\n .version-number { font-size: 14px; font-weight: 600; }\n .version-date { font-size: 12px; color: #666; }\n .version-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: 12px; color: #666; }\n .version-author { display: flex; align-items: center; gap: 4px; }\n .version-size { color: #999; }\n\n .version-notes { font-size: 13px; color: #333; margin-bottom: 8px; }\n\n .version-actions { display: flex; gap: 8px; margin-top: 12px; }\n .btn-action { padding: 6px 12px; background: #0076B6; color: white; border: none; border-radius: 4px; cursor: pointer; font-size: 12px; display: flex; align-items: center; gap: 6px; }\n .btn-action:hover { background: #005A8C; }\n\n .diff-panel { border-top: 2px solid #D9D9D9; max-height: 50%; overflow: hidden; display: flex; flex-direction: column; }\n .diff-header { padding: 12px 16px; background: #F8F8F8; border-bottom: 1px solid #D9D9D9; display: flex; justify-content: space-between; align-items: center; }\n .diff-header h4 { margin: 0; font-size: 13px; font-weight: 600; }\n .btn-close-diff { padding: 4px; background: transparent; border: none; cursor: pointer; border-radius: 3px; color: #666; }\n .btn-close-diff:hover { background: rgba(0,0,0,0.1); }\n .diff-content { flex: 1; overflow-y: auto; padding: 16px; }\n .diff-content pre { margin: 0; font-family: 'Courier New', monospace; font-size: 12px; white-space: pre-wrap; }\n `]\n})\nexport class ArtifactVersionHistoryComponent extends BaseAngularComponent implements OnInit {\n private confirmService = inject(MJConfirmService);\n\n @Input() Artifact!: MJArtifactEntity;\n\n /** @deprecated Use {@link Artifact}. */\n @Input() set artifact(value: MJArtifactEntity) {\n this.Artifact = value;\n }\n /** @deprecated Use {@link Artifact}. */\n get artifact(): MJArtifactEntity {\n return this.Artifact;\n }\n @Input() CurrentUser!: UserInfo;\n\n /** @deprecated Use {@link CurrentUser}. */\n @Input() set currentUser(value: UserInfo) {\n this.CurrentUser = value;\n }\n /** @deprecated Use {@link CurrentUser}. */\n get currentUser(): UserInfo {\n return this.CurrentUser;\n }\n\n @Output() Closed = new EventEmitter<void>();\n\n /**\n * @deprecated Use {@link Closed}.\n *\n * The same emitter under the old binding name, so a template still binding\n * (closed) keeps working. Must stay AFTER Closed: class fields\n * initialise in order, and the other way round this captures undefined.\n */\n @Output() closed = this.Closed;\n @Output() VersionRestored = new EventEmitter<number>();\n\n /**\n * @deprecated Use {@link VersionRestored}.\n *\n * The same emitter under the old binding name, so a template still binding\n * (versionRestored) keeps working. Must stay AFTER VersionRestored: class fields\n * initialise in order, and the other way round this captures undefined.\n */\n @Output() versionRestored = this.VersionRestored;\n @Output() VersionSelected = new EventEmitter<number>();\n\n /**\n * @deprecated Use {@link VersionSelected}.\n *\n * The same emitter under the old binding name, so a template still binding\n * (versionSelected) keeps working. Must stay AFTER VersionSelected: class fields\n * initialise in order, and the other way round this captures undefined.\n */\n @Output() versionSelected = this.VersionSelected;\n\n public Versions: MJArtifactVersionEntity[] = [];\n\n /** @deprecated Use {@link Versions}. */\n public get versions(): MJArtifactVersionEntity[] {\n return this.Versions;\n }\n /** @deprecated Use {@link Versions}. */\n public set versions(value: MJArtifactVersionEntity[]) {\n this.Versions = value;\n }\n public SelectedVersion: number | null = null;\n\n /** @deprecated Use {@link SelectedVersion}. */\n public get selectedVersion(): number | null {\n return this.SelectedVersion;\n }\n /** @deprecated Use {@link SelectedVersion}. */\n public set selectedVersion(value: number | null) {\n this.SelectedVersion = value;\n }\n public ShowDiff: boolean = false;\n\n /** @deprecated Use {@link ShowDiff}. */\n public get showDiff(): boolean {\n return this.ShowDiff;\n }\n /** @deprecated Use {@link ShowDiff}. */\n public set showDiff(value: boolean) {\n this.ShowDiff = value;\n }\n public CurrentVersionContent: string = '';\n\n /** @deprecated Use {@link CurrentVersionContent}. */\n public get currentVersionContent(): string {\n return this.CurrentVersionContent;\n }\n /** @deprecated Use {@link CurrentVersionContent}. */\n public set currentVersionContent(value: string) {\n this.CurrentVersionContent = value;\n }\n public PreviousVersionContent: string = '';\n\n /** @deprecated Use {@link PreviousVersionContent}. */\n public get previousVersionContent(): string {\n return this.PreviousVersionContent;\n }\n /** @deprecated Use {@link PreviousVersionContent}. */\n public set previousVersionContent(value: string) {\n this.PreviousVersionContent = value;\n }\n\n ngOnInit() {\n this.loadVersions();\n }\n\n private async loadVersions(): Promise<void> {\n try {\n const rv = RunView.FromMetadataProvider(this.ProviderToUse);\n const result = await rv.RunView<MJArtifactVersionEntity>({\n EntityName: 'MJ: Artifact Versions',\n ExtraFilter: `ArtifactID='${this.Artifact.ID}'`,\n OrderBy: 'VersionNumber DESC',\n ResultType: 'entity_object'\n }, this.CurrentUser);\n\n if (result.Success) {\n this.Versions = result.Results || [];\n }\n } catch (error) {\n console.error('Failed to load version history:', error);\n }\n }\n\n OnSelectVersion(version: MJArtifactVersionEntity): void {\n this.SelectedVersion = version.VersionNumber;\n this.VersionSelected.emit(version.VersionNumber);\n }\n\n /** @deprecated Use {@link OnSelectVersion}. */\n onSelectVersion(version: MJArtifactVersionEntity): void {\n return this.OnSelectVersion(version);\n }\n\n async OnRestoreVersion(version: MJArtifactVersionEntity): Promise<void> {\n if (!(await this.confirmService.Confirm({ title: 'Restore version', message: `Restore to version ${version.VersionNumber}?`, detail: 'This will create a new version.' }))) return;\n\n try {\n // Restoring creates a new version with the old content\n this.VersionRestored.emit(version.VersionNumber);\n alert(`Version ${version.VersionNumber} has been restored as the latest version`);\n } catch (error) {\n console.error('Failed to restore version:', error);\n alert('Failed to restore version');\n }\n }\n\n /** @deprecated Use {@link OnRestoreVersion}. */\n async onRestoreVersion(version: MJArtifactVersionEntity): Promise<void> {\n return this.OnRestoreVersion(version);\n }\n\n async OnCompareVersion(version: MJArtifactVersionEntity): Promise<void> {\n if (version.VersionNumber === 1) {\n alert('Cannot compare: this is the first version');\n return;\n }\n\n try {\n this.CurrentVersionContent = version.Content || '';\n\n // Load previous version\n const previousVersion = this.Versions.find(v => v.VersionNumber === version.VersionNumber - 1);\n if (previousVersion) {\n this.PreviousVersionContent = previousVersion.Content || '';\n this.ShowDiff = true;\n }\n } catch (error) {\n console.error('Failed to load version for comparison:', error);\n alert('Failed to compare versions');\n }\n }\n\n /** @deprecated Use {@link OnCompareVersion}. */\n async onCompareVersion(version: MJArtifactVersionEntity): Promise<void> {\n return this.OnCompareVersion(version);\n }\n\n OnDownloadVersion(version: MJArtifactVersionEntity): void {\n try {\n const content = version.Content || '';\n const download = BuildVersionDownload(content, version.FileName, this.Artifact.Name, version.VersionNumber, version.MimeType);\n const blob = new Blob([download.Data], { type: download.MimeType });\n const url = window.URL.createObjectURL(blob);\n const link = document.createElement('a');\n link.href = url;\n link.download = download.FileName;\n link.click();\n window.URL.revokeObjectURL(url);\n } catch (error) {\n console.error('Failed to download version:', error);\n alert('Failed to download version');\n }\n }\n\n /** @deprecated Use {@link OnDownloadVersion}. */\n onDownloadVersion(version: MJArtifactVersionEntity): void {\n return this.OnDownloadVersion(version);\n }\n\n GetContentSize(content: string | null): string {\n if (!content) return '0 B';\n const bytes = new Blob([content]).size;\n if (bytes < 1024) return `${bytes} B`;\n if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;\n return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;\n }\n\n /** @deprecated Use {@link GetContentSize}. */\n getContentSize(content: string | null): string {\n return this.GetContentSize(content);\n }\n\n GetDiffSummary(): string {\n // Simple line-based diff summary\n const currentLines = this.CurrentVersionContent.split('\\n');\n const previousLines = this.PreviousVersionContent.split('\\n');\n\n const added = currentLines.length - previousLines.length;\n const summary = `Lines: ${previousLines.length} → ${currentLines.length} (${added > 0 ? '+' : ''}${added})\\n\\n`;\n\n // Show a simple comparison\n return summary + '(Full diff view would require a diff library)';\n }\n\n /** @deprecated Use {@link GetDiffSummary}. */\n getDiffSummary(): string {\n return this.GetDiffSummary();\n }\n\n OnClose(): void {\n this.Closed.emit();\n }\n\n /** @deprecated Use {@link OnClose}. */\n onClose(): void {\n return this.OnClose();\n }\n}"]}
|