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AAW,kBACf,GAAIH,EAAoB,CACvB,MAAMI,EAAQJ,EAAmBI,MAAM,qBACnCA,GAASA,EAAM,KAAMD,EAAWC,EAAM,G,CAE5C,CAEA,yCAAMC,CAAoCpC,EAA2BC,G,MAC9D,IAAIoC,EAAc9G,KAAKZ,WAAW8B,UAC9B6F,EAAqB/G,KAAKb,UAAU6H,QAAQF,GAG5CG,QAAoDF,EAAIL,IAAI,2CAA2CjC,EAAIzF,MAAMkI,aAErH,IAAKD,EAAW,OAAOjH,KAAK6E,wBAAwBJ,GACpD,KAAKwC,aAAO,EAAPA,EAASlD,UAAY,OAAO/D,KAAKmH,oBAAoB1C,EAAKwC,GAI/D,GAFAxC,EAAIV,UAAW,EACK,QAApB,EAAA/D,KAAKI,uBAAe,SAAE4D,wBAAuB,GACzChE,KAAKI,gBACL,KAAM,0DAId,CACH,uBAAAyE,CAAwB/D,G,MACvBA,EAASiD,UAAW,EACA,QAApB,EAAA/D,KAAKI,uBAAe,SAAE4D,wBAAuB,GAC7ChE,KAAKT,MAAM6D,YAAY,aAAc,4BAA2B,EACjE,CACA,mBAAA+D,CAAoBrG,EAAgCsG,G,MACnDtG,EAASiD,UAAW,EACA,QAApB,EAAA/D,KAAKI,uBAAe,SAAE4D,wBAAuB,GAC7ChE,KAAKT,MAAM6D,YAAY,oBAAqB,yBAAyBgE,EAAOC,iCAE7E,CAEG,eAAAC,CAAgBrE,EAAcsE,GAC1B,IAAIC,EAAiB,GACrBA,EAAQ1I,KAAK,CAAE2I,QAAS,OAAQC,MAAO,CAAEC,QAASJ,KAClDvH,KAAKP,mBAAmBmI,KAAK3E,EAAOuE,EACxC,GApPSvI,E,mUAAS,EADrB,EAAA4I,W,kIAYiC,IAA6B,IAChC,KAAwBC,QAAuB,IACtD,IACmB,IACf,OAff7I,E","sources":["webpack://client-app/./src/app/project/model-revision/revision/revisions.scss","webpack://client-app/./src/app/project/model-revision/revision/revisions.html","webpack://client-app/./src/app/project/model-revision/revision/revisions.ts"],"sourcesContent":["// Imports\nimport ___CSS_LOADER_API_SOURCEMAP_IMPORT___ from \"../../../../../node_modules/css-loader/dist/runtime/sourceMaps.js\";\nimport ___CSS_LOADER_API_IMPORT___ from \"../../../../../node_modules/css-loader/dist/runtime/api.js\";\nvar ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_SOURCEMAP_IMPORT___);\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, `.revision-content-block{display:block}.add-new-version{position:relative;display:block}.add-new-version-inner{width:100%;min-height:30px;position:relative;display:block;margin-bottom:20px}.add-new-version-inner .note-text-area{resize:none}.fixed-size-revision-table{table-layout:fixed;min-width:200px}.fixed-size-revision-table tr .rightAlignedContent{text-align:right}.fixed-size-revision-table tr .rightAlignedContent .revision-button{margin-left:2px;padding:2px}.fixed-size-revision-table tr .revision-info-td div{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.fixed-size-revision-table tr .note-td{position:relative;width:20px;padding:0px}.fixed-size-revision-table tr .note-td .revision-note-icon::before{position:absolute;top:10px;font-size:1.5em !important}.fixed-size-revision-table tr .fixed-rev-td{overflow:hidden;width:90px}.delete-button{float:right;margin-top:10px}`, \"\",{\"version\":3,\"sources\":[\"webpack://./src/app/project/model-revision/revision/revisions.scss\"],\"names\":[],\"mappings\":\"AAAA,wBACI,aAAA,CAIJ,iBACI,iBAAA,CACA,aAAA,CAGJ,uBACI,UAAA,CACA,eAAA,CACA,iBAAA,CACA,aAAA,CACA,kBAAA,CACA,uCACI,WAAA,CAIR,2BACI,kBAAA,CACA,eAAA,CAEI,mDACI,gBAAA,CACA,oEACI,eAAA,CACA,WAAA,CAKJ,oDACI,eAAA,CACA,sBAAA,CACA,kBAAA,CAIR,uCACI,iBAAA,CACA,UAAA,CACA,WAAA,CACA,mEACI,iBAAA,CACA,QAAA,CACA,0BAAA,CAGR,4CACI,eAAA,CACA,UAAA,CAKZ,eACI,WAAA,CACA,eAAA\",\"sourceRoot\":\"\"}]);\n// Exports\nexport default ___CSS_LOADER_EXPORT___;\n","// Module\nvar code = ` Edit model Add new version Add new version Add a version note OK All revisions \\${r.name} \\${r.created} By: \\${r.username} 10 ? r.note.substring(0,10)+'...' : r.note)\" click.delegate=\"openContextMenu(\\$event, r.note)\" class=\"fas fa-sticky-note revision-note-icon\"> `;\n// Exports\nexport default code;","import { ApiClient} from \"app/services/api-client\";\r\nimport { RequestMethod } from 'app/services/RequestMethod';\r\nimport { AppContextService } from \"app/services/app-context-service\";\r\nimport { autoinject } from 'aurelia-framework';\r\nimport { Router } from 'aurelia-router';\r\nimport { ModalService } from 'app/services/modal-service';\r\nimport { BimViewerService } from \"app/services/bim-viewer-service\";\r\nimport {BimViewerFileDto, BimViewerRevisionDto, CheckRevisionSyncStatusResponseDto} from \"../../../models/viewer-dtos/Dtos/bimviewer-dtos\";\r\nimport { ModelRevision } from \"../model-revision\";\r\nimport { UserService } from \"app/services/user-service\";\r\nimport { ContextMenuService } from \"app/services/context-menu-service\";\r\nimport { DialogCloseResult } from \"aurelia-dialog\";\r\nimport { DateTimeFormatter } from \"app/services/date-time-formatter\";\r\nimport { FragmentLoader } from \"app/project/ifc-fun/fragment-loader\";\r\nimport { RevisionMediaStatus } from \"app/project/ifc-fun/openbim-container\";\r\n\r\n@autoinject\r\nexport class Revisions {\r\n public revisionNote: string = \"\"; // hmm, historically this was for the EDITOR locally, ie not populated.\r\n private modelFiles: File[] = []\r\n private selectedRevisionFileName = \"Upload model\"\r\n private chosenFileToUpload?: File;\r\n public revisionList: BimViewerRevisionDto[] = []; // was: private\r\n private bimViewerService: BimViewerService\r\n private parentComponent?: ModelRevision;\r\n private isRevitPlugin: boolean = false;\r\n private fileInputElement?: HTMLInputElement;\r\n\r\n constructor(public apiClient: ApiClient, public appContext:AppContextService, \r\n public router: Router, public element: Element, public modal: ModalService, \r\n\t\t\t\tpublic userService: UserService, \r\n public contextMenuService: ContextMenuService,\r\n\t\t\t\tpublic fragmentLoader2: FragmentLoader // (this is a bastard cousin to BimViewerService)\r\n\t) {\r\n this.bimViewerService = new BimViewerService(apiClient,appContext);\r\n }\r\n\r\n\tasync bind(params: ModelRevision): Promise {\r\n this.parentComponent = params;\r\n console.log('revision-activate, params:', params, 'modelList#:', params.modelList.length);\r\n }\r\n \r\n attached(): void { this.fileInputElement = document.getElementById('revFileInput'); }\r\n\r\n open2DViewerRevision(revision: BimViewerRevisionDto): void {\r\n let revisionId: string = revision.id;\r\n let modelId: string[] = [revision.bimViewerFile_Id];\r\n let projectId: string | undefined = this.appContext?.getSelectedProject()?.id;\r\n if (projectId) {\r\n this.router.navigateToRoute('project/work-area', {projectId: projectId, revisionId, modelId, is2d: true}, {replace: true});\r\n }\r\n }\r\n\r\n open3DViewerRevision(revision: BimViewerRevisionDto): void {\r\n let revisionId: string = revision.id;\r\n let modelId: string[] = [revision.bimViewerFile_Id];\r\n let projectId: string | undefined = this.appContext?.getSelectedProject()?.id;\r\n if (projectId) {\r\n this.router.navigateToRoute('project/work-area', {projectId: projectId, revisionId, modelId, is2d: false}, {replace: true});\r\n }\r\n }\r\n\r\n async fillList(revisionList: BimViewerRevisionDto[]): Promise {//getRevision\r\n this.revisionList = revisionList;//fillList\r\n this.revisionList = await this.userService.fillUsernames(this.revisionList,'fillList');//fillList\r\n this.formatRevisionTime();\r\n this.sortRevisions();\r\n }\r\n \r\n formatRevisionTime(): void {\r\n this.revisionList.forEach((revision: BimViewerRevisionDto) => {//formatRevisionTime\r\n revision.created = DateTimeFormatter.formatDate(revision.created);\r\n });\r\n }\r\n \r\n sortRevisions(): void {\r\n this.revisionList.sort((element1: BimViewerRevisionDto, element2: BimViewerRevisionDto) => {//sortRevisions\r\n return Number(element2.revision) - Number(element1.revision);\r\n });\r\n }\r\n \r\n changeIcon(className: string): void {\r\n let element: Element | null = document.querySelector(className);\r\n if (element) {\r\n if (element.classList.contains(\"fa-angle-up\")) {\r\n element.classList.add(\"fa-angle-down\");\r\n element.classList.remove(\"fa-angle-up\");\r\n } else {\r\n element.classList.add(\"fa-angle-up\");\r\n element.classList.remove(\"fa-angle-down\");\r\n }\r\n this.resetInputs();\r\n }\r\n }\r\n \r\n resetInputs(): void {\r\n\t\tconsole.log('resetInputs');\r\n this.selectedRevisionFileName = \"Upload model\";\r\n this.chosenFileToUpload = undefined;\r\n this.revisionNote = \"\";//resetInputs\r\n if (this.fileInputElement) {\r\n this.fileInputElement.value = \"\";\r\n }\r\n\r\n }\r\n\r\n setIsRevitPlugin(isPlugin: boolean): void { this.isRevitPlugin = isPlugin; }\r\n\r\n async saveNewRevision(event:PointerEvent): Promise {\r\n\t\tconsole.log('saveNewRevision, event:', event);\r\n\t\tconsole.log('A saveNewRevision, event:', event.shiftKey);\r\n\t\tconst withShift = event.shiftKey;\r\n\t\tconst altUpload = withShift;\r\n\r\n\t\tif (!this.chosenFileToUpload) {\r\n\t\t\tthis.modal.OpenMessage(\"Attach file\",\"You must attach a file to add a new revision.\");\r\n\t\t\treturn;\r\n\t\t}\r\n if (!this.chosenFileToUpload.name.endsWith(\".ifc\")) {\r\n\t\t\tthis.modal.OpenMessage(\"Wrong file type\", \"Please select a file with a valid file type.\");\r\n\t\t\treturn;\r\n\t\t}\r\n let currentModel: BimViewerFileDto | undefined = this.parentComponent?.getSelectedModel();\r\n if (currentModel) {\r\n let revisionDto: BimViewerRevisionDto = await this.bimViewerService.uploadRevision(this.chosenFileToUpload, this.revisionNote, currentModel.id, altUpload);\r\n if (revisionDto == null) {\r\n return;\r\n }\r\n revisionDto.created = DateTimeFormatter.formatDate(revisionDto.created);\r\n let username: string | undefined = await this.userService.getUsername(revisionDto.createdByUser_Id,'saveNewRevision');\r\n revisionDto.username = username ? username : \"Unknown\";\r\n this.revisionList.push(revisionDto);//saveNewRevision\r\n this.parentComponent?.updateRevisionNumber(revisionDto.revision, revisionDto.created); \r\n this.sortRevisions();\r\n this.resetInputs();\r\n revisionDto.isSynced = false;\r\n this.parentComponent?.setSelectedModelSynced(false);\r\n }\r\n\r\n }\r\n\r\n fileSelected(): void {\r\n if (this.modelFiles.length > 0) {\r\n this.chosenFileToUpload = this.modelFiles[0];\r\n this.selectedRevisionFileName = this.chosenFileToUpload.name;\r\n }\r\n }\r\n\r\n async deleteModel(): Promise {\r\n document.getElementById(\"delete-button\")?.blur();\r\n console.log(\"Deleted\");\r\n let response: boolean = await this.modal.OpenConfirm(\"Delete model\",\"Are you sure you want to delete this model?\").whenClosed((response: DialogCloseResult) => {\r\n\t\t\treturn !response.wasCancelled;\r\n });\r\n if (response == true) {\r\n this.parentComponent?.deleteModel();\r\n }\r\n }\r\n\r\n async downloadModelRevision1(rev: BimViewerRevisionDto, normalize: boolean): Promise {\r\n console.log(\"downloadModelRevision, rev:\", rev);\r\n\t\tlet rms:RevisionMediaStatus = await this.fragmentLoader2.getRevisionMediaStatus(rev.id, rev.bimViewerFile_Id);\r\n if (!rms) { return this.report_RevisionNotFound(rev); }\r\n\r\n\t\tthis.downloadUrl_client(rms.ifcUrl, rev);\r\n\t}\r\n\r\n async downloadModelRevision2(rev: BimViewerRevisionDto, normalize: boolean): Promise {\r\n console.log(\"downloadModelRevision, rev:\", rev);\r\n\t\tlet rms:RevisionMediaStatus = await this.fragmentLoader2.getRevisionMediaStatus(rev.id, rev.bimViewerFile_Id);\r\n if (!rms) { return this.report_RevisionNotFound(rev); }\r\n\r\n\t\tthis.downloadUrl_direct(rms.ifcUrl, rev);\r\n\t}\r\n\t\r\n\tdownloadUrl_direct(ifcUrl: string, rev: BimViewerRevisionDto) {\r\n\t\tlet link = document.createElement(\"a\");\r\n\t\tconsole.log('download-name will be: ', rev.fileName, 'instead of ', link.download, rev);\r\n\t\tconsole.log('NAME is:', rev.name);\r\n\t\tconst fileName = `${rev.name}.ifc`;\r\n\t\tlink.download = fileName; // This appears be be ignored by firefox.\r\n\t\t//link.name = rev.fileName; // deprecated, so not necessary.\r\n\t\t// https://stackoverflow.com/questions/49474775/chrome-65-blocks-cross-origin-a-download-client-side-workaround-to-force-down\r\n\t\tlink.href = ifcUrl;\r\n\t\tlink.target = \"_blank\"; // is this necessary? It was a suggestion to control filename.\r\n\r\n\t\tdocument.body.appendChild(link);\r\n\t\tlink.click();\r\n\t\tdocument.body.removeChild(link);\r\n\t}\t\r\n\r\n\tasync downloadUrl_client(ifcUrl: string, rev: BimViewerRevisionDto) {\r\n\t\ttry { await this.downloadUrl_client_impl(ifcUrl,rev); } catch (error) { console.error('Error:', error); }\r\n\t}\r\n\r\n\tasync downloadUrl_client_impl(ifcUrl: string, rev: BimViewerRevisionDto) {\t\t\t\t\t\r\n\t\tconst response:Response = await fetch(ifcUrl); // Fetch the Blob from the Azure Storage URL\r\n\t\tif (!response.ok) { throw new Error(`HTTP error! status: ${response.status}`); } // Check if the request was successful\r\n\t\t// this.forgetAbout_ContentDisposition(response);\r\n\t\r\n\t\tconst blob = await response.blob(); // Convert the response to a Blob\r\n\r\n\t\tconst link = document.createElement('a'); // Create a temporary link element to trigger the download\r\n\t\tlink.href = window.URL.createObjectURL(blob);\r\n\t\t//link.href = ifcUrl;\r\n\t\t//link.target = \"_blank\"; // is this necessary? It was a suggestion to control filename.\r\n\r\n\t\tconst fileName = `${rev.name}.ifc`;\r\n\t\tconsole.log('download-name will be: ', fileName, rev);\r\n\t\tlink.download = fileName; // Set the filename to the one from the header\r\n\t\tlink.name = fileName; // deprecated, so not necessary.\r\n\r\n\t\tdocument.body.appendChild(link); // Append the link to the body\r\n\t\tlink.click(); // Trigger the download by simulating a click on the link\t\t\r\n\t\tdocument.body.removeChild(link); // Clean up the temporary link element\r\n\t\twindow.URL.revokeObjectURL(link.href);\t\t\r\n\t} // https://stackoverflow.com/questions/49474775/chrome-65-blocks-cross-origin-a-download-client-side-workaround-to-force-down\r\n\r\n\tforgetAbout_ContentDisposition(response:Response) {\t\t\r\n\t\tconst contentDisposition = response.headers.get('Content-Disposition'); // Extract the filename from the Content-Disposition header\r\n\t\tlet filename = 'downloaded-blob';\r\n\t\tif (contentDisposition) { // Parse the filename from Content-Disposition header\r\n\t\t\tconst match = contentDisposition.match(/filename=\"?(.+)\"?/);\r\n\t\t\tif (match && match[1]) { filename = match[1]; }\r\n\t\t}\r\n\t}\r\n\t\r\n\tasync brokenCatenda_downloadModelRevision(rev: BimViewerRevisionDto, normalize: boolean) {\r\n let prj: string = this.appContext.projectId;\r\n let api: RequestMethod = this.apiClient.project(prj);\r\n\t\t// this approach in its existing form will probably break,not work, for openBim variant:\r\n //let result: CheckRevisionSyncStatusResponseDto = await api.get(`BimViewer/GetCatendaRevision?revisionId=${revision.id}`).jsonResult();\r\n let revInfo: CheckRevisionSyncStatusResponseDto = await api.get(`BimViewer/GetCatendaRevision?revisionId=${rev.id}`).jsonResult();\r\n\r\n if (!revInfo) { return this.report_RevisionNotFound(rev); }\r\n if (!revInfo?.isSynced) { return this.report_fileNotReady(rev, revInfo); }\r\n\r\n rev.isSynced = true;\r\n this.parentComponent?.setSelectedModelSynced(true);\r\n if (this.parentComponent) { // why on earth would this depend on whether there is a parentComponent or not??\r\n throw 'This has not been implemented yet in the OpenBim version'\r\n\t\t\t//await this.bimsyncApi.setTokenAndProject(this.parentComponent.appContext.projectId);\r\n //await this.bimsyncApi.downloadRevisionFile(result, normalize);\r\n }\r\n }\r\n\treport_RevisionNotFound(revision: BimViewerRevisionDto) {\r\n\t\trevision.isSynced = false;\r\n\t\tthis.parentComponent?.setSelectedModelSynced(false);\r\n\t\tthis.modal.OpenMessage(\"File error\", `Error fetching the file.`,true);\r\n\t}\r\n\treport_fileNotReady(revision: BimViewerRevisionDto, result: CheckRevisionSyncStatusResponseDto) {\r\n\t\trevision.isSynced = false;\r\n\t\tthis.parentComponent?.setSelectedModelSynced(false);\r\n\t\tthis.modal.OpenMessage(\"(Processing file)\", `The requested file is ${result.syncProgress}% done processing.`);\r\n\t\treturn;\r\n\t}\r\n\r\n openContextMenu(event: Event, note: string): void {\r\n let actions: any[] = [];\r\n actions.push({ viewKey: \"text\", setup: { textKey: note}});\r\n this.contextMenuService.open(event, actions);\r\n }\r\n}\r\n"],"names":["___CSS_LOADER_EXPORT___","push","module","id","Revisions","constructor","apiClient","appContext","router","element","modal","userService","contextMenuService","fragmentLoader2","revisionNote","modelFiles","selectedRevisionFileName","revisionList","isRevitPlugin","this","bimViewerService","bind","params","parentComponent","console","log","modelList","length","attached","fileInputElement","document","getElementById","open2DViewerRevision","revision","revisionId","modelId","bimViewerFile_Id","projectId","getSelectedProject","navigateToRoute","is2d","replace","open3DViewerRevision","fillList","fillUsernames","formatRevisionTime","sortRevisions","forEach","created","formatDate","sort","element1","element2","Number","changeIcon","className","querySelector","classList","contains","add","remove","resetInputs","chosenFileToUpload","undefined","value","setIsRevitPlugin","isPlugin","saveNewRevision","event","shiftKey","altUpload","OpenMessage","name","endsWith","currentModel","getSelectedModel","revisionDto","uploadRevision","username","getUsername","createdByUser_Id","updateRevisionNumber","isSynced","setSelectedModelSynced","fileSelected","deleteModel","blur","OpenConfirm","whenClosed","response","wasCancelled","downloadModelRevision1","rev","normalize","rms","getRevisionMediaStatus","report_RevisionNotFound","downloadUrl_client","ifcUrl","downloadModelRevision2","downloadUrl_direct","link","createElement","fileName","download","href","target","body","appendChild","click","removeChild","downloadUrl_client_impl","error","fetch","ok","Error","status","blob","window","URL","createObjectURL","revokeObjectURL","forgetAbout_ContentDisposition","contentDisposition","headers","get","filename","match","brokenCatenda_downloadModelRevision","prj","api","project","revInfo","jsonResult","report_fileNotReady","result","syncProgress","openContextMenu","note","actions","viewKey","setup","textKey","open","autoinject","Element"],"sourceRoot":""}