contentBundle.debug.js 150 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994
  1. /**
  2. * Licensed Materials - Property of IBM
  3. *
  4. * IBM Cognos Products: Content Explorer
  5. *
  6. * Copyright IBM Corp. 2015, 2018
  7. *
  8. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  9. */
  10. define('bacontentnav/nls/ContentNavResources',{
  11. "root": true,
  12. "cs": true,
  13. "da": true,
  14. "de": true,
  15. "es": true,
  16. "fi": true,
  17. "fr": true,
  18. "he": true,
  19. "hr": true,
  20. "hu": true,
  21. "it": true,
  22. "ja": true,
  23. "kk": true,
  24. "ko": true,
  25. "no": true,
  26. "nb": true,
  27. "nl": true,
  28. "pl": true,
  29. "pt": true,
  30. "pt-br": true,
  31. "ro": true,
  32. "ru": true,
  33. "sl": true,
  34. "sv": true,
  35. "th": true,
  36. "tr": true,
  37. "zh": true,
  38. "zh-cn": true,
  39. "zh-tw": true
  40. });
  41. /**
  42. * Licensed Materials - Property of IBM
  43. * IBM Cognos Products: ba-content-nav
  44. * (C) Copyright IBM Corp. 2022
  45. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  46. */
  47. define('bacontentnav/nls/root/ContentNavResources',{
  48. "allContent": "All content",
  49. "allGenericItems": "All",
  50. "myContent": "My content",
  51. "copy": "Copy to",
  52. "confirmDelete": "Confirm delete",
  53. "confirmDeleteMessage": "Deleting entries can break links. Are you sure you want to delete the selected entries?",
  54. "dashboards": "Dashboards",
  55. "explorations": "Explorations",
  56. "delete": "Delete",
  57. "edit": "Edit",
  58. "notebooks": "Notebooks",
  59. "modificationTime": "Modified",
  60. "modifiedWithColon": "Modified:",
  61. "move": "Move to",
  62. "name": "Name",
  63. "tenant": "Tenant",
  64. "tenantSettings": "Tenant Settings",
  65. "tenantSet": "Tenant updated",
  66. "tenantSetError": "Error setting tenant",
  67. "tenantClear": "Tenant cleared",
  68. "tenantClearError": "Error clearing tenant",
  69. "owner": "Owner",
  70. "reports": "Reports",
  71. "copyMove": "Copy or move:",
  72. "copyOnly": "Copy",
  73. "noOfItemSelected": "%{noOfItems} selected",
  74. "selectDestination": "Select a destination",
  75. "selectAccountGroupOrRole": "Select groups, users or roles",
  76. "members": "Members",
  77. "teamContent": "Team content",
  78. "folderTeamContent": "Folder (Team Content)",
  79. "folders": "Folders",
  80. "goToCloudLocation": "Go to cloud location",
  81. "type": "Type",
  82. "typeWithColon": "Type:",
  83. "others": "Other",
  84. "unknown": "Unknown",
  85. "description": "Description",
  86. "general": "General",
  87. "advancedProperties": "Advanced",
  88. "location": "Location",
  89. "schedule": "Schedule",
  90. "created": "Created",
  91. "createdWithColon": "Created:",
  92. "disableThisEntry": "Disable this entry",
  93. "hideThisEntry": "Hide this entry",
  94. "indexed": "Indexed",
  95. "language": "Language",
  96. "reportOutputVersions": "Report output versions",
  97. "reportOutputVersion": "Report output version",
  98. "rowsPerPageHtmlReport": "Rows per page in HTML Reports",
  99. "package": "Package",
  100. "data": "Data",
  101. "dataModule": "Data module",
  102. "mode": "Mode",
  103. "live": "Live",
  104. "snapshot": "Snapshot",
  105. "noSnapshotsFound": "No Snapshot found",
  106. "uploadedFile": "Uploaded file",
  107. "fileUpload": "Upload files",
  108. "dataSetEx": "Data set",
  109. "externalRepository": "External repository",
  110. "queryMode": "Query mode",
  111. "queryModeCompatible": "Compatible",
  112. "queryModeDynamic": "Dynamic",
  113. "report": "Report",
  114. "activeReport": "Active Report",
  115. "query": "Query",
  116. "analysis": "Analysis",
  117. "permission": "Permissions",
  118. "capabilities": "Capabilities",
  119. "newItemMenuLabel": "New",
  120. "newFolderDefaultName": "New Folder",
  121. "newFolderLabel": "New folder",
  122. "switchViewsLabel": "Switch Views",
  123. "emptyTableContentMessage": "There's nothing in this folder.",
  124. "emptyRecentList": "You haven't viewed any content recently.",
  125. "back": "Back",
  126. "optionsMenuLabel": "Options",
  127. "defaultAction": "Default action",
  128. "reportOptions": "Report options",
  129. "promptValues": "Prompt values",
  130. "runTheReport": "Run the report",
  131. "viewMostRecentReport": "View most recent report",
  132. "openWithReportStudio": "Open with Report Studio",
  133. "comingSoon": "Coming soon",
  134. "recentlyViewed": "Recently viewed",
  135. "destination": "Destination:",
  136. "lastUsed": "Last Used",
  137. "reportView": "Report View",
  138. "reportViews": "Report Views",
  139. "adminFolder": "Administration",
  140. "folder": "Folder",
  141. "dashboard": "Dashboard",
  142. "dashboardTemplate": "Dashboard Template",
  143. "exploration": "Exploration",
  144. "story": "Story",
  145. "stories": "Stories",
  146. "notebook": "Notebook",
  147. "workspace": "Workspace",
  148. "pagelet": "Page",
  149. "content": "Content",
  150. "directory": "Namespaces",
  151. "dataSet": "Data set",
  152. "powerPlayCube": "PowerPlay Cube",
  153. "powerPlayReport": "PowerPlay Report",
  154. "powerPlay8Report": "PowerPlay Report",
  155. "powerPlay8ReportView": "PowerPlay Report View",
  156. "reportTemplate": "Report Template",
  157. "packageConfigurations": "Package Configuration",
  158. "agent": "Agent",
  159. "agentDefinition": "Agent Definition",
  160. "agentDefinitionView": "Agent View",
  161. "dataMovementTask": "Data Movement Task",
  162. "dataMovementTaskAlias": "Data Movement Task Alias",
  163. "document": "Document",
  164. "DocumentRetention": "Document properties",
  165. "jobDefinition": "Job Definition",
  166. "job": "Job",
  167. "jobs": "Jobs",
  168. "metricsDataSourceETLTask": "Metrics Data Source ETL Task",
  169. "metricsExportTask": "Metrics Export Task",
  170. "metricsFileImportTask": "Metrics File Import Task",
  171. "metricsMaintenanceTask": "Metrics Maintenance Task",
  172. "planningTask": "Planning Task",
  173. "shortcut": "Shortcut",
  174. "shortcuts": "Shortcuts",
  175. "URL": "URL",
  176. "launchable": "Launchable",
  177. "dataSetFolder": "Data Set Folder",
  178. "ViewAccessibleLabel": "View %{label}",
  179. "overrideReportOptions": "Override the default report options",
  180. "formats": "Formats",
  181. "saveReport": "Save the report",
  182. "promptForValues": "Prompt me",
  183. "html": "HTML",
  184. "pdf": "PDF",
  185. "spreadsheetML": "Excel",
  186. "xlsxData": "Excel Data",
  187. "csv": "CSV",
  188. "xml": "XML",
  189. "runAs": "Run as",
  190. "permissionHeader": "Permission",
  191. "read": "Read",
  192. "write": "Write",
  193. "execute": "Execute",
  194. "setPolicy": "Set Policy",
  195. "full": "Full",
  196. "traverse": "Traverse",
  197. "toastDoneMoving": "%{noOfItems} items were moved.",
  198. "toastDoneCopying": "%{noOfItems} items were copied.",
  199. "toastDoneShortcutting": "%{noOfItems} shortcuts were created.",
  200. "toastDoneDeleting": "%{noOfItems} items were deleted.",
  201. "toastDoneMovingSingular": "%{nameOfItem} was moved.",
  202. "toastDoneCopyingSingular": "%{nameOfItem} was copied.",
  203. "toastDoneShortcuttingSingular": "%{nameOfItem} was created.",
  204. "toastCreateNewFolder": "%{nameOfFolder} was created.",
  205. "toastDoneDeletingSingular": "%{nameOfItem} was deleted.",
  206. "toastLaunchPerspectiveError": "Cannot open %{objectType}.",
  207. "toastItemsWereAdded": "%{noOfItems} items were added to the profile.",
  208. "toastItemsWereAddedSingular": "%{noOfItems} item was added to the profile.",
  209. "toastItemsAlreadyAddedSingular": "Item has already been added to the profile.",
  210. "toastItemsAlreadyAdded": "Items have already been added to the profile.",
  211. "toastRunRequestWasSubmitted": "Run request was submitted.",
  212. "toastNoCapabilityForContainer": "No capabilities or permissions to save into '%{nameOfContainer}'.",
  213. "shortCutName": "%{nameOfItem}%{shortCutLabel}",
  214. "ok": "OK",
  215. "cancel": "Cancel",
  216. "permissionDetails": "Permission Details",
  217. "grant": "Grant",
  218. "deny": "Deny",
  219. "overrideParentPermissions": "Override parent permissions",
  220. "applyToAllChildren": "Apply to all children",
  221. "policiesTableLable": "Policies",
  222. "policesAddButtonLabel": "Member",
  223. "policesAddMemberButtonLabel": "Add",
  224. "policesRemove": "Remove",
  225. "policiesFindAUserHint": "Search",
  226. "policiesFindModeMenuTip": "Search method",
  227. "policiesFindMode": "Search",
  228. "policiesTypeInMode": "Type in",
  229. "policyFilterAccounts": "Users",
  230. "policyFilterRoles": "Roles",
  231. "policyFilterGroups": "Groups",
  232. "policyToastMessageSyntax": "Type the names of the entries to find, separated by semi-colons. Use the format namespace/user, group or role; For example, type Cognos/Everyone",
  233. "policyToastMessageNamespace": "You must first select a namespace.",
  234. "emptyPolicyList": "Nothing found",
  235. "applyLabel": "Apply",
  236. "permissionRead": "Read",
  237. "permissionRun": "Run",
  238. "permissionWrite": "Write",
  239. "permissionFull": "Full",
  240. "permissionCustom": "Custom",
  241. "permissionDetailsColumnAccess": "Access",
  242. "permissionDetailsColumnPermission": "Permission",
  243. "permissionDetailsColumnAction": "Action",
  244. "permissionSetAccess": "Set access",
  245. "preferencesMyCredentials": "My credentials",
  246. "preferencesCredentialsLabel": "Credentials",
  247. "preferencesDataSourceCredentialsLabel": "Data Servers",
  248. "preferencesDatasourceTitle": "Data server credentials",
  249. "preferencesDatasourceHeader": "Data server name",
  250. "preferencesGroupsAndRoles": "Groups and Roles",
  251. "preferencesMyCapabilities": "My Capabilities",
  252. "preferencesCredentialsHintText": "Specify the users, groups or roles that can use your credentials to run activities:",
  253. "preferencesCapabilitiesHintText": "These capabilities are available to you:",
  254. "preferencesGroupsAndRolesHintText": "In this session, you can use the access permissions of these groups and roles:",
  255. "preferencesDataSourceCredentialsHintText": "You have saved credentials for these data servers:",
  256. "enableAccessibilitySupport": "Enable accessibility support",
  257. "languages": "Languages",
  258. "True": "True",
  259. "False": "False",
  260. "id": "ID",
  261. "run": "Run",
  262. "createVersion": "Create a version",
  263. "create": "Create",
  264. "size": "Size",
  265. "sizeByte": "%{value} B",
  266. "sizeKiloByte": "%{value} KB",
  267. "sizeMegaByte": "%{value} MB",
  268. "sizeGigaByte": "%{value} GB",
  269. "sizeTeraByte": "%{value} TB",
  270. "sizePetaByte": "%{value} PB",
  271. "refreshedDatetime": "Refreshed time",
  272. "dataRefreshed": "Data refreshed",
  273. "dataRefWithColon": "Data refreshed:",
  274. "missingPermissions": "You need permissions to view the properties for this item.",
  275. "missingPolicies": "You only see entries that you have permissions for. You might see different entries if you sign in to a different namespace",
  276. "versions": "Versions",
  277. "archives": "Archives",
  278. "occurrences": "Occurrences",
  279. "days": "Day(s)",
  280. "months": "Month(s)",
  281. "errorMessages": "Messages",
  282. "errorMessageLengthFolderName": "Please enter a folder name that does not exceed 255 characters.",
  283. "errorMessageApostropheError": "Please enter a file name that does not contain both ' and \" characters",
  284. "error": "Error",
  285. "warn": "Warning",
  286. "fatal": "Fatal",
  287. "debug": "Debug",
  288. "info": "Information",
  289. "runTime": "Run time",
  290. "requestTime": "Request time",
  291. "startTime": "Start time",
  292. "endTime": "End time",
  293. "successful": "Successful",
  294. "failed": "Failed",
  295. "noSavedOutputs": "There are no saved outputs.",
  296. "noVersions": "No versions available",
  297. "noReportOptionsAvailable": "No report options record available.",
  298. "showDetails": "Open details panel",
  299. "unavailable": "Unavailable",
  300. "runInBackgroundOption": "Run in background",
  301. "selectAFormat": "Please select a format",
  302. "delivery": "Delivery",
  303. "now": "Now",
  304. "later": "Later",
  305. "invalidTime": "Time selected is earlier than current time. Please select again.",
  306. "executionPrompt": "Prompt for values",
  307. "currentValues": "Current values",
  308. "noPromptsValuesSet": "You currently have no prompt values set",
  309. "setValues": "Set values",
  310. "numOfPromptValues": "prompt values",
  311. "clear": "Clear",
  312. "sourceReport": "Source Report",
  313. "reportName": "Report Name",
  314. "reportLocation": "Report Location",
  315. "burst": "Burst the report",
  316. "sourcePackage": "Source Package",
  317. "packageName": "Package Name",
  318. "packageLocation": "Package Location",
  319. "confirmTakeOwnership": "Confirm Take Ownership",
  320. "confirmTakeOwnershipMessage": "Are you sure you want to take ownership of the selected entries?",
  321. "SetLabel": "Set...",
  322. "externalRepositories": "External Repositories",
  323. "toastTakeOwnership": "You now own %{noOfItemsClaimed} of %{noOfItems} selected items.",
  324. "runAsUser": "With user's credentials",
  325. "runWithOwnerCapabilities": "With owner capabilities",
  326. "runAsOwner": "As %{ownerName}",
  327. "pdfOptions": "PDF options",
  328. "set": "Set",
  329. "passwordNotMatched": "Passwords don't match or are missing",
  330. "Orientation": "Orientation",
  331. "default": "Default",
  332. "portrait": "Portrait",
  333. "landscape": "Landscape",
  334. "pageSize": "Paper size",
  335. "letter": "Letter",
  336. "legal": "Legal",
  337. "11x17": "11x17",
  338. "A3": "A3",
  339. "A4": "A4",
  340. "B4JIS": "B4 JIS",
  341. "B5JIS": "B5 JIS",
  342. "requiresPasswordToOpenReport": "Requires a password to open the report",
  343. "requiresPasswordToAccessOptions": "Requires a password to access options",
  344. "password": "Password:",
  345. "confirmPassword": "Confirm Password:",
  346. "runHistory": "Run History",
  347. "viewRunHistory": "View...",
  348. "jobAdvancedProperties": "Properties",
  349. "scheduleAJob": "Schedule Job",
  350. "viewCurrentVersions": "View document versions",
  351. "viewArchivedVersions": "View archived versions",
  352. "renameCollisionError": "%{name} already exists. Try a different name.",
  353. "nameCollision": "An item with this name already exists:",
  354. "nameCollisionMessage": "What do you want to do?",
  355. "copyReplace": "Copy and replace",
  356. "keepBoth": "Keep both",
  357. "copySkip": "Don't copy",
  358. "moveReplace": "Move and replace",
  359. "moveSkip": "Don't move",
  360. "repeatNameCollisionAction": "Do this for the next %{noItems} conflicts",
  361. "repeatNameCollisionActionSingular": "Do this for the next conflict",
  362. "bulkNameCollision": "There are %{noOfItems} items with names that already exist",
  363. "overwrite": "Overwrite",
  364. "rename": "Rename",
  365. "nameCollisionGeneric": "There are one or more items with a name that already exists.",
  366. "repeatedDeleteError": "One or more of these items are already in the process of being deleted. Wait until the delete action completes and try again.",
  367. "repeatedDeleteErrorTitle": "Repeated delete",
  368. "details": "Details:",
  369. "role": "Role",
  370. "account": "Account",
  371. "contact": "Contact",
  372. "distributionList": "Distribution list",
  373. "group": "Group",
  374. "namespace": "Namespace",
  375. "SetLanguagesLabel": "Set...",
  376. "SetExternalRespostoryLabel": "Set...",
  377. "SetCapabilitiesLabel": "Set...",
  378. "JobAdvancedSettings": "Set...",
  379. "JobSchedule": "Set...",
  380. "JobAdvancedRunHistory": "View...",
  381. "invalidNumber": "The value entered is not a number. Type a number.",
  382. "exceedMaxLength": "The text is too long. Shorten to %{maxLength} characters.",
  383. "invalidInput": "Invalid input",
  384. "invalidEmailMessage": "Email address is not valid.",
  385. "typeInHintText": "Example: Namespace1/name; Namespace2/name;",
  386. "importDeployment": "Import deployment",
  387. "exportDeployment": "Export deployment",
  388. "between": "Between",
  389. "greaterOrEqual": "Greater than or equal to %{upperboundValue}",
  390. "lessOrEqual": "Less than or equal to %{lowerboundValue}",
  391. "and": "and",
  392. "properties": "Properties - %{objectName}",
  393. "none": "None",
  394. "objectDeleted": "This object doesn't exist",
  395. "PageLayout": "Page Layout",
  396. "PageStyle": "Style",
  397. "Gateway": "Gateway",
  398. "PowerPlayReport": "PowerPlay Report",
  399. "more": "More",
  400. "title": "Title",
  401. "itemName": "Item name",
  402. "showMissingPolicies": "show",
  403. "hideMissingPolicies": "hide",
  404. "nowOrLaterRadioOptions": "Run now or later options",
  405. "runHistoryUnits": "Run history units",
  406. "reportOutputVersionsUnits": "Report output versions units",
  407. "breadCrumbsAccessibleLabel": "Ancestor Folders",
  408. "selectAllFolder": "Select all in folder",
  409. "deselectAllFolder": "Deselect all in folder",
  410. "clearAllSelected": "Clear all selected",
  411. "a11yContentListUpdatedNotification": "Now showing contents of %{folderOrPackageName}",
  412. "a11yPropertyPane": "Properties of object %{nameOfObject}",
  413. "moreActionsMenu": "More Actions Menu",
  414. "itemType": "Item type",
  415. "confirmCancelMessage": "Do you want to discard your changes?",
  416. "confirmCancel": "Confirm cancel",
  417. "formatOptions": "Format options",
  418. "listControlColumns": "List Columns",
  419. "source": "Source",
  420. "external": "External",
  421. "removeSelectedItem": "Remove selected item",
  422. "deleteReportVersion": "Delete report version",
  423. "dataset": "Data set",
  424. "numberRows": "Number of rows",
  425. "numberColumns": "Number of columns",
  426. "TimeToRefresh": "Time to refresh",
  427. "LastRefreshedBy": "Refreshed by",
  428. "OverwriteFileSuccessfully": "Successfully overwrote the object %{nameOfObject}",
  429. "RenameFileSuccessfully": "Successfully renamed the object from %{originalNameOfObject} to %{newNameOfObject}",
  430. "showAllHistory": "Show all history",
  431. "history": "History",
  432. "user": "User",
  433. "confirmDeleteAllowed": "You do not have permission to delete: %{number} item(s). Would you like to proceed and delete the rest?",
  434. "download": "Download",
  435. "personal": "Personal",
  436. "customization": "Customization",
  437. "schemas": "Schemas",
  438. "connections": "Connections",
  439. "numberOutOfRange": "The value entered must be a number between %{min} and %{max}",
  440. "numberTooSmall": "The value entered must be a number greater than %{min}",
  441. "numberTooBig": "The value entered must be a number less than %{max}",
  442. "searchReturnedNoResults": "Your search returned no results.",
  443. "tryChangingSearchTerms": "Please try a different search term.",
  444. "searchAllYourData": "Search all your data",
  445. "search": "Search",
  446. "saveSearch": "Save search",
  447. "narrowYourSearch": "Narrow your search",
  448. "all": "All",
  449. "packages": "Packages",
  450. "savedSearch": "Saved searches",
  451. "haventSavedSearches": "You haven't saved any searches.",
  452. "clickTheSaveButton": "Tap the Save search icon after you search.",
  453. "remove": "Remove",
  454. "searchWasDeleted": "Search was deleted",
  455. "searchWasntDeleted": "Search wasn't deleted",
  456. "searchWasSaved": "Search was saved",
  457. "searchWasntSaved": "Search wasn't saved",
  458. "socialInsightsProject": "Social Insights",
  459. "errorWithSearch": "There was an error with your search.",
  460. "saveTenSearches": "You can save 10 searches.",
  461. "deleteASearch": "Delete one to save another.",
  462. "models": "Models",
  463. "today": "Today",
  464. "yesterday": "Yesterday",
  465. "date": "Date",
  466. "clearAll": "Clear all",
  467. "EnterSearchTerms": "Enter a search term before you select a filter type.",
  468. "pastWeek": "Past week",
  469. "pastMonth": "Past month",
  470. "createShortcut": "Create shortcut",
  471. "createShortcutDialogTitle": "Create shortcut:",
  472. "shortcutTo": "Shortcut to",
  473. "shortcutToItem": "Shortcut to %{itemName}",
  474. "add": "Add",
  475. "close": "Close",
  476. "confirmClearTenant": "Confirm clear tenant",
  477. "confirmClearTenantText": "Clearing the tenant will change the value to \"None\" and might allow other tenants to access the content.<br><br>Click OK to make the entry public or Cancel to keep the current tenant",
  478. "changeTenantWarning": "Changing the tenant of an entry also changes the tenant of child entries.",
  479. "dataSource": "Data Server",
  480. "dataSourceConnection": "Connection",
  481. "dataSourceSignon": "Sign on",
  482. "searchForAssets": "You can search for assets",
  483. "results": "Results",
  484. "filterBy": "Filter by",
  485. "resultLimit": "Result limit",
  486. "noAccessRecent": "No access",
  487. "noAccessRecentMsg": "You don't have access to this asset. It might have been disabled or deleted, or your permissions might have been reduced. Verify the state of the asset at its expected source location. You can remove the asset from your recent items by clicking OK.",
  488. "capability": "Capability",
  489. "loading": "Loading",
  490. "save": "Save",
  491. "saveAs": "Save as",
  492. "saveAsLabel": "Save as:",
  493. "teamFolders": "Team Folders",
  494. "open": "Open",
  495. "openDialogTitle": "Open file",
  496. "openDialogFooter": "Open and cancel button",
  497. "saveDialogTitle": "Save as",
  498. "saveDialogFooter": "Save and cancel button",
  499. "toastSaveErrorSameNameDifferentType": "'%{nameOfItem}' already exists with a different type. Please choose a different name.",
  500. "filesToOpen": "Files to open:",
  501. "confirmRefreshUpload": "Confirm replacement of existing data",
  502. "msgConfirmRefreshUpload": "The file '%{fileName}' already exists. Do you want to replace its data with the data contained in the selected file?",
  503. "userDataSource": "CSV",
  504. "dataAsset": "XLS",
  505. "xls": "XLS",
  506. "xlsx": "XLSX",
  507. "sav": "SAV",
  508. "txt": "TXT",
  509. "circle": "In progress",
  510. "sortHeader": "Sort by",
  511. "filterHeader": "Filter by",
  512. "sort": "Sort",
  513. "sortBy": "Sort by",
  514. "order": "Order",
  515. "previous": "Previous",
  516. "collapsedBreadCrumb": "Collapsed items",
  517. "sortedAscending": "Ascending",
  518. "sortedDescending": "Descending",
  519. "itemsOverLimit": "The specified name '%{itemName}' has exceeded the maximum (20) limit. Please specify a different name to continue.",
  520. "searchFolder": "Type any text",
  521. "text": "Keywords",
  522. "noFilterResult": "No data matched your search.",
  523. "tryOtherFilter": "Try selecting a different filter.",
  524. "visualization": "Visualization",
  525. "cosConnection": "Cloud object storage connection",
  526. "cosConnections": "Cloud object storage connections",
  527. "cosLocation": "Cloud location",
  528. "resourceFolder": "Resource folder",
  529. "unableToOpenFolderMsg": "Unable to open the specified folder"
  530. });
  531. /*
  532. *+------------------------------------------------------------------------+
  533. *| Licensed Materials - Property of IBM
  534. *| IBM Cognos Products: Content Explorer
  535. *| (C) Copyright IBM Corp. 2015
  536. *|
  537. *| US Government Users Restricted Rights - Use, duplication or disclosure
  538. *| restricted by GSA ADP Schedule Contract with IBM Corp.
  539. *+------------------------------------------------------------------------+
  540. */
  541. define('bacontentnav/nls/StringResource',['i18n!./ContentNavResources', 'polyglot'], function(localeResources, Polyglot) {
  542. 'use strict';
  543. /**
  544. * Module which provides simple access to string resources.
  545. *
  546. */
  547. var poly = new Polyglot({
  548. phrases: localeResources
  549. });
  550. var StringResources = function() {
  551. return undefined;
  552. };
  553. /**
  554. * Get the string resource for the given key and interpolation options
  555. *
  556. * @param key The key of the string to return
  557. * @param interpolationOptions Optional interpolation options (see poly.t documentation for details)
  558. * @returns The string to display
  559. */
  560. StringResources.prototype.get = function(key, interpolationOptions) {
  561. return poly.t(key, interpolationOptions);
  562. };
  563. return new StringResources();
  564. });
  565. /*
  566. *+------------------------------------------------------------------------+
  567. *| Licensed Materials - Property of IBM
  568. *| IBM Cognos Products: Content Explorer
  569. *| (C) Copyright IBM Corp. 2015, 2018
  570. *|
  571. *| US Government Users Restricted Rights - Use, duplication or disclosure
  572. *| restricted by GSA ADP Schedule Contract with IBM Corp.
  573. *+------------------------------------------------------------------------+
  574. */
  575. define('bacontentnav/utils/GlassContextHelper',[], function() {
  576. 'use strict';
  577. var _singletonInstance = null;
  578. var GlassContextHelper = function() {
  579. if (GlassContextHelper.prototype._singletonInstance) {
  580. return GlassContextHelper.prototype._singletonInstance;
  581. }
  582. GlassContextHelper.prototype._singletonInstance = this;
  583. };
  584. /*
  585. @glassContext - glassContext
  586. @jqXHR - jQuery XMLHttpRequest returned by Glass Ajax service on fail
  587. Is temporary and should be removed when Glass handles the showing of error messages
  588. */
  589. GlassContextHelper.prototype.showAjaxServiceErrorMessage = function(glassContext, jqXHR) {
  590. var messages = '';
  591. if (jqXHR) {
  592. var responseJSON = jqXHR.responseJSON;
  593. if (responseJSON) {
  594. if (responseJSON.messages) {
  595. messages = jqXHR.responseJSON.messages.join('\n');
  596. } else if (responseJSON.cause) {
  597. try {
  598. var cause = JSON.parse(responseJSON.cause);
  599. if (cause.messages) {
  600. messages = cause.messages.join('\n');
  601. }
  602. } catch (e) {
  603. //if we get here, 'cause' is not a json object
  604. messages = responseJSON.cause;
  605. }
  606. }
  607. } else {
  608. messages = jqXHR.responseText;
  609. }
  610. }
  611. if ( messages && messages.length > 0 ) { // RTC189248 - Don't show empty error messages!
  612. glassContext.appController.showErrorMessage(messages, 'Error');
  613. }
  614. };
  615. GlassContextHelper.prototype.showAjaxServiceError = function(glassContext, error) {
  616. this.showAjaxServiceErrorMessage(glassContext, error.jqXHR);
  617. };
  618. /*
  619. @glassContext - glassContext
  620. @str - the message
  621. @options - an options jsonObject to pass to glass's showToast
  622. */
  623. GlassContextHelper.prototype.displayToast = function(glassContext, str, options) {
  624. glassContext.appController.showToast(str, options);
  625. };
  626. /*
  627. * preference - name of the preference setting to get. e.g contentLocale, email, etc
  628. */
  629. GlassContextHelper.prototype.getUserPreference = function(glassContext, preference) {
  630. return glassContext.getCoreSvc('.UserProfile').preferences[preference];
  631. };
  632. GlassContextHelper.prototype.getContentLocales = function(glassContext) {
  633. return glassContext.getCoreSvc('.Config').getContentLocales();
  634. };
  635. GlassContextHelper.prototype.getLocaleTime = function(glassContext) {
  636. var preferences = glassContext ? glassContext.getCoreSvc('.UserProfile').preferences : {};
  637. return {
  638. timeZone: preferences.timeZoneID || 'America/New_York',
  639. contentLocale: preferences.contentLocale || 'en'
  640. };
  641. };
  642. var _static = {
  643. getInstance: function() {
  644. if (!_singletonInstance) {
  645. _singletonInstance = new GlassContextHelper();
  646. }
  647. return _singletonInstance;
  648. }
  649. };
  650. return _static.getInstance();
  651. });
  652. /*
  653. *+------------------------------------------------------------------------+
  654. *| Licensed Materials - Property of IBM
  655. *| IBM Cognos Products: Content Explorer
  656. *| (C) Copyright IBM Corp. 2018
  657. *|
  658. *| US Government Users Restricted Rights - Use, duplication or disclosure
  659. *| restricted by GSA ADP Schedule Contract with IBM Corp.
  660. *+------------------------------------------------------------------------+
  661. */
  662. define('bacontentnav/utils/ContentServiceUrls',[], function() {
  663. return {
  664. baseContentServiceURL: 'v1/objects',
  665. basePathURL: 'v1/path?path=',
  666. baseSearchPathURL: 'v1/search_path?searchPath=',
  667. baseUserProfileServiceURL: 'v1/users',
  668. baseNamespaceServiceURL: 'v1/namespaces',
  669. getMyFoldersURL: function() {
  670. return this.baseContentServiceURL + '/.my_folders';
  671. },
  672. getMyFoldersContentURL: function() {
  673. return this.getMyFoldersURL() + '/items';
  674. },
  675. getOtherUsersFoldersURL: function() {
  676. return this.baseContentServiceURL + '/.users';
  677. },
  678. getBaseNamespaceURL: function() {
  679. return this.baseNamespaceServiceURL;
  680. },
  681. getPublicFoldersURL: function() {
  682. return this.baseContentServiceURL + '/.public_folders';
  683. },
  684. getPublicFoldersContentURL: function() {
  685. return this.getPublicFoldersURL() + '/items';
  686. },
  687. getRootPublicFolderName: function() {
  688. return null;
  689. },
  690. getRootMyFolderName: function() {
  691. return null;
  692. },
  693. getMRUURL: function() {
  694. return this.baseUserProfileServiceURL + '/~/mrus';
  695. },
  696. getBaseObjectsURL: function() {
  697. return this.baseContentServiceURL;
  698. },
  699. getBasePathURL: function() {
  700. return this.basePathURL;
  701. },
  702. getBaseSearchPathURL: function() {
  703. return this.baseSearchPathURL;
  704. },
  705. getDefaultUploadLocationURL: function() {
  706. return this.baseUserProfileServiceURL + '/_tilde_/user_profile_settings?fields=fileUpload_location';
  707. }
  708. };
  709. });
  710. /*
  711. *+------------------------------------------------------------------------+
  712. *| Licensed Materials - Property of IBM
  713. *|
  714. *| IBM Cognos Products: ba-content-nav
  715. *|
  716. *| (C) Copyright IBM Corp. 2015,2022
  717. *|
  718. *| US Government Users Restricted Rights - Use, duplication or disclosure
  719. *| restricted by GSA ADP Schedule Contract with IBM Corp.
  720. *+------------------------------------------------------------------------+
  721. */
  722. // jshint maxdepth:5
  723. define('bacontentnav/utils/ContentStoreObject',[
  724. 'underscore',
  725. '../nls/StringResource',
  726. '../lib/@waca/core-client/js/core-client/utils/DateTimeUtils',
  727. './GlassContextHelper',
  728. './ContentServiceUrls'
  729. ], function(_, StringResource, DateTimeUtils, GlassContextHelper, ContentServiceUrls) {
  730. 'use strict';
  731. var _singletonInstance = null;
  732. var ContentStoreObject = function() {
  733. if (ContentStoreObject.prototype._singletonInstance) {
  734. return ContentStoreObject.prototype._singletonInstance;
  735. }
  736. this.ID = 'id';
  737. this.TYPE = 'type';
  738. this.DEFAULT_NAME = 'defaultName';
  739. this.MODIFICATION_TIME = 'modificationTime';
  740. this.SEARCH_PATH = 'searchPath';
  741. this.TENANT_NAME = 'tenantName';
  742. this.TENANT_ID = 'tenantID';
  743. this.CREATION_TIME = 'creationTime';
  744. this.OWNER = 'owner';
  745. this.META = '_meta';
  746. this.LINKS = 'links';
  747. this.URL = 'url';
  748. this.selfURL = 'selfUrl';
  749. this.SELF = 'self';
  750. this.ITEMS = 'items';
  751. this.ICON = 'iconURI';
  752. this.DEFAULT_TOOLTIP = 'defaultScreenTip';
  753. this.MODELS = 'models';
  754. this.DEFAULT_DESCRIPTION = 'defaultDescription';
  755. this.ANCESTORS = 'ancestors';
  756. this.DEFAULT_PORTAL_ACTION = 'defaultPortalAction';
  757. this.RUN_AS_OWNER = 'runAsOwner';
  758. this.RUN_WITH_OWNER_CAPABILITIES = 'runWithOwnerCapabilities';
  759. this.RUN_AS_USER = 'runAsUser';
  760. this.HIDDEN = 'hidden';
  761. this.DISABLED = 'disabled';
  762. this.MIME_TYPE = 'mimeType';
  763. this.OPTIONS = 'options';
  764. this.PERMISSIONS = 'permissions';
  765. this.SCHEMAINFO = 'schemaInfo';
  766. this.POLICIES = 'policies';
  767. this.ACQUIRED = 'acquired';
  768. this.HISTORY = 'history';
  769. this.DATA_DESCRIPTOR = 'dataDescriptor';
  770. this.BASE = 'base';
  771. this.METADATA_MODEL_PACKAGE = 'metadataModelPackage';
  772. this.MODULE = 'module';
  773. this.TAGS = 'tags';
  774. this.REFERENCES = 'references';
  775. this.SURNAME='surname';
  776. this.GIVENNAME='givenName';
  777. // for histories and history details
  778. this.HISTORIES = 'histories';
  779. this.VERSIONS = 'versions';
  780. this.DETAILS = 'details';
  781. this.REQUESTED_TIME = 'requestedExecutionTime';
  782. this.EXECUTION_TIME = 'actualExecutionTime';
  783. this.COMPLETION_TIME = 'actualCompletionTime';
  784. this.STATUS = 'status';
  785. this.OUTPUT = 'output';
  786. this.OUTPUTS = 'outputs';
  787. this.MESSAGES = 'messages';
  788. this.MESSAGES_DETAIL = 'detail';
  789. this.MESSAGES_SEVERITY = 'severity';
  790. this.REQUEST_ARGUMENTS = 'requestArguments';
  791. this.PARAMETERS = 'parameters';
  792. this.EXECUTION_PROMPT = 'executionPrompt';
  793. // for report outputs
  794. this.BURSTKEY = 'burstKey';
  795. this.FORMAT = 'format';
  796. this.LOCALE = 'locale';
  797. this.CONTENT = 'content';
  798. this.RUN_IN_ADVANCED_VIEWER = 'runInAdvancedViewer';
  799. this.OPTION_OUTPUT_FORMAT = 'outputFormat';
  800. this.OPTION_OUTPUT_LOCALE = 'outputLocale';
  801. this.OPTION_ACCESSIBILITY_FEATURES = 'http://developer.cognos.com/ceba/constants/systemOptionEnum#accessibilityFeatures';
  802. this.OPTION_PROMPT = 'prompt';
  803. this.OPTION_HTML_ROWS_PER_PAGE = 'verticalElements';
  804. this.OPTION_SELECTION_BASED_FEATURES = 'selectionBasedFeatures';
  805. this.OPTION_ENABLE_ALLOW_NOTIFICATION = 'allowNotification';
  806. this.OPTION_ENABLE_USER_FEATURE_SAVED_OUTPUT = 'advancedOutput';
  807. this.EFFECTIVE_USER_CAPABILITIES = 'effectiveUserCapabilities';
  808. ContentStoreObject.prototype._singletonInstance = this;
  809. // private functions
  810. this._getMetaLinksURL = function(oData, target) {
  811. var linksTarget = oData[this.META] && oData[this.META][this.LINKS] && oData[this.META][this.LINKS][target];
  812. return linksTarget && linksTarget[this.URL] || null;
  813. };
  814. this._getBaseType = function(oData) {
  815. var base = this.getBase(oData);
  816. return base && this.getType(base) || null;
  817. };
  818. this._getFormatedDateTime = function(oData, formated, formatLength, fieldKey, includeTime) {
  819. var time = oData[fieldKey] || null;
  820. if (formated && time) {
  821. var timeLocale = (this.glassContext) ? GlassContextHelper.getLocaleTime(this.glassContext) : {};
  822. time = includeTime ? DateTimeUtils.formatDateTime(time, formatLength, timeLocale) : DateTimeUtils.formatDate(time, formatLength, timeLocale);
  823. }
  824. return time;
  825. };
  826. };
  827. ContentStoreObject.prototype.setGlassContext = function(glassContext) {
  828. this.glassContext = glassContext;
  829. };
  830. ContentStoreObject.prototype.setContentService = function(contentService) {
  831. console.warn('ContentStoreObject.setContentService method is deprectated; Use ContentStoreObject.setGlassContext');
  832. if ( contentService && contentService.glassContext) {
  833. this.glassContext = contentService.glassContext;
  834. }
  835. };
  836. /**
  837. Takes a list of objects and returns a list of their ids
  838. **/
  839. ContentStoreObject.prototype.getObjectListIds = function(objects) {
  840. var ids = [];
  841. objects.forEach(function(obj) {
  842. if (obj.id) {
  843. ids.push(obj.id);
  844. }
  845. });
  846. return ids;
  847. };
  848. ContentStoreObject.prototype.isPoliciesAcquired = function(oData) {
  849. return oData[this.META] && oData[this.META][this.SCHEMAINFO] && oData[this.META][this.SCHEMAINFO][this.POLICIES] && oData[this.META][this.SCHEMAINFO][this.POLICIES][this.ACQUIRED];
  850. };
  851. ContentStoreObject.prototype.getObjectId = function(oData) {
  852. return oData.id || '';
  853. };
  854. ContentStoreObject.prototype.getSearchPath = function(oData) {
  855. return oData.searchPath || '';
  856. };
  857. ContentStoreObject.prototype.isTeamContent = function(oData) {
  858. return oData && oData.type === 'content';
  859. };
  860. /**
  861. returns the object type from the JSON response
  862. @return {string} or null
  863. **/
  864. ContentStoreObject.prototype.getType = function(oData) {
  865. return oData && oData[this.TYPE] || null;
  866. };
  867. /**
  868. returns the object icon from the JSON response
  869. @return {string} or null
  870. **/
  871. ContentStoreObject.prototype.getIcon = function(oData) {
  872. return oData[this.ICON] || null;
  873. };
  874. /**
  875. returns the object default tooltip from the JSON response
  876. @return {string} or null
  877. **/
  878. ContentStoreObject.prototype.getTooltip = function(oData) {
  879. return oData[this.DEFAULT_TOOLTIP] || null;
  880. };
  881. /**
  882. returns the object tags from the JSON response
  883. @return {array} or null
  884. **/
  885. ContentStoreObject.prototype.getTags = function(oData) {
  886. return oData[this.TAGS] || null;
  887. };
  888. /**
  889. Will return the base object type.
  890. - If the object is not a reportView, then the object type will be returned
  891. - If the object is a view and the base type is available then it will be returned
  892. - If the object is a view and the base type is not available, then we will query for it
  893. @returns a promise that will resolve with the type of the base object
  894. **/
  895. ContentStoreObject.prototype.getBaseObjectType = function(oData) {
  896. var type = this.getType(oData);
  897. if (type && /view$/.test(type.toLowerCase()) ) {
  898. // If we already have the base type available, simply return it
  899. var baseType = this._getBaseType(oData);
  900. if (baseType) {
  901. return Promise.resolve(baseType);
  902. } else {
  903. // If this is a report, we need to query the base type
  904. var selfUrl = this.getSelfLink(oData);
  905. return this.glassContext.getCoreSvc('.Ajax').ajax({
  906. 'url': selfUrl,
  907. 'type': 'GET',
  908. 'dataType': 'json',
  909. 'data': {
  910. 'fields': 'base.type'
  911. }
  912. }).then(function(response) {
  913. var data = response && response.data && response.data.data;
  914. var base = this.getBase(data[0]);
  915. // We've queried for the information, might as well place it in the oData that was passed in
  916. oData.base = [base];
  917. return this.getType(base);
  918. }.bind(this));
  919. }
  920. } else {
  921. return Promise.resolve(type);
  922. }
  923. };
  924. //TODO: is this a WA-specific test? if yes, remove
  925. ContentStoreObject.prototype._isUserFolder = function(oData) {
  926. // Need to check for length of 1 since as we drill into User Folders, ancestor[0] is still UserFolder.
  927. if (oData.ancestors && oData.ancestors.length === 1) {
  928. return !!(oData.ancestors[0] && (oData.ancestors[0].id === '.other_users_folders'));
  929. } else {
  930. return false;
  931. }
  932. };
  933. // TODO: is this a WA-specific test? if yes, remove
  934. ContentStoreObject.prototype._getUserFolderName = function(oData) {
  935. return oData.createdBy && oData.createdBy.defaultName || '';
  936. };
  937. /**
  938. Returns the child link from the JSON response
  939. @return {string} or null
  940. **/
  941. ContentStoreObject.prototype.getItemsLink = function(oData) {
  942. var type = oData.type;
  943. if (type === 'namespace') {
  944. return 'v1/namespaces/' + oData.id + '/items';
  945. } else if (type === 'namespaceFolder') {
  946. return 'v1/namespaces/' + oData.id + '/items?page=0|0&sorting=defaultName|asc';
  947. } else if (type === 'agentDefinition' || this._isUserFolder(oData)) {
  948. // content-service does not support getItemsLink for agentDefinition yet
  949. var selfLink = this._getMetaLinksURL(oData, this.SELF);
  950. if (selfLink) {
  951. return selfLink + '/items';
  952. }
  953. }
  954. return this._getMetaLinksURL(oData, this.ITEMS); // returns null if not found
  955. };
  956. /**
  957. Returns the child link from the JSON response
  958. @return {string} or null
  959. **/
  960. ContentStoreObject.prototype.getSelfLink = function(oData) {
  961. return this._getMetaLinksURL(oData, this.SELF) || oData[this.selfURL] || 'v1/objects/' + oData[this.ID];
  962. };
  963. /**
  964. * Returns the histories from the JSON response
  965. * @return {promise}
  966. */
  967. ContentStoreObject.prototype.getHistories = function(oData, fields) {
  968. var historyLink = this._getMetaLinksURL(oData, this.HISTORIES);
  969. if (historyLink) {
  970. return this.glassContext.getCoreSvc('.Ajax').ajax({
  971. dataType: 'json',
  972. type: 'GET',
  973. url: historyLink,
  974. data: {
  975. fields: fields
  976. }
  977. }).then(function(response) {
  978. var data = response.data;
  979. var responseData = data.data && data.data.length > 0 ? data.data : false;
  980. return responseData;
  981. });
  982. } else {
  983. return Promise.resolve(false);
  984. }
  985. };
  986. /**
  987. * Returns the versions from the JSON response
  988. * @return {promise}
  989. */
  990. ContentStoreObject.prototype.getVersions = function(oData, fields) {
  991. var versionsLink = this.getVersionsLink(oData);
  992. if (versionsLink) {
  993. return this.glassContext.getCoreSvc('.Ajax').ajax({
  994. dataType: 'json',
  995. type: 'GET',
  996. url: versionsLink,
  997. data: {
  998. fields: fields
  999. }
  1000. }).then(function(response) {
  1001. var data = response.data;
  1002. var responseData = data.data && data.data.length > 0 ? data.data : false;
  1003. return responseData;
  1004. });
  1005. } else {
  1006. return Promise.resolve(false);
  1007. }
  1008. };
  1009. /**
  1010. Returns the versions link from the JSON response
  1011. @return {string} or null
  1012. **/
  1013. ContentStoreObject.prototype.getVersionsLink = function(oData) {
  1014. return this._getMetaLinksURL(oData, this.VERSIONS);
  1015. };
  1016. /**
  1017. Returns the details link from the JSON response
  1018. @return {string} or null
  1019. **/
  1020. ContentStoreObject.prototype.getDetailsLink = function(oData) {
  1021. return this._getMetaLinksURL(oData, this.DETAILS);
  1022. };
  1023. /**
  1024. Returns the output's report version self link from the JSON response
  1025. @return {string} or null
  1026. **/
  1027. ContentStoreObject.prototype.getOutputsLink = function(oData) {
  1028. var output = oData[this.OUTPUT] && oData[this.OUTPUT][0];
  1029. return output && this._getMetaLinksURL(output, this.OUTPUTS) || null;
  1030. };
  1031. /**
  1032. Returns the output's report version self link from the JSON response
  1033. @return {string} or null
  1034. **/
  1035. ContentStoreObject.prototype.getVersionLink = function(oData) {
  1036. var output = oData[this.OUTPUT] && oData[this.OUTPUT][0];
  1037. return output && this.getSelfLink(output) || null;
  1038. };
  1039. /**
  1040. Returns the output content link from the JSON response
  1041. @return {string} or null
  1042. **/
  1043. ContentStoreObject.prototype.getOutputContentLink = function(oData) {
  1044. return this._getMetaLinksURL(oData, this.CONTENT);
  1045. };
  1046. /**
  1047. Returns the models link from the JSON response
  1048. @return {string} or null
  1049. **/
  1050. ContentStoreObject.prototype.getModelsLink = function(oData) {
  1051. return this._getMetaLinksURL(oData, this.MODELS);
  1052. };
  1053. /**
  1054. Returns the saved report's options list from the JSON response
  1055. @return {string} or null
  1056. **/
  1057. ContentStoreObject.prototype.getDetailsReportVersionOptions = function(oData) {
  1058. return oData[this.REQUEST_ARGUMENTS] && oData[this.REQUEST_ARGUMENTS][this.OPTIONS] || null;
  1059. };
  1060. /**
  1061. Returns the saved report's options list from the JSON response
  1062. @return {string} or null
  1063. **/
  1064. ContentStoreObject.prototype.getDetailsReportVersionParameters = function(oData) {
  1065. return oData[this.REQUEST_ARGUMENTS] && oData[this.REQUEST_ARGUMENTS][this.PARAMETERS] || null;
  1066. };
  1067. /**
  1068. @return {string} - the owner name
  1069. **/
  1070. ContentStoreObject.prototype.getOwnerName = function(oData) {
  1071. if (!oData || !oData[this.OWNER]) {
  1072. return StringResource.get('unknown');
  1073. }
  1074. if (!$.isArray(oData[this.OWNER])) {
  1075. return oData[this.OWNER];
  1076. } else if (oData[this.OWNER][0] && oData[this.OWNER][0][this.DEFAULT_NAME]) {
  1077. // check if the givenName, surName, and userName are available, otherwise display the defaultName
  1078. if((oData[this.GIVENNAME] && oData[this.SURNAME]) && (oData[this.OWNER][0][this.DEFAULT_NAME] === oData.defaultName)){
  1079. return oData[this.GIVENNAME] + ' ' + oData[this.SURNAME];
  1080. } else{
  1081. return oData[this.OWNER][0][this.DEFAULT_NAME];
  1082. }
  1083. }
  1084. return StringResource.get('unknown');
  1085. };
  1086. /**
  1087. @return {string} - the object name
  1088. **/
  1089. ContentStoreObject.prototype.getObjectName = function(oData) {
  1090. if (!oData || !oData.defaultName) {
  1091. return StringResource.get('unknown');
  1092. }
  1093. return oData.defaultName;
  1094. };
  1095. /**
  1096. @return {string} or null - the owner ID
  1097. **/
  1098. ContentStoreObject.prototype.getOwnerId = function(oData) {
  1099. if (!oData[this.OWNER] || oData[this.OWNER].length < 1) {
  1100. return null;
  1101. }
  1102. return oData[this.OWNER][0] && oData[this.OWNER][0][this.ID] || null;
  1103. };
  1104. /**
  1105. @return {string} or null - the owner self link
  1106. **/
  1107. ContentStoreObject.prototype.getOwnerSelfLink = function(oData) {
  1108. return (oData[this.OWNER] && oData[this.OWNER].length > 0) ? this.getSelfLink(oData[this.OWNER][0]) : null;
  1109. };
  1110. /**
  1111. @return {boolean} - returns true if the current user is the owner of the item
  1112. **/
  1113. ContentStoreObject.prototype.isOwner = function(oData) {
  1114. var oDataOwnerId = this.getOwnerId(oData);
  1115. return !!(oDataOwnerId && oDataOwnerId === this.glassContext.getCoreSvc('.UserProfile').preferences.id);
  1116. };
  1117. /**
  1118. Returns the requested time from the JSON reponse
  1119. @formated {boolean} - should the response be formated
  1120. @formatLength {string} - if the response is to be formated, then specify the length of the formar (short|medium|long)
  1121. **/
  1122. ContentStoreObject.prototype.getRequestedTime = function(oData, formated, formatLength) {
  1123. return this._getFormatedDateTime(oData, formated, formatLength, this.REQUESTED_TIME, true);
  1124. };
  1125. /**
  1126. Returns report's actual execution time from the JSON reponse
  1127. @formated {boolean} - should the response be formated
  1128. @formatLength {string} - if the response is to be formated, then specify the length of the formar (short|medium|long)
  1129. **/
  1130. ContentStoreObject.prototype.getExecutionTime = function(oData, formated, formatLength) {
  1131. return this._getFormatedDateTime(oData, formated, formatLength, this.EXECUTION_TIME, true);
  1132. };
  1133. /**
  1134. Returns report's actual completion time from the JSON reponse
  1135. @formated {boolean} - should the response be formated
  1136. @formatLength {string} - if the response is to be formated, then specify the length of the formar (short|medium|long)
  1137. **/
  1138. ContentStoreObject.prototype.getCompletionTime = function(oData, formated, formatLength) {
  1139. return this._getFormatedDateTime(oData, formated, formatLength, this.COMPLETION_TIME, true);
  1140. };
  1141. /**
  1142. Returns the creation date (no time) from the JSON reponse. Used for backwards compatibility.
  1143. @formated {boolean} - should the response be formated
  1144. @formatLength {string} - if the response is to be formated, then specify the length of the formar (short|medium|long)
  1145. **/
  1146. ContentStoreObject.prototype.getCreationTime = function(oData, formated, formatLength) {
  1147. return this._getFormatedDateTime(oData, formated, formatLength, this.CREATION_TIME, false);
  1148. };
  1149. /**
  1150. Returns the creation time from the JSON reponse
  1151. @formated {boolean} - should the response be formated
  1152. @formatLength {string} - if the response is to be formated, then specify the length of the formar (short|medium|long)
  1153. @includeTime {boolean} - should the formated response include the time
  1154. **/
  1155. ContentStoreObject.prototype.getCreationDate = function(oData, formated, formatLength, includeTime) {
  1156. return this._getFormatedDateTime(oData, formated, formatLength, this.CREATION_TIME, includeTime);
  1157. };
  1158. /**
  1159. Returns the modification time from the JSON reponse
  1160. @formated {boolean} - should the response be formated
  1161. @formatLength {string} - if the response is to be formated, then specify the length of the formar (short|medium|long)
  1162. **/
  1163. ContentStoreObject.prototype.getModificationTime = function(oData, formated, formatLength, includeTime) {
  1164. return this._getFormatedDateTime(oData, formated, formatLength, this.MODIFICATION_TIME, includeTime);
  1165. };
  1166. ContentStoreObject.prototype.getRunHistoryConfig = function(oData) {
  1167. return this._getRetentionPropertyInfo('history', oData);
  1168. };
  1169. ContentStoreObject.prototype.getReportOutputVersionsConfig = function(oData) {
  1170. return this._getRetentionPropertyInfo('reportVersion', oData);
  1171. };
  1172. ContentStoreObject.prototype._getRetentionPropertyInfo = function(propertyName, oData) {
  1173. if (!oData.retentions) {
  1174. return null;
  1175. }
  1176. var length = oData.retentions.length;
  1177. for (var i = 0; i < length; i += 1) {
  1178. if (oData.retentions[i].objectClass === propertyName) {
  1179. return oData.retentions[i];
  1180. }
  1181. }
  1182. return null;
  1183. };
  1184. ContentStoreObject.prototype.getLocation = function(oData, appendDefaultName) {
  1185. var ancestors = this.getAncestors(oData);
  1186. if (!ancestors) {
  1187. return null;
  1188. }
  1189. var ancestorNames = [];
  1190. ancestors.forEach(function(ancestor) {
  1191. ancestorNames.push(ancestor.defaultName);
  1192. });
  1193. if (appendDefaultName && this.getName(oData)) {
  1194. ancestorNames.push(this.getName(oData));
  1195. }
  1196. return ancestorNames.join(' > ');
  1197. };
  1198. ContentStoreObject.prototype.getName = function(oData) {
  1199. return oData[this.DEFAULT_NAME];
  1200. };
  1201. ContentStoreObject.prototype.hasBase = function(oData) {
  1202. // search results return base as a 'reference'
  1203. return this.getBase(oData) || (oData[this.REFERENCES] && oData[this.REFERENCES][0]);
  1204. };
  1205. ContentStoreObject.prototype.getBase = function(oData) {
  1206. return oData[this.BASE] && oData[this.BASE][0] || null;
  1207. };
  1208. ContentStoreObject.prototype.getPermissionsAndBasePermissions = function (oData, fetch, refresh) {
  1209. if (fetch) {
  1210. if (!refresh && oData[this.PERMISSIONS] && this.getBasePermissions(oData)) {
  1211. return Promise.resolve({
  1212. permissions: oData[this.PERMISSIONS],
  1213. base: oData[this.BASE]
  1214. });
  1215. } else {
  1216. return this.glassContext.getCoreSvc('.Ajax').ajax({
  1217. 'url': this.getSelfLink(oData) + '?fields=permissions,base.permissions',
  1218. 'dataType': 'json',
  1219. 'type': 'GET'
  1220. })
  1221. .then(function(response) {
  1222. var data = response.data;
  1223. return {
  1224. permissions: data.data[0].permissions,
  1225. base: data.data[0].base
  1226. };
  1227. });
  1228. }
  1229. } else {
  1230. if (oData) {
  1231. return {
  1232. permissions: oData[this.PERMISSIONS],
  1233. base: oData[this.BASE]
  1234. };
  1235. }
  1236. return null;
  1237. }
  1238. };
  1239. ContentStoreObject.prototype.getPermissionsOwnerIdAndBasePermissions = function (oData, fetch, refresh) {
  1240. if (fetch) {
  1241. if (!refresh && oData[this.PERMISSIONS] && this.getOwnerId(oData) && this.getBasePermissions(oData)) {
  1242. return Promise.resolve({
  1243. permissions: oData[this.PERMISSIONS],
  1244. owner: oData[this.OWNER],
  1245. base: oData[this.BASE]
  1246. });
  1247. } else {
  1248. return this.glassContext.getCoreSvc('.Ajax').ajax({
  1249. 'url': this.getSelfLink(oData) + '?fields=permissions,owner.id,base.permissions',
  1250. 'dataType': 'json',
  1251. 'type': 'GET'
  1252. })
  1253. .then(function(response) {
  1254. var data = response.data;
  1255. return {
  1256. permissions: data.data[0].permissions,
  1257. owner: data.data[0].owner,
  1258. base: data.data[0].base
  1259. };
  1260. });
  1261. }
  1262. } else {
  1263. if (oData) {
  1264. return {
  1265. permissions: oData[this.PERMISSIONS],
  1266. owner: oData[this.OWNER],
  1267. base: oData[this.BASE]
  1268. };
  1269. }
  1270. return null;
  1271. }
  1272. };
  1273. ContentStoreObject.prototype.getPermissionsAndMetadataModelPackageEffectiveUserCapabilities = function (oData, fetch) {
  1274. if (fetch) {
  1275. if (oData[this.PERMISSIONS] && this.getMetadataModelPackageEffectiveUserCapabilities(oData)) {
  1276. return Promise.resolve({
  1277. permissions: oData[this.PERMISSIONS],
  1278. metadataModelPackage: oData[this.METADATA_MODEL_PACKAGE]
  1279. });
  1280. } else {
  1281. return this.glassContext.getCoreSvc('.Ajax').ajax({
  1282. 'url': this.getSelfLink(oData) + '?fields=permissions,metadataModelPackage.effectiveUserCapabilities',
  1283. 'dataType': 'json',
  1284. 'type': 'GET'
  1285. })
  1286. .then(function(response) {
  1287. var data = response.data;
  1288. return {
  1289. permissions: data.data[0].permissions,
  1290. metadataModelPackage: data.data[0].metadataModelPackage
  1291. };
  1292. });
  1293. }
  1294. } else {
  1295. if (oData) {
  1296. return {
  1297. permissions: oData[this.PERMISSIONS],
  1298. metadataModelPackage: oData[this.METADATA_MODEL_PACKAGE]
  1299. };
  1300. }
  1301. return null;
  1302. }
  1303. };
  1304. ContentStoreObject.prototype.getPermissionsOwnerIdAndMetadataModelPackageEffectiveUserCapabilities = function (oData, fetch) {
  1305. if (fetch) {
  1306. if (oData[this.PERMISSIONS] && this.getOwnerId(oData) && this.getMetadataModelPackageEffectiveUserCapabilities(oData)) {
  1307. return Promise.resolve({
  1308. permissions: oData[this.PERMISSIONS],
  1309. owner: oData[this.OWNER],
  1310. metadataModelPackage: oData[this.METADATA_MODEL_PACKAGE]
  1311. });
  1312. } else {
  1313. return this.glassContext.getCoreSvc('.Ajax').ajax({
  1314. 'url': this.getSelfLink(oData) + '?fields=permissions,owner.id,metadataModelPackage.effectiveUserCapabilities',
  1315. 'dataType': 'json',
  1316. 'type': 'GET'
  1317. })
  1318. .then(function(response) {
  1319. var data = response.data;
  1320. return {
  1321. permissions: data.data[0].permissions,
  1322. owner: data.data[0].owner,
  1323. metadataModelPackage: data.data[0].metadataModelPackage
  1324. };
  1325. });
  1326. }
  1327. } else {
  1328. if (oData) {
  1329. return {
  1330. permissions: oData[this.PERMISSIONS],
  1331. owner: oData[this.OWNER],
  1332. metadataModelPackage: oData[this.METADATA_MODEL_PACKAGE]
  1333. };
  1334. }
  1335. return null;
  1336. }
  1337. };
  1338. ContentStoreObject.prototype.getPermissionsAndCapabilities = function (oData, fetch) {
  1339. if (fetch) {
  1340. if (oData[this.PERMISSIONS] && oData[this.EFFECTIVE_USER_CAPABILITIES]) {
  1341. return Promise.resolve({
  1342. permissions: oData[this.PERMISSIONS],
  1343. effectiveUserCapabilities: oData[this.EFFECTIVE_USER_CAPABILITIES]
  1344. });
  1345. } else {
  1346. return this.glassContext.getCoreSvc('.Ajax').ajax({
  1347. 'url': this.getSelfLink(oData) + '?fields=permissions,effectiveUserCapabilities',
  1348. 'dataType': 'json',
  1349. 'type': 'GET'
  1350. })
  1351. .then(function(response) {
  1352. var data = response.data;
  1353. return {
  1354. permissions: data.data[0].permissions,
  1355. effectiveUserCapabilities: data.data[0].effectiveUserCapabilities
  1356. };
  1357. });
  1358. }
  1359. } else {
  1360. if (oData) {
  1361. return {
  1362. permissions: oData[this.PERMISSIONS],
  1363. effectiveUserCapabilities: oData[this.EFFECTIVE_USER_CAPABILITIES]
  1364. };
  1365. }
  1366. return null;
  1367. }
  1368. };
  1369. ContentStoreObject.prototype.getPermissionsOwnerIdAndCapabilities = function (oData, fetch) {
  1370. if (fetch) {
  1371. if (oData[this.PERMISSIONS] && this.getOwnerId(oData) && oData[this.EFFECTIVE_USER_CAPABILITIES]) {
  1372. return Promise.resolve({
  1373. permissions: oData[this.PERMISSIONS],
  1374. owner: oData[this.OWNER],
  1375. effectiveUserCapabilities: oData[this.EFFECTIVE_USER_CAPABILITIES]
  1376. });
  1377. } else {
  1378. return this.glassContext.getCoreSvc('.Ajax').ajax({
  1379. 'url': this.getSelfLink(oData) + '?fields=permissions,owner.id,effectiveUserCapabilities',
  1380. 'dataType': 'json',
  1381. 'type': 'GET'
  1382. })
  1383. .then(function(response) {
  1384. var data = response.data;
  1385. return {
  1386. permissions: data.data[0].permissions,
  1387. owner: data.data[0].owner,
  1388. effectiveUserCapabilities: data.data[0].effectiveUserCapabilities
  1389. };
  1390. });
  1391. }
  1392. } else {
  1393. if (oData) {
  1394. return {
  1395. permissions: oData[this.PERMISSIONS],
  1396. owner: oData[this.OWNER],
  1397. effectiveUserCapabilities: oData[this.EFFECTIVE_USER_CAPABILITIES]
  1398. };
  1399. }
  1400. return null;
  1401. }
  1402. };
  1403. ContentStoreObject.prototype.getPermissions = function(oData, fetch) {
  1404. if (fetch) {
  1405. if (oData[this.PERMISSIONS]) {
  1406. return Promise.resolve(oData[this.PERMISSIONS]);
  1407. } else {
  1408. return this.glassContext.getCoreSvc('.Ajax').ajax({
  1409. 'url': this.getSelfLink(oData) + '?fields=permissions',
  1410. 'dataType': 'json',
  1411. 'type': 'GET'
  1412. })
  1413. .then(function(response) {
  1414. var data = response.data;
  1415. return data.data[0].permissions;
  1416. });
  1417. }
  1418. } else {
  1419. return oData ? oData[this.PERMISSIONS] : null;
  1420. }
  1421. };
  1422. ContentStoreObject.prototype.getDefaultPortalAction = function(oData, fetch) {
  1423. if (fetch) {
  1424. if (oData[this.DEFAULT_PORTAL_ACTION]) {
  1425. return Promise.resolve(oData[this.DEFAULT_PORTAL_ACTION]);
  1426. } else {
  1427. return this.glassContext.getCoreSvc('.Ajax').ajax({
  1428. url: this.getSelfLink(oData) + '?fields=defaultPortalAction',
  1429. dataType: 'json',
  1430. type: 'GET'
  1431. })
  1432. .then(function(response) {
  1433. var data = response.data;
  1434. return data.data[0].defaultPortalAction;
  1435. });
  1436. }
  1437. } else {
  1438. return oData ? oData[this.DEFAULT_PORTAL_ACTION] : null;
  1439. }
  1440. };
  1441. ContentStoreObject.prototype.getTargetDefaultPortalAction = function(oData, fetch) {
  1442. if (fetch) {
  1443. if (oData[this.DEFAULT_PORTAL_ACTION]) {
  1444. return Promise.resolve(oData[this.DEFAULT_PORTAL_ACTION]);
  1445. } else {
  1446. return this.glassContext.getCoreSvc('.Ajax').ajax({
  1447. url: this.getSelfLink(oData) + '?fields=target.defaultPortalAction',
  1448. dataType: 'json',
  1449. type: 'GET'
  1450. })
  1451. .then(function(response) {
  1452. var data = response.data;
  1453. return data.data[0].target[0].defaultPortalAction;
  1454. });
  1455. }
  1456. } else {
  1457. return oData ? oData[this.DEFAULT_PORTAL_ACTION] : null;
  1458. }
  1459. };
  1460. ContentStoreObject.prototype.getTargetFileNameFromSearchPath = function(searchPath) {
  1461. if (searchPath){
  1462. var splitPath = searchPath.split('/');
  1463. if (splitPath.length > 0) {
  1464. splitPath = splitPath[splitPath.length -1].split('\'');
  1465. return splitPath[1];
  1466. }
  1467. }
  1468. return null;
  1469. };
  1470. ContentStoreObject.prototype.getTargetSearchPath = function(oData, fetch) {
  1471. if (fetch) {
  1472. if (oData.target && oData.target.length && oData.target[0].searchPath) {
  1473. return Promise.resolve(oData.target[0]);
  1474. }
  1475. return this.glassContext.getCoreSvc('.Ajax').ajax({
  1476. url: this.getSelfLink(oData) + '?fields=target.searchPath',
  1477. dataType: 'json',
  1478. type: 'GET'
  1479. })
  1480. .then(function(response) {
  1481. var data = response.data;
  1482. if (data.data && data.data.length && data.data[0].target && data.data[0].target.length) {
  1483. return data.data[0].target[0];
  1484. }
  1485. });
  1486. } else {
  1487. if (oData && oData.target && oData.target.length) {
  1488. return oData.target[0];
  1489. }
  1490. }
  1491. return null;
  1492. };
  1493. ContentStoreObject.prototype.hasPermissions = function(oData, permissionsArray) {
  1494. var oPermArray = this.getPermissions(oData);
  1495. if (!oPermArray) {
  1496. return false;
  1497. }
  1498. return _.intersection(oPermArray, permissionsArray).length === permissionsArray.length;
  1499. };
  1500. /**
  1501. * Returns true if the given asset has the given tag
  1502. * @return {boolean}
  1503. */
  1504. ContentStoreObject.prototype.hasTag = function(oData, tag) {
  1505. return !!(oData[this.TAGS] && oData[this.TAGS].indexOf(tag) !== -1);
  1506. };
  1507. ContentStoreObject.prototype.getDescription = function(oData) {
  1508. var description = oData[this.DEFAULT_DESCRIPTION];
  1509. if (_.isEmpty(description)) {
  1510. var base = this.getBase(oData);
  1511. if (base) {
  1512. description = base[this.DEFAULT_DESCRIPTION];
  1513. }
  1514. }
  1515. return description;
  1516. };
  1517. ContentStoreObject.prototype.getReportRetentions = function(oData) {
  1518. if (oData.retentions === null || $.isEmptyObject(oData.retentions)) {
  1519. oData.retentions = [];
  1520. }
  1521. return oData.retentions;
  1522. };
  1523. ContentStoreObject.prototype.getOptions = function(oData) {
  1524. if (oData[this.OPTIONS] === null || $.isEmptyObject(oData[this.OPTIONS])) {
  1525. oData[this.OPTIONS] = [];
  1526. }
  1527. return oData[this.OPTIONS];
  1528. };
  1529. ContentStoreObject.prototype.getOption = function(oData, name) {
  1530. var options = this.getOptions(oData);
  1531. if (options) {
  1532. for (var i = 0; i < options.length; i = i + 1) {
  1533. if (options[i].name === name) {
  1534. if (options[i].value instanceof Array) {
  1535. return options[i].value[0];
  1536. }
  1537. return options[i].value;
  1538. }
  1539. }
  1540. }
  1541. return null;
  1542. };
  1543. ContentStoreObject.prototype.getRunAsOwner = function(oData) {
  1544. return oData[this.RUN_AS_OWNER] || false;
  1545. };
  1546. ContentStoreObject.prototype.getRunWithOwnerCapabilities = function(oData) {
  1547. return oData[this.RUN_WITH_OWNER_CAPABILITIES] || false;
  1548. };
  1549. /**
  1550. * Returns the ContentStoreObject associated with the report property
  1551. */
  1552. ContentStoreObject.prototype.getRunAsOwnerValue = function(oData) {
  1553. var runAsOwnerValue = this.getRunWithOwnerCapabilities(oData) ? this.RUN_WITH_OWNER_CAPABILITIES : this.RUN_AS_USER;
  1554. runAsOwnerValue = this.getRunAsOwner(oData) ? this.RUN_AS_OWNER : runAsOwnerValue;
  1555. return runAsOwnerValue;
  1556. };
  1557. ContentStoreObject.prototype.getStatus = function(oData) {
  1558. return oData[this.STATUS] || false;
  1559. };
  1560. ContentStoreObject.prototype.getMessages = function(oData) {
  1561. return oData[this.MESSAGES] || false;
  1562. };
  1563. ContentStoreObject.prototype.getMessageDetail = function(oData) {
  1564. return oData[this.MESSAGES_DETAIL] || false;
  1565. };
  1566. ContentStoreObject.prototype.getMessageSeverity = function(oData) {
  1567. return oData[this.MESSAGES_SEVERITY] || false;
  1568. };
  1569. ContentStoreObject.prototype.getFormat = function(oData) {
  1570. return oData[this.FORMAT] || false;
  1571. };
  1572. ContentStoreObject.prototype.getLocale = function(oData) {
  1573. return oData[this.LOCALE] || false;
  1574. };
  1575. ContentStoreObject.prototype.getBurstKey = function(oData) {
  1576. return oData[this.BURSTKEY] || false;
  1577. };
  1578. ContentStoreObject.prototype.getHidden = function(oData) {
  1579. var hidden = oData[this.HIDDEN] ? oData[this.HIDDEN].toString() : 'false';
  1580. return hidden.toLowerCase() === 'true';
  1581. };
  1582. ContentStoreObject.prototype.getDisabled = function(oData) {
  1583. var disabled = oData[this.DISABLED] ? oData[this.DISABLED].toString() : 'false';
  1584. var isTargetDisabled = this.isTargetDisabled(oData);
  1585. return disabled.toLowerCase() === 'true' || isTargetDisabled;
  1586. };
  1587. ContentStoreObject.prototype.isTargetDisabled = function(oData) {
  1588. if (oData.target && oData.target.length && oData.target[0]) {
  1589. return oData.target[0][this.DISABLED];
  1590. }
  1591. return false;
  1592. };
  1593. ContentStoreObject.prototype.getAncestors = function(oData) {
  1594. if (!oData[this.ANCESTORS] || oData[this.ANCESTORS].length === 0) {
  1595. return null;
  1596. }
  1597. // We hide the fact that My content is My Folders, so trim all those ancestors
  1598. var rootAncestor = oData[this.ANCESTORS][0];
  1599. if (rootAncestor.type) {
  1600. var rootType = rootAncestor.type.toLowerCase();
  1601. if (rootType === 'directory' && rootAncestor.id !== '.my_folders') {
  1602. do {
  1603. rootAncestor = oData[this.ANCESTORS].shift();
  1604. } while (oData[this.ANCESTORS].length > 0 && oData[this.ANCESTORS][0].type !== 'folder');
  1605. oData[this.ANCESTORS][0] = (this.getRootMyFoldersAncestors());
  1606. } else if (rootType === 'content') {
  1607. oData[this.ANCESTORS][0] = (this.getRootPublicFoldersAncestor());
  1608. }
  1609. }
  1610. return oData[this.ANCESTORS];
  1611. };
  1612. ContentStoreObject.prototype.ancestorsEqual = function(ancestor1, ancestor2) {
  1613. if (!ancestor1 || !ancestor2) {
  1614. return false;
  1615. }
  1616. if (ancestor1.length !== ancestor2.length) {
  1617. return false;
  1618. }
  1619. for (var i = 0; i < ancestor1.length; i = i + 1) {
  1620. if (ancestor1[i].id !== ancestor2[i].id) {
  1621. return false;
  1622. }
  1623. }
  1624. return true;
  1625. };
  1626. ContentStoreObject.prototype.getHistoryConfig = function(oData) {
  1627. return oData[this.HISTORY] && JSON.parse(oData[this.HISTORY]);
  1628. };
  1629. ContentStoreObject.prototype.getDataDescriptor = function(oData) {
  1630. return oData && oData.dataDescriptor || {};
  1631. };
  1632. ContentStoreObject.prototype.buildAncestorEntry = function(oData) {
  1633. var ancestorEntry = {};
  1634. ancestorEntry[this.ID] = oData[this.ID];
  1635. if (this._isUserFolder(oData)) {
  1636. ancestorEntry[this.DEFAULT_NAME] = this._getUserFolderName(oData);
  1637. } else {
  1638. ancestorEntry[this.DEFAULT_NAME] = oData[this.DEFAULT_NAME];
  1639. }
  1640. if (oData[this.META]) {
  1641. ancestorEntry[this.META] = oData[this.META];
  1642. } else {
  1643. // Mostly for search
  1644. var selfLink = this.getSelfLink(oData);
  1645. var url = this.getItemsLink(oData);
  1646. if (!url) {
  1647. url = selfLink + '/items';
  1648. }
  1649. ancestorEntry[this.META] = this._buildMetaSection(url, selfLink);
  1650. }
  1651. ancestorEntry[this.TYPE] = oData[this.TYPE];
  1652. ancestorEntry[this.PERMISSIONS] = oData[this.PERMISSIONS];
  1653. return ancestorEntry;
  1654. };
  1655. ContentStoreObject.prototype.buildAncestorTree = function(oData) {
  1656. var ancestors = [];
  1657. if (oData[this.ANCESTORS]) {
  1658. _.each(this.getAncestors(oData), function(ancestor) {
  1659. ancestors.push(this.buildAncestorEntry(ancestor));
  1660. }.bind(this));
  1661. ancestors.push(this.buildAncestorEntry(oData));
  1662. }
  1663. return ancestors;
  1664. };
  1665. ContentStoreObject.prototype._buildMetaSection = function(url, selfUrl) {
  1666. var items = {};
  1667. items[this.MIME_TYPE] = 'application/json';
  1668. items[this.URL] = url;
  1669. var self = {};
  1670. self[this.MIME_TYPE] = 'application/json';
  1671. self[this.URL] = selfUrl;
  1672. var links = {};
  1673. links[this.ITEMS] = items;
  1674. links[this.SELF] = self;
  1675. var meta = {};
  1676. meta[this.LINKS] = links;
  1677. return meta;
  1678. };
  1679. ContentStoreObject.prototype.getRootPublicFoldersAncestor = function() {
  1680. var rootPublicFolderName = ContentServiceUrls.getRootPublicFolderName();
  1681. var publicFolderUrl = ContentServiceUrls.getPublicFoldersURL();
  1682. var ancestorEntry = {};
  1683. ancestorEntry[this.ID] = '.public_folders';
  1684. ancestorEntry[this.DEFAULT_NAME] = rootPublicFolderName ? rootPublicFolderName : StringResource.get('teamContent');
  1685. ancestorEntry[this.META] = this._buildMetaSection(publicFolderUrl + '/items', publicFolderUrl);
  1686. ancestorEntry[this.TYPE] = 'content';
  1687. return ancestorEntry;
  1688. };
  1689. ContentStoreObject.prototype.getRootMyFoldersAncestors = function() {
  1690. var rootMyFoldersName = ContentServiceUrls.getRootMyFolderName();
  1691. var myFoldersUrl = ContentServiceUrls.getMyFoldersURL();
  1692. var ancestorEntry = {};
  1693. ancestorEntry[this.ID] = '.my_folders';
  1694. ancestorEntry[this.DEFAULT_NAME] = rootMyFoldersName ? rootMyFoldersName : StringResource.get('myContent');
  1695. ancestorEntry[this.META] = this._buildMetaSection(myFoldersUrl + '/items', myFoldersUrl);
  1696. ancestorEntry[this.TYPE] = 'directory';
  1697. return ancestorEntry;
  1698. };
  1699. ContentStoreObject.prototype.getRootOtherUsersFoldersAncestors = function(options) {
  1700. var ancestorEntry = {};
  1701. ancestorEntry[this.ID] = '.other_users_folders';
  1702. ancestorEntry[this.DEFAULT_NAME] = options.defaultName || '';
  1703. var url = ContentServiceUrls.getOtherUsersFoldersURL();
  1704. ancestorEntry[this.META] = this._buildMetaSection(url + '/items', url);
  1705. ancestorEntry[this.TYPE] = 'folder';
  1706. return ancestorEntry;
  1707. };
  1708. ContentStoreObject.prototype.getRootNamespacesAncestors = function() {
  1709. var baseNamespaceUrl = ContentServiceUrls.getBaseNamespaceURL();
  1710. var ancestorEntry = {};
  1711. ancestorEntry[this.ID] = '.directory';
  1712. ancestorEntry[this.DEFAULT_NAME] = StringResource.get('directory');
  1713. ancestorEntry[this.META] = this._buildMetaSection(baseNamespaceUrl, baseNamespaceUrl);
  1714. ancestorEntry[this.TYPE] = 'directory';
  1715. return ancestorEntry;
  1716. };
  1717. ContentStoreObject.prototype.getExecutionPrompt = function(oData) {
  1718. return (oData[this.EXECUTION_PROMPT]!==undefined) ? oData[this.EXECUTION_PROMPT] : true;
  1719. };
  1720. ContentStoreObject.prototype.getOptionValue = function(oData, optionName, defaultValue) {
  1721. var foundOption = _.find(oData.options, function(option) {
  1722. return (option.name === optionName);
  1723. });
  1724. return foundOption === undefined? defaultValue : foundOption.value;
  1725. };
  1726. ContentStoreObject.prototype.getParameters = function(oData) {
  1727. return oData[this.PARAMETERS] || [];
  1728. };
  1729. ContentStoreObject.prototype.getAllowNotification = function(oData){
  1730. return oData[this.OPTION_ENABLE_ALLOW_NOTIFICATION] || null;
  1731. };
  1732. ContentStoreObject.prototype.getPromptsDisplayValues = function(parameters, forWrapText) {
  1733. var i;
  1734. var values = [];
  1735. if (parameters) {
  1736. for (i = 0; i < parameters.length; i = i + 1) {
  1737. var value = parameters[i].value;
  1738. var displayValue = '';
  1739. for (var j = 0; j < value.length; j = j + 1) {
  1740. if (j === 0) {
  1741. displayValue = displayValue + this.buildPromptsDisplayValues(value[j]);
  1742. } else {
  1743. if (forWrapText) {
  1744. displayValue = displayValue + ', ' + this.buildPromptsDisplayValues(value[j]);
  1745. } else {
  1746. displayValue = displayValue + ',' + this.buildPromptsDisplayValues(value[j]);
  1747. }
  1748. }
  1749. }
  1750. values.push({
  1751. 'name': parameters[i].name,
  1752. 'display': displayValue
  1753. });
  1754. }
  1755. }
  1756. return values;
  1757. };
  1758. ContentStoreObject.prototype.buildPromptsDisplayValues = function(value) {
  1759. var displayValue;
  1760. var use = value.use ? value.use : null;
  1761. if (value.type === 'simpleParmValueItem') {
  1762. displayValue = ((typeof value.display === 'undefined') || (value.display === '')) ? use : value.display;
  1763. } else if (value.type === 'boundRangeParmValueItem') {
  1764. if (value.start || value.end) {
  1765. displayValue = StringResource.get('between');
  1766. if (value.start) {
  1767. displayValue += ' ';
  1768. displayValue += ((typeof value.start.display === 'undefined') || (value.start.display === '')) ? value.start.use : value.start.display;
  1769. displayValue += ' ';
  1770. } else {
  1771. displayValue += ' ';
  1772. }
  1773. displayValue += StringResource.get('and');
  1774. if (value.end) {
  1775. displayValue += ' ';
  1776. displayValue += ((typeof value.end.display === 'undefined') || (value.end.display === '')) ? value.end.use : value.end.display;
  1777. }
  1778. }
  1779. } else if (value.type === 'unboundedEndRangeParmValueItem') {
  1780. if (value.start) {
  1781. var upperboundValue = ((typeof value.start.display === 'undefined') || (value.start.display === '')) ? value.start.use : value.start.display;
  1782. displayValue = StringResource.get('greaterOrEqual', {
  1783. 'upperboundValue' : upperboundValue
  1784. });
  1785. }
  1786. } else if (value.type === 'unboundedStartRangeParmValueItem') {
  1787. if (value.end) {
  1788. var lowerboundValue = ((typeof value.end.display === 'undefined') || (value.end.display === '')) ? value.end.use : value.end.display;
  1789. displayValue = StringResource.get('lessOrEqual', {
  1790. 'lowerboundValue' : lowerboundValue
  1791. });
  1792. }
  1793. }
  1794. return displayValue;
  1795. };
  1796. ContentStoreObject.prototype.getModule = function(oData) {
  1797. return oData[this.MODULE] && oData[this.MODULE][0] || null;
  1798. };
  1799. ContentStoreObject.prototype.getMetadataModelPackage = function(oData) {
  1800. return oData[this.METADATA_MODEL_PACKAGE] && oData[this.METADATA_MODEL_PACKAGE][0] || null;
  1801. };
  1802. ContentStoreObject.prototype.getBaseMetadataModelPackage = function(oData) {
  1803. var baseMetaDataModelPackage = oData[this.BASE] && oData[this.BASE][0] && oData[this.BASE][0][this.METADATA_MODEL_PACKAGE];
  1804. return baseMetaDataModelPackage && baseMetaDataModelPackage[0] || null;
  1805. };
  1806. ContentStoreObject.prototype.getBasePermissions = function (oData) {
  1807. if (oData[this.BASE] && oData[this.BASE][0] && oData[this.BASE][0][this.PERMISSIONS]) {
  1808. return oData[this.BASE][0][this.PERMISSIONS];
  1809. }
  1810. return null;
  1811. };
  1812. ContentStoreObject.prototype.getMetadataModelPackageEffectiveUserCapabilities = function (oData) {
  1813. if (oData[this.METADATA_MODEL_PACKAGE] && oData[this.METADATA_MODEL_PACKAGE][0] && oData[this.METADATA_MODEL_PACKAGE][0][this.EFFECTIVE_USER_CAPABILITIES]) {
  1814. return oData[this.METADATA_MODEL_PACKAGE][0][this.EFFECTIVE_USER_CAPABILITIES];
  1815. }
  1816. return null;
  1817. };
  1818. ContentStoreObject.prototype.getBaseModule = function(oData) {
  1819. var baseModule = oData[this.BASE] && oData[this.BASE][0] && oData[this.BASE][0][this.MODULE];
  1820. return baseModule && baseModule[0] || null;
  1821. };
  1822. ContentStoreObject.prototype.getRunInAdvancedViewer = function(oData) {
  1823. return !!oData[this.RUN_IN_ADVANCED_VIEWER];
  1824. };
  1825. ContentStoreObject.prototype.getEffectiveUserCapabilities = function(oData, fetch) {
  1826. if (fetch) {
  1827. if (oData[this.EFFECTIVE_USER_CAPABILITIES]) {
  1828. return Promise.resolve(oData[this.EFFECTIVE_USER_CAPABILITIES]);
  1829. } else {
  1830. return this.glassContext.getCoreSvc('.Ajax').ajax({
  1831. 'url': this.getSelfLink(oData) + '?fields=effectiveUserCapabilities',
  1832. 'dataType': 'json',
  1833. 'type': 'GET'
  1834. }).then(function(response) {
  1835. var data = response.data;
  1836. oData[this.EFFECTIVE_USER_CAPABILITIES] = data.data[0].effectiveUserCapabilities;
  1837. return oData[this.EFFECTIVE_USER_CAPABILITIES];
  1838. }.bind(this));
  1839. }
  1840. } else {
  1841. return oData ? oData[this.EFFECTIVE_USER_CAPABILITIES] : null;
  1842. }
  1843. };
  1844. ContentStoreObject.prototype.hasCapabilities = function (oData, capabilitiesArray) {
  1845. var oCapabilitiesArray = this.getEffectiveUserCapabilities(oData);
  1846. if (!oCapabilitiesArray) {
  1847. return false;
  1848. }
  1849. return _.intersection(oCapabilitiesArray, capabilitiesArray).length === capabilitiesArray.length;
  1850. };
  1851. ContentStoreObject.prototype.canBurst = function(oData) {
  1852. var base = this.getBase(oData);
  1853. return oData.canBurst || (base && base.canBurst);
  1854. };
  1855. var _static = {
  1856. getInstance: function() {
  1857. if (!_singletonInstance) {
  1858. _singletonInstance = new ContentStoreObject();
  1859. }
  1860. return _singletonInstance;
  1861. }
  1862. };
  1863. return _static.getInstance();
  1864. });
  1865. !function(a,s){if("object"==typeof exports&&"object"==typeof module)module.exports=s(require("@ba-ui-toolkit/ba-graphics/dist/illustrations-js/ba-graphics-icons-commons.js"));else if("function"==typeof define&&define.amd)define('bacontentnav/lib/@ba-ui-toolkit/ba-graphics/dist/illustrations-js/no-detail_128',["@ba-ui-toolkit/ba-graphics/dist/illustrations-js/ba-graphics-icons-commons.js"],s);else{var t=s("object"==typeof exports?require("@ba-ui-toolkit/ba-graphics/dist/illustrations-js/ba-graphics-icons-commons.js"):a["@ba-ui-toolkit/ba-graphics/dist/illustrations-js/ba-graphics-icons-commons.js"]);for(var c in t)("object"==typeof exports?exports:a)[c]=t[c]}}("undefined"!=typeof self?self:this,function(a){return webpackJsonPBaGraphics([68],{"3865314c5959606874d4":function(s,t){s.exports=a},"81b6137299c348072845":function(a,s,t){"use strict";var c=t("9689a9c94ae38b47fa2c"),i=t.n(c),h=t("9ce58a7deea14f49ef01"),r=t.n(h),l=new i.a({id:"no-detail_128_v7",use:"no-detail_128_v7-usage",viewBox:"0 0 200 200",content:'<symbol xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 200" id="no-detail_128_v7"><circle class="ba-graphics-neutral-white4" cx="100" cy="100" r="100" /><path class="ba-graphics-white" d="M14.97 170.08h135.66" /><path class="ba-graphics-gray60" d="M150.63 172.08H15a2 2 0 110-4h135.63a2 2 0 010 4z" /><path class="ba-graphics-white" d="M2 170.08h4.97" /><path class="ba-graphics-gray60" d="M7 172.08H2a2 2 0 010-4h5a2 2 0 010 4z" /><path class="ba-graphics-white" d="M179.03 170.08H198" /><path class="ba-graphics-gray60" d="M198 172.08h-19a2 2 0 010-4h19a2 2 0 010 4z" /><rect class="ba-graphics-gray80" style="opacity:.1" x="79.35" y="45.75" width="87.73" height="107.48" rx="4" transform="rotate(6.89 123.277 99.528)" /><rect class="ba-graphics-white" x="76.15" y="41.66" width="87.73" height="107.48" rx="4" transform="rotate(6.89 120.115 95.467)" /><path class="ba-graphics-gray60" d="M86.4 37.24v3.82l79.15 9.57a.18.18 0 01.16.2l-12 98.76a.18.18 0 01-.19.16l-79.15-9.57a.17.17 0 01-.15-.2l12.01-98.76a.18.18 0 01.17-.16v-3.82m0 0a4 4 0 00-4 3.52l-12 98.76A4 4 0 0074 144l79.15 9.57a3.87 3.87 0 00.48 0 4 4 0 004-3.52l11.94-98.76a4 4 0 00-3.57-4.45l-79.11-9.57h-.49z" /><path class="ba-graphics-white" d="M97.8 59.92l50.31 6.05" /><path class="ba-graphics-gray40" d="M148.11 68h-.24l-50.31-6a2 2 0 11.48-4l50.31 6a2 2 0 01-.24 4z" /><path class="ba-graphics-white" d="M95.88 75.78l44.61 5.39" /><path class="ba-graphics-gray40" d="M140.49 83.17h-.24l-44.61-5.41a2 2 0 01.48-4l44.61 5.39a2 2 0 01-.24 4z" /><path class="ba-graphics-white" d="M93.97 91.63l47.68 5.77" /><path class="ba-graphics-gray40" d="M141.65 99.4h-.24l-47.68-5.78a2 2 0 11.48-4l47.68 5.76a2 2 0 01-.24 4z" /><path class="ba-graphics-white" d="M90.14 123.35l27.78 3.35" /><path class="ba-graphics-gray40" d="M117.92 128.7h-.24l-27.78-3.37a2 2 0 11.48-4l27.77 3.36a2 2 0 01-.23 4z" /><path class="ba-graphics-white" d="M92.05 107.49l34.35 4.15" /><path class="ba-graphics-gray40" d="M126.4 113.64h-.24l-34.35-4.15a2 2 0 01.48-4l34.35 4.15a2 2 0 01-.24 4z" /><path class="ba-graphics-white" d="M158.63 170.08h12.4" /><path class="ba-graphics-gray60" d="M171 172.08h-12.4a2 2 0 010-4H171a2 2 0 010 4z" /><rect class="ba-graphics-gray80" style="opacity:.1" x="46.02" y="39.26" width="91.22" height="111.76" rx="4" transform="rotate(-7.43 91.57 95.108)" /><rect class="ba-graphics-white" x="41.75" y="35.97" width="91.22" height="111.76" rx="4" transform="rotate(-7.43 87.3 91.815)" /><path class="ba-graphics-gray60" d="M121.91 34.84a.19.19 0 01.18.16l13.41 102.89a.18.18 0 01-.16.2L52.8 148.85a.19.19 0 01-.18-.16L39.21 45.8a.18.18 0 01.16-.2l82.51-10.76m0-3.82a3.12 3.12 0 00-.52 0L38.87 41.81a4 4 0 00-3.45 4.49l13.41 102.88a4 4 0 004 3.49 3.12 3.12 0 00.52 0l82.51-10.75a4 4 0 003.45-4.48L125.87 34.51a4 4 0 00-4-3.49z" /><path class="ba-graphics-white" d="M55.84 61.77l52.24-6.85" /><path class="ba-graphics-gray40" d="M55.84 63.77a2 2 0 01-.26-4l52.24-6.84a2 2 0 01.52 4L56.1 63.75z" /><path class="ba-graphics-white" d="M57.99 78.23l46.32-6.04" /><path class="ba-graphics-gray40" d="M58 80.23a2 2 0 01-.25-4l46.32-6a2 2 0 11.52 4l-46.33 6z" /><path class="ba-graphics-white" d="M60.13 94.7l49.52-6.46" /><path class="ba-graphics-gray40" d="M60.13 96.7a2 2 0 01-.26-4l49.52-6.46a2 2 0 01.52 4l-49.52 6.44z" /><path class="ba-graphics-white" d="M64.43 127.63l28.85-3.76" /><path class="ba-graphics-gray40" d="M64.43 129.63a2 2 0 01-.26-4L93 121.89a2 2 0 01.52 4l-28.85 3.77z" /><path class="ba-graphics-white" d="M62.28 111.17l35.67-4.65" /><path class="ba-graphics-gray40" d="M62.28 113.17a2 2 0 01-.26-4l35.67-4.65a2 2 0 01.52 4l-35.67 4.65z" /><circle class="ba-graphics-gray60" cx="119.33" cy="13.5" r="2" /><circle class="ba-graphics-gray60" cx="26.56" cy="87.62" r="2" /><path class="ba-graphics-gray60" d="M80.16 19.25a2.1 2.1 0 002.09-2.09.52.52 0 011 0 2.1 2.1 0 002.09 2.09.52.52 0 110 1 2.1 2.1 0 00-2.09 2.09.52.52 0 11-1 0 2.1 2.1 0 00-2.09-2.09.52.52 0 110-1z" /></symbol>'});r.a.add(l);s.a=l},"94499d8163892e59406b":function(a,s,t){"use strict";Object.defineProperty(s,"__esModule",{value:!0});var c=t("3865314c5959606874d4"),i=(t.n(c),t("81b6137299c348072845"));s.default=i.a}},["94499d8163892e59406b"])});
  1866. define('text!bacontentnav/config/ca.json',[],function () { return '{\n\t"copyright": "Licensed Materials - Property of IBM. IBM Cognos Products: BI Cloud(C) Copyright IBM Corp. 2017,2021. US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.",\n\t"samples": {\n\t\t"url": "https://www.ibm.com/communities/analytics/cognos-analytics-blog/guide-to-sample-data-sets/"\n\t},\n\t"modulePaths": {\n\t\t"myContent": "bi/content_apps/CAMyContentView",\n\t\t"teamContent": "bi/content_apps/CATeamFoldersView"\n\t},\n\t"contextMenuId": "com.ibm.bi.contentApps.listViewMenu",\n\t"capabilities": {\n\t\t"saveAs": {\n\t\t\t"publicFolder": false,\n\t\t\t"requiresParentWritePermissions": true\n\t\t}\n\t},\n\t"search": {\n\t\t"URL": "v1/search/cm",\n\t\t"savedURL": "v1/users/~/searches",\n\t\t"returnParams": "defaultName|selfUrl|hidden|type|disabled|id|ancestors|snapShotEnabled|iconURI|defaultScreenTip|tags|references",\n\t\t"disabledActions": ["ManageContentAction", "DeleteAction", "ShortcutContentAction"]\n\t},\n\t"sort": {\n\t\t"indexes": {\n\t\t\t"folders": "0",\n\t\t\t"reports": "1",\n\t\t\t"dashboards": "2",\n\t\t\t"data": "3",\n\t\t\t"packages": "4",\n\t\t\t"explorations": "5",\n\t\t\t"stories": "6",\n\t\t\t"notebook": "7",\n\t\t\t"others": "8"\n\t\t}\n\t},\n\t"filter": {\n\t\t"items": ["allContent", "reports", "reportViews", "dashboards", "data", "packages", "explorations", "stories", "folders", "notebook", "jobs", "shortcuts"],\n\t\t"facets": [\n\t\t\t{"msgKey": "folders", "group": "folder"},\n\t\t\t{"msgKey": "dashboards", "group": "dashboard"},\n\t\t\t{"msgKey": "data", "group": "data"},\n\t\t\t{"msgKey": "packages", "group": "packages"},\n\t\t\t{"msgKey": "explorations", "group": "exploration"},\n\t\t\t{"msgKey": "stories", "group": "stories"},\n\t\t\t{"msgKey": "reports", "group": "report"},\n\t\t\t{"msgKey": "reportViews", "group": "reportView"},\n\t\t\t{"msgKey": "notebooks", "group":"notebook"},\n\t\t\t{"msgKey": "jobs", "group": "job"},\n\t\t\t{"msgKey": "shortcuts", "group": "shortcut"}\n\t\t]\n\t},\n\t"uiTypes": {\n\t\t"account": {\n\t\t\t"icon": "#common-user",\n\t\t\t"msgKey": "user",\n\t\t\t"options": ["tenant"]\n\t\t},\n\t\t"adminFolder": {\n\t\t\t"icon": "#common-folder_16",\n\t\t\t"msgKey": "adminFolder",\n\t\t\t"options": ["container"]\n\t\t},\n\t\t"resourceFolder": {\n\t\t\t"icon": "#common-folder_16",\n\t\t\t"msgKey": "resourceFolder",\n\t\t\t"options": ["container"]\n\t\t},\n\t\t"cosConnection": {\n\t\t\t"icon": "#ba_content_nav-cloud_32",\n\t\t\t"msgKey": "cosConnection",\n\t\t\t"options": ["container"]\n\t\t},\n\t\t"cosLocation": {\n\t\t\t"icon": "#ba_content_nav-cloud_32",\n\t\t\t"msgKey": "cosLocation",\n\t\t\t"options": ["container"]\n\t\t},\n\t\t"agentDefinition": {\n\t\t\t"icon": "#common-agent",\n\t\t\t"msgKey": "agent",\n\t\t\t"options": ["content"],\n\t\t\t"properties": "agent"\n\t\t},\n\t\t"agentDefinitionView": {\n\t\t\t"baseTypes": ["agentDefinition"],\n\t\t\t"icon": "#common-agent",\n\t\t\t"msgKey": "agentDefinitionView",\n\t\t\t"options": ["view","decorateIcon","content"],\n\t\t\t"properties": "agentDefinitionView"\n\t\t},\n\t\t"analysis": {\n\t\t\t"groups": ["report"],\n\t\t\t"icon": "#common-analysis_studio_report",\n\t\t\t"msgKey": "analysis",\n\t\t\t"options": ["versions","content"],\n\t\t\t"properties": "report"\n\t\t},\n\t\t"contact": {\n\t "icon": "#email_16",\n\t\t "msgKey": "contact",\n\t\t "options": ["tenant"]\n\t },\n\t\t"content": {\n\t\t\t"icon": "#ba_content_nav-shared_24",\n\t\t\t"msgKey": "content",\n\t\t\t"options": ["container","teamroot","mruDisabled"],\n\t\t\t"properties": "content"\n\t\t},\n\t\t"csv": {\n\t\t\t"derived": "uploadedFile",\n\t\t\t"groups": ["data"],\n\t\t\t"icon": "#common-csv_icon",\n\t\t\t"msgKey": "csv"\n\t\t},\n\t\t"dashboard": {\n\t\t\t"groups": ["dashboard"],\n\t\t\t"icon": "#common-workspace",\n\t\t\t"msgKey": "workspace",\n\t\t\t"options": ["content"],\n\t\t\t"properties": "dashboard"\n\t\t},\n\t\t"dataMovementTask": {\n\t\t\t"icon": "#common-dataMovement",\n\t\t\t"msgKey": "dataMovementTask",\n\t\t\t"options": ["content"]\n\t\t},\n\t\t"dataMovementTaskAlias": {\n\t\t\t"icon": "#common-dataMovement",\n\t\t\t"msgKey": "dataMovementTaskAlias",\n\t\t\t"options": ["content"]\n\t\t},\n\t\t"dataSet": {\n\t\t\t"groups": ["data"],\n\t\t\t"icon": "#common-question-mark",\n\t\t\t"msgKey": "dataSet"\n\t\t},\n\t\t"dataSet2": {\n\t\t\t"groups": ["data"],\n\t\t\t"icon": "#common-dataset",\n\t\t\t"msgKey": "dataset",\n\t\t\t"options": ["content"],\n\t\t\t"properties": "dataSet2"\n\t\t},\n\t\t"dataSetFolder": {\n\t\t\t"icon": "#common-question-mark",\n\t\t\t"msgKey": "dataSetFolder",\n\t\t\t"options": ["container","teamroot","mruDisabled"]\n\t\t},\n\t\t"dataSource": {\n\t\t\t"icon": "#common-data_source",\n\t\t\t"msgKey": "dataSource",\n\t\t\t"options": ["tenant"]\n\t\t},\n\t\t"dataSourceSchema": {\n\t\t\t"icon": "#common-data_source",\n\t\t\t"msgKey": "dataSourceConnection",\n\t\t\t"options": ["tenant"]\n\t\t},\n\t\t"dataSourceConnection": {\n\t\t\t"icon": "#common-database-server",\n\t\t\t"msgKey": "dataSourceConnection",\n\t\t\t"options": ["tenant"]\n\t\t},\n\t\t"dataSourceCredential": {\n\t\t\t"icon": "#common-dataset",\n\t\t\t"msgKey": "dataSourceCredential"\n\t\t},\n\t\t"dataSourceSignon": {\n\t\t\t"icon": "#ba_content_nav-password-key",\n\t\t\t"msgKey": "dataSourceSignon"\n\t\t},\n\t\t"directory": {\n\t\t\t"icon": "#ba_content_nav-personal_24",\n\t\t\t"msgKey": "directory",\n\t\t\t"options": ["container","teamroot","mruDisabled"]\n\t\t},\n\t\t"distributionList": {\n\t\t\t "icon": "#bulleted-list_16",\n\t\t\t "msgKey": "distributionList",\n\t\t\t "options": ["tenant"]\n\t\t },\n\t\t"document": {\n\t\t\t"icon": "#common-document",\n\t\t\t"msgKey": "document",\n\t\t\t"properties": "document",\n\t\t\t"options": ["content"]\n\t\t},\n\t\t"exploration": {\n\t\t\t"groups": ["dashboard"],\n\t\t\t"icon": "#common-dashboard_24",\n\t\t\t"mruFields": ["defaultScreenTip","iconURI","tags"],\n\t\t\t"msgKey": "dashboard",\n\t\t\t"options": ["content"],\n\t\t\t"subtypes": [\n\t\t\t\t{ "check": { "field": "defaultScreenTip", "test": "equal", "value": "story" },\n\t\t\t\t\t"type": "story"\n\t\t\t\t},\n\t\t\t\t{ "check": { "field": "tags", "test": "contains", "value": "story" },\n\t\t\t\t\t"type": "story"\n\t\t\t\t},\n\t\t\t\t{ "check": { "field": "tags", "test": "contains", "value": "explore" },\n\t\t\t\t\t"type": "explore"\n\t\t\t\t},\n\t\t\t\t{ "check": { "field": "tags", "test": "contains", "value": "dashboard_template" },\n\t\t\t\t\t"type": "dashboard_template"\n },\n { "check": { "field": "tags", "test": "contains", "value": "dashboard",\n "type": "dashboard"\n }\n }\n\t\t\t]\n\t\t},\n\t\t"dashboard_template": {\n\t\t\t"derived": "exploration",\n\t\t\t"filterType": "dashboard_template",\n\t\t\t"groups": ["dashboard"],\n\t\t\t"icon": "#ba_content_nav-template_32",\n\t\t\t"msgKey": "dashboardTemplate",\n\t\t\t"mruFields": ["tags"]\n\t\t},\n\t\t"explore": {\n\t\t\t"derived": "exploration",\n\t\t\t"filterType": "explore",\n\t\t\t"groups": ["exploration"],\n\t\t\t"icon": "#common-explore",\n\t\t\t"msgKey": "exploration",\n\t\t\t"mruFields": ["tags"]\n\t\t},\n\t\t"exportDeployment": {\n\t\t\t"icon": "#common-archive",\n\t\t\t"msgKey": "exportDeployment"\n\t\t},\n\t\t"folder": {\n\t\t\t"groups": ["folder"],\n\t\t\t"icon": "#common-folder_16",\n\t\t\t"msgKey": "folder",\n\t\t\t"options": ["container","teamroot","content","mruDisabled"],\n\t\t\t"properties": "folder"\n\t\t},\n\t\t"group": {\n\t\t\t"icon": "#common-group",\n\t\t\t"msgKey": "group",\n\t\t\t"options": ["tenant"]\n\t\t},\n\t\t"importDeployment": {\n\t\t\t"icon": "#common-archive",\n\t\t\t"msgKey": "importDeployment"\n\t\t},\n\t\t"interactiveReport": {\n\t\t\t"groups": ["report"],\n\t\t\t"icon": "#ba_content_nav-activereport_16",\n\t\t\t"msgKey": "activeReport",\n\t\t\t"options": ["versions","content"],\n\t\t\t"properties": "report"\n\t\t},\n\t\t"jobDefinition": {\n\t\t\t"groups": ["job"],\n\t\t\t"icon": "#ba_content_nav-job_16",\n\t\t\t"msgKey": "job",\n\t\t\t"properties": "jobDefinition",\n\t\t\t"options": ["content"]\n\t\t},\n\t\t"jupyterNotebook": {\n\t\t\t"groups": ["notebook"],\n\t\t\t"icon": "#data-notebook",\n\t\t\t"msgKey": "notebook",\n\t\t\t"properties": "jupyterNotebook",\n\t\t\t"options": ["content"]\n\t\t},\n\t\t"launchable": {\n\t\t\t"icon": "#common-question-mark",\n\t\t\t"msgKey": "launchable",\n\t\t\t"options": ["teamroot"]\n\t\t},\n\t\t"metricsDataSourceETLTask": {\n\t\t\t"icon": "#common-metricsDataSource",\n\t\t\t"msgKey": "metricsDataSourceETLTask",\n\t\t\t"options": ["content"],\n\t\t\t"properties": "metricsDataSourceETLTask"\n\t\t},\n\t\t"metricsExportTask": {\n\t\t\t"icon": "#common-metricsExport",\n\t\t\t"msgKey": "metricsExportTask",\n\t\t\t"options": ["content"],\n\t\t\t"properties": "metricsExportTask"\n\t\t},\n\t\t"metricsFileImportTask": {\n\t\t\t"icon": "#common-metricsImport",\n\t\t\t"msgKey": "metricsFileImportTask",\n\t\t\t"options": ["content"],\n\t\t\t"properties": "metricsFileImportTask"\n\t\t},\n\t\t"metricsMaintenanceTask": {\n\t\t\t"icon": "#common-metricsMaintenance",\n\t\t\t"msgKey": "metricsMaintenanceTask",\n\t\t\t"options": ["content"],\n\t\t\t"properties": "metricsMaintenanceTask"\n\t\t},\n\t\t"module": {\n\t\t\t"groups": ["data"],\n\t\t\t"icon": "#ba_content_nav-data_model_16",\n\t\t\t"msgKey": "dataModule",\n\t\t\t"options": ["content"],\n\t\t\t"properties": "module"\n\t\t},\n\t\t"namespace": {\n\t\t\t"icon": "#common-namespace",\n\t\t\t"msgKey": "namespace",\n\t\t\t"options": ["container","teamroot","mruDisabled"]\n\t\t},\n\t\t"namespaceFolder": {\n\t\t\t"icon": "#common-folder_16",\n\t\t\t"msgKey": "folder",\n\t\t\t"options": ["container","teamroot","mruDisabled","tenant"]\n\t\t},\n\t\t"newsItem": {\n\t\t\t"icon": "#ba_content_nav-data_16",\n\t\t\t"msgKey": "newsItem",\n\t\t\t"options": ["content"]\n\t\t},\n\t\t"notebook": {\n\t\t\t"groups":["notebook"],\n\t\t\t"msgKey":"notebook",\n\t\t\t"options":["content"]\n\t\t},\n\t\t"package": {\n\t\t\t"groups": ["packages"],\n\t\t\t"icon": "#common-repository-archive",\n\t\t\t"msgKey": "package",\n\t\t\t"options": ["container","teamroot","content","mruDisabled"],\n\t\t\t"properties": "package"\n\t\t},\n\t\t"packageConfigurations": {\n\t\t\t"icon": "#common-question-mark",\n\t\t\t"msgKey": "packageConfigurations"\n\t\t},\n\t\t"pagelet": {\n\t\t\t"groups": ["dashboard"],\n\t\t\t"icon": "#common-pagelet",\n\t\t\t"msgKey": "pagelet",\n\t\t\t"options": ["content"]\n\t\t},\n\t\t"myPageletRef": {\n\t\t\t"icon": "#common-shortcut",\n\t\t\t"msgKey": "shortcut"\n\t\t},\n\t\t"pageletRefs": {\n\t\t\t"icon": "#ba_content_nav-folder-portal-pages_16",\n\t\t\t"msgKey": "pagelet"\n\t\t},\n\t\t"planningTask": {\n\t\t\t"icon": "#common-planning",\n\t\t\t"msgKey": "planningTask",\n\t\t\t"options": ["content"],\n\t\t\t"properties": "planningTask"\n\t\t},\n\t\t"powerPlayCube": {\n\t\t\t"icon": "#common-powerPlayCube",\n\t\t\t"msgKey": "powerPlayCube",\n\t\t\t"options": ["content"]\n\t\t},\n\t\t"powerPlayReport": {\n\t\t\t"groups": ["report"],\n\t\t\t"icon": "#ba_content_nav-powerplayreport_16",\n\t\t\t"msgKey": "powerPlayReport",\n\t\t\t"options": ["versions","content"],\n\t\t\t"properties": "powerPlayReport"\n\t\t},\n\t\t"powerPlay8Report": {\n\t\t\t"groups": ["report"],\n\t\t\t"icon": "#ba_content_nav-powerplayreport_16",\n\t\t\t"msgKey": "powerPlay8Report",\n\t\t\t"options": ["versions","content","powerPlay8"],\n\t\t\t"properties": "report"\n\t\t},\n\t\t"powerPlay8ReportView": {\n\t\t\t"baseTypes": ["powerPlay8Report"],\n\t\t\t"groups": ["report"],\n\t\t\t"icon": "#common-powerPlay8_report",\n\t\t\t"mruFields": ["base"],\n\t\t\t"msgKey": "powerPlay8ReportView",\n\t\t\t"options": ["invalidWithoutBase","view","decorateIcon","versions","content","powerPlay8"],\n\t\t\t"properties": "powerPlay8ReportView"\n\t\t},\n\t\t"query": {\n\t\t\t"groups": ["report"],\n\t\t\t"icon": "#common-queryReport",\n\t\t\t"msgKey": "query",\n\t\t\t"options": ["versions","content"],\n\t\t\t"properties": "report"\n\t\t},\n\t\t"report": {\n\t\t\t"groups": ["report"],\n\t\t\t"icon": "#common-report",\n\t\t\t"msgKey": "report",\n\t\t\t"options": ["versions","content"],\n\t\t\t"properties": "report"\n\t\t},\n\t\t"reportTemplate": {\n\t\t\t"groups": ["report"],\n\t\t\t"icon": "#ba_content_nav-reporttemplate_16",\n\t\t\t"msgKey": "reportTemplate",\n\t\t\t"options": ["versions","content"]\n\t\t},\n\t\t"reportView": {\n\t\t\t"baseTypes": ["report","query","analysis","interactiveReport"],\n\t\t\t"groups": ["reportView"],\n\t\t\t"icon": "#common-report_view",\n\t\t\t"mruFields": ["base"],\n\t\t\t"msgKey": "reportView",\n\t\t\t"options": ["invalidWithoutBase","view","versions","content"],\n\t\t\t"properties": "reportView"\n\t\t},\n\t\t"role": {\n\t\t\t"icon": "#common-role",\n\t\t\t"msgKey": "role",\n\t\t\t"options": ["tenant"]\n\t\t},\n\t\t"securedFeature": {\n\t\t\t"msgKey": "capability",\n\t\t\t"icon": "#capability_32"\n\t\t},\n\t\t"securedFunction": {\n\t\t\t"msgKey": "capability",\n\t\t\t"icon": "#capability_32"\n\t\t},\n\t\t"productCapability": {\n\t\t\t"msgKey": "capability",\n\t\t\t"icon": "#capability_32"\n\t\t},\n\t\t"shortcut": {\n\t\t\t"icon": "#common-shortcut",\n\t\t\t"msgKey": "shortcut",\n\t\t\t"groups": ["shortcut"],\n\t\t\t"options": ["content","hasSource","mruDisabled"],\n\t\t\t"properties": "shortcut"\n },\n "socialMediaProject": {\n "icon": "#ba_content_nav-social-insights-project_16",\n "msgKey": "socialInsightsProject",\n "groups": ["data"]\n },\n\t\t"story": {\n\t\t\t"derived": "exploration",\n\t\t\t"filterType": "story",\n\t\t\t"groups": ["stories"],\n\t\t\t"icon": "#common-story",\n\t\t\t"msgKey": "story",\n\t\t\t"mruFields": ["defaultScreenTip","iconURI"]\n\t\t},\n\t\t"tenant": {\n\t\t\t"icon": "#common-multi_tenant",\n\t\t\t"msgKey": "tenant"\n\t\t},\n\t\t"txt": {\n\t\t\t"derived": "uploadedFile",\n\t\t\t"groups": ["data"],\n\t\t\t"icon": "#ba_content_nav-text-file_24",\n\t\t\t"msgKey": "txt"\n\t\t},\n\t\t"uploadedFile": {\n\t\t\t"groups": ["data"],\n\t\t\t"icon": "#common-upload",\n\t\t\t"msgKey": "uploadedFile",\n\t\t\t"options": ["content"],\n\t\t\t"properties": "uploadedFile",\n\t\t\t"subtypes": [\n\t\t\t\t{ "check": { "field": "defaultName", "test": "extension", "values": ["csv","txt","xls","xlsx"] } }\n\t\t\t]\n\t\t},\n\t\t"fileUpload": {\n\t\t\t"icon": "#common-upload",\n\t\t\t"msgKey": "fileUpload"\n\t\t},\n\t\t"unknown": {\n\t\t\t"icon": "#ba_content_nav-data_16",\n\t\t\t"mruFields": ["base","defaultScreenTip","iconURI","tags"],\n\t\t\t"msgKey": "unknown"\n\t\t},\n\t\t"urlItem": {\n\t\t\t"icon": "#ba_content_nav-data_16",\n\t\t\t"msgKey": "urlItem",\n\t\t\t"options": ["content"]\n\t\t},\n\t\t"URL": {\n\t\t\t"icon": "#ba_content_nav-url_32",\n\t\t\t"msgKey": "URL",\n\t\t\t"options": ["content"]\n\t\t},\n\t\t"xls": {\n\t\t\t"derived": "uploadedFile",\n\t\t\t"groups": ["data"],\n\t\t\t"icon": "#common-excel_icon",\n\t\t\t"msgKey": "xls"\n\t\t},\n\t\t"xlsx": {\n\t\t\t"derived": "uploadedFile",\n\t\t\t"groups": ["data"],\n\t\t\t"icon": "#common-excel_icon",\n\t\t\t"msgKey": "xlsx"\n\t\t},\n\t\t"visualization": {\n\t\t\t"icon": "#change-visualization_16",\n\t\t\t"msgKey": "visualization"\n\t\t}\n\t}\n}\n';});
  1867. /*
  1868. *+------------------------------------------------------------------------+
  1869. *| Licensed Materials - Property of IBM
  1870. *| IBM Cognos Products: ba-content-nav
  1871. *| (C) Copyright IBM Corp. 2015, 2019
  1872. *|
  1873. *| US Government Users Restricted Rights - Use, duplication or disclosure
  1874. *| restricted by GSA ADP Schedule Contract with IBM Corp.
  1875. *+------------------------------------------------------------------------+
  1876. */
  1877. define('bacontentnav/utils/UIHelper',[
  1878. 'underscore',
  1879. '../nls/StringResource',
  1880. '../lib/@waca/core-client/js/core-client/i18n/Formatter',
  1881. '../lib/@waca/core-client/js/core-client/ui/dialogs/MessageBox',
  1882. './ContentStoreObject',
  1883. '../lib/@ba-ui-toolkit/ba-graphics/dist/illustrations-js/no-detail_128',
  1884. 'text!../config/ca.json'
  1885. ], function(_, StringResource, Formatter, MessageBox, ContentStoreObject, noDetail, caJSON) {
  1886. 'use strict'; //NOSONAR
  1887. var _singletonInstance = null;
  1888. var REQUIRED_MRU_FIELDS = ['defaultName', 'type', 'ancestors', 'permissions', 'disabled'];
  1889. // Note: hidden will not be returned if the user doesn't have 'read', but they may have 'execute', it has been recommended that
  1890. // we use the field 'shown' instead of 'hidden' - consider for future refactoring. Also, owner may not be absent for imported assets
  1891. var OPTIONAL_MRU_FIELDS = ['hidden', 'owner'];
  1892. var UIHelper = function() { //NOSONAR
  1893. if (UIHelper.prototype._singletonInstance) {
  1894. return UIHelper.prototype._singletonInstance;
  1895. }
  1896. UIHelper.prototype._singletonInstance = this;
  1897. // Default to 'CA' configuration - in the long run, everything should be
  1898. // driven by what comes up from the content-service
  1899. this._UI_CONFIG = JSON.parse(caJSON);
  1900. this._UI_REGISTRY = this._UI_CONFIG.uiTypes;
  1901. this._CONFIG_TYPE = 'ca';
  1902. this._filterFacets = {};
  1903. this._CONTENT_NAV_LS_KEY = 'waca-nav-ls';
  1904. this._sortCollator = null;
  1905. // Check for overriding UI types
  1906. this._getSubtype = function(item) {
  1907. var subtypeOverride;
  1908. var type = ContentStoreObject.getType(item);
  1909. if (!type && item.securityObject) {
  1910. // security objects have no top level type field
  1911. subtypeOverride = item.securityObject.type;
  1912. } else {
  1913. // other objects have overriding subtypes, eg. exploration -> story
  1914. _.find(this._UI_REGISTRY[type] && this._UI_REGISTRY[type].subtypes || [], function(subtype) {
  1915. var field = item[subtype.check.field];
  1916. if (field) {
  1917. switch (subtype.check.test) {
  1918. case 'equal':
  1919. subtypeOverride = field === subtype.check.value && subtype.type;
  1920. break;
  1921. case 'contains':
  1922. subtypeOverride = field.indexOf(subtype.check.value) !== -1 && subtype.type;
  1923. break;
  1924. case 'extension':
  1925. var extensionTxt = field.split('.').pop();
  1926. var extensionIndex = extensionTxt && subtype.check.values.indexOf(extensionTxt.toLowerCase());
  1927. subtypeOverride = extensionIndex !== -1 && subtype.check.values[extensionIndex];
  1928. break;
  1929. default:
  1930. // nothing
  1931. }
  1932. }
  1933. return !!subtypeOverride;
  1934. }.bind(this));
  1935. }
  1936. return subtypeOverride;
  1937. };
  1938. // Check if the given type is derived from something else
  1939. this._isDerived = function(type) {
  1940. var entry = this._UI_REGISTRY[type] || this._UI_REGISTRY['unknown'];
  1941. return !!entry.derived || false;
  1942. };
  1943. // Check if item has the given tag
  1944. this._hasOption = function(type, tag) {
  1945. var entry = this._UI_REGISTRY[type] || this._UI_REGISTRY['unknown'];
  1946. return entry.options && entry.options.indexOf(tag) !== -1;
  1947. };
  1948. this._hasOptionFromObject = function(object, tag) {
  1949. return this._hasOption(ContentStoreObject.getType(object), tag);
  1950. };
  1951. // For validation - Admin uses :(
  1952. this._validateIsNumber = function(value) {
  1953. return _.isNumber(value);
  1954. };
  1955. this._validateIsEmail = function(value) {
  1956. var emailRegex = /^([a-zA-Z0-9]+[_|-|.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|-|.]?)*[a-zA-Z0-9]+.[a-zA-Z]{2,3}$/;
  1957. return value.length === 0 || emailRegex.test(value);
  1958. };
  1959. this._validateMaxLength = function(value, options) {
  1960. return !value || value.toString().length <= options.maxLength;
  1961. };
  1962. this._validateNumericRange = function(value, options) {
  1963. if (options.numericRange.min !== undefined && value < options.numericRange.min) {
  1964. return false;
  1965. }
  1966. if (options.numericRange.max !== undefined && value > options.numericRange.max) {
  1967. return false;
  1968. }
  1969. return true;
  1970. };
  1971. // Constants for validation messages
  1972. this._GET_VALIDATION_MESSAGES = {
  1973. 'isNumber': function() {
  1974. return StringResource.get('invalidNumber');
  1975. },
  1976. 'isEmail': function() {
  1977. return StringResource.get('invalidEmailMessage');
  1978. },
  1979. 'maxLength': function(checkList, timeLocale) {
  1980. timeLocale = timeLocale || {};
  1981. return StringResource.get('exceedMaxLength', {
  1982. 'maxLength': Formatter.formatNumber(checkList.maxLength, {
  1983. 'locale': timeLocale.contentLocale
  1984. })
  1985. });
  1986. }.bind(this),
  1987. 'numericRange': function(checkList, timeLocale) {
  1988. var errorMessage;
  1989. if (checkList.numericRange.min !== undefined && checkList.numericRange.max !== undefined) {
  1990. errorMessage = StringResource.get('numberOutOfRange', {
  1991. 'min': Formatter.formatNumber(checkList.numericRange.min, {
  1992. 'locale': timeLocale.contentLocale
  1993. }),
  1994. 'max': Formatter.formatNumber(checkList.numericRange.max, {
  1995. 'locale': timeLocale.contentLocale
  1996. })
  1997. });
  1998. } else if (checkList.numericRange.min !== undefined) {
  1999. errorMessage = StringResource.get('numberTooSmall', {
  2000. 'min': Formatter.formatNumber(checkList.numericRange.min, {
  2001. 'locale': timeLocale.contentLocale
  2002. })
  2003. });
  2004. } else if (checkList.numericRange.max !== undefined) {
  2005. errorMessage = StringResource.get('numberTooBig', {
  2006. 'max': Formatter.formatNumber(checkList.numericRange.max, {
  2007. 'locale': timeLocale.contentLocale
  2008. })
  2009. });
  2010. }
  2011. return errorMessage;
  2012. }
  2013. };
  2014. };
  2015. UIHelper.prototype.init = function(initValues) {
  2016. _.extend(this, initValues);
  2017. };
  2018. /**
  2019. * Allow the UI types (icons, strings) to be reset according to the current product type.
  2020. * TODO: temporary - until the configuration is pushed down to the server
  2021. * @param {object} glassContext
  2022. * @return Promise - resolved when the new configuration is set
  2023. */
  2024. UIHelper.prototype.initializeRegistry = function(glassContext) {
  2025. var config = glassContext && glassContext.getCoreSvc('.Context').get('config');
  2026. var productTypeKey = (config && config.productType || 'ca').toLowerCase();
  2027. if (this._CONFIG_TYPE === productTypeKey) {
  2028. return Promise.resolve();
  2029. } else {
  2030. this._CONFIG_TYPE = productTypeKey;
  2031. return new Promise(function(resolve) {
  2032. var filePath = 'text!bacontentnav/config/' + productTypeKey + '.json';
  2033. require([ filePath ], function(config) {
  2034. var configOptions = JSON.parse(config);
  2035. if (configOptions && configOptions.uiTypes) {
  2036. this._UI_CONFIG = configOptions;
  2037. this._UI_REGISTRY = configOptions.uiTypes;
  2038. }
  2039. resolve();
  2040. }.bind(this));
  2041. }.bind(this));
  2042. }
  2043. };
  2044. /**
  2045. * Render an info message with given text at the given node
  2046. * @param {object} $node the DOM element
  2047. * @param {string} message the text to display
  2048. * @param {object} icon the icon object that must contain 'default.id'
  2049. */
  2050. UIHelper.prototype.renderInfoMessage = function($node, message, iconURL) {
  2051. iconURL = iconURL || noDetail;
  2052. var svg = '<svg class="svgIcon" role="img" focusable="false"> \
  2053. <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#' + iconURL.default.id + '"></use> \
  2054. </svg>';
  2055. $node.html('<div class="contentApps_comingSoon"><div class="emptyTableImage">' + svg + '</div><div class="emptyTableText">' + message + '</div></div>');
  2056. };
  2057. /**
  2058. * Return the display type of the item
  2059. * @param {object} item the content-service item
  2060. * @return {boolean}
  2061. */
  2062. UIHelper.prototype.getDisplayType = function(item) {
  2063. var displayType = ContentStoreObject.getType(item);
  2064. if (item) {
  2065. switch (item.state) {
  2066. case 'valid':
  2067. case undefined:
  2068. // check for overriding display type
  2069. displayType = this._getSubtype(item, displayType) || displayType;
  2070. break;
  2071. default:
  2072. // item is a 'progressing' state - used when deleting
  2073. displayType = 'circle';
  2074. }
  2075. }
  2076. return displayType || 'unknown';
  2077. };
  2078. /**
  2079. * Return the filter type of the item
  2080. * @param {object} item the content-service item
  2081. * @return {boolean}
  2082. */
  2083. UIHelper.prototype.getFilterType = function(item) {
  2084. var type = this.getDisplayType(item);
  2085. var entry = type && this._UI_REGISTRY[type] || this._UI_REGISTRY['unknown'];
  2086. return entry.filterType || ContentStoreObject.getType(item);
  2087. };
  2088. /**
  2089. * Return an array of content-services types (excluding derived types such as 'unknown' or 'story')
  2090. * @param [[{string}]] optional param - an array of strings indicating what options the types should have
  2091. * @return {array}
  2092. */
  2093. UIHelper.prototype.getTypes = function(options) {
  2094. return _.filter(Object.keys(this._UI_REGISTRY), function(type) {
  2095. if (!this._isDerived(type)) {
  2096. return options ? _.intersection(options, this._UI_REGISTRY[type].options).length > 0 : true;
  2097. }
  2098. return false;
  2099. }.bind(this));
  2100. };
  2101. /**
  2102. * Return filtering facets
  2103. * @param [[{string}]] optional param - an array of strings indicating what options the types should have
  2104. * @return {object}
  2105. */
  2106. UIHelper.prototype.getFilterFacets = function(options) {
  2107. // only build once as it's kind of expensive
  2108. var optionsKey = options ? options.join(',') : 'all';
  2109. if (!this._filterFacets[optionsKey]) {
  2110. // function to find all the types of a group
  2111. var getGroup = function(groupName) {
  2112. var group =[];
  2113. _.each(Object.keys(this._UI_REGISTRY), function(type) {
  2114. var entry = this._UI_REGISTRY[type];
  2115. if (groupName) {
  2116. if (this.isGroup(type, groupName)){
  2117. group.push(type);
  2118. }
  2119. } else if (!entry.groups){
  2120. group.push(type);
  2121. }
  2122. }.bind(this));
  2123. return group;
  2124. }.bind(this);
  2125. // get the groups from the configured facet
  2126. var filterFacets = {};
  2127. var definedFacets = this.getConfiguration('filter').facets;
  2128. _.each(definedFacets, function(facet){
  2129. filterFacets[facet.msgKey] = getGroup(facet.group).join('|');
  2130. });
  2131. // add other group for items without groups
  2132. filterFacets['others'] = getGroup(null).join('|');
  2133. this._filterFacets[optionsKey] = filterFacets;
  2134. }
  2135. return this._filterFacets[optionsKey];
  2136. };
  2137. /**
  2138. * Return an array of fields required for mru persistence for the given type
  2139. * @param {string} type the display or content-service type
  2140. * @return {array}
  2141. */
  2142. UIHelper.prototype.getMRUFields = function(type, requiredOnly) {
  2143. if (requiredOnly) {
  2144. return REQUIRED_MRU_FIELDS;
  2145. } else {
  2146. var entry = this._UI_REGISTRY[type] || this._UI_REGISTRY['unknown'];
  2147. return REQUIRED_MRU_FIELDS.concat(OPTIONAL_MRU_FIELDS).concat(entry.mruFields || []);
  2148. }
  2149. };
  2150. /**
  2151. * Return true if the object type is a container
  2152. * @param {string} type the content-service type
  2153. * @return {boolean}
  2154. */
  2155. UIHelper.prototype.isContainer = function(type) {
  2156. return !!this._hasOption(type, 'container');
  2157. };
  2158. /**
  2159. * Return true if the object type is the given type
  2160. * @param {string} type the content-service type
  2161. * @return {boolean}
  2162. */
  2163. UIHelper.prototype.isGroup = function(type, groupType) {
  2164. var entry = this._UI_REGISTRY[type] || this._UI_REGISTRY['unknown'];
  2165. return entry.groups && groupType && entry.groups.indexOf(groupType) !== -1;
  2166. };
  2167. /**
  2168. * Return true if the object type is a container
  2169. * @param {object} oData the content-service object
  2170. * @return {boolean}
  2171. */
  2172. UIHelper.prototype.isAllowedInTeamRoot = function(oData) {
  2173. // we don't care if it's valid, etc. for this tag
  2174. return !!this._hasOptionFromObject(oData, 'teamroot');
  2175. };
  2176. /**
  2177. * Return true if the object type can be linked to a tenant
  2178. * @param {object} oData the content-service object
  2179. * @return {boolean}
  2180. */
  2181. UIHelper.prototype.hasTenantOption = function(oData) {
  2182. // we don't care if it's valid, etc. for this tag
  2183. return !!this._hasOptionFromObject(oData, 'tenant');
  2184. };
  2185. /**
  2186. * Return true if the object type requires refetching to identify actions
  2187. * @param {object} oData the content-service object
  2188. * @return {boolean}
  2189. */
  2190. UIHelper.prototype.hasSource = function(oData) {
  2191. return !!this._hasOptionFromObject(oData, 'hasSource');
  2192. };
  2193. /**
  2194. * Return true if versions is supported
  2195. * @param {object} oData the content-service object
  2196. * @return {boolean}
  2197. **/
  2198. UIHelper.prototype.isVersionsSupported = function(oData) {
  2199. return !!(ContentStoreObject.getVersionsLink(oData) || this._hasOptionFromObject(oData, 'versions'));
  2200. };
  2201. /**
  2202. * Return the type's icon svg id
  2203. * @param {string} type the content-service type
  2204. * @return {string}
  2205. */
  2206. UIHelper.prototype.getSVGIconForType = function(type) {
  2207. var entry = this._UI_REGISTRY[type] || this._UI_REGISTRY['unknown'];
  2208. return entry.icon;
  2209. };
  2210. /**
  2211. * Return true if the base icon should be decorated
  2212. * @param {string} type the content-service type
  2213. * @return {string}
  2214. */
  2215. UIHelper.prototype.isSVGIconDecorated = function(type) {
  2216. return !!this._hasOption(type, 'decorateIcon');
  2217. };
  2218. /**
  2219. * Return the content-service type
  2220. * @param {string} type the display (or content-service) type
  2221. * @return {string}
  2222. */
  2223. UIHelper.prototype.getType = function(type) {
  2224. var entry = this._UI_REGISTRY[type] || this._UI_REGISTRY['unknown'];
  2225. return entry.derived || type;
  2226. };
  2227. /**
  2228. * Return the type's display string
  2229. * @param {string} type the content-service type
  2230. * @return {string}
  2231. */
  2232. UIHelper.prototype.getTypeName = function(type) {
  2233. var entry = this._UI_REGISTRY[type] || this._UI_REGISTRY['unknown'];
  2234. return entry.msg || StringResource.get(entry.msgKey);
  2235. };
  2236. /**
  2237. * Return the type's display string
  2238. * @param {object} object the content-service object
  2239. * @return {string}
  2240. */
  2241. UIHelper.prototype.getTypeNameFromObject = function(object) {
  2242. return this.getTypeName(this.getDisplayType(object));
  2243. };
  2244. /**
  2245. * Return the type's display string
  2246. * @param {string} type content-service type
  2247. * @return {string}
  2248. * @deprecated use getTypeName
  2249. */
  2250. UIHelper.prototype.getIconTooltipForType = function(type) {
  2251. return this.getTypeName(type);
  2252. };
  2253. /**
  2254. * Return the type's display string
  2255. * @param {object} object the content-service object
  2256. * @return {string}
  2257. */
  2258. UIHelper.prototype.getTypeSVGIconFromObject = function(object) {
  2259. return this.getSVGIconForType(this.getDisplayType(object));
  2260. };
  2261. /**
  2262. * Return a type's icon fill or null
  2263. * @param {string} type the content-service type
  2264. * @return {string}
  2265. */
  2266. UIHelper.prototype.getIconFill = function(type) {
  2267. var entry = this._UI_REGISTRY[type] || this._UI_REGISTRY['unknown'];
  2268. return entry.iconFill || null;
  2269. };
  2270. /**
  2271. * Return the type's properties key for the properties panel (or null)
  2272. * @param {string} type the content-service type
  2273. * @return {string}
  2274. */
  2275. UIHelper.prototype.getProperties = function(type) {
  2276. var entry = this._UI_REGISTRY[type] || this._UI_REGISTRY['unknown'];
  2277. return entry.properties || null;
  2278. };
  2279. /**
  2280. * Return the configuration for the given nameKey: capabilities, search, filter, etc.
  2281. * @param {string} nameKey of the configuration to be fetched
  2282. * @return {object} the configuration or an empty object if it does not exist
  2283. */
  2284. UIHelper.prototype.getConfiguration = function(nameKey) {
  2285. return (this._UI_CONFIG || {})[nameKey] || {};
  2286. };
  2287. /**
  2288. * Return true if local storage is supported
  2289. * @return {boolean}
  2290. */
  2291. UIHelper.prototype.isLocalStorageSupported = function() {
  2292. try {
  2293. var testKey = 'testKey';
  2294. localStorage.setItem(testKey, '1');
  2295. localStorage.removeItem(testKey);
  2296. return true;
  2297. } catch (error) {
  2298. return false;
  2299. }
  2300. };
  2301. /**
  2302. * Return true if the object permissions have the required permission
  2303. * @param {array} objectPerm array of object permissions
  2304. * @param {array} requiredPerm array of required permissions
  2305. * @return {boolean}
  2306. */
  2307. UIHelper.prototype.hasPermissions = function(objectPerm, requiredPerm) {
  2308. var matchingPerms = _.intersection(requiredPerm, objectPerm);
  2309. return matchingPerms.length === requiredPerm.length;
  2310. };
  2311. /**
  2312. * Return true if the input is valid
  2313. * @param {string} value - the value to be validated
  2314. * @param {object} checkList - the different 'validators' to be applied to the value
  2315. * @param {function} validationFailedCallback - if the validation fails, a dialog will be shown. This callback will be called once that dialog is hidden by the user.
  2316. * @return {boolean} true|false depending if the value is valid
  2317. */
  2318. UIHelper.prototype.validateInput = function(value, checkList, validationFailedCallback, timeLocale) {
  2319. var okCallback = function(e) {
  2320. e.stopPropagation();
  2321. MessageBox.inherited('ok', this, arguments);
  2322. if (validationFailedCallback) {
  2323. validationFailedCallback();
  2324. }
  2325. return false;
  2326. };
  2327. for (var validationCheck in checkList) {
  2328. if (checkList.hasOwnProperty(validationCheck)) {
  2329. // Function names for validation need to start with '_validate'
  2330. var funcName = '_validate' + validationCheck.charAt(0).toUpperCase() + validationCheck.slice(1);
  2331. if (this[funcName] && !this[funcName](value, checkList)) {
  2332. var dlg = new MessageBox('warning', StringResource.get('invalidInput'), this._GET_VALIDATION_MESSAGES[validationCheck](checkList, timeLocale));
  2333. dlg.ok = okCallback;
  2334. dlg.open();
  2335. return false;
  2336. }
  2337. }
  2338. }
  2339. return true;
  2340. };
  2341. /**
  2342. * Return true if a content object type is valid (At this time, only report views can be invalid if their base report is missing)
  2343. * @param {object} oData - content object
  2344. * @return {boolean} true|false depending if the value is valid
  2345. */
  2346. UIHelper.prototype.isValid = function(oData) {
  2347. return this._hasOptionFromObject(oData, 'invalidWithoutBase') ? !!ContentStoreObject.hasBase(oData) : true;
  2348. };
  2349. /**
  2350. * Return true if this object should be stored in the mru
  2351. * @param {object} oData - content object
  2352. * @return {boolean} true|false depending if the object should be stored in the MRU
  2353. */
  2354. UIHelper.prototype.isMRUSupported = function(oData) {
  2355. var type = ContentStoreObject.getType(oData);
  2356. return !(!type || this._isDerived(type) || this._hasOption(type, 'mruDisabled'));
  2357. };
  2358. /**
  2359. * @param {string} type the content-service type
  2360. * @return {array} array of base types, otherwise null
  2361. */
  2362. UIHelper.prototype.getBaseTypes = function(type) {
  2363. var entry = this._UI_REGISTRY[type] || this._UI_REGISTRY['unknown'];
  2364. return entry.baseTypes || null;
  2365. };
  2366. /**
  2367. * Add a 'stroke' attribute to an svg element
  2368. * @param {element} svg the svg element
  2369. */
  2370. UIHelper.prototype.addStroke = function(svg) {
  2371. //ensure we remove the stroke in case we've already added it
  2372. this.removeStroke(svg);
  2373. var useTags = $(svg).find('use.ba_content_nav-filter_circle');
  2374. if (useTags.length) { // i.e. the stroke exists
  2375. // make it visible
  2376. useTags.attr('visibility', 'visible');
  2377. } else if (svg && svg.length){
  2378. // add stroke to base image, todo: remove css from js
  2379. var use = document.createElementNS('http://www.w3.org/2000/svg', 'use');
  2380. use.setAttributeNS('http://www.w3.org/1999/xlink', 'href', '#ba_content_nav-filter_circle');
  2381. use.setAttribute('height', '12');
  2382. use.setAttribute('stroke', '#ffffff');
  2383. use.setAttribute('fill', '#1f57a4');
  2384. use.setAttribute('class', 'ba_content_nav-filter_circle');
  2385. // adjust container height so stroke appears at the right height and append stroke
  2386. $(svg).attr('style', 'height: 25px;');
  2387. $(svg).append(use);
  2388. }
  2389. };
  2390. /**
  2391. * removes a 'stroke' attribute from an svg element that previously had one set using addStroke()
  2392. * @param {element} svg the svg element
  2393. */
  2394. UIHelper.prototype.removeStroke = function(svg) {
  2395. var useTags = $(svg).find('use.ba_content_nav-filter_circle');
  2396. useTags.attr('visibility', 'hidden');
  2397. };
  2398. /**
  2399. * Returns true if the content object is not missing required object capabilities
  2400. * @param {object} object the content object
  2401. * @param {array} typesToCheck array of object types that need to be verified
  2402. * @param {array} capabilitiesToCheck array of object capabilities that are needed
  2403. * @return {boolean}
  2404. */
  2405. UIHelper.prototype.hasRequiredCapabilities = function (object, typesToCheck, capabilitiesToCheck) {
  2406. if (capabilitiesToCheck === undefined || capabilitiesToCheck.length === 0)
  2407. return true;
  2408. // Currently, module objects do not have effectiveUserCapabilities property.
  2409. // This is wrong as per Offering Management. They will log defects for this.
  2410. // The following block is temporarily and it is to be removed when fixed.
  2411. if (ContentStoreObject.getType(object) === ContentStoreObject.MODULE) {
  2412. return true;
  2413. }
  2414. if (_.indexOf(typesToCheck, ContentStoreObject.getType(object)) === -1) {
  2415. return true;
  2416. }
  2417. return ContentStoreObject.hasCapabilities(object, capabilitiesToCheck);
  2418. };
  2419. UIHelper.prototype.saveSlideoutWidth = function(id, width) {
  2420. var widths = this.getSlideoutObject() || {};
  2421. if (!widths) widths = {};
  2422. widths[id] = width;
  2423. this.saveSlideoutObject(widths);
  2424. };
  2425. UIHelper.prototype.getSlideoutWidth = function(id) {
  2426. var widths = this.getSlideoutObject();
  2427. return widths && widths[id] || null;
  2428. };
  2429. UIHelper.prototype.getSlideoutObject = function() {
  2430. var localStorage = window.localStorage || null;
  2431. if (localStorage) {
  2432. try {
  2433. var contentNavWidthsRaw = localStorage.getItem(this._CONTENT_NAV_LS_KEY);
  2434. return JSON.parse(contentNavWidthsRaw);
  2435. } catch (e) {
  2436. return null;
  2437. }
  2438. }
  2439. return null;
  2440. };
  2441. UIHelper.prototype.saveSlideoutObject = function(slideout) {
  2442. var localStorage = window.localStorage || null;
  2443. if (localStorage) {
  2444. try {
  2445. localStorage.setItem(this._CONTENT_NAV_LS_KEY, JSON.stringify(slideout));
  2446. } catch(e) {
  2447. // error here, invalid object somehow.
  2448. }
  2449. }
  2450. };
  2451. UIHelper.prototype.getCollator = function() {
  2452. if (!this._sortCollator) {
  2453. this._createSortCollator();
  2454. }
  2455. return this._sortCollator;
  2456. };
  2457. UIHelper.prototype._createSortCollator = function() {
  2458. if (window.Intl) {
  2459. this._sortCollator = new Intl.Collator();
  2460. } else {
  2461. this._sortCollator = {
  2462. compare: function(a, b) {
  2463. return a.toString().toLowerCase() > b.toString().toLowerCase();
  2464. }
  2465. };
  2466. }
  2467. };
  2468. var _static = {
  2469. getInstance: function() {
  2470. if (!_singletonInstance) {
  2471. _singletonInstance = new UIHelper();
  2472. }
  2473. return _singletonInstance;
  2474. }
  2475. };
  2476. return _static.getInstance();
  2477. });
  2478. /**
  2479. * Licensed Materials - Property of IBM
  2480. * IBM Cognos Products: BI
  2481. * (C) Copyright IBM Corp. 2017
  2482. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  2483. */
  2484. define('bacontentnav/utils/CookieJar',[
  2485. '../lib/@waca/baglass/js/baglass/utils/Utils'
  2486. ], function(GlassUtils) {
  2487. var CookieJar = {
  2488. /**
  2489. * Returns the value of the requested cookie
  2490. * @param {String} key The key of the cookie
  2491. * @return {String|undefined} the value of the cookie
  2492. */
  2493. getCookieValue: function(key) {
  2494. return GlassUtils.getCookieValue(key);
  2495. },
  2496. /**
  2497. * Set a cookie
  2498. * @param {String} key Cookie name.
  2499. * @param {String} value Cookie value.
  2500. * @param {Date} expires The expires date.
  2501. * @param {String} path Cookie path.
  2502. * @param {String} domain Cookie domain.
  2503. * @param {Boolean} secure Is the cookie secure.
  2504. * @type void
  2505. */
  2506. setCookie: function(key, value, expires, path, domain, secure) {
  2507. document.cookie = key + '=' + encodeURIComponent(value) +
  2508. (expires ? '; expires=' + expires.toUTCString() : '') +
  2509. (path ? '; path=' + path : '') +
  2510. (domain ? '; domain=' + domain : '') +
  2511. (secure ? '; secure' : '');
  2512. },
  2513. /**
  2514. * Delete a cookie
  2515. * @param {String} key Cookie name.
  2516. * @param {String} path Cookie path.
  2517. * @param {String} domain Cookie domain.
  2518. * @type void
  2519. */
  2520. deleteCookie: function(key, path, domain) {
  2521. document.cookie = key + '=' +
  2522. (path ? '; path=' + path : '') +
  2523. (domain ? '; domain=' + domain : '') +
  2524. '; expires=Thu, 1 Jan 1970 00:00:01 UTC';
  2525. }
  2526. };
  2527. return CookieJar;
  2528. });
  2529. /*
  2530. *+------------------------------------------------------------------------+
  2531. *| Licensed Materials - Property of IBM
  2532. *| IBM Cognos Products: Content Explorer
  2533. *| (C) Copyright IBM Corp. 2015, 2020
  2534. *|
  2535. *| US Government Users Restricted Rights - Use, duplication or disclosure
  2536. *| restricted by GSA ADP Schedule Contract with IBM Corp.
  2537. *+------------------------------------------------------------------------+
  2538. */
  2539. define('bacontentnav/services/MRUClientStore',[
  2540. 'jquery',
  2541. '../lib/@waca/core-client/js/core-client/ui/core/Class',
  2542. '../utils/CookieJar',
  2543. '../utils/GlassContextHelper',
  2544. '../utils/UIHelper',
  2545. '../lib/@waca/core-client/js/core-client/utils/BrowserUtils',
  2546. 'underscore'
  2547. ], function($, Class, CookieJar, GlassContextHelper, UIHelper, BrowserUtils, _) {
  2548. 'use strict';
  2549. var MRUQueue = Class.extend({
  2550. /**
  2551. @param glassContext (deprecated - required in initialize)
  2552. @param compareToFunction (function, optional): function that takes two keys as parameters, and returns true if the two keys refer to the same object
  2553. **/
  2554. init: function(glassContext, compareToFunction) {
  2555. this._FOLDER = 'formatedPath';
  2556. this._NAME = 'defaultName';
  2557. this._DELETE_VALUE = 'delete';
  2558. this._TIMESTAMP_NUMERICAL_VALUE = '_timestamp';
  2559. this._TIMESTAMP_DATE_VALUE = 'timestamp';
  2560. this._LIST_VALUE = 'list';
  2561. this._ID_VALUE = 'id';
  2562. this._DEFAULT_URL = 'v1/users/~/mrus';
  2563. this._LIST_ID = 'data';
  2564. this._DUMP_PERIOD = 300000; //The queue will send it's content to the server every 5 minutes
  2565. this._QUEUE_MAX_SIZE = 20; //The value 0 means no max size
  2566. this._hasBeenPopulated = false; //Flag to populate the queue only once on creation
  2567. this._MRU_COOKIE_KEY = 'MRUStorage';
  2568. this._CONFIG_SECURE_COOKIES = 'cookieSecure';
  2569. this._CONFIG_COOKIE_PATH = 'cookiePath';
  2570. this._SELFURL_VALUE = 'selfUrl';
  2571. this._listObject = {};
  2572. this._queue = [];
  2573. this._cycleID = -1; //The ID of the setInterval, kept so that it can be canceled
  2574. /* A flag that refreshes whenever an item is added or deleted.
  2575. * Will be checked by the cycle, to avoid
  2576. * unecessary dumps to the server */
  2577. this._needsRefresh = false;
  2578. // Set the compare method used to find a key in the queue
  2579. if (compareToFunction) {
  2580. this._compareTo = compareToFunction;
  2581. } else {
  2582. this._compareTo = function(a, b) {
  2583. return a === b;
  2584. };
  2585. }
  2586. },
  2587. /**
  2588. * Initializes the MRU store with the current glass context and starts the cycle of pushing.
  2589. * @param {object} glassContext
  2590. */
  2591. initialize: function(glassContext) {
  2592. if (!this._initialized && glassContext) {
  2593. this.glassContext = glassContext;
  2594. this._logger = glassContext.getCoreSvc('.Logger');
  2595. this._USER_ID = glassContext.profile.account.id;
  2596. this._LOCAL_STORAGE_KEY = 'MRUStorage_' + this._USER_ID;
  2597. this._GATEWAY = glassContext.gateway || '';
  2598. this._isCAPASSOEnv = glassContext.getCoreSvc('.FeatureChecker').checkValue('contentNav', 'CAPASSO', 'enabled');
  2599. // initialize from local storage
  2600. if (UIHelper.isLocalStorageSupported()) {
  2601. if (this._getUserMRUCookie()) {
  2602. var storedMRUQueue = localStorage.getItem(this._LOCAL_STORAGE_KEY);
  2603. if (storedMRUQueue) {
  2604. try {
  2605. this._queue = JSON.parse(storedMRUQueue);
  2606. } catch (error) {
  2607. this._logger.error('Failed to restore MRU queue from local storage', error);
  2608. }
  2609. localStorage.removeItem(this._LOCAL_STORAGE_KEY);
  2610. }
  2611. } else {
  2612. this._setUserMRUCookie();
  2613. }
  2614. }
  2615. var onUnload = function(asyncVal, returnPromise) {
  2616. // on the final unload, we may not want to block the user from closing the browser by
  2617. // choosing 'async' or returning a promise
  2618. var finalDump = this._doFinalDump(asyncVal);
  2619. return returnPromise ? finalDump : undefined;
  2620. }.bind(this);
  2621. if (BrowserUtils.isIPad()) {
  2622. //Code for Ipad and mobile Apple devices
  2623. $(window).blur(onUnload.bind(this, false, false));
  2624. } else {
  2625. //Code for browsers (Safari, Chrome, FF, IE)
  2626. //More specifically, closing the tab or closing the window
  2627. $(window).bind('beforeunload', onUnload.bind(this, false, false));
  2628. }
  2629. // for log out
  2630. try {
  2631. return glassContext.getSvc('.Logout')
  2632. .then(function(logoutSvc) {
  2633. logoutSvc.registerPreLogout(onUnload.bind(this, true, true));
  2634. return this;
  2635. }.bind(this));
  2636. } catch(error) {
  2637. this._logger.error(error);
  2638. } finally {
  2639. this.cycle();
  2640. this._initialized = true;
  2641. }
  2642. }
  2643. return Promise.resolve(this);
  2644. },
  2645. // perform last dump of mru queue before session end (via logout or window unload)
  2646. _doFinalDump: function(asyncVal) {
  2647. try {
  2648. // cancel any pending dump through the interval
  2649. this.cycle(false);
  2650. // dump the queue if required
  2651. if (this._needsRefresh) {
  2652. // store current MRU queue in local storage in case browser cannot successfully perform the 'dump' ajax calls
  2653. if (UIHelper.isLocalStorageSupported()) {
  2654. if (this._getUserMRUCookie()) {
  2655. localStorage.setItem(this._LOCAL_STORAGE_KEY, JSON.stringify(this._queue));
  2656. } else if (localStorage.getItem(this._LOCAL_STORAGE_KEY)) {
  2657. // clean localStorage entry if cookie was deleted
  2658. localStorage.removeItem(this._LOCAL_STORAGE_KEY);
  2659. }
  2660. }
  2661. // pass along async value, but always skip error handling in last dump
  2662. return this.dump(asyncVal, true);
  2663. }
  2664. } catch (error) {
  2665. this.glassContext.getCoreSvc('.Logger').error(error);
  2666. } finally {
  2667. this._needsRefresh = false;
  2668. }
  2669. return Promise.resolve();
  2670. },
  2671. _getUserMRUCookie: function() {
  2672. var mruCookie = (CookieJar.getCookieValue(this._MRU_COOKIE_KEY));
  2673. mruCookie = (mruCookie) ? JSON.parse(mruCookie) : {};
  2674. return mruCookie[this._USER_ID];
  2675. },
  2676. _setUserMRUCookie: function() {
  2677. var mruCookie = (CookieJar.getCookieValue(this._MRU_COOKIE_KEY));
  2678. mruCookie = (mruCookie) ? JSON.parse(mruCookie) : {};
  2679. mruCookie[this._USER_ID] = true;
  2680. this._getCookiePath().then(function(path) {
  2681. this._isSecureCookies().then(function(isSecure) {
  2682. CookieJar.setCookie(this._MRU_COOKIE_KEY, JSON.stringify(mruCookie), undefined, path, undefined, isSecure);
  2683. }.bind(this));
  2684. }.bind(this));
  2685. },
  2686. _isSecureCookies: function() {
  2687. return this.glassContext.getCoreSvc('.Config').getConfigValue(this._CONFIG_SECURE_COOKIES).then(function(response) {
  2688. if (response && response === 'true') {
  2689. return true;
  2690. }
  2691. return false;
  2692. });
  2693. },
  2694. _getCookiePath: function() {
  2695. return this.glassContext.getCoreSvc('.Config').getConfigValue(this._CONFIG_COOKIE_PATH).then(function(response) {
  2696. if (response) {
  2697. return response;
  2698. }
  2699. return undefined;
  2700. });
  2701. },
  2702. push: function(key, elem, updateTimestamp) {
  2703. this._delete(key);
  2704. this._append(key, elem, updateTimestamp);
  2705. this._needsRefresh = true;
  2706. },
  2707. /**
  2708. Updates an entry in the queue with new information. Note, this won't
  2709. update the timestamp of the entry, simply its information (name, location, ...)
  2710. **/
  2711. updateEntry: function(key, objInfo) {
  2712. if (!objInfo || !key) {
  2713. return;
  2714. }
  2715. var index = this.contains(key);
  2716. if (index !== -1) {
  2717. this._queue[index].elem = _.extend(this._queue[index].elem, objInfo);
  2718. this._needsRefresh = true;
  2719. }
  2720. },
  2721. _delete: function(key) {
  2722. var index = this.contains(key);
  2723. var returnValue = null;
  2724. if (index !== -1) {
  2725. returnValue = this._queue[index].elem;
  2726. this._queue.splice(index, 1);
  2727. this._needsRefresh = true;
  2728. }
  2729. return returnValue;
  2730. },
  2731. contains: function(key) {
  2732. var index = -1;
  2733. $.each(this._queue, function(i, val) {
  2734. if (this._compareTo(key, val.key)) {
  2735. index = i;
  2736. return false;
  2737. }
  2738. }.bind(this));
  2739. return index;
  2740. },
  2741. _append: function(key, elem, updateTimestamp) {
  2742. if (this.isFull()) {
  2743. this._queue.shift();
  2744. }
  2745. if (updateTimestamp) {
  2746. var date = new Date();
  2747. elem[this._TIMESTAMP_NUMERICAL_VALUE] = date.getTime();
  2748. elem[this._TIMESTAMP_DATE_VALUE] = date.toISOString();
  2749. }
  2750. this._queue.push({
  2751. 'key': key,
  2752. 'elem': elem
  2753. });
  2754. },
  2755. //The boolean set to false turns off the cyclical dump
  2756. cycle: function(bool) {
  2757. window.clearInterval(this._cycleID);
  2758. if (typeof bool === 'undefined' || bool) {
  2759. this._cycleID = window.setInterval(function() {
  2760. this.dump();
  2761. }.bind(this), this._DUMP_PERIOD);
  2762. }
  2763. },
  2764. dump: function(async, skipErrorHandling) {
  2765. return new Promise(function(resolve) {
  2766. if (this._needsRefresh) {
  2767. if (async === false) {
  2768. this.getFromMRU(async, skipErrorHandling).then(function() {
  2769. this.putToMRU(async, skipErrorHandling).then(function() {
  2770. this._needsRefresh = false;
  2771. resolve();
  2772. }.bind(this));
  2773. }.bind(this));
  2774. } else {
  2775. this.getFromMRU().then(function() {
  2776. this.putToMRU().then(function() {
  2777. this._needsRefresh = false;
  2778. resolve();
  2779. }.bind(this));
  2780. }.bind(this));
  2781. }
  2782. } else {
  2783. resolve();
  2784. }
  2785. }.bind(this));
  2786. },
  2787. refresh: function() {
  2788. return this.dump()
  2789. .then(function() {
  2790. // reset fields
  2791. this._hasBeenPopulated = false;
  2792. this._listObject = {};
  2793. this._queue = [];
  2794. return this._populateQueue();
  2795. }.bind(this));
  2796. },
  2797. //Requires arrays of key/elem pairs
  2798. mergeArrays: function(a, b) { // jshint ignore:line
  2799. var onHold = this._queue;
  2800. this.clear();
  2801. var tempA = [];
  2802. var tempB = [];
  2803. a = a.sort(this.sortTimestamp.bind(this));
  2804. b = b.sort(this.sortTimestamp.bind(this));
  2805. while (!this.isEmpty(a) || !this.isEmpty(b)) {
  2806. if (a.length && b.length && this._compareTo(a[0].key, b[0].key)) {
  2807. //Only push the element with the most recent timestamp
  2808. if (a[0].elem._timestamp >= b[0].elem._timestamp) {
  2809. this.push(a[0].key, a[0].elem);
  2810. } else {
  2811. this.push(b[0].key, b[0].elem);
  2812. }
  2813. tempA.push(a.shift());
  2814. tempB.push(b.shift());
  2815. } else if (a.length && !b.length ||
  2816. (a.length && b.length && a[0].elem._timestamp <= b[0].elem._timestamp)) {
  2817. //Order the queue by timestamp. The smallest timestamp (aka. oldest) gets pushed first
  2818. this.push(a[0].key, a[0].elem);
  2819. tempA.push(a.shift());
  2820. } else if (!a.length && b.length ||
  2821. (a.length && b.length && a[0].elem._timestamp > b[0].elem._timestamp)) {
  2822. this.push(b[0].key, b[0].elem);
  2823. tempB.push(b.shift());
  2824. }
  2825. }
  2826. var returnArr = this._queue;
  2827. this._queue = onHold;
  2828. while (tempA.length > 0) {
  2829. a.push(tempA.shift());
  2830. }
  2831. while (tempB.length > 0) {
  2832. b.push(tempB.shift());
  2833. }
  2834. return returnArr;
  2835. },
  2836. sortTimestamp: function(a, b) {
  2837. var aTime = a.elem[this._TIMESTAMP_NUMERICAL_VALUE];
  2838. var bTime = b.elem[this._TIMESTAMP_NUMERICAL_VALUE];
  2839. return ((aTime < bTime) ? -1 : ((aTime > bTime) ? 1 : 0));
  2840. },
  2841. //Assumes the arr's elements contain the property 'id'
  2842. addKeysToArray: function(arr) {
  2843. if (!arr[0] || !arr[0].id) {
  2844. return [];
  2845. }
  2846. var temp = this._queue;
  2847. this.clear();
  2848. $.each(arr, function(index, elem) {
  2849. this.push(elem.id, elem);
  2850. }.bind(this));
  2851. var returnArr = this._queue;
  2852. this._queue = temp;
  2853. return returnArr;
  2854. },
  2855. getFromMRU: function(async, skipErrorHandling) {
  2856. return new Promise(function(resolve) {
  2857. async = async !== false;
  2858. skipErrorHandling = skipErrorHandling === true;
  2859. var url = this._DEFAULT_URL;
  2860. var options = {
  2861. 'url': url,
  2862. 'dataType': 'json',
  2863. 'async': async,
  2864. 'skipErrorHandling': skipErrorHandling,
  2865. 'data': {}
  2866. };
  2867. this.glassContext.getCoreSvc('.Ajax').ajax(options)
  2868. .then(function(response) {
  2869. response = response.data;
  2870. var needsTrimming = false;
  2871. var flippedQueue = [];
  2872. var i = this.findList(response);
  2873. if (i !== -1) {
  2874. if (!this._listObject[this._LIST_VALUE]) {
  2875. this._listObject = response[i];
  2876. this._listObject[this._ID_VALUE] = response[i][this._ID_VALUE];
  2877. }
  2878. if (this._listObject[this._LIST_VALUE] && $.isArray(this._listObject[this._LIST_VALUE])) {
  2879. flippedQueue = this._listObject[this._LIST_VALUE].reverse();
  2880. }
  2881. if (response.length > 1) {
  2882. needsTrimming = true;
  2883. this.trimMRU(response, url, 0 /*count*/ , i /*keeper*/ ).then(resolve);
  2884. }
  2885. } else if (response.length) {
  2886. needsTrimming = true;
  2887. this.trimMRU(response, url).then(resolve);
  2888. }
  2889. this._queue = this.mergeArrays(this._queue, this.addKeysToArray(flippedQueue));
  2890. if (!needsTrimming) {
  2891. resolve();
  2892. }
  2893. }.bind(this))
  2894. .catch(this._handleMRUError.bind(this));
  2895. }.bind(this));
  2896. },
  2897. findList: function(arrayOfLists) {
  2898. //Returns the index of the element containing a proper ID and a 'list' value, or -1 otherwise
  2899. var index = -1;
  2900. if (!$.isArray(arrayOfLists)) {
  2901. return index;
  2902. }
  2903. $.each(arrayOfLists, function(i, value) {
  2904. if (value.hasOwnProperty(this._LIST_VALUE) &&
  2905. value[this._ID_VALUE] === this._LIST_ID) {
  2906. index = i;
  2907. }
  2908. }.bind(this));
  2909. return index;
  2910. },
  2911. //A safety measure, in case the MRU data gets duplicated. Recursively deletes
  2912. //all but the element with an ID matching this._LIST_ID.
  2913. trimMRU: function(mruArr, url, count, keeper) {
  2914. if (!count) {
  2915. count = 0;
  2916. }
  2917. if (count > mruArr.length - 1) {
  2918. return Promise.resolve();
  2919. }
  2920. var promise;
  2921. if (count !== keeper) {
  2922. var idUrl = url + '/' + mruArr[count].id;
  2923. this.counter = this.counter + 1;
  2924. var options = {
  2925. 'url': idUrl,
  2926. 'type': 'DELETE',
  2927. 'dataType': 'json'
  2928. };
  2929. promise = this.glassContext.getCoreSvc('.Ajax').ajax(options);
  2930. } else {
  2931. promise = Promise.resolve();
  2932. }
  2933. return promise.then(this.trimMRU.bind(this, mruArr, url, count + 1, keeper)).catch(function(err) {
  2934. // Stop the cycle if the delete call failed as no item will be updated
  2935. this._logger.error(err);
  2936. this.cycle(false);
  2937. }.bind(this));
  2938. },
  2939. putToMRU: function(async, skipErrorHandling) {
  2940. var url = this._DEFAULT_URL;
  2941. async = async !== false;
  2942. skipErrorHandling = skipErrorHandling === true;
  2943. return this.getQueue(true)
  2944. .then(function(mruQueue) {
  2945. this._listObject[this._LIST_VALUE] = mruQueue;
  2946. this._listObject[this._ID_VALUE] = this._LIST_ID;
  2947. url += '/' + this._listObject[this._ID_VALUE];
  2948. var options = {
  2949. 'contentType': 'application/json',
  2950. 'dataType': 'json',
  2951. 'async': async,
  2952. 'skipErrorHandling': skipErrorHandling,
  2953. 'type': 'PUT',
  2954. 'url': url,
  2955. 'data': JSON.stringify(this._listObject)
  2956. };
  2957. return this.glassContext.getCoreSvc('.Ajax').ajax(options)
  2958. .then(function() {
  2959. this.printQueue();
  2960. }.bind(this))
  2961. .catch(this._handleMRUError.bind(this));
  2962. }.bind(this));
  2963. },
  2964. _handleMRUError: function(err) {
  2965. this._logger.error('Failed to get/set MRU', err);
  2966. return Promise.reject(err);
  2967. },
  2968. // Marks the element as deleted (doesn't really *remove* the element)
  2969. remove: function(key) {
  2970. var elem = this._delete(key);
  2971. if (elem !== null) {
  2972. elem[this._DELETE_VALUE] = true;
  2973. this._append(key, elem, true);
  2974. }
  2975. },
  2976. // Remove all of the children of the container from the MRU list and keep the container itself.
  2977. removeContainer: function(containerInfo) {
  2978. if (!containerInfo.ancestors) {
  2979. this._logger.warn('Missing ancestors info');
  2980. return Promise.resolve();
  2981. }
  2982. return this.getQueue().then(function(mruQueue) {
  2983. //For each element in the MRU...
  2984. $.each(mruQueue, function(mruIndex, mruItem) {
  2985. /*Compare it with the deleted container. Look at each shared ancestor, and if they all match,
  2986. it means the MRU item is a descendant of that container.*/
  2987. var mruAncestors = mruItem[this._FOLDER].split(' > ');
  2988. var isContained = false;
  2989. $.each(containerInfo.ancestors, function(ancestorIndex, ancestorItem) {
  2990. if (ancestorItem[this._NAME] !== mruAncestors[ancestorIndex]) {
  2991. return false;
  2992. } else if (ancestorIndex === containerInfo.ancestors.length - 1 &&
  2993. mruAncestors[ancestorIndex + 1] &&
  2994. mruAncestors[ancestorIndex + 1] === containerInfo.defaultName) {
  2995. //All the ancestors match
  2996. isContained = true;
  2997. }
  2998. }.bind(this));
  2999. if (isContained && mruItem.id) {
  3000. //A deleted element is an ancestor to this MRU item. Remove that item from the MRU.
  3001. this.remove(mruItem.id);
  3002. }
  3003. }.bind(this));
  3004. }.bind(this));
  3005. },
  3006. //Returns a new array devoid of the keys and deleted elements, flipped so that index [0] is the newest Element
  3007. // @param returnAll : if true, returns all the items in the queue, including the deleted ones waiting to be cleaned.
  3008. getQueue: function(returnAll) {
  3009. return this._populateQueue().then(function() {
  3010. var arr = [];
  3011. this._removeDuplicateElements();
  3012. $.each(this._queue, function(i, value) {
  3013. if (returnAll || (!value.elem[this._DELETE_VALUE] && (!value.elem[this._SELFURL_VALUE] || value.elem[this._SELFURL_VALUE].indexOf(this._GATEWAY) === 0 || this._isCAPASSOEnv))) {
  3014. arr.push(value.elem);
  3015. }
  3016. }.bind(this));
  3017. return arr.reverse();
  3018. }.bind(this));
  3019. },
  3020. _populateQueue: function() {
  3021. if (this._hasBeenPopulated || this._listObject[this._LIST_VALUE]) {
  3022. return Promise.resolve('populated');
  3023. }
  3024. return this.getFromMRU().then(function() {
  3025. this._hasBeenPopulated = true;
  3026. }.bind(this));
  3027. },
  3028. // Remove older elements with same name and folder from the queue
  3029. _removeDuplicateElements: function() {
  3030. $.each(this._queue, function(key, value) {
  3031. var elem = value.elem;
  3032. if (this._isDuplicate(elem)) {
  3033. elem[this._DELETE_VALUE] = true;
  3034. }
  3035. }.bind(this));
  3036. },
  3037. // Returns true if elem is a duplicate
  3038. _isDuplicate: function(elem) {
  3039. // If not already deleted and has a newer version... then it's a duplicate
  3040. return !elem[this._DELETE_VALUE] && this._hasNewerVersion(elem);
  3041. },
  3042. // Returns true if a newer elem with same name and folder exists in the queue
  3043. _hasNewerVersion: function(elem) {
  3044. // Iterate over the queue until we find a newer version of the element
  3045. return this._queue.some(function(candidate) {
  3046. return this._isNewerVersion(candidate.elem, elem);
  3047. }.bind(this));
  3048. },
  3049. // Returns true if candidate is a newer version of elem
  3050. _isNewerVersion: function(candidate, elem) {
  3051. return candidate.id !== elem.id &&
  3052. !candidate[this._DELETE_VALUE] &&
  3053. candidate[this._FOLDER] === elem[this._FOLDER] &&
  3054. candidate[this._NAME] === elem[this._NAME] &&
  3055. candidate[this._TIMESTAMP_NUMERICAL_VALUE] >= elem[this._TIMESTAMP_NUMERICAL_VALUE];
  3056. },
  3057. _clearLastDeletedElem: function() {
  3058. while (this._queue[0] && this._queue[0].elem[this._DELETE_VALUE] && this._queue.length > this._QUEUE_MAX_SIZE) {
  3059. this._queue.shift();
  3060. }
  3061. },
  3062. isFull: function() {
  3063. if (this._queue.length < this._QUEUE_MAX_SIZE || this._QUEUE_MAX_SIZE === 0) {
  3064. return false;
  3065. } else {
  3066. this._clearLastDeletedElem();
  3067. }
  3068. var count = 0;
  3069. $.each(this._queue, function(i/*, value*/) {
  3070. if (!this._queue[i].elem[this._DELETE_VALUE]) {
  3071. count = count + 1;
  3072. }
  3073. }.bind(this));
  3074. return count >= this._QUEUE_MAX_SIZE;
  3075. },
  3076. isEmpty: function(arr) {
  3077. if (arr) {
  3078. return !arr.length;
  3079. }
  3080. return !this._queue.length;
  3081. },
  3082. clear: function() {
  3083. this._queue = [];
  3084. },
  3085. printQueue: function() {
  3086. this._logger.info('Printing the queue');
  3087. this._logger.info(this._queue);
  3088. },
  3089. getMaxSize: function() {
  3090. return this._QUEUE_MAX_SIZE;
  3091. }
  3092. });
  3093. return MRUQueue;
  3094. });
  3095. /*
  3096. *+------------------------------------------------------------------------+
  3097. *| Licensed Materials - Property of IBM
  3098. *| IBM Cognos Products: Content Explorer
  3099. *| (C) Copyright IBM Corp. 2015, 2021
  3100. *|
  3101. *| US Government Users Restricted Rights - Use, duplication or disclosure
  3102. *| restricted by GSA ADP Schedule Contract with IBM Corp.
  3103. *+------------------------------------------------------------------------+
  3104. */
  3105. // jshint -W072
  3106. define('bacontentnav/services/ContentService',[
  3107. '../lib/@waca/baglass/js/baglass/app/services/AjaxService',
  3108. '../lib/@waca/core-client/js/core-client/utils/Utils',
  3109. '../utils/ContentStoreObject',
  3110. '../utils/GlassContextHelper',
  3111. '../utils/UIHelper',
  3112. '../utils/ContentServiceUrls',
  3113. './MRUClientStore',
  3114. '../nls/StringResource',
  3115. 'jquery',
  3116. 'underscore'
  3117. ], function(AjaxService, Utils, ContentStoreObject, GlassContextHelper, UIHelper, ContentServiceUrls, MRUClientStore, StringResources, $, _) {
  3118. 'use strict';
  3119. // constants for mru management
  3120. var MRU_HTTP_HEADER_NAME = 'X-BI-MRU-PUT';
  3121. var MRU_CATEGORY = 'CONTENT_MRU';
  3122. var MRU_KEY_FUNCTION_MAP = {
  3123. 'formatedPath': 'getLocation',
  3124. 'defaultName': 'getName',
  3125. 'type': 'getType',
  3126. 'disabled': 'getDisabled',
  3127. 'permissions': 'getPermissions',
  3128. 'selfUrl': 'getSelfLink'
  3129. };
  3130. var MRU_OPTIONALKEY_FUNCTION_MAP = {
  3131. 'defaultScreenTip': 'getTooltip',
  3132. 'hidden': 'getHidden', // hidden will not be returned if the user doesn't have 'read', but they may have 'execute'
  3133. 'iconURI': 'getIcon',
  3134. 'owner': 'getOwnerName',
  3135. 'tags': 'getTags'
  3136. };
  3137. // fields with the same name that appear both in an MRU entry and content-service object
  3138. var _COMMON_MRU_FIELDS = ['defaultName','type','owner','permissions','disabled','hidden','iconURI','defaultScreenTip'];
  3139. /**
  3140. * For any ajax request done through the content service, you can specify MRUInfo option to add to the MRU list.
  3141. * At a minimum, this MRUInfo should contain the id of the content-service asset. If not a 'get' operation,
  3142. * a rest call will be made to fetch the asset freshly from content-service to persist it to that user's mru.
  3143. */
  3144. var ContentService = AjaxService.extend({
  3145. init: function(options) {
  3146. ContentService.inherited('init', this, arguments);
  3147. _.extend(this, options);
  3148. this.initialize(this.glassContext);
  3149. },
  3150. get: function(path, options, originalDeferred) {
  3151. void(path, originalDeferred);
  3152. // merge any fields in the given options with the needed mru fields
  3153. // NOTE: it seems that some fields added in the MRU request are not required for MRU,
  3154. // but are currently expected by consumers, eg. permissions
  3155. var fields = options && options.data && options.data.fields;
  3156. var type = options && options.MRUInfo && options.MRUInfo.type || 'unknown';
  3157. var fieldsArray = (fields ? fields.split(',') : []).concat(UIHelper.getMRUFields(type));
  3158. fieldsArray = _.uniq(fieldsArray);
  3159. // add these fields to the options data
  3160. options = options || {};
  3161. options.data = options.data || {};
  3162. options.data.fields = fieldsArray.join(',');
  3163. // make the get request
  3164. var deferred = $.Deferred();
  3165. ContentService.inherited('get', this, arguments)
  3166. .then(function() {
  3167. deferred.resolve.apply(deferred, arguments);
  3168. if (options.MRUInfo) {
  3169. this._addToMRU(arguments[0].data[0]);
  3170. }
  3171. }.bind(this), function() {
  3172. deferred.reject.apply(deferred, arguments);
  3173. });
  3174. return deferred.promise();
  3175. },
  3176. post: function(path, options, originalDeferred) {
  3177. void(path, originalDeferred);
  3178. var deferred = $.Deferred();
  3179. ContentService.inherited('post', this, arguments)
  3180. .then(function(data, status, request) {
  3181. deferred.resolve.apply(deferred, arguments);
  3182. if (options.MRUInfo) {
  3183. // extend MRU with location in response header
  3184. options.MRUInfo.selfUrl = request.getResponseHeader('location');
  3185. this._fetchAndAddToMRU(options.MRUInfo);
  3186. }
  3187. }.bind(this), function(){
  3188. deferred.reject.apply(deferred, arguments);
  3189. });
  3190. return deferred.promise();
  3191. },
  3192. put: function(path, options, originalDeferred) {
  3193. void(path, originalDeferred);
  3194. var deferred = $.Deferred();
  3195. ContentService.inherited('put', this, arguments)
  3196. .then(function() {
  3197. deferred.resolve.apply(deferred, arguments);
  3198. if (options.MRUInfo) {
  3199. this._fetchAndAddToMRU(options.MRUInfo);
  3200. }
  3201. }.bind(this), function(){
  3202. deferred.reject.apply(deferred, arguments);
  3203. });
  3204. return deferred.promise();
  3205. },
  3206. delete: function(path, options, originalDeferred) {
  3207. void(path, originalDeferred);
  3208. // TODO: does this work?
  3209. if (options.MRUInfo && options.MRUInfo.id) {
  3210. options.headers = options.headers || [];
  3211. // To remove something from the MRU specify the category and ID
  3212. options.headers[MRU_HTTP_HEADER_NAME] = JSON.stringify({
  3213. category: MRU_CATEGORY,
  3214. key: options.MRUInfo.id
  3215. });
  3216. }
  3217. return ContentService.inherited('delete', this, arguments);
  3218. },
  3219. /**
  3220. * Returns the MRU entry json for a given content-service object
  3221. * @param {object} objInfo - the content service object
  3222. */
  3223. _getMRUEntry: function(objInfo) {
  3224. var mruEntry = {};
  3225. // populate the new mruEntry
  3226. mruEntry[ContentStoreObject.ID] = objInfo.id;
  3227. // set required fields
  3228. _.each(Object.keys(MRU_KEY_FUNCTION_MAP), function(key){
  3229. mruEntry[key] = ContentStoreObject[MRU_KEY_FUNCTION_MAP[key]](objInfo);
  3230. });
  3231. // set optional fields depending on type
  3232. var mruFields = UIHelper.getMRUFields(ContentStoreObject.getType(objInfo));
  3233. _.each(Object.keys(MRU_OPTIONALKEY_FUNCTION_MAP), function(key) {
  3234. if (mruFields.indexOf(key) !== -1 && objInfo.hasOwnProperty(key)) {
  3235. mruEntry[key] = ContentStoreObject[MRU_OPTIONALKEY_FUNCTION_MAP[key]](objInfo);
  3236. }
  3237. });
  3238. // special case - base comes back in array from content-service, so persist it like that
  3239. if (mruFields.indexOf('base') !== -1 && ContentStoreObject.getBase(objInfo)) {
  3240. mruEntry['base'] = [ContentStoreObject.getBase(objInfo)];
  3241. }
  3242. return mruEntry;
  3243. },
  3244. /**
  3245. * Puts the given object into the MRU queue if it has valid fields
  3246. * @param {object} objInfo - the content service object
  3247. */
  3248. _addToMRU: function(objInfo) {
  3249. var hasValidFieldsForMRU =
  3250. !(_.some(UIHelper.getMRUFields(ContentStoreObject.getType(objInfo), true), function(field){
  3251. return objInfo[field] === undefined || objInfo[field] === null;
  3252. }));
  3253. if (hasValidFieldsForMRU) {
  3254. var mruEntry = this._getMRUEntry(objInfo);
  3255. this.mruQueue.push(mruEntry.id, mruEntry, true);
  3256. this.eventRouter.trigger('home:refresh', { dump: false });
  3257. } else {
  3258. this.logger.debug('Not adding to asset to MRU list: ' + objInfo.id);
  3259. }
  3260. },
  3261. /**
  3262. * If the object type is enabled for MRU, fetches the asset, then adds it to the MRU queue
  3263. * @param {object} objInfo - the content service object
  3264. */
  3265. _fetchAndAddToMRU: function(objInfo) {
  3266. // short-circuit fetch if asset is not supported
  3267. if (UIHelper.isMRUSupported(objInfo)) {
  3268. // fetch the asset to ensure it is 'fresh', then persist to mru list
  3269. var options = {
  3270. 'url': ContentStoreObject.getSelfLink(objInfo),
  3271. 'dataType': 'json',
  3272. 'type': 'GET',
  3273. 'data': {
  3274. 'fields': UIHelper.getMRUFields(ContentStoreObject.getType(objInfo)).join(',')
  3275. }
  3276. };
  3277. this.glassContext.getCoreSvc('.Ajax').ajax(options)
  3278. .then(function(response) {
  3279. this._addToMRU(response.data.data[0]);
  3280. }.bind(this))
  3281. .catch(function(err) {
  3282. // just log the error - there's nothing a user can do
  3283. this.logger.error(err);
  3284. }.bind(this));
  3285. }
  3286. },
  3287. /**
  3288. * Returns an encoded path for the given parameter
  3289. * @param {string} path
  3290. */
  3291. _getEncodedPath: function(path) {
  3292. var pathWithNoSlash = path ? path.replace(/^\//, '') : path;
  3293. return encodeURIComponent(pathWithNoSlash);
  3294. },
  3295. /**
  3296. * Puts the given object into the MRU if it is valid for the MRU,
  3297. * otherwise, it will try to fetch the object one time to get
  3298. * @param {object} objInfo - the content service object
  3299. */
  3300. addToMRU: function(objInfo) {
  3301. this._fetchAndAddToMRU(objInfo);
  3302. },
  3303. /**
  3304. * Updates the MRU entry for the given content-service object
  3305. * (if it exists in the current MRU queue)
  3306. * @param {object} objInfo - the content service object
  3307. */
  3308. updateMRUEntry: function(objInfo) {
  3309. if (objInfo && objInfo.id) {
  3310. // Build up the MRU entry, then remove any entry that was not well defined in objInfo
  3311. var mruEntry = this._getMRUEntry(objInfo);
  3312. // regular cases where the content-service field names match mru field names
  3313. _.each(_COMMON_MRU_FIELDS, function(field) {
  3314. if (objInfo[field] === undefined || objInfo[field] === null || objInfo[field] === '') {
  3315. delete mruEntry[field];
  3316. }
  3317. });
  3318. // special case where they don't...
  3319. if (!objInfo['ancestors']) {
  3320. delete mruEntry['formatedPath'];
  3321. }
  3322. // self urls shouldn't change, so don't update them
  3323. delete mruEntry['selfUrl'];
  3324. this.mruQueue.updateEntry(mruEntry.id, mruEntry);
  3325. this.eventRouter.trigger('home:refresh', { dump: false });
  3326. }
  3327. },
  3328. /**
  3329. * Removes the MRU entry for the given content-service object
  3330. * (if it exists in the current MRU queue)
  3331. * @param {object} objInfo - the content service object
  3332. */
  3333. removeFromMRU: function(objInfo) {
  3334. if (objInfo && objInfo.id) {
  3335. // ??? containers aren't in the MRU
  3336. if (UIHelper.isContainer(ContentStoreObject.getType(objInfo))) {
  3337. this.mruQueue.removeContainer(objInfo);
  3338. }
  3339. this.mruQueue.remove(objInfo.id);
  3340. this.eventRouter.trigger('home:refresh', { dump: false });
  3341. } else {
  3342. this.logger.debug('Missing information to remove from the MRU List: ' + objInfo);
  3343. }
  3344. return $.Deferred().resolve(true).promise();
  3345. },
  3346. getBaseObjectsURL: function() {
  3347. return ContentServiceUrls.getBaseObjectsURL();
  3348. },
  3349. getBasePathURL: function() {
  3350. return ContentServiceUrls.getBasePathURL();
  3351. },
  3352. /**
  3353. * @param {String} path - unencoded path
  3354. * @return the url for the given path
  3355. */
  3356. getPathUrl: function(path) {
  3357. return ContentServiceUrls.getBasePathURL() + this._getEncodedPath(path);
  3358. },
  3359. /**
  3360. * @param {String} path - unencoded path
  3361. * @return the search path url for the given path
  3362. */
  3363. getSearchPathUrl: function(path) {
  3364. return ContentServiceUrls.getBaseSearchPathURL() + this._getEncodedPath(path);
  3365. },
  3366. getMyFoldersURL: function() {
  3367. return ContentServiceUrls.getMyFoldersURL();
  3368. },
  3369. getOtherUsersFoldersURL: function() {
  3370. return ContentServiceUrls.getOtherUsersFoldersURL();
  3371. },
  3372. getBaseNamespaceURL: function() {
  3373. return ContentServiceUrls.getBaseNamespaceURL();
  3374. },
  3375. getPublicFoldersURL: function() {
  3376. return ContentServiceUrls.getPublicFoldersURL();
  3377. },
  3378. refreshMRU: function() {
  3379. return this.mruQueue.refresh();
  3380. },
  3381. getMRUList: function() {
  3382. return this.mruQueue.getQueue()
  3383. .then(function(data) {
  3384. // filter out items that should be hidden to the user (unless their preference is to see them)
  3385. if (!GlassContextHelper.getUserPreference(this.glassContext, 'showHiddenObjects')) {
  3386. data = _.filter(data, function(item){
  3387. return !ContentStoreObject.getHidden(item);
  3388. });
  3389. }
  3390. return data || [];
  3391. }.bind(this));
  3392. },
  3393. getLocation: function(oData) {
  3394. return ContentStoreObject.getLocation(oData);
  3395. },
  3396. getMRUMaxSize: function() {
  3397. return this.mruQueue.getMaxSize();
  3398. },
  3399. initialize: function(glassContext) {
  3400. if (!glassContext) {
  3401. return;
  3402. }
  3403. this.glassContext = glassContext;
  3404. this.eventRouter = this.glassContext.getCoreSvc('.Events');
  3405. this.logger = this.glassContext.getCoreSvc('.Logger');
  3406. ContentStoreObject.setGlassContext(glassContext);
  3407. // Adding the glassContext to Utils for date and time translation.
  3408. if (_.isFunction(Utils.init)) {
  3409. Utils.init({
  3410. 'glassContext': this.glassContext
  3411. });
  3412. }
  3413. // create and initialize the MRU store
  3414. this.mruQueue = new MRUClientStore();
  3415. return this.mruQueue.initialize(glassContext);
  3416. },
  3417. getRootPublicFolderName: function() {
  3418. return ContentServiceUrls.getRootPublicFolderName();
  3419. },
  3420. getRootMyFolderName: function() {
  3421. return ContentServiceUrls.getRootMyFolderName();
  3422. },
  3423. showFolder: function(folder) {
  3424. return this._getFolderData(folder).then(function(folderInfo) {
  3425. if(folderInfo) {
  3426. this._openFolder(folderInfo);
  3427. }
  3428. }.bind(this));
  3429. },
  3430. _getFolderData: function(folderPathRef) {
  3431. var options = {
  3432. dataType: 'json',
  3433. type: 'GET',
  3434. url: 'v1/path?path=' + encodeURIComponent(folderPathRef),
  3435. data: {
  3436. 'fields': 'id,type,defaultName,ancestors,shown'
  3437. }
  3438. };
  3439. return this.glassContext.getCoreSvc('.Ajax').ajax(options).then(function(objInfo) {
  3440. var folder = objInfo.data.data[0];
  3441. if (folder.type !== 'folder' && folder.ancestors && folder.ancestors.length) {
  3442. return this._getFolderData(folder.ancestors.pop().id);
  3443. }
  3444. return objInfo.data.data[0];
  3445. }.bind(this)).catch(function(error) {
  3446. this.logger.error('Failed to retrieve objInfo for pathRef=' + folderPathRef, error);
  3447. this._showUnableToOpenFolderMessage();
  3448. }.bind(this));
  3449. },
  3450. // Check if a folder is top level (Need to transform My Folders to My Content, since we get back My Folders from content store)
  3451. _isTopLevel: function(objInfo){
  3452. if (objInfo.ancestors){
  3453. for (var i = 0; i < objInfo.ancestors.length; i++) {
  3454. if (objInfo.ancestors[i].type === 'folder'){
  3455. return false;
  3456. }
  3457. }
  3458. return true;
  3459. }
  3460. },
  3461. _openFolder: function(folderInfo) {
  3462. if(folderInfo.shown === true) {
  3463. // Top level directory My content
  3464. var isTopLevel = this._isTopLevel(folderInfo);
  3465. var isUserContent = this._isUserContent(folderInfo, isTopLevel);
  3466. var pluginId = isUserContent ? 'com.ibm.bi.contentApps.myContentFoldersSlideout' : 'com.ibm.bi.contentApps.teamFoldersSlideout';
  3467. var plugin = this.glassContext.appController.findPlugin(pluginId);
  3468. if(plugin) {
  3469. return plugin.getActionController().then(function(actionController) {
  3470. // here: set plugin options as needed...
  3471. plugin.itemSpec.options.content.initialFolder = folderInfo;
  3472. actionController.onPress({
  3473. glassContext: this.glassContext,
  3474. pushState: true,
  3475. target: {
  3476. plugin: plugin
  3477. }
  3478. });
  3479. }.bind(this));
  3480. } else {
  3481. this.logger.error('Cannot find plugin with id="' + pluginId + '"');
  3482. this._showUnableToOpenFolderMessage();
  3483. }
  3484. } else {
  3485. this._showUnableToOpenFolderMessage();
  3486. }
  3487. },
  3488. _showUnableToOpenFolderMessage: function() {
  3489. this.glassContext.appController.showToast(StringResources.get('unableToOpenFolderMsg'), {
  3490. type: 'error',
  3491. preventDuplicates: true
  3492. });
  3493. },
  3494. _isUserContent: function(objInfo, isTopLevel) {
  3495. var ancestors = ContentStoreObject.getAncestors(objInfo);
  3496. if(ancestors && ancestors.length > 0){
  3497. var rootUrl = ContentStoreObject.getSelfLink(ancestors[0]);
  3498. }
  3499. // transforming My Folders to My Content. My Content used to be My Folders and logic needs updating since it still
  3500. // comes back as My Folders from the server
  3501. if (isTopLevel && rootUrl === this.getMyFoldersURL()) {
  3502. objInfo.ancestors = [];
  3503. objInfo.defaultName = StringResources.get('myContent');
  3504. }
  3505. return rootUrl === this.getMyFoldersURL();
  3506. }
  3507. });
  3508. return ContentService;
  3509. });
  3510. /*
  3511. *+------------------------------------------------------------------------+
  3512. *| Licensed Materials - Property of IBM
  3513. *| IBM Cognos Products: Content Explorer
  3514. *| (C) Copyright IBM Corp. 2017, 2018
  3515. *|
  3516. *| US Government Users Restricted Rights - Use, duplication or disclosure
  3517. *| restricted by GSA ADP Schedule Contract with IBM Corp.
  3518. *+------------------------------------------------------------------------+
  3519. */
  3520. define('bi/content_apps/api/ContentSlideoutController',[
  3521. 'bi/glass/app/NavbarButtonSlideoutController',
  3522. 'bacontentnav/utils/ContentStoreObject',
  3523. 'bacontentnav/utils/UIHelper',
  3524. 'underscore'
  3525. ], function(NavbarButtonSlideoutController, ContentStoreObject, UIHelper, _) {
  3526. 'use strict'; //NOSONAR
  3527. var ContentSlideoutController = NavbarButtonSlideoutController.extend({
  3528. /**
  3529. * Builds a predefined spec for slideout.
  3530. * If current content view has a folderInfo object then it
  3531. * builds a slideout spec to display a folder instead of root
  3532. * based on ancestors from folderInfo object.
  3533. * @public
  3534. * @override
  3535. * @param {object} Context containing glass context and target
  3536. * @returns {object} Slideout item spec
  3537. */
  3538. getCustomSpec: function(context) {
  3539. var spec = ContentSlideoutController.inherited('getCustomSpec', this, arguments);
  3540. var contentView = context.glassContext.appController.getCurrentContentView();
  3541. if (this._hasInitialFolder(spec) || this._needToOpenSpecificFolder(contentView)) {
  3542. try {
  3543. this._addFolderInfoInSpec(spec, contentView);
  3544. } catch (e) {
  3545. context.glassContext.getCoreSvc('.Logger').error('Cannot add folder info in spec', e);
  3546. }
  3547. }
  3548. if (spec.options && spec.options.content.id) {
  3549. var specWidth = UIHelper.getSlideoutWidth(spec.options.content.id);
  3550. if (specWidth) {
  3551. // We need to add 9px for the bar.
  3552. specWidth = parseInt(specWidth);
  3553. specWidth += 9;
  3554. if (specWidth < $(document).width()) {
  3555. spec.options.width = '' + specWidth + 'px';
  3556. }
  3557. }
  3558. }
  3559. return spec;
  3560. },
  3561. _needToOpenSpecificFolder: function(contentView) {
  3562. return contentView && contentView.module === 'cahome/views/CAHomeView' &&
  3563. _.isFunction(contentView.getFolderInfo) &&
  3564. _.isFunction(contentView.resetFolderInfo);
  3565. },
  3566. onShowCallback: function() {
  3567. if (this._slideout && this._slideout.contentView && this._isNotLegacyView(this._slideout.contentView.moduleID)) {
  3568. this._slideout.contentView.toggleSlideoutOpen();
  3569. this._slideout.contentView.render(this.targetFolder);
  3570. }
  3571. },
  3572. _addFolderInfoInSpec: function(spec, contentView) {
  3573. this.targetFolder = spec.options.content.initialFolder;
  3574. this.renderFromReact = spec.options.content.renderFromReact;
  3575. var folderInfo = contentView.getFolderInfo && contentView.getFolderInfo();
  3576. this.targetURL = spec.options.content.url;
  3577. if (spec.options.content.initialFolder) {
  3578. folderInfo = spec.options.content.initialFolder;
  3579. delete spec.options.content.initialFolder;
  3580. }
  3581. if (contentView.resetFolderInfo) {
  3582. contentView.resetFolderInfo();
  3583. }
  3584. if (_.isObject(folderInfo)) {
  3585. var ancestors = _.clone(ContentStoreObject.getAncestors(folderInfo));
  3586. if (ancestors) {
  3587. if (UIHelper.isContainer(ContentStoreObject.getType(folderInfo))) {
  3588. ancestors.push(_.pick(folderInfo, 'id', 'type', 'defaultName', '_meta'));
  3589. } else {
  3590. folderInfo = ancestors[ancestors.length - 1];
  3591. }
  3592. } else {
  3593. ancestors = [];
  3594. }
  3595. spec.options.label = folderInfo.defaultName;
  3596. spec.options.content.ancestors = ancestors;
  3597. spec.options.content.url = ContentStoreObject.getItemsLink(folderInfo);
  3598. spec.options.content.selfUrl = ContentStoreObject.getSelfLink(folderInfo);
  3599. if (this._slideout && this._slideout.contentView) {
  3600. var realAncestors = [];
  3601. for (var i=0; i<ancestors.length; i++) {
  3602. if (ancestors[i].id !== folderInfo.id) {
  3603. realAncestors.push(ancestors[i]);
  3604. }
  3605. }
  3606. folderInfo.ancestors = realAncestors;
  3607. if (!this.renderFromReact) {
  3608. this._slideout.contentView.ancestors = folderInfo.ancestors; // reset the breadcrumbs
  3609. this._slideout.contentView.navigate(folderInfo);
  3610. }
  3611. }
  3612. }
  3613. },
  3614. _hasInitialFolder: function(spec) {
  3615. return spec && spec.options && spec.options.content && _.isObject(spec.options.content.initialFolder);
  3616. },
  3617. _isNotLegacyView: function(id) {
  3618. return id && id.indexOf('LegacyCAMyContentView') === -1 && id.indexOf('LegacyCATeamFoldersView') === -1;
  3619. }
  3620. });
  3621. return ContentSlideoutController;
  3622. });
  3623. define("js/content_apps/contentBundle", function(){});