1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994 |
- /**
- * Licensed Materials - Property of IBM
- *
- * IBM Cognos Products: Content Explorer
- *
- * Copyright IBM Corp. 2015, 2018
- *
- * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- */
- define('bacontentnav/nls/ContentNavResources',{
- "root": true,
- "cs": true,
- "da": true,
- "de": true,
- "es": true,
- "fi": true,
- "fr": true,
- "he": true,
- "hr": true,
- "hu": true,
- "it": true,
- "ja": true,
- "kk": true,
- "ko": true,
- "no": true,
- "nb": true,
- "nl": true,
- "pl": true,
- "pt": true,
- "pt-br": true,
- "ro": true,
- "ru": true,
- "sl": true,
- "sv": true,
- "th": true,
- "tr": true,
- "zh": true,
- "zh-cn": true,
- "zh-tw": true
- });
- /**
- * Licensed Materials - Property of IBM
- * IBM Cognos Products: ba-content-nav
- * (C) Copyright IBM Corp. 2022
- * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- */
- define('bacontentnav/nls/root/ContentNavResources',{
- "allContent": "All content",
- "allGenericItems": "All",
- "myContent": "My content",
- "copy": "Copy to",
- "confirmDelete": "Confirm delete",
- "confirmDeleteMessage": "Deleting entries can break links. Are you sure you want to delete the selected entries?",
- "dashboards": "Dashboards",
- "explorations": "Explorations",
- "delete": "Delete",
- "edit": "Edit",
- "notebooks": "Notebooks",
- "modificationTime": "Modified",
- "modifiedWithColon": "Modified:",
- "move": "Move to",
- "name": "Name",
- "tenant": "Tenant",
- "tenantSettings": "Tenant Settings",
- "tenantSet": "Tenant updated",
- "tenantSetError": "Error setting tenant",
- "tenantClear": "Tenant cleared",
- "tenantClearError": "Error clearing tenant",
- "owner": "Owner",
- "reports": "Reports",
- "copyMove": "Copy or move:",
- "copyOnly": "Copy",
- "noOfItemSelected": "%{noOfItems} selected",
- "selectDestination": "Select a destination",
- "selectAccountGroupOrRole": "Select groups, users or roles",
- "members": "Members",
- "teamContent": "Team content",
- "folderTeamContent": "Folder (Team Content)",
- "folders": "Folders",
- "goToCloudLocation": "Go to cloud location",
- "type": "Type",
- "typeWithColon": "Type:",
- "others": "Other",
- "unknown": "Unknown",
- "description": "Description",
- "general": "General",
- "advancedProperties": "Advanced",
- "location": "Location",
- "schedule": "Schedule",
- "created": "Created",
- "createdWithColon": "Created:",
- "disableThisEntry": "Disable this entry",
- "hideThisEntry": "Hide this entry",
- "indexed": "Indexed",
- "language": "Language",
- "reportOutputVersions": "Report output versions",
- "reportOutputVersion": "Report output version",
- "rowsPerPageHtmlReport": "Rows per page in HTML Reports",
- "package": "Package",
- "data": "Data",
- "dataModule": "Data module",
- "mode": "Mode",
- "live": "Live",
- "snapshot": "Snapshot",
- "noSnapshotsFound": "No Snapshot found",
- "uploadedFile": "Uploaded file",
- "fileUpload": "Upload files",
- "dataSetEx": "Data set",
- "externalRepository": "External repository",
- "queryMode": "Query mode",
- "queryModeCompatible": "Compatible",
- "queryModeDynamic": "Dynamic",
- "report": "Report",
- "activeReport": "Active Report",
- "query": "Query",
- "analysis": "Analysis",
- "permission": "Permissions",
- "capabilities": "Capabilities",
- "newItemMenuLabel": "New",
- "newFolderDefaultName": "New Folder",
- "newFolderLabel": "New folder",
- "switchViewsLabel": "Switch Views",
- "emptyTableContentMessage": "There's nothing in this folder.",
- "emptyRecentList": "You haven't viewed any content recently.",
- "back": "Back",
- "optionsMenuLabel": "Options",
- "defaultAction": "Default action",
- "reportOptions": "Report options",
- "promptValues": "Prompt values",
- "runTheReport": "Run the report",
- "viewMostRecentReport": "View most recent report",
- "openWithReportStudio": "Open with Report Studio",
- "comingSoon": "Coming soon",
- "recentlyViewed": "Recently viewed",
- "destination": "Destination:",
- "lastUsed": "Last Used",
- "reportView": "Report View",
- "reportViews": "Report Views",
- "adminFolder": "Administration",
- "folder": "Folder",
- "dashboard": "Dashboard",
- "dashboardTemplate": "Dashboard Template",
- "exploration": "Exploration",
- "story": "Story",
- "stories": "Stories",
- "notebook": "Notebook",
- "workspace": "Workspace",
- "pagelet": "Page",
- "content": "Content",
- "directory": "Namespaces",
- "dataSet": "Data set",
- "powerPlayCube": "PowerPlay Cube",
- "powerPlayReport": "PowerPlay Report",
- "powerPlay8Report": "PowerPlay Report",
- "powerPlay8ReportView": "PowerPlay Report View",
- "reportTemplate": "Report Template",
- "packageConfigurations": "Package Configuration",
- "agent": "Agent",
- "agentDefinition": "Agent Definition",
- "agentDefinitionView": "Agent View",
- "dataMovementTask": "Data Movement Task",
- "dataMovementTaskAlias": "Data Movement Task Alias",
- "document": "Document",
- "DocumentRetention": "Document properties",
- "jobDefinition": "Job Definition",
- "job": "Job",
- "jobs": "Jobs",
- "metricsDataSourceETLTask": "Metrics Data Source ETL Task",
- "metricsExportTask": "Metrics Export Task",
- "metricsFileImportTask": "Metrics File Import Task",
- "metricsMaintenanceTask": "Metrics Maintenance Task",
- "planningTask": "Planning Task",
- "shortcut": "Shortcut",
- "shortcuts": "Shortcuts",
- "URL": "URL",
- "launchable": "Launchable",
- "dataSetFolder": "Data Set Folder",
- "ViewAccessibleLabel": "View %{label}",
- "overrideReportOptions": "Override the default report options",
- "formats": "Formats",
- "saveReport": "Save the report",
- "promptForValues": "Prompt me",
- "html": "HTML",
- "pdf": "PDF",
- "spreadsheetML": "Excel",
- "xlsxData": "Excel Data",
- "csv": "CSV",
- "xml": "XML",
- "runAs": "Run as",
- "permissionHeader": "Permission",
- "read": "Read",
- "write": "Write",
- "execute": "Execute",
- "setPolicy": "Set Policy",
- "full": "Full",
- "traverse": "Traverse",
- "toastDoneMoving": "%{noOfItems} items were moved.",
- "toastDoneCopying": "%{noOfItems} items were copied.",
- "toastDoneShortcutting": "%{noOfItems} shortcuts were created.",
- "toastDoneDeleting": "%{noOfItems} items were deleted.",
- "toastDoneMovingSingular": "%{nameOfItem} was moved.",
- "toastDoneCopyingSingular": "%{nameOfItem} was copied.",
- "toastDoneShortcuttingSingular": "%{nameOfItem} was created.",
- "toastCreateNewFolder": "%{nameOfFolder} was created.",
- "toastDoneDeletingSingular": "%{nameOfItem} was deleted.",
- "toastLaunchPerspectiveError": "Cannot open %{objectType}.",
- "toastItemsWereAdded": "%{noOfItems} items were added to the profile.",
- "toastItemsWereAddedSingular": "%{noOfItems} item was added to the profile.",
- "toastItemsAlreadyAddedSingular": "Item has already been added to the profile.",
- "toastItemsAlreadyAdded": "Items have already been added to the profile.",
- "toastRunRequestWasSubmitted": "Run request was submitted.",
- "toastNoCapabilityForContainer": "No capabilities or permissions to save into '%{nameOfContainer}'.",
- "shortCutName": "%{nameOfItem}%{shortCutLabel}",
- "ok": "OK",
- "cancel": "Cancel",
- "permissionDetails": "Permission Details",
- "grant": "Grant",
- "deny": "Deny",
- "overrideParentPermissions": "Override parent permissions",
- "applyToAllChildren": "Apply to all children",
- "policiesTableLable": "Policies",
- "policesAddButtonLabel": "Member",
- "policesAddMemberButtonLabel": "Add",
- "policesRemove": "Remove",
- "policiesFindAUserHint": "Search",
- "policiesFindModeMenuTip": "Search method",
- "policiesFindMode": "Search",
- "policiesTypeInMode": "Type in",
- "policyFilterAccounts": "Users",
- "policyFilterRoles": "Roles",
- "policyFilterGroups": "Groups",
- "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",
- "policyToastMessageNamespace": "You must first select a namespace.",
- "emptyPolicyList": "Nothing found",
- "applyLabel": "Apply",
- "permissionRead": "Read",
- "permissionRun": "Run",
- "permissionWrite": "Write",
- "permissionFull": "Full",
- "permissionCustom": "Custom",
- "permissionDetailsColumnAccess": "Access",
- "permissionDetailsColumnPermission": "Permission",
- "permissionDetailsColumnAction": "Action",
- "permissionSetAccess": "Set access",
- "preferencesMyCredentials": "My credentials",
- "preferencesCredentialsLabel": "Credentials",
- "preferencesDataSourceCredentialsLabel": "Data Servers",
- "preferencesDatasourceTitle": "Data server credentials",
- "preferencesDatasourceHeader": "Data server name",
- "preferencesGroupsAndRoles": "Groups and Roles",
- "preferencesMyCapabilities": "My Capabilities",
- "preferencesCredentialsHintText": "Specify the users, groups or roles that can use your credentials to run activities:",
- "preferencesCapabilitiesHintText": "These capabilities are available to you:",
- "preferencesGroupsAndRolesHintText": "In this session, you can use the access permissions of these groups and roles:",
- "preferencesDataSourceCredentialsHintText": "You have saved credentials for these data servers:",
- "enableAccessibilitySupport": "Enable accessibility support",
- "languages": "Languages",
- "True": "True",
- "False": "False",
- "id": "ID",
- "run": "Run",
- "createVersion": "Create a version",
- "create": "Create",
- "size": "Size",
- "sizeByte": "%{value} B",
- "sizeKiloByte": "%{value} KB",
- "sizeMegaByte": "%{value} MB",
- "sizeGigaByte": "%{value} GB",
- "sizeTeraByte": "%{value} TB",
- "sizePetaByte": "%{value} PB",
- "refreshedDatetime": "Refreshed time",
- "dataRefreshed": "Data refreshed",
- "dataRefWithColon": "Data refreshed:",
- "missingPermissions": "You need permissions to view the properties for this item.",
- "missingPolicies": "You only see entries that you have permissions for. You might see different entries if you sign in to a different namespace",
- "versions": "Versions",
- "archives": "Archives",
- "occurrences": "Occurrences",
- "days": "Day(s)",
- "months": "Month(s)",
- "errorMessages": "Messages",
- "errorMessageLengthFolderName": "Please enter a folder name that does not exceed 255 characters.",
- "errorMessageApostropheError": "Please enter a file name that does not contain both ' and \" characters",
- "error": "Error",
- "warn": "Warning",
- "fatal": "Fatal",
- "debug": "Debug",
- "info": "Information",
- "runTime": "Run time",
- "requestTime": "Request time",
- "startTime": "Start time",
- "endTime": "End time",
- "successful": "Successful",
- "failed": "Failed",
- "noSavedOutputs": "There are no saved outputs.",
- "noVersions": "No versions available",
- "noReportOptionsAvailable": "No report options record available.",
- "showDetails": "Open details panel",
- "unavailable": "Unavailable",
- "runInBackgroundOption": "Run in background",
- "selectAFormat": "Please select a format",
- "delivery": "Delivery",
- "now": "Now",
- "later": "Later",
- "invalidTime": "Time selected is earlier than current time. Please select again.",
- "executionPrompt": "Prompt for values",
- "currentValues": "Current values",
- "noPromptsValuesSet": "You currently have no prompt values set",
- "setValues": "Set values",
- "numOfPromptValues": "prompt values",
- "clear": "Clear",
- "sourceReport": "Source Report",
- "reportName": "Report Name",
- "reportLocation": "Report Location",
- "burst": "Burst the report",
- "sourcePackage": "Source Package",
- "packageName": "Package Name",
- "packageLocation": "Package Location",
- "confirmTakeOwnership": "Confirm Take Ownership",
- "confirmTakeOwnershipMessage": "Are you sure you want to take ownership of the selected entries?",
- "SetLabel": "Set...",
- "externalRepositories": "External Repositories",
- "toastTakeOwnership": "You now own %{noOfItemsClaimed} of %{noOfItems} selected items.",
- "runAsUser": "With user's credentials",
- "runWithOwnerCapabilities": "With owner capabilities",
- "runAsOwner": "As %{ownerName}",
- "pdfOptions": "PDF options",
- "set": "Set",
- "passwordNotMatched": "Passwords don't match or are missing",
- "Orientation": "Orientation",
- "default": "Default",
- "portrait": "Portrait",
- "landscape": "Landscape",
- "pageSize": "Paper size",
- "letter": "Letter",
- "legal": "Legal",
- "11x17": "11x17",
- "A3": "A3",
- "A4": "A4",
- "B4JIS": "B4 JIS",
- "B5JIS": "B5 JIS",
- "requiresPasswordToOpenReport": "Requires a password to open the report",
- "requiresPasswordToAccessOptions": "Requires a password to access options",
- "password": "Password:",
- "confirmPassword": "Confirm Password:",
- "runHistory": "Run History",
- "viewRunHistory": "View...",
- "jobAdvancedProperties": "Properties",
- "scheduleAJob": "Schedule Job",
- "viewCurrentVersions": "View document versions",
- "viewArchivedVersions": "View archived versions",
- "renameCollisionError": "%{name} already exists. Try a different name.",
- "nameCollision": "An item with this name already exists:",
- "nameCollisionMessage": "What do you want to do?",
- "copyReplace": "Copy and replace",
- "keepBoth": "Keep both",
- "copySkip": "Don't copy",
- "moveReplace": "Move and replace",
- "moveSkip": "Don't move",
- "repeatNameCollisionAction": "Do this for the next %{noItems} conflicts",
- "repeatNameCollisionActionSingular": "Do this for the next conflict",
- "bulkNameCollision": "There are %{noOfItems} items with names that already exist",
- "overwrite": "Overwrite",
- "rename": "Rename",
- "nameCollisionGeneric": "There are one or more items with a name that already exists.",
- "repeatedDeleteError": "One or more of these items are already in the process of being deleted. Wait until the delete action completes and try again.",
- "repeatedDeleteErrorTitle": "Repeated delete",
- "details": "Details:",
- "role": "Role",
- "account": "Account",
- "contact": "Contact",
- "distributionList": "Distribution list",
- "group": "Group",
- "namespace": "Namespace",
- "SetLanguagesLabel": "Set...",
- "SetExternalRespostoryLabel": "Set...",
- "SetCapabilitiesLabel": "Set...",
- "JobAdvancedSettings": "Set...",
- "JobSchedule": "Set...",
- "JobAdvancedRunHistory": "View...",
- "invalidNumber": "The value entered is not a number. Type a number.",
- "exceedMaxLength": "The text is too long. Shorten to %{maxLength} characters.",
- "invalidInput": "Invalid input",
- "invalidEmailMessage": "Email address is not valid.",
- "typeInHintText": "Example: Namespace1/name; Namespace2/name;",
- "importDeployment": "Import deployment",
- "exportDeployment": "Export deployment",
- "between": "Between",
- "greaterOrEqual": "Greater than or equal to %{upperboundValue}",
- "lessOrEqual": "Less than or equal to %{lowerboundValue}",
- "and": "and",
- "properties": "Properties - %{objectName}",
- "none": "None",
- "objectDeleted": "This object doesn't exist",
- "PageLayout": "Page Layout",
- "PageStyle": "Style",
- "Gateway": "Gateway",
- "PowerPlayReport": "PowerPlay Report",
- "more": "More",
- "title": "Title",
- "itemName": "Item name",
- "showMissingPolicies": "show",
- "hideMissingPolicies": "hide",
- "nowOrLaterRadioOptions": "Run now or later options",
- "runHistoryUnits": "Run history units",
- "reportOutputVersionsUnits": "Report output versions units",
- "breadCrumbsAccessibleLabel": "Ancestor Folders",
- "selectAllFolder": "Select all in folder",
- "deselectAllFolder": "Deselect all in folder",
- "clearAllSelected": "Clear all selected",
- "a11yContentListUpdatedNotification": "Now showing contents of %{folderOrPackageName}",
- "a11yPropertyPane": "Properties of object %{nameOfObject}",
- "moreActionsMenu": "More Actions Menu",
- "itemType": "Item type",
- "confirmCancelMessage": "Do you want to discard your changes?",
- "confirmCancel": "Confirm cancel",
- "formatOptions": "Format options",
- "listControlColumns": "List Columns",
- "source": "Source",
- "external": "External",
- "removeSelectedItem": "Remove selected item",
- "deleteReportVersion": "Delete report version",
- "dataset": "Data set",
- "numberRows": "Number of rows",
- "numberColumns": "Number of columns",
- "TimeToRefresh": "Time to refresh",
- "LastRefreshedBy": "Refreshed by",
- "OverwriteFileSuccessfully": "Successfully overwrote the object %{nameOfObject}",
- "RenameFileSuccessfully": "Successfully renamed the object from %{originalNameOfObject} to %{newNameOfObject}",
- "showAllHistory": "Show all history",
- "history": "History",
- "user": "User",
- "confirmDeleteAllowed": "You do not have permission to delete: %{number} item(s). Would you like to proceed and delete the rest?",
- "download": "Download",
- "personal": "Personal",
- "customization": "Customization",
- "schemas": "Schemas",
- "connections": "Connections",
- "numberOutOfRange": "The value entered must be a number between %{min} and %{max}",
- "numberTooSmall": "The value entered must be a number greater than %{min}",
- "numberTooBig": "The value entered must be a number less than %{max}",
- "searchReturnedNoResults": "Your search returned no results.",
- "tryChangingSearchTerms": "Please try a different search term.",
- "searchAllYourData": "Search all your data",
- "search": "Search",
- "saveSearch": "Save search",
- "narrowYourSearch": "Narrow your search",
- "all": "All",
- "packages": "Packages",
- "savedSearch": "Saved searches",
- "haventSavedSearches": "You haven't saved any searches.",
- "clickTheSaveButton": "Tap the Save search icon after you search.",
- "remove": "Remove",
- "searchWasDeleted": "Search was deleted",
- "searchWasntDeleted": "Search wasn't deleted",
- "searchWasSaved": "Search was saved",
- "searchWasntSaved": "Search wasn't saved",
- "socialInsightsProject": "Social Insights",
- "errorWithSearch": "There was an error with your search.",
- "saveTenSearches": "You can save 10 searches.",
- "deleteASearch": "Delete one to save another.",
- "models": "Models",
- "today": "Today",
- "yesterday": "Yesterday",
- "date": "Date",
- "clearAll": "Clear all",
- "EnterSearchTerms": "Enter a search term before you select a filter type.",
- "pastWeek": "Past week",
- "pastMonth": "Past month",
- "createShortcut": "Create shortcut",
- "createShortcutDialogTitle": "Create shortcut:",
- "shortcutTo": "Shortcut to",
- "shortcutToItem": "Shortcut to %{itemName}",
- "add": "Add",
- "close": "Close",
- "confirmClearTenant": "Confirm clear tenant",
- "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",
- "changeTenantWarning": "Changing the tenant of an entry also changes the tenant of child entries.",
- "dataSource": "Data Server",
- "dataSourceConnection": "Connection",
- "dataSourceSignon": "Sign on",
- "searchForAssets": "You can search for assets",
- "results": "Results",
- "filterBy": "Filter by",
- "resultLimit": "Result limit",
- "noAccessRecent": "No access",
- "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.",
- "capability": "Capability",
- "loading": "Loading",
- "save": "Save",
- "saveAs": "Save as",
- "saveAsLabel": "Save as:",
- "teamFolders": "Team Folders",
- "open": "Open",
- "openDialogTitle": "Open file",
- "openDialogFooter": "Open and cancel button",
- "saveDialogTitle": "Save as",
- "saveDialogFooter": "Save and cancel button",
- "toastSaveErrorSameNameDifferentType": "'%{nameOfItem}' already exists with a different type. Please choose a different name.",
- "filesToOpen": "Files to open:",
- "confirmRefreshUpload": "Confirm replacement of existing data",
- "msgConfirmRefreshUpload": "The file '%{fileName}' already exists. Do you want to replace its data with the data contained in the selected file?",
- "userDataSource": "CSV",
- "dataAsset": "XLS",
- "xls": "XLS",
- "xlsx": "XLSX",
- "sav": "SAV",
- "txt": "TXT",
- "circle": "In progress",
- "sortHeader": "Sort by",
- "filterHeader": "Filter by",
- "sort": "Sort",
- "sortBy": "Sort by",
- "order": "Order",
- "previous": "Previous",
- "collapsedBreadCrumb": "Collapsed items",
- "sortedAscending": "Ascending",
- "sortedDescending": "Descending",
- "itemsOverLimit": "The specified name '%{itemName}' has exceeded the maximum (20) limit. Please specify a different name to continue.",
- "searchFolder": "Type any text",
- "text": "Keywords",
- "noFilterResult": "No data matched your search.",
- "tryOtherFilter": "Try selecting a different filter.",
- "visualization": "Visualization",
- "cosConnection": "Cloud object storage connection",
- "cosConnections": "Cloud object storage connections",
- "cosLocation": "Cloud location",
- "resourceFolder": "Resource folder",
- "unableToOpenFolderMsg": "Unable to open the specified folder"
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2015
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bacontentnav/nls/StringResource',['i18n!./ContentNavResources', 'polyglot'], function(localeResources, Polyglot) {
- 'use strict';
- /**
- * Module which provides simple access to string resources.
- *
- */
- var poly = new Polyglot({
- phrases: localeResources
- });
- var StringResources = function() {
- return undefined;
- };
- /**
- * Get the string resource for the given key and interpolation options
- *
- * @param key The key of the string to return
- * @param interpolationOptions Optional interpolation options (see poly.t documentation for details)
- * @returns The string to display
- */
- StringResources.prototype.get = function(key, interpolationOptions) {
- return poly.t(key, interpolationOptions);
- };
- return new StringResources();
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2015, 2018
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bacontentnav/utils/GlassContextHelper',[], function() {
- 'use strict';
- var _singletonInstance = null;
- var GlassContextHelper = function() {
- if (GlassContextHelper.prototype._singletonInstance) {
- return GlassContextHelper.prototype._singletonInstance;
- }
- GlassContextHelper.prototype._singletonInstance = this;
- };
- /*
- @glassContext - glassContext
- @jqXHR - jQuery XMLHttpRequest returned by Glass Ajax service on fail
- Is temporary and should be removed when Glass handles the showing of error messages
- */
- GlassContextHelper.prototype.showAjaxServiceErrorMessage = function(glassContext, jqXHR) {
- var messages = '';
- if (jqXHR) {
- var responseJSON = jqXHR.responseJSON;
- if (responseJSON) {
- if (responseJSON.messages) {
- messages = jqXHR.responseJSON.messages.join('\n');
- } else if (responseJSON.cause) {
- try {
- var cause = JSON.parse(responseJSON.cause);
- if (cause.messages) {
- messages = cause.messages.join('\n');
- }
- } catch (e) {
- //if we get here, 'cause' is not a json object
- messages = responseJSON.cause;
- }
- }
- } else {
- messages = jqXHR.responseText;
- }
- }
- if ( messages && messages.length > 0 ) { // RTC189248 - Don't show empty error messages!
- glassContext.appController.showErrorMessage(messages, 'Error');
- }
- };
- GlassContextHelper.prototype.showAjaxServiceError = function(glassContext, error) {
- this.showAjaxServiceErrorMessage(glassContext, error.jqXHR);
- };
- /*
- @glassContext - glassContext
- @str - the message
- @options - an options jsonObject to pass to glass's showToast
- */
- GlassContextHelper.prototype.displayToast = function(glassContext, str, options) {
- glassContext.appController.showToast(str, options);
- };
- /*
- * preference - name of the preference setting to get. e.g contentLocale, email, etc
- */
- GlassContextHelper.prototype.getUserPreference = function(glassContext, preference) {
- return glassContext.getCoreSvc('.UserProfile').preferences[preference];
- };
- GlassContextHelper.prototype.getContentLocales = function(glassContext) {
- return glassContext.getCoreSvc('.Config').getContentLocales();
- };
- GlassContextHelper.prototype.getLocaleTime = function(glassContext) {
- var preferences = glassContext ? glassContext.getCoreSvc('.UserProfile').preferences : {};
- return {
- timeZone: preferences.timeZoneID || 'America/New_York',
- contentLocale: preferences.contentLocale || 'en'
- };
- };
- var _static = {
- getInstance: function() {
- if (!_singletonInstance) {
- _singletonInstance = new GlassContextHelper();
- }
- return _singletonInstance;
- }
- };
- return _static.getInstance();
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2018
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bacontentnav/utils/ContentServiceUrls',[], function() {
- return {
- baseContentServiceURL: 'v1/objects',
- basePathURL: 'v1/path?path=',
- baseSearchPathURL: 'v1/search_path?searchPath=',
- baseUserProfileServiceURL: 'v1/users',
- baseNamespaceServiceURL: 'v1/namespaces',
- getMyFoldersURL: function() {
- return this.baseContentServiceURL + '/.my_folders';
- },
- getMyFoldersContentURL: function() {
- return this.getMyFoldersURL() + '/items';
- },
- getOtherUsersFoldersURL: function() {
- return this.baseContentServiceURL + '/.users';
- },
- getBaseNamespaceURL: function() {
- return this.baseNamespaceServiceURL;
- },
- getPublicFoldersURL: function() {
- return this.baseContentServiceURL + '/.public_folders';
- },
- getPublicFoldersContentURL: function() {
- return this.getPublicFoldersURL() + '/items';
- },
- getRootPublicFolderName: function() {
- return null;
- },
- getRootMyFolderName: function() {
- return null;
- },
- getMRUURL: function() {
- return this.baseUserProfileServiceURL + '/~/mrus';
- },
- getBaseObjectsURL: function() {
- return this.baseContentServiceURL;
- },
- getBasePathURL: function() {
- return this.basePathURL;
- },
- getBaseSearchPathURL: function() {
- return this.baseSearchPathURL;
- },
- getDefaultUploadLocationURL: function() {
- return this.baseUserProfileServiceURL + '/_tilde_/user_profile_settings?fields=fileUpload_location';
- }
- };
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *|
- *| IBM Cognos Products: ba-content-nav
- *|
- *| (C) Copyright IBM Corp. 2015,2022
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- // jshint maxdepth:5
- define('bacontentnav/utils/ContentStoreObject',[
- 'underscore',
- '../nls/StringResource',
- '../lib/@waca/core-client/js/core-client/utils/DateTimeUtils',
- './GlassContextHelper',
- './ContentServiceUrls'
- ], function(_, StringResource, DateTimeUtils, GlassContextHelper, ContentServiceUrls) {
- 'use strict';
- var _singletonInstance = null;
- var ContentStoreObject = function() {
- if (ContentStoreObject.prototype._singletonInstance) {
- return ContentStoreObject.prototype._singletonInstance;
- }
- this.ID = 'id';
- this.TYPE = 'type';
- this.DEFAULT_NAME = 'defaultName';
- this.MODIFICATION_TIME = 'modificationTime';
- this.SEARCH_PATH = 'searchPath';
- this.TENANT_NAME = 'tenantName';
- this.TENANT_ID = 'tenantID';
- this.CREATION_TIME = 'creationTime';
- this.OWNER = 'owner';
- this.META = '_meta';
- this.LINKS = 'links';
- this.URL = 'url';
- this.selfURL = 'selfUrl';
- this.SELF = 'self';
- this.ITEMS = 'items';
- this.ICON = 'iconURI';
- this.DEFAULT_TOOLTIP = 'defaultScreenTip';
- this.MODELS = 'models';
- this.DEFAULT_DESCRIPTION = 'defaultDescription';
- this.ANCESTORS = 'ancestors';
- this.DEFAULT_PORTAL_ACTION = 'defaultPortalAction';
- this.RUN_AS_OWNER = 'runAsOwner';
- this.RUN_WITH_OWNER_CAPABILITIES = 'runWithOwnerCapabilities';
- this.RUN_AS_USER = 'runAsUser';
- this.HIDDEN = 'hidden';
- this.DISABLED = 'disabled';
- this.MIME_TYPE = 'mimeType';
- this.OPTIONS = 'options';
- this.PERMISSIONS = 'permissions';
- this.SCHEMAINFO = 'schemaInfo';
- this.POLICIES = 'policies';
- this.ACQUIRED = 'acquired';
- this.HISTORY = 'history';
- this.DATA_DESCRIPTOR = 'dataDescriptor';
- this.BASE = 'base';
- this.METADATA_MODEL_PACKAGE = 'metadataModelPackage';
- this.MODULE = 'module';
- this.TAGS = 'tags';
- this.REFERENCES = 'references';
- this.SURNAME='surname';
- this.GIVENNAME='givenName';
- // for histories and history details
- this.HISTORIES = 'histories';
- this.VERSIONS = 'versions';
- this.DETAILS = 'details';
- this.REQUESTED_TIME = 'requestedExecutionTime';
- this.EXECUTION_TIME = 'actualExecutionTime';
- this.COMPLETION_TIME = 'actualCompletionTime';
- this.STATUS = 'status';
- this.OUTPUT = 'output';
- this.OUTPUTS = 'outputs';
- this.MESSAGES = 'messages';
- this.MESSAGES_DETAIL = 'detail';
- this.MESSAGES_SEVERITY = 'severity';
- this.REQUEST_ARGUMENTS = 'requestArguments';
- this.PARAMETERS = 'parameters';
- this.EXECUTION_PROMPT = 'executionPrompt';
- // for report outputs
- this.BURSTKEY = 'burstKey';
- this.FORMAT = 'format';
- this.LOCALE = 'locale';
- this.CONTENT = 'content';
- this.RUN_IN_ADVANCED_VIEWER = 'runInAdvancedViewer';
- this.OPTION_OUTPUT_FORMAT = 'outputFormat';
- this.OPTION_OUTPUT_LOCALE = 'outputLocale';
- this.OPTION_ACCESSIBILITY_FEATURES = 'http://developer.cognos.com/ceba/constants/systemOptionEnum#accessibilityFeatures';
- this.OPTION_PROMPT = 'prompt';
- this.OPTION_HTML_ROWS_PER_PAGE = 'verticalElements';
- this.OPTION_SELECTION_BASED_FEATURES = 'selectionBasedFeatures';
- this.OPTION_ENABLE_ALLOW_NOTIFICATION = 'allowNotification';
- this.OPTION_ENABLE_USER_FEATURE_SAVED_OUTPUT = 'advancedOutput';
- this.EFFECTIVE_USER_CAPABILITIES = 'effectiveUserCapabilities';
- ContentStoreObject.prototype._singletonInstance = this;
- // private functions
- this._getMetaLinksURL = function(oData, target) {
- var linksTarget = oData[this.META] && oData[this.META][this.LINKS] && oData[this.META][this.LINKS][target];
- return linksTarget && linksTarget[this.URL] || null;
- };
- this._getBaseType = function(oData) {
- var base = this.getBase(oData);
- return base && this.getType(base) || null;
- };
- this._getFormatedDateTime = function(oData, formated, formatLength, fieldKey, includeTime) {
- var time = oData[fieldKey] || null;
- if (formated && time) {
- var timeLocale = (this.glassContext) ? GlassContextHelper.getLocaleTime(this.glassContext) : {};
- time = includeTime ? DateTimeUtils.formatDateTime(time, formatLength, timeLocale) : DateTimeUtils.formatDate(time, formatLength, timeLocale);
- }
- return time;
- };
- };
- ContentStoreObject.prototype.setGlassContext = function(glassContext) {
- this.glassContext = glassContext;
- };
- ContentStoreObject.prototype.setContentService = function(contentService) {
- console.warn('ContentStoreObject.setContentService method is deprectated; Use ContentStoreObject.setGlassContext');
- if ( contentService && contentService.glassContext) {
- this.glassContext = contentService.glassContext;
- }
- };
- /**
- Takes a list of objects and returns a list of their ids
- **/
- ContentStoreObject.prototype.getObjectListIds = function(objects) {
- var ids = [];
- objects.forEach(function(obj) {
- if (obj.id) {
- ids.push(obj.id);
- }
- });
- return ids;
- };
- ContentStoreObject.prototype.isPoliciesAcquired = function(oData) {
- 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];
- };
- ContentStoreObject.prototype.getObjectId = function(oData) {
- return oData.id || '';
- };
- ContentStoreObject.prototype.getSearchPath = function(oData) {
- return oData.searchPath || '';
- };
- ContentStoreObject.prototype.isTeamContent = function(oData) {
- return oData && oData.type === 'content';
- };
- /**
- returns the object type from the JSON response
- @return {string} or null
- **/
- ContentStoreObject.prototype.getType = function(oData) {
- return oData && oData[this.TYPE] || null;
- };
- /**
- returns the object icon from the JSON response
- @return {string} or null
- **/
- ContentStoreObject.prototype.getIcon = function(oData) {
- return oData[this.ICON] || null;
- };
- /**
- returns the object default tooltip from the JSON response
- @return {string} or null
- **/
- ContentStoreObject.prototype.getTooltip = function(oData) {
- return oData[this.DEFAULT_TOOLTIP] || null;
- };
- /**
- returns the object tags from the JSON response
- @return {array} or null
- **/
- ContentStoreObject.prototype.getTags = function(oData) {
- return oData[this.TAGS] || null;
- };
- /**
- Will return the base object type.
- - If the object is not a reportView, then the object type will be returned
- - If the object is a view and the base type is available then it will be returned
- - If the object is a view and the base type is not available, then we will query for it
- @returns a promise that will resolve with the type of the base object
- **/
- ContentStoreObject.prototype.getBaseObjectType = function(oData) {
- var type = this.getType(oData);
- if (type && /view$/.test(type.toLowerCase()) ) {
- // If we already have the base type available, simply return it
- var baseType = this._getBaseType(oData);
- if (baseType) {
- return Promise.resolve(baseType);
- } else {
- // If this is a report, we need to query the base type
- var selfUrl = this.getSelfLink(oData);
- return this.glassContext.getCoreSvc('.Ajax').ajax({
- 'url': selfUrl,
- 'type': 'GET',
- 'dataType': 'json',
- 'data': {
- 'fields': 'base.type'
- }
- }).then(function(response) {
- var data = response && response.data && response.data.data;
- var base = this.getBase(data[0]);
- // We've queried for the information, might as well place it in the oData that was passed in
- oData.base = [base];
- return this.getType(base);
- }.bind(this));
- }
- } else {
- return Promise.resolve(type);
- }
- };
- //TODO: is this a WA-specific test? if yes, remove
- ContentStoreObject.prototype._isUserFolder = function(oData) {
- // Need to check for length of 1 since as we drill into User Folders, ancestor[0] is still UserFolder.
- if (oData.ancestors && oData.ancestors.length === 1) {
- return !!(oData.ancestors[0] && (oData.ancestors[0].id === '.other_users_folders'));
- } else {
- return false;
- }
- };
- // TODO: is this a WA-specific test? if yes, remove
- ContentStoreObject.prototype._getUserFolderName = function(oData) {
- return oData.createdBy && oData.createdBy.defaultName || '';
- };
- /**
- Returns the child link from the JSON response
- @return {string} or null
- **/
- ContentStoreObject.prototype.getItemsLink = function(oData) {
- var type = oData.type;
- if (type === 'namespace') {
- return 'v1/namespaces/' + oData.id + '/items';
- } else if (type === 'namespaceFolder') {
- return 'v1/namespaces/' + oData.id + '/items?page=0|0&sorting=defaultName|asc';
- } else if (type === 'agentDefinition' || this._isUserFolder(oData)) {
- // content-service does not support getItemsLink for agentDefinition yet
- var selfLink = this._getMetaLinksURL(oData, this.SELF);
- if (selfLink) {
- return selfLink + '/items';
- }
- }
- return this._getMetaLinksURL(oData, this.ITEMS); // returns null if not found
- };
- /**
- Returns the child link from the JSON response
- @return {string} or null
- **/
- ContentStoreObject.prototype.getSelfLink = function(oData) {
- return this._getMetaLinksURL(oData, this.SELF) || oData[this.selfURL] || 'v1/objects/' + oData[this.ID];
- };
- /**
- * Returns the histories from the JSON response
- * @return {promise}
- */
- ContentStoreObject.prototype.getHistories = function(oData, fields) {
- var historyLink = this._getMetaLinksURL(oData, this.HISTORIES);
- if (historyLink) {
- return this.glassContext.getCoreSvc('.Ajax').ajax({
- dataType: 'json',
- type: 'GET',
- url: historyLink,
- data: {
- fields: fields
- }
- }).then(function(response) {
- var data = response.data;
- var responseData = data.data && data.data.length > 0 ? data.data : false;
- return responseData;
- });
- } else {
- return Promise.resolve(false);
- }
- };
- /**
- * Returns the versions from the JSON response
- * @return {promise}
- */
- ContentStoreObject.prototype.getVersions = function(oData, fields) {
- var versionsLink = this.getVersionsLink(oData);
- if (versionsLink) {
- return this.glassContext.getCoreSvc('.Ajax').ajax({
- dataType: 'json',
- type: 'GET',
- url: versionsLink,
- data: {
- fields: fields
- }
- }).then(function(response) {
- var data = response.data;
- var responseData = data.data && data.data.length > 0 ? data.data : false;
- return responseData;
- });
- } else {
- return Promise.resolve(false);
- }
- };
- /**
- Returns the versions link from the JSON response
- @return {string} or null
- **/
- ContentStoreObject.prototype.getVersionsLink = function(oData) {
- return this._getMetaLinksURL(oData, this.VERSIONS);
- };
- /**
- Returns the details link from the JSON response
- @return {string} or null
- **/
- ContentStoreObject.prototype.getDetailsLink = function(oData) {
- return this._getMetaLinksURL(oData, this.DETAILS);
- };
- /**
- Returns the output's report version self link from the JSON response
- @return {string} or null
- **/
- ContentStoreObject.prototype.getOutputsLink = function(oData) {
- var output = oData[this.OUTPUT] && oData[this.OUTPUT][0];
- return output && this._getMetaLinksURL(output, this.OUTPUTS) || null;
- };
- /**
- Returns the output's report version self link from the JSON response
- @return {string} or null
- **/
- ContentStoreObject.prototype.getVersionLink = function(oData) {
- var output = oData[this.OUTPUT] && oData[this.OUTPUT][0];
- return output && this.getSelfLink(output) || null;
- };
- /**
- Returns the output content link from the JSON response
- @return {string} or null
- **/
- ContentStoreObject.prototype.getOutputContentLink = function(oData) {
- return this._getMetaLinksURL(oData, this.CONTENT);
- };
- /**
- Returns the models link from the JSON response
- @return {string} or null
- **/
- ContentStoreObject.prototype.getModelsLink = function(oData) {
- return this._getMetaLinksURL(oData, this.MODELS);
- };
- /**
- Returns the saved report's options list from the JSON response
- @return {string} or null
- **/
- ContentStoreObject.prototype.getDetailsReportVersionOptions = function(oData) {
- return oData[this.REQUEST_ARGUMENTS] && oData[this.REQUEST_ARGUMENTS][this.OPTIONS] || null;
- };
- /**
- Returns the saved report's options list from the JSON response
- @return {string} or null
- **/
- ContentStoreObject.prototype.getDetailsReportVersionParameters = function(oData) {
- return oData[this.REQUEST_ARGUMENTS] && oData[this.REQUEST_ARGUMENTS][this.PARAMETERS] || null;
- };
- /**
- @return {string} - the owner name
- **/
- ContentStoreObject.prototype.getOwnerName = function(oData) {
- if (!oData || !oData[this.OWNER]) {
- return StringResource.get('unknown');
- }
- if (!$.isArray(oData[this.OWNER])) {
- return oData[this.OWNER];
- } else if (oData[this.OWNER][0] && oData[this.OWNER][0][this.DEFAULT_NAME]) {
- // check if the givenName, surName, and userName are available, otherwise display the defaultName
- if((oData[this.GIVENNAME] && oData[this.SURNAME]) && (oData[this.OWNER][0][this.DEFAULT_NAME] === oData.defaultName)){
- return oData[this.GIVENNAME] + ' ' + oData[this.SURNAME];
- } else{
- return oData[this.OWNER][0][this.DEFAULT_NAME];
- }
- }
- return StringResource.get('unknown');
- };
- /**
- @return {string} - the object name
- **/
- ContentStoreObject.prototype.getObjectName = function(oData) {
- if (!oData || !oData.defaultName) {
- return StringResource.get('unknown');
- }
- return oData.defaultName;
- };
- /**
- @return {string} or null - the owner ID
- **/
- ContentStoreObject.prototype.getOwnerId = function(oData) {
- if (!oData[this.OWNER] || oData[this.OWNER].length < 1) {
- return null;
- }
- return oData[this.OWNER][0] && oData[this.OWNER][0][this.ID] || null;
- };
- /**
- @return {string} or null - the owner self link
- **/
- ContentStoreObject.prototype.getOwnerSelfLink = function(oData) {
- return (oData[this.OWNER] && oData[this.OWNER].length > 0) ? this.getSelfLink(oData[this.OWNER][0]) : null;
- };
- /**
- @return {boolean} - returns true if the current user is the owner of the item
- **/
- ContentStoreObject.prototype.isOwner = function(oData) {
- var oDataOwnerId = this.getOwnerId(oData);
- return !!(oDataOwnerId && oDataOwnerId === this.glassContext.getCoreSvc('.UserProfile').preferences.id);
- };
- /**
- Returns the requested time from the JSON reponse
- @formated {boolean} - should the response be formated
- @formatLength {string} - if the response is to be formated, then specify the length of the formar (short|medium|long)
- **/
- ContentStoreObject.prototype.getRequestedTime = function(oData, formated, formatLength) {
- return this._getFormatedDateTime(oData, formated, formatLength, this.REQUESTED_TIME, true);
- };
- /**
- Returns report's actual execution time from the JSON reponse
- @formated {boolean} - should the response be formated
- @formatLength {string} - if the response is to be formated, then specify the length of the formar (short|medium|long)
- **/
- ContentStoreObject.prototype.getExecutionTime = function(oData, formated, formatLength) {
- return this._getFormatedDateTime(oData, formated, formatLength, this.EXECUTION_TIME, true);
- };
- /**
- Returns report's actual completion time from the JSON reponse
- @formated {boolean} - should the response be formated
- @formatLength {string} - if the response is to be formated, then specify the length of the formar (short|medium|long)
- **/
- ContentStoreObject.prototype.getCompletionTime = function(oData, formated, formatLength) {
- return this._getFormatedDateTime(oData, formated, formatLength, this.COMPLETION_TIME, true);
- };
- /**
- Returns the creation date (no time) from the JSON reponse. Used for backwards compatibility.
- @formated {boolean} - should the response be formated
- @formatLength {string} - if the response is to be formated, then specify the length of the formar (short|medium|long)
- **/
- ContentStoreObject.prototype.getCreationTime = function(oData, formated, formatLength) {
- return this._getFormatedDateTime(oData, formated, formatLength, this.CREATION_TIME, false);
- };
- /**
- Returns the creation time from the JSON reponse
- @formated {boolean} - should the response be formated
- @formatLength {string} - if the response is to be formated, then specify the length of the formar (short|medium|long)
- @includeTime {boolean} - should the formated response include the time
- **/
- ContentStoreObject.prototype.getCreationDate = function(oData, formated, formatLength, includeTime) {
- return this._getFormatedDateTime(oData, formated, formatLength, this.CREATION_TIME, includeTime);
- };
- /**
- Returns the modification time from the JSON reponse
- @formated {boolean} - should the response be formated
- @formatLength {string} - if the response is to be formated, then specify the length of the formar (short|medium|long)
- **/
- ContentStoreObject.prototype.getModificationTime = function(oData, formated, formatLength, includeTime) {
- return this._getFormatedDateTime(oData, formated, formatLength, this.MODIFICATION_TIME, includeTime);
- };
- ContentStoreObject.prototype.getRunHistoryConfig = function(oData) {
- return this._getRetentionPropertyInfo('history', oData);
- };
- ContentStoreObject.prototype.getReportOutputVersionsConfig = function(oData) {
- return this._getRetentionPropertyInfo('reportVersion', oData);
- };
- ContentStoreObject.prototype._getRetentionPropertyInfo = function(propertyName, oData) {
- if (!oData.retentions) {
- return null;
- }
- var length = oData.retentions.length;
- for (var i = 0; i < length; i += 1) {
- if (oData.retentions[i].objectClass === propertyName) {
- return oData.retentions[i];
- }
- }
- return null;
- };
- ContentStoreObject.prototype.getLocation = function(oData, appendDefaultName) {
- var ancestors = this.getAncestors(oData);
- if (!ancestors) {
- return null;
- }
- var ancestorNames = [];
- ancestors.forEach(function(ancestor) {
- ancestorNames.push(ancestor.defaultName);
- });
- if (appendDefaultName && this.getName(oData)) {
- ancestorNames.push(this.getName(oData));
- }
- return ancestorNames.join(' > ');
- };
- ContentStoreObject.prototype.getName = function(oData) {
- return oData[this.DEFAULT_NAME];
- };
- ContentStoreObject.prototype.hasBase = function(oData) {
- // search results return base as a 'reference'
- return this.getBase(oData) || (oData[this.REFERENCES] && oData[this.REFERENCES][0]);
- };
- ContentStoreObject.prototype.getBase = function(oData) {
- return oData[this.BASE] && oData[this.BASE][0] || null;
- };
- ContentStoreObject.prototype.getPermissionsAndBasePermissions = function (oData, fetch, refresh) {
- if (fetch) {
- if (!refresh && oData[this.PERMISSIONS] && this.getBasePermissions(oData)) {
- return Promise.resolve({
- permissions: oData[this.PERMISSIONS],
- base: oData[this.BASE]
- });
- } else {
- return this.glassContext.getCoreSvc('.Ajax').ajax({
- 'url': this.getSelfLink(oData) + '?fields=permissions,base.permissions',
- 'dataType': 'json',
- 'type': 'GET'
- })
- .then(function(response) {
- var data = response.data;
- return {
- permissions: data.data[0].permissions,
- base: data.data[0].base
- };
- });
- }
- } else {
- if (oData) {
- return {
- permissions: oData[this.PERMISSIONS],
- base: oData[this.BASE]
- };
- }
- return null;
- }
- };
- ContentStoreObject.prototype.getPermissionsOwnerIdAndBasePermissions = function (oData, fetch, refresh) {
- if (fetch) {
- if (!refresh && oData[this.PERMISSIONS] && this.getOwnerId(oData) && this.getBasePermissions(oData)) {
- return Promise.resolve({
- permissions: oData[this.PERMISSIONS],
- owner: oData[this.OWNER],
- base: oData[this.BASE]
- });
- } else {
- return this.glassContext.getCoreSvc('.Ajax').ajax({
- 'url': this.getSelfLink(oData) + '?fields=permissions,owner.id,base.permissions',
- 'dataType': 'json',
- 'type': 'GET'
- })
- .then(function(response) {
- var data = response.data;
- return {
- permissions: data.data[0].permissions,
- owner: data.data[0].owner,
- base: data.data[0].base
- };
- });
- }
- } else {
- if (oData) {
- return {
- permissions: oData[this.PERMISSIONS],
- owner: oData[this.OWNER],
- base: oData[this.BASE]
- };
- }
- return null;
- }
- };
- ContentStoreObject.prototype.getPermissionsAndMetadataModelPackageEffectiveUserCapabilities = function (oData, fetch) {
- if (fetch) {
- if (oData[this.PERMISSIONS] && this.getMetadataModelPackageEffectiveUserCapabilities(oData)) {
- return Promise.resolve({
- permissions: oData[this.PERMISSIONS],
- metadataModelPackage: oData[this.METADATA_MODEL_PACKAGE]
- });
- } else {
- return this.glassContext.getCoreSvc('.Ajax').ajax({
- 'url': this.getSelfLink(oData) + '?fields=permissions,metadataModelPackage.effectiveUserCapabilities',
- 'dataType': 'json',
- 'type': 'GET'
- })
- .then(function(response) {
- var data = response.data;
- return {
- permissions: data.data[0].permissions,
- metadataModelPackage: data.data[0].metadataModelPackage
- };
- });
- }
- } else {
- if (oData) {
- return {
- permissions: oData[this.PERMISSIONS],
- metadataModelPackage: oData[this.METADATA_MODEL_PACKAGE]
- };
- }
- return null;
- }
- };
- ContentStoreObject.prototype.getPermissionsOwnerIdAndMetadataModelPackageEffectiveUserCapabilities = function (oData, fetch) {
- if (fetch) {
- if (oData[this.PERMISSIONS] && this.getOwnerId(oData) && this.getMetadataModelPackageEffectiveUserCapabilities(oData)) {
- return Promise.resolve({
- permissions: oData[this.PERMISSIONS],
- owner: oData[this.OWNER],
- metadataModelPackage: oData[this.METADATA_MODEL_PACKAGE]
- });
- } else {
- return this.glassContext.getCoreSvc('.Ajax').ajax({
- 'url': this.getSelfLink(oData) + '?fields=permissions,owner.id,metadataModelPackage.effectiveUserCapabilities',
- 'dataType': 'json',
- 'type': 'GET'
- })
- .then(function(response) {
- var data = response.data;
- return {
- permissions: data.data[0].permissions,
- owner: data.data[0].owner,
- metadataModelPackage: data.data[0].metadataModelPackage
- };
- });
- }
- } else {
- if (oData) {
- return {
- permissions: oData[this.PERMISSIONS],
- owner: oData[this.OWNER],
- metadataModelPackage: oData[this.METADATA_MODEL_PACKAGE]
- };
- }
- return null;
- }
- };
- ContentStoreObject.prototype.getPermissionsAndCapabilities = function (oData, fetch) {
- if (fetch) {
- if (oData[this.PERMISSIONS] && oData[this.EFFECTIVE_USER_CAPABILITIES]) {
- return Promise.resolve({
- permissions: oData[this.PERMISSIONS],
- effectiveUserCapabilities: oData[this.EFFECTIVE_USER_CAPABILITIES]
- });
- } else {
- return this.glassContext.getCoreSvc('.Ajax').ajax({
- 'url': this.getSelfLink(oData) + '?fields=permissions,effectiveUserCapabilities',
- 'dataType': 'json',
- 'type': 'GET'
- })
- .then(function(response) {
- var data = response.data;
- return {
- permissions: data.data[0].permissions,
- effectiveUserCapabilities: data.data[0].effectiveUserCapabilities
- };
- });
- }
- } else {
- if (oData) {
- return {
- permissions: oData[this.PERMISSIONS],
- effectiveUserCapabilities: oData[this.EFFECTIVE_USER_CAPABILITIES]
- };
- }
- return null;
- }
- };
- ContentStoreObject.prototype.getPermissionsOwnerIdAndCapabilities = function (oData, fetch) {
- if (fetch) {
- if (oData[this.PERMISSIONS] && this.getOwnerId(oData) && oData[this.EFFECTIVE_USER_CAPABILITIES]) {
- return Promise.resolve({
- permissions: oData[this.PERMISSIONS],
- owner: oData[this.OWNER],
- effectiveUserCapabilities: oData[this.EFFECTIVE_USER_CAPABILITIES]
- });
- } else {
- return this.glassContext.getCoreSvc('.Ajax').ajax({
- 'url': this.getSelfLink(oData) + '?fields=permissions,owner.id,effectiveUserCapabilities',
- 'dataType': 'json',
- 'type': 'GET'
- })
- .then(function(response) {
- var data = response.data;
- return {
- permissions: data.data[0].permissions,
- owner: data.data[0].owner,
- effectiveUserCapabilities: data.data[0].effectiveUserCapabilities
- };
- });
- }
- } else {
- if (oData) {
- return {
- permissions: oData[this.PERMISSIONS],
- owner: oData[this.OWNER],
- effectiveUserCapabilities: oData[this.EFFECTIVE_USER_CAPABILITIES]
- };
- }
- return null;
- }
- };
- ContentStoreObject.prototype.getPermissions = function(oData, fetch) {
- if (fetch) {
- if (oData[this.PERMISSIONS]) {
- return Promise.resolve(oData[this.PERMISSIONS]);
- } else {
- return this.glassContext.getCoreSvc('.Ajax').ajax({
- 'url': this.getSelfLink(oData) + '?fields=permissions',
- 'dataType': 'json',
- 'type': 'GET'
- })
- .then(function(response) {
- var data = response.data;
- return data.data[0].permissions;
- });
- }
- } else {
- return oData ? oData[this.PERMISSIONS] : null;
- }
- };
- ContentStoreObject.prototype.getDefaultPortalAction = function(oData, fetch) {
- if (fetch) {
- if (oData[this.DEFAULT_PORTAL_ACTION]) {
- return Promise.resolve(oData[this.DEFAULT_PORTAL_ACTION]);
- } else {
- return this.glassContext.getCoreSvc('.Ajax').ajax({
- url: this.getSelfLink(oData) + '?fields=defaultPortalAction',
- dataType: 'json',
- type: 'GET'
- })
- .then(function(response) {
- var data = response.data;
- return data.data[0].defaultPortalAction;
- });
- }
- } else {
- return oData ? oData[this.DEFAULT_PORTAL_ACTION] : null;
- }
- };
- ContentStoreObject.prototype.getTargetDefaultPortalAction = function(oData, fetch) {
- if (fetch) {
- if (oData[this.DEFAULT_PORTAL_ACTION]) {
- return Promise.resolve(oData[this.DEFAULT_PORTAL_ACTION]);
- } else {
- return this.glassContext.getCoreSvc('.Ajax').ajax({
- url: this.getSelfLink(oData) + '?fields=target.defaultPortalAction',
- dataType: 'json',
- type: 'GET'
- })
- .then(function(response) {
- var data = response.data;
- return data.data[0].target[0].defaultPortalAction;
- });
- }
- } else {
- return oData ? oData[this.DEFAULT_PORTAL_ACTION] : null;
- }
- };
- ContentStoreObject.prototype.getTargetFileNameFromSearchPath = function(searchPath) {
- if (searchPath){
- var splitPath = searchPath.split('/');
- if (splitPath.length > 0) {
- splitPath = splitPath[splitPath.length -1].split('\'');
- return splitPath[1];
- }
- }
- return null;
- };
- ContentStoreObject.prototype.getTargetSearchPath = function(oData, fetch) {
- if (fetch) {
- if (oData.target && oData.target.length && oData.target[0].searchPath) {
- return Promise.resolve(oData.target[0]);
- }
- return this.glassContext.getCoreSvc('.Ajax').ajax({
- url: this.getSelfLink(oData) + '?fields=target.searchPath',
- dataType: 'json',
- type: 'GET'
- })
- .then(function(response) {
- var data = response.data;
- if (data.data && data.data.length && data.data[0].target && data.data[0].target.length) {
- return data.data[0].target[0];
- }
- });
- } else {
- if (oData && oData.target && oData.target.length) {
- return oData.target[0];
- }
- }
- return null;
- };
- ContentStoreObject.prototype.hasPermissions = function(oData, permissionsArray) {
- var oPermArray = this.getPermissions(oData);
- if (!oPermArray) {
- return false;
- }
- return _.intersection(oPermArray, permissionsArray).length === permissionsArray.length;
- };
- /**
- * Returns true if the given asset has the given tag
- * @return {boolean}
- */
- ContentStoreObject.prototype.hasTag = function(oData, tag) {
- return !!(oData[this.TAGS] && oData[this.TAGS].indexOf(tag) !== -1);
- };
- ContentStoreObject.prototype.getDescription = function(oData) {
- var description = oData[this.DEFAULT_DESCRIPTION];
- if (_.isEmpty(description)) {
- var base = this.getBase(oData);
- if (base) {
- description = base[this.DEFAULT_DESCRIPTION];
- }
- }
- return description;
- };
- ContentStoreObject.prototype.getReportRetentions = function(oData) {
- if (oData.retentions === null || $.isEmptyObject(oData.retentions)) {
- oData.retentions = [];
- }
- return oData.retentions;
- };
- ContentStoreObject.prototype.getOptions = function(oData) {
- if (oData[this.OPTIONS] === null || $.isEmptyObject(oData[this.OPTIONS])) {
- oData[this.OPTIONS] = [];
- }
- return oData[this.OPTIONS];
- };
- ContentStoreObject.prototype.getOption = function(oData, name) {
- var options = this.getOptions(oData);
- if (options) {
- for (var i = 0; i < options.length; i = i + 1) {
- if (options[i].name === name) {
- if (options[i].value instanceof Array) {
- return options[i].value[0];
- }
- return options[i].value;
- }
- }
- }
- return null;
- };
- ContentStoreObject.prototype.getRunAsOwner = function(oData) {
- return oData[this.RUN_AS_OWNER] || false;
- };
- ContentStoreObject.prototype.getRunWithOwnerCapabilities = function(oData) {
- return oData[this.RUN_WITH_OWNER_CAPABILITIES] || false;
- };
- /**
- * Returns the ContentStoreObject associated with the report property
- */
- ContentStoreObject.prototype.getRunAsOwnerValue = function(oData) {
- var runAsOwnerValue = this.getRunWithOwnerCapabilities(oData) ? this.RUN_WITH_OWNER_CAPABILITIES : this.RUN_AS_USER;
- runAsOwnerValue = this.getRunAsOwner(oData) ? this.RUN_AS_OWNER : runAsOwnerValue;
- return runAsOwnerValue;
- };
- ContentStoreObject.prototype.getStatus = function(oData) {
- return oData[this.STATUS] || false;
- };
- ContentStoreObject.prototype.getMessages = function(oData) {
- return oData[this.MESSAGES] || false;
- };
- ContentStoreObject.prototype.getMessageDetail = function(oData) {
- return oData[this.MESSAGES_DETAIL] || false;
- };
- ContentStoreObject.prototype.getMessageSeverity = function(oData) {
- return oData[this.MESSAGES_SEVERITY] || false;
- };
- ContentStoreObject.prototype.getFormat = function(oData) {
- return oData[this.FORMAT] || false;
- };
- ContentStoreObject.prototype.getLocale = function(oData) {
- return oData[this.LOCALE] || false;
- };
- ContentStoreObject.prototype.getBurstKey = function(oData) {
- return oData[this.BURSTKEY] || false;
- };
- ContentStoreObject.prototype.getHidden = function(oData) {
- var hidden = oData[this.HIDDEN] ? oData[this.HIDDEN].toString() : 'false';
- return hidden.toLowerCase() === 'true';
- };
- ContentStoreObject.prototype.getDisabled = function(oData) {
- var disabled = oData[this.DISABLED] ? oData[this.DISABLED].toString() : 'false';
- var isTargetDisabled = this.isTargetDisabled(oData);
- return disabled.toLowerCase() === 'true' || isTargetDisabled;
- };
- ContentStoreObject.prototype.isTargetDisabled = function(oData) {
- if (oData.target && oData.target.length && oData.target[0]) {
- return oData.target[0][this.DISABLED];
- }
- return false;
- };
- ContentStoreObject.prototype.getAncestors = function(oData) {
- if (!oData[this.ANCESTORS] || oData[this.ANCESTORS].length === 0) {
- return null;
- }
- // We hide the fact that My content is My Folders, so trim all those ancestors
- var rootAncestor = oData[this.ANCESTORS][0];
- if (rootAncestor.type) {
- var rootType = rootAncestor.type.toLowerCase();
- if (rootType === 'directory' && rootAncestor.id !== '.my_folders') {
- do {
- rootAncestor = oData[this.ANCESTORS].shift();
- } while (oData[this.ANCESTORS].length > 0 && oData[this.ANCESTORS][0].type !== 'folder');
- oData[this.ANCESTORS][0] = (this.getRootMyFoldersAncestors());
- } else if (rootType === 'content') {
- oData[this.ANCESTORS][0] = (this.getRootPublicFoldersAncestor());
- }
- }
- return oData[this.ANCESTORS];
- };
- ContentStoreObject.prototype.ancestorsEqual = function(ancestor1, ancestor2) {
- if (!ancestor1 || !ancestor2) {
- return false;
- }
- if (ancestor1.length !== ancestor2.length) {
- return false;
- }
- for (var i = 0; i < ancestor1.length; i = i + 1) {
- if (ancestor1[i].id !== ancestor2[i].id) {
- return false;
- }
- }
- return true;
- };
- ContentStoreObject.prototype.getHistoryConfig = function(oData) {
- return oData[this.HISTORY] && JSON.parse(oData[this.HISTORY]);
- };
- ContentStoreObject.prototype.getDataDescriptor = function(oData) {
- return oData && oData.dataDescriptor || {};
- };
- ContentStoreObject.prototype.buildAncestorEntry = function(oData) {
- var ancestorEntry = {};
- ancestorEntry[this.ID] = oData[this.ID];
- if (this._isUserFolder(oData)) {
- ancestorEntry[this.DEFAULT_NAME] = this._getUserFolderName(oData);
- } else {
- ancestorEntry[this.DEFAULT_NAME] = oData[this.DEFAULT_NAME];
- }
- if (oData[this.META]) {
- ancestorEntry[this.META] = oData[this.META];
- } else {
- // Mostly for search
- var selfLink = this.getSelfLink(oData);
- var url = this.getItemsLink(oData);
- if (!url) {
- url = selfLink + '/items';
- }
- ancestorEntry[this.META] = this._buildMetaSection(url, selfLink);
- }
- ancestorEntry[this.TYPE] = oData[this.TYPE];
- ancestorEntry[this.PERMISSIONS] = oData[this.PERMISSIONS];
- return ancestorEntry;
- };
- ContentStoreObject.prototype.buildAncestorTree = function(oData) {
- var ancestors = [];
- if (oData[this.ANCESTORS]) {
- _.each(this.getAncestors(oData), function(ancestor) {
- ancestors.push(this.buildAncestorEntry(ancestor));
- }.bind(this));
- ancestors.push(this.buildAncestorEntry(oData));
- }
- return ancestors;
- };
- ContentStoreObject.prototype._buildMetaSection = function(url, selfUrl) {
- var items = {};
- items[this.MIME_TYPE] = 'application/json';
- items[this.URL] = url;
- var self = {};
- self[this.MIME_TYPE] = 'application/json';
- self[this.URL] = selfUrl;
- var links = {};
- links[this.ITEMS] = items;
- links[this.SELF] = self;
- var meta = {};
- meta[this.LINKS] = links;
- return meta;
- };
- ContentStoreObject.prototype.getRootPublicFoldersAncestor = function() {
- var rootPublicFolderName = ContentServiceUrls.getRootPublicFolderName();
- var publicFolderUrl = ContentServiceUrls.getPublicFoldersURL();
- var ancestorEntry = {};
- ancestorEntry[this.ID] = '.public_folders';
- ancestorEntry[this.DEFAULT_NAME] = rootPublicFolderName ? rootPublicFolderName : StringResource.get('teamContent');
- ancestorEntry[this.META] = this._buildMetaSection(publicFolderUrl + '/items', publicFolderUrl);
- ancestorEntry[this.TYPE] = 'content';
- return ancestorEntry;
- };
- ContentStoreObject.prototype.getRootMyFoldersAncestors = function() {
- var rootMyFoldersName = ContentServiceUrls.getRootMyFolderName();
- var myFoldersUrl = ContentServiceUrls.getMyFoldersURL();
- var ancestorEntry = {};
- ancestorEntry[this.ID] = '.my_folders';
- ancestorEntry[this.DEFAULT_NAME] = rootMyFoldersName ? rootMyFoldersName : StringResource.get('myContent');
- ancestorEntry[this.META] = this._buildMetaSection(myFoldersUrl + '/items', myFoldersUrl);
- ancestorEntry[this.TYPE] = 'directory';
- return ancestorEntry;
- };
- ContentStoreObject.prototype.getRootOtherUsersFoldersAncestors = function(options) {
- var ancestorEntry = {};
- ancestorEntry[this.ID] = '.other_users_folders';
- ancestorEntry[this.DEFAULT_NAME] = options.defaultName || '';
- var url = ContentServiceUrls.getOtherUsersFoldersURL();
- ancestorEntry[this.META] = this._buildMetaSection(url + '/items', url);
- ancestorEntry[this.TYPE] = 'folder';
- return ancestorEntry;
- };
- ContentStoreObject.prototype.getRootNamespacesAncestors = function() {
- var baseNamespaceUrl = ContentServiceUrls.getBaseNamespaceURL();
- var ancestorEntry = {};
- ancestorEntry[this.ID] = '.directory';
- ancestorEntry[this.DEFAULT_NAME] = StringResource.get('directory');
- ancestorEntry[this.META] = this._buildMetaSection(baseNamespaceUrl, baseNamespaceUrl);
- ancestorEntry[this.TYPE] = 'directory';
- return ancestorEntry;
- };
- ContentStoreObject.prototype.getExecutionPrompt = function(oData) {
- return (oData[this.EXECUTION_PROMPT]!==undefined) ? oData[this.EXECUTION_PROMPT] : true;
- };
- ContentStoreObject.prototype.getOptionValue = function(oData, optionName, defaultValue) {
- var foundOption = _.find(oData.options, function(option) {
- return (option.name === optionName);
- });
- return foundOption === undefined? defaultValue : foundOption.value;
- };
- ContentStoreObject.prototype.getParameters = function(oData) {
- return oData[this.PARAMETERS] || [];
- };
- ContentStoreObject.prototype.getAllowNotification = function(oData){
- return oData[this.OPTION_ENABLE_ALLOW_NOTIFICATION] || null;
- };
- ContentStoreObject.prototype.getPromptsDisplayValues = function(parameters, forWrapText) {
- var i;
- var values = [];
- if (parameters) {
- for (i = 0; i < parameters.length; i = i + 1) {
- var value = parameters[i].value;
- var displayValue = '';
- for (var j = 0; j < value.length; j = j + 1) {
- if (j === 0) {
- displayValue = displayValue + this.buildPromptsDisplayValues(value[j]);
- } else {
- if (forWrapText) {
- displayValue = displayValue + ', ' + this.buildPromptsDisplayValues(value[j]);
- } else {
- displayValue = displayValue + ',' + this.buildPromptsDisplayValues(value[j]);
- }
- }
- }
- values.push({
- 'name': parameters[i].name,
- 'display': displayValue
- });
- }
- }
- return values;
- };
- ContentStoreObject.prototype.buildPromptsDisplayValues = function(value) {
- var displayValue;
- var use = value.use ? value.use : null;
- if (value.type === 'simpleParmValueItem') {
- displayValue = ((typeof value.display === 'undefined') || (value.display === '')) ? use : value.display;
- } else if (value.type === 'boundRangeParmValueItem') {
- if (value.start || value.end) {
- displayValue = StringResource.get('between');
- if (value.start) {
- displayValue += ' ';
- displayValue += ((typeof value.start.display === 'undefined') || (value.start.display === '')) ? value.start.use : value.start.display;
- displayValue += ' ';
- } else {
- displayValue += ' ';
- }
- displayValue += StringResource.get('and');
- if (value.end) {
- displayValue += ' ';
- displayValue += ((typeof value.end.display === 'undefined') || (value.end.display === '')) ? value.end.use : value.end.display;
- }
- }
- } else if (value.type === 'unboundedEndRangeParmValueItem') {
- if (value.start) {
- var upperboundValue = ((typeof value.start.display === 'undefined') || (value.start.display === '')) ? value.start.use : value.start.display;
- displayValue = StringResource.get('greaterOrEqual', {
- 'upperboundValue' : upperboundValue
- });
- }
- } else if (value.type === 'unboundedStartRangeParmValueItem') {
- if (value.end) {
- var lowerboundValue = ((typeof value.end.display === 'undefined') || (value.end.display === '')) ? value.end.use : value.end.display;
- displayValue = StringResource.get('lessOrEqual', {
- 'lowerboundValue' : lowerboundValue
- });
- }
- }
- return displayValue;
- };
- ContentStoreObject.prototype.getModule = function(oData) {
- return oData[this.MODULE] && oData[this.MODULE][0] || null;
- };
- ContentStoreObject.prototype.getMetadataModelPackage = function(oData) {
- return oData[this.METADATA_MODEL_PACKAGE] && oData[this.METADATA_MODEL_PACKAGE][0] || null;
- };
- ContentStoreObject.prototype.getBaseMetadataModelPackage = function(oData) {
- var baseMetaDataModelPackage = oData[this.BASE] && oData[this.BASE][0] && oData[this.BASE][0][this.METADATA_MODEL_PACKAGE];
- return baseMetaDataModelPackage && baseMetaDataModelPackage[0] || null;
- };
- ContentStoreObject.prototype.getBasePermissions = function (oData) {
- if (oData[this.BASE] && oData[this.BASE][0] && oData[this.BASE][0][this.PERMISSIONS]) {
- return oData[this.BASE][0][this.PERMISSIONS];
- }
- return null;
- };
- ContentStoreObject.prototype.getMetadataModelPackageEffectiveUserCapabilities = function (oData) {
- if (oData[this.METADATA_MODEL_PACKAGE] && oData[this.METADATA_MODEL_PACKAGE][0] && oData[this.METADATA_MODEL_PACKAGE][0][this.EFFECTIVE_USER_CAPABILITIES]) {
- return oData[this.METADATA_MODEL_PACKAGE][0][this.EFFECTIVE_USER_CAPABILITIES];
- }
- return null;
- };
- ContentStoreObject.prototype.getBaseModule = function(oData) {
- var baseModule = oData[this.BASE] && oData[this.BASE][0] && oData[this.BASE][0][this.MODULE];
- return baseModule && baseModule[0] || null;
- };
- ContentStoreObject.prototype.getRunInAdvancedViewer = function(oData) {
- return !!oData[this.RUN_IN_ADVANCED_VIEWER];
- };
- ContentStoreObject.prototype.getEffectiveUserCapabilities = function(oData, fetch) {
- if (fetch) {
- if (oData[this.EFFECTIVE_USER_CAPABILITIES]) {
- return Promise.resolve(oData[this.EFFECTIVE_USER_CAPABILITIES]);
- } else {
- return this.glassContext.getCoreSvc('.Ajax').ajax({
- 'url': this.getSelfLink(oData) + '?fields=effectiveUserCapabilities',
- 'dataType': 'json',
- 'type': 'GET'
- }).then(function(response) {
- var data = response.data;
- oData[this.EFFECTIVE_USER_CAPABILITIES] = data.data[0].effectiveUserCapabilities;
- return oData[this.EFFECTIVE_USER_CAPABILITIES];
- }.bind(this));
- }
- } else {
- return oData ? oData[this.EFFECTIVE_USER_CAPABILITIES] : null;
- }
- };
- ContentStoreObject.prototype.hasCapabilities = function (oData, capabilitiesArray) {
- var oCapabilitiesArray = this.getEffectiveUserCapabilities(oData);
- if (!oCapabilitiesArray) {
- return false;
- }
- return _.intersection(oCapabilitiesArray, capabilitiesArray).length === capabilitiesArray.length;
- };
- ContentStoreObject.prototype.canBurst = function(oData) {
- var base = this.getBase(oData);
- return oData.canBurst || (base && base.canBurst);
- };
- var _static = {
- getInstance: function() {
- if (!_singletonInstance) {
- _singletonInstance = new ContentStoreObject();
- }
- return _singletonInstance;
- }
- };
- return _static.getInstance();
- });
- !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"])});
- 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';});
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: ba-content-nav
- *| (C) Copyright IBM Corp. 2015, 2019
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bacontentnav/utils/UIHelper',[
- 'underscore',
- '../nls/StringResource',
- '../lib/@waca/core-client/js/core-client/i18n/Formatter',
- '../lib/@waca/core-client/js/core-client/ui/dialogs/MessageBox',
- './ContentStoreObject',
- '../lib/@ba-ui-toolkit/ba-graphics/dist/illustrations-js/no-detail_128',
- 'text!../config/ca.json'
- ], function(_, StringResource, Formatter, MessageBox, ContentStoreObject, noDetail, caJSON) {
- 'use strict'; //NOSONAR
- var _singletonInstance = null;
- var REQUIRED_MRU_FIELDS = ['defaultName', 'type', 'ancestors', 'permissions', 'disabled'];
- // Note: hidden will not be returned if the user doesn't have 'read', but they may have 'execute', it has been recommended that
- // we use the field 'shown' instead of 'hidden' - consider for future refactoring. Also, owner may not be absent for imported assets
- var OPTIONAL_MRU_FIELDS = ['hidden', 'owner'];
- var UIHelper = function() { //NOSONAR
- if (UIHelper.prototype._singletonInstance) {
- return UIHelper.prototype._singletonInstance;
- }
- UIHelper.prototype._singletonInstance = this;
- // Default to 'CA' configuration - in the long run, everything should be
- // driven by what comes up from the content-service
- this._UI_CONFIG = JSON.parse(caJSON);
- this._UI_REGISTRY = this._UI_CONFIG.uiTypes;
- this._CONFIG_TYPE = 'ca';
- this._filterFacets = {};
- this._CONTENT_NAV_LS_KEY = 'waca-nav-ls';
- this._sortCollator = null;
- // Check for overriding UI types
- this._getSubtype = function(item) {
- var subtypeOverride;
- var type = ContentStoreObject.getType(item);
- if (!type && item.securityObject) {
- // security objects have no top level type field
- subtypeOverride = item.securityObject.type;
- } else {
- // other objects have overriding subtypes, eg. exploration -> story
- _.find(this._UI_REGISTRY[type] && this._UI_REGISTRY[type].subtypes || [], function(subtype) {
- var field = item[subtype.check.field];
- if (field) {
- switch (subtype.check.test) {
- case 'equal':
- subtypeOverride = field === subtype.check.value && subtype.type;
- break;
- case 'contains':
- subtypeOverride = field.indexOf(subtype.check.value) !== -1 && subtype.type;
- break;
- case 'extension':
- var extensionTxt = field.split('.').pop();
- var extensionIndex = extensionTxt && subtype.check.values.indexOf(extensionTxt.toLowerCase());
- subtypeOverride = extensionIndex !== -1 && subtype.check.values[extensionIndex];
- break;
- default:
- // nothing
- }
- }
- return !!subtypeOverride;
- }.bind(this));
- }
- return subtypeOverride;
- };
- // Check if the given type is derived from something else
- this._isDerived = function(type) {
- var entry = this._UI_REGISTRY[type] || this._UI_REGISTRY['unknown'];
- return !!entry.derived || false;
- };
- // Check if item has the given tag
- this._hasOption = function(type, tag) {
- var entry = this._UI_REGISTRY[type] || this._UI_REGISTRY['unknown'];
- return entry.options && entry.options.indexOf(tag) !== -1;
- };
- this._hasOptionFromObject = function(object, tag) {
- return this._hasOption(ContentStoreObject.getType(object), tag);
- };
- // For validation - Admin uses :(
- this._validateIsNumber = function(value) {
- return _.isNumber(value);
- };
- this._validateIsEmail = function(value) {
- var emailRegex = /^([a-zA-Z0-9]+[_|-|.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|-|.]?)*[a-zA-Z0-9]+.[a-zA-Z]{2,3}$/;
- return value.length === 0 || emailRegex.test(value);
- };
- this._validateMaxLength = function(value, options) {
- return !value || value.toString().length <= options.maxLength;
- };
- this._validateNumericRange = function(value, options) {
- if (options.numericRange.min !== undefined && value < options.numericRange.min) {
- return false;
- }
- if (options.numericRange.max !== undefined && value > options.numericRange.max) {
- return false;
- }
- return true;
- };
- // Constants for validation messages
- this._GET_VALIDATION_MESSAGES = {
- 'isNumber': function() {
- return StringResource.get('invalidNumber');
- },
- 'isEmail': function() {
- return StringResource.get('invalidEmailMessage');
- },
- 'maxLength': function(checkList, timeLocale) {
- timeLocale = timeLocale || {};
- return StringResource.get('exceedMaxLength', {
- 'maxLength': Formatter.formatNumber(checkList.maxLength, {
- 'locale': timeLocale.contentLocale
- })
- });
- }.bind(this),
- 'numericRange': function(checkList, timeLocale) {
- var errorMessage;
- if (checkList.numericRange.min !== undefined && checkList.numericRange.max !== undefined) {
- errorMessage = StringResource.get('numberOutOfRange', {
- 'min': Formatter.formatNumber(checkList.numericRange.min, {
- 'locale': timeLocale.contentLocale
- }),
- 'max': Formatter.formatNumber(checkList.numericRange.max, {
- 'locale': timeLocale.contentLocale
- })
- });
- } else if (checkList.numericRange.min !== undefined) {
- errorMessage = StringResource.get('numberTooSmall', {
- 'min': Formatter.formatNumber(checkList.numericRange.min, {
- 'locale': timeLocale.contentLocale
- })
- });
- } else if (checkList.numericRange.max !== undefined) {
- errorMessage = StringResource.get('numberTooBig', {
- 'max': Formatter.formatNumber(checkList.numericRange.max, {
- 'locale': timeLocale.contentLocale
- })
- });
- }
- return errorMessage;
- }
- };
- };
- UIHelper.prototype.init = function(initValues) {
- _.extend(this, initValues);
- };
- /**
- * Allow the UI types (icons, strings) to be reset according to the current product type.
- * TODO: temporary - until the configuration is pushed down to the server
- * @param {object} glassContext
- * @return Promise - resolved when the new configuration is set
- */
- UIHelper.prototype.initializeRegistry = function(glassContext) {
- var config = glassContext && glassContext.getCoreSvc('.Context').get('config');
- var productTypeKey = (config && config.productType || 'ca').toLowerCase();
- if (this._CONFIG_TYPE === productTypeKey) {
- return Promise.resolve();
- } else {
- this._CONFIG_TYPE = productTypeKey;
- return new Promise(function(resolve) {
- var filePath = 'text!bacontentnav/config/' + productTypeKey + '.json';
- require([ filePath ], function(config) {
- var configOptions = JSON.parse(config);
- if (configOptions && configOptions.uiTypes) {
- this._UI_CONFIG = configOptions;
- this._UI_REGISTRY = configOptions.uiTypes;
- }
- resolve();
- }.bind(this));
- }.bind(this));
- }
- };
- /**
- * Render an info message with given text at the given node
- * @param {object} $node the DOM element
- * @param {string} message the text to display
- * @param {object} icon the icon object that must contain 'default.id'
- */
- UIHelper.prototype.renderInfoMessage = function($node, message, iconURL) {
- iconURL = iconURL || noDetail;
- var svg = '<svg class="svgIcon" role="img" focusable="false"> \
- <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#' + iconURL.default.id + '"></use> \
- </svg>';
- $node.html('<div class="contentApps_comingSoon"><div class="emptyTableImage">' + svg + '</div><div class="emptyTableText">' + message + '</div></div>');
- };
- /**
- * Return the display type of the item
- * @param {object} item the content-service item
- * @return {boolean}
- */
- UIHelper.prototype.getDisplayType = function(item) {
- var displayType = ContentStoreObject.getType(item);
- if (item) {
- switch (item.state) {
- case 'valid':
- case undefined:
- // check for overriding display type
- displayType = this._getSubtype(item, displayType) || displayType;
- break;
- default:
- // item is a 'progressing' state - used when deleting
- displayType = 'circle';
- }
- }
- return displayType || 'unknown';
- };
- /**
- * Return the filter type of the item
- * @param {object} item the content-service item
- * @return {boolean}
- */
- UIHelper.prototype.getFilterType = function(item) {
- var type = this.getDisplayType(item);
- var entry = type && this._UI_REGISTRY[type] || this._UI_REGISTRY['unknown'];
- return entry.filterType || ContentStoreObject.getType(item);
- };
- /**
- * Return an array of content-services types (excluding derived types such as 'unknown' or 'story')
- * @param [[{string}]] optional param - an array of strings indicating what options the types should have
- * @return {array}
- */
- UIHelper.prototype.getTypes = function(options) {
- return _.filter(Object.keys(this._UI_REGISTRY), function(type) {
- if (!this._isDerived(type)) {
- return options ? _.intersection(options, this._UI_REGISTRY[type].options).length > 0 : true;
- }
- return false;
- }.bind(this));
- };
- /**
- * Return filtering facets
- * @param [[{string}]] optional param - an array of strings indicating what options the types should have
- * @return {object}
- */
- UIHelper.prototype.getFilterFacets = function(options) {
- // only build once as it's kind of expensive
- var optionsKey = options ? options.join(',') : 'all';
- if (!this._filterFacets[optionsKey]) {
- // function to find all the types of a group
- var getGroup = function(groupName) {
- var group =[];
- _.each(Object.keys(this._UI_REGISTRY), function(type) {
- var entry = this._UI_REGISTRY[type];
- if (groupName) {
- if (this.isGroup(type, groupName)){
- group.push(type);
- }
- } else if (!entry.groups){
- group.push(type);
- }
- }.bind(this));
- return group;
- }.bind(this);
- // get the groups from the configured facet
- var filterFacets = {};
- var definedFacets = this.getConfiguration('filter').facets;
- _.each(definedFacets, function(facet){
- filterFacets[facet.msgKey] = getGroup(facet.group).join('|');
- });
- // add other group for items without groups
- filterFacets['others'] = getGroup(null).join('|');
- this._filterFacets[optionsKey] = filterFacets;
- }
- return this._filterFacets[optionsKey];
- };
- /**
- * Return an array of fields required for mru persistence for the given type
- * @param {string} type the display or content-service type
- * @return {array}
- */
- UIHelper.prototype.getMRUFields = function(type, requiredOnly) {
- if (requiredOnly) {
- return REQUIRED_MRU_FIELDS;
- } else {
- var entry = this._UI_REGISTRY[type] || this._UI_REGISTRY['unknown'];
- return REQUIRED_MRU_FIELDS.concat(OPTIONAL_MRU_FIELDS).concat(entry.mruFields || []);
- }
- };
- /**
- * Return true if the object type is a container
- * @param {string} type the content-service type
- * @return {boolean}
- */
- UIHelper.prototype.isContainer = function(type) {
- return !!this._hasOption(type, 'container');
- };
- /**
- * Return true if the object type is the given type
- * @param {string} type the content-service type
- * @return {boolean}
- */
- UIHelper.prototype.isGroup = function(type, groupType) {
- var entry = this._UI_REGISTRY[type] || this._UI_REGISTRY['unknown'];
- return entry.groups && groupType && entry.groups.indexOf(groupType) !== -1;
- };
- /**
- * Return true if the object type is a container
- * @param {object} oData the content-service object
- * @return {boolean}
- */
- UIHelper.prototype.isAllowedInTeamRoot = function(oData) {
- // we don't care if it's valid, etc. for this tag
- return !!this._hasOptionFromObject(oData, 'teamroot');
- };
- /**
- * Return true if the object type can be linked to a tenant
- * @param {object} oData the content-service object
- * @return {boolean}
- */
- UIHelper.prototype.hasTenantOption = function(oData) {
- // we don't care if it's valid, etc. for this tag
- return !!this._hasOptionFromObject(oData, 'tenant');
- };
- /**
- * Return true if the object type requires refetching to identify actions
- * @param {object} oData the content-service object
- * @return {boolean}
- */
- UIHelper.prototype.hasSource = function(oData) {
- return !!this._hasOptionFromObject(oData, 'hasSource');
- };
- /**
- * Return true if versions is supported
- * @param {object} oData the content-service object
- * @return {boolean}
- **/
- UIHelper.prototype.isVersionsSupported = function(oData) {
- return !!(ContentStoreObject.getVersionsLink(oData) || this._hasOptionFromObject(oData, 'versions'));
- };
- /**
- * Return the type's icon svg id
- * @param {string} type the content-service type
- * @return {string}
- */
- UIHelper.prototype.getSVGIconForType = function(type) {
- var entry = this._UI_REGISTRY[type] || this._UI_REGISTRY['unknown'];
- return entry.icon;
- };
- /**
- * Return true if the base icon should be decorated
- * @param {string} type the content-service type
- * @return {string}
- */
- UIHelper.prototype.isSVGIconDecorated = function(type) {
- return !!this._hasOption(type, 'decorateIcon');
- };
- /**
- * Return the content-service type
- * @param {string} type the display (or content-service) type
- * @return {string}
- */
- UIHelper.prototype.getType = function(type) {
- var entry = this._UI_REGISTRY[type] || this._UI_REGISTRY['unknown'];
- return entry.derived || type;
- };
- /**
- * Return the type's display string
- * @param {string} type the content-service type
- * @return {string}
- */
- UIHelper.prototype.getTypeName = function(type) {
- var entry = this._UI_REGISTRY[type] || this._UI_REGISTRY['unknown'];
- return entry.msg || StringResource.get(entry.msgKey);
- };
- /**
- * Return the type's display string
- * @param {object} object the content-service object
- * @return {string}
- */
- UIHelper.prototype.getTypeNameFromObject = function(object) {
- return this.getTypeName(this.getDisplayType(object));
- };
- /**
- * Return the type's display string
- * @param {string} type content-service type
- * @return {string}
- * @deprecated use getTypeName
- */
- UIHelper.prototype.getIconTooltipForType = function(type) {
- return this.getTypeName(type);
- };
- /**
- * Return the type's display string
- * @param {object} object the content-service object
- * @return {string}
- */
- UIHelper.prototype.getTypeSVGIconFromObject = function(object) {
- return this.getSVGIconForType(this.getDisplayType(object));
- };
- /**
- * Return a type's icon fill or null
- * @param {string} type the content-service type
- * @return {string}
- */
- UIHelper.prototype.getIconFill = function(type) {
- var entry = this._UI_REGISTRY[type] || this._UI_REGISTRY['unknown'];
- return entry.iconFill || null;
- };
- /**
- * Return the type's properties key for the properties panel (or null)
- * @param {string} type the content-service type
- * @return {string}
- */
- UIHelper.prototype.getProperties = function(type) {
- var entry = this._UI_REGISTRY[type] || this._UI_REGISTRY['unknown'];
- return entry.properties || null;
- };
- /**
- * Return the configuration for the given nameKey: capabilities, search, filter, etc.
- * @param {string} nameKey of the configuration to be fetched
- * @return {object} the configuration or an empty object if it does not exist
- */
- UIHelper.prototype.getConfiguration = function(nameKey) {
- return (this._UI_CONFIG || {})[nameKey] || {};
- };
- /**
- * Return true if local storage is supported
- * @return {boolean}
- */
- UIHelper.prototype.isLocalStorageSupported = function() {
- try {
- var testKey = 'testKey';
- localStorage.setItem(testKey, '1');
- localStorage.removeItem(testKey);
- return true;
- } catch (error) {
- return false;
- }
- };
- /**
- * Return true if the object permissions have the required permission
- * @param {array} objectPerm array of object permissions
- * @param {array} requiredPerm array of required permissions
- * @return {boolean}
- */
- UIHelper.prototype.hasPermissions = function(objectPerm, requiredPerm) {
- var matchingPerms = _.intersection(requiredPerm, objectPerm);
- return matchingPerms.length === requiredPerm.length;
- };
- /**
- * Return true if the input is valid
- * @param {string} value - the value to be validated
- * @param {object} checkList - the different 'validators' to be applied to the value
- * @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.
- * @return {boolean} true|false depending if the value is valid
- */
- UIHelper.prototype.validateInput = function(value, checkList, validationFailedCallback, timeLocale) {
- var okCallback = function(e) {
- e.stopPropagation();
- MessageBox.inherited('ok', this, arguments);
- if (validationFailedCallback) {
- validationFailedCallback();
- }
- return false;
- };
- for (var validationCheck in checkList) {
- if (checkList.hasOwnProperty(validationCheck)) {
- // Function names for validation need to start with '_validate'
- var funcName = '_validate' + validationCheck.charAt(0).toUpperCase() + validationCheck.slice(1);
- if (this[funcName] && !this[funcName](value, checkList)) {
- var dlg = new MessageBox('warning', StringResource.get('invalidInput'), this._GET_VALIDATION_MESSAGES[validationCheck](checkList, timeLocale));
- dlg.ok = okCallback;
- dlg.open();
- return false;
- }
- }
- }
- return true;
- };
- /**
- * Return true if a content object type is valid (At this time, only report views can be invalid if their base report is missing)
- * @param {object} oData - content object
- * @return {boolean} true|false depending if the value is valid
- */
- UIHelper.prototype.isValid = function(oData) {
- return this._hasOptionFromObject(oData, 'invalidWithoutBase') ? !!ContentStoreObject.hasBase(oData) : true;
- };
- /**
- * Return true if this object should be stored in the mru
- * @param {object} oData - content object
- * @return {boolean} true|false depending if the object should be stored in the MRU
- */
- UIHelper.prototype.isMRUSupported = function(oData) {
- var type = ContentStoreObject.getType(oData);
- return !(!type || this._isDerived(type) || this._hasOption(type, 'mruDisabled'));
- };
- /**
- * @param {string} type the content-service type
- * @return {array} array of base types, otherwise null
- */
- UIHelper.prototype.getBaseTypes = function(type) {
- var entry = this._UI_REGISTRY[type] || this._UI_REGISTRY['unknown'];
- return entry.baseTypes || null;
- };
- /**
- * Add a 'stroke' attribute to an svg element
- * @param {element} svg the svg element
- */
- UIHelper.prototype.addStroke = function(svg) {
- //ensure we remove the stroke in case we've already added it
- this.removeStroke(svg);
- var useTags = $(svg).find('use.ba_content_nav-filter_circle');
- if (useTags.length) { // i.e. the stroke exists
- // make it visible
- useTags.attr('visibility', 'visible');
- } else if (svg && svg.length){
- // add stroke to base image, todo: remove css from js
- var use = document.createElementNS('http://www.w3.org/2000/svg', 'use');
- use.setAttributeNS('http://www.w3.org/1999/xlink', 'href', '#ba_content_nav-filter_circle');
- use.setAttribute('height', '12');
- use.setAttribute('stroke', '#ffffff');
- use.setAttribute('fill', '#1f57a4');
- use.setAttribute('class', 'ba_content_nav-filter_circle');
- // adjust container height so stroke appears at the right height and append stroke
- $(svg).attr('style', 'height: 25px;');
- $(svg).append(use);
- }
- };
- /**
- * removes a 'stroke' attribute from an svg element that previously had one set using addStroke()
- * @param {element} svg the svg element
- */
- UIHelper.prototype.removeStroke = function(svg) {
- var useTags = $(svg).find('use.ba_content_nav-filter_circle');
- useTags.attr('visibility', 'hidden');
- };
- /**
- * Returns true if the content object is not missing required object capabilities
- * @param {object} object the content object
- * @param {array} typesToCheck array of object types that need to be verified
- * @param {array} capabilitiesToCheck array of object capabilities that are needed
- * @return {boolean}
- */
- UIHelper.prototype.hasRequiredCapabilities = function (object, typesToCheck, capabilitiesToCheck) {
- if (capabilitiesToCheck === undefined || capabilitiesToCheck.length === 0)
- return true;
- // Currently, module objects do not have effectiveUserCapabilities property.
- // This is wrong as per Offering Management. They will log defects for this.
- // The following block is temporarily and it is to be removed when fixed.
- if (ContentStoreObject.getType(object) === ContentStoreObject.MODULE) {
- return true;
- }
- if (_.indexOf(typesToCheck, ContentStoreObject.getType(object)) === -1) {
- return true;
- }
- return ContentStoreObject.hasCapabilities(object, capabilitiesToCheck);
- };
- UIHelper.prototype.saveSlideoutWidth = function(id, width) {
- var widths = this.getSlideoutObject() || {};
- if (!widths) widths = {};
- widths[id] = width;
- this.saveSlideoutObject(widths);
- };
- UIHelper.prototype.getSlideoutWidth = function(id) {
- var widths = this.getSlideoutObject();
- return widths && widths[id] || null;
- };
- UIHelper.prototype.getSlideoutObject = function() {
- var localStorage = window.localStorage || null;
- if (localStorage) {
- try {
- var contentNavWidthsRaw = localStorage.getItem(this._CONTENT_NAV_LS_KEY);
- return JSON.parse(contentNavWidthsRaw);
- } catch (e) {
- return null;
- }
- }
- return null;
- };
- UIHelper.prototype.saveSlideoutObject = function(slideout) {
- var localStorage = window.localStorage || null;
- if (localStorage) {
- try {
- localStorage.setItem(this._CONTENT_NAV_LS_KEY, JSON.stringify(slideout));
- } catch(e) {
- // error here, invalid object somehow.
- }
- }
- };
- UIHelper.prototype.getCollator = function() {
- if (!this._sortCollator) {
- this._createSortCollator();
- }
- return this._sortCollator;
- };
- UIHelper.prototype._createSortCollator = function() {
- if (window.Intl) {
- this._sortCollator = new Intl.Collator();
- } else {
- this._sortCollator = {
- compare: function(a, b) {
- return a.toString().toLowerCase() > b.toString().toLowerCase();
- }
- };
- }
- };
- var _static = {
- getInstance: function() {
- if (!_singletonInstance) {
- _singletonInstance = new UIHelper();
- }
- return _singletonInstance;
- }
- };
- return _static.getInstance();
- });
- /**
- * Licensed Materials - Property of IBM
- * IBM Cognos Products: BI
- * (C) Copyright IBM Corp. 2017
- * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- */
- define('bacontentnav/utils/CookieJar',[
- '../lib/@waca/baglass/js/baglass/utils/Utils'
- ], function(GlassUtils) {
- var CookieJar = {
- /**
- * Returns the value of the requested cookie
- * @param {String} key The key of the cookie
- * @return {String|undefined} the value of the cookie
- */
- getCookieValue: function(key) {
- return GlassUtils.getCookieValue(key);
- },
- /**
- * Set a cookie
- * @param {String} key Cookie name.
- * @param {String} value Cookie value.
- * @param {Date} expires The expires date.
- * @param {String} path Cookie path.
- * @param {String} domain Cookie domain.
- * @param {Boolean} secure Is the cookie secure.
- * @type void
- */
- setCookie: function(key, value, expires, path, domain, secure) {
- document.cookie = key + '=' + encodeURIComponent(value) +
- (expires ? '; expires=' + expires.toUTCString() : '') +
- (path ? '; path=' + path : '') +
- (domain ? '; domain=' + domain : '') +
- (secure ? '; secure' : '');
- },
- /**
- * Delete a cookie
- * @param {String} key Cookie name.
- * @param {String} path Cookie path.
- * @param {String} domain Cookie domain.
- * @type void
- */
- deleteCookie: function(key, path, domain) {
- document.cookie = key + '=' +
- (path ? '; path=' + path : '') +
- (domain ? '; domain=' + domain : '') +
- '; expires=Thu, 1 Jan 1970 00:00:01 UTC';
- }
- };
- return CookieJar;
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2015, 2020
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bacontentnav/services/MRUClientStore',[
- 'jquery',
- '../lib/@waca/core-client/js/core-client/ui/core/Class',
- '../utils/CookieJar',
- '../utils/GlassContextHelper',
- '../utils/UIHelper',
- '../lib/@waca/core-client/js/core-client/utils/BrowserUtils',
- 'underscore'
- ], function($, Class, CookieJar, GlassContextHelper, UIHelper, BrowserUtils, _) {
- 'use strict';
- var MRUQueue = Class.extend({
- /**
- @param glassContext (deprecated - required in initialize)
- @param compareToFunction (function, optional): function that takes two keys as parameters, and returns true if the two keys refer to the same object
- **/
- init: function(glassContext, compareToFunction) {
- this._FOLDER = 'formatedPath';
- this._NAME = 'defaultName';
- this._DELETE_VALUE = 'delete';
- this._TIMESTAMP_NUMERICAL_VALUE = '_timestamp';
- this._TIMESTAMP_DATE_VALUE = 'timestamp';
- this._LIST_VALUE = 'list';
- this._ID_VALUE = 'id';
- this._DEFAULT_URL = 'v1/users/~/mrus';
- this._LIST_ID = 'data';
- this._DUMP_PERIOD = 300000; //The queue will send it's content to the server every 5 minutes
- this._QUEUE_MAX_SIZE = 20; //The value 0 means no max size
- this._hasBeenPopulated = false; //Flag to populate the queue only once on creation
- this._MRU_COOKIE_KEY = 'MRUStorage';
- this._CONFIG_SECURE_COOKIES = 'cookieSecure';
- this._CONFIG_COOKIE_PATH = 'cookiePath';
- this._SELFURL_VALUE = 'selfUrl';
- this._listObject = {};
- this._queue = [];
- this._cycleID = -1; //The ID of the setInterval, kept so that it can be canceled
- /* A flag that refreshes whenever an item is added or deleted.
- * Will be checked by the cycle, to avoid
- * unecessary dumps to the server */
- this._needsRefresh = false;
- // Set the compare method used to find a key in the queue
- if (compareToFunction) {
- this._compareTo = compareToFunction;
- } else {
- this._compareTo = function(a, b) {
- return a === b;
- };
- }
- },
- /**
- * Initializes the MRU store with the current glass context and starts the cycle of pushing.
- * @param {object} glassContext
- */
- initialize: function(glassContext) {
- if (!this._initialized && glassContext) {
- this.glassContext = glassContext;
- this._logger = glassContext.getCoreSvc('.Logger');
- this._USER_ID = glassContext.profile.account.id;
- this._LOCAL_STORAGE_KEY = 'MRUStorage_' + this._USER_ID;
- this._GATEWAY = glassContext.gateway || '';
- this._isCAPASSOEnv = glassContext.getCoreSvc('.FeatureChecker').checkValue('contentNav', 'CAPASSO', 'enabled');
- // initialize from local storage
- if (UIHelper.isLocalStorageSupported()) {
- if (this._getUserMRUCookie()) {
- var storedMRUQueue = localStorage.getItem(this._LOCAL_STORAGE_KEY);
- if (storedMRUQueue) {
- try {
- this._queue = JSON.parse(storedMRUQueue);
- } catch (error) {
- this._logger.error('Failed to restore MRU queue from local storage', error);
- }
- localStorage.removeItem(this._LOCAL_STORAGE_KEY);
- }
- } else {
- this._setUserMRUCookie();
- }
- }
- var onUnload = function(asyncVal, returnPromise) {
- // on the final unload, we may not want to block the user from closing the browser by
- // choosing 'async' or returning a promise
- var finalDump = this._doFinalDump(asyncVal);
- return returnPromise ? finalDump : undefined;
- }.bind(this);
- if (BrowserUtils.isIPad()) {
- //Code for Ipad and mobile Apple devices
- $(window).blur(onUnload.bind(this, false, false));
- } else {
- //Code for browsers (Safari, Chrome, FF, IE)
- //More specifically, closing the tab or closing the window
- $(window).bind('beforeunload', onUnload.bind(this, false, false));
- }
- // for log out
- try {
- return glassContext.getSvc('.Logout')
- .then(function(logoutSvc) {
- logoutSvc.registerPreLogout(onUnload.bind(this, true, true));
- return this;
- }.bind(this));
- } catch(error) {
- this._logger.error(error);
- } finally {
- this.cycle();
- this._initialized = true;
- }
- }
- return Promise.resolve(this);
- },
- // perform last dump of mru queue before session end (via logout or window unload)
- _doFinalDump: function(asyncVal) {
- try {
- // cancel any pending dump through the interval
- this.cycle(false);
- // dump the queue if required
- if (this._needsRefresh) {
- // store current MRU queue in local storage in case browser cannot successfully perform the 'dump' ajax calls
- if (UIHelper.isLocalStorageSupported()) {
- if (this._getUserMRUCookie()) {
- localStorage.setItem(this._LOCAL_STORAGE_KEY, JSON.stringify(this._queue));
- } else if (localStorage.getItem(this._LOCAL_STORAGE_KEY)) {
- // clean localStorage entry if cookie was deleted
- localStorage.removeItem(this._LOCAL_STORAGE_KEY);
- }
- }
- // pass along async value, but always skip error handling in last dump
- return this.dump(asyncVal, true);
- }
- } catch (error) {
- this.glassContext.getCoreSvc('.Logger').error(error);
- } finally {
- this._needsRefresh = false;
- }
- return Promise.resolve();
- },
- _getUserMRUCookie: function() {
- var mruCookie = (CookieJar.getCookieValue(this._MRU_COOKIE_KEY));
- mruCookie = (mruCookie) ? JSON.parse(mruCookie) : {};
- return mruCookie[this._USER_ID];
- },
- _setUserMRUCookie: function() {
- var mruCookie = (CookieJar.getCookieValue(this._MRU_COOKIE_KEY));
- mruCookie = (mruCookie) ? JSON.parse(mruCookie) : {};
- mruCookie[this._USER_ID] = true;
- this._getCookiePath().then(function(path) {
- this._isSecureCookies().then(function(isSecure) {
- CookieJar.setCookie(this._MRU_COOKIE_KEY, JSON.stringify(mruCookie), undefined, path, undefined, isSecure);
- }.bind(this));
- }.bind(this));
- },
- _isSecureCookies: function() {
- return this.glassContext.getCoreSvc('.Config').getConfigValue(this._CONFIG_SECURE_COOKIES).then(function(response) {
- if (response && response === 'true') {
- return true;
- }
- return false;
- });
- },
- _getCookiePath: function() {
- return this.glassContext.getCoreSvc('.Config').getConfigValue(this._CONFIG_COOKIE_PATH).then(function(response) {
- if (response) {
- return response;
- }
- return undefined;
- });
- },
- push: function(key, elem, updateTimestamp) {
- this._delete(key);
- this._append(key, elem, updateTimestamp);
- this._needsRefresh = true;
- },
- /**
- Updates an entry in the queue with new information. Note, this won't
- update the timestamp of the entry, simply its information (name, location, ...)
- **/
- updateEntry: function(key, objInfo) {
- if (!objInfo || !key) {
- return;
- }
- var index = this.contains(key);
- if (index !== -1) {
- this._queue[index].elem = _.extend(this._queue[index].elem, objInfo);
- this._needsRefresh = true;
- }
- },
- _delete: function(key) {
- var index = this.contains(key);
- var returnValue = null;
- if (index !== -1) {
- returnValue = this._queue[index].elem;
- this._queue.splice(index, 1);
- this._needsRefresh = true;
- }
- return returnValue;
- },
- contains: function(key) {
- var index = -1;
- $.each(this._queue, function(i, val) {
- if (this._compareTo(key, val.key)) {
- index = i;
- return false;
- }
- }.bind(this));
- return index;
- },
- _append: function(key, elem, updateTimestamp) {
- if (this.isFull()) {
- this._queue.shift();
- }
- if (updateTimestamp) {
- var date = new Date();
- elem[this._TIMESTAMP_NUMERICAL_VALUE] = date.getTime();
- elem[this._TIMESTAMP_DATE_VALUE] = date.toISOString();
- }
- this._queue.push({
- 'key': key,
- 'elem': elem
- });
- },
- //The boolean set to false turns off the cyclical dump
- cycle: function(bool) {
- window.clearInterval(this._cycleID);
- if (typeof bool === 'undefined' || bool) {
- this._cycleID = window.setInterval(function() {
- this.dump();
- }.bind(this), this._DUMP_PERIOD);
- }
- },
- dump: function(async, skipErrorHandling) {
- return new Promise(function(resolve) {
- if (this._needsRefresh) {
- if (async === false) {
- this.getFromMRU(async, skipErrorHandling).then(function() {
- this.putToMRU(async, skipErrorHandling).then(function() {
- this._needsRefresh = false;
- resolve();
- }.bind(this));
- }.bind(this));
- } else {
- this.getFromMRU().then(function() {
- this.putToMRU().then(function() {
- this._needsRefresh = false;
- resolve();
- }.bind(this));
- }.bind(this));
- }
- } else {
- resolve();
- }
- }.bind(this));
- },
- refresh: function() {
- return this.dump()
- .then(function() {
- // reset fields
- this._hasBeenPopulated = false;
- this._listObject = {};
- this._queue = [];
- return this._populateQueue();
- }.bind(this));
- },
- //Requires arrays of key/elem pairs
- mergeArrays: function(a, b) { // jshint ignore:line
- var onHold = this._queue;
- this.clear();
- var tempA = [];
- var tempB = [];
- a = a.sort(this.sortTimestamp.bind(this));
- b = b.sort(this.sortTimestamp.bind(this));
- while (!this.isEmpty(a) || !this.isEmpty(b)) {
- if (a.length && b.length && this._compareTo(a[0].key, b[0].key)) {
- //Only push the element with the most recent timestamp
- if (a[0].elem._timestamp >= b[0].elem._timestamp) {
- this.push(a[0].key, a[0].elem);
- } else {
- this.push(b[0].key, b[0].elem);
- }
- tempA.push(a.shift());
- tempB.push(b.shift());
- } else if (a.length && !b.length ||
- (a.length && b.length && a[0].elem._timestamp <= b[0].elem._timestamp)) {
- //Order the queue by timestamp. The smallest timestamp (aka. oldest) gets pushed first
- this.push(a[0].key, a[0].elem);
- tempA.push(a.shift());
- } else if (!a.length && b.length ||
- (a.length && b.length && a[0].elem._timestamp > b[0].elem._timestamp)) {
- this.push(b[0].key, b[0].elem);
- tempB.push(b.shift());
- }
- }
- var returnArr = this._queue;
- this._queue = onHold;
- while (tempA.length > 0) {
- a.push(tempA.shift());
- }
- while (tempB.length > 0) {
- b.push(tempB.shift());
- }
- return returnArr;
- },
- sortTimestamp: function(a, b) {
- var aTime = a.elem[this._TIMESTAMP_NUMERICAL_VALUE];
- var bTime = b.elem[this._TIMESTAMP_NUMERICAL_VALUE];
- return ((aTime < bTime) ? -1 : ((aTime > bTime) ? 1 : 0));
- },
- //Assumes the arr's elements contain the property 'id'
- addKeysToArray: function(arr) {
- if (!arr[0] || !arr[0].id) {
- return [];
- }
- var temp = this._queue;
- this.clear();
- $.each(arr, function(index, elem) {
- this.push(elem.id, elem);
- }.bind(this));
- var returnArr = this._queue;
- this._queue = temp;
- return returnArr;
- },
- getFromMRU: function(async, skipErrorHandling) {
- return new Promise(function(resolve) {
- async = async !== false;
- skipErrorHandling = skipErrorHandling === true;
- var url = this._DEFAULT_URL;
- var options = {
- 'url': url,
- 'dataType': 'json',
- 'async': async,
- 'skipErrorHandling': skipErrorHandling,
- 'data': {}
- };
- this.glassContext.getCoreSvc('.Ajax').ajax(options)
- .then(function(response) {
- response = response.data;
- var needsTrimming = false;
- var flippedQueue = [];
- var i = this.findList(response);
- if (i !== -1) {
- if (!this._listObject[this._LIST_VALUE]) {
- this._listObject = response[i];
- this._listObject[this._ID_VALUE] = response[i][this._ID_VALUE];
- }
- if (this._listObject[this._LIST_VALUE] && $.isArray(this._listObject[this._LIST_VALUE])) {
- flippedQueue = this._listObject[this._LIST_VALUE].reverse();
- }
- if (response.length > 1) {
- needsTrimming = true;
- this.trimMRU(response, url, 0 /*count*/ , i /*keeper*/ ).then(resolve);
- }
- } else if (response.length) {
- needsTrimming = true;
- this.trimMRU(response, url).then(resolve);
- }
- this._queue = this.mergeArrays(this._queue, this.addKeysToArray(flippedQueue));
- if (!needsTrimming) {
- resolve();
- }
- }.bind(this))
- .catch(this._handleMRUError.bind(this));
- }.bind(this));
- },
- findList: function(arrayOfLists) {
- //Returns the index of the element containing a proper ID and a 'list' value, or -1 otherwise
- var index = -1;
- if (!$.isArray(arrayOfLists)) {
- return index;
- }
- $.each(arrayOfLists, function(i, value) {
- if (value.hasOwnProperty(this._LIST_VALUE) &&
- value[this._ID_VALUE] === this._LIST_ID) {
- index = i;
- }
- }.bind(this));
- return index;
- },
- //A safety measure, in case the MRU data gets duplicated. Recursively deletes
- //all but the element with an ID matching this._LIST_ID.
- trimMRU: function(mruArr, url, count, keeper) {
- if (!count) {
- count = 0;
- }
- if (count > mruArr.length - 1) {
- return Promise.resolve();
- }
- var promise;
- if (count !== keeper) {
- var idUrl = url + '/' + mruArr[count].id;
- this.counter = this.counter + 1;
- var options = {
- 'url': idUrl,
- 'type': 'DELETE',
- 'dataType': 'json'
- };
- promise = this.glassContext.getCoreSvc('.Ajax').ajax(options);
- } else {
- promise = Promise.resolve();
- }
- return promise.then(this.trimMRU.bind(this, mruArr, url, count + 1, keeper)).catch(function(err) {
- // Stop the cycle if the delete call failed as no item will be updated
- this._logger.error(err);
- this.cycle(false);
- }.bind(this));
- },
- putToMRU: function(async, skipErrorHandling) {
- var url = this._DEFAULT_URL;
- async = async !== false;
- skipErrorHandling = skipErrorHandling === true;
- return this.getQueue(true)
- .then(function(mruQueue) {
- this._listObject[this._LIST_VALUE] = mruQueue;
- this._listObject[this._ID_VALUE] = this._LIST_ID;
- url += '/' + this._listObject[this._ID_VALUE];
- var options = {
- 'contentType': 'application/json',
- 'dataType': 'json',
- 'async': async,
- 'skipErrorHandling': skipErrorHandling,
- 'type': 'PUT',
- 'url': url,
- 'data': JSON.stringify(this._listObject)
- };
- return this.glassContext.getCoreSvc('.Ajax').ajax(options)
- .then(function() {
- this.printQueue();
- }.bind(this))
- .catch(this._handleMRUError.bind(this));
- }.bind(this));
- },
- _handleMRUError: function(err) {
- this._logger.error('Failed to get/set MRU', err);
- return Promise.reject(err);
- },
- // Marks the element as deleted (doesn't really *remove* the element)
- remove: function(key) {
- var elem = this._delete(key);
- if (elem !== null) {
- elem[this._DELETE_VALUE] = true;
- this._append(key, elem, true);
- }
- },
- // Remove all of the children of the container from the MRU list and keep the container itself.
- removeContainer: function(containerInfo) {
- if (!containerInfo.ancestors) {
- this._logger.warn('Missing ancestors info');
- return Promise.resolve();
- }
- return this.getQueue().then(function(mruQueue) {
- //For each element in the MRU...
- $.each(mruQueue, function(mruIndex, mruItem) {
- /*Compare it with the deleted container. Look at each shared ancestor, and if they all match,
- it means the MRU item is a descendant of that container.*/
- var mruAncestors = mruItem[this._FOLDER].split(' > ');
- var isContained = false;
- $.each(containerInfo.ancestors, function(ancestorIndex, ancestorItem) {
- if (ancestorItem[this._NAME] !== mruAncestors[ancestorIndex]) {
- return false;
- } else if (ancestorIndex === containerInfo.ancestors.length - 1 &&
- mruAncestors[ancestorIndex + 1] &&
- mruAncestors[ancestorIndex + 1] === containerInfo.defaultName) {
- //All the ancestors match
- isContained = true;
- }
- }.bind(this));
- if (isContained && mruItem.id) {
- //A deleted element is an ancestor to this MRU item. Remove that item from the MRU.
- this.remove(mruItem.id);
- }
- }.bind(this));
- }.bind(this));
- },
- //Returns a new array devoid of the keys and deleted elements, flipped so that index [0] is the newest Element
- // @param returnAll : if true, returns all the items in the queue, including the deleted ones waiting to be cleaned.
- getQueue: function(returnAll) {
- return this._populateQueue().then(function() {
- var arr = [];
- this._removeDuplicateElements();
- $.each(this._queue, function(i, value) {
- if (returnAll || (!value.elem[this._DELETE_VALUE] && (!value.elem[this._SELFURL_VALUE] || value.elem[this._SELFURL_VALUE].indexOf(this._GATEWAY) === 0 || this._isCAPASSOEnv))) {
- arr.push(value.elem);
- }
- }.bind(this));
- return arr.reverse();
- }.bind(this));
- },
- _populateQueue: function() {
- if (this._hasBeenPopulated || this._listObject[this._LIST_VALUE]) {
- return Promise.resolve('populated');
- }
- return this.getFromMRU().then(function() {
- this._hasBeenPopulated = true;
- }.bind(this));
- },
- // Remove older elements with same name and folder from the queue
- _removeDuplicateElements: function() {
- $.each(this._queue, function(key, value) {
- var elem = value.elem;
- if (this._isDuplicate(elem)) {
- elem[this._DELETE_VALUE] = true;
- }
- }.bind(this));
- },
- // Returns true if elem is a duplicate
- _isDuplicate: function(elem) {
- // If not already deleted and has a newer version... then it's a duplicate
- return !elem[this._DELETE_VALUE] && this._hasNewerVersion(elem);
- },
- // Returns true if a newer elem with same name and folder exists in the queue
- _hasNewerVersion: function(elem) {
- // Iterate over the queue until we find a newer version of the element
- return this._queue.some(function(candidate) {
- return this._isNewerVersion(candidate.elem, elem);
- }.bind(this));
- },
- // Returns true if candidate is a newer version of elem
- _isNewerVersion: function(candidate, elem) {
- return candidate.id !== elem.id &&
- !candidate[this._DELETE_VALUE] &&
- candidate[this._FOLDER] === elem[this._FOLDER] &&
- candidate[this._NAME] === elem[this._NAME] &&
- candidate[this._TIMESTAMP_NUMERICAL_VALUE] >= elem[this._TIMESTAMP_NUMERICAL_VALUE];
- },
- _clearLastDeletedElem: function() {
- while (this._queue[0] && this._queue[0].elem[this._DELETE_VALUE] && this._queue.length > this._QUEUE_MAX_SIZE) {
- this._queue.shift();
- }
- },
- isFull: function() {
- if (this._queue.length < this._QUEUE_MAX_SIZE || this._QUEUE_MAX_SIZE === 0) {
- return false;
- } else {
- this._clearLastDeletedElem();
- }
- var count = 0;
- $.each(this._queue, function(i/*, value*/) {
- if (!this._queue[i].elem[this._DELETE_VALUE]) {
- count = count + 1;
- }
- }.bind(this));
- return count >= this._QUEUE_MAX_SIZE;
- },
- isEmpty: function(arr) {
- if (arr) {
- return !arr.length;
- }
- return !this._queue.length;
- },
- clear: function() {
- this._queue = [];
- },
- printQueue: function() {
- this._logger.info('Printing the queue');
- this._logger.info(this._queue);
- },
- getMaxSize: function() {
- return this._QUEUE_MAX_SIZE;
- }
- });
- return MRUQueue;
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2015, 2021
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- // jshint -W072
- define('bacontentnav/services/ContentService',[
- '../lib/@waca/baglass/js/baglass/app/services/AjaxService',
- '../lib/@waca/core-client/js/core-client/utils/Utils',
- '../utils/ContentStoreObject',
- '../utils/GlassContextHelper',
- '../utils/UIHelper',
- '../utils/ContentServiceUrls',
- './MRUClientStore',
- '../nls/StringResource',
- 'jquery',
- 'underscore'
- ], function(AjaxService, Utils, ContentStoreObject, GlassContextHelper, UIHelper, ContentServiceUrls, MRUClientStore, StringResources, $, _) {
- 'use strict';
- // constants for mru management
- var MRU_HTTP_HEADER_NAME = 'X-BI-MRU-PUT';
- var MRU_CATEGORY = 'CONTENT_MRU';
- var MRU_KEY_FUNCTION_MAP = {
- 'formatedPath': 'getLocation',
- 'defaultName': 'getName',
- 'type': 'getType',
- 'disabled': 'getDisabled',
- 'permissions': 'getPermissions',
- 'selfUrl': 'getSelfLink'
- };
- var MRU_OPTIONALKEY_FUNCTION_MAP = {
- 'defaultScreenTip': 'getTooltip',
- 'hidden': 'getHidden', // hidden will not be returned if the user doesn't have 'read', but they may have 'execute'
- 'iconURI': 'getIcon',
- 'owner': 'getOwnerName',
- 'tags': 'getTags'
- };
- // fields with the same name that appear both in an MRU entry and content-service object
- var _COMMON_MRU_FIELDS = ['defaultName','type','owner','permissions','disabled','hidden','iconURI','defaultScreenTip'];
- /**
- * For any ajax request done through the content service, you can specify MRUInfo option to add to the MRU list.
- * At a minimum, this MRUInfo should contain the id of the content-service asset. If not a 'get' operation,
- * a rest call will be made to fetch the asset freshly from content-service to persist it to that user's mru.
- */
- var ContentService = AjaxService.extend({
- init: function(options) {
- ContentService.inherited('init', this, arguments);
- _.extend(this, options);
- this.initialize(this.glassContext);
- },
- get: function(path, options, originalDeferred) {
- void(path, originalDeferred);
- // merge any fields in the given options with the needed mru fields
- // NOTE: it seems that some fields added in the MRU request are not required for MRU,
- // but are currently expected by consumers, eg. permissions
- var fields = options && options.data && options.data.fields;
- var type = options && options.MRUInfo && options.MRUInfo.type || 'unknown';
- var fieldsArray = (fields ? fields.split(',') : []).concat(UIHelper.getMRUFields(type));
- fieldsArray = _.uniq(fieldsArray);
- // add these fields to the options data
- options = options || {};
- options.data = options.data || {};
- options.data.fields = fieldsArray.join(',');
- // make the get request
- var deferred = $.Deferred();
- ContentService.inherited('get', this, arguments)
- .then(function() {
- deferred.resolve.apply(deferred, arguments);
- if (options.MRUInfo) {
- this._addToMRU(arguments[0].data[0]);
- }
- }.bind(this), function() {
- deferred.reject.apply(deferred, arguments);
- });
- return deferred.promise();
- },
- post: function(path, options, originalDeferred) {
- void(path, originalDeferred);
- var deferred = $.Deferred();
- ContentService.inherited('post', this, arguments)
- .then(function(data, status, request) {
- deferred.resolve.apply(deferred, arguments);
- if (options.MRUInfo) {
- // extend MRU with location in response header
- options.MRUInfo.selfUrl = request.getResponseHeader('location');
- this._fetchAndAddToMRU(options.MRUInfo);
- }
- }.bind(this), function(){
- deferred.reject.apply(deferred, arguments);
- });
- return deferred.promise();
- },
- put: function(path, options, originalDeferred) {
- void(path, originalDeferred);
- var deferred = $.Deferred();
- ContentService.inherited('put', this, arguments)
- .then(function() {
- deferred.resolve.apply(deferred, arguments);
- if (options.MRUInfo) {
- this._fetchAndAddToMRU(options.MRUInfo);
- }
- }.bind(this), function(){
- deferred.reject.apply(deferred, arguments);
- });
- return deferred.promise();
- },
- delete: function(path, options, originalDeferred) {
- void(path, originalDeferred);
- // TODO: does this work?
- if (options.MRUInfo && options.MRUInfo.id) {
- options.headers = options.headers || [];
- // To remove something from the MRU specify the category and ID
- options.headers[MRU_HTTP_HEADER_NAME] = JSON.stringify({
- category: MRU_CATEGORY,
- key: options.MRUInfo.id
- });
- }
- return ContentService.inherited('delete', this, arguments);
- },
- /**
- * Returns the MRU entry json for a given content-service object
- * @param {object} objInfo - the content service object
- */
- _getMRUEntry: function(objInfo) {
- var mruEntry = {};
- // populate the new mruEntry
- mruEntry[ContentStoreObject.ID] = objInfo.id;
- // set required fields
- _.each(Object.keys(MRU_KEY_FUNCTION_MAP), function(key){
- mruEntry[key] = ContentStoreObject[MRU_KEY_FUNCTION_MAP[key]](objInfo);
- });
- // set optional fields depending on type
- var mruFields = UIHelper.getMRUFields(ContentStoreObject.getType(objInfo));
- _.each(Object.keys(MRU_OPTIONALKEY_FUNCTION_MAP), function(key) {
- if (mruFields.indexOf(key) !== -1 && objInfo.hasOwnProperty(key)) {
- mruEntry[key] = ContentStoreObject[MRU_OPTIONALKEY_FUNCTION_MAP[key]](objInfo);
- }
- });
- // special case - base comes back in array from content-service, so persist it like that
- if (mruFields.indexOf('base') !== -1 && ContentStoreObject.getBase(objInfo)) {
- mruEntry['base'] = [ContentStoreObject.getBase(objInfo)];
- }
- return mruEntry;
- },
- /**
- * Puts the given object into the MRU queue if it has valid fields
- * @param {object} objInfo - the content service object
- */
- _addToMRU: function(objInfo) {
- var hasValidFieldsForMRU =
- !(_.some(UIHelper.getMRUFields(ContentStoreObject.getType(objInfo), true), function(field){
- return objInfo[field] === undefined || objInfo[field] === null;
- }));
- if (hasValidFieldsForMRU) {
- var mruEntry = this._getMRUEntry(objInfo);
- this.mruQueue.push(mruEntry.id, mruEntry, true);
- this.eventRouter.trigger('home:refresh', { dump: false });
- } else {
- this.logger.debug('Not adding to asset to MRU list: ' + objInfo.id);
- }
- },
- /**
- * If the object type is enabled for MRU, fetches the asset, then adds it to the MRU queue
- * @param {object} objInfo - the content service object
- */
- _fetchAndAddToMRU: function(objInfo) {
- // short-circuit fetch if asset is not supported
- if (UIHelper.isMRUSupported(objInfo)) {
- // fetch the asset to ensure it is 'fresh', then persist to mru list
- var options = {
- 'url': ContentStoreObject.getSelfLink(objInfo),
- 'dataType': 'json',
- 'type': 'GET',
- 'data': {
- 'fields': UIHelper.getMRUFields(ContentStoreObject.getType(objInfo)).join(',')
- }
- };
- this.glassContext.getCoreSvc('.Ajax').ajax(options)
- .then(function(response) {
- this._addToMRU(response.data.data[0]);
- }.bind(this))
- .catch(function(err) {
- // just log the error - there's nothing a user can do
- this.logger.error(err);
- }.bind(this));
- }
- },
- /**
- * Returns an encoded path for the given parameter
- * @param {string} path
- */
- _getEncodedPath: function(path) {
- var pathWithNoSlash = path ? path.replace(/^\//, '') : path;
- return encodeURIComponent(pathWithNoSlash);
- },
- /**
- * Puts the given object into the MRU if it is valid for the MRU,
- * otherwise, it will try to fetch the object one time to get
- * @param {object} objInfo - the content service object
- */
- addToMRU: function(objInfo) {
- this._fetchAndAddToMRU(objInfo);
- },
- /**
- * Updates the MRU entry for the given content-service object
- * (if it exists in the current MRU queue)
- * @param {object} objInfo - the content service object
- */
- updateMRUEntry: function(objInfo) {
- if (objInfo && objInfo.id) {
- // Build up the MRU entry, then remove any entry that was not well defined in objInfo
- var mruEntry = this._getMRUEntry(objInfo);
- // regular cases where the content-service field names match mru field names
- _.each(_COMMON_MRU_FIELDS, function(field) {
- if (objInfo[field] === undefined || objInfo[field] === null || objInfo[field] === '') {
- delete mruEntry[field];
- }
- });
- // special case where they don't...
- if (!objInfo['ancestors']) {
- delete mruEntry['formatedPath'];
- }
- // self urls shouldn't change, so don't update them
- delete mruEntry['selfUrl'];
- this.mruQueue.updateEntry(mruEntry.id, mruEntry);
- this.eventRouter.trigger('home:refresh', { dump: false });
- }
- },
- /**
- * Removes the MRU entry for the given content-service object
- * (if it exists in the current MRU queue)
- * @param {object} objInfo - the content service object
- */
- removeFromMRU: function(objInfo) {
- if (objInfo && objInfo.id) {
- // ??? containers aren't in the MRU
- if (UIHelper.isContainer(ContentStoreObject.getType(objInfo))) {
- this.mruQueue.removeContainer(objInfo);
- }
- this.mruQueue.remove(objInfo.id);
- this.eventRouter.trigger('home:refresh', { dump: false });
- } else {
- this.logger.debug('Missing information to remove from the MRU List: ' + objInfo);
- }
- return $.Deferred().resolve(true).promise();
- },
- getBaseObjectsURL: function() {
- return ContentServiceUrls.getBaseObjectsURL();
- },
- getBasePathURL: function() {
- return ContentServiceUrls.getBasePathURL();
- },
- /**
- * @param {String} path - unencoded path
- * @return the url for the given path
- */
- getPathUrl: function(path) {
- return ContentServiceUrls.getBasePathURL() + this._getEncodedPath(path);
- },
- /**
- * @param {String} path - unencoded path
- * @return the search path url for the given path
- */
- getSearchPathUrl: function(path) {
- return ContentServiceUrls.getBaseSearchPathURL() + this._getEncodedPath(path);
- },
- getMyFoldersURL: function() {
- return ContentServiceUrls.getMyFoldersURL();
- },
- getOtherUsersFoldersURL: function() {
- return ContentServiceUrls.getOtherUsersFoldersURL();
- },
- getBaseNamespaceURL: function() {
- return ContentServiceUrls.getBaseNamespaceURL();
- },
- getPublicFoldersURL: function() {
- return ContentServiceUrls.getPublicFoldersURL();
- },
- refreshMRU: function() {
- return this.mruQueue.refresh();
- },
- getMRUList: function() {
- return this.mruQueue.getQueue()
- .then(function(data) {
- // filter out items that should be hidden to the user (unless their preference is to see them)
- if (!GlassContextHelper.getUserPreference(this.glassContext, 'showHiddenObjects')) {
- data = _.filter(data, function(item){
- return !ContentStoreObject.getHidden(item);
- });
- }
- return data || [];
- }.bind(this));
- },
- getLocation: function(oData) {
- return ContentStoreObject.getLocation(oData);
- },
- getMRUMaxSize: function() {
- return this.mruQueue.getMaxSize();
- },
- initialize: function(glassContext) {
- if (!glassContext) {
- return;
- }
- this.glassContext = glassContext;
- this.eventRouter = this.glassContext.getCoreSvc('.Events');
- this.logger = this.glassContext.getCoreSvc('.Logger');
- ContentStoreObject.setGlassContext(glassContext);
- // Adding the glassContext to Utils for date and time translation.
- if (_.isFunction(Utils.init)) {
- Utils.init({
- 'glassContext': this.glassContext
- });
- }
- // create and initialize the MRU store
- this.mruQueue = new MRUClientStore();
- return this.mruQueue.initialize(glassContext);
- },
- getRootPublicFolderName: function() {
- return ContentServiceUrls.getRootPublicFolderName();
- },
- getRootMyFolderName: function() {
- return ContentServiceUrls.getRootMyFolderName();
- },
- showFolder: function(folder) {
- return this._getFolderData(folder).then(function(folderInfo) {
- if(folderInfo) {
- this._openFolder(folderInfo);
- }
- }.bind(this));
- },
- _getFolderData: function(folderPathRef) {
- var options = {
- dataType: 'json',
- type: 'GET',
- url: 'v1/path?path=' + encodeURIComponent(folderPathRef),
- data: {
- 'fields': 'id,type,defaultName,ancestors,shown'
- }
- };
- return this.glassContext.getCoreSvc('.Ajax').ajax(options).then(function(objInfo) {
- var folder = objInfo.data.data[0];
- if (folder.type !== 'folder' && folder.ancestors && folder.ancestors.length) {
- return this._getFolderData(folder.ancestors.pop().id);
- }
- return objInfo.data.data[0];
- }.bind(this)).catch(function(error) {
- this.logger.error('Failed to retrieve objInfo for pathRef=' + folderPathRef, error);
- this._showUnableToOpenFolderMessage();
- }.bind(this));
- },
- // Check if a folder is top level (Need to transform My Folders to My Content, since we get back My Folders from content store)
- _isTopLevel: function(objInfo){
- if (objInfo.ancestors){
- for (var i = 0; i < objInfo.ancestors.length; i++) {
- if (objInfo.ancestors[i].type === 'folder'){
- return false;
- }
- }
- return true;
- }
- },
- _openFolder: function(folderInfo) {
- if(folderInfo.shown === true) {
- // Top level directory My content
- var isTopLevel = this._isTopLevel(folderInfo);
- var isUserContent = this._isUserContent(folderInfo, isTopLevel);
- var pluginId = isUserContent ? 'com.ibm.bi.contentApps.myContentFoldersSlideout' : 'com.ibm.bi.contentApps.teamFoldersSlideout';
- var plugin = this.glassContext.appController.findPlugin(pluginId);
- if(plugin) {
- return plugin.getActionController().then(function(actionController) {
- // here: set plugin options as needed...
- plugin.itemSpec.options.content.initialFolder = folderInfo;
- actionController.onPress({
- glassContext: this.glassContext,
- pushState: true,
- target: {
- plugin: plugin
- }
- });
- }.bind(this));
- } else {
- this.logger.error('Cannot find plugin with id="' + pluginId + '"');
- this._showUnableToOpenFolderMessage();
- }
- } else {
- this._showUnableToOpenFolderMessage();
- }
- },
- _showUnableToOpenFolderMessage: function() {
- this.glassContext.appController.showToast(StringResources.get('unableToOpenFolderMsg'), {
- type: 'error',
- preventDuplicates: true
- });
- },
- _isUserContent: function(objInfo, isTopLevel) {
- var ancestors = ContentStoreObject.getAncestors(objInfo);
- if(ancestors && ancestors.length > 0){
- var rootUrl = ContentStoreObject.getSelfLink(ancestors[0]);
- }
- // transforming My Folders to My Content. My Content used to be My Folders and logic needs updating since it still
- // comes back as My Folders from the server
- if (isTopLevel && rootUrl === this.getMyFoldersURL()) {
- objInfo.ancestors = [];
- objInfo.defaultName = StringResources.get('myContent');
- }
- return rootUrl === this.getMyFoldersURL();
- }
- });
- return ContentService;
- });
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Content Explorer
- *| (C) Copyright IBM Corp. 2017, 2018
- *|
- *| US Government Users Restricted Rights - Use, duplication or disclosure
- *| restricted by GSA ADP Schedule Contract with IBM Corp.
- *+------------------------------------------------------------------------+
- */
- define('bi/content_apps/api/ContentSlideoutController',[
- 'bi/glass/app/NavbarButtonSlideoutController',
- 'bacontentnav/utils/ContentStoreObject',
- 'bacontentnav/utils/UIHelper',
- 'underscore'
- ], function(NavbarButtonSlideoutController, ContentStoreObject, UIHelper, _) {
- 'use strict'; //NOSONAR
- var ContentSlideoutController = NavbarButtonSlideoutController.extend({
- /**
- * Builds a predefined spec for slideout.
- * If current content view has a folderInfo object then it
- * builds a slideout spec to display a folder instead of root
- * based on ancestors from folderInfo object.
- * @public
- * @override
- * @param {object} Context containing glass context and target
- * @returns {object} Slideout item spec
- */
- getCustomSpec: function(context) {
- var spec = ContentSlideoutController.inherited('getCustomSpec', this, arguments);
- var contentView = context.glassContext.appController.getCurrentContentView();
- if (this._hasInitialFolder(spec) || this._needToOpenSpecificFolder(contentView)) {
- try {
- this._addFolderInfoInSpec(spec, contentView);
- } catch (e) {
- context.glassContext.getCoreSvc('.Logger').error('Cannot add folder info in spec', e);
- }
- }
- if (spec.options && spec.options.content.id) {
- var specWidth = UIHelper.getSlideoutWidth(spec.options.content.id);
- if (specWidth) {
- // We need to add 9px for the bar.
- specWidth = parseInt(specWidth);
- specWidth += 9;
- if (specWidth < $(document).width()) {
- spec.options.width = '' + specWidth + 'px';
- }
- }
- }
- return spec;
- },
- _needToOpenSpecificFolder: function(contentView) {
- return contentView && contentView.module === 'cahome/views/CAHomeView' &&
- _.isFunction(contentView.getFolderInfo) &&
- _.isFunction(contentView.resetFolderInfo);
- },
- onShowCallback: function() {
- if (this._slideout && this._slideout.contentView && this._isNotLegacyView(this._slideout.contentView.moduleID)) {
- this._slideout.contentView.toggleSlideoutOpen();
- this._slideout.contentView.render(this.targetFolder);
- }
- },
- _addFolderInfoInSpec: function(spec, contentView) {
- this.targetFolder = spec.options.content.initialFolder;
- this.renderFromReact = spec.options.content.renderFromReact;
- var folderInfo = contentView.getFolderInfo && contentView.getFolderInfo();
- this.targetURL = spec.options.content.url;
- if (spec.options.content.initialFolder) {
- folderInfo = spec.options.content.initialFolder;
- delete spec.options.content.initialFolder;
- }
- if (contentView.resetFolderInfo) {
- contentView.resetFolderInfo();
- }
- if (_.isObject(folderInfo)) {
- var ancestors = _.clone(ContentStoreObject.getAncestors(folderInfo));
- if (ancestors) {
- if (UIHelper.isContainer(ContentStoreObject.getType(folderInfo))) {
- ancestors.push(_.pick(folderInfo, 'id', 'type', 'defaultName', '_meta'));
- } else {
- folderInfo = ancestors[ancestors.length - 1];
- }
- } else {
- ancestors = [];
- }
- spec.options.label = folderInfo.defaultName;
- spec.options.content.ancestors = ancestors;
- spec.options.content.url = ContentStoreObject.getItemsLink(folderInfo);
- spec.options.content.selfUrl = ContentStoreObject.getSelfLink(folderInfo);
- if (this._slideout && this._slideout.contentView) {
- var realAncestors = [];
- for (var i=0; i<ancestors.length; i++) {
- if (ancestors[i].id !== folderInfo.id) {
- realAncestors.push(ancestors[i]);
- }
- }
- folderInfo.ancestors = realAncestors;
- if (!this.renderFromReact) {
- this._slideout.contentView.ancestors = folderInfo.ancestors; // reset the breadcrumbs
- this._slideout.contentView.navigate(folderInfo);
- }
- }
- }
- },
- _hasInitialFolder: function(spec) {
- return spec && spec.options && spec.options.content && _.isObject(spec.options.content.initialFolder);
- },
- _isNotLegacyView: function(id) {
- return id && id.indexOf('LegacyCAMyContentView') === -1 && id.indexOf('LegacyCATeamFoldersView') === -1;
- }
- });
- return ContentSlideoutController;
- });
- define("js/content_apps/contentBundle", function(){});
|