@memberjunction/ng-artifacts 6.1.0-edge.4 → 6.1.0-edge.6
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-version-download.d.ts +31 -0
- package/dist/lib/components/artifact-version-download.d.ts.map +1 -0
- package/dist/lib/components/artifact-version-download.js +60 -0
- package/dist/lib/components/artifact-version-download.js.map +1 -0
- package/dist/lib/components/artifact-version-history.component.d.ts.map +1 -1
- package/dist/lib/components/artifact-version-history.component.js +5 -3
- package/dist/lib/components/artifact-version-history.component.js.map +1 -1
- package/dist/lib/components/artifact-viewer-panel.component.d.ts +30 -1
- package/dist/lib/components/artifact-viewer-panel.component.d.ts.map +1 -1
- package/dist/lib/components/artifact-viewer-panel.component.js +283 -89
- package/dist/lib/components/artifact-viewer-panel.component.js.map +1 -1
- package/dist/lib/components/file-artifact-toolbar.component.js +1 -1
- package/dist/lib/components/plugins/component-artifact-viewer.component.js +2 -2
- 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.js +1 -1
- package/dist/lib/components/plugins/data-artifact-viewer.component.d.ts.map +1 -1
- package/dist/lib/components/plugins/data-artifact-viewer.component.js +6 -8
- 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.js +1 -1
- package/dist/lib/components/plugins/docx-artifact-viewer.component.js +1 -1
- package/dist/lib/components/plugins/image-artifact-viewer.component.js +1 -1
- package/dist/lib/components/plugins/json-artifact-viewer.component.d.ts +8 -0
- package/dist/lib/components/plugins/json-artifact-viewer.component.d.ts.map +1 -1
- package/dist/lib/components/plugins/json-artifact-viewer.component.js +45 -14
- package/dist/lib/components/plugins/json-artifact-viewer.component.js.map +1 -1
- package/dist/lib/components/plugins/ml-experiment-results-viewer.component.js +1 -1
- package/dist/lib/components/plugins/pdf-artifact-viewer.component.js +1 -1
- package/dist/lib/components/plugins/save-query-dialog.component.js +7 -7
- package/dist/lib/components/plugins/save-query-dialog.component.js.map +1 -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 +15 -9
- package/dist/lib/components/previews/audio-artifact-preview.component.js.map +1 -1
- package/dist/lib/components/previews/base-artifact-preview.component.d.ts +13 -0
- package/dist/lib/components/previews/base-artifact-preview.component.d.ts.map +1 -1
- package/dist/lib/components/previews/base-artifact-preview.component.js +20 -0
- package/dist/lib/components/previews/base-artifact-preview.component.js.map +1 -1
- package/dist/lib/components/previews/image-artifact-preview.component.d.ts +13 -0
- package/dist/lib/components/previews/image-artifact-preview.component.d.ts.map +1 -1
- package/dist/lib/components/previews/image-artifact-preview.component.js +55 -19
- package/dist/lib/components/previews/image-artifact-preview.component.js.map +1 -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 +15 -9
- package/dist/lib/components/previews/video-artifact-preview.component.js.map +1 -1
- package/package.json +29 -29
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-artifact-viewer.component.js","sourceRoot":"","sources":["../../../../src/lib/components/plugins/json-artifact-viewer.component.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,SAAS,EAAwC,SAAS,EAAc,MAAM,eAAe,CAAC;AAGvG,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,iCAAiC,EAAE,MAAM,mCAAmC,CAAC;AACtF,OAAO,EAAgB,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;;;;;;;;;;IAkBlD,iCAAgF;IAA5B,+LAAS,wBAAiB,KAAC;IAC7E,wBAAwC;IAAC,4BAC3C;IAAA,iBAAS;IACT,kCAA6D;IAAtB,+LAAS,kBAAW,KAAC;I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O,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QAEtC,sBAAsB;QACtB,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QAEtC,6BAA6B;QAC7B,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;QAExC,iCAAiC;QACjC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;QAExC,OAAO,OAAO,CAAC;IACjB,CAAC;qHA9RU,2BAA2B;6DAA3B,2BAA2B;;;;;;YA/GhC,AADF,AAFF,8BAAuD,aAExB,gBACsC;YAAnB,wGAAS,YAAQ,IAAC;YAC9D,uBAA2B;YAAC,sBAC9B;YAAA,iBAAS;YACT,mFAAmB;YAQrB,iBAAM;YAGN,8BAA6B;YAkBzB,AARA,AATF,gGAAkC,uEASJ,uEAQrB;YAWb,AADE,iBAAM,EACF;;YA9C4B,sCAAoB;YAMlD,eAOC;YAPD,0CAOC;YAKD,eA0BC;YA1BD,sFA0BC;;;AAsEI,2BAA2B;IADvC,aAAa,CAAC,iCAAiC,EAAE,0BAA0B,CAAC;GAChE,2BAA2B,CA+RvC;;iFA/RY,2BAA2B;cAtHvC,SAAS;6BACI,KAAK,YACP,yBAAyB,YACzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDT;;kBAoEA,SAAS;mBAAC,WAAW;;kFADX,2BAA2B","sourcesContent":["import { Component, OnInit, OnDestroy, ChangeDetectorRef, ViewChild, ElementRef } from '@angular/core';\nimport { BaseAngularComponent } from '@memberjunction/ng-base-types';\nimport { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser';\nimport { RegisterClass } from '@memberjunction/global';\nimport { BaseArtifactViewerPluginComponent } from '../base-artifact-viewer.component';\nimport { DataSnapshot, RunView } from '@memberjunction/core';\nimport { MJArtifactVersionAttributeEntity } from '@memberjunction/core-entities';\nimport { createJsonSnapshot } from '../../snapshot-helpers';\n\n/**\n * Viewer component for JSON artifacts.\n * Supports extract rules - shows displayMarkdown, displayHtml, or raw JSON editor (in that priority order).\n * All content is displayed in the parent's Display tab.\n */\n@Component({\n standalone: false,\n selector: 'mj-json-artifact-viewer',\n template: `\n <div class=\"json-artifact-viewer\" [ngClass]=\"cssClass\">\n <!-- Display toolbar -->\n <div class=\"display-toolbar\">\n <button class=\"btn-icon\" title=\"Copy Content\" (click)=\"onCopy()\">\n <i class=\"fas fa-copy\"></i> Copy\n </button>\n @if (displayHtml) {\n <button class=\"btn-icon\" title=\"Open in New Window\" (click)=\"openInNewWindow()\">\n <i class=\"fas fa-external-link-alt\"></i> New Window\n </button>\n <button class=\"btn-icon\" title=\"Print\" (click)=\"printHtml()\">\n <i class=\"fas fa-print\"></i> Print\n </button>\n }\n </div>\n\n <!-- Display content: priority order = displayHtml > displayMarkdown > JSON editor -->\n <div class=\"display-content\">\n @if (displayHtml && htmlBlobUrl) {\n <!-- Sandboxed iframe for rich HTML using blob URL -->\n <iframe\n #htmlFrame\n [src]=\"htmlBlobUrl\"\n sandbox=\"allow-same-origin allow-scripts allow-popups allow-popups-to-escape-sandbox allow-modals\"\n class=\"html-iframe\"\n (load)=\"onIframeLoad()\">\n </iframe>\n } @else if (displayMarkdown) {\n <div class=\"markdown-content\">\n <mj-markdown [data]=\"displayMarkdown\"\n [enableCollapsibleHeadings]=\"true\"\n [enableLineNumbers]=\"true\"\n [enableSmartypants]=\"true\"\n [enableHtml]=\"true\"></mj-markdown>\n </div>\n } @else {\n <div class=\"json-editor-container\">\n <mj-code-editor\n [(ngModel)]=\"jsonContent\"\n [language]=\"'json'\"\n [readonly]=\"true\"\n style=\"width: 100%; height: 100%;\">\n </mj-code-editor>\n </div>\n }\n </div>\n </div>\n `,\n styles: [`\n .json-artifact-viewer {\n display: flex;\n flex-direction: column;\n height: 100%;\n }\n\n .display-toolbar {\n display: flex;\n justify-content: flex-end;\n gap: 8px;\n padding: 8px;\n background: var(--mj-bg-surface-sunken);\n border-bottom: 1px solid var(--mj-border-default);\n }\n\n .btn-icon {\n padding: 6px 12px;\n background: var(--mj-bg-surface);\n border: 1px solid var(--mj-border-strong);\n border-radius: 4px;\n cursor: pointer;\n font-size: 12px;\n color: var(--mj-text-secondary);\n display: flex;\n align-items: center;\n gap: 6px;\n transition: all 0.2s;\n }\n\n .btn-icon:hover {\n background: var(--mj-bg-surface-sunken);\n border-color: var(--mj-text-disabled);\n }\n\n .display-content {\n flex: 1;\n overflow: auto;\n min-height: 0;\n display: flex;\n flex-direction: column;\n }\n\n .html-iframe {\n width: 100%;\n border: none;\n background: var(--mj-bg-surface);\n display: block;\n }\n\n .markdown-content {\n flex: 1;\n padding: 20px;\n overflow: auto;\n min-height: 0;\n background: var(--mj-bg-surface);\n }\n\n .json-editor-container {\n flex: 1;\n overflow: auto;\n min-height: 0;\n }\n `]\n})\n@RegisterClass(BaseArtifactViewerPluginComponent, 'JsonArtifactViewerPlugin')\nexport class JsonArtifactViewerComponent extends BaseArtifactViewerPluginComponent implements OnInit, OnDestroy {\n @ViewChild('htmlFrame') htmlFrame?: ElementRef<HTMLIFrameElement>;\n\n public jsonContent = '';\n public displayMarkdown: string | null = null;\n public displayHtml: string | null = null;\n public htmlBlobUrl: SafeResourceUrl | null = null;\n private versionAttributes: MJArtifactVersionAttributeEntity[] = [];\n private unsafeBlobUrl: string | null = null; // Keep unsafe URL for cleanup\n\n /**\n * JSON artifacts always have content to display (JSON editor, displayHtml, or displayMarkdown)\n */\n public override get hasDisplayContent(): boolean {\n return true;\n }\n\n constructor(\n private cdr: ChangeDetectorRef,\n private sanitizer: DomSanitizer\n ) {\n super();\n }\n\n ngOnDestroy(): void {\n // Clean up blob URL to prevent memory leaks\n if (this.unsafeBlobUrl) {\n URL.revokeObjectURL(this.unsafeBlobUrl);\n this.unsafeBlobUrl = null;\n this.htmlBlobUrl = null;\n }\n }\n\n async ngOnInit(): Promise<void> {\n this.jsonContent = this.getContent();\n\n // Load version attributes to check for extract rules\n await this.loadVersionAttributes();\n\n // Trigger change detection after async load\n this.cdr.detectChanges();\n }\n\n /**\n * Override to return true when showing extracted displayHtml or displayMarkdown.\n * Returns false when showing raw JSON editor (no extract rules available).\n */\n public override get isShowingElevatedDisplay(): boolean {\n return !!(this.displayHtml || this.displayMarkdown);\n }\n\n /**\n * Override to tell parent whether to show raw JSON tab.\n * When showing elevated display (markdown/HTML), return true so parent shows JSON tab.\n * When showing raw JSON editor, return false (no need for duplicate JSON tab).\n */\n public override get parentShouldShowRawContent(): boolean {\n return this.isShowingElevatedDisplay;\n }\n\n private async loadVersionAttributes(): Promise<void> {\n if (!this.artifactVersion?.ID) {\n console.log('📦 JSON Plugin: No artifactVersion.ID, skipping attribute load');\n return;\n }\n\n console.log(`📦 JSON Plugin: Loading attributes for version ID: ${this.artifactVersion.ID}`);\n\n try {\n const rv = RunView.FromMetadataProvider(this.ProviderToUse);\n const result = await rv.RunView<MJArtifactVersionAttributeEntity>({\n EntityName: 'MJ: Artifact Version Attributes',\n ExtraFilter: `ArtifactVersionID='${this.artifactVersion.ID}'`,\n ResultType: 'entity_object'\n });\n\n console.log(`📦 JSON Plugin: RunView completed. Success=${result.Success}, Results count=${result.Results?.length || 0}`);\n\n if (result.Success && result.Results) {\n this.versionAttributes = result.Results;\n\n console.log(`📦 JSON Plugin: Loaded ${this.versionAttributes.length} attributes for version ${this.artifactVersion.ID}`);\n console.log(`📦 Attributes:`, this.versionAttributes.map(a => ({ name: a.Name, hasValue: !!a.Value })));\n\n // Check for displayHtml and displayMarkdown attributes (from extract rules)\n // Priority: displayHtml > displayMarkdown\n const displayHtmlAttr = this.versionAttributes.find(a => a.Name?.toLowerCase() === 'displayhtml');\n const displayMarkdownAttr = this.versionAttributes.find(a => a.Name?.toLowerCase() === 'displaymarkdown');\n\n console.log(`📦 displayHtmlAttr:`, displayHtmlAttr ? { name: displayHtmlAttr.Name, valueLength: displayHtmlAttr.Value?.length } : 'not found');\n console.log(`📦 displayMarkdownAttr:`, displayMarkdownAttr ? { name: displayMarkdownAttr.Name, valueLength: displayMarkdownAttr.Value?.length } : 'not found');\n\n // Parse attribute values - fix \"null\" string bug\n this.displayHtml = this.parseAttributeValue(displayHtmlAttr?.Value);\n this.displayMarkdown = this.parseAttributeValue(displayMarkdownAttr?.Value);\n\n // Clean up double-escaped characters in HTML (from LLM generation)\n if (this.displayHtml) {\n this.displayHtml = this.cleanEscapedCharacters(this.displayHtml);\n }\n\n // Create blob URL for HTML to avoid srcdoc sanitization issues\n if (this.displayHtml) {\n const blob = new Blob([this.displayHtml], { type: 'text/html' });\n this.unsafeBlobUrl = URL.createObjectURL(blob);\n // Sanitize the blob URL so Angular trusts it in the iframe\n this.htmlBlobUrl = this.sanitizer.bypassSecurityTrustResourceUrl(this.unsafeBlobUrl);\n }\n\n // Note: Markdown rendering is now handled by <mj-markdown> component in template\n\n console.log(`📦 JSON Plugin: displayHtml=${!!this.displayHtml} (${this.displayHtml?.length || 0} chars), displayMarkdown=${!!this.displayMarkdown} (${this.displayMarkdown?.length || 0} chars)`);\n console.log(`📦 isShowingElevatedDisplay=${this.isShowingElevatedDisplay}`);\n } else {\n console.log(`📦 JSON Plugin: No attributes found or query failed. Success=${result.Success}, ResultsLength=${result.Results?.length}`);\n }\n } catch (err) {\n console.error('📦 JSON Plugin: Error loading version attributes:', err);\n }\n }\n\n private parseAttributeValue(value: string | null | undefined): string | null {\n if (!value) return null;\n\n // Fix bug: Some extractors return string \"null\" instead of actual null\n if (value === 'null' || value.trim() === '') {\n return null;\n }\n\n try {\n // Try to parse as JSON first\n const parsed = JSON.parse(value);\n if (typeof parsed === 'string') {\n // Check if parsed string is also \"null\"\n if (parsed === 'null' || parsed.trim() === '') {\n return null;\n }\n return parsed;\n }\n return JSON.stringify(parsed, null, 2);\n } catch {\n // If not valid JSON, return as-is (unless it's \"null\")\n return value === 'null' ? null : value;\n }\n }\n\n onIframeLoad(): void {\n // Inject base styles if HTML doesn't have them\n if (this.htmlFrame) {\n const iframe = this.htmlFrame.nativeElement;\n const iframeDoc = iframe.contentDocument || iframe.contentWindow?.document;\n\n if (iframeDoc) {\n // Check if HTML already has styles\n const hasStyles = iframeDoc.querySelector('style') || iframeDoc.querySelector('link[rel=\"stylesheet\"]');\n\n if (!hasStyles) {\n // Inject minimal base styles for better defaults\n const style = iframeDoc.createElement('style');\n style.textContent = `\n body {\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;\n line-height: 1.6;\n color: #333;\n margin: 20px;\n padding: 0;\n }\n h1, h2, h3 { color: #2c3e50; margin-top: 1.5em; margin-bottom: 0.5em; }\n h1 { font-size: 2em; border-bottom: 2px solid #3498db; padding-bottom: 0.3em; }\n h2 { font-size: 1.5em; }\n table { border-collapse: collapse; width: 100%; margin: 1em 0; }\n th, td { border: 1px solid #ddd; padding: 8px; text-align: left; }\n th { background-color: #f8f9fa; font-weight: 600; }\n pre { background: #f6f8fa; padding: 16px; border-radius: 6px; overflow-x: auto; }\n code { background: #f6f8fa; padding: 2px 6px; border-radius: 3px; font-family: monospace; }\n `;\n iframeDoc.head.appendChild(style);\n }\n\n // Inject width guardrails to prevent iframe content from causing horizontal overflow\n const widthOverride = iframeDoc.createElement('style');\n widthOverride.textContent = `\n html, body {\n max-width: 100% !important;\n overflow-x: hidden !important;\n }\n body {\n margin: 20px 10px 5px 20px !important; /* top right bottom left */\n padding: 0 !important;\n box-sizing: border-box !important;\n }\n img, svg, table, pre {\n max-width: 100% !important;\n }\n `;\n iframeDoc.head.appendChild(widthOverride);\n\n console.log('📦 Iframe loaded, hasStyles:', !!hasStyles);\n\n // Auto-resize iframe to fit content\n this.resizeIframeToContent();\n }\n }\n }\n\n private resizeIframeToContent(): void {\n if (this.htmlFrame) {\n const iframe = this.htmlFrame.nativeElement;\n const iframeDoc = iframe.contentDocument || iframe.contentWindow?.document;\n\n if (iframeDoc && iframeDoc.body) {\n // Get the actual content height\n const contentHeight = Math.max(\n iframeDoc.body.scrollHeight,\n iframeDoc.body.offsetHeight,\n iframeDoc.documentElement.scrollHeight,\n iframeDoc.documentElement.offsetHeight\n );\n\n // Set iframe height to match content (with a bit of padding)\n iframe.style.height = `${contentHeight + 20}px`;\n\n console.log('📦 Iframe resized - Height:', contentHeight + 20, 'px');\n }\n }\n }\n\n openInNewWindow(): void {\n if (this.displayHtml) {\n const newWindow = window.open('', '_blank');\n if (newWindow) {\n newWindow.document.write(this.displayHtml);\n newWindow.document.close();\n }\n }\n }\n\n printHtml(): void {\n if (this.htmlFrame) {\n const iframe = this.htmlFrame.nativeElement;\n const iframeWindow = iframe.contentWindow;\n if (iframeWindow) {\n iframeWindow.focus();\n iframeWindow.print();\n }\n }\n }\n\n onCopy(): void {\n // Copy based on what's being displayed - prioritize displayHtml\n const content = this.displayHtml || this.displayMarkdown || this.jsonContent;\n if (content) {\n navigator.clipboard.writeText(content).then(() => {\n console.log('✅ Copied content to clipboard');\n }).catch(err => {\n console.error('Failed to copy to clipboard:', err);\n });\n }\n }\n\n public override GetCurrentStateSnapshot(): DataSnapshot | null {\n return createJsonSnapshot(this.getRawContent(), this.getDisplayTitle());\n }\n\n /**\n * Clean up double-escaped characters that appear in LLM-generated HTML\n * Removes literal \"\\\\n\", \"\\\\t\", and \"\\\\\\\"\" which cause rendering issues\n */\n private cleanEscapedCharacters(html: string): string {\n // Remove escaped quotes (\\\" becomes \")\n let cleaned = html.replace(/\\\\\"/g, '\"');\n\n // Remove escaped newlines (\\\\n becomes nothing)\n // HTML doesn't need whitespace for formatting, and these cause display issues\n cleaned = cleaned.replace(/\\\\n/g, '');\n\n // Remove escaped tabs\n cleaned = cleaned.replace(/\\\\t/g, '');\n\n // Remove double-escaped tabs\n cleaned = cleaned.replace(/\\\\\\\\t/g, '');\n\n // Remove double-escaped newlines\n cleaned = cleaned.replace(/\\\\\\\\n/g, '');\n\n return cleaned;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"json-artifact-viewer.component.js","sourceRoot":"","sources":["../../../../src/lib/components/plugins/json-artifact-viewer.component.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,SAAS,EAAwC,SAAS,EAAc,MAAM,eAAe,CAAC;AAGvG,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,iCAAiC,EAAE,MAAM,mCAAmC,CAAC;AACtF,OAAO,EAAgB,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;;;;;;;;;;IAkBlD,iCAAgF;IAA5B,+LAAS,wBAAiB,KAAC;IAC7E,wBAAwC;IAAC,4BAC3C;IAAA,iBAAS;IACT,kCAA6D;IAAtB,+LAAS,kBAAW,KAAC;IAC1D,wBAA4B;IAAC,uBAC/B;IAAA,iBAAS;;;;IAYT,qCAK0B;IAAxB,6LAAQ,qBAAc,KAAC;IACzB,iBAAS;;;IAJP,kEAAmB;;;IAMrB,8BAA8B;IAC5B,kCAI+C;IACjD,iBAAM;;;IALS,cAAwB;IAIxB,AADA,AADA,AADA,AADA,6CAAwB,mCACU,2BACR,2BACA,oBACP;;;;IAIhC,AADF,8BAAmC,yBAKI;IAHnC,kUAAyB;IAK7B,AADE,iBAAiB,EACb;;;IALF,cAAyB;IAAzB,kDAAyB;IAEzB,AADA,iCAAmB,kBACF;;AArD/B;;;;GAIG;AA+HI,IAAM,2BAA2B,GAAjC,MAAM,2BAA4B,SAAQ,iCAAiC;IAkBtE;IACA;IAlBc,SAAS,CAAiC;IAE3D,WAAW,GAAG,EAAE,CAAC;IACjB,eAAe,GAAkB,IAAI,CAAC;IACtC,WAAW,GAAkB,IAAI,CAAC;IAClC,WAAW,GAA2B,IAAI,CAAC;IAC1C,iBAAiB,GAAuC,EAAE,CAAC;IAC3D,aAAa,GAAkB,IAAI,CAAC,CAAC,8BAA8B;IAE3E;;OAEG;IACH,IAAoB,iBAAiB;QACnC,OAAO,I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TU,2BAA2B;6DAA3B,2BAA2B;;;;;;YAvHhC,AADF,AAFF,8BAAuD,aAExB,gBACsC;YAAnB,wGAAS,YAAQ,IAAC;YAC9D,uBAA2B;YAAC,sBAC9B;YAAA,iBAAS;YACT,mFAAmB;YAQrB,iBAAM;YAGN,8BAA6B;YAsBzB,AARA,AAbF,gGAAkC,uEAaJ,uEAQrB;YAWb,AADE,iBAAM,EACF;;YAlD4B,sCAAoB;YAMlD,eAOC;YAPD,0CAOC;YAKD,eA8BC;YA9BD,sFA8BC;;;AA0EI,2BAA2B;IADvC,aAAa,CAAC,iCAAiC,EAAE,0BAA0B,CAAC;GAChE,2BAA2B,CAwTvC;;iFAxTY,2BAA2B;cA9HvC,SAAS;6BACI,KAAK,YACP,yBAAyB,YACzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDT;;kBAwEA,SAAS;mBAAC,WAAW;;kFADX,2BAA2B","sourcesContent":["import { Component, OnInit, OnDestroy, ChangeDetectorRef, ViewChild, ElementRef } from '@angular/core';\nimport { BaseAngularComponent } from '@memberjunction/ng-base-types';\nimport { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser';\nimport { RegisterClass } from '@memberjunction/global';\nimport { BaseArtifactViewerPluginComponent } from '../base-artifact-viewer.component';\nimport { DataSnapshot, RunView } from '@memberjunction/core';\nimport { MJArtifactVersionAttributeEntity } from '@memberjunction/core-entities';\nimport { createJsonSnapshot } from '../../snapshot-helpers';\n\n/**\n * Viewer component for JSON artifacts.\n * Supports extract rules - shows displayMarkdown, displayHtml, or raw JSON editor (in that priority order).\n * All content is displayed in the parent's Display tab.\n */\n@Component({\n standalone: false,\n selector: 'mj-json-artifact-viewer',\n template: `\n <div class=\"json-artifact-viewer\" [ngClass]=\"cssClass\">\n <!-- Display toolbar -->\n <div class=\"display-toolbar\">\n <button class=\"btn-icon\" title=\"Copy Content\" (click)=\"onCopy()\">\n <i class=\"fas fa-copy\"></i> Copy\n </button>\n @if (displayHtml) {\n <button class=\"btn-icon\" title=\"Open in New Window\" (click)=\"openInNewWindow()\">\n <i class=\"fas fa-external-link-alt\"></i> New Window\n </button>\n <button class=\"btn-icon\" title=\"Print\" (click)=\"printHtml()\">\n <i class=\"fas fa-print\"></i> Print\n </button>\n }\n </div>\n\n <!-- Display content: priority order = displayHtml > displayMarkdown > JSON editor -->\n <div class=\"display-content\">\n @if (displayHtml && htmlBlobUrl) {\n <!-- Sandboxed iframe for rich HTML using blob URL.\n SECURITY: never add allow-same-origin here — a blob: URL inherits the app origin,\n so allow-same-origin + allow-scripts on LLM-produced HTML is in-origin XSS\n (script in the artifact could read the app's storage/cookies and DOM).\n Same pattern as whiteboard-srcdoc.pipe.ts. -->\n <iframe\n #htmlFrame\n [src]=\"htmlBlobUrl\"\n sandbox=\"allow-scripts allow-popups allow-popups-to-escape-sandbox allow-modals\"\n class=\"html-iframe\"\n (load)=\"onIframeLoad()\">\n </iframe>\n } @else if (displayMarkdown) {\n <div class=\"markdown-content\">\n <mj-markdown [data]=\"displayMarkdown\"\n [enableCollapsibleHeadings]=\"true\"\n [enableLineNumbers]=\"true\"\n [enableSmartypants]=\"true\"\n [enableHtml]=\"true\"></mj-markdown>\n </div>\n } @else {\n <div class=\"json-editor-container\">\n <mj-code-editor\n [(ngModel)]=\"jsonContent\"\n [language]=\"'json'\"\n [readonly]=\"true\"\n style=\"width: 100%; height: 100%;\">\n </mj-code-editor>\n </div>\n }\n </div>\n </div>\n `,\n styles: [`\n .json-artifact-viewer {\n display: flex;\n flex-direction: column;\n height: 100%;\n }\n\n .display-toolbar {\n display: flex;\n justify-content: flex-end;\n gap: 8px;\n padding: 8px;\n background: var(--mj-bg-surface-sunken);\n border-bottom: 1px solid var(--mj-border-default);\n }\n\n .btn-icon {\n padding: 6px 12px;\n background: var(--mj-bg-surface);\n border: 1px solid var(--mj-border-strong);\n border-radius: 4px;\n cursor: pointer;\n font-size: 12px;\n color: var(--mj-text-secondary);\n display: flex;\n align-items: center;\n gap: 6px;\n transition: all 0.2s;\n }\n\n .btn-icon:hover {\n background: var(--mj-bg-surface-sunken);\n border-color: var(--mj-text-disabled);\n }\n\n .display-content {\n flex: 1;\n overflow: auto;\n min-height: 0;\n display: flex;\n flex-direction: column;\n }\n\n .html-iframe {\n width: 100%;\n border: none;\n background: var(--mj-bg-surface);\n display: block;\n /* The frame is cross-origin (sandbox without allow-same-origin), so script-driven\n auto-resize is unavailable — fill the container instead. */\n flex: 1;\n min-height: 0;\n }\n\n .markdown-content {\n flex: 1;\n padding: 20px;\n overflow: auto;\n min-height: 0;\n background: var(--mj-bg-surface);\n }\n\n .json-editor-container {\n flex: 1;\n overflow: auto;\n min-height: 0;\n }\n `]\n})\n@RegisterClass(BaseArtifactViewerPluginComponent, 'JsonArtifactViewerPlugin')\nexport class JsonArtifactViewerComponent extends BaseArtifactViewerPluginComponent implements OnInit, OnDestroy {\n @ViewChild('htmlFrame') htmlFrame?: ElementRef<HTMLIFrameElement>;\n\n public jsonContent = '';\n public displayMarkdown: string | null = null;\n public displayHtml: string | null = null;\n public htmlBlobUrl: SafeResourceUrl | null = null;\n private versionAttributes: MJArtifactVersionAttributeEntity[] = [];\n private unsafeBlobUrl: string | null = null; // Keep unsafe URL for cleanup\n\n /**\n * JSON artifacts always have content to display (JSON editor, displayHtml, or displayMarkdown)\n */\n public override get hasDisplayContent(): boolean {\n return true;\n }\n\n constructor(\n private cdr: ChangeDetectorRef,\n private sanitizer: DomSanitizer\n ) {\n super();\n }\n\n ngOnDestroy(): void {\n // Clean up blob URL to prevent memory leaks\n if (this.unsafeBlobUrl) {\n URL.revokeObjectURL(this.unsafeBlobUrl);\n this.unsafeBlobUrl = null;\n this.htmlBlobUrl = null;\n }\n }\n\n async ngOnInit(): Promise<void> {\n this.jsonContent = this.getContent();\n\n // Load version attributes to check for extract rules\n await this.loadVersionAttributes();\n\n // Trigger change detection after async load\n this.cdr.detectChanges();\n }\n\n /**\n * Override to return true when showing extracted displayHtml or displayMarkdown.\n * Returns false when showing raw JSON editor (no extract rules available).\n */\n public override get isShowingElevatedDisplay(): boolean {\n return !!(this.displayHtml || this.displayMarkdown);\n }\n\n /**\n * Override to tell parent whether to show raw JSON tab.\n * When showing elevated display (markdown/HTML), return true so parent shows JSON tab.\n * When showing raw JSON editor, return false (no need for duplicate JSON tab).\n */\n public override get parentShouldShowRawContent(): boolean {\n return this.isShowingElevatedDisplay;\n }\n\n private async loadVersionAttributes(): Promise<void> {\n if (!this.artifactVersion?.ID) {\n console.log('📦 JSON Plugin: No artifactVersion.ID, skipping attribute load');\n return;\n }\n\n console.log(`📦 JSON Plugin: Loading attributes for version ID: ${this.artifactVersion.ID}`);\n\n try {\n const rv = RunView.FromMetadataProvider(this.ProviderToUse);\n const result = await rv.RunView<MJArtifactVersionAttributeEntity>({\n EntityName: 'MJ: Artifact Version Attributes',\n ExtraFilter: `ArtifactVersionID='${this.artifactVersion.ID}'`,\n ResultType: 'entity_object'\n });\n\n console.log(`📦 JSON Plugin: RunView completed. Success=${result.Success}, Results count=${result.Results?.length || 0}`);\n\n if (result.Success && result.Results) {\n this.versionAttributes = result.Results;\n\n console.log(`📦 JSON Plugin: Loaded ${this.versionAttributes.length} attributes for version ${this.artifactVersion.ID}`);\n console.log(`📦 Attributes:`, this.versionAttributes.map(a => ({ name: a.Name, hasValue: !!a.Value })));\n\n // Check for displayHtml and displayMarkdown attributes (from extract rules)\n // Priority: displayHtml > displayMarkdown\n const displayHtmlAttr = this.versionAttributes.find(a => a.Name?.toLowerCase() === 'displayhtml');\n const displayMarkdownAttr = this.versionAttributes.find(a => a.Name?.toLowerCase() === 'displaymarkdown');\n\n console.log(`📦 displayHtmlAttr:`, displayHtmlAttr ? { name: displayHtmlAttr.Name, valueLength: displayHtmlAttr.Value?.length } : 'not found');\n console.log(`📦 displayMarkdownAttr:`, displayMarkdownAttr ? { name: displayMarkdownAttr.Name, valueLength: displayMarkdownAttr.Value?.length } : 'not found');\n\n // Parse attribute values - fix \"null\" string bug\n this.displayHtml = this.parseAttributeValue(displayHtmlAttr?.Value);\n this.displayMarkdown = this.parseAttributeValue(displayMarkdownAttr?.Value);\n\n // Clean up double-escaped characters in HTML (from LLM generation)\n if (this.displayHtml) {\n this.displayHtml = this.cleanEscapedCharacters(this.displayHtml);\n }\n\n // Create blob URL for HTML to avoid srcdoc sanitization issues\n if (this.displayHtml) {\n const blob = new Blob([this.displayHtml], { type: 'text/html' });\n this.unsafeBlobUrl = URL.createObjectURL(blob);\n // Sanitize the blob URL so Angular trusts it in the iframe\n this.htmlBlobUrl = this.sanitizer.bypassSecurityTrustResourceUrl(this.unsafeBlobUrl);\n }\n\n // Note: Markdown rendering is now handled by <mj-markdown> component in template\n\n console.log(`📦 JSON Plugin: displayHtml=${!!this.displayHtml} (${this.displayHtml?.length || 0} chars), displayMarkdown=${!!this.displayMarkdown} (${this.displayMarkdown?.length || 0} chars)`);\n console.log(`📦 isShowingElevatedDisplay=${this.isShowingElevatedDisplay}`);\n } else {\n console.log(`📦 JSON Plugin: No attributes found or query failed. Success=${result.Success}, ResultsLength=${result.Results?.length}`);\n }\n } catch (err) {\n console.error('📦 JSON Plugin: Error loading version attributes:', err);\n }\n }\n\n private parseAttributeValue(value: string | null | undefined): string | null {\n if (!value) return null;\n\n // Fix bug: Some extractors return string \"null\" instead of actual null\n if (value === 'null' || value.trim() === '') {\n return null;\n }\n\n try {\n // Try to parse as JSON first\n const parsed = JSON.parse(value);\n if (typeof parsed === 'string') {\n // Check if parsed string is also \"null\"\n if (parsed === 'null' || parsed.trim() === '') {\n return null;\n }\n return parsed;\n }\n return JSON.stringify(parsed, null, 2);\n } catch {\n // If not valid JSON, return as-is (unless it's \"null\")\n return value === 'null' ? null : value;\n }\n }\n\n /**\n * Returns the iframe's document when accessible, or null.\n * With allow-same-origin removed from the sandbox (see template), the frame is\n * cross-origin to the app: contentDocument returns null or the access throws a\n * SecurityError depending on the browser. Both outcomes are tolerated — the\n * style/resize enhancements below are optional niceties, not requirements.\n */\n private getIframeDocument(): Document | null {\n try {\n const iframe = this.htmlFrame?.nativeElement;\n if (!iframe) return null;\n return iframe.contentDocument || iframe.contentWindow?.document || null;\n } catch {\n return null;\n }\n }\n\n onIframeLoad(): void {\n // Inject base styles if HTML doesn't have them\n if (this.htmlFrame) {\n const iframeDoc = this.getIframeDocument();\n\n if (iframeDoc) {\n // Check if HTML already has styles\n const hasStyles = iframeDoc.querySelector('style') || iframeDoc.querySelector('link[rel=\"stylesheet\"]');\n\n if (!hasStyles) {\n // Inject minimal base styles for better defaults\n const style = iframeDoc.createElement('style');\n style.textContent = `\n body {\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;\n line-height: 1.6;\n color: #333;\n margin: 20px;\n padding: 0;\n }\n h1, h2, h3 { color: #2c3e50; margin-top: 1.5em; margin-bottom: 0.5em; }\n h1 { font-size: 2em; border-bottom: 2px solid #3498db; padding-bottom: 0.3em; }\n h2 { font-size: 1.5em; }\n table { border-collapse: collapse; width: 100%; margin: 1em 0; }\n th, td { border: 1px solid #ddd; padding: 8px; text-align: left; }\n th { background-color: #f8f9fa; font-weight: 600; }\n pre { background: #f6f8fa; padding: 16px; border-radius: 6px; overflow-x: auto; }\n code { background: #f6f8fa; padding: 2px 6px; border-radius: 3px; font-family: monospace; }\n `;\n iframeDoc.head.appendChild(style);\n }\n\n // Inject width guardrails to prevent iframe content from causing horizontal overflow\n const widthOverride = iframeDoc.createElement('style');\n widthOverride.textContent = `\n html, body {\n max-width: 100% !important;\n overflow-x: hidden !important;\n }\n body {\n margin: 20px 10px 5px 20px !important; /* top right bottom left */\n padding: 0 !important;\n box-sizing: border-box !important;\n }\n img, svg, table, pre {\n max-width: 100% !important;\n }\n `;\n iframeDoc.head.appendChild(widthOverride);\n\n console.log('📦 Iframe loaded, hasStyles:', !!hasStyles);\n\n // Auto-resize iframe to fit content\n this.resizeIframeToContent();\n }\n }\n }\n\n private resizeIframeToContent(): void {\n if (this.htmlFrame) {\n const iframe = this.htmlFrame.nativeElement;\n // Cross-origin (sandboxed) frames yield no document — the CSS flex sizing on\n // .html-iframe is the fallback in that case.\n const iframeDoc = this.getIframeDocument();\n\n if (iframeDoc && iframeDoc.body) {\n // Get the actual content height\n const contentHeight = Math.max(\n iframeDoc.body.scrollHeight,\n iframeDoc.body.offsetHeight,\n iframeDoc.documentElement.scrollHeight,\n iframeDoc.documentElement.offsetHeight\n );\n\n // Set iframe height to match content (with a bit of padding)\n iframe.style.height = `${contentHeight + 20}px`;\n\n console.log('📦 Iframe resized - Height:', contentHeight + 20, 'px');\n }\n }\n }\n\n openInNewWindow(): void {\n if (this.displayHtml) {\n const newWindow = window.open('', '_blank');\n if (newWindow) {\n newWindow.document.write(this.displayHtml);\n newWindow.document.close();\n }\n }\n }\n\n printHtml(): void {\n if (this.htmlFrame) {\n try {\n const iframe = this.htmlFrame.nativeElement;\n const iframeWindow = iframe.contentWindow;\n if (iframeWindow) {\n iframeWindow.focus();\n iframeWindow.print();\n }\n } catch {\n // The sandboxed frame is cross-origin, so scripting into it can throw a\n // SecurityError in some browsers. Fall back to printing the host page,\n // which includes the rendered iframe content.\n window.print();\n }\n }\n }\n\n onCopy(): void {\n // Copy based on what's being displayed - prioritize displayHtml\n const content = this.displayHtml || this.displayMarkdown || this.jsonContent;\n if (content) {\n navigator.clipboard.writeText(content).then(() => {\n console.log('✅ Copied content to clipboard');\n }).catch(err => {\n console.error('Failed to copy to clipboard:', err);\n });\n }\n }\n\n public override GetCurrentStateSnapshot(): DataSnapshot | null {\n return createJsonSnapshot(this.getRawContent(), this.getDisplayTitle());\n }\n\n /**\n * Clean up double-escaped characters that appear in LLM-generated HTML\n * Removes literal \"\\\\n\", \"\\\\t\", and \"\\\\\\\"\" which cause rendering issues\n */\n private cleanEscapedCharacters(html: string): string {\n // Remove escaped quotes (\\\" becomes \")\n let cleaned = html.replace(/\\\\\"/g, '\"');\n\n // Remove escaped newlines (\\\\n becomes nothing)\n // HTML doesn't need whitespace for formatting, and these cause display issues\n cleaned = cleaned.replace(/\\\\n/g, '');\n\n // Remove escaped tabs\n cleaned = cleaned.replace(/\\\\t/g, '');\n\n // Remove double-escaped tabs\n cleaned = cleaned.replace(/\\\\\\\\t/g, '');\n\n // Remove double-escaped newlines\n cleaned = cleaned.replace(/\\\\\\\\n/g, '');\n\n return cleaned;\n }\n}\n"]}
|
|
@@ -614,7 +614,7 @@ let MLExperimentResultsViewerComponent = class MLExperimentResultsViewerComponen
|
|
|
614
614
|
i0.ɵɵproperty("ngClass", ctx.cssClass);
|
|
615
615
|
i0.ɵɵadvance();
|
|
616
616
|
i0.ɵɵconditional(ctx.IsLoading ? 1 : ctx.HasError || !ctx.Spec ? 2 : 3);
|
|
617
|
-
} }, dependencies: [i1.NgClass, i2.LoadingComponent, i3.MJButtonDirective], styles: ["[_nghost-%COMP%] {\n display: block;\n height: 100%;\n}\n\n.ml-exp-viewer[_ngcontent-%COMP%] {\n display: flex;\n flex-direction: column;\n height: 100%;\n overflow-y: auto;\n background: var(--mj-bg-page);\n color: var(--mj-text-primary);\n font-size: 13px;\n}\n\n\n\n
|
|
617
|
+
} }, dependencies: [i1.NgClass, i2.LoadingComponent, i3.MJButtonDirective], styles: ["[_nghost-%COMP%] {\n display: block;\n height: 100%;\n}\n\n.ml-exp-viewer[_ngcontent-%COMP%] {\n display: flex;\n flex-direction: column;\n height: 100%;\n overflow-y: auto;\n background: var(--mj-bg-page);\n color: var(--mj-text-primary);\n font-size: 13px;\n}\n\n\n\n.ml-exp-loading[_ngcontent-%COMP%] {\n display: flex;\n align-items: center;\n justify-content: center;\n flex: 1;\n min-height: 200px;\n}\n\n.ml-exp-empty[_ngcontent-%COMP%] {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n flex: 1;\n min-height: 240px;\n padding: 40px 24px;\n text-align: center;\n color: var(--mj-text-muted);\n}\n\n.ml-exp-empty[_ngcontent-%COMP%] i[_ngcontent-%COMP%] {\n font-size: 40px;\n margin-bottom: 14px;\n color: var(--mj-text-disabled);\n}\n\n.ml-exp-empty[_ngcontent-%COMP%] h3[_ngcontent-%COMP%] {\n margin: 0 0 6px;\n font-size: 16px;\n color: var(--mj-text-secondary);\n}\n\n.ml-exp-empty[_ngcontent-%COMP%] p[_ngcontent-%COMP%] {\n margin: 0;\n max-width: 420px;\n font-size: 13px;\n}\n\n\n\n.ml-exp-hero[_ngcontent-%COMP%] {\n display: flex;\n align-items: center;\n gap: 16px;\n padding: 20px 22px;\n color: var(--mj-text-inverse);\n background: linear-gradient(135deg, var(--mj-brand-primary-active), var(--mj-brand-primary));\n}\n\n.hero-badge[_ngcontent-%COMP%] {\n flex: 0 0 auto;\n width: 48px;\n height: 48px;\n border-radius: 12px;\n display: grid;\n place-items: center;\n font-size: 20px;\n background: color-mix(in srgb, var(--mj-text-inverse) 16%, transparent);\n}\n\n.hero-titles[_ngcontent-%COMP%] {\n min-width: 0;\n}\n\n.hero-title[_ngcontent-%COMP%] {\n margin: 0;\n font-size: 18px;\n font-weight: 700;\n}\n\n.hero-sub[_ngcontent-%COMP%] {\n margin-top: 3px;\n font-size: 12.5px;\n color: color-mix(in srgb, var(--mj-text-inverse) 78%, transparent);\n}\n\n.hero-metric[_ngcontent-%COMP%] {\n margin-left: auto;\n text-align: right;\n flex: 0 0 auto;\n}\n\n.hero-metric-value[_ngcontent-%COMP%] {\n font-size: 34px;\n font-weight: 780;\n letter-spacing: -0.02em;\n line-height: 1;\n}\n\n.hero-metric-label[_ngcontent-%COMP%] {\n margin-top: 4px;\n font-size: 11px;\n text-transform: uppercase;\n letter-spacing: 0.05em;\n color: color-mix(in srgb, var(--mj-text-inverse) 72%, transparent);\n}\n\n\n\n.ml-exp-body[_ngcontent-%COMP%] {\n padding: 20px 22px 28px;\n background: var(--mj-bg-surface);\n flex: 1;\n}\n\n.goalbar[_ngcontent-%COMP%] {\n display: flex;\n flex-wrap: wrap;\n gap: 10px 26px;\n padding: 13px 16px;\n margin-bottom: 18px;\n background: var(--mj-bg-surface-card);\n border: 1px solid var(--mj-border-default);\n border-radius: 10px;\n}\n\n.goal-item[_ngcontent-%COMP%] {\n font-size: 12.5px;\n min-width: 0;\n}\n\n.goal-key[_ngcontent-%COMP%] {\n display: block;\n font-size: 11px;\n font-weight: 600;\n text-transform: uppercase;\n letter-spacing: 0.04em;\n color: var(--mj-text-muted);\n}\n\n.goal-val[_ngcontent-%COMP%] {\n font-weight: 650;\n color: var(--mj-text-primary);\n}\n\n.ml-exp-cols[_ngcontent-%COMP%] {\n display: grid;\n grid-template-columns: 1.25fr 1fr;\n gap: 20px;\n align-items: start;\n}\n\n@media (max-width: 920px) {\n .ml-exp-cols[_ngcontent-%COMP%] {\n grid-template-columns: 1fr;\n }\n}\n\n.section-title[_ngcontent-%COMP%] {\n margin: 0 0 10px;\n font-size: 13px;\n font-weight: 700;\n color: var(--mj-text-secondary);\n}\n\n.col-main[_ngcontent-%COMP%] .section-title[_ngcontent-%COMP%]:not(:first-child) {\n margin-top: 20px;\n}\n\n.inline-empty[_ngcontent-%COMP%] {\n padding: 14px 16px;\n border: 1px dashed var(--mj-border-default);\n border-radius: 10px;\n color: var(--mj-text-muted);\n font-size: 12.5px;\n}\n\n\n\n.lb-card[_ngcontent-%COMP%] {\n border: 1px solid var(--mj-border-default);\n border-radius: 12px;\n overflow: hidden;\n background: var(--mj-bg-surface);\n}\n\n.lb-table[_ngcontent-%COMP%] {\n width: 100%;\n border-collapse: collapse;\n font-size: 12.5px;\n}\n\n.lb-table[_ngcontent-%COMP%] thead[_ngcontent-%COMP%] th[_ngcontent-%COMP%] {\n text-align: left;\n padding: 10px 12px;\n font-size: 11px;\n font-weight: 700;\n text-transform: uppercase;\n letter-spacing: 0.04em;\n color: var(--mj-text-muted);\n background: var(--mj-bg-surface-card);\n border-bottom: 1px solid var(--mj-border-default);\n}\n\n.lb-table[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] td[_ngcontent-%COMP%] {\n padding: 10px 12px;\n border-bottom: 1px solid var(--mj-border-subtle);\n color: var(--mj-text-primary);\n}\n\n.lb-table[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]:last-child td[_ngcontent-%COMP%] {\n border-bottom: 0;\n}\n\n.lb-table[_ngcontent-%COMP%] .num[_ngcontent-%COMP%] {\n text-align: right;\n font-variant-numeric: tabular-nums;\n}\n\n.lb-table[_ngcontent-%COMP%] .muted[_ngcontent-%COMP%] {\n color: var(--mj-text-muted);\n}\n\n.lb-table[_ngcontent-%COMP%] .lb-rank-col[_ngcontent-%COMP%] {\n width: 44px;\n}\n\n.lb-table[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] tr.is-winner[_ngcontent-%COMP%] {\n background: var(--mj-status-success-bg);\n}\n\n.lb-table[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] tr.has-model[_ngcontent-%COMP%] {\n cursor: pointer;\n}\n\n.lb-table[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] tr.has-model[_ngcontent-%COMP%]:hover {\n background: var(--mj-bg-surface-hover);\n}\n\n.lb-table[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] tr.has-model.is-winner[_ngcontent-%COMP%]:hover {\n background: color-mix(in srgb, var(--mj-status-success) 14%, var(--mj-bg-surface));\n}\n\n.row-link-icon[_ngcontent-%COMP%] {\n margin-left: 6px;\n font-size: 10px;\n color: var(--mj-text-disabled);\n}\n\n.lb-table[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] tr.has-model[_ngcontent-%COMP%]:hover .row-link-icon[_ngcontent-%COMP%] {\n color: var(--mj-brand-primary);\n}\n\n.rank[_ngcontent-%COMP%] {\n display: inline-grid;\n place-items: center;\n min-width: 22px;\n height: 22px;\n padding: 0 6px;\n border-radius: 999px;\n font-size: 11px;\n font-weight: 700;\n color: var(--mj-text-secondary);\n background: var(--mj-bg-surface-sunken);\n}\n\n.rank.gold[_ngcontent-%COMP%] {\n color: var(--mj-status-warning-text);\n background: var(--mj-status-warning-bg);\n}\n\n\n\n.fi-card[_ngcontent-%COMP%] {\n border: 1px solid var(--mj-border-default);\n border-radius: 12px;\n padding: 14px 16px;\n background: var(--mj-bg-surface);\n display: flex;\n flex-direction: column;\n gap: 10px;\n}\n\n.fbar[_ngcontent-%COMP%] {\n display: grid;\n grid-template-columns: minmax(0, 1fr) 2fr auto;\n align-items: center;\n gap: 12px;\n font-size: 12.5px;\n}\n\n.fbar-label[_ngcontent-%COMP%] {\n color: var(--mj-text-primary);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.fbar-track[_ngcontent-%COMP%] {\n height: 8px;\n border-radius: 999px;\n background: var(--mj-bg-surface-sunken);\n overflow: hidden;\n}\n\n.fbar-fill[_ngcontent-%COMP%] {\n display: block;\n height: 100%;\n border-radius: 999px;\n background: var(--mj-brand-primary);\n transition: width 0.25s ease;\n}\n\n.fbar-num[_ngcontent-%COMP%] {\n font-size: 11px;\n font-variant-numeric: tabular-nums;\n color: var(--mj-text-muted);\n min-width: 30px;\n text-align: right;\n}\n\n\n\n.winner-card[_ngcontent-%COMP%] {\n border: 1px solid var(--mj-status-success-border);\n border-radius: 12px;\n padding: 18px;\n background: color-mix(in srgb, var(--mj-status-success) 6%, var(--mj-bg-surface));\n}\n\n.winner-top[_ngcontent-%COMP%] {\n display: flex;\n align-items: center;\n gap: 13px;\n}\n\n.crown[_ngcontent-%COMP%] {\n flex: 0 0 auto;\n width: 46px;\n height: 46px;\n border-radius: 11px;\n display: grid;\n place-items: center;\n font-size: 19px;\n color: var(--mj-text-inverse);\n background: var(--mj-status-success);\n}\n\n.winner-head[_ngcontent-%COMP%] {\n min-width: 0;\n}\n\n.winner-name[_ngcontent-%COMP%] {\n margin: 0;\n font-size: 16px;\n font-weight: 700;\n color: var(--mj-text-primary);\n}\n\n.winner-head[_ngcontent-%COMP%] .muted[_ngcontent-%COMP%] {\n font-size: 12px;\n color: var(--mj-text-muted);\n}\n\n.wmetrics[_ngcontent-%COMP%] {\n display: grid;\n grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));\n gap: 10px;\n margin: 16px 0;\n}\n\n.wmetric[_ngcontent-%COMP%] {\n border: 1px solid var(--mj-border-subtle);\n border-radius: 9px;\n padding: 10px 12px;\n text-align: center;\n background: var(--mj-bg-surface);\n}\n\n.wmetric-value[_ngcontent-%COMP%] {\n font-size: 19px;\n font-weight: 720;\n color: var(--mj-status-success-text);\n}\n\n.wmetric-label[_ngcontent-%COMP%] {\n margin-top: 2px;\n font-size: 11px;\n color: var(--mj-text-muted);\n}\n\n.drill-btn[_ngcontent-%COMP%] {\n width: 100%;\n justify-content: center;\n}\n\n.drill-hint[_ngcontent-%COMP%] {\n margin-top: 8px;\n font-size: 11.5px;\n text-align: center;\n color: var(--mj-text-muted);\n}"] });
|
|
618
618
|
};
|
|
619
619
|
MLExperimentResultsViewerComponent = __decorate([
|
|
620
620
|
RegisterClass(BaseArtifactViewerPluginComponent, 'MLExperimentResultsViewerPlugin')
|
|
@@ -301,7 +301,7 @@ let PdfArtifactViewerComponent = class PdfArtifactViewerComponent extends BaseAr
|
|
|
301
301
|
i0.ɵɵproperty("fileName", ctx.artifactVersion.FileName || "document.pdf")("currentPage", ctx.currentPage)("totalPages", ctx.totalPages)("isDownloading", ctx.isDownloading)("showPrint", true)("showZoom", true)("zoomPercent", ctx.zoomPercent)("canZoomIn", ctx.canZoomIn)("canZoomOut", ctx.canZoomOut);
|
|
302
302
|
i0.ɵɵadvance(2);
|
|
303
303
|
i0.ɵɵconditional(ctx.isLoading ? 3 : ctx.errorMessage ? 4 : 5);
|
|
304
|
-
} }, dependencies: [i2.FileArtifactToolbarComponent], styles: [".pdf-viewer[_ngcontent-%COMP%] {\n display: flex;\n flex-direction: column;\n height: 100%;\n background: var(--mj-bg-surface-sunken);\n }\n\n .pdf-viewer__body[_ngcontent-%COMP%] {\n flex: 1;\n min-height: 0;\n overflow: auto;\n }\n\n .pdf-viewer__state[_ngcontent-%COMP%] {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n gap: 12px;\n height: 100%;\n color: var(--mj-text-muted);\n font-size: 14px;\n }\n\n .pdf-viewer__state--error[_ngcontent-%COMP%] {\n color: var(--mj-status-error-text);\n }\n\n .pdf-viewer__canvas-wrap[_ngcontent-%COMP%] {\n display: flex;\n justify-content: center;\n padding: 16px;\n \n\n\n
|
|
304
|
+
} }, dependencies: [i2.FileArtifactToolbarComponent], styles: [".pdf-viewer[_ngcontent-%COMP%] {\n display: flex;\n flex-direction: column;\n height: 100%;\n background: var(--mj-bg-surface-sunken);\n }\n\n .pdf-viewer__body[_ngcontent-%COMP%] {\n flex: 1;\n min-height: 0;\n overflow: auto;\n }\n\n .pdf-viewer__state[_ngcontent-%COMP%] {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n gap: 12px;\n height: 100%;\n color: var(--mj-text-muted);\n font-size: 14px;\n }\n\n .pdf-viewer__state--error[_ngcontent-%COMP%] {\n color: var(--mj-status-error-text);\n }\n\n .pdf-viewer__canvas-wrap[_ngcontent-%COMP%] {\n display: flex;\n justify-content: center;\n padding: 16px;\n \n\n\n min-width: fit-content;\n }\n\n canvas[_ngcontent-%COMP%] {\n display: block;\n box-shadow: 0 2px 8px color-mix(in srgb, var(--mj-text-primary) 15%, transparent);\n \n\n\n\n }"] });
|
|
305
305
|
};
|
|
306
306
|
PdfArtifactViewerComponent = __decorate([
|
|
307
307
|
RegisterClass(BaseArtifactViewerPluginComponent, 'PdfArtifactViewerPlugin')
|
|
@@ -332,7 +332,7 @@ export class SaveQueryPanelComponent extends BaseAngularComponent {
|
|
|
332
332
|
} }, inputs: { QueryName: "QueryName", QueryDescription: "QueryDescription", SQL: "SQL", Plan: "Plan" }, outputs: { Saved: "Saved", Cancelled: "Cancelled" }, standalone: false, features: [i0.ɵɵInheritDefinitionFeature], decls: 36, vars: 17, consts: [["categoryTree", ""], [1, "sqp-backdrop", 3, "click"], [1, "sqp-panel"], [1, "sqp-header"], [1, "sqp-title-group"], [1, "fa-solid", "fa-save", "sqp-title-icon"], [1, "sqp-title"], [1, "sqp-close-btn", 3, "click"], [1, "fa-solid", "fa-xmark"], [1, "sqp-body"], [1, "sqp-field"], [1, "sqp-label"], [1, "sqp-required"], ["type", "text", "placeholder", "Query name", 1, "sqp-input", 3, "ngModelChange", "keydown.enter", "ngModel"], [1, "sqp-label-row"], ["title", "Create new category", 1, "sqp-add-btn"], [3, "SelectionChange", "BranchConfig", "SelectionMode", "SelectableTypes", "Placeholder", "Value"], [1, "sqp-create-category"], ["placeholder", "Optional description", "rows", "3", 1, "sqp-textarea", 3, "ngModelChange", "ngModel"], [1, "sqp-error"], [1, "sqp-footer"], [1, "sqp-btn", "sqp-btn-save", 3, "click", "disabled"], [1, "sqp-btn", "sqp-btn-cancel", 3, "click", "disabled"], ["title", "Create new category", 1, "sqp-add-btn", 3, "click"], [1, "fa-solid", "fa-plus"], [1, "sqp-create-header"], [1, "fa-solid", "fa-folder-plus"], [1, "sqp-create-fields"], ["type", "text", "placeholder", "Category name", 1, "sqp-input", 3, "ngModelChange", "keydown.enter", "keydown.escape", "ngModel"], [1, "sqp-create-parent"], [1, "sqp-sublabel"], [3, "SelectionChange", "BranchConfig", "SelectionMode", "SelectableTypes", "Placeholder"], [1, "sqp-create-actions"], [1, "sqp-btn", "sqp-btn-create", 3, "click", "disabled"], [1, "fa-solid", "fa-spinner", "fa-spin"], [1, "fa-solid", "fa-check"], [1, "sqp-btn", "sqp-btn-cancel-create", 3, "click", "disabled"], [1, "sqp-inline-error"], [1, "fa-solid", "fa-exclamation-circle"], [1, "fa-solid", "fa-save"]], template: function SaveQueryPanelComponent_Template(rf, ctx) { if (rf & 1) {
|
|
333
333
|
const _r1 = i0.ɵɵgetCurrentView();
|
|
334
334
|
i0.ɵɵelementStart(0, "div", 1);
|
|
335
|
-
i0.ɵɵlistener("click", function SaveQueryPanelComponent_Template_div_click_0_listener() {
|
|
335
|
+
i0.ɵɵlistener("click", function SaveQueryPanelComponent_Template_div_click_0_listener() { return ctx.OnCancel(); });
|
|
336
336
|
i0.ɵɵelementEnd();
|
|
337
337
|
i0.ɵɵelementStart(1, "div", 2)(2, "div", 3)(3, "div", 4);
|
|
338
338
|
i0.ɵɵelement(4, "i", 5);
|
|
@@ -340,7 +340,7 @@ export class SaveQueryPanelComponent extends BaseAngularComponent {
|
|
|
340
340
|
i0.ɵɵtext(6, "Save Query");
|
|
341
341
|
i0.ɵɵelementEnd()();
|
|
342
342
|
i0.ɵɵelementStart(7, "button", 7);
|
|
343
|
-
i0.ɵɵlistener("click", function SaveQueryPanelComponent_Template_button_click_7_listener() {
|
|
343
|
+
i0.ɵɵlistener("click", function SaveQueryPanelComponent_Template_button_click_7_listener() { return ctx.OnCancel(); });
|
|
344
344
|
i0.ɵɵelement(8, "i", 8);
|
|
345
345
|
i0.ɵɵelementEnd()();
|
|
346
346
|
i0.ɵɵelementStart(9, "div", 9)(10, "div", 10)(11, "label", 11);
|
|
@@ -350,7 +350,7 @@ export class SaveQueryPanelComponent extends BaseAngularComponent {
|
|
|
350
350
|
i0.ɵɵelementEnd()();
|
|
351
351
|
i0.ɵɵelementStart(15, "input", 13);
|
|
352
352
|
i0.ɵɵtwoWayListener("ngModelChange", function SaveQueryPanelComponent_Template_input_ngModelChange_15_listener($event) { i0.ɵɵrestoreView(_r1); i0.ɵɵtwoWayBindingSet(ctx.Name, $event) || (ctx.Name = $event); return i0.ɵɵresetView($event); });
|
|
353
|
-
i0.ɵɵlistener("keydown.enter", function SaveQueryPanelComponent_Template_input_keydown_enter_15_listener() {
|
|
353
|
+
i0.ɵɵlistener("keydown.enter", function SaveQueryPanelComponent_Template_input_keydown_enter_15_listener() { return ctx.OnSave(); });
|
|
354
354
|
i0.ɵɵelementEnd()();
|
|
355
355
|
i0.ɵɵelementStart(16, "div", 10)(17, "div", 14)(18, "label", 11);
|
|
356
356
|
i0.ɵɵtext(19, "Category");
|
|
@@ -358,7 +358,7 @@ export class SaveQueryPanelComponent extends BaseAngularComponent {
|
|
|
358
358
|
i0.ɵɵconditionalCreate(20, SaveQueryPanelComponent_Conditional_20_Template, 3, 0, "button", 15);
|
|
359
359
|
i0.ɵɵelementEnd();
|
|
360
360
|
i0.ɵɵelementStart(21, "mj-tree-dropdown", 16, 0);
|
|
361
|
-
i0.ɵɵlistener("SelectionChange", function SaveQueryPanelComponent_Template_mj_tree_dropdown_SelectionChange_21_listener($event) {
|
|
361
|
+
i0.ɵɵlistener("SelectionChange", function SaveQueryPanelComponent_Template_mj_tree_dropdown_SelectionChange_21_listener($event) { return ctx.OnCategoryChanged($event); });
|
|
362
362
|
i0.ɵɵelementEnd();
|
|
363
363
|
i0.ɵɵconditionalCreate(23, SaveQueryPanelComponent_Conditional_23_Template, 19, 10, "div", 17);
|
|
364
364
|
i0.ɵɵelementEnd();
|
|
@@ -372,11 +372,11 @@ export class SaveQueryPanelComponent extends BaseAngularComponent {
|
|
|
372
372
|
i0.ɵɵconditionalCreate(29, SaveQueryPanelComponent_Conditional_29_Template, 3, 1, "div", 19);
|
|
373
373
|
i0.ɵɵelementEnd();
|
|
374
374
|
i0.ɵɵelementStart(30, "div", 20)(31, "button", 21);
|
|
375
|
-
i0.ɵɵlistener("click", function SaveQueryPanelComponent_Template_button_click_31_listener() {
|
|
375
|
+
i0.ɵɵlistener("click", function SaveQueryPanelComponent_Template_button_click_31_listener() { return ctx.OnSave(); });
|
|
376
376
|
i0.ɵɵconditionalCreate(32, SaveQueryPanelComponent_Conditional_32_Template, 2, 0)(33, SaveQueryPanelComponent_Conditional_33_Template, 2, 0);
|
|
377
377
|
i0.ɵɵelementEnd();
|
|
378
378
|
i0.ɵɵelementStart(34, "button", 22);
|
|
379
|
-
i0.ɵɵlistener("click", function SaveQueryPanelComponent_Template_button_click_34_listener() {
|
|
379
|
+
i0.ɵɵlistener("click", function SaveQueryPanelComponent_Template_button_click_34_listener() { return ctx.OnCancel(); });
|
|
380
380
|
i0.ɵɵtext(35, " Cancel ");
|
|
381
381
|
i0.ɵɵelementEnd()()();
|
|
382
382
|
} if (rf & 2) {
|
|
@@ -401,7 +401,7 @@ export class SaveQueryPanelComponent extends BaseAngularComponent {
|
|
|
401
401
|
i0.ɵɵconditional(ctx.IsSaving ? 32 : 33);
|
|
402
402
|
i0.ɵɵadvance(2);
|
|
403
403
|
i0.ɵɵproperty("disabled", ctx.IsSaving);
|
|
404
|
-
} }, dependencies: [i1.DefaultValueAccessor, i1.NgControlStatus, i1.NgModel, i2.TreeDropdownComponent], styles: ["\n
|
|
404
|
+
} }, dependencies: [i1.DefaultValueAccessor, i1.NgControlStatus, i1.NgModel, i2.TreeDropdownComponent], styles: ["\n .sqp-backdrop[_ngcontent-%COMP%] {\n position: fixed;\n inset: 0;\n background: rgba(0, 0, 0, 0);\n z-index: 1000;\n transition: background 0.3s ease;\n pointer-events: none;\n }\n .sqp-backdrop.sqp-visible[_ngcontent-%COMP%] {\n background: var(--mj-bg-overlay, rgba(0, 0, 0, 0.3));\n pointer-events: auto;\n }\n\n \n\n\n .sqp-panel[_ngcontent-%COMP%] {\n position: fixed;\n top: 0;\n right: -440px;\n height: 100vh;\n width: 440px;\n background: var(--mj-bg-surface);\n box-shadow: -8px 0 32px rgba(0, 0, 0, 0.12);\n z-index: 1001;\n display: flex;\n flex-direction: column;\n transition: right 0.3s cubic-bezier(0.16, 1, 0.3, 1);\n }\n .sqp-panel.sqp-visible[_ngcontent-%COMP%] {\n right: 0;\n }\n\n \n .sqp-header[_ngcontent-%COMP%] {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 20px 24px 16px;\n border-bottom: 1px solid var(--mj-border-default);\n flex-shrink: 0;\n }\n .sqp-title-group[_ngcontent-%COMP%] {\n display: flex;\n align-items: center;\n gap: 10px;\n }\n .sqp-title-icon[_ngcontent-%COMP%] {\n font-size: 20px;\n color: var(--mj-brand-primary);\n }\n .sqp-title[_ngcontent-%COMP%] {\n margin: 0;\n font-size: 18px;\n font-weight: 700;\n color: var(--mj-text-primary);\n }\n .sqp-close-btn[_ngcontent-%COMP%] {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 36px;\n height: 36px;\n background: none;\n border: none;\n border-radius: 8px;\n color: var(--mj-text-secondary);\n cursor: pointer;\n transition: all 0.15s ease;\n font-size: 16px;\n flex-shrink: 0;\n }\n .sqp-close-btn[_ngcontent-%COMP%]:hover {\n background: var(--mj-bg-surface-hover);\n color: var(--mj-text-primary);\n }\n\n \n .sqp-body[_ngcontent-%COMP%] {\n flex: 1;\n overflow-y: auto;\n padding: 24px;\n }\n\n \n .sqp-field[_ngcontent-%COMP%] {\n margin-bottom: 20px;\n }\n .sqp-label-row[_ngcontent-%COMP%] {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin-bottom: 6px;\n }\n .sqp-label[_ngcontent-%COMP%] {\n display: block;\n margin-bottom: 6px;\n font-weight: 600;\n font-size: 13px;\n color: var(--mj-text-primary);\n }\n .sqp-label-row[_ngcontent-%COMP%] .sqp-label[_ngcontent-%COMP%] {\n margin-bottom: 0;\n }\n .sqp-sublabel[_ngcontent-%COMP%] {\n display: block;\n margin-bottom: 4px;\n font-weight: 500;\n font-size: 12px;\n color: var(--mj-text-secondary);\n }\n .sqp-required[_ngcontent-%COMP%] {\n color: var(--mj-status-error);\n }\n .sqp-input[_ngcontent-%COMP%] {\n width: 100%;\n padding: 10px 12px;\n border: 1px solid var(--mj-border-default);\n border-radius: 6px;\n font-size: 14px;\n color: var(--mj-text-primary);\n background: var(--mj-bg-surface);\n transition: border-color 0.15s ease, box-shadow 0.15s ease;\n box-sizing: border-box;\n }\n .sqp-input[_ngcontent-%COMP%]:focus {\n outline: none;\n border-color: var(--mj-border-focus);\n box-shadow: 0 0 0 3px color-mix(in srgb, var(--mj-brand-primary) 15%, transparent);\n }\n .sqp-input[_ngcontent-%COMP%]::placeholder {\n color: var(--mj-text-disabled);\n }\n .sqp-textarea[_ngcontent-%COMP%] {\n width: 100%;\n padding: 10px 12px;\n border: 1px solid var(--mj-border-default);\n border-radius: 6px;\n font-size: 14px;\n color: var(--mj-text-primary);\n background: var(--mj-bg-surface);\n resize: vertical;\n font-family: inherit;\n transition: border-color 0.15s ease, box-shadow 0.15s ease;\n box-sizing: border-box;\n }\n .sqp-textarea[_ngcontent-%COMP%]:focus {\n outline: none;\n border-color: var(--mj-border-focus);\n box-shadow: 0 0 0 3px color-mix(in srgb, var(--mj-brand-primary) 15%, transparent);\n }\n .sqp-textarea[_ngcontent-%COMP%]::placeholder {\n color: var(--mj-text-disabled);\n }\n\n \n .sqp-add-btn[_ngcontent-%COMP%] {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n padding: 3px 10px;\n background: none;\n border: 1px solid var(--mj-border-default);\n border-radius: 4px;\n font-size: 12px;\n color: var(--mj-brand-primary);\n cursor: pointer;\n transition: all 0.15s ease;\n }\n .sqp-add-btn[_ngcontent-%COMP%]:hover {\n background: color-mix(in srgb, var(--mj-brand-primary) 10%, var(--mj-bg-surface));\n border-color: var(--mj-brand-primary);\n }\n\n \n .sqp-create-category[_ngcontent-%COMP%] {\n margin-top: 12px;\n padding: 14px;\n background: var(--mj-bg-surface-card);\n border: 1px solid var(--mj-border-default);\n border-radius: 8px;\n }\n .sqp-create-header[_ngcontent-%COMP%] {\n display: flex;\n align-items: center;\n gap: 6px;\n font-size: 13px;\n font-weight: 600;\n color: var(--mj-text-secondary);\n margin-bottom: 10px;\n }\n .sqp-create-header[_ngcontent-%COMP%] i[_ngcontent-%COMP%] {\n color: var(--mj-brand-primary);\n }\n .sqp-create-fields[_ngcontent-%COMP%] {\n display: flex;\n flex-direction: column;\n gap: 10px;\n }\n .sqp-create-parent[_ngcontent-%COMP%] {\n margin-top: 2px;\n }\n .sqp-create-actions[_ngcontent-%COMP%] {\n display: flex;\n gap: 8px;\n margin-top: 12px;\n }\n .sqp-inline-error[_ngcontent-%COMP%] {\n margin-top: 8px;\n font-size: 12px;\n color: var(--mj-status-error-text);\n }\n\n \n .sqp-btn[_ngcontent-%COMP%] {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n padding: 8px 16px;\n border: none;\n border-radius: 6px;\n font-size: 13px;\n font-weight: 500;\n cursor: pointer;\n transition: all 0.15s ease;\n }\n .sqp-btn[_ngcontent-%COMP%]:disabled {\n opacity: 0.6;\n cursor: not-allowed;\n }\n .sqp-btn-save[_ngcontent-%COMP%] {\n background: var(--mj-brand-primary);\n color: var(--mj-text-inverse);\n padding: 10px 20px;\n font-size: 14px;\n }\n .sqp-btn-save[_ngcontent-%COMP%]:hover:not(:disabled) {\n background: var(--mj-brand-primary-hover);\n }\n .sqp-btn-cancel[_ngcontent-%COMP%] {\n background: none;\n border: 1px solid var(--mj-border-default);\n color: var(--mj-text-secondary);\n padding: 10px 20px;\n font-size: 14px;\n }\n .sqp-btn-cancel[_ngcontent-%COMP%]:hover:not(:disabled) {\n background: var(--mj-bg-surface-hover);\n color: var(--mj-text-primary);\n }\n .sqp-btn-create[_ngcontent-%COMP%] {\n background: var(--mj-status-success);\n color: var(--mj-text-inverse);\n }\n .sqp-btn-create[_ngcontent-%COMP%]:hover:not(:disabled) {\n background: color-mix(in srgb, var(--mj-status-success) 85%, black);\n }\n .sqp-btn-cancel-create[_ngcontent-%COMP%] {\n background: none;\n color: var(--mj-text-secondary);\n }\n .sqp-btn-cancel-create[_ngcontent-%COMP%]:hover:not(:disabled) {\n color: var(--mj-text-primary);\n background: var(--mj-bg-surface-sunken);\n }\n\n \n .sqp-footer[_ngcontent-%COMP%] {\n display: flex;\n gap: 10px;\n padding: 16px 24px;\n border-top: 1px solid var(--mj-border-default);\n flex-shrink: 0;\n }\n\n \n .sqp-error[_ngcontent-%COMP%] {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 10px 14px;\n background: var(--mj-status-error-bg);\n border: 1px solid var(--mj-status-error-border);\n border-radius: 6px;\n color: var(--mj-status-error-text);\n font-size: 13px;\n }\n\n \n @media (max-width: 768px) {\n .sqp-panel[_ngcontent-%COMP%] {\n width: 100% !important;\n right: -100%;\n }\n .sqp-panel.sqp-visible[_ngcontent-%COMP%] {\n right: 0;\n }\n .sqp-header[_ngcontent-%COMP%] {\n padding: 16px 20px 12px;\n }\n .sqp-body[_ngcontent-%COMP%] {\n padding: 16px;\n }\n .sqp-footer[_ngcontent-%COMP%] {\n padding: 12px 16px;\n }\n }"], changeDetection: 0 });
|
|
405
405
|
}
|
|
406
406
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(SaveQueryPanelComponent, [{
|
|
407
407
|
type: Component,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"save-query-dialog.component.js","sourceRoot":"","sources":["../../../../src/lib/components/plugins/save-query-dialog.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,uBAAuB,EAAqB,YAAY,EAAE,MAAM,eAAe,CAAC;AAC5I,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAY,YAAY,EAAE,YAAY,EAAc,MAAM,sBAAsB,CAAC;AAExF,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;;;;;;;IA2D3D,kCAAwF;IAA5D,4LAAS,4BAAqB,KAAC;IACzD,wBAAgC;IAAC,qBACnC;IAAA,iBAAS;;;IA6CH,wBAA2C;;;IAE3C,wBAAiC;;;IAWrC,+BAA8B;IAAA,YAAyB;IAAA,iBAAM;;;IAA/B,cAAyB;IAAzB,gDAAyB;;;;IAzCzD,AADF,+BAAiC,cACA;IAC7B,wBAAuC;IACvC,4BAAM;IAAA,4BAAY;IACpB,AADoB,iBAAO,EACrB;IAEJ,AADF,+BAA+B,gBAOe;IAH1C,8TAA6B;IAG7B,AADA,2MAAiB,uBAAgB,KAAC,gMAChB,6BAAsB,KAAC;IAN3C,iBAM4C;IAE1C,AADF,+BAA+B,gBACD;IAAA,iCAAiB;IAAA,iBAAQ;IACrD,6CAKyD;IAAvD,iOAAmB,yC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EACL,EACF;;YAzIoB,4CAA+B;YAGlC,cAA+B;YAA/B,4CAA+B;YAsB9C,gBAAkB;YAAlB,wCAAkB;YASlB,eAIC;YAJD,mDAIC;YAKD,cAAqC;YAIrC,AADA,AADA,AADA,AADA,uDAAqC,2BACX,6BACE,+CACkB,kCACjB;YAK/B,eA8CC;YA9CD,kDA8CC;YAQC,eAAyB;YAAzB,+CAAyB;YAM7B,eAKC;YALD,4CAKC;YAOC,eAAiC;YAAjC,uDAAiC;YACjC,cAIC;YAJD,wCAIC;YAID,eAAqB;YAArB,uCAAqB;;;iFA8TlB,uBAAuB;cAxcnC,SAAS;6BACI,KAAK,YACP,qBAAqB,YACrB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4IT,mBAuTgB,uBAAuB,CAAC,MAAM;;kBAG9C,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBAEL,MAAM;;kBACN,MAAM;;kBAEN,SAAS;mBAAC,cAAc;;kBAiDxB,YAAY;mBAAC,yBAAyB;;kFA1D5B,uBAAuB","sourcesContent":["import { Component, Input, Output, EventEmitter, ViewChild, ChangeDetectionStrategy, ChangeDetectorRef, HostListener } from '@angular/core';\nimport { BaseAngularComponent } from '@memberjunction/ng-base-types';\nimport { Metadata, CompositeKey, KeyValuePair, BaseEntity } from '@memberjunction/core';\nimport { MJQueryEntity, MJQueryCategoryEntity } from '@memberjunction/core-entities';\nimport { MJNotificationService } from '@memberjunction/ng-notifications';\nimport { TreeBranchConfig, TreeNode } from '@memberjunction/ng-trees';\nimport { TreeDropdownComponent } from '@memberjunction/ng-trees';\n\n/**\n * Result emitted when a query is successfully saved\n */\nexport interface SaveQueryResult {\n queryId: string;\n queryName: string;\n}\n\n/**\n * Slide-in panel for saving an ad-hoc SQL query as a reusable MJ Query record.\n * Pre-populates name from the artifact title and provides a tree dropdown\n * for selecting a query category, with inline category creation.\n *\n * Follows the CreateAgentSlideInComponent pattern for slide-in UX.\n */\n@Component({\n standalone: false,\n selector: 'mj-save-query-panel',\n template: `\n <!-- Backdrop -->\n <div class=\"sqp-backdrop\" [class.sqp-visible]=\"IsVisible\" (click)=\"OnCancel()\"></div>\n\n <!-- Slide panel -->\n <div class=\"sqp-panel\" [class.sqp-visible]=\"IsVisible\">\n <!-- Header -->\n <div class=\"sqp-header\">\n <div class=\"sqp-title-group\">\n <i class=\"fa-solid fa-save sqp-title-icon\"></i>\n <h2 class=\"sqp-title\">Save Query</h2>\n </div>\n <button class=\"sqp-close-btn\" (click)=\"OnCancel()\">\n <i class=\"fa-solid fa-xmark\"></i>\n </button>\n </div>\n\n <!-- Body -->\n <div class=\"sqp-body\">\n <!-- Name -->\n <div class=\"sqp-field\">\n <label class=\"sqp-label\">\n Name <span class=\"sqp-required\">*</span>\n </label>\n <input\n type=\"text\"\n class=\"sqp-input\"\n [(ngModel)]=\"Name\"\n placeholder=\"Query name\"\n (keydown.enter)=\"OnSave()\">\n </div>\n\n <!-- Category -->\n <div class=\"sqp-field\">\n <div class=\"sqp-label-row\">\n <label class=\"sqp-label\">Category</label>\n @if (!IsCreatingCategory) {\n <button class=\"sqp-add-btn\" (click)=\"StartCreateCategory()\" title=\"Create new category\">\n <i class=\"fa-solid fa-plus\"></i> New\n </button>\n }\n </div>\n\n <mj-tree-dropdown\n #categoryTree\n [BranchConfig]=\"CategoryBranchConfig\"\n [SelectionMode]=\"'single'\"\n [SelectableTypes]=\"'branch'\"\n [Placeholder]=\"'Select a category (optional)'\"\n [Value]=\"SelectedCategoryKey\"\n (SelectionChange)=\"OnCategoryChanged($event)\">\n </mj-tree-dropdown>\n\n <!-- Inline create category form -->\n @if (IsCreatingCategory) {\n <div class=\"sqp-create-category\">\n <div class=\"sqp-create-header\">\n <i class=\"fa-solid fa-folder-plus\"></i>\n <span>New Category</span>\n </div>\n <div class=\"sqp-create-fields\">\n <input\n type=\"text\"\n class=\"sqp-input\"\n [(ngModel)]=\"NewCategoryName\"\n placeholder=\"Category name\"\n (keydown.enter)=\"CreateCategory()\"\n (keydown.escape)=\"CancelCreateCategory()\">\n <div class=\"sqp-create-parent\">\n <label class=\"sqp-sublabel\">Parent (optional)</label>\n <mj-tree-dropdown\n [BranchConfig]=\"CategoryBranchConfig\"\n [SelectionMode]=\"'single'\"\n [SelectableTypes]=\"'branch'\"\n [Placeholder]=\"'None (top level)'\"\n (SelectionChange)=\"OnNewCategoryParentChanged($event)\">\n </mj-tree-dropdown>\n </div>\n </div>\n <div class=\"sqp-create-actions\">\n <button class=\"sqp-btn sqp-btn-create\"\n (click)=\"CreateCategory()\"\n [disabled]=\"!NewCategoryName.trim() || IsCreatingCategorySaving\">\n @if (IsCreatingCategorySaving) {\n <i class=\"fa-solid fa-spinner fa-spin\"></i>\n } @else {\n <i class=\"fa-solid fa-check\"></i>\n }\n {{ IsCreatingCategorySaving ? 'Creating...' : 'Create' }}\n </button>\n <button class=\"sqp-btn sqp-btn-cancel-create\"\n (click)=\"CancelCreateCategory()\"\n [disabled]=\"IsCreatingCategorySaving\">\n Cancel\n </button>\n </div>\n @if (CreateCategoryError) {\n <div class=\"sqp-inline-error\">{{ CreateCategoryError }}</div>\n }\n </div>\n }\n </div>\n\n <!-- Description -->\n <div class=\"sqp-field\">\n <label class=\"sqp-label\">Description</label>\n <textarea\n class=\"sqp-textarea\"\n [(ngModel)]=\"Description\"\n placeholder=\"Optional description\"\n rows=\"3\">\n </textarea>\n </div>\n\n @if (ErrorMessage) {\n <div class=\"sqp-error\">\n <i class=\"fa-solid fa-exclamation-circle\"></i>\n {{ ErrorMessage }}\n </div>\n }\n </div>\n\n <!-- Footer -->\n <div class=\"sqp-footer\">\n <button class=\"sqp-btn sqp-btn-save\"\n (click)=\"OnSave()\"\n [disabled]=\"!CanSave || IsSaving\">\n @if (IsSaving) {\n <i class=\"fa-solid fa-spinner fa-spin\"></i> Saving...\n } @else {\n <i class=\"fa-solid fa-save\"></i> Save Query\n }\n </button>\n <button class=\"sqp-btn sqp-btn-cancel\"\n (click)=\"OnCancel()\"\n [disabled]=\"IsSaving\">\n Cancel\n </button>\n </div>\n </div>\n `,\n styles: [`\n /* Backdrop */\n .sqp-backdrop {\n position: fixed;\n inset: 0;\n background: rgba(0, 0, 0, 0);\n z-index: 1000;\n transition: background 0.3s ease;\n pointer-events: none;\n }\n .sqp-backdrop.sqp-visible {\n background: var(--mj-bg-overlay, rgba(0, 0, 0, 0.3));\n pointer-events: auto;\n }\n\n /* Panel — uses right offset instead of transform to avoid creating\n a new containing block that breaks position:fixed children\n (e.g., the tree-dropdown popup). */\n .sqp-panel {\n position: fixed;\n top: 0;\n right: -440px;\n height: 100vh;\n width: 440px;\n background: var(--mj-bg-surface);\n box-shadow: -8px 0 32px rgba(0, 0, 0, 0.12);\n z-index: 1001;\n display: flex;\n flex-direction: column;\n transition: right 0.3s cubic-bezier(0.16, 1, 0.3, 1);\n }\n .sqp-panel.sqp-visible {\n right: 0;\n }\n\n /* Header */\n .sqp-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 20px 24px 16px;\n border-bottom: 1px solid var(--mj-border-default);\n flex-shrink: 0;\n }\n .sqp-title-group {\n display: flex;\n align-items: center;\n gap: 10px;\n }\n .sqp-title-icon {\n font-size: 20px;\n color: var(--mj-brand-primary);\n }\n .sqp-title {\n margin: 0;\n font-size: 18px;\n font-weight: 700;\n color: var(--mj-text-primary);\n }\n .sqp-close-btn {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 36px;\n height: 36px;\n background: none;\n border: none;\n border-radius: 8px;\n color: var(--mj-text-secondary);\n cursor: pointer;\n transition: all 0.15s ease;\n font-size: 16px;\n flex-shrink: 0;\n }\n .sqp-close-btn:hover {\n background: var(--mj-bg-surface-hover);\n color: var(--mj-text-primary);\n }\n\n /* Body */\n .sqp-body {\n flex: 1;\n overflow-y: auto;\n padding: 24px;\n }\n\n /* Fields */\n .sqp-field {\n margin-bottom: 20px;\n }\n .sqp-label-row {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin-bottom: 6px;\n }\n .sqp-label {\n display: block;\n margin-bottom: 6px;\n font-weight: 600;\n font-size: 13px;\n color: var(--mj-text-primary);\n }\n .sqp-label-row .sqp-label {\n margin-bottom: 0;\n }\n .sqp-sublabel {\n display: block;\n margin-bottom: 4px;\n font-weight: 500;\n font-size: 12px;\n color: var(--mj-text-secondary);\n }\n .sqp-required {\n color: var(--mj-status-error);\n }\n .sqp-input {\n width: 100%;\n padding: 10px 12px;\n border: 1px solid var(--mj-border-default);\n border-radius: 6px;\n font-size: 14px;\n color: var(--mj-text-primary);\n background: var(--mj-bg-surface);\n transition: border-color 0.15s ease, box-shadow 0.15s ease;\n box-sizing: border-box;\n }\n .sqp-input:focus {\n outline: none;\n border-color: var(--mj-border-focus);\n box-shadow: 0 0 0 3px color-mix(in srgb, var(--mj-brand-primary) 15%, transparent);\n }\n .sqp-input::placeholder {\n color: var(--mj-text-disabled);\n }\n .sqp-textarea {\n width: 100%;\n padding: 10px 12px;\n border: 1px solid var(--mj-border-default);\n border-radius: 6px;\n font-size: 14px;\n color: var(--mj-text-primary);\n background: var(--mj-bg-surface);\n resize: vertical;\n font-family: inherit;\n transition: border-color 0.15s ease, box-shadow 0.15s ease;\n box-sizing: border-box;\n }\n .sqp-textarea:focus {\n outline: none;\n border-color: var(--mj-border-focus);\n box-shadow: 0 0 0 3px color-mix(in srgb, var(--mj-brand-primary) 15%, transparent);\n }\n .sqp-textarea::placeholder {\n color: var(--mj-text-disabled);\n }\n\n /* Add category button */\n .sqp-add-btn {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n padding: 3px 10px;\n background: none;\n border: 1px solid var(--mj-border-default);\n border-radius: 4px;\n font-size: 12px;\n color: var(--mj-brand-primary);\n cursor: pointer;\n transition: all 0.15s ease;\n }\n .sqp-add-btn:hover {\n background: color-mix(in srgb, var(--mj-brand-primary) 10%, var(--mj-bg-surface));\n border-color: var(--mj-brand-primary);\n }\n\n /* Inline create category */\n .sqp-create-category {\n margin-top: 12px;\n padding: 14px;\n background: var(--mj-bg-surface-card);\n border: 1px solid var(--mj-border-default);\n border-radius: 8px;\n }\n .sqp-create-header {\n display: flex;\n align-items: center;\n gap: 6px;\n font-size: 13px;\n font-weight: 600;\n color: var(--mj-text-secondary);\n margin-bottom: 10px;\n }\n .sqp-create-header i {\n color: var(--mj-brand-primary);\n }\n .sqp-create-fields {\n display: flex;\n flex-direction: column;\n gap: 10px;\n }\n .sqp-create-parent {\n margin-top: 2px;\n }\n .sqp-create-actions {\n display: flex;\n gap: 8px;\n margin-top: 12px;\n }\n .sqp-inline-error {\n margin-top: 8px;\n font-size: 12px;\n color: var(--mj-status-error-text);\n }\n\n /* Buttons */\n .sqp-btn {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n padding: 8px 16px;\n border: none;\n border-radius: 6px;\n font-size: 13px;\n font-weight: 500;\n cursor: pointer;\n transition: all 0.15s ease;\n }\n .sqp-btn:disabled {\n opacity: 0.6;\n cursor: not-allowed;\n }\n .sqp-btn-save {\n background: var(--mj-brand-primary);\n color: var(--mj-text-inverse);\n padding: 10px 20px;\n font-size: 14px;\n }\n .sqp-btn-save:hover:not(:disabled) {\n background: var(--mj-brand-primary-hover);\n }\n .sqp-btn-cancel {\n background: none;\n border: 1px solid var(--mj-border-default);\n color: var(--mj-text-secondary);\n padding: 10px 20px;\n font-size: 14px;\n }\n .sqp-btn-cancel:hover:not(:disabled) {\n background: var(--mj-bg-surface-hover);\n color: var(--mj-text-primary);\n }\n .sqp-btn-create {\n background: var(--mj-status-success);\n color: var(--mj-text-inverse);\n }\n .sqp-btn-create:hover:not(:disabled) {\n background: color-mix(in srgb, var(--mj-status-success) 85%, black);\n }\n .sqp-btn-cancel-create {\n background: none;\n color: var(--mj-text-secondary);\n }\n .sqp-btn-cancel-create:hover:not(:disabled) {\n color: var(--mj-text-primary);\n background: var(--mj-bg-surface-sunken);\n }\n\n /* Footer */\n .sqp-footer {\n display: flex;\n gap: 10px;\n padding: 16px 24px;\n border-top: 1px solid var(--mj-border-default);\n flex-shrink: 0;\n }\n\n /* Error */\n .sqp-error {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 10px 14px;\n background: var(--mj-status-error-bg);\n border: 1px solid var(--mj-status-error-border);\n border-radius: 6px;\n color: var(--mj-status-error-text);\n font-size: 13px;\n }\n\n /* Responsive */\n @media (max-width: 768px) {\n .sqp-panel {\n width: 100% !important;\n right: -100%;\n }\n .sqp-panel.sqp-visible {\n right: 0;\n }\n .sqp-header {\n padding: 16px 20px 12px;\n }\n .sqp-body {\n padding: 16px;\n }\n .sqp-footer {\n padding: 12px 16px;\n }\n }\n `],\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class SaveQueryPanelComponent extends BaseAngularComponent {\n @Input() QueryName = '';\n @Input() QueryDescription = '';\n @Input() SQL = '';\n @Input() Plan = '';\n\n @Output() Saved = new EventEmitter<SaveQueryResult>();\n @Output() Cancelled = new EventEmitter<void>();\n\n @ViewChild('categoryTree') categoryTree!: TreeDropdownComponent;\n\n // Form state\n public Name = '';\n public Description = '';\n public IsSaving = false;\n public ErrorMessage = '';\n public IsVisible = false;\n\n // Category selection\n private selectedCategoryId: string | null = null;\n public SelectedCategoryKey: CompositeKey | null = null;\n\n // Inline category creation\n public IsCreatingCategory = false;\n public IsCreatingCategorySaving = false;\n public NewCategoryName = '';\n public CreateCategoryError = '';\n private newCategoryParentId: string | null = null;\n\n /** Tree config for query category hierarchy */\n public CategoryBranchConfig: TreeBranchConfig = {\n EntityName: 'MJ: Query Categories',\n DisplayField: 'Name',\n IDField: 'ID',\n ParentIDField: 'ParentID',\n DefaultIcon: 'fa-solid fa-folder',\n OrderBy: 'Name ASC'\n };\n\n constructor(private cdr: ChangeDetectorRef) {\n super();}\n\n public get CanSave(): boolean {\n return !!this.Name?.trim();\n }\n\n ngOnInit(): void {\n // Sync input values\n this.Name = this.QueryName;\n this.Description = this.QueryDescription;\n\n // Trigger slide-in on next microtask (ensures DOM is ready)\n Promise.resolve().then(() => {\n this.IsVisible = true;\n this.cdr.markForCheck();\n });\n }\n\n @HostListener('document:keydown.escape')\n public OnEscapeKey(): void {\n if (this.IsCreatingCategory) {\n this.CancelCreateCategory();\n } else if (!this.IsSaving) {\n this.OnCancel();\n }\n }\n\n // =========================================================================\n // Category Selection\n // =========================================================================\n\n public OnCategoryChanged(selection: TreeNode | TreeNode[] | null): void {\n if (!selection) {\n this.selectedCategoryId = null;\n } else if (Array.isArray(selection)) {\n this.selectedCategoryId = selection.length > 0 ? selection[0].ID : null;\n } else {\n this.selectedCategoryId = selection.ID;\n }\n }\n\n // =========================================================================\n // Inline Category Creation\n // =========================================================================\n\n public StartCreateCategory(): void {\n this.IsCreatingCategory = true;\n this.NewCategoryName = '';\n this.newCategoryParentId = null;\n this.CreateCategoryError = '';\n this.cdr.markForCheck();\n }\n\n public CancelCreateCategory(): void {\n this.IsCreatingCategory = false;\n this.NewCategoryName = '';\n this.newCategoryParentId = null;\n this.CreateCategoryError = '';\n this.cdr.markForCheck();\n }\n\n public OnNewCategoryParentChanged(selection: TreeNode | TreeNode[] | null): void {\n if (!selection) {\n this.newCategoryParentId = null;\n } else if (Array.isArray(selection)) {\n this.newCategoryParentId = selection.length > 0 ? selection[0].ID : null;\n } else {\n this.newCategoryParentId = selection.ID;\n }\n }\n\n public async CreateCategory(): Promise<void> {\n const name = this.NewCategoryName.trim();\n if (!name || this.IsCreatingCategorySaving) return;\n\n this.IsCreatingCategorySaving = true;\n this.CreateCategoryError = '';\n this.cdr.markForCheck();\n\n try {\n const md = this.ProviderToUse;\n const category = await md.GetEntityObject<MJQueryCategoryEntity>('MJ: Query Categories');\n\n category.Name = name;\n category.UserID = md.CurrentUser.ID;\n if (this.newCategoryParentId) {\n category.ParentID = this.newCategoryParentId;\n }\n\n const saved = await category.Save();\n if (saved) {\n MJNotificationService.Instance.CreateSimpleNotification(`Category \"${name}\" created`, 'success', 2500);\n\n // Refresh tree to pick up the new category\n await this.categoryTree.Refresh();\n\n // Auto-select the newly created category.\n // Must use detectChanges() (not markForCheck) to immediately propagate\n // the new Value input to the tree dropdown, since this panel uses OnPush.\n const newKey = new CompositeKey([new KeyValuePair('ID', category.ID)]);\n this.SelectedCategoryKey = newKey;\n this.selectedCategoryId = category.ID;\n this.cdr.detectChanges();\n\n // Collapse the create form\n this.IsCreatingCategory = false;\n this.NewCategoryName = '';\n this.newCategoryParentId = null;\n } else {\n const errorMsg = this.getEntityErrorMessage(category, 'create category');\n this.CreateCategoryError = errorMsg;\n MJNotificationService.Instance.CreateSimpleNotification(errorMsg, 'error', 5000);\n console.error('Failed to create category:', category.LatestResult);\n }\n } catch (error) {\n const errorMsg = error instanceof Error ? error.message : 'Failed to create category';\n this.CreateCategoryError = errorMsg;\n MJNotificationService.Instance.CreateSimpleNotification(errorMsg, 'error', 5000);\n console.error('Error creating category:', error);\n } finally {\n this.IsCreatingCategorySaving = false;\n this.cdr.markForCheck();\n }\n }\n\n // =========================================================================\n // Save / Cancel\n // =========================================================================\n\n public async OnSave(): Promise<void> {\n if (!this.CanSave || this.IsSaving) return;\n\n this.IsSaving = true;\n this.ErrorMessage = '';\n this.cdr.markForCheck();\n\n try {\n const md = this.ProviderToUse;\n const query = await md.GetEntityObject<MJQueryEntity>('MJ: Queries');\n\n query.Name = this.Name.trim();\n query.SQL = this.SQL;\n query.Status = 'Approved';\n\n if (this.Description?.trim()) {\n query.Description = this.Description.trim();\n }\n if (this.Plan?.trim()) {\n query.TechnicalDescription = this.Plan.trim();\n }\n if (this.selectedCategoryId) {\n query.CategoryID = this.selectedCategoryId;\n }\n\n const saved = await query.Save();\n if (saved) {\n MJNotificationService.Instance.CreateSimpleNotification(`Query \"${query.Name}\" saved`, 'success', 2500);\n\n // Animate out, then emit\n this.IsVisible = false;\n this.cdr.markForCheck();\n setTimeout(() => {\n this.Saved.emit({\n queryId: query.ID,\n queryName: query.Name\n });\n }, 300);\n } else {\n const errorMsg = this.getEntityErrorMessage(query, 'save query');\n this.ErrorMessage = errorMsg;\n MJNotificationService.Instance.CreateSimpleNotification(errorMsg, 'error', 5000);\n console.error('Failed to save query:', query.LatestResult);\n }\n } catch (error) {\n const errorMsg = error instanceof Error ? error.message : 'An unexpected error occurred';\n this.ErrorMessage = errorMsg;\n MJNotificationService.Instance.CreateSimpleNotification(errorMsg, 'error', 5000);\n console.error('Error saving query:', error);\n } finally {\n this.IsSaving = false;\n this.cdr.markForCheck();\n }\n }\n\n public OnCancel(): void {\n if (this.IsSaving) return;\n this.IsVisible = false;\n this.cdr.markForCheck();\n setTimeout(() => this.Cancelled.emit(), 300);\n }\n\n // =========================================================================\n // Helpers\n // =========================================================================\n\n private getEntityErrorMessage(entity: BaseEntity, operation: string): string {\n const result = entity.LatestResult;\n if (result?.Message) {\n return result.Message;\n }\n return `Failed to ${operation}. Please try again.`;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"save-query-dialog.component.js","sourceRoot":"","sources":["../../../../src/lib/components/plugins/save-query-dialog.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,uBAAuB,EAAqB,YAAY,EAAE,MAAM,eAAe,CAAC;AAC5I,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAY,YAAY,EAAE,YAAY,EAAc,MAAM,sBAAsB,CAAC;AAExF,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;;;;;;;IA2D3D,kCAAwF;IAA5D,4LAAS,4BAAqB,KAAC;IACzD,wBAAgC;IAAC,qBACnC;IAAA,iBAAS;;;IA6CH,wBAA2C;;;IAE3C,wBAAiC;;;IAWrC,+BAA8B;IAAA,YAAyB;IAAA,iBAAM;;;IAA/B,cAAyB;IAAzB,gDAAyB;;;;IAzCzD,AADF,+BA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YAAA,iBAAQ;YAC5C,qCAIW;YAFT,kQAAyB;YAG3B,2BAAA;YACF,AADE,iBAAW,EACP;YAEN,4FAAoB;YAMtB,iBAAM;YAIJ,AADF,gCAAwB,kBAGc;YADlC,qGAAS,YAAQ,IAAC;YAIhB,AAFF,iFAAgB,2DAEP;YAGX,iBAAS;YACT,mCAEwB;YADtB,qGAAS,cAAU,IAAC;YAEpB,yBACF;YAEJ,AADE,AADE,iBAAS,EACL,EACF;;YAzIoB,4CAA+B;YAGlC,cAA+B;YAA/B,4CAA+B;YAsB9C,gBAAkB;YAAlB,wCAAkB;YASlB,eAIC;YAJD,mDAIC;YAKD,cAAqC;YAIrC,AADA,AADA,AADA,AADA,uDAAqC,2BACX,6BACE,+CACkB,kCACjB;YAK/B,eA8CC;YA9CD,kDA8CC;YAQC,eAAyB;YAAzB,+CAAyB;YAM7B,eAKC;YALD,4CAKC;YAOC,eAAiC;YAAjC,uDAAiC;YACjC,cAIC;YAJD,wCAIC;YAID,eAAqB;YAArB,uCAAqB;;;iFA8TlB,uBAAuB;cAxcnC,SAAS;6BACI,KAAK,YACP,qBAAqB,YACrB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4IT,mBAuTgB,uBAAuB,CAAC,MAAM;;kBAG9C,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBAEL,MAAM;;kBACN,MAAM;;kBAEN,SAAS;mBAAC,cAAc;;kBAiDxB,YAAY;mBAAC,yBAAyB;;kFA1D5B,uBAAuB","sourcesContent":["import { Component, Input, Output, EventEmitter, ViewChild, ChangeDetectionStrategy, ChangeDetectorRef, HostListener } from '@angular/core';\nimport { BaseAngularComponent } from '@memberjunction/ng-base-types';\nimport { Metadata, CompositeKey, KeyValuePair, BaseEntity } from '@memberjunction/core';\nimport { MJQueryEntity, MJQueryCategoryEntity } from '@memberjunction/core-entities';\nimport { MJNotificationService } from '@memberjunction/ng-notifications';\nimport { TreeBranchConfig, TreeNode } from '@memberjunction/ng-trees';\nimport { TreeDropdownComponent } from '@memberjunction/ng-trees';\n\n/**\n * Result emitted when a query is successfully saved\n */\nexport interface SaveQueryResult {\n queryId: string;\n queryName: string;\n}\n\n/**\n * Slide-in panel for saving an ad-hoc SQL query as a reusable MJ Query record.\n * Pre-populates name from the artifact title and provides a tree dropdown\n * for selecting a query category, with inline category creation.\n *\n * Follows the CreateAgentSlideInComponent pattern for slide-in UX.\n */\n@Component({\n standalone: false,\n selector: 'mj-save-query-panel',\n template: `\n <!-- Backdrop -->\n <div class=\"sqp-backdrop\" [class.sqp-visible]=\"IsVisible\" (click)=\"OnCancel()\"></div>\n\n <!-- Slide panel -->\n <div class=\"sqp-panel\" [class.sqp-visible]=\"IsVisible\">\n <!-- Header -->\n <div class=\"sqp-header\">\n <div class=\"sqp-title-group\">\n <i class=\"fa-solid fa-save sqp-title-icon\"></i>\n <h2 class=\"sqp-title\">Save Query</h2>\n </div>\n <button class=\"sqp-close-btn\" (click)=\"OnCancel()\">\n <i class=\"fa-solid fa-xmark\"></i>\n </button>\n </div>\n\n <!-- Body -->\n <div class=\"sqp-body\">\n <!-- Name -->\n <div class=\"sqp-field\">\n <label class=\"sqp-label\">\n Name <span class=\"sqp-required\">*</span>\n </label>\n <input\n type=\"text\"\n class=\"sqp-input\"\n [(ngModel)]=\"Name\"\n placeholder=\"Query name\"\n (keydown.enter)=\"OnSave()\">\n </div>\n\n <!-- Category -->\n <div class=\"sqp-field\">\n <div class=\"sqp-label-row\">\n <label class=\"sqp-label\">Category</label>\n @if (!IsCreatingCategory) {\n <button class=\"sqp-add-btn\" (click)=\"StartCreateCategory()\" title=\"Create new category\">\n <i class=\"fa-solid fa-plus\"></i> New\n </button>\n }\n </div>\n\n <mj-tree-dropdown\n #categoryTree\n [BranchConfig]=\"CategoryBranchConfig\"\n [SelectionMode]=\"'single'\"\n [SelectableTypes]=\"'branch'\"\n [Placeholder]=\"'Select a category (optional)'\"\n [Value]=\"SelectedCategoryKey\"\n (SelectionChange)=\"OnCategoryChanged($event)\">\n </mj-tree-dropdown>\n\n <!-- Inline create category form -->\n @if (IsCreatingCategory) {\n <div class=\"sqp-create-category\">\n <div class=\"sqp-create-header\">\n <i class=\"fa-solid fa-folder-plus\"></i>\n <span>New Category</span>\n </div>\n <div class=\"sqp-create-fields\">\n <input\n type=\"text\"\n class=\"sqp-input\"\n [(ngModel)]=\"NewCategoryName\"\n placeholder=\"Category name\"\n (keydown.enter)=\"CreateCategory()\"\n (keydown.escape)=\"CancelCreateCategory()\">\n <div class=\"sqp-create-parent\">\n <label class=\"sqp-sublabel\">Parent (optional)</label>\n <mj-tree-dropdown\n [BranchConfig]=\"CategoryBranchConfig\"\n [SelectionMode]=\"'single'\"\n [SelectableTypes]=\"'branch'\"\n [Placeholder]=\"'None (top level)'\"\n (SelectionChange)=\"OnNewCategoryParentChanged($event)\">\n </mj-tree-dropdown>\n </div>\n </div>\n <div class=\"sqp-create-actions\">\n <button class=\"sqp-btn sqp-btn-create\"\n (click)=\"CreateCategory()\"\n [disabled]=\"!NewCategoryName.trim() || IsCreatingCategorySaving\">\n @if (IsCreatingCategorySaving) {\n <i class=\"fa-solid fa-spinner fa-spin\"></i>\n } @else {\n <i class=\"fa-solid fa-check\"></i>\n }\n {{ IsCreatingCategorySaving ? 'Creating...' : 'Create' }}\n </button>\n <button class=\"sqp-btn sqp-btn-cancel-create\"\n (click)=\"CancelCreateCategory()\"\n [disabled]=\"IsCreatingCategorySaving\">\n Cancel\n </button>\n </div>\n @if (CreateCategoryError) {\n <div class=\"sqp-inline-error\">{{ CreateCategoryError }}</div>\n }\n </div>\n }\n </div>\n\n <!-- Description -->\n <div class=\"sqp-field\">\n <label class=\"sqp-label\">Description</label>\n <textarea\n class=\"sqp-textarea\"\n [(ngModel)]=\"Description\"\n placeholder=\"Optional description\"\n rows=\"3\">\n </textarea>\n </div>\n\n @if (ErrorMessage) {\n <div class=\"sqp-error\">\n <i class=\"fa-solid fa-exclamation-circle\"></i>\n {{ ErrorMessage }}\n </div>\n }\n </div>\n\n <!-- Footer -->\n <div class=\"sqp-footer\">\n <button class=\"sqp-btn sqp-btn-save\"\n (click)=\"OnSave()\"\n [disabled]=\"!CanSave || IsSaving\">\n @if (IsSaving) {\n <i class=\"fa-solid fa-spinner fa-spin\"></i> Saving...\n } @else {\n <i class=\"fa-solid fa-save\"></i> Save Query\n }\n </button>\n <button class=\"sqp-btn sqp-btn-cancel\"\n (click)=\"OnCancel()\"\n [disabled]=\"IsSaving\">\n Cancel\n </button>\n </div>\n </div>\n `,\n styles: [`\n /* Backdrop */\n .sqp-backdrop {\n position: fixed;\n inset: 0;\n background: rgba(0, 0, 0, 0);\n z-index: 1000;\n transition: background 0.3s ease;\n pointer-events: none;\n }\n .sqp-backdrop.sqp-visible {\n background: var(--mj-bg-overlay, rgba(0, 0, 0, 0.3));\n pointer-events: auto;\n }\n\n /* Panel — uses right offset instead of transform to avoid creating\n a new containing block that breaks position:fixed children\n (e.g., the tree-dropdown popup). */\n .sqp-panel {\n position: fixed;\n top: 0;\n right: -440px;\n height: 100vh;\n width: 440px;\n background: var(--mj-bg-surface);\n box-shadow: -8px 0 32px rgba(0, 0, 0, 0.12);\n z-index: 1001;\n display: flex;\n flex-direction: column;\n transition: right 0.3s cubic-bezier(0.16, 1, 0.3, 1);\n }\n .sqp-panel.sqp-visible {\n right: 0;\n }\n\n /* Header */\n .sqp-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 20px 24px 16px;\n border-bottom: 1px solid var(--mj-border-default);\n flex-shrink: 0;\n }\n .sqp-title-group {\n display: flex;\n align-items: center;\n gap: 10px;\n }\n .sqp-title-icon {\n font-size: 20px;\n color: var(--mj-brand-primary);\n }\n .sqp-title {\n margin: 0;\n font-size: 18px;\n font-weight: 700;\n color: var(--mj-text-primary);\n }\n .sqp-close-btn {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 36px;\n height: 36px;\n background: none;\n border: none;\n border-radius: 8px;\n color: var(--mj-text-secondary);\n cursor: pointer;\n transition: all 0.15s ease;\n font-size: 16px;\n flex-shrink: 0;\n }\n .sqp-close-btn:hover {\n background: var(--mj-bg-surface-hover);\n color: var(--mj-text-primary);\n }\n\n /* Body */\n .sqp-body {\n flex: 1;\n overflow-y: auto;\n padding: 24px;\n }\n\n /* Fields */\n .sqp-field {\n margin-bottom: 20px;\n }\n .sqp-label-row {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin-bottom: 6px;\n }\n .sqp-label {\n display: block;\n margin-bottom: 6px;\n font-weight: 600;\n font-size: 13px;\n color: var(--mj-text-primary);\n }\n .sqp-label-row .sqp-label {\n margin-bottom: 0;\n }\n .sqp-sublabel {\n display: block;\n margin-bottom: 4px;\n font-weight: 500;\n font-size: 12px;\n color: var(--mj-text-secondary);\n }\n .sqp-required {\n color: var(--mj-status-error);\n }\n .sqp-input {\n width: 100%;\n padding: 10px 12px;\n border: 1px solid var(--mj-border-default);\n border-radius: 6px;\n font-size: 14px;\n color: var(--mj-text-primary);\n background: var(--mj-bg-surface);\n transition: border-color 0.15s ease, box-shadow 0.15s ease;\n box-sizing: border-box;\n }\n .sqp-input:focus {\n outline: none;\n border-color: var(--mj-border-focus);\n box-shadow: 0 0 0 3px color-mix(in srgb, var(--mj-brand-primary) 15%, transparent);\n }\n .sqp-input::placeholder {\n color: var(--mj-text-disabled);\n }\n .sqp-textarea {\n width: 100%;\n padding: 10px 12px;\n border: 1px solid var(--mj-border-default);\n border-radius: 6px;\n font-size: 14px;\n color: var(--mj-text-primary);\n background: var(--mj-bg-surface);\n resize: vertical;\n font-family: inherit;\n transition: border-color 0.15s ease, box-shadow 0.15s ease;\n box-sizing: border-box;\n }\n .sqp-textarea:focus {\n outline: none;\n border-color: var(--mj-border-focus);\n box-shadow: 0 0 0 3px color-mix(in srgb, var(--mj-brand-primary) 15%, transparent);\n }\n .sqp-textarea::placeholder {\n color: var(--mj-text-disabled);\n }\n\n /* Add category button */\n .sqp-add-btn {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n padding: 3px 10px;\n background: none;\n border: 1px solid var(--mj-border-default);\n border-radius: 4px;\n font-size: 12px;\n color: var(--mj-brand-primary);\n cursor: pointer;\n transition: all 0.15s ease;\n }\n .sqp-add-btn:hover {\n background: color-mix(in srgb, var(--mj-brand-primary) 10%, var(--mj-bg-surface));\n border-color: var(--mj-brand-primary);\n }\n\n /* Inline create category */\n .sqp-create-category {\n margin-top: 12px;\n padding: 14px;\n background: var(--mj-bg-surface-card);\n border: 1px solid var(--mj-border-default);\n border-radius: 8px;\n }\n .sqp-create-header {\n display: flex;\n align-items: center;\n gap: 6px;\n font-size: 13px;\n font-weight: 600;\n color: var(--mj-text-secondary);\n margin-bottom: 10px;\n }\n .sqp-create-header i {\n color: var(--mj-brand-primary);\n }\n .sqp-create-fields {\n display: flex;\n flex-direction: column;\n gap: 10px;\n }\n .sqp-create-parent {\n margin-top: 2px;\n }\n .sqp-create-actions {\n display: flex;\n gap: 8px;\n margin-top: 12px;\n }\n .sqp-inline-error {\n margin-top: 8px;\n font-size: 12px;\n color: var(--mj-status-error-text);\n }\n\n /* Buttons */\n .sqp-btn {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n padding: 8px 16px;\n border: none;\n border-radius: 6px;\n font-size: 13px;\n font-weight: 500;\n cursor: pointer;\n transition: all 0.15s ease;\n }\n .sqp-btn:disabled {\n opacity: 0.6;\n cursor: not-allowed;\n }\n .sqp-btn-save {\n background: var(--mj-brand-primary);\n color: var(--mj-text-inverse);\n padding: 10px 20px;\n font-size: 14px;\n }\n .sqp-btn-save:hover:not(:disabled) {\n background: var(--mj-brand-primary-hover);\n }\n .sqp-btn-cancel {\n background: none;\n border: 1px solid var(--mj-border-default);\n color: var(--mj-text-secondary);\n padding: 10px 20px;\n font-size: 14px;\n }\n .sqp-btn-cancel:hover:not(:disabled) {\n background: var(--mj-bg-surface-hover);\n color: var(--mj-text-primary);\n }\n .sqp-btn-create {\n background: var(--mj-status-success);\n color: var(--mj-text-inverse);\n }\n .sqp-btn-create:hover:not(:disabled) {\n background: color-mix(in srgb, var(--mj-status-success) 85%, black);\n }\n .sqp-btn-cancel-create {\n background: none;\n color: var(--mj-text-secondary);\n }\n .sqp-btn-cancel-create:hover:not(:disabled) {\n color: var(--mj-text-primary);\n background: var(--mj-bg-surface-sunken);\n }\n\n /* Footer */\n .sqp-footer {\n display: flex;\n gap: 10px;\n padding: 16px 24px;\n border-top: 1px solid var(--mj-border-default);\n flex-shrink: 0;\n }\n\n /* Error */\n .sqp-error {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 10px 14px;\n background: var(--mj-status-error-bg);\n border: 1px solid var(--mj-status-error-border);\n border-radius: 6px;\n color: var(--mj-status-error-text);\n font-size: 13px;\n }\n\n /* Responsive */\n @media (max-width: 768px) {\n .sqp-panel {\n width: 100% !important;\n right: -100%;\n }\n .sqp-panel.sqp-visible {\n right: 0;\n }\n .sqp-header {\n padding: 16px 20px 12px;\n }\n .sqp-body {\n padding: 16px;\n }\n .sqp-footer {\n padding: 12px 16px;\n }\n }\n `],\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class SaveQueryPanelComponent extends BaseAngularComponent {\n @Input() QueryName = '';\n @Input() QueryDescription = '';\n @Input() SQL = '';\n @Input() Plan = '';\n\n @Output() Saved = new EventEmitter<SaveQueryResult>();\n @Output() Cancelled = new EventEmitter<void>();\n\n @ViewChild('categoryTree') categoryTree!: TreeDropdownComponent;\n\n // Form state\n public Name = '';\n public Description = '';\n public IsSaving = false;\n public ErrorMessage = '';\n public IsVisible = false;\n\n // Category selection\n private selectedCategoryId: string | null = null;\n public SelectedCategoryKey: CompositeKey | null = null;\n\n // Inline category creation\n public IsCreatingCategory = false;\n public IsCreatingCategorySaving = false;\n public NewCategoryName = '';\n public CreateCategoryError = '';\n private newCategoryParentId: string | null = null;\n\n /** Tree config for query category hierarchy */\n public CategoryBranchConfig: TreeBranchConfig = {\n EntityName: 'MJ: Query Categories',\n DisplayField: 'Name',\n IDField: 'ID',\n ParentIDField: 'ParentID',\n DefaultIcon: 'fa-solid fa-folder',\n OrderBy: 'Name ASC'\n };\n\n constructor(private cdr: ChangeDetectorRef) {\n super();}\n\n public get CanSave(): boolean {\n return !!this.Name?.trim();\n }\n\n ngOnInit(): void {\n // Sync input values\n this.Name = this.QueryName;\n this.Description = this.QueryDescription;\n\n // Trigger slide-in on next microtask (ensures DOM is ready)\n Promise.resolve().then(() => {\n this.IsVisible = true;\n this.cdr.markForCheck();\n });\n }\n\n @HostListener('document:keydown.escape')\n public OnEscapeKey(): void {\n if (this.IsCreatingCategory) {\n this.CancelCreateCategory();\n } else if (!this.IsSaving) {\n this.OnCancel();\n }\n }\n\n // =========================================================================\n // Category Selection\n // =========================================================================\n\n public OnCategoryChanged(selection: TreeNode | TreeNode[] | null): void {\n if (!selection) {\n this.selectedCategoryId = null;\n } else if (Array.isArray(selection)) {\n this.selectedCategoryId = selection.length > 0 ? selection[0].ID : null;\n } else {\n this.selectedCategoryId = selection.ID;\n }\n }\n\n // =========================================================================\n // Inline Category Creation\n // =========================================================================\n\n public StartCreateCategory(): void {\n this.IsCreatingCategory = true;\n this.NewCategoryName = '';\n this.newCategoryParentId = null;\n this.CreateCategoryError = '';\n this.cdr.markForCheck();\n }\n\n public CancelCreateCategory(): void {\n this.IsCreatingCategory = false;\n this.NewCategoryName = '';\n this.newCategoryParentId = null;\n this.CreateCategoryError = '';\n this.cdr.markForCheck();\n }\n\n public OnNewCategoryParentChanged(selection: TreeNode | TreeNode[] | null): void {\n if (!selection) {\n this.newCategoryParentId = null;\n } else if (Array.isArray(selection)) {\n this.newCategoryParentId = selection.length > 0 ? selection[0].ID : null;\n } else {\n this.newCategoryParentId = selection.ID;\n }\n }\n\n public async CreateCategory(): Promise<void> {\n const name = this.NewCategoryName.trim();\n if (!name || this.IsCreatingCategorySaving) return;\n\n this.IsCreatingCategorySaving = true;\n this.CreateCategoryError = '';\n this.cdr.markForCheck();\n\n try {\n const md = this.ProviderToUse;\n const category = await md.GetEntityObject<MJQueryCategoryEntity>('MJ: Query Categories');\n\n category.Name = name;\n category.UserID = md.CurrentUser.ID;\n if (this.newCategoryParentId) {\n category.ParentID = this.newCategoryParentId;\n }\n\n const saved = await category.Save();\n if (saved) {\n MJNotificationService.Instance.CreateSimpleNotification(`Category \"${name}\" created`, 'success', 2500);\n\n // Refresh tree to pick up the new category\n await this.categoryTree.Refresh();\n\n // Auto-select the newly created category.\n // Must use detectChanges() (not markForCheck) to immediately propagate\n // the new Value input to the tree dropdown, since this panel uses OnPush.\n const newKey = new CompositeKey([new KeyValuePair('ID', category.ID)]);\n this.SelectedCategoryKey = newKey;\n this.selectedCategoryId = category.ID;\n this.cdr.detectChanges();\n\n // Collapse the create form\n this.IsCreatingCategory = false;\n this.NewCategoryName = '';\n this.newCategoryParentId = null;\n } else {\n const errorMsg = this.getEntityErrorMessage(category, 'create category');\n this.CreateCategoryError = errorMsg;\n MJNotificationService.Instance.CreateSimpleNotification(errorMsg, 'error', 5000);\n console.error('Failed to create category:', category.LatestResult);\n }\n } catch (error) {\n const errorMsg = error instanceof Error ? error.message : 'Failed to create category';\n this.CreateCategoryError = errorMsg;\n MJNotificationService.Instance.CreateSimpleNotification(errorMsg, 'error', 5000);\n console.error('Error creating category:', error);\n } finally {\n this.IsCreatingCategorySaving = false;\n this.cdr.markForCheck();\n }\n }\n\n // =========================================================================\n // Save / Cancel\n // =========================================================================\n\n public async OnSave(): Promise<void> {\n if (!this.CanSave || this.IsSaving) return;\n\n this.IsSaving = true;\n this.ErrorMessage = '';\n this.cdr.markForCheck();\n\n try {\n const md = this.ProviderToUse;\n const query = await md.GetEntityObject<MJQueryEntity>('MJ: Queries');\n\n query.Name = this.Name.trim();\n query.SQL = this.SQL;\n query.Status = 'Approved';\n\n if (this.Description?.trim()) {\n query.Description = this.Description.trim();\n }\n if (this.Plan?.trim()) {\n query.TechnicalDescription = this.Plan.trim();\n }\n if (this.selectedCategoryId) {\n query.CategoryID = this.selectedCategoryId;\n }\n\n const saved = await query.Save();\n if (saved) {\n MJNotificationService.Instance.CreateSimpleNotification(`Query \"${query.Name}\" saved`, 'success', 2500);\n\n // Animate out, then emit\n this.IsVisible = false;\n this.cdr.markForCheck();\n setTimeout(() => {\n this.Saved.emit({\n queryId: query.ID,\n queryName: query.Name\n });\n }, 300);\n } else {\n const errorMsg = this.getEntityErrorMessage(query, 'save query');\n this.ErrorMessage = errorMsg;\n MJNotificationService.Instance.CreateSimpleNotification(errorMsg, 'error', 5000);\n console.error('Failed to save query:', query.LatestResult);\n }\n } catch (error) {\n const errorMsg = error instanceof Error ? error.message : 'An unexpected error occurred';\n this.ErrorMessage = errorMsg;\n MJNotificationService.Instance.CreateSimpleNotification(errorMsg, 'error', 5000);\n console.error('Error saving query:', error);\n } finally {\n this.IsSaving = false;\n this.cdr.markForCheck();\n }\n }\n\n public OnCancel(): void {\n if (this.IsSaving) return;\n this.IsVisible = false;\n this.cdr.markForCheck();\n setTimeout(() => this.Cancelled.emit(), 300);\n }\n\n // =========================================================================\n // Helpers\n // =========================================================================\n\n private getEntityErrorMessage(entity: BaseEntity, operation: string): string {\n const result = entity.LatestResult;\n if (result?.Message) {\n return result.Message;\n }\n return `Failed to ${operation}. Please try again.`;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audio-artifact-preview.component.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/previews/audio-artifact-preview.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwC,MAAM,EAAE,MAAM,eAAe,CAAC;AAC7E,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC;;AAEjF;;;;;;;;GAQG;AACH,
|
|
1
|
+
{"version":3,"file":"audio-artifact-preview.component.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/previews/audio-artifact-preview.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwC,MAAM,EAAE,MAAM,eAAe,CAAC;AAC7E,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC;;AAEjF;;;;;;;;GAQG;AACH,qBAkDa,6BAA8B,SAAQ,4BAA6B,YAAW,MAAM;IAC7F,OAAO,CAAC,QAAQ,CAAC,GAAG,CAA6B;IAEjD,qGAAqG;IAC9F,QAAQ,SAAM;IAGrB,iEAAiE;IAC1D,YAAY,SAAM;IAEzB;;;OAGG;IACI,WAAW,EAAE,UAAU,EAAE,CAAM;IAEtC,mGAAmG;IACnG,OAAO,CAAC,WAAW;IAcb,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAcxB,YAAY,IAAI,IAAI;IAM3B,yFAAyF;IAClF,YAAY,IAAI,IAAI;yCApDlB,6BAA6B;2CAA7B,6BAA6B;CAuDzC"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { ChangeDetectorRef, Component, inject } from '@angular/core';
|
|
2
2
|
import { BaseArtifactPreviewComponent } from './base-artifact-preview.component';
|
|
3
3
|
import * as i0 from "@angular/core";
|
|
4
|
-
import * as i1 from "@memberjunction/ng-
|
|
4
|
+
import * as i1 from "@memberjunction/ng-shared-generic";
|
|
5
|
+
import * as i2 from "@memberjunction/ng-media-player";
|
|
5
6
|
function AudioArtifactPreviewComponent_Conditional_0_Template(rf, ctx) { if (rf & 1) {
|
|
6
7
|
i0.ɵɵelementStart(0, "div", 0);
|
|
7
|
-
i0.ɵɵelement(1, "i",
|
|
8
|
+
i0.ɵɵelement(1, "i", 3);
|
|
8
9
|
i0.ɵɵelementStart(2, "span");
|
|
9
10
|
i0.ɵɵtext(3);
|
|
10
11
|
i0.ɵɵelementEnd()();
|
|
@@ -14,9 +15,12 @@ function AudioArtifactPreviewComponent_Conditional_0_Template(rf, ctx) { if (rf
|
|
|
14
15
|
i0.ɵɵtextInterpolate(ctx_r0.errorMessage);
|
|
15
16
|
} }
|
|
16
17
|
function AudioArtifactPreviewComponent_Conditional_1_Template(rf, ctx) { if (rf & 1) {
|
|
18
|
+
i0.ɵɵelement(0, "mj-loading", 1);
|
|
19
|
+
} }
|
|
20
|
+
function AudioArtifactPreviewComponent_Conditional_2_Template(rf, ctx) { if (rf & 1) {
|
|
17
21
|
const _r2 = i0.ɵɵgetCurrentView();
|
|
18
|
-
i0.ɵɵelementStart(0, "mj-media-player",
|
|
19
|
-
i0.ɵɵlistener("click", function
|
|
22
|
+
i0.ɵɵelementStart(0, "mj-media-player", 4);
|
|
23
|
+
i0.ɵɵlistener("click", function AudioArtifactPreviewComponent_Conditional_2_Template_mj_media_player_click_0_listener($event) { return $event.stopPropagation(); })("Ended", function AudioArtifactPreviewComponent_Conditional_2_Template_mj_media_player_Ended_0_listener() { i0.ɵɵrestoreView(_r2); const ctx_r0 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r0.onMediaEnded()); });
|
|
20
24
|
i0.ɵɵelementEnd();
|
|
21
25
|
} if (rf & 2) {
|
|
22
26
|
const ctx_r0 = i0.ɵɵnextContext();
|
|
@@ -81,11 +85,11 @@ export class AudioArtifactPreviewComponent extends BaseArtifactPreviewComponent
|
|
|
81
85
|
// Playback finished — nothing to persist for an inline preview.
|
|
82
86
|
}
|
|
83
87
|
static ɵfac = /*@__PURE__*/ (() => { let ɵAudioArtifactPreviewComponent_BaseFactory; return function AudioArtifactPreviewComponent_Factory(__ngFactoryType__) { return (ɵAudioArtifactPreviewComponent_BaseFactory || (ɵAudioArtifactPreviewComponent_BaseFactory = i0.ɵɵgetInheritedFactory(AudioArtifactPreviewComponent)))(__ngFactoryType__ || AudioArtifactPreviewComponent); }; })();
|
|
84
|
-
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: AudioArtifactPreviewComponent, selectors: [["mj-audio-artifact-preview"]], standalone: false, features: [i0.ɵɵInheritDefinitionFeature], decls:
|
|
85
|
-
i0.ɵɵconditionalCreate(0, AudioArtifactPreviewComponent_Conditional_0_Template, 4, 1, "div", 0)(1, AudioArtifactPreviewComponent_Conditional_1_Template, 1, 8, "mj-media-player",
|
|
88
|
+
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: AudioArtifactPreviewComponent, selectors: [["mj-audio-artifact-preview"]], standalone: false, features: [i0.ɵɵInheritDefinitionFeature], decls: 3, vars: 1, consts: [[1, "audio-preview", "audio-preview--error"], ["text", "Loading audio...", "size", "small"], [1, "audio-preview__player", 3, "Tracks", "ShowTranscript", "ShowTranscriptToggle", "ShowWaveform", "ShowSpeedControl", "ShowSkipControls", "ShowVolume", "ShowFullscreen"], [1, "fa-solid", "fa-music"], [1, "audio-preview__player", 3, "click", "Ended", "Tracks", "ShowTranscript", "ShowTranscriptToggle", "ShowWaveform", "ShowSpeedControl", "ShowSkipControls", "ShowVolume", "ShowFullscreen"]], template: function AudioArtifactPreviewComponent_Template(rf, ctx) { if (rf & 1) {
|
|
89
|
+
i0.ɵɵconditionalCreate(0, AudioArtifactPreviewComponent_Conditional_0_Template, 4, 1, "div", 0)(1, AudioArtifactPreviewComponent_Conditional_1_Template, 1, 0, "mj-loading", 1)(2, AudioArtifactPreviewComponent_Conditional_2_Template, 1, 8, "mj-media-player", 2);
|
|
86
90
|
} if (rf & 2) {
|
|
87
|
-
i0.ɵɵconditional(ctx.errorMessage ? 0 : ctx.
|
|
88
|
-
} }, dependencies: [i1.MJMediaPlayerComponent], styles: ["[_nghost-%COMP%] {\n display: block;\n }\n\n .audio-preview__player[_ngcontent-%COMP%] {\n display: block;\n width: 100%;\n max-width: 100%;\n }\n\n .audio-preview--error[_ngcontent-%COMP%] {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 12px 16px;\n color: var(--mj-text-muted);\n font-size: 13px;\n }"] });
|
|
91
|
+
i0.ɵɵconditional(ctx.errorMessage ? 0 : ctx.isLoading ? 1 : ctx.audioUrl ? 2 : -1);
|
|
92
|
+
} }, dependencies: [i1.LoadingComponent, i2.MJMediaPlayerComponent], styles: ["[_nghost-%COMP%] {\n display: block;\n }\n\n .audio-preview__player[_ngcontent-%COMP%] {\n display: block;\n width: 100%;\n max-width: 100%;\n }\n\n .audio-preview--error[_ngcontent-%COMP%] {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 12px 16px;\n color: var(--mj-text-muted);\n font-size: 13px;\n }"] });
|
|
89
93
|
}
|
|
90
94
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AudioArtifactPreviewComponent, [{
|
|
91
95
|
type: Component,
|
|
@@ -95,6 +99,8 @@ export class AudioArtifactPreviewComponent extends BaseArtifactPreviewComponent
|
|
|
95
99
|
<i class="fa-solid fa-music"></i>
|
|
96
100
|
<span>{{ errorMessage }}</span>
|
|
97
101
|
</div>
|
|
102
|
+
} @else if (isLoading) {
|
|
103
|
+
<mj-loading text="Loading audio..." size="small"></mj-loading>
|
|
98
104
|
} @else if (audioUrl) {
|
|
99
105
|
<mj-media-player
|
|
100
106
|
class="audio-preview__player"
|
|
@@ -112,5 +118,5 @@ export class AudioArtifactPreviewComponent extends BaseArtifactPreviewComponent
|
|
|
112
118
|
}
|
|
113
119
|
`, styles: ["\n :host {\n display: block;\n }\n\n .audio-preview__player {\n display: block;\n width: 100%;\n max-width: 100%;\n }\n\n .audio-preview--error {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 12px 16px;\n color: var(--mj-text-muted);\n font-size: 13px;\n }\n "] }]
|
|
114
120
|
}], null, null); })();
|
|
115
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(AudioArtifactPreviewComponent, { className: "AudioArtifactPreviewComponent", filePath: "src/lib/components/previews/audio-artifact-preview.component.ts", lineNumber:
|
|
121
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(AudioArtifactPreviewComponent, { className: "AudioArtifactPreviewComponent", filePath: "src/lib/components/previews/audio-artifact-preview.component.ts", lineNumber: 64 }); })();
|
|
116
122
|
//# sourceMappingURL=audio-artifact-preview.component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audio-artifact-preview.component.js","sourceRoot":"","sources":["../../../../src/lib/components/previews/audio-artifact-preview.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,EAAU,MAAM,eAAe,CAAC;AAE7E,OAAO,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC
|
|
1
|
+
{"version":3,"file":"audio-artifact-preview.component.js","sourceRoot":"","sources":["../../../../src/lib/components/previews/audio-artifact-preview.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,EAAU,MAAM,eAAe,CAAC;AAE7E,OAAO,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC;;;;;IAgBrE,8BAAgD;IAC5C,uBAAiC;IACjC,4BAAM;IAAA,YAAkB;IAC5B,AAD4B,iBAAO,EAC7B;;;IADI,eAAkB;IAAlB,yCAAkB;;;IAG5B,gCAA8D;;;;IAE9D,0CAYC;IADG,AADA,uIAAS,wBAAwB,IAAC,6LACzB,qBAAc,KAAC;IAC3B,iBAAkB;;;IAHf,AADA,AADA,AADA,AADA,AADA,AADA,AADA,2CAAsB,yBACE,+BACM,uBACR,2BACI,2BACA,qBACN,yBACI;;AA9BxC;;;;;;;;GAQG;AAmDH,MAAM,OAAO,6BAA8B,SAAQ,4BAA4B;IAC1D,GAAG,GAAG,MAAM,CAAC,iBAAiB,CAAC,CAAC;IAEjD,qGAAqG;IAC9F,QAAQ,GAAG,EAAE,CAAC;IAGrB,iEAAiE;IAC1D,YAAY,GAAG,EAAE,CAAC;IAEzB;;;OAGG;IACI,WAAW,GAAiB,EAAE,CAAC;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":["import { ChangeDetectorRef, Component, inject, OnInit } from '@angular/core';\nimport { MediaTrack } from '@memberjunction/ng-media-player';\nimport { BaseArtifactPreviewComponent } from './base-artifact-preview.component';\n\n/**\n * Inline preview for audio artifacts. Embeds the generic {@link MJMediaPlayerComponent}\n * (`mj-media-player`) in a compact, thumbnail-sized configuration inside the conversation message\n * card. Click events are stopped from propagating so using the transport controls does NOT open\n * the full-size viewer.\n *\n * Compact gating: only play/pause + scrubber + time are shown. Transcript, waveform, speed,\n * skip, volume and fullscreen chrome are turned OFF so the player reads cleanly at preview size.\n */\n@Component({\n standalone: false,\n selector: 'mj-audio-artifact-preview',\n template: `\n @if (errorMessage) {\n <div class=\"audio-preview audio-preview--error\">\n <i class=\"fa-solid fa-music\"></i>\n <span>{{ errorMessage }}</span>\n </div>\n } @else if (isLoading) {\n <mj-loading text=\"Loading audio...\" size=\"small\"></mj-loading>\n } @else if (audioUrl) {\n <mj-media-player\n class=\"audio-preview__player\"\n [Tracks]=\"MediaTracks\"\n [ShowTranscript]=\"false\"\n [ShowTranscriptToggle]=\"false\"\n [ShowWaveform]=\"false\"\n [ShowSpeedControl]=\"false\"\n [ShowSkipControls]=\"false\"\n [ShowVolume]=\"false\"\n [ShowFullscreen]=\"false\"\n (click)=\"$event.stopPropagation()\"\n (Ended)=\"onMediaEnded()\"\n ></mj-media-player>\n }\n `,\n styles: [\n `\n :host {\n display: block;\n }\n\n .audio-preview__player {\n display: block;\n width: 100%;\n max-width: 100%;\n }\n\n .audio-preview--error {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 12px 16px;\n color: var(--mj-text-muted);\n font-size: 13px;\n }\n `,\n ],\n})\nexport class AudioArtifactPreviewComponent extends BaseArtifactPreviewComponent implements OnInit {\n private readonly cdr = inject(ChangeDetectorRef);\n\n /** Resolved URL — data URI (inline) or pre-auth URL (file). Funneled through {@link setAudioUrl}. */\n public audioUrl = '';\n\n\n /** Non-empty hides the player and shows a compact error line. */\n public errorMessage = '';\n\n /**\n * Single-track input for the generic {@link MJMediaPlayerComponent}. Rebuilt in lockstep with\n * {@link audioUrl} via {@link setAudioUrl}; `[]` until a URL exists so the player shows its empty state.\n */\n public MediaTracks: MediaTrack[] = [];\n\n /** Set the resolved URL and recompute the single-element {@link MediaTracks} array in lockstep. */\n private setAudioUrl(url: string): void {\n this.audioUrl = url;\n this.MediaTracks = url\n ? [\n {\n Id: this.artifactVersion?.ID ?? 'audio',\n Kind: 'audio',\n Url: url,\n MimeType: this.artifactVersion?.MimeType ?? undefined,\n },\n ]\n : [];\n }\n\n async ngOnInit(): Promise<void> {\n try {\n const url = await this.resolveContentUrl();\n if (url) {\n this.setAudioUrl(url);\n } else {\n this.errorMessage = 'No audio content.';\n }\n } catch {\n this.errorMessage = 'Could not load audio.';\n }\n this.cdr.markForCheck();\n }\n\n public onMediaError(): void {\n this.errorMessage = 'Audio could not be played.';\n this.setAudioUrl('');\n this.cdr.markForCheck();\n }\n\n /** Fired when the generic player reaches the end of the track. No-op affordance hook. */\n public onMediaEnded(): void {\n // Playback finished — nothing to persist for an inline preview.\n }\n}\n"]}
|