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AApB,EAAA1D,KAAKI,uBAAe,SAAEuD,wBAAuB,QAC7C3D,KAAKR,MAAMuD,YAAY,oBAAqB,yBAAyByB,EAAOG,kCAGhF/D,EAAS8C,UAAW,EACA,QAApB,EAAA1D,KAAKI,uBAAe,SAAEuD,wBAAuB,GACzC3D,KAAKI,wBACCJ,KAAKZ,WAAWwF,mBAAmB5E,KAAKI,gBAAgBf,WAAW2B,iBACnEhB,KAAKZ,WAAWyF,qBAAqBL,EAAQJ,GAE3D,CAEAU,gBAAgBlC,EAAcmC,GAC1B,IAAIC,EAAiB,GACrBA,EAAQnG,KAAK,CAAEoG,QAAS,OAAQC,MAAO,CAAEC,QAASJ,KAClD/E,KAAKN,mBAAmB0F,KAAKxC,EAAOoC,EACxC,GA5KS/F,E,mUAAS,EADrB,EAAAoG,W,kIAYiC,KAA+B,IAAiC,IACnE,KAAwBC,QAAuB,IAAkC,IACrE,OAb9BrG,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\",\"sourcesContent\":[\".revision-content-block {\\r\\n display: block;\\r\\n\\r\\n}\\r\\n\\r\\n.add-new-version {\\r\\n position: relative;\\r\\n display: block;\\r\\n}\\r\\n\\r\\n.add-new-version-inner {\\r\\n width: 100%;\\r\\n min-height: 30px;\\r\\n position: relative;\\r\\n display: block;\\r\\n margin-bottom: 20px;\\r\\n .note-text-area {\\r\\n resize: none;\\r\\n }\\r\\n}\\r\\n\\r\\n.fixed-size-revision-table {\\r\\n table-layout: fixed;\\r\\n min-width: 200px;\\r\\n tr {\\r\\n .rightAlignedContent {\\r\\n text-align: right;\\r\\n .revision-button {\\r\\n margin-left: 2px;\\r\\n padding: 2px;\\r\\n } \\r\\n }\\r\\n\\r\\n .revision-info-td {\\r\\n div {\\r\\n overflow: hidden;\\r\\n text-overflow:ellipsis;\\r\\n white-space: nowrap;\\r\\n }\\r\\n \\r\\n }\\r\\n .note-td {\\r\\n position: relative;\\r\\n width: 20px;\\r\\n padding: 0px;\\r\\n .revision-note-icon::before {\\r\\n position: absolute;\\r\\n top: 10px;\\r\\n font-size: 1.5em!important;//Setting icon size.\\r\\n }\\r\\n }\\r\\n .fixed-rev-td {\\r\\n overflow: hidden;\\r\\n width:90px;\\r\\n }\\r\\n }\\r\\n}\\r\\n\\r\\n.delete-button {\\r\\n float: right;\\r\\n margin-top: 10px;\\r\\n \\r\\n}\"],\"sourceRoot\":\"\"}]);\n// Exports\nexport default ___CSS_LOADER_EXPORT___;\n","module.exports = \"\\r\\n\";","import { ApiClient, RequestMethod} from \"app/services/api-client\";\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 { BimsyncClient } from \"app/services/bimsync-client\";\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\n\r\n@autoinject\r\nexport class Revisions {\r\n private revisionNote: string = \"\";\r\n private modelFiles: File[] = []\r\n private selectedRevisionFileName = \"Upload model\"\r\n private chosenFileToUpload?: File;\r\n private revisionList: BimViewerRevisionDto[] = [];\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 bimsyncApi : BimsyncClient, public appContext:AppContextService, \r\n public router: Router, public element: Element, public modal: ModalService, public userService: UserService, \r\n public contextMenuService: ContextMenuService){\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);\r\n }\r\n \r\n attached(): void {\r\n this.fileInputElement = document.getElementById('revFileInput');\r\n }\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 {\r\n this.revisionList = revisionList;\r\n this.revisionList = await this.userService.fillUsernames(this.revisionList,'fillList');\r\n this.formatRevisionTime();\r\n this.sortRevisions();\r\n }\r\n \r\n formatRevisionTime(): void {\r\n this.revisionList.forEach((revision: BimViewerRevisionDto) => {\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) => {\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 this.selectedRevisionFileName = \"Upload model\";\r\n this.chosenFileToUpload = undefined;\r\n this.revisionNote = \"\";\r\n if (this.fileInputElement) {\r\n this.fileInputElement.value = \"\";\r\n }\r\n\r\n }\r\n\r\n setIsRevitPlugin(isPlugin: boolean): void {\r\n this.isRevitPlugin = isPlugin;\r\n }\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);\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 async downloadModelRevision(revision: BimViewerRevisionDto, normalize: boolean): Promise {\r\n console.log(\"Download\")\r\n console.log(revision)\r\n let prj: string = this.appContext.projectId;\r\n let api: RequestMethod = this.apiClient.project(prj);\r\n\t\t\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 if (!result) {\r\n revision.isSynced = false;\r\n this.parentComponent?.setSelectedModelSynced(false);\r\n this.modal.OpenMessage(\"File error\", `Error fetching the file.`,true);\r\n }\r\n if (!result?.isSynced) {\r\n revision.isSynced = false;\r\n this.parentComponent?.setSelectedModelSynced(false);\r\n this.modal.OpenMessage(\"(Processing file)\", `The requested file is ${result.syncProgress}% done processing.`);\r\n\t\t\treturn;\r\n }\r\n revision.isSynced = true;\r\n this.parentComponent?.setSelectedModelSynced(true);\r\n if (this.parentComponent) {\r\n await this.bimsyncApi.setTokenAndProject(this.parentComponent.appContext.projectId);\r\n await this.bimsyncApi.downloadRevisionFile(result, normalize);\r\n }\r\n }\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","exports","Revisions","constructor","apiClient","bimsyncApi","appContext","router","element","modal","userService","contextMenuService","revisionNote","modelFiles","selectedRevisionFileName","revisionList","isRevitPlugin","this","bimViewerService","async","params","parentComponent","console","log","attached","fileInputElement","document","getElementById","open2DViewerRevision","revision","revisionId","modelId","bimViewerFile_Id","projectId","getSelectedProject","navigateToRoute","is2d","replace","open3DViewerRevision","fillUsernames","formatRevisionTime","sortRevisions","forEach","created","sort","element1","element2","Number","changeIcon","className","querySelector","classList","contains","add","remove","resetInputs","chosenFileToUpload","undefined","value","setIsRevitPlugin","isPlugin","event","shiftKey","altUpload","OpenMessage","name","endsWith","currentModel","getSelectedModel","revisionDto","uploadRevision","username","getUsername","createdByUser_Id","updateRevisionNumber","isSynced","setSelectedModelSynced","fileSelected","length","blur","OpenConfirm","whenClosed","response","wasCancelled","deleteModel","normalize","prj","api","project","result","get","jsonResult","syncProgress","setTokenAndProject","downloadRevisionFile","openContextMenu","note","actions","viewKey","setup","textKey","open","autoinject","Element"],"sourceRoot":""}