From 6bf8bd14f43f978bbe41a4f60660bb322ab76519 Mon Sep 17 00:00:00 2001 From: Palak Bhati Date: Fri, 10 Jul 2026 18:24:43 +0530 Subject: [PATCH 1/2] Fix #267: display file sizes in GiB/MiB/KiB instead of GB/MB/KB Size formatting used binary (1024-based) division but labeled units as decimal (GB/MB/KB). Relabeled to correct binary unit names (KiB/MiB/GiB) in formatUploadSize, formatFileSize, the activity chart axis label, and a related comment. --- public/dist/main.js | 623 +++++++++--------- public/js/angular-application.js | 2 +- .../collection-data-table.js | 6 +- public/js/utils/databus-utils.js | 8 +- .../app/common/queries/query-modules/pages.js | 2 +- 5 files changed, 331 insertions(+), 310 deletions(-) diff --git a/public/dist/main.js b/public/dist/main.js index d866f88c..b77f1a63 100644 --- a/public/dist/main.js +++ b/public/dist/main.js @@ -9,749 +9,755 @@ /******/ (() => { // webpackBootstrap /******/ var __webpack_modules__ = ({ -/***/ "./js/angular-application.js": +/***/ "../server/app/common/utils/api-error.js" +/*!***********************************************!*\ + !*** ../server/app/common/utils/api-error.js ***! + \***********************************************/ +(module) { + +eval("{class ApiError extends Error {\r\n constructor(statusCode, resource, message, body) {\r\n super(message);\r\n this.name = \"ApiError\";\r\n this.statusCode = statusCode;\r\n this.resource = resource;\r\n this.body = body;\r\n }\r\n}\r\n\r\nmodule.exports = ApiError;\n\n//# sourceURL=webpack://databus-webapp/../server/app/common/utils/api-error.js?\n}"); + +/***/ }, + +/***/ "./js/angular-application.js" /*!***********************************!*\ !*** ./js/angular-application.js ***! \***********************************/ -/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { +(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { -eval("const AccountPageController = __webpack_require__(/*! ./page-controller/account-controller */ \"./js/page-controller/account-controller.js\");\nconst ArtifactPageController = __webpack_require__(/*! ./page-controller/artifact-controller */ \"./js/page-controller/artifact-controller.js\");\nconst FrontPageController = __webpack_require__(/*! ./page-controller/frontpage-controller */ \"./js/page-controller/frontpage-controller.js\");\nconst HeaderController = __webpack_require__(/*! ./page-controller/header-controller */ \"./js/page-controller/header-controller.js\");\nconst CollectionController = __webpack_require__(/*! ./page-controller/collection-controller */ \"./js/page-controller/collection-controller.js\");\nconst CollectionsEditorController = __webpack_require__(/*! ./page-controller/collections-editor-controller */ \"./js/page-controller/collections-editor-controller.js\");\nconst GroupPageController = __webpack_require__(/*! ./page-controller/group-controller */ \"./js/page-controller/group-controller.js\");\nconst ProfileController = __webpack_require__(/*! ./page-controller/profile-controller */ \"./js/page-controller/profile-controller.js\");\nconst PublishWizardController = __webpack_require__(/*! ./page-controller/publish-wizard-controller */ \"./js/page-controller/publish-wizard-controller.js\");\nconst VersionPageController = __webpack_require__(/*! ./page-controller/version-controller */ \"./js/page-controller/version-controller.js\");\nconst UserSettingsController = __webpack_require__(/*! ./page-controller/user-settings-controller */ \"./js/page-controller/user-settings-controller.js\");\nconst DatabusCollectionManager = __webpack_require__(/*! ./collections/databus-collection-manager */ \"./js/collections/databus-collection-manager.js\");\nconst SearchManager = __webpack_require__(/*! ./search/search-manager */ \"./js/search/search-manager.js\");\nconst SearchController = __webpack_require__(/*! ./components/search/search-controller */ \"./js/components/search/search-controller.js\");\nconst DatabusAlertController = __webpack_require__(/*! ./components/databus-alert/databus-alert-controller */ \"./js/components/databus-alert/databus-alert-controller.js\");\nconst EntityCardController = __webpack_require__(/*! ./components/entity-card/entity-card */ \"./js/components/entity-card/entity-card.js\");\nconst OverrideCheckboxController = __webpack_require__(/*! ./components/override-checkbox/override-checkbox */ \"./js/components/override-checkbox/override-checkbox.js\");\nconst AutofillDropdownController = __webpack_require__(/*! ./components/autofill-dropdown/autofill-dropdown */ \"./js/components/autofill-dropdown/autofill-dropdown.js\");\nconst DatabusIconController = __webpack_require__(/*! ./components/databus-icon/databus-icon */ \"./js/components/databus-icon/databus-icon.js\");\nconst TypeTagController = __webpack_require__(/*! ./components/type-tag/type-tag */ \"./js/components/type-tag/type-tag.js\");\nconst CollectionEditorWidgetController = __webpack_require__(/*! ./components/collection-editor-widget/collection-editor-widget */ \"./js/components/collection-editor-widget/collection-editor-widget.js\");\nconst CollectionHierarchyControllerTwo = __webpack_require__(/*! ./components/collection-hierarchy-two/collection-hierarchy */ \"./js/components/collection-hierarchy-two/collection-hierarchy.js\");\nconst UriBreadcrumbsController = __webpack_require__(/*! ./components/uri-breadcrumbs/uri-breadcrumbs */ \"./js/components/uri-breadcrumbs/uri-breadcrumbs.js\");\nconst TableEditorController = __webpack_require__(/*! ./components/table-editor/table-editor */ \"./js/components/table-editor/table-editor.js\");\nconst MultiselectDropdownController = __webpack_require__(/*! ./components/multiselect-dropdown/multiselect-dropdown */ \"./js/components/multiselect-dropdown/multiselect-dropdown.js\");\nconst FileBrowserController = __webpack_require__(/*! ./components/file-browser/file-browser */ \"./js/components/file-browser/file-browser.js\");\nconst FacetsViewController = __webpack_require__(/*! ./components/facets-view/facets-view */ \"./js/components/facets-view/facets-view.js\");\nconst ExpandableArrowController = __webpack_require__(/*! ./components/expandable-arrow/expandable-arrow */ \"./js/components/expandable-arrow/expandable-arrow.js\");\nconst YasqeTextController = __webpack_require__(/*! ./components/yasqe-text/yasqe-text */ \"./js/components/yasqe-text/yasqe-text.js\");\nconst YasrViewController = __webpack_require__(/*! ./components/yasr-view/yasr-view */ \"./js/components/yasr-view/yasr-view.js\");\nconst CollectionStatisticsController = __webpack_require__(/*! ./components/collection-statistics/collection-statistics */ \"./js/components/collection-statistics/collection-statistics.js\");\nconst CollectionNodeController = __webpack_require__(/*! ./components/collection-node/collection-node */ \"./js/components/collection-node/collection-node.js\");\nconst CollectionSearchController = __webpack_require__(/*! ./components/collection-search/collection-search */ \"./js/components/collection-search/collection-search.js\");\nconst CollectionStatusController = __webpack_require__(/*! ./components/collection-status/collection-status */ \"./js/components/collection-status/collection-status.js\");\nconst CollectionDataTableController = __webpack_require__(/*! ./components/collection-data-table/collection-data-table */ \"./js/components/collection-data-table/collection-data-table.js\");\nconst AccountHistoryController = __webpack_require__(/*! ./components/account-history/account-history */ \"./js/components/account-history/account-history.js\");\nconst SparqlEditorController = __webpack_require__(/*! ./page-controller/sparql-editor-controller */ \"./js/page-controller/sparql-editor-controller.js\");\nconst BetterDropdownController = __webpack_require__(/*! ./components/better-dropdown/better-dropdown */ \"./js/components/better-dropdown/better-dropdown.js\");\nconst NavSearchController = __webpack_require__(/*! ./components/nav-search/nav-search-controller */ \"./js/components/nav-search/nav-search-controller.js\");\nconst EntityDropdownController = __webpack_require__(/*! ./components/entity-dropdown/entity-dropdown */ \"./js/components/entity-dropdown/entity-dropdown.js\");\nconst EntityApiViewController = __webpack_require__(/*! ./components/entity-api-view/entity-api-view */ \"./js/components/entity-api-view/entity-api-view.js\");\nconst ErrorNotificationController = __webpack_require__(/*! ./components/error-notification/error-notifcation */ \"./js/components/error-notification/error-notifcation.js\");\n\nvar databusApplication = angular.module(\"databusApplication\", [])\n .controller(\"HeaderController\", [\"$scope\", \"$http\", \"collectionManager\", HeaderController])\n .factory('collectionManager', [ \"$interval\", \"$http\", function ($interval, $http) { return new DatabusCollectionManager($http, $interval, 'databus_collections'); }])\n .factory('searchManager', [ \"$interval\", \"$http\", function ($interval, $http) { return new SearchManager($http, $interval); }])\n .factory('focus', [\"$timeout\", \"$window\", function ($timeout, $window) {\n return function (id) {\n $timeout(function () {\n var element = $window.document.getElementById(id);\n if (element)\n element.focus();\n });\n };\n }])\n .controller(\"UserSettingsController\", [ \"$scope\", \"$http\", \"$sce\", \"$location\", UserSettingsController])\n .controller(\"HeaderController\", [\"$scope\", \"$http\", \"collectionManager\", \"searchManager\", HeaderController])\n .controller(\"AccountPageController\", [\"$scope\", \"$http\", \"$location\", \"collectionManager\", AccountPageController])\n .controller(\"FrontPageController\", [\"$scope\", \"$sce\", \"$http\", FrontPageController])\n .controller(\"ArtifactPageController\", [\"$scope\", \"$http\", \"$sce\", \"$location\", \"collectionManager\", ArtifactPageController])\n .controller(\"CollectionController\", [\"$scope\", \"$sce\", \"$http\", \"collectionManager\", CollectionController])\n .controller(\"CollectionsEditorController\", [\"$scope\", \"$timeout\", \"$http\", \"$location\", \"collectionManager\", CollectionsEditorController])\n .controller(\"GroupPageController\", [\"$scope\", \"$http\", \"$sce\", \"$interval\", \"$location\", \"collectionManager\", GroupPageController])\n .controller(\"ProfileController\", [\"$scope\", \"$http\", ProfileController])\n .controller(\"SparqlEditorController\", [\"$scope\", \"$http\", \"$location\", SparqlEditorController])\n .controller(\"PublishWizardController\", [\"$scope\", \"$http\", \"$interval\", \"focus\", \"$q\", \"$location\", PublishWizardController])\n .controller(\"VersionPageController\", [\"$scope\", \"$http\", \"$sce\", \"$location\", \"collectionManager\", VersionPageController])\n .directive('uploadRanking', function () {\n return {\n restrict: 'E',\n replace: true,\n templateUrl: '/website/templates/upload-ranking.html',\n scope: {\n data: '=data'\n }\n }\n });\n \nfunction config($locationProvider) {\n $locationProvider.html5Mode({\n enabled: true,\n requireBase: false,\n rewriteLinks: false\n });\n};\n\ndatabusApplication.filter('collectionfilter', function() {\n return function(input, search) {\n if (!input) return input;\n \n var expected = '';\n\n if (search != null) {\n expected = ('' + search).toLowerCase();\n }\n\n var result = [];\n\n angular.forEach(input, function(value, key) {\n if(value.title == undefined) {\n return;\n }\n \n if(value.title.toLowerCase().includes(expected)) {\n result.push(value); \n }\n });\n\n return result;\n }\n});\n\ndatabusApplication.config(['$locationProvider', config]);\n\n// Components\ndatabusApplication.component('overrideCheckbox', {\n templateUrl: '/js/components/override-checkbox/override-checkbox.html',\n controller: OverrideCheckboxController,\n bindings: {\n checkValue: '<',\n label: '<',\n id: '<',\n readonly: '<',\n isOverride: '<',\n onChange: '&'\n }\n});\n\ndatabusApplication.component('errorTag', {\n controller: ErrorNotificationController,\n templateUrl: '/js/components/error-notification/error-notification.html',\n bindings: {\n entity: '<',\n key: '@',\n texts: '<'\n }\n});\n\ndatabusApplication.component('entityDropdown', {\n bindings: {\n placeholder: '@',\n items: '<',\n displayProperty: '@',\n loading: '<',\n selected: '<',\n onSelect: '&'\n },\n controller: EntityDropdownController,\n templateUrl: '/js/components/entity-dropdown/entity-dropdown.html'\n});\n\ndatabusApplication.component('entityApiView', {\n bindings: {\n entity: '<',\n apiKeys: '<',\n texts: '<',\n publishLog: '<'\n },\n controller: EntityApiViewController,\n templateUrl: '/js/components/entity-api-view/entity-api-view.html'\n });\n\n\n\ndatabusApplication.component('accountHistory', {\n templateUrl: '/js/components/account-history/account-history.html',\n controller: [ '$http', AccountHistoryController ],\n bindings: {\n accountName: '<'\n }\n});\n\n// Components\ndatabusApplication.component('databusAlert', {\n templateUrl: '/js/components/databus-alert/databus-alert.html',\n controller: [ '$scope', '$timeout', DatabusAlertController ],\n});\n\ndatabusApplication.component('entityCard', {\n templateUrl: '/js/components/entity-card/entity-card.html',\n controller: ['$sce', EntityCardController ],\n bindings: {\n label: '<',\n uri: '<',\n desc: '<',\n date: '<',\n type: '<',\n imageUrl: '<',\n absolute: '<'\n }\n});\n\ndatabusApplication.component('search', {\n templateUrl: '/js/components/search/search.html',\n controller: ['$http', '$interval', '$sce', 'searchManager', SearchController],\n bindings: {\n searchInput: '=',\n settings: '<',\n }\n});\n\n\ndatabusApplication.component('navSearch', {\n templateUrl: '/js/components/nav-search/nav-search.html',\n controller: ['$http', '$interval', '$sce', 'searchManager', NavSearchController],\n bindings: {\n searchInput: '=',\n settings: '<',\n }\n});\n\n/*\ndatabusApplication.component('databusSearch', {\n templateUrl: '/js/components/databus-search/databus-search.html',\n controller: ['$http', '$interval', '$sce', DatabusSearchController],\n bindings: {\n filters: '=',\n input: '='\n }\n});*/\n\ndatabusApplication.component('autofillDropdown', {\n templateUrl: '/js/components/autofill-dropdown/autofill-dropdown.html',\n controller: ['$timeout', AutofillDropdownController ],\n bindings: {\n input: '=',\n values: '<',\n isDisabled: '<',\n placeholder: '@',\n onChange: '&'\n }\n});\n\n\ndatabusApplication.component('databusIcon', {\n templateUrl: '/js/components/databus-icon/databus-icon.html',\n controller: DatabusIconController,\n bindings: {\n size: '<',\n shape: '<',\n onClick: '&',\n isClickable: '<',\n color: '<'\n }\n});\n\ndatabusApplication.component('typeTag', {\n templateUrl: '/js/components/type-tag/type-tag.html',\n controller: TypeTagController,\n bindings: {\n type: '<',\n height: '<',\n width: '<',\n }\n});\n\n/*\n\ndatabusApplication.component('collectionEditor', {\n templateUrl: '/js/components/collection-editor/collection-editor.html',\n controller: ['$http', '$location', '$sce', CollectionEditorController],\n bindings: {\n collection: '=',\n readonly: '<',\n onPublish: '&',\n onDelete: '&',\n loggedIn: '<'\n }\n});*/\n\ndatabusApplication.component('collectionEditorWidget', {\n templateUrl: '/js/components/collection-editor-widget/collection-editor-widget.html',\n controller: ['collectionManager', '$scope', CollectionEditorWidgetController ],\n bindings: {\n selection: '<',\n collection: '=',\n }\n});\n\n/*\ndatabusApplication.component('collectionHierarchy', {\n templateUrl: '/js/components/collection-hierarchy/collection-hierarchy.html',\n controller: ['$http', '$location', '$sce', CollectionHierarchyController],\n bindings: {\n collection: '=',\n readonly: '<',\n onPublish: '&',\n onDelete: '&',\n loggedIn: '<',\n onChange: '&'\n }\n});*/\n\ndatabusApplication.component('collectionHierarchyTwo', {\n templateUrl: '/js/components/collection-hierarchy-two/collection-hierarchy.html',\n controller: ['$http', '$location', '$sce', '$scope', 'collectionManager', CollectionHierarchyControllerTwo ],\n bindings: {\n collection: '=',\n onChange: '&',\n onAddContent: '&'\n }\n});\n\ndatabusApplication.component('collectionNode', {\n templateUrl: '/js/components/collection-node/collection-node.html',\n controller: CollectionNodeController,\n bindings: {\n node: '<',\n readonly: '<',\n onRemoveNode: '&',\n onClick: '&',\n count: '<',\n isExpandable: '<'\n }\n});\n\ndatabusApplication.component('collectionSearch', {\n templateUrl: '/js/components/collection-search/collection-search.html',\n controller: ['collectionManager', '$http', '$interval', '$sce', CollectionSearchController ],\n bindings: {\n collection: '=',\n targetDatabusUrl: '<',\n onComponentAdded: '&'\n }\n});\n\ndatabusApplication.component('collectionStatistics', {\n templateUrl: '/js/components/collection-statistics/collection-statistics.html',\n controller: ['$http', '$scope', '$location', '$sce', CollectionStatisticsController ],\n bindings: {\n collection: '<'\n }\n});\n\ndatabusApplication.component('collectionStatus', {\n templateUrl: '/js/components/collection-status/collection-status.html',\n controller: ['$http', '$location', '$sce', CollectionStatusController ],\n bindings: {\n hasLocalChanges: '<',\n isPublished: '<',\n isDraft: '<',\n }\n});\n\n/*\n\ndatabusApplication.component('editLabel', {\n templateUrl: '/js/components/edit-label/edit-label.html',\n controller: ['$element', EditLabelController],\n bindings: {\n text: '=',\n singleLine: '<',\n onBlur: '&',\n onChange: '&'\n }\n});*/\n\ndatabusApplication.component('expandableArrow', {\n templateUrl: '/js/components/expandable-arrow/expandable-arrow.html',\n controller: ExpandableArrowController,\n bindings: {\n expanded: '=',\n onChange: '&',\n isReadonly: '<'\n }\n});\n\ndatabusApplication.component('facetsView', {\n templateUrl: '/js/components/facets-view/facets-view.html',\n controller: ['$http', '$scope', FacetsViewController ],\n bindings: {\n node: '=',\n readonly: '<',\n resourceType: '@',\n onChange: '&',\n onLoaded: '&'\n }\n});\n\ndatabusApplication.component('facetsViewHorizontal', {\n templateUrl: '/js/components/facets-view/facets-view-horizontal.html',\n controller: ['$http', '$scope', FacetsViewController ],\n bindings: {\n node: '=',\n readonly: '<',\n resourceType: '@',\n onChange: '&',\n onLoaded: '&'\n }\n});\n\ndatabusApplication.component('fileBrowser', {\n templateUrl: '/js/components/file-browser/file-browser.html',\n controller: ['$http', '$scope', FileBrowserController ],\n bindings: {\n resourceUri: '<',\n resourceType: '@',\n node: '<',\n facetSettings: '<',\n parentFacetSettings: '<',\n query: '<',\n fullQuery: '<',\n config: '<'\n }\n});\n\n/*\n\ndatabusApplication.component('multiselectArtifactDropdown', {\n templateUrl: '/js/components/multiselect-artifact-dropdown/multiselect-artifact-dropdown.html',\n controller: ['$timeout', '$sce', MultiselectArtifactDropdownController],\n bindings: {\n data: '<',\n node: '<',\n values: '<',\n isDisabled: '<',\n icon: '<',\n onChange: '&'\n }\n});*/\n\ndatabusApplication.component('multiselectDropdown', {\n templateUrl: '/js/components/multiselect-dropdown/multiselect-dropdown.html',\n controller: ['$timeout', '$sce', MultiselectDropdownController],\n bindings: {\n parentInput: '<',\n input: '=',\n values: '<',\n isDisabled: '<',\n placeholder: '@',\n onChange: '&'\n }\n});\n\ndatabusApplication.component('tableEditor', {\n templateUrl: '/js/components/table-editor/table-editor.html',\n controller: TableEditorController,\n bindings: {\n model: '=',\n onRemoveFile: '&',\n onEditContentVariant: '&',\n onAnalyzeFile: '&',\n analysisProcesses: '<'\n }\n});\n\ndatabusApplication.component('uriBreadcrumbs', {\n templateUrl: '/js/components/uri-breadcrumbs/uri-breadcrumbs.html',\n controller: UriBreadcrumbsController,\n bindings: {\n uri: '<',\n absolute: '<'\n }\n});\n\n\ndatabusApplication.component('yasqeText', {\n templateUrl: '/js/components/yasqe-text/yasqe-text.html',\n controller: ['$scope', '$element', YasqeTextController ],\n bindings: {\n query: '=',\n autoSize: '<',\n readOnly: '<',\n onChange: '&',\n onSend: '&',\n hasSend: '<'\n }\n});\n\ndatabusApplication.component('betterDropdown', {\n templateUrl: '/js/components/better-dropdown/better-dropdown.html',\n controller: ['$scope', '$interval', '$element', BetterDropdownController ],\n bindings: {\n rootNode: '=',\n onNodeClicked: '&',\n icon: '<',\n label: '<'\n }\n});\n\n\ndatabusApplication.component('yasrView', {\n templateUrl: '/js/components/yasr-view/yasr-view.html',\n controller: ['$scope', '$element', YasrViewController ],\n bindings: {\n data: '=',\n autoSize: '<',\n readOnly: '<',\n onChange: '&'\n }\n});\n\ndatabusApplication.component('collectionDataTable', {\n templateUrl: '/js/components/collection-data-table/collection-data-table.html',\n controller: ['$http', '$scope', '$location', '$sce', CollectionDataTableController],\n bindings: {\n collection: '<'\n }\n});\n\n\ndatabusApplication.directive('selectOnClick', ['$window', function ($window) {\n return {\n restrict: 'A',\n link: function (scope, element, attrs) {\n element.on('click', function () {\n if (!$window.getSelection().toString() && this.readonly == false) {\n // Required for mobile Safari\n this.setSelectionRange(0, this.value.length)\n }\n });\n }\n };\n}]);\n\ndatabusApplication.directive('focusMe', ['$timeout', '$parse', function ($timeout, $parse) {\n return {\n //scope: true, // optionally create a child scope\n link: function (scope, element, attrs) {\n var model = $parse(attrs.focusMe);\n scope.$watch(model, function (value) {\n if (value === true) {\n $timeout(function () {\n element[0].focus();\n });\n }\n });\n }\n };\n}]);\n\ndatabusApplication.directive('eventFocus', function (focus) {\n return function (scope, elem, attr) {\n elem.on(attr.eventFocus, function () {\n focus(attr.eventFocusId);\n });\n\n // Removes bound events in the element itself\n // when the scope is destroyed\n scope.$on('$destroy', function () {\n elem.off(attr.eventFocus);\n });\n };\n});\n\n\n\ndatabusApplication.directive('uploaderRanking', function () {\n return {\n restrict: 'E',\n replace: true,\n template: '
UserUploadsDerived Data
{{ row.account }}{{ row.numUploads }}{{ row.uploadSize }}
',\n scope: {\n data: '=data',\n }\n }\n});\n\n\ndatabusApplication.directive('groupsTable', function () {\n return {\n restrict: 'E',\n replace: true,\n template: '
Group Id# Artifacts
{{ row.label }}{{ row.artifactCount }}
',\n scope: {\n data: '=data',\n }\n }\n});\n\n\ndatabusApplication.directive('activityChart', function () {\n return {\n restrict: 'E',\n replace: true,\n template: '',\n scope: {\n data: '=data',\n height: '=height'\n },\n link: function (scope, element, attrs) {\n\n var svgHeight = scope.height;\n\n for (d in scope.data) {\n scope.data[d].date = new Date(scope.data[d].date);\n }\n\n var svg = d3.select(element[0])\n .attr(\"id\", \"graph\")\n .attr(\"width\", \"107%\")\n .attr(\"height\", svgHeight);\n\n var bounds = svg.node().getBoundingClientRect();\n var svgWidth = bounds.width;\n\n var margin = { top: 20, right: 50, bottom: 60, left: 50 };\n var width = svgWidth - margin.left - margin.right;\n var height = svgHeight - margin.top - margin.bottom;\n\n var g = svg.append(\"g\")\n .attr(\"transform\",\n \"translate(\" + margin.left + \",\" + margin.top + \")\"\n );\n\n var x = d3.scaleTime().rangeRound([0, width]);\n var y = d3.scaleLinear().rangeRound([height, 0]);\n\n var line = d3.line()\n .x(function (d) { return x(d.date) })\n .y(function (d) { return y(d.value) })\n\n x.domain(d3.extent(scope.data, function (d) { return d.date }));\n y.domain(d3.extent(scope.data, function (d) { return d.value }));\n\n g.append(\"g\")\n .attr(\"transform\", \"translate(0,\" + height + \")\")\n .call(d3.axisBottom(x))\n .selectAll(\"text\")\n .attr(\"y\", 0)\n .attr(\"x\", 9)\n .attr(\"dy\", \".35em\")\n .attr(\"transform\", \"rotate(90)\")\n .style(\"text-anchor\", \"start\");\n\n g.append(\"g\")\n .call(d3.axisLeft(y))\n .append(\"text\")\n .attr(\"fill\", \"#000\")\n .attr(\"transform\", \"rotate(-90)\")\n .attr(\"y\", 6)\n .attr(\"dy\", \"1em\")\n .attr(\"font-size\", \"1.1em\")\n .attr(\"text-anchor\", \"end\")\n .text(\"Uploaded Data (GByte)\");\n\n var path = g.append(\"path\")\n .datum(scope.data)\n .attr(\"fill\", \"none\")\n .attr(\"stroke\", \"steelblue\")\n .attr(\"stroke-linejoin\", \"round\")\n .attr(\"stroke-linecap\", \"round\")\n .attr(\"stroke-width\", 2)\n .attr(\"d\", line);\n }\n }\n});\n\ndatabusApplication.directive('onFinishRender', ['$timeout', '$parse', function ($timeout, $parse) {\n return {\n restrict: 'A',\n link: function (scope, element, attr) {\n if (scope.$last === true) {\n $timeout(function () {\n scope.$emit('ngRepeatFinished');\n if (!!attr.onFinishRender) {\n $parse(attr.onFinishRender)(scope);\n }\n });\n }\n }\n }\n}]);\n\ndatabusApplication.directive('clickOutside', [\n '$document', '$parse', '$timeout',\n clickOutside\n]);\n\n/**\n * @ngdoc directive\n * @name angular-click-outside.directive:clickOutside\n * @description Directive to add click outside capabilities to DOM elements\n * @requires $document\n * @requires $parse\n * @requires $timeout\n **/\n function clickOutside($document, $parse, $timeout) {\n return {\n restrict: 'A',\n link: function($scope, elem, attr) {\n\n // postpone linking to next digest to allow for unique id generation\n $timeout(function() {\n var classList = (attr.outsideIfNot !== undefined) ? attr.outsideIfNot.split(/[ ,]+/) : [],\n fn;\n\n function eventHandler(e) {\n var i,\n element,\n r,\n id,\n classNames,\n l;\n\n // check if our element already hidden and abort if so\n if (angular.element(elem).hasClass(\"ng-hide\")) {\n return;\n }\n\n // if there is no click target, no point going on\n if (!e || !e.target) {\n return;\n }\n\n // loop through the available elements, looking for classes in the class list that might match and so will eat\n for (element = e.target; element; element = element.parentNode) {\n // check if the element is the same element the directive is attached to and exit if so (props @CosticaPuntaru)\n if (element === elem[0]) {\n return;\n }\n \n // now we have done the initial checks, start gathering id's and classes\n id = element.id,\n classNames = element.className,\n l = classList.length;\n\n // Unwrap SVGAnimatedString classes\n if (classNames && classNames.baseVal !== undefined) {\n classNames = classNames.baseVal;\n }\n\n // if there are no class names on the element clicked, skip the check\n if (classNames || id) {\n\n // loop through the elements id's and classnames looking for exceptions\n for (i = 0; i < l; i++) {\n //prepare regex for class word matching\n r = new RegExp('\\\\b' + classList[i] + '\\\\b');\n\n // check for exact matches on id's or classes, but only if they exist in the first place\n if ((id !== undefined && id === classList[i]) || (classNames && r.test(classNames))) {\n // now let's exit out as it is an element that has been defined as being ignored for clicking outside\n return;\n }\n }\n }\n }\n\n // if we have got this far, then we are good to go with processing the command passed in via the click-outside attribute\n $timeout(function() {\n fn = $parse(attr['clickOutside']);\n fn($scope, { event: e });\n });\n }\n\n // if the devices has a touchscreen, listen for this event\n if (_hasTouch()) {\n $document.on('touchstart', eventHandler);\n }\n\n // still listen for the click event even if there is touch to cater for touchscreen laptops\n $document.on('click', eventHandler);\n\n // when the scope is destroyed, clean up the documents event handlers as we don't want it hanging around\n $scope.$on('$destroy', function() {\n if (_hasTouch()) {\n $document.off('touchstart', eventHandler);\n }\n\n $document.off('click', eventHandler);\n });\n\n /**\n * @description Private function to attempt to figure out if we are on a touch device\n * @private\n **/\n function _hasTouch() {\n // works on most browsers, IE10/11 and Surface\n return 'ontouchstart' in window || navigator.maxTouchPoints;\n };\n });\n }\n };\n}\n\n\n//# sourceURL=webpack://databus-webapp/./js/angular-application.js?"); +eval("{const AccountPageController = __webpack_require__(/*! ./page-controller/account-controller */ \"./js/page-controller/account-controller.js\");\nconst ArtifactPageController = __webpack_require__(/*! ./page-controller/artifact-controller */ \"./js/page-controller/artifact-controller.js\");\nconst FrontPageController = __webpack_require__(/*! ./page-controller/frontpage-controller */ \"./js/page-controller/frontpage-controller.js\");\nconst HeaderController = __webpack_require__(/*! ./page-controller/header-controller */ \"./js/page-controller/header-controller.js\");\nconst CollectionController = __webpack_require__(/*! ./page-controller/collection-controller */ \"./js/page-controller/collection-controller.js\");\nconst CollectionsEditorController = __webpack_require__(/*! ./page-controller/collections-editor-controller */ \"./js/page-controller/collections-editor-controller.js\");\nconst GroupPageController = __webpack_require__(/*! ./page-controller/group-controller */ \"./js/page-controller/group-controller.js\");\nconst ProfileController = __webpack_require__(/*! ./page-controller/profile-controller */ \"./js/page-controller/profile-controller.js\");\nconst PublishWizardController = __webpack_require__(/*! ./page-controller/publish-wizard-controller */ \"./js/page-controller/publish-wizard-controller.js\");\nconst VersionPageController = __webpack_require__(/*! ./page-controller/version-controller */ \"./js/page-controller/version-controller.js\");\nconst UserSettingsController = __webpack_require__(/*! ./page-controller/user-settings-controller */ \"./js/page-controller/user-settings-controller.js\");\nconst DatabusCollectionManager = __webpack_require__(/*! ./collections/databus-collection-manager */ \"./js/collections/databus-collection-manager.js\");\nconst SearchManager = __webpack_require__(/*! ./search/search-manager */ \"./js/search/search-manager.js\");\nconst SearchController = __webpack_require__(/*! ./components/search/search-controller */ \"./js/components/search/search-controller.js\");\nconst DatabusAlertController = __webpack_require__(/*! ./components/databus-alert/databus-alert-controller */ \"./js/components/databus-alert/databus-alert-controller.js\");\nconst EntityCardController = __webpack_require__(/*! ./components/entity-card/entity-card */ \"./js/components/entity-card/entity-card.js\");\nconst OverrideCheckboxController = __webpack_require__(/*! ./components/override-checkbox/override-checkbox */ \"./js/components/override-checkbox/override-checkbox.js\");\nconst AutofillDropdownController = __webpack_require__(/*! ./components/autofill-dropdown/autofill-dropdown */ \"./js/components/autofill-dropdown/autofill-dropdown.js\");\nconst DatabusIconController = __webpack_require__(/*! ./components/databus-icon/databus-icon */ \"./js/components/databus-icon/databus-icon.js\");\nconst TypeTagController = __webpack_require__(/*! ./components/type-tag/type-tag */ \"./js/components/type-tag/type-tag.js\");\nconst CollectionEditorWidgetController = __webpack_require__(/*! ./components/collection-editor-widget/collection-editor-widget */ \"./js/components/collection-editor-widget/collection-editor-widget.js\");\nconst CollectionHierarchyControllerTwo = __webpack_require__(/*! ./components/collection-hierarchy-two/collection-hierarchy */ \"./js/components/collection-hierarchy-two/collection-hierarchy.js\");\nconst UriBreadcrumbsController = __webpack_require__(/*! ./components/uri-breadcrumbs/uri-breadcrumbs */ \"./js/components/uri-breadcrumbs/uri-breadcrumbs.js\");\nconst TableEditorController = __webpack_require__(/*! ./components/table-editor/table-editor */ \"./js/components/table-editor/table-editor.js\");\nconst MultiselectDropdownController = __webpack_require__(/*! ./components/multiselect-dropdown/multiselect-dropdown */ \"./js/components/multiselect-dropdown/multiselect-dropdown.js\");\nconst FileBrowserController = __webpack_require__(/*! ./components/file-browser/file-browser */ \"./js/components/file-browser/file-browser.js\");\nconst FacetsViewController = __webpack_require__(/*! ./components/facets-view/facets-view */ \"./js/components/facets-view/facets-view.js\");\nconst ExpandableArrowController = __webpack_require__(/*! ./components/expandable-arrow/expandable-arrow */ \"./js/components/expandable-arrow/expandable-arrow.js\");\nconst YasqeTextController = __webpack_require__(/*! ./components/yasqe-text/yasqe-text */ \"./js/components/yasqe-text/yasqe-text.js\");\nconst YasrViewController = __webpack_require__(/*! ./components/yasr-view/yasr-view */ \"./js/components/yasr-view/yasr-view.js\");\nconst CollectionStatisticsController = __webpack_require__(/*! ./components/collection-statistics/collection-statistics */ \"./js/components/collection-statistics/collection-statistics.js\");\nconst CollectionNodeController = __webpack_require__(/*! ./components/collection-node/collection-node */ \"./js/components/collection-node/collection-node.js\");\nconst CollectionSearchController = __webpack_require__(/*! ./components/collection-search/collection-search */ \"./js/components/collection-search/collection-search.js\");\nconst CollectionStatusController = __webpack_require__(/*! ./components/collection-status/collection-status */ \"./js/components/collection-status/collection-status.js\");\nconst CollectionDataTableController = __webpack_require__(/*! ./components/collection-data-table/collection-data-table */ \"./js/components/collection-data-table/collection-data-table.js\");\nconst AccountHistoryController = __webpack_require__(/*! ./components/account-history/account-history */ \"./js/components/account-history/account-history.js\");\nconst SparqlEditorController = __webpack_require__(/*! ./page-controller/sparql-editor-controller */ \"./js/page-controller/sparql-editor-controller.js\");\nconst BetterDropdownController = __webpack_require__(/*! ./components/better-dropdown/better-dropdown */ \"./js/components/better-dropdown/better-dropdown.js\");\nconst NavSearchController = __webpack_require__(/*! ./components/nav-search/nav-search-controller */ \"./js/components/nav-search/nav-search-controller.js\");\nconst EntityDropdownController = __webpack_require__(/*! ./components/entity-dropdown/entity-dropdown */ \"./js/components/entity-dropdown/entity-dropdown.js\");\nconst EntityApiViewController = __webpack_require__(/*! ./components/entity-api-view/entity-api-view */ \"./js/components/entity-api-view/entity-api-view.js\");\nconst ErrorNotificationController = __webpack_require__(/*! ./components/error-notification/error-notifcation */ \"./js/components/error-notification/error-notifcation.js\");\n\nvar databusApplication = angular.module(\"databusApplication\", [])\n .controller(\"HeaderController\", [\"$scope\", \"$http\", \"collectionManager\", HeaderController])\n .factory('collectionManager', [ \"$interval\", \"$http\", function ($interval, $http) { return new DatabusCollectionManager($http, $interval, 'databus_collections'); }])\n .factory('searchManager', [ \"$interval\", \"$http\", function ($interval, $http) { return new SearchManager($http, $interval); }])\n .factory('focus', [\"$timeout\", \"$window\", function ($timeout, $window) {\n return function (id) {\n $timeout(function () {\n var element = $window.document.getElementById(id);\n if (element)\n element.focus();\n });\n };\n }])\n .controller(\"UserSettingsController\", [ \"$scope\", \"$http\", \"$sce\", \"$location\", UserSettingsController])\n .controller(\"HeaderController\", [\"$scope\", \"$http\", \"collectionManager\", \"searchManager\", HeaderController])\n .controller(\"AccountPageController\", [\"$scope\", \"$http\", \"$location\", \"collectionManager\", AccountPageController])\n .controller(\"FrontPageController\", [\"$scope\", \"$sce\", \"$http\", FrontPageController])\n .controller(\"ArtifactPageController\", [\"$scope\", \"$http\", \"$sce\", \"$location\", \"collectionManager\", ArtifactPageController])\n .controller(\"CollectionController\", [\"$scope\", \"$sce\", \"$http\", \"collectionManager\", CollectionController])\n .controller(\"CollectionsEditorController\", [\"$scope\", \"$timeout\", \"$http\", \"$location\", \"collectionManager\", CollectionsEditorController])\n .controller(\"GroupPageController\", [\"$scope\", \"$http\", \"$sce\", \"$interval\", \"$location\", \"collectionManager\", GroupPageController])\n .controller(\"ProfileController\", [\"$scope\", \"$http\", ProfileController])\n .controller(\"SparqlEditorController\", [\"$scope\", \"$http\", \"$location\", SparqlEditorController])\n .controller(\"PublishWizardController\", [\"$scope\", \"$http\", \"$interval\", \"focus\", \"$q\", \"$location\", PublishWizardController])\n .controller(\"VersionPageController\", [\"$scope\", \"$http\", \"$sce\", \"$location\", \"collectionManager\", VersionPageController])\n .directive('uploadRanking', function () {\n return {\n restrict: 'E',\n replace: true,\n templateUrl: '/website/templates/upload-ranking.html',\n scope: {\n data: '=data'\n }\n }\n });\n \nfunction config($locationProvider) {\n $locationProvider.html5Mode({\n enabled: true,\n requireBase: false,\n rewriteLinks: false\n });\n};\n\ndatabusApplication.filter('collectionfilter', function() {\n return function(input, search) {\n if (!input) return input;\n \n var expected = '';\n\n if (search != null) {\n expected = ('' + search).toLowerCase();\n }\n\n var result = [];\n\n angular.forEach(input, function(value, key) {\n if(value.title == undefined) {\n return;\n }\n \n if(value.title.toLowerCase().includes(expected)) {\n result.push(value); \n }\n });\n\n return result;\n }\n});\n\ndatabusApplication.config(['$locationProvider', config]);\n\n// Components\ndatabusApplication.component('overrideCheckbox', {\n templateUrl: '/js/components/override-checkbox/override-checkbox.html',\n controller: OverrideCheckboxController,\n bindings: {\n checkValue: '<',\n label: '<',\n id: '<',\n readonly: '<',\n isOverride: '<',\n onChange: '&'\n }\n});\n\ndatabusApplication.component('errorTag', {\n controller: ErrorNotificationController,\n templateUrl: '/js/components/error-notification/error-notification.html',\n bindings: {\n entity: '<',\n key: '@',\n texts: '<'\n }\n});\n\ndatabusApplication.component('entityDropdown', {\n bindings: {\n placeholder: '@',\n items: '<',\n displayProperty: '@',\n loading: '<',\n selected: '<',\n onSelect: '&'\n },\n controller: EntityDropdownController,\n templateUrl: '/js/components/entity-dropdown/entity-dropdown.html'\n});\n\ndatabusApplication.component('entityApiView', {\n bindings: {\n entity: '<',\n apiKeys: '<',\n texts: '<',\n publishLog: '<'\n },\n controller: EntityApiViewController,\n templateUrl: '/js/components/entity-api-view/entity-api-view.html'\n });\n\n\n\ndatabusApplication.component('accountHistory', {\n templateUrl: '/js/components/account-history/account-history.html',\n controller: [ '$http', AccountHistoryController ],\n bindings: {\n accountName: '<'\n }\n});\n\n// Components\ndatabusApplication.component('databusAlert', {\n templateUrl: '/js/components/databus-alert/databus-alert.html',\n controller: [ '$scope', '$timeout', DatabusAlertController ],\n});\n\ndatabusApplication.component('entityCard', {\n templateUrl: '/js/components/entity-card/entity-card.html',\n controller: ['$sce', EntityCardController ],\n bindings: {\n label: '<',\n uri: '<',\n desc: '<',\n date: '<',\n type: '<',\n imageUrl: '<',\n absolute: '<'\n }\n});\n\ndatabusApplication.component('search', {\n templateUrl: '/js/components/search/search.html',\n controller: ['$http', '$interval', '$sce', 'searchManager', SearchController],\n bindings: {\n searchInput: '=',\n settings: '<',\n }\n});\n\n\ndatabusApplication.component('navSearch', {\n templateUrl: '/js/components/nav-search/nav-search.html',\n controller: ['$http', '$interval', '$sce', 'searchManager', NavSearchController],\n bindings: {\n searchInput: '=',\n settings: '<',\n }\n});\n\n/*\ndatabusApplication.component('databusSearch', {\n templateUrl: '/js/components/databus-search/databus-search.html',\n controller: ['$http', '$interval', '$sce', DatabusSearchController],\n bindings: {\n filters: '=',\n input: '='\n }\n});*/\n\ndatabusApplication.component('autofillDropdown', {\n templateUrl: '/js/components/autofill-dropdown/autofill-dropdown.html',\n controller: ['$timeout', AutofillDropdownController ],\n bindings: {\n input: '=',\n values: '<',\n isDisabled: '<',\n placeholder: '@',\n onChange: '&'\n }\n});\n\n\ndatabusApplication.component('databusIcon', {\n templateUrl: '/js/components/databus-icon/databus-icon.html',\n controller: DatabusIconController,\n bindings: {\n size: '<',\n shape: '<',\n onClick: '&',\n isClickable: '<',\n color: '<'\n }\n});\n\ndatabusApplication.component('typeTag', {\n templateUrl: '/js/components/type-tag/type-tag.html',\n controller: TypeTagController,\n bindings: {\n type: '<',\n height: '<',\n width: '<',\n }\n});\n\n/*\n\ndatabusApplication.component('collectionEditor', {\n templateUrl: '/js/components/collection-editor/collection-editor.html',\n controller: ['$http', '$location', '$sce', CollectionEditorController],\n bindings: {\n collection: '=',\n readonly: '<',\n onPublish: '&',\n onDelete: '&',\n loggedIn: '<'\n }\n});*/\n\ndatabusApplication.component('collectionEditorWidget', {\n templateUrl: '/js/components/collection-editor-widget/collection-editor-widget.html',\n controller: ['collectionManager', '$scope', CollectionEditorWidgetController ],\n bindings: {\n selection: '<',\n collection: '=',\n }\n});\n\n/*\ndatabusApplication.component('collectionHierarchy', {\n templateUrl: '/js/components/collection-hierarchy/collection-hierarchy.html',\n controller: ['$http', '$location', '$sce', CollectionHierarchyController],\n bindings: {\n collection: '=',\n readonly: '<',\n onPublish: '&',\n onDelete: '&',\n loggedIn: '<',\n onChange: '&'\n }\n});*/\n\ndatabusApplication.component('collectionHierarchyTwo', {\n templateUrl: '/js/components/collection-hierarchy-two/collection-hierarchy.html',\n controller: ['$http', '$location', '$sce', '$scope', 'collectionManager', CollectionHierarchyControllerTwo ],\n bindings: {\n collection: '=',\n onChange: '&',\n onAddContent: '&'\n }\n});\n\ndatabusApplication.component('collectionNode', {\n templateUrl: '/js/components/collection-node/collection-node.html',\n controller: CollectionNodeController,\n bindings: {\n node: '<',\n readonly: '<',\n onRemoveNode: '&',\n onClick: '&',\n count: '<',\n isExpandable: '<'\n }\n});\n\ndatabusApplication.component('collectionSearch', {\n templateUrl: '/js/components/collection-search/collection-search.html',\n controller: ['collectionManager', '$http', '$interval', '$sce', CollectionSearchController ],\n bindings: {\n collection: '=',\n targetDatabusUrl: '<',\n onComponentAdded: '&'\n }\n});\n\ndatabusApplication.component('collectionStatistics', {\n templateUrl: '/js/components/collection-statistics/collection-statistics.html',\n controller: ['$http', '$scope', '$location', '$sce', CollectionStatisticsController ],\n bindings: {\n collection: '<'\n }\n});\n\ndatabusApplication.component('collectionStatus', {\n templateUrl: '/js/components/collection-status/collection-status.html',\n controller: ['$http', '$location', '$sce', CollectionStatusController ],\n bindings: {\n hasLocalChanges: '<',\n isPublished: '<',\n isDraft: '<',\n }\n});\n\n/*\n\ndatabusApplication.component('editLabel', {\n templateUrl: '/js/components/edit-label/edit-label.html',\n controller: ['$element', EditLabelController],\n bindings: {\n text: '=',\n singleLine: '<',\n onBlur: '&',\n onChange: '&'\n }\n});*/\n\ndatabusApplication.component('expandableArrow', {\n templateUrl: '/js/components/expandable-arrow/expandable-arrow.html',\n controller: ExpandableArrowController,\n bindings: {\n expanded: '=',\n onChange: '&',\n isReadonly: '<'\n }\n});\n\ndatabusApplication.component('facetsView', {\n templateUrl: '/js/components/facets-view/facets-view.html',\n controller: ['$http', '$scope', FacetsViewController ],\n bindings: {\n node: '=',\n readonly: '<',\n resourceType: '@',\n onChange: '&',\n onLoaded: '&'\n }\n});\n\ndatabusApplication.component('facetsViewHorizontal', {\n templateUrl: '/js/components/facets-view/facets-view-horizontal.html',\n controller: ['$http', '$scope', FacetsViewController ],\n bindings: {\n node: '=',\n readonly: '<',\n resourceType: '@',\n onChange: '&',\n onLoaded: '&'\n }\n});\n\ndatabusApplication.component('fileBrowser', {\n templateUrl: '/js/components/file-browser/file-browser.html',\n controller: ['$http', '$scope', FileBrowserController ],\n bindings: {\n resourceUri: '<',\n resourceType: '@',\n node: '<',\n facetSettings: '<',\n parentFacetSettings: '<',\n query: '<',\n fullQuery: '<',\n config: '<'\n }\n});\n\n/*\n\ndatabusApplication.component('multiselectArtifactDropdown', {\n templateUrl: '/js/components/multiselect-artifact-dropdown/multiselect-artifact-dropdown.html',\n controller: ['$timeout', '$sce', MultiselectArtifactDropdownController],\n bindings: {\n data: '<',\n node: '<',\n values: '<',\n isDisabled: '<',\n icon: '<',\n onChange: '&'\n }\n});*/\n\ndatabusApplication.component('multiselectDropdown', {\n templateUrl: '/js/components/multiselect-dropdown/multiselect-dropdown.html',\n controller: ['$timeout', '$sce', MultiselectDropdownController],\n bindings: {\n parentInput: '<',\n input: '=',\n values: '<',\n isDisabled: '<',\n placeholder: '@',\n onChange: '&'\n }\n});\n\ndatabusApplication.component('tableEditor', {\n templateUrl: '/js/components/table-editor/table-editor.html',\n controller: TableEditorController,\n bindings: {\n model: '=',\n onRemoveFile: '&',\n onEditContentVariant: '&',\n onAnalyzeFile: '&',\n analysisProcesses: '<'\n }\n});\n\ndatabusApplication.component('uriBreadcrumbs', {\n templateUrl: '/js/components/uri-breadcrumbs/uri-breadcrumbs.html',\n controller: UriBreadcrumbsController,\n bindings: {\n uri: '<',\n absolute: '<'\n }\n});\n\n\ndatabusApplication.component('yasqeText', {\n templateUrl: '/js/components/yasqe-text/yasqe-text.html',\n controller: ['$scope', '$element', YasqeTextController ],\n bindings: {\n query: '=',\n autoSize: '<',\n readOnly: '<',\n onChange: '&',\n onSend: '&',\n hasSend: '<'\n }\n});\n\ndatabusApplication.component('betterDropdown', {\n templateUrl: '/js/components/better-dropdown/better-dropdown.html',\n controller: ['$scope', '$interval', '$element', BetterDropdownController ],\n bindings: {\n rootNode: '=',\n onNodeClicked: '&',\n icon: '<',\n label: '<'\n }\n});\n\n\ndatabusApplication.component('yasrView', {\n templateUrl: '/js/components/yasr-view/yasr-view.html',\n controller: ['$scope', '$element', YasrViewController ],\n bindings: {\n data: '=',\n autoSize: '<',\n readOnly: '<',\n onChange: '&'\n }\n});\n\ndatabusApplication.component('collectionDataTable', {\n templateUrl: '/js/components/collection-data-table/collection-data-table.html',\n controller: ['$http', '$scope', '$location', '$sce', CollectionDataTableController],\n bindings: {\n collection: '<'\n }\n});\n\n\ndatabusApplication.directive('selectOnClick', ['$window', function ($window) {\n return {\n restrict: 'A',\n link: function (scope, element, attrs) {\n element.on('click', function () {\n if (!$window.getSelection().toString() && this.readonly == false) {\n // Required for mobile Safari\n this.setSelectionRange(0, this.value.length)\n }\n });\n }\n };\n}]);\n\ndatabusApplication.directive('focusMe', ['$timeout', '$parse', function ($timeout, $parse) {\n return {\n //scope: true, // optionally create a child scope\n link: function (scope, element, attrs) {\n var model = $parse(attrs.focusMe);\n scope.$watch(model, function (value) {\n if (value === true) {\n $timeout(function () {\n element[0].focus();\n });\n }\n });\n }\n };\n}]);\n\ndatabusApplication.directive('eventFocus', function (focus) {\n return function (scope, elem, attr) {\n elem.on(attr.eventFocus, function () {\n focus(attr.eventFocusId);\n });\n\n // Removes bound events in the element itself\n // when the scope is destroyed\n scope.$on('$destroy', function () {\n elem.off(attr.eventFocus);\n });\n };\n});\n\n\n\ndatabusApplication.directive('uploaderRanking', function () {\n return {\n restrict: 'E',\n replace: true,\n template: '
UserUploadsDerived Data
{{ row.account }}{{ row.numUploads }}{{ row.uploadSize }}
',\n scope: {\n data: '=data',\n }\n }\n});\n\n\ndatabusApplication.directive('groupsTable', function () {\n return {\n restrict: 'E',\n replace: true,\n template: '
Group Id# Artifacts
{{ row.label }}{{ row.artifactCount }}
',\n scope: {\n data: '=data',\n }\n }\n});\n\n\ndatabusApplication.directive('activityChart', function () {\n return {\n restrict: 'E',\n replace: true,\n template: '',\n scope: {\n data: '=data',\n height: '=height'\n },\n link: function (scope, element, attrs) {\n\n var svgHeight = scope.height;\n\n for (d in scope.data) {\n scope.data[d].date = new Date(scope.data[d].date);\n }\n\n var svg = d3.select(element[0])\n .attr(\"id\", \"graph\")\n .attr(\"width\", \"107%\")\n .attr(\"height\", svgHeight);\n\n var bounds = svg.node().getBoundingClientRect();\n var svgWidth = bounds.width;\n\n var margin = { top: 20, right: 50, bottom: 60, left: 50 };\n var width = svgWidth - margin.left - margin.right;\n var height = svgHeight - margin.top - margin.bottom;\n\n var g = svg.append(\"g\")\n .attr(\"transform\",\n \"translate(\" + margin.left + \",\" + margin.top + \")\"\n );\n\n var x = d3.scaleTime().rangeRound([0, width]);\n var y = d3.scaleLinear().rangeRound([height, 0]);\n\n var line = d3.line()\n .x(function (d) { return x(d.date) })\n .y(function (d) { return y(d.value) })\n\n x.domain(d3.extent(scope.data, function (d) { return d.date }));\n y.domain(d3.extent(scope.data, function (d) { return d.value }));\n\n g.append(\"g\")\n .attr(\"transform\", \"translate(0,\" + height + \")\")\n .call(d3.axisBottom(x))\n .selectAll(\"text\")\n .attr(\"y\", 0)\n .attr(\"x\", 9)\n .attr(\"dy\", \".35em\")\n .attr(\"transform\", \"rotate(90)\")\n .style(\"text-anchor\", \"start\");\n\n g.append(\"g\")\n .call(d3.axisLeft(y))\n .append(\"text\")\n .attr(\"fill\", \"#000\")\n .attr(\"transform\", \"rotate(-90)\")\n .attr(\"y\", 6)\n .attr(\"dy\", \"1em\")\n .attr(\"font-size\", \"1.1em\")\n .attr(\"text-anchor\", \"end\")\n .text(\"Uploaded Data (GiByte)\");\n\n var path = g.append(\"path\")\n .datum(scope.data)\n .attr(\"fill\", \"none\")\n .attr(\"stroke\", \"steelblue\")\n .attr(\"stroke-linejoin\", \"round\")\n .attr(\"stroke-linecap\", \"round\")\n .attr(\"stroke-width\", 2)\n .attr(\"d\", line);\n }\n }\n});\n\ndatabusApplication.directive('onFinishRender', ['$timeout', '$parse', function ($timeout, $parse) {\n return {\n restrict: 'A',\n link: function (scope, element, attr) {\n if (scope.$last === true) {\n $timeout(function () {\n scope.$emit('ngRepeatFinished');\n if (!!attr.onFinishRender) {\n $parse(attr.onFinishRender)(scope);\n }\n });\n }\n }\n }\n}]);\n\ndatabusApplication.directive('clickOutside', [\n '$document', '$parse', '$timeout',\n clickOutside\n]);\n\n/**\n * @ngdoc directive\n * @name angular-click-outside.directive:clickOutside\n * @description Directive to add click outside capabilities to DOM elements\n * @requires $document\n * @requires $parse\n * @requires $timeout\n **/\n function clickOutside($document, $parse, $timeout) {\n return {\n restrict: 'A',\n link: function($scope, elem, attr) {\n\n // postpone linking to next digest to allow for unique id generation\n $timeout(function() {\n var classList = (attr.outsideIfNot !== undefined) ? attr.outsideIfNot.split(/[ ,]+/) : [],\n fn;\n\n function eventHandler(e) {\n var i,\n element,\n r,\n id,\n classNames,\n l;\n\n // check if our element already hidden and abort if so\n if (angular.element(elem).hasClass(\"ng-hide\")) {\n return;\n }\n\n // if there is no click target, no point going on\n if (!e || !e.target) {\n return;\n }\n\n // loop through the available elements, looking for classes in the class list that might match and so will eat\n for (element = e.target; element; element = element.parentNode) {\n // check if the element is the same element the directive is attached to and exit if so (props @CosticaPuntaru)\n if (element === elem[0]) {\n return;\n }\n \n // now we have done the initial checks, start gathering id's and classes\n id = element.id,\n classNames = element.className,\n l = classList.length;\n\n // Unwrap SVGAnimatedString classes\n if (classNames && classNames.baseVal !== undefined) {\n classNames = classNames.baseVal;\n }\n\n // if there are no class names on the element clicked, skip the check\n if (classNames || id) {\n\n // loop through the elements id's and classnames looking for exceptions\n for (i = 0; i < l; i++) {\n //prepare regex for class word matching\n r = new RegExp('\\\\b' + classList[i] + '\\\\b');\n\n // check for exact matches on id's or classes, but only if they exist in the first place\n if ((id !== undefined && id === classList[i]) || (classNames && r.test(classNames))) {\n // now let's exit out as it is an element that has been defined as being ignored for clicking outside\n return;\n }\n }\n }\n }\n\n // if we have got this far, then we are good to go with processing the command passed in via the click-outside attribute\n $timeout(function() {\n fn = $parse(attr['clickOutside']);\n fn($scope, { event: e });\n });\n }\n\n // if the devices has a touchscreen, listen for this event\n if (_hasTouch()) {\n $document.on('touchstart', eventHandler);\n }\n\n // still listen for the click event even if there is touch to cater for touchscreen laptops\n $document.on('click', eventHandler);\n\n // when the scope is destroyed, clean up the documents event handlers as we don't want it hanging around\n $scope.$on('$destroy', function() {\n if (_hasTouch()) {\n $document.off('touchstart', eventHandler);\n }\n\n $document.off('click', eventHandler);\n });\n\n /**\n * @description Private function to attempt to figure out if we are on a touch device\n * @private\n **/\n function _hasTouch() {\n // works on most browsers, IE10/11 and Surface\n return 'ontouchstart' in window || navigator.maxTouchPoints;\n };\n });\n }\n };\n}\n\n\n//# sourceURL=webpack://databus-webapp/./js/angular-application.js?\n}"); -/***/ }), +/***/ }, -/***/ "./js/collections/databus-collection-manager.js": +/***/ "./js/collections/databus-collection-manager.js" /*!******************************************************!*\ !*** ./js/collections/databus-collection-manager.js ***! \******************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +(module, __unused_webpack_exports, __webpack_require__) { -eval("const AppJsonFormatter = __webpack_require__(/*! ../utils/app-json-formatter */ \"./js/utils/app-json-formatter.js\");\nconst DatabusUris = __webpack_require__(/*! ../utils/databus-uris */ \"./js/utils/databus-uris.js\");\nconst DatabusUtils = __webpack_require__(/*! ../utils/databus-utils */ \"./js/utils/databus-utils.js\");\nconst DatabusCollectionUtils = __webpack_require__(/*! ./databus-collection-utils */ \"./js/collections/databus-collection-utils.js\");\nconst DatabusCollectionWrapper = __webpack_require__(/*! ./databus-collection-wrapper */ \"./js/collections/databus-collection-wrapper.js\");\n\nclass DatabusCollectionManager {\n\n // Daten die wir haben:\n\n // Liste von Remote Collections (ungeladen) { uri: databus.org/asdf, label: asdffasd }\n // Liste von Working Copies in der Local Storage\n // Beispiel:\n // [0] : { uri: databus.org/asdf, label: asdffasd, content: { ... }, ... }\n // [1] : { uri: databus.org/asdsdff, label: asdasdfffasd }\n\n\n\n // On Initizialze:\n // Fuer alle remove collections -> finde lokale Kopie / erzeuge lokale Kopie\n\n // On Select / On Set Active\n // 1: Ist es ein Draft -> uri ist undefined\n // Ja? -> Collection direkt als Draft Anzeigen\n // Nein? -> Ist Collection schon geladen? content ist nicht undefined\n // Ja? -> Lade async, uberschreibe remote entry\n // Nein? -> Lade async, setze remote und local entry\n\n _isInitialized = false;\n _initSubscribers = [];\n\n constructor($http, $interval, storageKey) {\n\n try {\n this.storageKeyPrefix = `${encodeURI(DATABUS_RESOURCE_BASE_URL)}`;\n // window.sessionStorage.removeItem(`${this.storageKeyPrefix}_session`);\n\n this.sessionInfo = JSON.parse(window.sessionStorage.getItem(`${this.storageKeyPrefix}_session`));\n\n if (this.sessionInfo == undefined) {\n this.sessionInfo = {};\n }\n\n window.sessionStorage.setItem(`${this.storageKeyPrefix}_session`, JSON.stringify(this.sessionInfo));\n this.storageKey = `${this.storageKeyPrefix}__collections`;\n this.local = this.loadCollectionsFromStorage(true);\n this.remote = {};\n\n } catch (err) {\n this.sessionInfo = {};\n }\n\n\n this.http = $http;\n this.interval = $interval;\n }\n\n clearSession() {\n this.sessionInfo = {};\n window.sessionStorage.setItem(`${this.storageKeyPrefix}_session`, JSON.stringify(this.sessionInfo));\n }\n\n get accountName() {\n return this.sessionInfo != undefined ? this.sessionInfo.accountName : undefined;\n }\n\n getLocalCollectionByUri(uri) {\n for (let guid in this.local) {\n let localCollection = this.local[guid];\n\n if (localCollection.uri == uri) {\n return localCollection;\n }\n }\n\n return undefined;\n }\n\n /**\n * Set up the collection mananger for a specific account.\n * 1) Load ALL the collections of this account from the remote\n * 2) Save to remote map\n * 3) Create local working copies if local has no entry for remote collection\n * @param {*} accountName \n * @returns \n */\n async tryInitialize(accountName) {\n\n // Needs an account name to set up\n if (accountName == undefined) {\n return;\n }\n\n // this.remote = this.loadCollectionsFromStorage(false);\n this.sessionInfo.accountName = accountName;\n\n\n\n let collectionListResponse = await this.http.get(`/app/account/collections?account=${encodeURIComponent(accountName)}`);\n let remoteCollections = collectionListResponse.data;\n\n\n let wasLocalCollectionAdded = false;\n\n for (let collectionUri in remoteCollections) {\n let remoteCollection = remoteCollections[collectionUri];\n let localCollection = this.getLocalCollectionByUri(collectionUri);\n\n // Create local copy if not exist\n if (localCollection == undefined) {\n localCollection = JSON.parse(JSON.stringify(remoteCollection));\n localCollection.uuid = DatabusCollectionUtils.uuidv4();\n this.local[localCollection.uuid] = localCollection;\n wasLocalCollectionAdded = true;\n }\n\n this.remote[localCollection.uuid] = remoteCollection;\n this.remote[localCollection.uuid].isHidden = this.remote[localCollection.uuid].issued == undefined;\n\n if(this.local[localCollection.uuid].isHidden == undefined) {\n this.local[localCollection.uuid].isHidden = this.remote[localCollection.uuid].isHidden;\n }\n }\n\n if(wasLocalCollectionAdded) {\n this.saveLocally();\n }\n\n this.findActive();\n\n /*\n\n if (loadFromServer) {\n try {\n var res = await this.http.get(`/app/account/collections?account=${accountName}`);\n this.initialize(res.data);\n\n } catch (e) {\n console.log(`Failed to initialze collection manager.`);\n console.log(e);\n }\n }\n */\n\n var self = this;\n\n this.interval(function () {\n var storageHash = window.localStorage.getItem(`${self.storageKey}_hash`);\n\n if (storageHash != self.currentHash) {\n self.local = JSON.parse(window.localStorage.getItem(self.storageKey));\n self.currentHash = storageHash;\n\n for (let identifier in self.local) {\n if (identifier === undefined || identifier === \"undefined\") {\n delete (self.local[identifier]);\n } else {\n //enable Collection Utils for all collections in local storage\n self.local[identifier] = new DatabusCollectionWrapper(self.local[identifier]);\n }\n }\n\n if (self.onCollectionChangedInDifferentTab != null) {\n self.onCollectionChangedInDifferentTab();\n }\n }\n }, 300);\n\n\n this._isInitialized = true;\n this._notifyInitialized();\n }\n\n get isInitialized() {\n return this._isInitialized;\n }\n\n subscribeOnInitialized(callback) {\n if (this._isInitialized) {\n callback();\n } else {\n this._initSubscribers.push(callback);\n }\n }\n\n _notifyInitialized() {\n this._initSubscribers.forEach(cb => cb());\n this._initSubscribers = [];\n }\n\n get hasAccountName() {\n return this.accountName != null;\n }\n\n // Setze das remote array und update local array\n initialize(remoteCollections) {\n // We keep remote entries and local entries separately to detect diffs\n this.remote = {};\n\n // Load everyting from the local browser storage. All entries in the local browser\n // storage are indexed with a UUID identifier.\n // Remote collections that are pulled to the local browser storage will\n // also be given such an identifier\n // this.local = this.loadCollectionsFromLocalStorage();\n\n // This map will keep track of all local entries that already claim to have a remote counterpart\n let localPublished = {};\n\n for (let identifier in this.local) {\n if (!identifier.startsWith('___')) {\n delete this.local[identifier];\n continue;\n }\n\n if (identifier !== this.local[identifier].uuid) {\n delete this.local[identifier];\n continue;\n }\n\n let localCollection = this.local[identifier];\n\n if (localCollection.uri !== undefined && remoteCollections !== undefined) {\n let uri = localCollection.uri;\n // The local collection already has a URI\n if (remoteCollections[uri] === undefined) {\n // There is no remote collection with that URI - delete it! Keep the collection as a draft\n delete (this.local[identifier].uri);\n delete (this.local[identifier].issued);\n delete (this.local[identifier].created);\n } else {\n // Remember that the collection with uri already has a working copy\n localPublished[uri] = true;\n // Also remember the remote entry as an entry with a local working copy\n this.remote[identifier] = remoteCollections[uri];\n // Make sure the unchangeable values are set to the remote entry\n this.local[identifier].publisher = remoteCollections[uri].publisher;\n this.local[identifier].issued = remoteCollections[uri].issued;\n this.local[identifier].created = remoteCollections[uri].created;\n this.local[identifier].files = remoteCollections[uri].files;\n }\n }\n }\n\n for (let uri in remoteCollections) {\n if (localPublished[uri] === undefined) {\n // We don't have a working copy in our local storage yet, time to create an identifier!\n let identifier = DatabusCollectionUtils.uuidv4();\n remoteCollections[uri].uuid = identifier;\n remoteCollections[uri].isHidden = remoteCollections[uri].issued == undefined;\n // Create two entries, one in the local map, one in the remote map\n this.local[identifier] = DatabusCollectionUtils.createCleanCopy(remoteCollections[uri]);\n this.remote[identifier] = DatabusCollectionUtils.createCleanCopy(remoteCollections[uri]);\n }\n }\n\n for (let identifier in this.local) {\n // The local collection is now either a draft or a working copy of the remote - wrap it.\n this.local[identifier] = new DatabusCollectionWrapper(this.local[identifier]);\n // Sanitize content\n if (!(this.local[identifier].content instanceof Object)) {\n this.local[identifier].content = { groups: [], customQueries: [] };\n }\n }\n\n /*\n let activeIdentifier = this.activeCollectionIdentifier;\n // Set first collection as active\n\n if (this.local[activeIdentifier] !== undefined) {\n this.activeCollectionIdentifier = activeIdentifier;\n }\n */\n\n\n\n // QueryNode.assignParents(this.activeCollection.content.root);\n\n // Save locally in case we created any local working copies\n\n this.saveLocally();\n\n // Call this always in header-controller.js\n if (this.activeCollection == null) {\n // select first or create a new draft if we don't have any local drafts yet\n this.selectFirstOrCreate();\n }\n\n }\n\n\n\n findActive() {\n if (!this.hasAccountName) throw \"Databus-Collection-Manager is not initialized1.\";\n if (this.activeCollection == undefined) {\n this.selectFirstOrCreate();\n }\n }\n\n\n loadCollectionsFromStorage(local = true) {\n let collections;\n\n if (local) {\n collections = JSON.parse(window.localStorage.getItem(this.storageKey));\n } else {\n collections = JSON.parse(window.sessionStorage.getItem(this.storageKey));\n }\n\n if (collections == null) {\n collections = {};\n }\n\n for (let identifier in collections) {\n if (identifier === undefined || identifier === \"undefined\") {\n delete (collections[identifier]);\n } else if (collections[identifier].accountName == null) {\n delete (collections[identifier]);\n } else {\n //enable Collection Utils for all collections in local storage\n collections[identifier] = new DatabusCollectionWrapper(collections[identifier]);\n }\n }\n\n return collections;\n }\n\n /**\n * Selects the first collection in the local list or creates a new draft\n */\n selectFirstOrCreate(accountName) {\n\n for (let identifier in this.local) {\n this.setActive(identifier);\n break;\n }\n\n // Create new collection if current is null\n if (this.activeCollection == null) {\n this.createNew(accountName, \"Unnamed Collection\", \"\", function (response) { });\n }\n }\n\n setActive(uuid) {\n if (!this.hasAccountName) throw \"Databus-Collection-Manager is not initialized1.\";\n\n this.convertCollectionContentToTree(uuid);\n\n let collection = this.local[uuid];\n // QueryNode.assignParents(collection.content.root);\n\n this.sessionInfo.activeCollectionIdentifier = uuid;\n window.sessionStorage.setItem(`${this.storageKeyPrefix}_session`, JSON.stringify(this.sessionInfo));\n\n }\n\n get activeCollectionIdentifier() {\n return this.sessionInfo != null ? this.sessionInfo.activeCollectionIdentifier : null;\n }\n\n get activeCollection() {\n if (this.activeCollectionIdentifier == null) {\n return null;\n }\n\n if (this.local == null) {\n return null;\n }\n\n return this.local[this.activeCollectionIdentifier];\n }\n\n convertCollectionContentToTree(uuid) {\n let collection = this.local[uuid];\n\n if (collection.content.root !== undefined) {\n return;\n }\n\n collection.content.root = new QueryNode(null, null);\n\n for (var g in collection.content.groups) {\n var group = collection.content.groups[g];\n var groupNode = new QueryNode(group.uri, 'databus:group');\n\n // add group facets\n for (var s in group.settings) {\n var setting = group.settings[s];\n\n if (setting.value === 'SYSTEM_LATEST_ARTIFACT_VERSION' || setting.value === 'SYSTEM_LATEST_GROUP_VERSION') {\n setting.value = '$latest';\n }\n\n groupNode.setFacet(setting.facet, setting.value, setting.checked);\n }\n\n collection.content.root.addChild(groupNode);\n\n\n for (var a in group.artifacts) {\n var artifact = group.artifacts[a];\n\n var artifactNode = new QueryNode(artifact.uri, 'databus:artifact');\n\n // add artifact facets\n\n groupNode.addChild(artifactNode);\n }\n }\n\n }\n\n createSnapshot(source) { // convert each version=\"latest\" to actual latest version\n if (!this.hasAccountName) throw \"Databus-Collection-Manager is not initialized.\";\n\n let collection = DatabusCollectionWrapper.createNew();\n collection.accountName = this.accountName;\n collection.content = DatabusCollectionUtils.createCleanCopy(source.content);\n\n let root = collection.content.root;\n for (var g in root.childNodes) {\n var graph = root.childNodes[g];\n\n for (var s in graph.facetSettings) {\n if (graph.facetSettings[s][0].value === '$latest') {\n this.http.get('/app/utils/facets', {\n params: { uri: artifact.uri, type: 'group' }\n }).then(function (result) {\n let versions = result.data[\"http://purl.org/dc/terms/hasVersion\"].values;\n let latestVersion = versions.reduce(function (a, b) { return a > b ? a : b; });\n artifact.facetSettings[s][0].value = latestVersion;\n });\n }\n }\n\n for (var a in graph.childNodes) {\n var artifact = graph.childNodes[a];\n\n for (var s in artifact.facetSettings) {\n if (artifact.facetSettings[s][0].value === '$latest') {\n this.http.get('/app/utils/facets', {\n params: { uri: artifact.uri, type: 'artifact' }\n }).then(function (result) {\n let versions = result.data[\"http://purl.org/dc/terms/hasVersion\"].values;\n let latestVersion = versions.reduce(function (a, b) { return a > b ? a : b; });\n artifact.facetSettings[s][0].value = latestVersion;\n });\n }\n }\n\n }\n\n }\n\n\n collection.title = `Snapshot of ${source.title}`;\n collection.description = source.description;\n\n this.local[collection.uuid] = new DatabusCollectionWrapper(collection);\n this.saveLocally();\n this.setActive(collection.uuid);\n\n return collection;\n }\n\n saveLocally() {\n if (!this.hasAccountName) throw \"Databus-Collection-Manager is not initialized.\";\n\n if (this.activeCollection != null) {\n this.activeCollection.hasLocalChanges = this.hasLocalChanges(this.activeCollection);\n }\n\n var hash = DatabusCollectionUtils.cyrb53Hash(DatabusCollectionUtils.serialize(this.local));\n this.currentHash = hash;\n\n window.localStorage.setItem(`${this.storageKey}_hash`, hash);\n\n for (let identifier in this.local) {\n if (this.local[identifier].accountName == null) {\n delete (this.local[identifier]);\n }\n }\n\n try {\n //write local collections to local storage\n window.localStorage.setItem(this.storageKey, DatabusCollectionUtils.serialize(this.local));\n //write remote collections to session storage\n window.sessionStorage.setItem(this.storageKey, DatabusCollectionUtils.serialize(this.remote));\n } catch (e) {\n console.log(e);\n }\n }\n\n hasLocalChanges(localCollection) {\n if (this.remote[localCollection.uuid] === undefined) {\n return true;\n }\n\n let remoteCollection = this.remote[localCollection.uuid];\n\n if (remoteCollection.isHidden != localCollection.isHidden) {\n return true;\n }\n\n if (localCollection.title !== remoteCollection.title) {\n return true;\n }\n\n if (localCollection.description !== remoteCollection.description) {\n return true;\n }\n\n let serializedRemoteContent = DatabusCollectionUtils.serialize(remoteCollection.content);\n let serializedLocalContent = DatabusCollectionUtils.serialize(localCollection.content);\n\n return serializedLocalContent !== serializedRemoteContent;\n }\n\n discardLocalChanges() {\n\n if (!this.hasAccountName) throw \"Databus-Collection-Manager is not initialized.\";\n\n let uuid = this.activeCollection.uuid;\n\n if (this.remote[uuid] === undefined) {\n return;\n }\n\n let uri = this.activeCollection.uri;\n\n if (uri == undefined) {\n return;\n }\n\n this.local[uuid].title = this.remote[uuid].title;\n this.local[uuid].abstract = this.remote[uuid].abstract;\n this.local[uuid].description = this.remote[uuid].description;\n this.local[uuid].content = DatabusCollectionUtils.createCleanCopy(this.remote[uuid].content);\n this.local[uuid].hasLocalChanges = this.hasLocalChanges(this.local[uuid]);\n\n this.saveLocally();\n }\n\n addElement(elementQuery) {\n this.current.addElement(elementQuery);\n this.saveLocally();\n\n if (this.onActiveCollectionChanged != null) {\n this.onActiveCollectionChanged(this.current);\n }\n }\n\n removeElement(elementGuid) {\n this.current.removeElement(elementGuid);\n this.saveLocally();\n\n if (this.onActiveCollectionChanged != null) {\n this.onActiveCollectionChanged(this.current);\n }\n }\n\n\n\n createNew(accountName, title, description, callback) {\n if (!this.hasAccountName) throw \"Databus-Collection-Manager is not initialized.\";\n\n let reg = /^\\w+[\\w\\s]*$/;\n\n if (title === undefined || !reg.test(title)) {\n callback(false);\n return;\n }\n\n let collection = DatabusCollectionWrapper.createNew(title, description, DATABUS_RESOURCE_BASE_URL, accountName);\n\n this.local[collection.uuid] = new DatabusCollectionWrapper(collection);\n this.setActive(collection.uuid);\n this.saveLocally();\n\n callback(collection);\n }\n\n createDraft(callback) {\n if (!this.hasAccountName) {\n return;\n }\n\n let collection = DatabusCollectionWrapper.createNew('', '');\n this.local[collection.uuid] = new DatabusCollectionWrapper(collection);\n this.setActive(collection.uuid);\n this.saveLocally()\n\n callback(DatabusResponse.COLLECTION_DRAFT_CREATED);\n }\n\n createCopy(source) {\n if (!this.hasAccountName) throw \"Databus-Collection-Manager is not initialized.\";\n\n let collection = DatabusCollectionWrapper.createNew();\n collection.content = DatabusCollectionUtils.createCleanCopy(source.content);\n collection.title = `Copy of ${source.title}`;\n collection.abstract = source.abstract;\n collection.description = source.description;\n collection.accountName = this.accountName;\n\n this.local[collection.uuid] = new DatabusCollectionWrapper(collection);\n this.saveLocally();\n this.setActive(collection.uuid);\n\n return collection;\n }\n\n\n\n deleteLocally() {\n delete this.local[this.activeCollection.uuid];\n this.saveLocally();\n }\n\n /**\n * Returns the collection or null\n * @param {[type]} uri [description]\n * @return {[type]} [description]\n */\n getCollectionByUri(uri) {\n if (uri == null)\n return null;\n\n for (let identifier in this.local) {\n if (uri === this.local[identifier].uri) {\n return this.local[identifier];\n }\n }\n return null;\n }\n\n /**\n * Returns the first collection or null\n * @return {[type]} [description]\n */\n getFirstCollection() {\n if (this.local.length === 0) {\n return null;\n }\n return this.local[0];\n }\n\n\n async changeCollection(username, collectionUri) {\n try {\n if (!this.hasAccountName) throw \"Databus-Collection-Manager is not initialized.\";\n\n this.saveLocally();\n\n // Keep the identifier of the collection we want to push\n var pushIdentifier = this.activeCollection.uuid;\n var publisherUri = `${DATABUS_RESOURCE_BASE_URL}/${username}#this`;\n\n var ignoreKeys = [\n 'parent',\n '$$hashKey',\n 'expanded',\n 'files',\n 'eventListeners',\n 'hasLocalChanges',\n 'published',\n 'uuid',\n ];\n\n var contentString = encodeURIComponent(DatabusCollectionUtils.serialize(this.activeCollection.content, ignoreKeys));\n\n // Format collection as json-ld\n let collectionJsonLd = {\n \"@context\": DATABUS_CONTEXT[DatabusUris.JSONLD_CONTEXT],\n \"@graph\": [\n {\n \"@id\": collectionUri,\n \"@type\": \"Collection\",\n \"publisher\": publisherUri,\n \"title\": this.activeCollection.title,\n \"abstract\": this.activeCollection.abstract,\n \"description\": this.activeCollection.description,\n \"databus:collectionContent\": contentString,\n }\n ]\n };\n\n if (!this.activeCollection.isHidden) {\n collectionJsonLd[\"@graph\"][0].issued = DatabusUtils.timeStringNow();\n }\n\n var response = null;\n\n try {\n\n // var relativeUri = new URL(collectionUri).pathname;\n // response = await this.http.put(relativeUri, collectionJsonLd);\n\n response = await this.http.post('/api/register', collectionJsonLd);\n\n } catch (errResponse) {\n console.log(errResponse);\n throw { code: errResponse.data.code };\n }\n\n try {\n var relativeUri = new URL(collectionUri).pathname;\n\n var response = await this.http({\n method: 'GET',\n url: relativeUri,\n headers: {\n 'Accept': 'application/ld+json',\n 'X-Jsonld-Formatting': 'compact'\n }\n });\n\n\n } catch (errResponse) {\n console.log(errResponse);\n throw { code: errResponse.data.code };\n }\n\n // Get the remotely saved collection from the payload\n var remoteGraph = response.data;\n\n // If the user changed the active collection in the meantime throw an error. This\n // should be prevented by a loading dialog\n if (this.activeCollection.uuid != pushIdentifier) {\n throw { code: DatabusResponse.COLLECTION_INVALID_ARGUMENT };\n }\n\n this.local[pushIdentifier].uri = remoteGraph['@id'];\n this.local[pushIdentifier].hasLocalChanges = false;\n this.local[pushIdentifier].modified = remoteGraph.modified;\n this.local[pushIdentifier].issued = remoteGraph.issued;\n this.local[pushIdentifier].isHidden = remoteGraph.issued == null;\n // this.local[pushIdentifier].created = remoteGraph.created;\n\n //Update remote data\n this.remote[pushIdentifier] = JSON.parse(DatabusCollectionUtils.serialize(this.activeCollection));\n\n // Update the local data\n // this.local[pushIdentifier].uri = remoteGraph['@id'];\n //this.local[pushIdentifier].hasLocalChanges = this.hasLocalChanges(this.local[pushIdentifier]);\n //this.local[pushIdentifier].modified = this.activeCollection.modified;\n //this.local[pushIdentifier].issued = this.activeCollection.issued;\n //this.local[pushIdentifier].created = this.activeCollection.created;\n\n this.saveLocally();\n\n return response.data;\n\n } catch (err) {\n\n console.log(err);\n throw {\n code: err.data !== undefined && err.data.code !== undefined ? err.data.code :\n DatabusResponse.COLLECTION_UPDATE_ERROR\n };\n }\n }\n\n async updateCollection(username, collectionTag) {\n\n if (this.activeCollection.uri != null) {\n return await this.changeCollection(username, this.activeCollection.uri);\n } else {\n var collectionUri = `${DATABUS_RESOURCE_BASE_URL}/${username}/collections/${collectionTag}`;\n\n for (var uuid in this.local) {\n if (this.local[uuid].uri == collectionUri) {\n throw \"A collection with the specifed URI already exists.\";\n }\n }\n\n return await this.changeCollection(username, collectionUri);\n }\n }\n\n\n /**\n * Fetches the remote data of the current collection and assigns the field values to the local copy\n */\n async fetchCollection(uri) {\n try {\n if (!this.hasAccountName) throw \"Databus-Collection-Manager is not initialized.\";\n\n var req = {\n method: 'GET',\n url: uri,\n headers: { 'Accept': 'application/json' }\n };\n\n var getResponse = await this.http(req);\n var collection = getCollectionByUri(uri);\n\n this.local[collection.uuid].content = getResponse.data.content;\n this.local[collection.uuid].created = getResponse.data.created;\n this.local[collection.uuid].issued = getResponse.data.issued;\n this.local[collection.uuid].title = getResponse.data.title;\n this.local[collection.uuid].description = getResponse.data.description;\n this.local[collection.uuid].files = getResponse.data.files;\n } catch (errResponse) {\n console.log(errResponse);\n return errResponse.data;\n }\n }\n\n async deleteCollection(username, collectionTag) {\n try {\n if (!this.hasAccountName) throw \"Databus-Collection-Manager is not initialized.\";\n\n\n\n // Keep the identifier of the collection we want to push\n let deleteIdentifier = this.activeCollection.uuid;\n\n if (this.activeCollection.isDraft) {\n delete this.local[deleteIdentifier];\n this.saveLocally();\n return { code: DatabusResponse.COLLECTION_DELETED };\n }\n\n var targetUri = `/${username}/collections/${collectionTag}`;\n\n let deleteResponse = await this.http.delete(targetUri);\n\n delete this.remote[deleteIdentifier];\n delete this.local[deleteIdentifier];\n\n return deleteResponse.data;\n } catch (errResponse) {\n console.log(errResponse);\n return errResponse.data;\n }\n }\n\n /**\n * Deletes the active collection from the server but keeps the local storage entry\n */\n async unpublishActiveCollection() {\n\n if (!this.hasAccountName) throw \"Databus-Collection-Manager is not initialized.\";\n\n if (this.activeCollection.isDraft) {\n throw \"Cannot unpublish an unpublished draft\";\n }\n\n // Keep the identifier of the collection we want to push\n let uuid = this.activeCollection.uuid;\n let identifier = DatabusUtils.uriToName(this.activeCollection.uri);\n\n var targetUri = `/${this.accountName}/collections/${identifier}`;\n await this.http.delete(targetUri);\n\n delete this.remote[uuid];\n delete this.local[uuid].uri;\n delete this.local[uuid].issued;\n this.saveLocally();\n }\n}\n\n\nmodule.exports = DatabusCollectionManager;\n\n//# sourceURL=webpack://databus-webapp/./js/collections/databus-collection-manager.js?"); +eval("{const AppJsonFormatter = __webpack_require__(/*! ../utils/app-json-formatter */ \"./js/utils/app-json-formatter.js\");\nconst DatabusUris = __webpack_require__(/*! ../utils/databus-uris */ \"./js/utils/databus-uris.js\");\nconst DatabusUtils = __webpack_require__(/*! ../utils/databus-utils */ \"./js/utils/databus-utils.js\");\nconst DatabusCollectionUtils = __webpack_require__(/*! ./databus-collection-utils */ \"./js/collections/databus-collection-utils.js\");\nconst DatabusCollectionWrapper = __webpack_require__(/*! ./databus-collection-wrapper */ \"./js/collections/databus-collection-wrapper.js\");\n\nclass DatabusCollectionManager {\n\n // Daten die wir haben:\n\n // Liste von Remote Collections (ungeladen) { uri: databus.org/asdf, label: asdffasd }\n // Liste von Working Copies in der Local Storage\n // Beispiel:\n // [0] : { uri: databus.org/asdf, label: asdffasd, content: { ... }, ... }\n // [1] : { uri: databus.org/asdsdff, label: asdasdfffasd }\n\n\n\n // On Initizialze:\n // Fuer alle remove collections -> finde lokale Kopie / erzeuge lokale Kopie\n\n // On Select / On Set Active\n // 1: Ist es ein Draft -> uri ist undefined\n // Ja? -> Collection direkt als Draft Anzeigen\n // Nein? -> Ist Collection schon geladen? content ist nicht undefined\n // Ja? -> Lade async, uberschreibe remote entry\n // Nein? -> Lade async, setze remote und local entry\n\n _isInitialized = false;\n _initSubscribers = [];\n\n constructor($http, $interval, storageKey) {\n\n try {\n this.storageKeyPrefix = `${encodeURI(DATABUS_RESOURCE_BASE_URL)}`;\n // window.sessionStorage.removeItem(`${this.storageKeyPrefix}_session`);\n\n this.sessionInfo = JSON.parse(window.sessionStorage.getItem(`${this.storageKeyPrefix}_session`));\n\n if (this.sessionInfo == undefined) {\n this.sessionInfo = {};\n }\n\n window.sessionStorage.setItem(`${this.storageKeyPrefix}_session`, JSON.stringify(this.sessionInfo));\n this.storageKey = `${this.storageKeyPrefix}__collections`;\n this.local = this.loadCollectionsFromStorage(true);\n this.remote = {};\n\n } catch (err) {\n this.sessionInfo = {};\n }\n\n\n this.http = $http;\n this.interval = $interval;\n }\n\n clearSession() {\n this.sessionInfo = {};\n window.sessionStorage.setItem(`${this.storageKeyPrefix}_session`, JSON.stringify(this.sessionInfo));\n }\n\n get accountName() {\n return this.sessionInfo != undefined ? this.sessionInfo.accountName : undefined;\n }\n\n getLocalCollectionByUri(uri) {\n for (let guid in this.local) {\n let localCollection = this.local[guid];\n\n if (localCollection.uri == uri) {\n return localCollection;\n }\n }\n\n return undefined;\n }\n\n /**\n * Set up the collection mananger for a specific account.\n * 1) Load ALL the collections of this account from the remote\n * 2) Save to remote map\n * 3) Create local working copies if local has no entry for remote collection\n * @param {*} accountName \n * @returns \n */\n async tryInitialize(accountName) {\n\n // Needs an account name to set up\n if (accountName == undefined) {\n return;\n }\n\n // this.remote = this.loadCollectionsFromStorage(false);\n this.sessionInfo.accountName = accountName;\n\n\n\n let collectionListResponse = await this.http.get(`/app/account/collections?account=${encodeURIComponent(accountName)}`);\n let remoteCollections = collectionListResponse.data;\n\n\n let wasLocalCollectionAdded = false;\n\n for (let collectionUri in remoteCollections) {\n let remoteCollection = remoteCollections[collectionUri];\n let localCollection = this.getLocalCollectionByUri(collectionUri);\n\n // Create local copy if not exist\n if (localCollection == undefined) {\n localCollection = JSON.parse(JSON.stringify(remoteCollection));\n localCollection.uuid = DatabusCollectionUtils.uuidv4();\n this.local[localCollection.uuid] = localCollection;\n wasLocalCollectionAdded = true;\n }\n\n this.remote[localCollection.uuid] = remoteCollection;\n this.remote[localCollection.uuid].isHidden = this.remote[localCollection.uuid].issued == undefined;\n\n if(this.local[localCollection.uuid].isHidden == undefined) {\n this.local[localCollection.uuid].isHidden = this.remote[localCollection.uuid].isHidden;\n }\n }\n\n if(wasLocalCollectionAdded) {\n this.saveLocally();\n }\n\n this.findActive();\n\n /*\n\n if (loadFromServer) {\n try {\n var res = await this.http.get(`/app/account/collections?account=${accountName}`);\n this.initialize(res.data);\n\n } catch (e) {\n console.log(`Failed to initialze collection manager.`);\n console.log(e);\n }\n }\n */\n\n var self = this;\n\n this.interval(function () {\n var storageHash = window.localStorage.getItem(`${self.storageKey}_hash`);\n\n if (storageHash != self.currentHash) {\n self.local = JSON.parse(window.localStorage.getItem(self.storageKey));\n self.currentHash = storageHash;\n\n for (let identifier in self.local) {\n if (identifier === undefined || identifier === \"undefined\") {\n delete (self.local[identifier]);\n } else {\n //enable Collection Utils for all collections in local storage\n self.local[identifier] = new DatabusCollectionWrapper(self.local[identifier]);\n }\n }\n\n if (self.onCollectionChangedInDifferentTab != null) {\n self.onCollectionChangedInDifferentTab();\n }\n }\n }, 300);\n\n\n this._isInitialized = true;\n this._notifyInitialized();\n }\n\n get isInitialized() {\n return this._isInitialized;\n }\n\n subscribeOnInitialized(callback) {\n if (this._isInitialized) {\n callback();\n } else {\n this._initSubscribers.push(callback);\n }\n }\n\n _notifyInitialized() {\n this._initSubscribers.forEach(cb => cb());\n this._initSubscribers = [];\n }\n\n get hasAccountName() {\n return this.accountName != null;\n }\n\n // Setze das remote array und update local array\n initialize(remoteCollections) {\n // We keep remote entries and local entries separately to detect diffs\n this.remote = {};\n\n // Load everyting from the local browser storage. All entries in the local browser\n // storage are indexed with a UUID identifier.\n // Remote collections that are pulled to the local browser storage will\n // also be given such an identifier\n // this.local = this.loadCollectionsFromLocalStorage();\n\n // This map will keep track of all local entries that already claim to have a remote counterpart\n let localPublished = {};\n\n for (let identifier in this.local) {\n if (!identifier.startsWith('___')) {\n delete this.local[identifier];\n continue;\n }\n\n if (identifier !== this.local[identifier].uuid) {\n delete this.local[identifier];\n continue;\n }\n\n let localCollection = this.local[identifier];\n\n if (localCollection.uri !== undefined && remoteCollections !== undefined) {\n let uri = localCollection.uri;\n // The local collection already has a URI\n if (remoteCollections[uri] === undefined) {\n // There is no remote collection with that URI - delete it! Keep the collection as a draft\n delete (this.local[identifier].uri);\n delete (this.local[identifier].issued);\n delete (this.local[identifier].created);\n } else {\n // Remember that the collection with uri already has a working copy\n localPublished[uri] = true;\n // Also remember the remote entry as an entry with a local working copy\n this.remote[identifier] = remoteCollections[uri];\n // Make sure the unchangeable values are set to the remote entry\n this.local[identifier].publisher = remoteCollections[uri].publisher;\n this.local[identifier].issued = remoteCollections[uri].issued;\n this.local[identifier].created = remoteCollections[uri].created;\n this.local[identifier].files = remoteCollections[uri].files;\n }\n }\n }\n\n for (let uri in remoteCollections) {\n if (localPublished[uri] === undefined) {\n // We don't have a working copy in our local storage yet, time to create an identifier!\n let identifier = DatabusCollectionUtils.uuidv4();\n remoteCollections[uri].uuid = identifier;\n remoteCollections[uri].isHidden = remoteCollections[uri].issued == undefined;\n // Create two entries, one in the local map, one in the remote map\n this.local[identifier] = DatabusCollectionUtils.createCleanCopy(remoteCollections[uri]);\n this.remote[identifier] = DatabusCollectionUtils.createCleanCopy(remoteCollections[uri]);\n }\n }\n\n for (let identifier in this.local) {\n // The local collection is now either a draft or a working copy of the remote - wrap it.\n this.local[identifier] = new DatabusCollectionWrapper(this.local[identifier]);\n // Sanitize content\n if (!(this.local[identifier].content instanceof Object)) {\n this.local[identifier].content = { groups: [], customQueries: [] };\n }\n }\n\n /*\n let activeIdentifier = this.activeCollectionIdentifier;\n // Set first collection as active\n\n if (this.local[activeIdentifier] !== undefined) {\n this.activeCollectionIdentifier = activeIdentifier;\n }\n */\n\n\n\n // QueryNode.assignParents(this.activeCollection.content.root);\n\n // Save locally in case we created any local working copies\n\n this.saveLocally();\n\n // Call this always in header-controller.js\n if (this.activeCollection == null) {\n // select first or create a new draft if we don't have any local drafts yet\n this.selectFirstOrCreate();\n }\n\n }\n\n\n\n findActive() {\n if (!this.hasAccountName) throw \"Databus-Collection-Manager is not initialized1.\";\n if (this.activeCollection == undefined) {\n this.selectFirstOrCreate();\n }\n }\n\n\n loadCollectionsFromStorage(local = true) {\n let collections;\n\n if (local) {\n collections = JSON.parse(window.localStorage.getItem(this.storageKey));\n } else {\n collections = JSON.parse(window.sessionStorage.getItem(this.storageKey));\n }\n\n if (collections == null) {\n collections = {};\n }\n\n for (let identifier in collections) {\n if (identifier === undefined || identifier === \"undefined\") {\n delete (collections[identifier]);\n } else if (collections[identifier].accountName == null) {\n delete (collections[identifier]);\n } else {\n //enable Collection Utils for all collections in local storage\n collections[identifier] = new DatabusCollectionWrapper(collections[identifier]);\n }\n }\n\n return collections;\n }\n\n /**\n * Selects the first collection in the local list or creates a new draft\n */\n selectFirstOrCreate(accountName) {\n\n for (let identifier in this.local) {\n this.setActive(identifier);\n break;\n }\n\n // Create new collection if current is null\n if (this.activeCollection == null) {\n this.createNew(accountName, \"Unnamed Collection\", \"\", function (response) { });\n }\n }\n\n setActive(uuid) {\n if (!this.hasAccountName) throw \"Databus-Collection-Manager is not initialized1.\";\n\n this.convertCollectionContentToTree(uuid);\n\n let collection = this.local[uuid];\n // QueryNode.assignParents(collection.content.root);\n\n this.sessionInfo.activeCollectionIdentifier = uuid;\n window.sessionStorage.setItem(`${this.storageKeyPrefix}_session`, JSON.stringify(this.sessionInfo));\n\n }\n\n get activeCollectionIdentifier() {\n return this.sessionInfo != null ? this.sessionInfo.activeCollectionIdentifier : null;\n }\n\n get activeCollection() {\n if (this.activeCollectionIdentifier == null) {\n return null;\n }\n\n if (this.local == null) {\n return null;\n }\n\n return this.local[this.activeCollectionIdentifier];\n }\n\n convertCollectionContentToTree(uuid) {\n let collection = this.local[uuid];\n\n if (collection.content.root !== undefined) {\n return;\n }\n\n collection.content.root = new QueryNode(null, null);\n\n for (var g in collection.content.groups) {\n var group = collection.content.groups[g];\n var groupNode = new QueryNode(group.uri, 'databus:group');\n\n // add group facets\n for (var s in group.settings) {\n var setting = group.settings[s];\n\n if (setting.value === 'SYSTEM_LATEST_ARTIFACT_VERSION' || setting.value === 'SYSTEM_LATEST_GROUP_VERSION') {\n setting.value = '$latest';\n }\n\n groupNode.setFacet(setting.facet, setting.value, setting.checked);\n }\n\n collection.content.root.addChild(groupNode);\n\n\n for (var a in group.artifacts) {\n var artifact = group.artifacts[a];\n\n var artifactNode = new QueryNode(artifact.uri, 'databus:artifact');\n\n // add artifact facets\n\n groupNode.addChild(artifactNode);\n }\n }\n\n }\n\n createSnapshot(source) { // convert each version=\"latest\" to actual latest version\n if (!this.hasAccountName) throw \"Databus-Collection-Manager is not initialized.\";\n\n let collection = DatabusCollectionWrapper.createNew();\n collection.accountName = this.accountName;\n collection.content = DatabusCollectionUtils.createCleanCopy(source.content);\n\n let root = collection.content.root;\n for (var g in root.childNodes) {\n var graph = root.childNodes[g];\n\n for (var s in graph.facetSettings) {\n if (graph.facetSettings[s][0].value === '$latest') {\n this.http.get('/app/utils/facets', {\n params: { uri: artifact.uri, type: 'group' }\n }).then(function (result) {\n let versions = result.data[\"http://purl.org/dc/terms/hasVersion\"].values;\n let latestVersion = versions.reduce(function (a, b) { return a > b ? a : b; });\n artifact.facetSettings[s][0].value = latestVersion;\n });\n }\n }\n\n for (var a in graph.childNodes) {\n var artifact = graph.childNodes[a];\n\n for (var s in artifact.facetSettings) {\n if (artifact.facetSettings[s][0].value === '$latest') {\n this.http.get('/app/utils/facets', {\n params: { uri: artifact.uri, type: 'artifact' }\n }).then(function (result) {\n let versions = result.data[\"http://purl.org/dc/terms/hasVersion\"].values;\n let latestVersion = versions.reduce(function (a, b) { return a > b ? a : b; });\n artifact.facetSettings[s][0].value = latestVersion;\n });\n }\n }\n\n }\n\n }\n\n\n collection.title = `Snapshot of ${source.title}`;\n collection.description = source.description;\n\n this.local[collection.uuid] = new DatabusCollectionWrapper(collection);\n this.saveLocally();\n this.setActive(collection.uuid);\n\n return collection;\n }\n\n saveLocally() {\n if (!this.hasAccountName) throw \"Databus-Collection-Manager is not initialized.\";\n\n if (this.activeCollection != null) {\n this.activeCollection.hasLocalChanges = this.hasLocalChanges(this.activeCollection);\n }\n\n var hash = DatabusCollectionUtils.cyrb53Hash(DatabusCollectionUtils.serialize(this.local));\n this.currentHash = hash;\n\n window.localStorage.setItem(`${this.storageKey}_hash`, hash);\n\n for (let identifier in this.local) {\n if (this.local[identifier].accountName == null) {\n delete (this.local[identifier]);\n }\n }\n\n try {\n //write local collections to local storage\n window.localStorage.setItem(this.storageKey, DatabusCollectionUtils.serialize(this.local));\n //write remote collections to session storage\n window.sessionStorage.setItem(this.storageKey, DatabusCollectionUtils.serialize(this.remote));\n } catch (e) {\n console.log(e);\n }\n }\n\n hasLocalChanges(localCollection) {\n if (this.remote[localCollection.uuid] === undefined) {\n return true;\n }\n\n let remoteCollection = this.remote[localCollection.uuid];\n\n if (remoteCollection.isHidden != localCollection.isHidden) {\n return true;\n }\n\n if (localCollection.title !== remoteCollection.title) {\n return true;\n }\n\n if (localCollection.description !== remoteCollection.description) {\n return true;\n }\n\n let serializedRemoteContent = DatabusCollectionUtils.serialize(remoteCollection.content);\n let serializedLocalContent = DatabusCollectionUtils.serialize(localCollection.content);\n\n return serializedLocalContent !== serializedRemoteContent;\n }\n\n discardLocalChanges() {\n\n if (!this.hasAccountName) throw \"Databus-Collection-Manager is not initialized.\";\n\n let uuid = this.activeCollection.uuid;\n\n if (this.remote[uuid] === undefined) {\n return;\n }\n\n let uri = this.activeCollection.uri;\n\n if (uri == undefined) {\n return;\n }\n\n this.local[uuid].title = this.remote[uuid].title;\n this.local[uuid].abstract = this.remote[uuid].abstract;\n this.local[uuid].description = this.remote[uuid].description;\n this.local[uuid].content = DatabusCollectionUtils.createCleanCopy(this.remote[uuid].content);\n this.local[uuid].hasLocalChanges = this.hasLocalChanges(this.local[uuid]);\n\n this.saveLocally();\n }\n\n addElement(elementQuery) {\n this.current.addElement(elementQuery);\n this.saveLocally();\n\n if (this.onActiveCollectionChanged != null) {\n this.onActiveCollectionChanged(this.current);\n }\n }\n\n removeElement(elementGuid) {\n this.current.removeElement(elementGuid);\n this.saveLocally();\n\n if (this.onActiveCollectionChanged != null) {\n this.onActiveCollectionChanged(this.current);\n }\n }\n\n\n\n createNew(accountName, title, description, callback) {\n if (!this.hasAccountName) throw \"Databus-Collection-Manager is not initialized.\";\n\n let reg = /^\\w+[\\w\\s]*$/;\n\n if (title === undefined || !reg.test(title)) {\n callback(false);\n return;\n }\n\n let collection = DatabusCollectionWrapper.createNew(title, description, DATABUS_RESOURCE_BASE_URL, accountName);\n\n this.local[collection.uuid] = new DatabusCollectionWrapper(collection);\n this.setActive(collection.uuid);\n this.saveLocally();\n\n callback(collection);\n }\n\n createDraft(callback) {\n if (!this.hasAccountName) {\n return;\n }\n\n let collection = DatabusCollectionWrapper.createNew('', '');\n this.local[collection.uuid] = new DatabusCollectionWrapper(collection);\n this.setActive(collection.uuid);\n this.saveLocally()\n\n callback(DatabusResponse.COLLECTION_DRAFT_CREATED);\n }\n\n createCopy(source) {\n if (!this.hasAccountName) throw \"Databus-Collection-Manager is not initialized.\";\n\n let collection = DatabusCollectionWrapper.createNew();\n collection.content = DatabusCollectionUtils.createCleanCopy(source.content);\n collection.title = `Copy of ${source.title}`;\n collection.abstract = source.abstract;\n collection.description = source.description;\n collection.accountName = this.accountName;\n\n this.local[collection.uuid] = new DatabusCollectionWrapper(collection);\n this.saveLocally();\n this.setActive(collection.uuid);\n\n return collection;\n }\n\n\n\n deleteLocally() {\n delete this.local[this.activeCollection.uuid];\n this.saveLocally();\n }\n\n /**\n * Returns the collection or null\n * @param {[type]} uri [description]\n * @return {[type]} [description]\n */\n getCollectionByUri(uri) {\n if (uri == null)\n return null;\n\n for (let identifier in this.local) {\n if (uri === this.local[identifier].uri) {\n return this.local[identifier];\n }\n }\n return null;\n }\n\n /**\n * Returns the first collection or null\n * @return {[type]} [description]\n */\n getFirstCollection() {\n if (this.local.length === 0) {\n return null;\n }\n return this.local[0];\n }\n\n\n async changeCollection(username, collectionUri) {\n try {\n if (!this.hasAccountName) throw \"Databus-Collection-Manager is not initialized.\";\n\n this.saveLocally();\n\n // Keep the identifier of the collection we want to push\n var pushIdentifier = this.activeCollection.uuid;\n var publisherUri = `${DATABUS_RESOURCE_BASE_URL}/${username}#this`;\n\n var ignoreKeys = [\n 'parent',\n '$$hashKey',\n 'expanded',\n 'files',\n 'eventListeners',\n 'hasLocalChanges',\n 'published',\n 'uuid',\n ];\n\n var contentString = encodeURIComponent(DatabusCollectionUtils.serialize(this.activeCollection.content, ignoreKeys));\n\n // Format collection as json-ld\n let collectionJsonLd = {\n \"@context\": DATABUS_CONTEXT[DatabusUris.JSONLD_CONTEXT],\n \"@graph\": [\n {\n \"@id\": collectionUri,\n \"@type\": \"Collection\",\n \"publisher\": publisherUri,\n \"title\": this.activeCollection.title,\n \"abstract\": this.activeCollection.abstract,\n \"description\": this.activeCollection.description,\n \"databus:collectionContent\": contentString,\n }\n ]\n };\n\n if (!this.activeCollection.isHidden) {\n collectionJsonLd[\"@graph\"][0].issued = DatabusUtils.timeStringNow();\n }\n\n var response = null;\n\n try {\n\n // var relativeUri = new URL(collectionUri).pathname;\n // response = await this.http.put(relativeUri, collectionJsonLd);\n\n response = await this.http.post('/api/register', collectionJsonLd);\n\n } catch (errResponse) {\n console.log(errResponse);\n throw { code: errResponse.data.code };\n }\n\n try {\n var relativeUri = new URL(collectionUri).pathname;\n\n var response = await this.http({\n method: 'GET',\n url: relativeUri,\n headers: {\n 'Accept': 'application/ld+json',\n 'X-Jsonld-Formatting': 'compact'\n }\n });\n\n\n } catch (errResponse) {\n console.log(errResponse);\n throw { code: errResponse.data.code };\n }\n\n // Get the remotely saved collection from the payload\n var remoteGraph = response.data;\n\n // If the user changed the active collection in the meantime throw an error. This\n // should be prevented by a loading dialog\n if (this.activeCollection.uuid != pushIdentifier) {\n throw { code: DatabusResponse.COLLECTION_INVALID_ARGUMENT };\n }\n\n this.local[pushIdentifier].uri = remoteGraph['@id'];\n this.local[pushIdentifier].hasLocalChanges = false;\n this.local[pushIdentifier].modified = remoteGraph.modified;\n this.local[pushIdentifier].issued = remoteGraph.issued;\n this.local[pushIdentifier].isHidden = remoteGraph.issued == null;\n // this.local[pushIdentifier].created = remoteGraph.created;\n\n //Update remote data\n this.remote[pushIdentifier] = JSON.parse(DatabusCollectionUtils.serialize(this.activeCollection));\n\n // Update the local data\n // this.local[pushIdentifier].uri = remoteGraph['@id'];\n //this.local[pushIdentifier].hasLocalChanges = this.hasLocalChanges(this.local[pushIdentifier]);\n //this.local[pushIdentifier].modified = this.activeCollection.modified;\n //this.local[pushIdentifier].issued = this.activeCollection.issued;\n //this.local[pushIdentifier].created = this.activeCollection.created;\n\n this.saveLocally();\n\n return response.data;\n\n } catch (err) {\n\n console.log(err);\n throw {\n code: err.data !== undefined && err.data.code !== undefined ? err.data.code :\n DatabusResponse.COLLECTION_UPDATE_ERROR\n };\n }\n }\n\n async updateCollection(username, collectionTag) {\n\n if (this.activeCollection.uri != null) {\n return await this.changeCollection(username, this.activeCollection.uri);\n } else {\n var collectionUri = `${DATABUS_RESOURCE_BASE_URL}/${username}/collections/${collectionTag}`;\n\n for (var uuid in this.local) {\n if (this.local[uuid].uri == collectionUri) {\n throw \"A collection with the specifed URI already exists.\";\n }\n }\n\n return await this.changeCollection(username, collectionUri);\n }\n }\n\n\n /**\n * Fetches the remote data of the current collection and assigns the field values to the local copy\n */\n async fetchCollection(uri) {\n try {\n if (!this.hasAccountName) throw \"Databus-Collection-Manager is not initialized.\";\n\n var req = {\n method: 'GET',\n url: uri,\n headers: { 'Accept': 'application/json' }\n };\n\n var getResponse = await this.http(req);\n var collection = getCollectionByUri(uri);\n\n this.local[collection.uuid].content = getResponse.data.content;\n this.local[collection.uuid].created = getResponse.data.created;\n this.local[collection.uuid].issued = getResponse.data.issued;\n this.local[collection.uuid].title = getResponse.data.title;\n this.local[collection.uuid].description = getResponse.data.description;\n this.local[collection.uuid].files = getResponse.data.files;\n } catch (errResponse) {\n console.log(errResponse);\n return errResponse.data;\n }\n }\n\n async deleteCollection(username, collectionTag) {\n try {\n if (!this.hasAccountName) throw \"Databus-Collection-Manager is not initialized.\";\n\n\n\n // Keep the identifier of the collection we want to push\n let deleteIdentifier = this.activeCollection.uuid;\n\n if (this.activeCollection.isDraft) {\n delete this.local[deleteIdentifier];\n this.saveLocally();\n return { code: DatabusResponse.COLLECTION_DELETED };\n }\n\n var targetUri = `/${username}/collections/${collectionTag}`;\n\n let deleteResponse = await this.http.delete(targetUri);\n\n delete this.remote[deleteIdentifier];\n delete this.local[deleteIdentifier];\n\n return deleteResponse.data;\n } catch (errResponse) {\n console.log(errResponse);\n return errResponse.data;\n }\n }\n\n /**\n * Deletes the active collection from the server but keeps the local storage entry\n */\n async unpublishActiveCollection() {\n\n if (!this.hasAccountName) throw \"Databus-Collection-Manager is not initialized.\";\n\n if (this.activeCollection.isDraft) {\n throw \"Cannot unpublish an unpublished draft\";\n }\n\n // Keep the identifier of the collection we want to push\n let uuid = this.activeCollection.uuid;\n let identifier = DatabusUtils.uriToName(this.activeCollection.uri);\n\n var targetUri = `/${this.accountName}/collections/${identifier}`;\n await this.http.delete(targetUri);\n\n delete this.remote[uuid];\n delete this.local[uuid].uri;\n delete this.local[uuid].issued;\n this.saveLocally();\n }\n}\n\n\nmodule.exports = DatabusCollectionManager;\n\n//# sourceURL=webpack://databus-webapp/./js/collections/databus-collection-manager.js?\n}"); -/***/ }), +/***/ }, -/***/ "./js/collections/databus-collection-utils.js": +/***/ "./js/collections/databus-collection-utils.js" /*!****************************************************!*\ !*** ./js/collections/databus-collection-utils.js ***! \****************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +(module, __unused_webpack_exports, __webpack_require__) { -eval("const QueryBuilder = __webpack_require__(/*! ../query-builder/query-builder */ \"./js/query-builder/query-builder.js\");\nconst QueryTemplates = __webpack_require__(/*! ../query-builder/query-templates */ \"./js/query-builder/query-templates.js\");\nconst DatabusConstants = __webpack_require__(/*! ../utils/databus-constants */ \"./js/utils/databus-constants.js\");\nconst DatabusMessages = __webpack_require__(/*! ../utils/databus-messages */ \"./js/utils/databus-messages.js\");\nconst DatabusUtils = __webpack_require__(/*! ../utils/databus-utils */ \"./js/utils/databus-utils.js\");\n\nclass DatabusCollectionUtils {\n\n static CEDIT_IDENTIFIER_REGEX = /^[a-z0-9_-]{3,50}$/;\n static CEDIT_TITLE_REGEX = /^[A-Za-z0-9\\s_()\\.\\,\\-]{3,200}$/;\n static CEDIT_ABSTRACT_REGEX = /^[\\x00-\\xFF\\n]{10,}$/;\n static CEDIT_DESCRIPTION_REGEX = /^[\\x00-\\xFF\\n]{10,}$/;\n\n static formatMessageWithRegex(message, regex) {\n var regexString = regex.source;\n return message.replace(\"#REGEX#\", regexString);\n }\n\n static checkCollectionForm(form, collection) {\n\n var hasError = false;\n\n form.identifier.error = null;\n form.title.error = null;\n form.abstract.error = null;\n form.description.error = null;\n\n if (collection.isDraft) {\n\n // Check the identifier\n if (!this.CEDIT_IDENTIFIER_REGEX.test(form.identifier.value)) {\n hasError = true;\n form.identifier.error = this.formatMessageWithRegex(\n DatabusMessages.CEDIT_INVALID_IDENTIFIER,\n this.CEDIT_IDENTIFIER_REGEX\n );\n }\n }\n\n // Check the title\n if (!this.CEDIT_TITLE_REGEX.test(collection.title)) {\n hasError = true;\n form.title.error = this.formatMessageWithRegex(\n DatabusMessages.CEDIT_INVALID_TITLE,\n this.CEDIT_TITLE_REGEX\n );\n }\n\n // Check the abstract\n if (!this.CEDIT_ABSTRACT_REGEX.test(collection.abstract)) {\n hasError = true;\n form.abstract.error = this.formatMessageWithRegex(\n DatabusMessages.CEDIT_INVALID_ABSTRACT,\n this.CEDIT_ABSTRACT_REGEX\n );\n }\n\n // Check the description\n if (!this.CEDIT_DESCRIPTION_REGEX.test(collection.description)) {\n hasError = true;\n form.description.error = this.formatMessageWithRegex(\n DatabusMessages.CEDIT_INVALID_DESCRIPTION,\n this.CEDIT_DESCRIPTION_REGEX\n );\n }\n\n return !hasError;\n }\n\n\n\n\n static checkIdentifier(identifier) {\n var identifierRegex = /^[a-z0-9_-]{3, 50}$/;\n return this.checkField(identifier, identifierRegex, 3, 50);\n }\n\n static checkText(value, min, max) {\n var textRegex = /^[\\x00-\\xFF\\n]*$/;\n return this.checkField(value, textRegex, min, max);\n }\n\n static checkLabel(value, min, max) {\n var labelRegex = /^[A-Za-z0-9\\s_()\\.\\,\\-]*$/;\n return this.checkField(value, labelRegex, min, max);\n }\n\n static checkField(value, regex, min, max) {\n if (value == undefined) {\n return false;\n }\n\n if (max > 0 && value.length > max) {\n return false;\n }\n\n if (value.length < min) {\n return false;\n }\n\n return regex.test(value);\n }\n\n\n // Checks whether a collection can be saved\n static checkCollectionTexts(collection) {\n var labelReg = /^[\\x00-\\x7F]*$/;\n var textReg = /^[\\x00-\\x7F\\n]*$/;\n\n if (collection.label == undefined || collection.label == \"\") {\n return DatabusResponse.COLLECTION_MISSING_LABEL;\n }\n\n if (!labelReg.test(collection.label) || collection.label.length > 200) {\n return DatabusResponse.COLLECTION_INVALID_LABEL;\n }\n\n if (collection.description == undefined || collection.description == \"\") {\n return DatabusResponse.COLLECTION_MISSING_DESCRIPTION;\n }\n\n if (!textReg.test(collection.description) || description.description.length < 50) {\n return DatabusResponse.COLLECTION_INVALID_DESCRIPTION;\n }\n\n return 0;\n }\n\n\n // Creates a v4 uuid\n static uuidv4() {\n return '___xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {\n var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);\n return v.toString(16);\n });\n }\n\n static createQueryString(collection) {\n var wrapper = new DatabusCollectionWrapper(collection);\n return wrapper.createQuery();\n }\n\n static reduceBinding(binding) {\n for (var key in binding) {\n binding[key] = binding[key].value;\n }\n\n return binding;\n }\n\n\n static formatQuery(query, placeholderMappings) {\n\n if (placeholderMappings == undefined) {\n return query;\n }\n\n for (var placeholder in placeholderMappings) {\n var re = new RegExp('%' + placeholder + '%', \"g\");\n query = query.replace(re, placeholderMappings[placeholder]);\n }\n\n return query;\n }\n\n static async getCollectionStatistics($http, collection) {\n\n var query = QueryBuilder.build({\n node: collection.content.root,\n resourceBaseUrl: DATABUS_RESOURCE_BASE_URL,\n template: QueryTemplates.COLLECTION_STATISTICS_TEMPLATE\n });\n\n if (query == null) return null;\n\n var req = {\n method: 'POST',\n url: DatabusConstants.DATABUS_SPARQL_ENDPOINT_URL,\n data: \"format=json&timeout=1000000&query=\" + encodeURIComponent(query),\n headers: {\n \"Content-type\": \"application/x-www-form-urlencoded\"\n },\n }\n\n var response = await $http(req);\n var entries = response.data.results.bindings;\n\n entries = entries.filter(function (e) {\n return e.file != undefined;\n });\n\n if (entries.length === 0) {\n return null;\n }\n\n\n let result = {\n fileCount: entries.length,\n licenses: [],\n files: [],\n size: 0\n };\n\n for (let i in entries) {\n let element = DatabusCollectionUtils.reduceBinding(entries[i]);\n\n result.size += parseInt(element.size);\n result.licenses.push(element.license);\n result.files.push(element);\n }\n\n result.licenses = result.licenses.filter(function (item, pos, self) {\n return self.indexOf(item) === pos;\n });\n\n return result;\n }\n\n static async getCollectionFiles($http, collection) {\n\n if (!collection.hasContent) {\n return [];\n }\n\n let query = QueryBuilder.build({\n node: collection.content.root,\n resourceBaseUrl: DATABUS_RESOURCE_BASE_URL,\n template: QueryTemplates.DISTRIBUTIONS_TEMPLATE\n });\n\n var req = {\n method: 'POST',\n url: DatabusConstants.DATABUS_SPARQL_ENDPOINT_URL,\n data: \"format=json&query=\" + encodeURIComponent(query),\n headers: {\n \"Content-type\": \"application/x-www-form-urlencoded\"\n },\n }\n\n var response = await $http(req);\n var entries = response.data.results.bindings;\n\n if (entries.length === 0) {\n return null;\n }\n\n var distributions = {};\n var bindings = [];\n\n for (var entry of entries) {\n var uri = entry.distribution.value;\n var databusUri = DatabusCollectionUtils.navigateUp(uri, 4);\n\n if (distributions[databusUri] == null) {\n distributions[databusUri] = [];\n }\n\n distributions[databusUri].push(`<${uri}>`);\n }\n\n for (var databusUri in distributions) {\n\n var distributionsString = distributions[databusUri].join('\\n');\n\n var params = {};\n params.DISTRIBUTIONS = distributionsString;\n\n let fileQuery = DatabusCollectionUtils.formatQuery(QueryTemplates.COLLECTION_TABLE_QUERY, params);\n\n var req = {\n method: 'POST',\n url: `${databusUri}${DatabusConstants.DATABUS_SPARQL_ENDPOINT_URL}`,\n data: \"format=json&query=\" + encodeURIComponent(fileQuery),\n headers: {\n \"Content-type\": \"application/x-www-form-urlencoded\"\n },\n }\n\n response = await $http(req);\n\n for (var binding of response.data.results.bindings) {\n binding.databus = databusUri;\n bindings.push(binding);\n }\n }\n\n // Postproccess\n let result = [];\n\n for (var binding of bindings) {\n binding = DatabusCollectionUtils.reduceBinding(binding);\n\n var variant = binding.variant;\n\n if(variant != undefined) {\n var variants = variant.split(',');\n\n var cleanedVariants = [];\n\n for (var v of variants) {\n if (v != \"\" && v != \" \") {\n cleanedVariants.push(v);\n }\n }\n\n binding.variant = cleanedVariants.join(\",\");\n }\n\n result.push(binding);\n }\n\n\n /*\n for (var entry of entries) {\n\n try {\n console.log(entry.distribution.value);\n\n var params = {};\n params.DISTRIBUTION = entry.distribution.value;\n\n let fileQuery = DatabusUtils.formatQuery(QueryTemplates.COLLECTION_TABLE_ROW_QUERY, params);\n\n var req = {\n method: 'POST',\n url: DatabusConstants.DATABUS_SPARQL_ENDPOINT_URL,\n data: \"format=json&query=\" + encodeURIComponent(fileQuery),\n headers: {\n \"Content-type\": \"application/x-www-form-urlencoded\"\n },\n }\n\n response = await $http(req);\n\n if (response.data.results.bindings.length === 0) {\n continue;\n }\n\n result.push(DatabusCollectionUtils.reduceBinding(response.data.results.bindings[0]));\n\n } catch(err) {\n console.log(err);\n }\n }\n\n // Postprocess:\n\n\n\n for (let i in entries) {\n let element = DatabusCollectionUtils.reduceBinding(entries[i]);\n result.push(element);\n }\n */\n\n return result;\n }\n\n\n\n static navigateUp(uri, steps) {\n\n if (steps == undefined) {\n steps = 1;\n }\n\n for (var i = 0; i < steps; i++) {\n uri = uri.substr(0, uri.lastIndexOf('/'));\n }\n\n if (uri.includes('#')) {\n uri = uri.substr(0, uri.lastIndexOf('#'));\n }\n\n return uri;\n }\n\n static async getCollectionFileURLs($http, collection) {\n\n let query = QueryBuilder.build({\n node: collection.content.root,\n resourceBaseUrl: DATABUS_RESOURCE_BASE_URL,\n template: QueryTemplates.DEFAULT_FILE_TEMPLATE\n });\n\n var req = {\n method: 'POST',\n url: DatabusConstants.DATABUS_SPARQL_ENDPOINT_URL,\n data: \"format=json&query=\" + encodeURIComponent(query),\n headers: {\n \"Content-type\": \"application/x-www-form-urlencoded\"\n },\n }\n\n var response = await $http(req);\n var entries = response.data.results.bindings;\n\n if (entries.length === 0) {\n return null;\n }\n\n let result = \"\";\n\n for (let i in entries) {\n let element = DatabusCollectionUtils.reduceBinding(entries[i]);\n result += element.file + '\\n';\n }\n\n return result;\n }\n\n /*\n static copyData(data) {\n return JSON.parse(JSON.stringify(data));\n }*/\n\n static serialize(collectionObject, ignoreKeys) {\n\n if (ignoreKeys == undefined) {\n ignoreKeys = [\n 'parent',\n '$$hashKey',\n 'expanded',\n 'files',\n 'eventListeners',\n 'hasLocalChanges',\n 'published'\n ];\n }\n\n return JSON.stringify(collectionObject, function (key, value) {\n if (ignoreKeys.includes(key)) {\n return undefined;\n }\n\n return value;\n });\n }\n\n static cyrb53Hash(str, seed = 0) {\n let h1 = 0xdeadbeef ^ seed,\n h2 = 0x41c6ce57 ^ seed;\n for (let i = 0, ch; i < str.length; i++) {\n ch = str.charCodeAt(i);\n h1 = Math.imul(h1 ^ ch, 2654435761);\n h2 = Math.imul(h2 ^ ch, 1597334677);\n }\n\n h1 = Math.imul(h1 ^ (h1 >>> 16), 2246822507) ^ Math.imul(h2 ^ (h2 >>> 13), 3266489909);\n h2 = Math.imul(h2 ^ (h2 >>> 16), 2246822507) ^ Math.imul(h1 ^ (h1 >>> 13), 3266489909);\n\n return 4294967296 * (2097151 & h2) + (h1 >>> 0);\n };\n\n static createCleanCopy(jsonData) {\n\n var data = JSON.parse(DatabusCollectionUtils.serialize(jsonData));\n return data;\n }\n\n static exportToJsonFile(jsonData) {\n\n var ignoreKeys = [\n 'parent',\n '$$hashKey',\n 'expanded',\n 'files',\n 'eventListeners',\n 'hasLocalChanges',\n 'published',\n 'uuid'\n ];\n\n let dataStr = DatabusCollectionUtils.serialize(jsonData, ignoreKeys);\n let dataUri = 'data:application/json;charset=utf-8,' + encodeURIComponent(dataStr);\n\n let exportFileDefaultName = 'data.json';\n\n let linkElement = document.createElement('a');\n linkElement.setAttribute('href', dataUri);\n linkElement.setAttribute('download', exportFileDefaultName);\n linkElement.click();\n }\n\n}\n\nmodule.exports = DatabusCollectionUtils;\n\n\n//# sourceURL=webpack://databus-webapp/./js/collections/databus-collection-utils.js?"); +eval("{const QueryBuilder = __webpack_require__(/*! ../query-builder/query-builder */ \"./js/query-builder/query-builder.js\");\nconst QueryTemplates = __webpack_require__(/*! ../query-builder/query-templates */ \"./js/query-builder/query-templates.js\");\nconst DatabusConstants = __webpack_require__(/*! ../utils/databus-constants */ \"./js/utils/databus-constants.js\");\nconst DatabusMessages = __webpack_require__(/*! ../utils/databus-messages */ \"./js/utils/databus-messages.js\");\nconst DatabusUtils = __webpack_require__(/*! ../utils/databus-utils */ \"./js/utils/databus-utils.js\");\n\nclass DatabusCollectionUtils {\n\n static CEDIT_IDENTIFIER_REGEX = /^[a-z0-9_-]{3,50}$/;\n static CEDIT_TITLE_REGEX = /^[A-Za-z0-9\\s_()\\.\\,\\-]{3,200}$/;\n static CEDIT_ABSTRACT_REGEX = /^[\\x00-\\xFF\\n]{10,}$/;\n static CEDIT_DESCRIPTION_REGEX = /^[\\x00-\\xFF\\n]{10,}$/;\n\n static formatMessageWithRegex(message, regex) {\n var regexString = regex.source;\n return message.replace(\"#REGEX#\", regexString);\n }\n\n static checkCollectionForm(form, collection) {\n\n var hasError = false;\n\n form.identifier.error = null;\n form.title.error = null;\n form.abstract.error = null;\n form.description.error = null;\n\n if (collection.isDraft) {\n\n // Check the identifier\n if (!this.CEDIT_IDENTIFIER_REGEX.test(form.identifier.value)) {\n hasError = true;\n form.identifier.error = this.formatMessageWithRegex(\n DatabusMessages.CEDIT_INVALID_IDENTIFIER,\n this.CEDIT_IDENTIFIER_REGEX\n );\n }\n }\n\n // Check the title\n if (!this.CEDIT_TITLE_REGEX.test(collection.title)) {\n hasError = true;\n form.title.error = this.formatMessageWithRegex(\n DatabusMessages.CEDIT_INVALID_TITLE,\n this.CEDIT_TITLE_REGEX\n );\n }\n\n // Check the abstract\n if (!this.CEDIT_ABSTRACT_REGEX.test(collection.abstract)) {\n hasError = true;\n form.abstract.error = this.formatMessageWithRegex(\n DatabusMessages.CEDIT_INVALID_ABSTRACT,\n this.CEDIT_ABSTRACT_REGEX\n );\n }\n\n // Check the description\n if (!this.CEDIT_DESCRIPTION_REGEX.test(collection.description)) {\n hasError = true;\n form.description.error = this.formatMessageWithRegex(\n DatabusMessages.CEDIT_INVALID_DESCRIPTION,\n this.CEDIT_DESCRIPTION_REGEX\n );\n }\n\n return !hasError;\n }\n\n\n\n\n static checkIdentifier(identifier) {\n var identifierRegex = /^[a-z0-9_-]{3, 50}$/;\n return this.checkField(identifier, identifierRegex, 3, 50);\n }\n\n static checkText(value, min, max) {\n var textRegex = /^[\\x00-\\xFF\\n]*$/;\n return this.checkField(value, textRegex, min, max);\n }\n\n static checkLabel(value, min, max) {\n var labelRegex = /^[A-Za-z0-9\\s_()\\.\\,\\-]*$/;\n return this.checkField(value, labelRegex, min, max);\n }\n\n static checkField(value, regex, min, max) {\n if (value == undefined) {\n return false;\n }\n\n if (max > 0 && value.length > max) {\n return false;\n }\n\n if (value.length < min) {\n return false;\n }\n\n return regex.test(value);\n }\n\n\n // Checks whether a collection can be saved\n static checkCollectionTexts(collection) {\n var labelReg = /^[\\x00-\\x7F]*$/;\n var textReg = /^[\\x00-\\x7F\\n]*$/;\n\n if (collection.label == undefined || collection.label == \"\") {\n return DatabusResponse.COLLECTION_MISSING_LABEL;\n }\n\n if (!labelReg.test(collection.label) || collection.label.length > 200) {\n return DatabusResponse.COLLECTION_INVALID_LABEL;\n }\n\n if (collection.description == undefined || collection.description == \"\") {\n return DatabusResponse.COLLECTION_MISSING_DESCRIPTION;\n }\n\n if (!textReg.test(collection.description) || description.description.length < 50) {\n return DatabusResponse.COLLECTION_INVALID_DESCRIPTION;\n }\n\n return 0;\n }\n\n\n // Creates a v4 uuid\n static uuidv4() {\n return '___xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {\n var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);\n return v.toString(16);\n });\n }\n\n static createQueryString(collection) {\n var wrapper = new DatabusCollectionWrapper(collection);\n return wrapper.createQuery();\n }\n\n static reduceBinding(binding) {\n for (var key in binding) {\n binding[key] = binding[key].value;\n }\n\n return binding;\n }\n\n\n static formatQuery(query, placeholderMappings) {\n\n if (placeholderMappings == undefined) {\n return query;\n }\n\n for (var placeholder in placeholderMappings) {\n var re = new RegExp('%' + placeholder + '%', \"g\");\n query = query.replace(re, placeholderMappings[placeholder]);\n }\n\n return query;\n }\n\n static async getCollectionStatistics($http, collection) {\n\n var query = QueryBuilder.build({\n node: collection.content.root,\n resourceBaseUrl: DATABUS_RESOURCE_BASE_URL,\n template: QueryTemplates.COLLECTION_STATISTICS_TEMPLATE\n });\n\n if (query == null) return null;\n\n var req = {\n method: 'POST',\n url: DatabusConstants.DATABUS_SPARQL_ENDPOINT_URL,\n data: \"format=json&timeout=1000000&query=\" + encodeURIComponent(query),\n headers: {\n \"Content-type\": \"application/x-www-form-urlencoded\"\n },\n }\n\n var response = await $http(req);\n var entries = response.data.results.bindings;\n\n entries = entries.filter(function (e) {\n return e.file != undefined;\n });\n\n if (entries.length === 0) {\n return null;\n }\n\n\n let result = {\n fileCount: entries.length,\n licenses: [],\n files: [],\n size: 0\n };\n\n for (let i in entries) {\n let element = DatabusCollectionUtils.reduceBinding(entries[i]);\n\n result.size += parseInt(element.size);\n result.licenses.push(element.license);\n result.files.push(element);\n }\n\n result.licenses = result.licenses.filter(function (item, pos, self) {\n return self.indexOf(item) === pos;\n });\n\n return result;\n }\n\n static async getCollectionFiles($http, collection) {\n\n if (!collection.hasContent) {\n return [];\n }\n\n let query = QueryBuilder.build({\n node: collection.content.root,\n resourceBaseUrl: DATABUS_RESOURCE_BASE_URL,\n template: QueryTemplates.DISTRIBUTIONS_TEMPLATE\n });\n\n var req = {\n method: 'POST',\n url: DatabusConstants.DATABUS_SPARQL_ENDPOINT_URL,\n data: \"format=json&query=\" + encodeURIComponent(query),\n headers: {\n \"Content-type\": \"application/x-www-form-urlencoded\"\n },\n }\n\n var response = await $http(req);\n var entries = response.data.results.bindings;\n\n if (entries.length === 0) {\n return null;\n }\n\n var distributions = {};\n var bindings = [];\n\n for (var entry of entries) {\n var uri = entry.distribution.value;\n var databusUri = DatabusCollectionUtils.navigateUp(uri, 4);\n\n if (distributions[databusUri] == null) {\n distributions[databusUri] = [];\n }\n\n distributions[databusUri].push(`<${uri}>`);\n }\n\n for (var databusUri in distributions) {\n\n var distributionsString = distributions[databusUri].join('\\n');\n\n var params = {};\n params.DISTRIBUTIONS = distributionsString;\n\n let fileQuery = DatabusCollectionUtils.formatQuery(QueryTemplates.COLLECTION_TABLE_QUERY, params);\n\n var req = {\n method: 'POST',\n url: `${databusUri}${DatabusConstants.DATABUS_SPARQL_ENDPOINT_URL}`,\n data: \"format=json&query=\" + encodeURIComponent(fileQuery),\n headers: {\n \"Content-type\": \"application/x-www-form-urlencoded\"\n },\n }\n\n response = await $http(req);\n\n for (var binding of response.data.results.bindings) {\n binding.databus = databusUri;\n bindings.push(binding);\n }\n }\n\n // Postproccess\n let result = [];\n\n for (var binding of bindings) {\n binding = DatabusCollectionUtils.reduceBinding(binding);\n\n var variant = binding.variant;\n\n if(variant != undefined) {\n var variants = variant.split(',');\n\n var cleanedVariants = [];\n\n for (var v of variants) {\n if (v != \"\" && v != \" \") {\n cleanedVariants.push(v);\n }\n }\n\n binding.variant = cleanedVariants.join(\",\");\n }\n\n result.push(binding);\n }\n\n\n /*\n for (var entry of entries) {\n\n try {\n console.log(entry.distribution.value);\n\n var params = {};\n params.DISTRIBUTION = entry.distribution.value;\n\n let fileQuery = DatabusUtils.formatQuery(QueryTemplates.COLLECTION_TABLE_ROW_QUERY, params);\n\n var req = {\n method: 'POST',\n url: DatabusConstants.DATABUS_SPARQL_ENDPOINT_URL,\n data: \"format=json&query=\" + encodeURIComponent(fileQuery),\n headers: {\n \"Content-type\": \"application/x-www-form-urlencoded\"\n },\n }\n\n response = await $http(req);\n\n if (response.data.results.bindings.length === 0) {\n continue;\n }\n\n result.push(DatabusCollectionUtils.reduceBinding(response.data.results.bindings[0]));\n\n } catch(err) {\n console.log(err);\n }\n }\n\n // Postprocess:\n\n\n\n for (let i in entries) {\n let element = DatabusCollectionUtils.reduceBinding(entries[i]);\n result.push(element);\n }\n */\n\n return result;\n }\n\n\n\n static navigateUp(uri, steps) {\n\n if (steps == undefined) {\n steps = 1;\n }\n\n for (var i = 0; i < steps; i++) {\n uri = uri.substr(0, uri.lastIndexOf('/'));\n }\n\n if (uri.includes('#')) {\n uri = uri.substr(0, uri.lastIndexOf('#'));\n }\n\n return uri;\n }\n\n static async getCollectionFileURLs($http, collection) {\n\n let query = QueryBuilder.build({\n node: collection.content.root,\n resourceBaseUrl: DATABUS_RESOURCE_BASE_URL,\n template: QueryTemplates.DEFAULT_FILE_TEMPLATE\n });\n\n var req = {\n method: 'POST',\n url: DatabusConstants.DATABUS_SPARQL_ENDPOINT_URL,\n data: \"format=json&query=\" + encodeURIComponent(query),\n headers: {\n \"Content-type\": \"application/x-www-form-urlencoded\"\n },\n }\n\n var response = await $http(req);\n var entries = response.data.results.bindings;\n\n if (entries.length === 0) {\n return null;\n }\n\n let result = \"\";\n\n for (let i in entries) {\n let element = DatabusCollectionUtils.reduceBinding(entries[i]);\n result += element.file + '\\n';\n }\n\n return result;\n }\n\n /*\n static copyData(data) {\n return JSON.parse(JSON.stringify(data));\n }*/\n\n static serialize(collectionObject, ignoreKeys) {\n\n if (ignoreKeys == undefined) {\n ignoreKeys = [\n 'parent',\n '$$hashKey',\n 'expanded',\n 'files',\n 'eventListeners',\n 'hasLocalChanges',\n 'published'\n ];\n }\n\n return JSON.stringify(collectionObject, function (key, value) {\n if (ignoreKeys.includes(key)) {\n return undefined;\n }\n\n return value;\n });\n }\n\n static cyrb53Hash(str, seed = 0) {\n let h1 = 0xdeadbeef ^ seed,\n h2 = 0x41c6ce57 ^ seed;\n for (let i = 0, ch; i < str.length; i++) {\n ch = str.charCodeAt(i);\n h1 = Math.imul(h1 ^ ch, 2654435761);\n h2 = Math.imul(h2 ^ ch, 1597334677);\n }\n\n h1 = Math.imul(h1 ^ (h1 >>> 16), 2246822507) ^ Math.imul(h2 ^ (h2 >>> 13), 3266489909);\n h2 = Math.imul(h2 ^ (h2 >>> 16), 2246822507) ^ Math.imul(h1 ^ (h1 >>> 13), 3266489909);\n\n return 4294967296 * (2097151 & h2) + (h1 >>> 0);\n };\n\n static createCleanCopy(jsonData) {\n\n var data = JSON.parse(DatabusCollectionUtils.serialize(jsonData));\n return data;\n }\n\n static exportToJsonFile(jsonData) {\n\n var ignoreKeys = [\n 'parent',\n '$$hashKey',\n 'expanded',\n 'files',\n 'eventListeners',\n 'hasLocalChanges',\n 'published',\n 'uuid'\n ];\n\n let dataStr = DatabusCollectionUtils.serialize(jsonData, ignoreKeys);\n let dataUri = 'data:application/json;charset=utf-8,' + encodeURIComponent(dataStr);\n\n let exportFileDefaultName = 'data.json';\n\n let linkElement = document.createElement('a');\n linkElement.setAttribute('href', dataUri);\n linkElement.setAttribute('download', exportFileDefaultName);\n linkElement.click();\n }\n\n}\n\nmodule.exports = DatabusCollectionUtils;\n\n\n//# sourceURL=webpack://databus-webapp/./js/collections/databus-collection-utils.js?\n}"); -/***/ }), +/***/ }, -/***/ "./js/collections/databus-collection-wrapper.js": +/***/ "./js/collections/databus-collection-wrapper.js" /*!******************************************************!*\ !*** ./js/collections/databus-collection-wrapper.js ***! \******************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +(module, __unused_webpack_exports, __webpack_require__) { -eval("const QueryBuilder = __webpack_require__(/*! ../query-builder/query-builder */ \"./js/query-builder/query-builder.js\");\nconst QueryNode = __webpack_require__(/*! ../query-builder/query-node */ \"./js/query-builder/query-node.js\");\nconst QueryTemplates = __webpack_require__(/*! ../query-builder/query-templates */ \"./js/query-builder/query-templates.js\");\nconst DatabusUtils = __webpack_require__(/*! ../utils/databus-utils */ \"./js/utils/databus-utils.js\");\n\nclass DatabusCollectionWrapper {\n\n /**\n * Creates a new DatabusCollection from an already existing\n * @param {[type]} data [description]\n */\n constructor(data) {\n Object.assign(this, data);\n this.eventListeners = {};\n }\n\n addEventListener(name, callback) {\n if(this.eventListeners[name] == undefined) {\n this.eventListeners[name] = [];\n }\n\n this.eventListeners[name].push(callback);\n }\n\n isPublisher(username) {\n return this.uri != undefined && this.uri.startsWith('https://databus.dbpedia.org/' + username);\n }\n\n get isPublished() {\n return this.issued != undefined;\n }\n\n get displayLabelHtml() {\n var l = '';\n if(this.isDraft) {\n l += 'DRAFT:';\n }\n l += (this.label != undefined && this.label.length > 0) ? this.label : 'Untitled Collection';\n return l;\n }\n\n get isDraft() {\n return this.uri === undefined;\n }\n\n get hasContent() {\n\n if(this.content.root.childNodes.length == 0) {\n return false;\n }\n\n for(var childNode of this.content.root.childNodes) {\n if(childNode.childNodes.length > 0) {\n return true;\n }\n }\n\n return false;\n }\n\n fireEvent(name) {\n if(this.eventListeners[name] == undefined) {\n return;\n }\n\n for(var c in this.eventListeners[name]) {\n var callback = this.eventListeners[name][c];\n callback();\n }\n }\n\n\n static createNew(title, description, source, accountName) {\n var data = {};\n data.uuid = DatabusUtils.uuidv4();\n data.title = title;\n data.description = description;\n data.accountName = accountName;\n data.abstract = description;\n data.content = {};\n data.content.root = new QueryNode(null, null);\n data.content.root.addChild(new QueryNode(source, null));\n\n return data;\n }\n\n /**\n * Builds a composed query from all elements\n * @return {[type]} [description]\n */\n createQuery() {\n\n if(this.content.root == undefined) {\n return null;\n }\n\n return QueryBuilder.build({\n template : QueryTemplates.DEFAULT_FILE_TEMPLATE,\n resourceBaseUrl : DATABUS_RESOURCE_BASE_URL,\n node: this.content.root\n });\n }\n\n /**\n * Downloads the entire collection object as json\n * @return {[type]} [description]\n */\n downloadAsJson(){\n var dataStr = \"data:text/json;charset=utf-8,\" + encodeURIComponent(angular.toJson(this));\n var downloadAnchorNode = document.createElement('a');\n downloadAnchorNode.setAttribute(\"href\", dataStr);\n downloadAnchorNode.setAttribute(\"download\", this.title + \".json\");\n document.body.appendChild(downloadAnchorNode); // required for firefox\n downloadAnchorNode.click();\n downloadAnchorNode.remove();\n }\n\n removeCustomQueryNode(node) {\n this.content.customQueries = this.content.customQueries.filter(function(n){\n return node.guid != n.guid;\n });\n }\n\n removeNodeByUri(uri) {\n QueryNode.removeChildByUri(this.content.root, uri);\n }\n\n getParentNode(node) {\n return QueryNode.findParentNodeRecursive(this.content.root, node);\n }\n\n removeGroupNode(groupNode) {\n this.content.groups = this.content.groups.filter(function(a){\n return groupNode.uri != a.uri;\n });\n }\n\n addCustomQueryNode(label, query) {\n this.content.customQueries.push({\n guid : DatabusUtils.uuidv4(),\n label : label,\n query : query,\n });\n }\n\n hasGroup(groupUri) {\n var group = this.findGroup(groupUri);\n return group != undefined;\n }\n\n hasArtifact(artifactUri) {\n var groupUri = DatabusUtils.navigateUp(artifactUri);\n\n var group = this.findGroup(groupUri);\n\n if(group == undefined) {\n return false;\n }\n\n var artifact = this.findArtifact(group, artifactUri);\n return artifact != undefined;\n }\n\n /**\n * Adds a new group node with label, uri and settings\n * @param {[type]} groupUri [description]\n * @param {[type]} groupLabel [description]\n * @param {[type]} settings [description]\n */\n addGroupNode(groupUri, settings) {\n\n var group = this.findGroup(groupUri);\n\n if(group == undefined) {\n\n var publisherUri = DatabusUtils.navigateUp(groupUri);\n\n var groupLabel = DatabusUtils.uriToName(groupUri);\n var publisherLabel = DatabusUtils.uriToName(publisherUri);\n\n group = {};\n group.uri = groupUri;\n group.artifacts = [];\n group.label = publisherLabel + \" » \" + groupLabel;\n group.settings = settings;\n group.expanded = true;\n\n this.content.groups.push(group);\n\n this.fireEvent(\"onGroupAdded\");\n }\n\n return group;\n }\n\n /**\n * Adds a new artifact node with label uri and settings\n * This will fail if the appropriate group node has not been\n * added previously\n * @param {[type]} artifactUri [description]\n * @param {[type]} artifactLabel [description]\n * @param {[type]} settings [description]\n */\n addArtifactNode(artifactUri, artifactLabel, settings) {\n\n var groupUri = DatabusUtils.navigateUp(artifactUri);\n var group = this.addGroupNode(groupUri, [ \n {\n facet: \"http://purl.org/dc/terms/hasVersion\",\n value: \"SYSTEM_LATEST_ARTIFACT_VERSION\",\n checked: true\n }]);\n\n var artifact = this.findArtifact(group, artifactUri);\n\n if(artifact == undefined) {\n artifact = {};\n artifact.uri = artifactUri;\n artifact.label = artifactLabel;\n artifact.settings = settings;\n\n group.artifacts.push(artifact);\n \n // TODO: merge facets\n \n\n this.fireEvent(\"onArtifactAdded\");\n }\n }\n\n findGroup(groupUri) {\n for(var g in this.content.groups) {\n var group = this.content.groups[g];\n\n if(group.uri == groupUri) {\n return group;\n }\n }\n\n return null;\n }\n\n findArtifact(group, artifactUri) {\n for(var a in group.artifacts) {\n var artifact = group.artifacts[a];\n\n if(artifact.uri == artifactUri) {\n return artifact;\n }\n }\n\n return null;\n }\n}\n\nmodule.exports = DatabusCollectionWrapper;\n\n//# sourceURL=webpack://databus-webapp/./js/collections/databus-collection-wrapper.js?"); +eval("{const QueryBuilder = __webpack_require__(/*! ../query-builder/query-builder */ \"./js/query-builder/query-builder.js\");\nconst QueryNode = __webpack_require__(/*! ../query-builder/query-node */ \"./js/query-builder/query-node.js\");\nconst QueryTemplates = __webpack_require__(/*! ../query-builder/query-templates */ \"./js/query-builder/query-templates.js\");\nconst DatabusUtils = __webpack_require__(/*! ../utils/databus-utils */ \"./js/utils/databus-utils.js\");\n\nclass DatabusCollectionWrapper {\n\n /**\n * Creates a new DatabusCollection from an already existing\n * @param {[type]} data [description]\n */\n constructor(data) {\n Object.assign(this, data);\n this.eventListeners = {};\n }\n\n addEventListener(name, callback) {\n if(this.eventListeners[name] == undefined) {\n this.eventListeners[name] = [];\n }\n\n this.eventListeners[name].push(callback);\n }\n\n isPublisher(username) {\n return this.uri != undefined && this.uri.startsWith('https://databus.dbpedia.org/' + username);\n }\n\n get isPublished() {\n return this.issued != undefined;\n }\n\n get displayLabelHtml() {\n var l = '';\n if(this.isDraft) {\n l += 'DRAFT:';\n }\n l += (this.label != undefined && this.label.length > 0) ? this.label : 'Untitled Collection';\n return l;\n }\n\n get isDraft() {\n return this.uri === undefined;\n }\n\n get hasContent() {\n\n if(this.content.root.childNodes.length == 0) {\n return false;\n }\n\n for(var childNode of this.content.root.childNodes) {\n if(childNode.childNodes.length > 0) {\n return true;\n }\n }\n\n return false;\n }\n\n fireEvent(name) {\n if(this.eventListeners[name] == undefined) {\n return;\n }\n\n for(var c in this.eventListeners[name]) {\n var callback = this.eventListeners[name][c];\n callback();\n }\n }\n\n\n static createNew(title, description, source, accountName) {\n var data = {};\n data.uuid = DatabusUtils.uuidv4();\n data.title = title;\n data.description = description;\n data.accountName = accountName;\n data.abstract = description;\n data.content = {};\n data.content.root = new QueryNode(null, null);\n data.content.root.addChild(new QueryNode(source, null));\n\n return data;\n }\n\n /**\n * Builds a composed query from all elements\n * @return {[type]} [description]\n */\n createQuery() {\n\n if(this.content.root == undefined) {\n return null;\n }\n\n return QueryBuilder.build({\n template : QueryTemplates.DEFAULT_FILE_TEMPLATE,\n resourceBaseUrl : DATABUS_RESOURCE_BASE_URL,\n node: this.content.root\n });\n }\n\n /**\n * Downloads the entire collection object as json\n * @return {[type]} [description]\n */\n downloadAsJson(){\n var dataStr = \"data:text/json;charset=utf-8,\" + encodeURIComponent(angular.toJson(this));\n var downloadAnchorNode = document.createElement('a');\n downloadAnchorNode.setAttribute(\"href\", dataStr);\n downloadAnchorNode.setAttribute(\"download\", this.title + \".json\");\n document.body.appendChild(downloadAnchorNode); // required for firefox\n downloadAnchorNode.click();\n downloadAnchorNode.remove();\n }\n\n removeCustomQueryNode(node) {\n this.content.customQueries = this.content.customQueries.filter(function(n){\n return node.guid != n.guid;\n });\n }\n\n removeNodeByUri(uri) {\n QueryNode.removeChildByUri(this.content.root, uri);\n }\n\n getParentNode(node) {\n return QueryNode.findParentNodeRecursive(this.content.root, node);\n }\n\n removeGroupNode(groupNode) {\n this.content.groups = this.content.groups.filter(function(a){\n return groupNode.uri != a.uri;\n });\n }\n\n addCustomQueryNode(label, query) {\n this.content.customQueries.push({\n guid : DatabusUtils.uuidv4(),\n label : label,\n query : query,\n });\n }\n\n hasGroup(groupUri) {\n var group = this.findGroup(groupUri);\n return group != undefined;\n }\n\n hasArtifact(artifactUri) {\n var groupUri = DatabusUtils.navigateUp(artifactUri);\n\n var group = this.findGroup(groupUri);\n\n if(group == undefined) {\n return false;\n }\n\n var artifact = this.findArtifact(group, artifactUri);\n return artifact != undefined;\n }\n\n /**\n * Adds a new group node with label, uri and settings\n * @param {[type]} groupUri [description]\n * @param {[type]} groupLabel [description]\n * @param {[type]} settings [description]\n */\n addGroupNode(groupUri, settings) {\n\n var group = this.findGroup(groupUri);\n\n if(group == undefined) {\n\n var publisherUri = DatabusUtils.navigateUp(groupUri);\n\n var groupLabel = DatabusUtils.uriToName(groupUri);\n var publisherLabel = DatabusUtils.uriToName(publisherUri);\n\n group = {};\n group.uri = groupUri;\n group.artifacts = [];\n group.label = publisherLabel + \" » \" + groupLabel;\n group.settings = settings;\n group.expanded = true;\n\n this.content.groups.push(group);\n\n this.fireEvent(\"onGroupAdded\");\n }\n\n return group;\n }\n\n /**\n * Adds a new artifact node with label uri and settings\n * This will fail if the appropriate group node has not been\n * added previously\n * @param {[type]} artifactUri [description]\n * @param {[type]} artifactLabel [description]\n * @param {[type]} settings [description]\n */\n addArtifactNode(artifactUri, artifactLabel, settings) {\n\n var groupUri = DatabusUtils.navigateUp(artifactUri);\n var group = this.addGroupNode(groupUri, [ \n {\n facet: \"http://purl.org/dc/terms/hasVersion\",\n value: \"SYSTEM_LATEST_ARTIFACT_VERSION\",\n checked: true\n }]);\n\n var artifact = this.findArtifact(group, artifactUri);\n\n if(artifact == undefined) {\n artifact = {};\n artifact.uri = artifactUri;\n artifact.label = artifactLabel;\n artifact.settings = settings;\n\n group.artifacts.push(artifact);\n \n // TODO: merge facets\n \n\n this.fireEvent(\"onArtifactAdded\");\n }\n }\n\n findGroup(groupUri) {\n for(var g in this.content.groups) {\n var group = this.content.groups[g];\n\n if(group.uri == groupUri) {\n return group;\n }\n }\n\n return null;\n }\n\n findArtifact(group, artifactUri) {\n for(var a in group.artifacts) {\n var artifact = group.artifacts[a];\n\n if(artifact.uri == artifactUri) {\n return artifact;\n }\n }\n\n return null;\n }\n}\n\nmodule.exports = DatabusCollectionWrapper;\n\n//# sourceURL=webpack://databus-webapp/./js/collections/databus-collection-wrapper.js?\n}"); -/***/ }), +/***/ }, -/***/ "./js/components/account-history/account-history.js": +/***/ "./js/components/account-history/account-history.js" /*!**********************************************************!*\ !*** ./js/components/account-history/account-history.js ***! \**********************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +(module, __unused_webpack_exports, __webpack_require__) { -eval("const DatabusWebappUtils = __webpack_require__(/*! ../../utils/databus-webapp-utils */ \"./js/utils/databus-webapp-utils.js\");\n\n// hinzufügen eines Controllers zum Modul\nfunction AccountHistoryController($http) {\n\n var ctrl = this;\n ctrl.utils = new DatabusWebappUtils(null, null);\n\n \n ctrl.$onInit = async function() {\n\n var result = await $http.get(`/app/account/history?accountName=${ctrl.accountName}`);\n\n ctrl.results = result.data;\n }\n}\n\n\nmodule.exports = AccountHistoryController;\n\n//# sourceURL=webpack://databus-webapp/./js/components/account-history/account-history.js?"); +eval("{const DatabusWebappUtils = __webpack_require__(/*! ../../utils/databus-webapp-utils */ \"./js/utils/databus-webapp-utils.js\");\n\n// hinzufügen eines Controllers zum Modul\nfunction AccountHistoryController($http) {\n\n var ctrl = this;\n ctrl.utils = new DatabusWebappUtils(null, null);\n\n \n ctrl.$onInit = async function() {\n\n var result = await $http.get(`/app/account/history?accountName=${ctrl.accountName}`);\n\n ctrl.results = result.data;\n }\n}\n\n\nmodule.exports = AccountHistoryController;\n\n//# sourceURL=webpack://databus-webapp/./js/components/account-history/account-history.js?\n}"); -/***/ }), +/***/ }, -/***/ "./js/components/autofill-dropdown/autofill-dropdown.js": +/***/ "./js/components/autofill-dropdown/autofill-dropdown.js" /*!**************************************************************!*\ !*** ./js/components/autofill-dropdown/autofill-dropdown.js ***! \**************************************************************/ -/***/ ((module) => { +(module) { -eval("// hinzufügen eines Controllers zum Modul\nfunction AutofillDropdownController($timeout) {\n\n var ctrl = this;\n\n ctrl.$onInit = function () {\n ctrl.displayValues = [];\n }\n\n ctrl.showAll = function() {\n ctrl.showDrop = true;\n ctrl.displayValues = ctrl.values;\n }\n\n ctrl.handleKey = function (e) {\n\n if (e.which === 9 || e.which === 13) {\n\n ctrl.showDrop = false;\n\n if(ctrl.displayValues.length > 0 && ctrl.input != ctrl.displayValues[0]) {\n e.preventDefault();\n ctrl.input = ctrl.displayValues[0];\n ctrl.change();\n }\n }\n }\n\n ctrl.hideDropDelayed = function () {\n $timeout(function () {\n ctrl.showDrop = false;\n }, 120);\n }\n\n ctrl.autoComplete = function () {\n\n ctrl.showDrop = true;\n if (ctrl.input == \"\" || ctrl.input == undefined) {\n ctrl.displayValues = ctrl.values;\n return;\n }\n\n ctrl.displayValues = [];\n\n for (var value of ctrl.values) {\n if (value.includes(ctrl.input) && value != ctrl.input) {\n ctrl.displayValues.push(value);\n }\n }\n\n if(ctrl.displayValues.length == 0) {\n ctrl.showDrop = false;\n }\n }\n\n ctrl.change = function () {\n\n ctrl.autoComplete();\n\n $timeout(function () {\n ctrl.onChange();\n }, 50);;\n }\n}\n\nmodule.exports = AutofillDropdownController;\n\n\n\n//# sourceURL=webpack://databus-webapp/./js/components/autofill-dropdown/autofill-dropdown.js?"); +eval("{// hinzufügen eines Controllers zum Modul\nfunction AutofillDropdownController($timeout) {\n\n var ctrl = this;\n\n ctrl.$onInit = function () {\n ctrl.displayValues = [];\n }\n\n ctrl.showAll = function() {\n ctrl.showDrop = true;\n ctrl.displayValues = ctrl.values;\n }\n\n ctrl.handleKey = function (e) {\n\n if (e.which === 9 || e.which === 13) {\n\n ctrl.showDrop = false;\n\n if(ctrl.displayValues.length > 0 && ctrl.input != ctrl.displayValues[0]) {\n e.preventDefault();\n ctrl.input = ctrl.displayValues[0];\n ctrl.change();\n }\n }\n }\n\n ctrl.hideDropDelayed = function () {\n $timeout(function () {\n ctrl.showDrop = false;\n }, 120);\n }\n\n ctrl.autoComplete = function () {\n\n ctrl.showDrop = true;\n if (ctrl.input == \"\" || ctrl.input == undefined) {\n ctrl.displayValues = ctrl.values;\n return;\n }\n\n ctrl.displayValues = [];\n\n for (var value of ctrl.values) {\n if (value.includes(ctrl.input) && value != ctrl.input) {\n ctrl.displayValues.push(value);\n }\n }\n\n if(ctrl.displayValues.length == 0) {\n ctrl.showDrop = false;\n }\n }\n\n ctrl.change = function () {\n\n ctrl.autoComplete();\n\n $timeout(function () {\n ctrl.onChange();\n }, 50);;\n }\n}\n\nmodule.exports = AutofillDropdownController;\n\n\n\n//# sourceURL=webpack://databus-webapp/./js/components/autofill-dropdown/autofill-dropdown.js?\n}"); -/***/ }), +/***/ }, -/***/ "./js/components/better-dropdown/better-dropdown.js": +/***/ "./js/components/better-dropdown/better-dropdown.js" /*!**********************************************************!*\ !*** ./js/components/better-dropdown/better-dropdown.js ***! \**********************************************************/ -/***/ ((module) => { +(module) { -eval("\n// hinzufügen eines Controllers zum Modul\nfunction BetterDropdownController($scope, $timeout, $element) {\n\n\n const ctrl = this;\n ctrl.isActive = false;\n\n ctrl.closeAll = function() {\n ctrl.rootNode.isActive = false;\n ctrl.setChildrenActiveState(ctrl.rootNode, false);\n }\n\n ctrl.activateNode = function(parent, node) {\n for(var sibling of parent.children) {\n sibling.isActive = false;\n ctrl.setChildrenActiveState(sibling, false);\n }\n\n node.isActive = true;\n }\n\n ctrl.setChildrenActiveState = function(node, value) {\n if(node.children == null) {\n return;\n }\n\n for(var child of node.children) {\n child.isActive = value;\n ctrl.setChildrenActiveState(child, value);\n }\n }\n\n ctrl.toggleNode = function(node) {\n node.isActive = !node.isActive;\n\n if(!node.isActive) {\n ctrl.setChildrenActiveState(node, false);\n }\n }\n\n ctrl.toggleDropdown = function () {\n ctrl.isActive = !ctrl.isActive;\n };\n ctrl.showDropdown = function () {\n ctrl.isActive = true;\n };\n ctrl.hideDropdown = function () {\n ctrl.isActive = false;\n };\n\n ctrl.showNested = function (parent, node) {\n if (node.children) {\n ctrl.cancelShowNested();\n ctrl.currentTimeout = $timeout(function () {\n ctrl.activateNode(parent, node);\n }, 200);\n }\n };\n\n ctrl.cancelShowNested = function() {\n if(ctrl.currentTimeout != null) {\n $timeout.cancel(ctrl.currentTimeout);\n ctrl.currentTimeout = null;\n }\n }\n\n ctrl.toggleNestedDropdown = function (node) {\n node.showChildren = !node.showChildren;\n };\n ctrl.selectNode = function (node) {\n // Handle the selected node here\n ctrl.onNodeClicked({ node : node });\n };\n\n\n\n}\n\n\nmodule.exports = BetterDropdownController;\n\n\n//# sourceURL=webpack://databus-webapp/./js/components/better-dropdown/better-dropdown.js?"); +eval("{\n// hinzufügen eines Controllers zum Modul\nfunction BetterDropdownController($scope, $timeout, $element) {\n\n\n const ctrl = this;\n ctrl.isActive = false;\n\n ctrl.closeAll = function() {\n ctrl.rootNode.isActive = false;\n ctrl.setChildrenActiveState(ctrl.rootNode, false);\n }\n\n ctrl.activateNode = function(parent, node) {\n for(var sibling of parent.children) {\n sibling.isActive = false;\n ctrl.setChildrenActiveState(sibling, false);\n }\n\n node.isActive = true;\n }\n\n ctrl.setChildrenActiveState = function(node, value) {\n if(node.children == null) {\n return;\n }\n\n for(var child of node.children) {\n child.isActive = value;\n ctrl.setChildrenActiveState(child, value);\n }\n }\n\n ctrl.toggleNode = function(node) {\n node.isActive = !node.isActive;\n\n if(!node.isActive) {\n ctrl.setChildrenActiveState(node, false);\n }\n }\n\n ctrl.toggleDropdown = function () {\n ctrl.isActive = !ctrl.isActive;\n };\n ctrl.showDropdown = function () {\n ctrl.isActive = true;\n };\n ctrl.hideDropdown = function () {\n ctrl.isActive = false;\n };\n\n ctrl.showNested = function (parent, node) {\n if (node.children) {\n ctrl.cancelShowNested();\n ctrl.currentTimeout = $timeout(function () {\n ctrl.activateNode(parent, node);\n }, 200);\n }\n };\n\n ctrl.cancelShowNested = function() {\n if(ctrl.currentTimeout != null) {\n $timeout.cancel(ctrl.currentTimeout);\n ctrl.currentTimeout = null;\n }\n }\n\n ctrl.toggleNestedDropdown = function (node) {\n node.showChildren = !node.showChildren;\n };\n ctrl.selectNode = function (node) {\n // Handle the selected node here\n ctrl.onNodeClicked({ node : node });\n };\n\n\n\n}\n\n\nmodule.exports = BetterDropdownController;\n\n\n//# sourceURL=webpack://databus-webapp/./js/components/better-dropdown/better-dropdown.js?\n}"); -/***/ }), +/***/ }, -/***/ "./js/components/collection-data-table/collection-data-table.js": +/***/ "./js/components/collection-data-table/collection-data-table.js" /*!**********************************************************************!*\ !*** ./js/components/collection-data-table/collection-data-table.js ***! \**********************************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +(module, __unused_webpack_exports, __webpack_require__) { -eval("const DatabusCollectionUtils = __webpack_require__(/*! ../../collections/databus-collection-utils */ \"./js/collections/databus-collection-utils.js\");\nconst DatabusUtils = __webpack_require__(/*! ../../utils/databus-utils */ \"./js/utils/databus-utils.js\");\n\n\n// hinzufügen eines Controllers zum Modul\nfunction CollectionDataTableController($http, $scope, $location, $sce) {\n\n var ctrl = this;\n ctrl.$http = $http;\n\n\n ctrl.$onInit = function() {\n\n\n ctrl.isLoading = true;\n DatabusCollectionUtils.getCollectionFiles(ctrl.$http, ctrl.collection).then(function(result) {\n ctrl.files = result;\n ctrl.isLoading = false;\n $scope.$apply();\n }, function(err) {\n ctrl.statistics = null;\n ctrl.isLoading = false;\n });\n\n\n if(ctrl.files == null) {\n return;\n }\n\n ctrl.groupedFiles = ctrl.groupBy(ctrl.files, 'version');\n }\n\n ctrl.getRowspan = function(file) {\n\n return file.distributions.length * 2; \n /*\n var span = file.distributions.length * 2;\n if(!file.distributions[file.distributions.length - 1].expanded) {\n span--;\n }\n\n return span;*/\n }\n\n ctrl.groupBy = function(list, key) {\n\n var result = {};\n\n for(var i in list) {\n var element = list[i];\n var keyVal = element[key];\n\n if(result[keyVal] == undefined) {\n result[keyVal] = {}\n result[keyVal].value = keyVal;\n result[keyVal].title = element.title;\n result[keyVal].uri = keyVal;\n result[keyVal].distributions = [];\n result[keyVal].license = element.license;\n }\n\n result[keyVal].distributions.push(element);\n }\n \n return result;\n }\n\n ctrl.calculateRowSpan = function(file) {\n var rowspan = 0;\n\n for(var d in file.distributions) {\n rowspan += 1; //(file.distributions[d].expanded ? 2 : 1);\n }\n\n return rowspan;\n }\n\n ctrl.createRelativeUri = function(url) {\n var u = new URL(url);\n return u.pathname;\n }\n\n ctrl.$doCheck = function() {\n\n if(ctrl.files == null) {\n return;\n }\n\n if(ctrl.previousFileCount != ctrl.files.length) {\n ctrl.previousFileCount = ctrl.files.length;\n ctrl.groupedFiles = ctrl.groupBy(ctrl.files, 'version');\n } \n }\n\n ctrl.uriToName = function(uri) {\n return DatabusUtils.uriToName(uri);\n }\n\n ctrl.formatUploadSize = function(size) {\n if(size < 1024) return size + \" B\";\n else if (size < 1048576) return Math.round(size / 1024) + \" KB\";\n else if (size < 1073741824) return (Math.round(10 * size / 1048576) / 10) + \" MB\";\n else return (Math.round(100 * size / 1073741824) / 100) + \" GB\";\n }\n}\n\n\nmodule.exports = CollectionDataTableController;\n\n//# sourceURL=webpack://databus-webapp/./js/components/collection-data-table/collection-data-table.js?"); +eval("{const DatabusCollectionUtils = __webpack_require__(/*! ../../collections/databus-collection-utils */ \"./js/collections/databus-collection-utils.js\");\nconst DatabusUtils = __webpack_require__(/*! ../../utils/databus-utils */ \"./js/utils/databus-utils.js\");\n\n\n// hinzufügen eines Controllers zum Modul\nfunction CollectionDataTableController($http, $scope, $location, $sce) {\n\n var ctrl = this;\n ctrl.$http = $http;\n\n\n ctrl.$onInit = function() {\n\n\n ctrl.isLoading = true;\n DatabusCollectionUtils.getCollectionFiles(ctrl.$http, ctrl.collection).then(function(result) {\n ctrl.files = result;\n ctrl.isLoading = false;\n $scope.$apply();\n }, function(err) {\n ctrl.statistics = null;\n ctrl.isLoading = false;\n });\n\n\n if(ctrl.files == null) {\n return;\n }\n\n ctrl.groupedFiles = ctrl.groupBy(ctrl.files, 'version');\n }\n\n ctrl.getRowspan = function(file) {\n\n return file.distributions.length * 2; \n /*\n var span = file.distributions.length * 2;\n if(!file.distributions[file.distributions.length - 1].expanded) {\n span--;\n }\n\n return span;*/\n }\n\n ctrl.groupBy = function(list, key) {\n\n var result = {};\n\n for(var i in list) {\n var element = list[i];\n var keyVal = element[key];\n\n if(result[keyVal] == undefined) {\n result[keyVal] = {}\n result[keyVal].value = keyVal;\n result[keyVal].title = element.title;\n result[keyVal].uri = keyVal;\n result[keyVal].distributions = [];\n result[keyVal].license = element.license;\n }\n\n result[keyVal].distributions.push(element);\n }\n \n return result;\n }\n\n ctrl.calculateRowSpan = function(file) {\n var rowspan = 0;\n\n for(var d in file.distributions) {\n rowspan += 1; //(file.distributions[d].expanded ? 2 : 1);\n }\n\n return rowspan;\n }\n\n ctrl.createRelativeUri = function(url) {\n var u = new URL(url);\n return u.pathname;\n }\n\n ctrl.$doCheck = function() {\n\n if(ctrl.files == null) {\n return;\n }\n\n if(ctrl.previousFileCount != ctrl.files.length) {\n ctrl.previousFileCount = ctrl.files.length;\n ctrl.groupedFiles = ctrl.groupBy(ctrl.files, 'version');\n } \n }\n\n ctrl.uriToName = function(uri) {\n return DatabusUtils.uriToName(uri);\n }\n\n ctrl.formatUploadSize = function(size) {\n if(size < 1024) return size + \" B\";\n else if (size < 1048576) return Math.round(size / 1024) + \" KiB\";\n else if (size < 1073741824) return (Math.round(10 * size / 1048576) / 10) + \" MiB\";\n else return (Math.round(100 * size / 1073741824) / 100) + \" GiB\";\n }\n}\n\n\nmodule.exports = CollectionDataTableController;\n\n//# sourceURL=webpack://databus-webapp/./js/components/collection-data-table/collection-data-table.js?\n}"); -/***/ }), +/***/ }, -/***/ "./js/components/collection-editor-widget/collection-editor-widget.js": +/***/ "./js/components/collection-editor-widget/collection-editor-widget.js" /*!****************************************************************************!*\ !*** ./js/components/collection-editor-widget/collection-editor-widget.js ***! \****************************************************************************/ -/***/ ((module) => { +(module) { -eval("\n// hinzufügen eines Controllers zum Modul\nfunction CollectionEditorWidgetController(collectionManager, $scope) {\n\n var ctrl = this;\n ctrl.$scope = $scope;\n ctrl.collectionManager = collectionManager;\n\n ctrl.$onInit = function () {\n\n // TODO: Change this hacky BS!\n setTimeout(function () {\n $(\".dropdown-item\").click(function (e) {\n var dropdown = $(this).closest(\".dropdown\");\n $(dropdown).removeClass(\"is-active\");\n e.stopPropagation();\n });\n\n\n $(\"body\").click(function () {\n $(\".dropdown\").removeClass(\"is-active\");\n });\n\n $(\".dropdown\").click(function (e) {\n $(\".dropdown\").removeClass(\"is-active\");\n $(this).addClass(\"is-active\");\n e.stopPropagation();\n });\n }, 500);\n\n }\n\n ctrl.goToEditor = function () {\n window.location.href = '/app/collection-editor';\n }\n\n ctrl.addSelectionToCollection = function (uuid) {\n var selection = ctrl.selection;\n\n ctrl.collectionManager.setActive(uuid);\n var collection = ctrl.collectionManager.activeCollection;\n\n // Get local bus node\n var databusNode = QueryNode.findChildByUri(collection.content.root, DATABUS_RESOURCE_BASE_URL);\n\n if (databusNode == undefined) {\n databusNode = new QueryNode(DATABUS_RESOURCE_BASE_URL, null);\n collection.content.root.childNodes.push(databusNode);\n }\n\n QueryNode.mergeAddChild(databusNode, selection);\n\n ctrl.collectionManager.activeCollection.hasLocalChanges\n = ctrl.collectionManager.hasLocalChanges(ctrl.collectionManager.activeCollection);\n ctrl.collectionManager.saveLocally();\n }\n\n}\n\n\nmodule.exports = CollectionEditorWidgetController;\n\n\n//# sourceURL=webpack://databus-webapp/./js/components/collection-editor-widget/collection-editor-widget.js?"); +eval("{\n// hinzufügen eines Controllers zum Modul\nfunction CollectionEditorWidgetController(collectionManager, $scope) {\n\n var ctrl = this;\n ctrl.$scope = $scope;\n ctrl.collectionManager = collectionManager;\n\n ctrl.$onInit = function () {\n\n // TODO: Change this hacky BS!\n setTimeout(function () {\n $(\".dropdown-item\").click(function (e) {\n var dropdown = $(this).closest(\".dropdown\");\n $(dropdown).removeClass(\"is-active\");\n e.stopPropagation();\n });\n\n\n $(\"body\").click(function () {\n $(\".dropdown\").removeClass(\"is-active\");\n });\n\n $(\".dropdown\").click(function (e) {\n $(\".dropdown\").removeClass(\"is-active\");\n $(this).addClass(\"is-active\");\n e.stopPropagation();\n });\n }, 500);\n\n }\n\n ctrl.goToEditor = function () {\n window.location.href = '/app/collection-editor';\n }\n\n ctrl.addSelectionToCollection = function (uuid) {\n var selection = ctrl.selection;\n\n ctrl.collectionManager.setActive(uuid);\n var collection = ctrl.collectionManager.activeCollection;\n\n // Get local bus node\n var databusNode = QueryNode.findChildByUri(collection.content.root, DATABUS_RESOURCE_BASE_URL);\n\n if (databusNode == undefined) {\n databusNode = new QueryNode(DATABUS_RESOURCE_BASE_URL, null);\n collection.content.root.childNodes.push(databusNode);\n }\n\n QueryNode.mergeAddChild(databusNode, selection);\n\n ctrl.collectionManager.activeCollection.hasLocalChanges\n = ctrl.collectionManager.hasLocalChanges(ctrl.collectionManager.activeCollection);\n ctrl.collectionManager.saveLocally();\n }\n\n}\n\n\nmodule.exports = CollectionEditorWidgetController;\n\n\n//# sourceURL=webpack://databus-webapp/./js/components/collection-editor-widget/collection-editor-widget.js?\n}"); -/***/ }), +/***/ }, -/***/ "./js/components/collection-hierarchy-two/collection-hierarchy.js": +/***/ "./js/components/collection-hierarchy-two/collection-hierarchy.js" /*!************************************************************************!*\ !*** ./js/components/collection-hierarchy-two/collection-hierarchy.js ***! \************************************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +(module, __unused_webpack_exports, __webpack_require__) { -eval("const DatabusCollectionWrapper = __webpack_require__(/*! ../../collections/databus-collection-wrapper */ \"./js/collections/databus-collection-wrapper.js\");\nconst QueryBuilder = __webpack_require__(/*! ../../query-builder/query-builder */ \"./js/query-builder/query-builder.js\");\nconst QueryNode = __webpack_require__(/*! ../../query-builder/query-node */ \"./js/query-builder/query-node.js\");\nconst QueryTemplates = __webpack_require__(/*! ../../query-builder/query-templates */ \"./js/query-builder/query-templates.js\");\nconst DatabusConstants = __webpack_require__(/*! ../../utils/databus-constants */ \"./js/utils/databus-constants.js\");\nconst DatabusFacetsCache = __webpack_require__(/*! ../../utils/databus-facets-cache */ \"./js/utils/databus-facets-cache.js\");\nconst DatabusUris = __webpack_require__(/*! ../../utils/databus-uris */ \"./js/utils/databus-uris.js\");\nconst DatabusUtils = __webpack_require__(/*! ../../utils/databus-utils */ \"./js/utils/databus-utils.js\");\nconst DatabusWebappUtils = __webpack_require__(/*! ../../utils/databus-webapp-utils */ \"./js/utils/databus-webapp-utils.js\");\n\n// hinzufügen eines Controllers zum Modul\nfunction CollectionHierarchyControllerTwo($http, $location, $sce, $scope, collectionManager) {\n\n var ctrl = this;\n\n ctrl.viewMode = -1;\n ctrl.$http = $http;\n ctrl.$scope = $scope;\n ctrl.facets = new DatabusFacetsCache($http);\n ctrl.utils = new DatabusWebappUtils($scope, $sce);\n ctrl.$sce = $sce;\n\n collectionManager.onCollectionChangedInDifferentTab = function () {\n ctrl.previousCollectionId = null;\n }\n\n ctrl.defaultQuery = `PREFIX databus: \nPREFIX dcv: \nPREFIX dct: \nPREFIX dcat: \nPREFIX rdf: \nPREFIX rdfs: \nSELECT ?file WHERE {\n # Replace this with your custom query:\n ?file .\n} LIMIT 0`;\n const DATAID_ARTIFACT_PROPERTY = 'databus:artifact';\n const DATAID_GROUP_PROPERTY = 'databus:group';\n const KEY_LATEST_VERSION = \"$latest\";\n\n\n ctrl.$onInit = function () {\n\n ctrl.viewMode = -1;\n\n if (ctrl.collection == null) {\n return;\n }\n }\n\n ctrl.onAddContentClicked = function (sourceNode) {\n ctrl.onAddContent({ source: sourceNode.uri });\n\n ctrl.onChange();\n ctrl.updateViewModel();\n }\n\n\n ctrl.onAddCustomQueryClicked = function (sourceNode) {\n var node = QueryNode.createFrom(sourceNode);\n node.addChild(new QueryNode(DatabusUtils.uuidv4(), null));\n ctrl.onChange();\n }\n\n ctrl.toggleCollapsed = function (node, view) {\n view.collapsed = !view.collapsed;\n\n if (!view.collapsed) {\n ctrl.query(node);\n }\n }\n\n ctrl.isDatabus = async function (uri) {\n var req = {\n method: 'GET',\n url: uri,\n headers: {\n 'Accept': 'application/rdf+turtle'\n }\n }\n\n var res = await ctrl.$http(req);\n var manifest = await DatabusUtils.parseDatabusManifest(res.data);\n var expectedUri = new URL(uri);\n\n if (manifest == undefined || manifest.uri != expectedUri.origin) {\n return false;\n }\n\n return true;\n }\n\n ctrl.getDatabusUri = async function (uri) {\n\n var url = new URL(uri);\n var segments = url.pathname.split('/');\n var base = url.origin;\n var currentUrl = base;\n\n var isDatabus = await ctrl.isDatabus(currentUrl);\n\n if (isDatabus) {\n return currentUrl;\n }\n\n for (var i = 0; segments.length; i++) {\n\n currentUrl += `/${segments[i]}`;\n var isDatabus = await ctrl.isDatabus(currentUrl);\n\n if (isDatabus) {\n return currentUrl;\n }\n }\n\n }\n\n ctrl.onAddResource = async function (uri) {\n\n if (uri.endsWith('/')) {\n uri = uri.substr(0, uri.length - 1);\n }\n\n let node = QueryNode.findChildByUri(ctrl.root, uri);\n\n // Resource already in collection\n if (node != undefined) {\n return;\n }\n\n var databusUri = await ctrl.getDatabusUri(uri);\n\n\n var databusUriLength = DatabusUtils.getResourcePathLength(databusUri);\n var resourceUriLength = DatabusUtils.getResourcePathLength(uri);\n var diff = resourceUriLength - databusUriLength;\n\n if (diff < 0 && diff > 3 || diff == 1) {\n return;\n }\n\n if (diff == 0) {\n ctrl.addDatabus(uri);\n }\n\n if (diff == 2) {\n ctrl.addDatabus(databusUri);\n let databusNode = QueryNode.findChildByUri(ctrl.root, databusUri);\n ctrl.addGroup(databusNode, uri);\n }\n\n if (diff == 3) {\n ctrl.addDatabus(databusUri);\n let databusNode = QueryNode.findChildByUri(ctrl.root, databusUri);\n let groupUri = DatabusUtils.navigateUp(uri);\n ctrl.addGroup(databusNode, groupUri);\n let groupNode = QueryNode.findChildByUri(ctrl.root, groupUri);\n ctrl.addArtifact(groupNode, uri);\n }\n\n ctrl.onChange();\n ctrl.updateViewModel();\n ctrl.$scope.$apply();\n }\n\n ctrl.addDatabus = function (uri) {\n let node = QueryNode.findChildByUri(ctrl.root, uri);\n\n if (node == null) {\n ctrl.root.childNodes.push(new QueryNode(uri, null));\n }\n }\n\n ctrl.addGroup = function (databusNode, uri) {\n let node = QueryNode.findChildByUri(ctrl.root, uri);\n\n if (node == null) {\n databusNode.childNodes.push(new QueryNode(uri, DATAID_GROUP_PROPERTY));\n }\n }\n\n ctrl.addArtifact = function (groupNode, uri) {\n let node = QueryNode.findChildByUri(ctrl.root, uri);\n\n if (node == null) {\n groupNode.childNodes.push(new QueryNode(uri, DATAID_ARTIFACT_PROPERTY));\n }\n }\n\n ctrl.addToCollection = function (source, view, result) {\n\n if (ctrl.isInCollection(result)) {\n QueryNode.removeChildByUri(ctrl.root, result.id[0].value);\n }\n else {\n if (result.typeName[0].value == 'Group') {\n let node = new QueryNode(result.id[0].value, DATAID_GROUP_PROPERTY);\n\n source.childNodes.push(node);\n }\n\n if (result.typeName[0].value == 'Artifact') {\n\n var artifactUri = result.id[0].value;\n let groupUri = DatabusUtils.navigateUp(artifactUri);\n let groupNode = QueryNode.findChildByUri(ctrl.root, groupUri);\n\n if (groupNode == null) {\n groupNode = new QueryNode(groupUri, DATAID_GROUP_PROPERTY);\n source.childNodes.push(groupNode);\n }\n\n let node = new QueryNode(artifactUri, DATAID_ARTIFACT_PROPERTY);\n groupNode.addChild(node);\n }\n }\n\n for (var res of view.searchResults) {\n res.inCollection = ctrl.isInCollection(res);\n }\n\n ctrl.onChange();\n ctrl.updateViewModel();\n }\n\n ctrl.isLastChild = function (group, artifact) {\n\n if (group.childNodes == undefined || group.childNodes.length == 0) {\n return false;\n }\n\n return group.childNodes[group.childNodes.length - 1].uri == artifact.uri;\n }\n\n ctrl.toggleExpand = function (node) {\n node.expanded = !node.expanded;\n ctrl.onChange();\n }\n\n ctrl.mergeFacets = function (node, facets) {\n\n if (node.facets == undefined) {\n node.facets = JSON.parse(JSON.stringify(facets));\n return;\n }\n\n for (var f in facets) {\n\n if (node.facets[f] == undefined) {\n node.facets[f] = JSON.parse(JSON.stringify(facets[f]));\n continue;\n }\n\n for (var value of facets[f].values) {\n if (!node.facets[f].values.includes(value)) {\n node.facets[f].values.push(value);\n }\n }\n }\n\n node.facetLabels = null;\n }\n\n ctrl.getAllFilters = function (groupNode, artifactNode) {\n\n if (artifactNode == null) {\n var result = Object.keys(groupNode.facetSettings)\n return DatabusUtils.uniqueList(result);\n }\n\n var result = Object.keys(groupNode.facetSettings).concat(Object.keys(artifactNode.facetSettings));\n return DatabusUtils.uniqueList(result);\n }\n\n ctrl.$doCheck = function () {\n\n if (ctrl.collection == null) {\n ctrl.previousCollectionId = null;\n return;\n }\n\n if (ctrl.previousCollectionId != ctrl.collection.uuid) {\n ctrl.previousCollectionId = ctrl.collection.uuid;\n\n ctrl.activeNode = null;\n ctrl.viewMode = -1;\n ctrl.updateViewModel();\n }\n }\n\n ctrl.handleKey = function (e, nodeView) {\n if (e.which === 9) {\n nodeView.showSearchResults = false;\n }\n }\n\n ctrl.isInCollection = function (result) {\n let uri = result.id[0].value;\n let node = QueryNode.findChildByUri(ctrl.root, uri);\n return node != null;\n }\n\n ctrl.updateSearchResults = function (view) {\n\n if (view == null || view.searchResults == null) {\n return;\n }\n\n for (var res of view.searchResults) {\n res.inCollection = ctrl.isInCollection(res);\n }\n }\n\n ctrl.searchNode = function (node, nodeView) {\n\n var baseUrl = new URL(node.uri).origin;\n var typeFilters = `typeName=Artifact Group`;\n\n if (node.property == DATAID_GROUP_PROPERTY) {\n var groupName = DatabusUtils.uriToResourceName(node.uri);\n var accountName = DatabusUtils.uriToResourceName(DatabusUtils.navigateUp(node.uri));\n typeFilters = `typeName=Artifact&publisher=${accountName}&group=${groupName}`;\n }\n\n var url = `${baseUrl}/api/search?${typeFilters}&typeNameWeight=0&format=JSON_FULL&minRelevance=15&maxResults=10&query=${nodeView.search}`;\n\n try {\n $http({ method: 'GET', url: url }).then(function successCallback(response) {\n\n nodeView.searchResults = [];\n\n for (var doc of response.data.docs) {\n doc.inCollection = ctrl.isInCollection(doc);\n nodeView.searchResults.push(doc);\n }\n\n }, function errorCallback(response) {\n console.log(response);\n });\n } catch (err) {\n\n }\n\n };\n\n ctrl.toggleExpand = function (view) {\n view.expanded = !view.expanded;\n }\n\n\n ctrl.isValidHttpUrl = function (url) {\n return DatabusUtils.isValidHttpUrl(url);\n }\n\n\n ctrl.updateViewModel = function () {\n ctrl.collectionWrapper = new DatabusCollectionWrapper(ctrl.collection);\n ctrl.root = ctrl.collection.content.root;\n\n ctrl.view = {};\n ctrl.view.groups = {};\n ctrl.view.artifacts = {};\n ctrl.view.sources = {};\n\n for (var s in ctrl.root.childNodes) {\n\n var sourceNode = ctrl.root.childNodes[s];\n\n if (ctrl.view.sources[sourceNode.uri] == undefined) {\n ctrl.view.sources[sourceNode.uri] = {};\n ctrl.view.sources[sourceNode.uri].uri = sourceNode.uri;\n ctrl.view.sources[sourceNode.uri].expanded = true;\n ctrl.view.sources[sourceNode.uri].addMode = 'artifact';\n ctrl.view.sources[sourceNode.uri].customQueryLabel = `New Custom Query`;\n ctrl.view.sources[sourceNode.uri].customQueryInput = ctrl.defaultQuery;\n }\n\n for (var g in sourceNode.childNodes) {\n\n var groupNode = sourceNode.childNodes[g];\n groupNode.expanded = true;\n\n\n ctrl.view.groups[groupNode.uri] = {};\n\n if (DatabusUtils.isValidHttpUrl(groupNode.uri)) {\n\n ctrl.facets.get(groupNode.uri).then(function (res) {\n delete res.facets[DatabusUris.DATABUS_ARTIFACT_PROPERTY];\n ctrl.view.groups[res.uri].facets = res.facets;\n\n var hasVersionFacets = ctrl.view.groups[res.uri].facets[DatabusUris.DCT_HAS_VERSION];\n\n if (hasVersionFacets != null && !hasVersionFacets.values.includes(KEY_LATEST_VERSION)) {\n hasVersionFacets.values.unshift(KEY_LATEST_VERSION);\n }\n\n $scope.$apply();\n });\n\n ctrl.query(groupNode);\n\n for (var a in groupNode.childNodes) {\n\n var artifactNode = groupNode.childNodes[a];\n\n ctrl.view.artifacts[artifactNode.uri] = {};\n ctrl.view.artifacts[artifactNode.uri].expanded = false;\n ctrl.view.artifacts[artifactNode.uri].collapsed = true;\n\n ctrl.facets.get(artifactNode.uri).then(function (res) {\n ctrl.view.artifacts[res.uri].facets = res.facets;\n\n var hasVersionFacets = ctrl.view.artifacts[res.uri].facets[DatabusUris.DCT_HAS_VERSION];\n\n if (hasVersionFacets != null && !hasVersionFacets.values.includes(KEY_LATEST_VERSION)) {\n hasVersionFacets.values.unshift(KEY_LATEST_VERSION);\n }\n\n $scope.$apply();\n //var groupUri = DatabusUtils.navigateUp(artifactNode.uri);\n //ctrl.view.artifacts[artifactNode.uri].facets = result.data;\n //ctrl.mergeFacets(ctrl.view.groups[groupUri], result.data);\n });\n\n\n\n /*en(function(result) {\n\n = result['http://purl.org/dc/terms/hasVersion'].values.unshift(\"$latest\");\n\n\n var groupUri = DatabusUtils.navigateUp(artifactNode.uri);\n ctrl.view.artifacts[artifactNode.uri].facets = result.data;\n ctrl.mergeFacets(ctrl.view.groups[groupUri], result.data);\n\n });\n\n\n \n */\n }\n }\n }\n }\n }\n\n\n\n ctrl.onArtifactDropdownChanged = function (groupNode) {\n ctrl.onChange();\n ctrl.query(groupNode);\n }\n\n ctrl.selectAddFilterValue = function (viewNode, value) {\n viewNode.addFilterValueInput = value;\n viewNode.showValueDrop = false;\n\n ctrl.onAddFilterValueInputChanged(viewNode);\n }\n\n ctrl.selectAddFilterFacet = function (viewNode, value) {\n viewNode.addFilterFacetInput = value;\n viewNode.showFacetDrop = false;\n\n ctrl.onAddFilterFacetInputChanged(viewNode);\n }\n\n ctrl.onAddFilterValueInputChanged = function (viewNode) {\n\n for (var value of viewNode.facets[viewNode.addFilterFacet].values) {\n\n if (viewNode.addFilterValueInput == value) {\n viewNode.addFilterValue = value;\n return;\n }\n }\n\n viewNode.addFilterValue = null;\n }\n\n ctrl.onAddFilterFacetInputChanged = function (viewNode) {\n\n for (var facet in viewNode.facets) {\n\n if (viewNode.addFilterFacetInput == viewNode.facets[facet].label) {\n\n if (viewNode.addFilterFacet != facet) {\n viewNode.addFilterFacet = facet;\n viewNode.addFilterValue = [];\n }\n\n return;\n }\n }\n\n viewNode.addFilterFacet = null;\n viewNode.addFilterValue = [];\n }\n\n ctrl.includesValue = function (objs, value) {\n if (objs == undefined) {\n return false;\n }\n\n for (var obj of objs) {\n if (obj.value == value) {\n return true;\n }\n }\n\n return false;\n }\n\n ctrl.isLocalDatabusNode = function (node) {\n return node.uri == DATABUS_RESOURCE_BASE_URL;\n }\n ctrl.addFilter = function (node, facet, values, checked) {\n\n if (values == null) {\n return;\n }\n\n if (node.facetSettings[facet] == undefined) {\n node.facetSettings[facet] = [];\n }\n\n for (var value of values) {\n\n if (!ctrl.includesValue(node.facetSettings[facet], value.value)) {\n node.facetSettings[facet].push(value);\n }\n }\n\n ctrl.onChange();\n ctrl.query(node);\n }\n\n ctrl.query = function (node) {\n\n if (node.childNodes != undefined && node.childNodes.length > 0) {\n\n node.files = null;\n for (var child of node.childNodes) {\n ctrl.query(child);\n }\n\n return;\n }\n\n var queryNode = QueryNode.createSubTree(node);\n\n var fullQuery = QueryBuilder.build({\n node: queryNode,\n template: QueryTemplates.NODE_FILE_TEMPLATE,\n resourceBaseUrl: DATABUS_RESOURCE_BASE_URL,\n root: ctrl.root\n });\n\n this.querySparql(fullQuery).then(function (result) {\n node.files = result;\n ctrl.$scope.$apply();\n\n });\n }\n\n ctrl.removeFilter = function (node, facet) {\n\n if (node.facetSettings[facet] == undefined) {\n return;\n }\n\n delete node.facetSettings[facet];\n\n ctrl.onChange();\n\n ctrl.query(node);\n }\n\n ctrl.onActiveFilterChanged = function (node) {\n ctrl.onChange();\n ctrl.query(node);\n }\n\n ctrl.getFacetLabels = function (viewNode) {\n\n if (viewNode.facetLabels != undefined) {\n return viewNode.facetLabels;\n }\n var result = [];\n\n for (var f in viewNode.facets) {\n result.push(viewNode.facets[f].label);\n }\n\n viewNode.facetLabels = result;\n return result;\n }\n\n\n ctrl.sortBy = function (property) {\n\n if (ctrl.sortProperty == property) {\n ctrl.sortReverse = !ctrl.sortReverse;\n }\n ctrl.sortProperty = property;\n }\n\n ctrl.formatFileSize = function (size) {\n return DatabusUtils.formatFileSize(size);\n };\n\n ctrl.toHTML = function (html) {\n return $sce.trustAsHtml(html);\n };\n\n ctrl.onComponentAdded = function () {\n\n }\n\n ctrl.customExpanded = function () {\n return ctrl.customNode.expanded && ctrl.collection.content.customQueries.length > 0;\n }\n\n ctrl.generatedExpanded = function () {\n return ctrl.generatedNode.expanded && ctrl.collection.content.groups.length > 0;\n }\n\n ctrl.publishCollection = function () {\n ctrl.onPublish();\n }\n\n ctrl.delete = function () {\n ctrl.onDelete();\n }\n\n ctrl.goToResource = function (node) {\n window.location = node.uri;\n }\n\n ctrl.formatGroupPrefix = function (uri) {\n return DatabusUtils.uriToName(DatabusUtils.navigateUp(uri));\n }\n\n ctrl.formatArtifactPrefix = function (uri) {\n var nav = DatabusUtils.navigateUp(uri);\n var groupName = DatabusUtils.uriToName(nav);\n var userName = DatabusUtils.uriToName(DatabusUtils.navigateUp(nav));\n\n return userName + '/' + groupName;\n }\n\n ctrl.uriToName = function (uri) {\n return DatabusUtils.uriToName(uri);\n }\n\n ctrl.objSize = function (obj) {\n return DatabusUtils.objSize(obj);\n }\n\n ctrl.showCollectionSearch = function () {\n ctrl.open = false;\n ctrl.viewMode = 0;\n ctrl.activeNode = ctrl.rootNode;\n\n $location.hash('search');\n }\n\n // ctrl.printJSON = function() {\n // console.log(JSON.stringify(ctrl.collection));\n // }\n\n // SHOW NODES\n ctrl.showGroupNode = function (groupNode) {\n ctrl.open = true;\n ctrl.viewMode = 3;\n ctrl.activeNode = QueryNode.createFrom(groupNode);\n\n this.updateQuery();\n }\n\n ctrl.showArtifactNode = function (artifactNode, groupNode) {\n\n ctrl.open = true;\n ctrl.viewMode = 1;\n ctrl.activeNode = QueryNode.createFrom(artifactNode);\n\n this.updateQuery();\n }\n\n ctrl.querySparql = async function (query) {\n\n\n try {\n\n var req = {\n method: 'POST',\n url: DatabusConstants.DATABUS_SPARQL_ENDPOINT_URL,\n data: \"format=json&query=\" + encodeURIComponent(query),\n headers: {\n \"Content-type\": \"application/x-www-form-urlencoded\"\n },\n }\n\n var updateResponse = await ctrl.$http(req);\n\n var data = updateResponse.data;\n var bindings = data.results.bindings;\n\n for (var b in bindings) {\n ctrl.reduceBinding(bindings[b]);\n }\n\n return bindings;\n\n\n } catch (e) {\n console.log(e);\n }\n }\n\n ctrl.reduceBinding = function (binding) {\n for (var key in binding) {\n binding[key] = binding[key].value;\n }\n\n return binding;\n }\n\n\n\n ctrl.updateQuery = function () {\n var queryNode = QueryNode.createSubTree(ctrl.activeNode);\n\n ctrl.activeFileQuery = QueryBuilder.build({\n node: queryNode,\n template: QueryTemplates.DEFAULT_FILE_TEMPLATE,\n resourceBaseUrl: DATABUS_RESOURCE_BASE_URL\n });\n\n ctrl.activeFullQuery = QueryBuilder.build({\n node: queryNode,\n template: QueryTemplates.NODE_FILE_TEMPLATE,\n resourceBaseUrl: DATABUS_RESOURCE_BASE_URL\n });\n }\n\n ctrl.onActiveNodeChanged = function () {\n this.updateQuery();\n\n ctrl.onChange();\n }\n\n ctrl.addCustomNode = function (sourceNode, label, desc, query) {\n\n var node = new QueryNode(label, query);\n sourceNode.childNodes.push(node);\n\n\n ctrl.updateViewModel();\n ctrl.onChange();\n }\n\n ctrl.removeNode = function (node) {\n\n var parent = ctrl.collectionWrapper.getParentNode(node);\n ctrl.collectionWrapper.removeNodeByUri(node.uri);\n\n if (parent != null) {\n ctrl.query(parent);\n }\n\n ctrl.onChange();\n }\n\n ctrl.showCustomQueryNode = function (customQueryNode) {\n ctrl.open = true;\n ctrl.viewMode = 2;\n ctrl.activeNode = customQueryNode;\n }\n\n ctrl.list = function (setting) {\n\n var allEntries = Object.keys(setting).map(function (key, index) {\n\n var label = undefined;\n var entry = setting[key];\n\n if (entry.value == '') {\n label = 'None';\n } else if (entry.value == '$latest') {\n label = 'Latest Version';\n } else {\n label = entry.value;\n }\n\n if (entry.checked) {\n return label;\n } else {\n return `${label}`;\n }\n });\n\n\n var list = [];\n var maxLength = 50;\n var length = 0;\n var hasOverflow = false;\n\n for (var entry of allEntries) {\n if (entry.length + length > maxLength) {\n hasOverflow = true;\n break;\n }\n\n length += entry.length;\n list.push(entry);\n }\n\n if (hasOverflow) {\n list.push('...');\n }\n\n return ctrl.$sce.trustAsHtml(list.join(', '));\n // return setting.map(function (v) { return v.value }).join(', ');\n }\n}\n\n\nmodule.exports = CollectionHierarchyControllerTwo;\n\n//# sourceURL=webpack://databus-webapp/./js/components/collection-hierarchy-two/collection-hierarchy.js?"); +eval("{const DatabusCollectionWrapper = __webpack_require__(/*! ../../collections/databus-collection-wrapper */ \"./js/collections/databus-collection-wrapper.js\");\nconst QueryBuilder = __webpack_require__(/*! ../../query-builder/query-builder */ \"./js/query-builder/query-builder.js\");\nconst QueryNode = __webpack_require__(/*! ../../query-builder/query-node */ \"./js/query-builder/query-node.js\");\nconst QueryTemplates = __webpack_require__(/*! ../../query-builder/query-templates */ \"./js/query-builder/query-templates.js\");\nconst DatabusConstants = __webpack_require__(/*! ../../utils/databus-constants */ \"./js/utils/databus-constants.js\");\nconst DatabusFacetsCache = __webpack_require__(/*! ../../utils/databus-facets-cache */ \"./js/utils/databus-facets-cache.js\");\nconst DatabusUris = __webpack_require__(/*! ../../utils/databus-uris */ \"./js/utils/databus-uris.js\");\nconst DatabusUtils = __webpack_require__(/*! ../../utils/databus-utils */ \"./js/utils/databus-utils.js\");\nconst DatabusWebappUtils = __webpack_require__(/*! ../../utils/databus-webapp-utils */ \"./js/utils/databus-webapp-utils.js\");\n\n// hinzufügen eines Controllers zum Modul\nfunction CollectionHierarchyControllerTwo($http, $location, $sce, $scope, collectionManager) {\n\n var ctrl = this;\n\n ctrl.viewMode = -1;\n ctrl.$http = $http;\n ctrl.$scope = $scope;\n ctrl.facets = new DatabusFacetsCache($http);\n ctrl.utils = new DatabusWebappUtils($scope, $sce);\n ctrl.$sce = $sce;\n\n collectionManager.onCollectionChangedInDifferentTab = function () {\n ctrl.previousCollectionId = null;\n }\n\n ctrl.defaultQuery = `PREFIX databus: \nPREFIX dcv: \nPREFIX dct: \nPREFIX dcat: \nPREFIX rdf: \nPREFIX rdfs: \nSELECT ?file WHERE {\n # Replace this with your custom query:\n ?file .\n} LIMIT 0`;\n const DATAID_ARTIFACT_PROPERTY = 'databus:artifact';\n const DATAID_GROUP_PROPERTY = 'databus:group';\n const KEY_LATEST_VERSION = \"$latest\";\n\n\n ctrl.$onInit = function () {\n\n ctrl.viewMode = -1;\n\n if (ctrl.collection == null) {\n return;\n }\n }\n\n ctrl.onAddContentClicked = function (sourceNode) {\n ctrl.onAddContent({ source: sourceNode.uri });\n\n ctrl.onChange();\n ctrl.updateViewModel();\n }\n\n\n ctrl.onAddCustomQueryClicked = function (sourceNode) {\n var node = QueryNode.createFrom(sourceNode);\n node.addChild(new QueryNode(DatabusUtils.uuidv4(), null));\n ctrl.onChange();\n }\n\n ctrl.toggleCollapsed = function (node, view) {\n view.collapsed = !view.collapsed;\n\n if (!view.collapsed) {\n ctrl.query(node);\n }\n }\n\n ctrl.isDatabus = async function (uri) {\n var req = {\n method: 'GET',\n url: uri,\n headers: {\n 'Accept': 'application/rdf+turtle'\n }\n }\n\n var res = await ctrl.$http(req);\n var manifest = await DatabusUtils.parseDatabusManifest(res.data);\n var expectedUri = new URL(uri);\n\n if (manifest == undefined || manifest.uri != expectedUri.origin) {\n return false;\n }\n\n return true;\n }\n\n ctrl.getDatabusUri = async function (uri) {\n\n var url = new URL(uri);\n var segments = url.pathname.split('/');\n var base = url.origin;\n var currentUrl = base;\n\n var isDatabus = await ctrl.isDatabus(currentUrl);\n\n if (isDatabus) {\n return currentUrl;\n }\n\n for (var i = 0; segments.length; i++) {\n\n currentUrl += `/${segments[i]}`;\n var isDatabus = await ctrl.isDatabus(currentUrl);\n\n if (isDatabus) {\n return currentUrl;\n }\n }\n\n }\n\n ctrl.onAddResource = async function (uri) {\n\n if (uri.endsWith('/')) {\n uri = uri.substr(0, uri.length - 1);\n }\n\n let node = QueryNode.findChildByUri(ctrl.root, uri);\n\n // Resource already in collection\n if (node != undefined) {\n return;\n }\n\n var databusUri = await ctrl.getDatabusUri(uri);\n\n\n var databusUriLength = DatabusUtils.getResourcePathLength(databusUri);\n var resourceUriLength = DatabusUtils.getResourcePathLength(uri);\n var diff = resourceUriLength - databusUriLength;\n\n if (diff < 0 && diff > 3 || diff == 1) {\n return;\n }\n\n if (diff == 0) {\n ctrl.addDatabus(uri);\n }\n\n if (diff == 2) {\n ctrl.addDatabus(databusUri);\n let databusNode = QueryNode.findChildByUri(ctrl.root, databusUri);\n ctrl.addGroup(databusNode, uri);\n }\n\n if (diff == 3) {\n ctrl.addDatabus(databusUri);\n let databusNode = QueryNode.findChildByUri(ctrl.root, databusUri);\n let groupUri = DatabusUtils.navigateUp(uri);\n ctrl.addGroup(databusNode, groupUri);\n let groupNode = QueryNode.findChildByUri(ctrl.root, groupUri);\n ctrl.addArtifact(groupNode, uri);\n }\n\n ctrl.onChange();\n ctrl.updateViewModel();\n ctrl.$scope.$apply();\n }\n\n ctrl.addDatabus = function (uri) {\n let node = QueryNode.findChildByUri(ctrl.root, uri);\n\n if (node == null) {\n ctrl.root.childNodes.push(new QueryNode(uri, null));\n }\n }\n\n ctrl.addGroup = function (databusNode, uri) {\n let node = QueryNode.findChildByUri(ctrl.root, uri);\n\n if (node == null) {\n databusNode.childNodes.push(new QueryNode(uri, DATAID_GROUP_PROPERTY));\n }\n }\n\n ctrl.addArtifact = function (groupNode, uri) {\n let node = QueryNode.findChildByUri(ctrl.root, uri);\n\n if (node == null) {\n groupNode.childNodes.push(new QueryNode(uri, DATAID_ARTIFACT_PROPERTY));\n }\n }\n\n ctrl.addToCollection = function (source, view, result) {\n\n if (ctrl.isInCollection(result)) {\n QueryNode.removeChildByUri(ctrl.root, result.id[0].value);\n }\n else {\n if (result.typeName[0].value == 'Group') {\n let node = new QueryNode(result.id[0].value, DATAID_GROUP_PROPERTY);\n\n source.childNodes.push(node);\n }\n\n if (result.typeName[0].value == 'Artifact') {\n\n var artifactUri = result.id[0].value;\n let groupUri = DatabusUtils.navigateUp(artifactUri);\n let groupNode = QueryNode.findChildByUri(ctrl.root, groupUri);\n\n if (groupNode == null) {\n groupNode = new QueryNode(groupUri, DATAID_GROUP_PROPERTY);\n source.childNodes.push(groupNode);\n }\n\n let node = new QueryNode(artifactUri, DATAID_ARTIFACT_PROPERTY);\n groupNode.addChild(node);\n }\n }\n\n for (var res of view.searchResults) {\n res.inCollection = ctrl.isInCollection(res);\n }\n\n ctrl.onChange();\n ctrl.updateViewModel();\n }\n\n ctrl.isLastChild = function (group, artifact) {\n\n if (group.childNodes == undefined || group.childNodes.length == 0) {\n return false;\n }\n\n return group.childNodes[group.childNodes.length - 1].uri == artifact.uri;\n }\n\n ctrl.toggleExpand = function (node) {\n node.expanded = !node.expanded;\n ctrl.onChange();\n }\n\n ctrl.mergeFacets = function (node, facets) {\n\n if (node.facets == undefined) {\n node.facets = JSON.parse(JSON.stringify(facets));\n return;\n }\n\n for (var f in facets) {\n\n if (node.facets[f] == undefined) {\n node.facets[f] = JSON.parse(JSON.stringify(facets[f]));\n continue;\n }\n\n for (var value of facets[f].values) {\n if (!node.facets[f].values.includes(value)) {\n node.facets[f].values.push(value);\n }\n }\n }\n\n node.facetLabels = null;\n }\n\n ctrl.getAllFilters = function (groupNode, artifactNode) {\n\n if (artifactNode == null) {\n var result = Object.keys(groupNode.facetSettings)\n return DatabusUtils.uniqueList(result);\n }\n\n var result = Object.keys(groupNode.facetSettings).concat(Object.keys(artifactNode.facetSettings));\n return DatabusUtils.uniqueList(result);\n }\n\n ctrl.$doCheck = function () {\n\n if (ctrl.collection == null) {\n ctrl.previousCollectionId = null;\n return;\n }\n\n if (ctrl.previousCollectionId != ctrl.collection.uuid) {\n ctrl.previousCollectionId = ctrl.collection.uuid;\n\n ctrl.activeNode = null;\n ctrl.viewMode = -1;\n ctrl.updateViewModel();\n }\n }\n\n ctrl.handleKey = function (e, nodeView) {\n if (e.which === 9) {\n nodeView.showSearchResults = false;\n }\n }\n\n ctrl.isInCollection = function (result) {\n let uri = result.id[0].value;\n let node = QueryNode.findChildByUri(ctrl.root, uri);\n return node != null;\n }\n\n ctrl.updateSearchResults = function (view) {\n\n if (view == null || view.searchResults == null) {\n return;\n }\n\n for (var res of view.searchResults) {\n res.inCollection = ctrl.isInCollection(res);\n }\n }\n\n ctrl.searchNode = function (node, nodeView) {\n\n var baseUrl = new URL(node.uri).origin;\n var typeFilters = `typeName=Artifact Group`;\n\n if (node.property == DATAID_GROUP_PROPERTY) {\n var groupName = DatabusUtils.uriToResourceName(node.uri);\n var accountName = DatabusUtils.uriToResourceName(DatabusUtils.navigateUp(node.uri));\n typeFilters = `typeName=Artifact&publisher=${accountName}&group=${groupName}`;\n }\n\n var url = `${baseUrl}/api/search?${typeFilters}&typeNameWeight=0&format=JSON_FULL&minRelevance=15&maxResults=10&query=${nodeView.search}`;\n\n try {\n $http({ method: 'GET', url: url }).then(function successCallback(response) {\n\n nodeView.searchResults = [];\n\n for (var doc of response.data.docs) {\n doc.inCollection = ctrl.isInCollection(doc);\n nodeView.searchResults.push(doc);\n }\n\n }, function errorCallback(response) {\n console.log(response);\n });\n } catch (err) {\n\n }\n\n };\n\n ctrl.toggleExpand = function (view) {\n view.expanded = !view.expanded;\n }\n\n\n ctrl.isValidHttpUrl = function (url) {\n return DatabusUtils.isValidHttpUrl(url);\n }\n\n\n ctrl.updateViewModel = function () {\n ctrl.collectionWrapper = new DatabusCollectionWrapper(ctrl.collection);\n ctrl.root = ctrl.collection.content.root;\n\n ctrl.view = {};\n ctrl.view.groups = {};\n ctrl.view.artifacts = {};\n ctrl.view.sources = {};\n\n for (var s in ctrl.root.childNodes) {\n\n var sourceNode = ctrl.root.childNodes[s];\n\n if (ctrl.view.sources[sourceNode.uri] == undefined) {\n ctrl.view.sources[sourceNode.uri] = {};\n ctrl.view.sources[sourceNode.uri].uri = sourceNode.uri;\n ctrl.view.sources[sourceNode.uri].expanded = true;\n ctrl.view.sources[sourceNode.uri].addMode = 'artifact';\n ctrl.view.sources[sourceNode.uri].customQueryLabel = `New Custom Query`;\n ctrl.view.sources[sourceNode.uri].customQueryInput = ctrl.defaultQuery;\n }\n\n for (var g in sourceNode.childNodes) {\n\n var groupNode = sourceNode.childNodes[g];\n groupNode.expanded = true;\n\n\n ctrl.view.groups[groupNode.uri] = {};\n\n if (DatabusUtils.isValidHttpUrl(groupNode.uri)) {\n\n ctrl.facets.get(groupNode.uri).then(function (res) {\n delete res.facets[DatabusUris.DATABUS_ARTIFACT_PROPERTY];\n ctrl.view.groups[res.uri].facets = res.facets;\n\n var hasVersionFacets = ctrl.view.groups[res.uri].facets[DatabusUris.DCT_HAS_VERSION];\n\n if (hasVersionFacets != null && !hasVersionFacets.values.includes(KEY_LATEST_VERSION)) {\n hasVersionFacets.values.unshift(KEY_LATEST_VERSION);\n }\n\n $scope.$apply();\n });\n\n ctrl.query(groupNode);\n\n for (var a in groupNode.childNodes) {\n\n var artifactNode = groupNode.childNodes[a];\n\n ctrl.view.artifacts[artifactNode.uri] = {};\n ctrl.view.artifacts[artifactNode.uri].expanded = false;\n ctrl.view.artifacts[artifactNode.uri].collapsed = true;\n\n ctrl.facets.get(artifactNode.uri).then(function (res) {\n ctrl.view.artifacts[res.uri].facets = res.facets;\n\n var hasVersionFacets = ctrl.view.artifacts[res.uri].facets[DatabusUris.DCT_HAS_VERSION];\n\n if (hasVersionFacets != null && !hasVersionFacets.values.includes(KEY_LATEST_VERSION)) {\n hasVersionFacets.values.unshift(KEY_LATEST_VERSION);\n }\n\n $scope.$apply();\n //var groupUri = DatabusUtils.navigateUp(artifactNode.uri);\n //ctrl.view.artifacts[artifactNode.uri].facets = result.data;\n //ctrl.mergeFacets(ctrl.view.groups[groupUri], result.data);\n });\n\n\n\n /*en(function(result) {\n\n = result['http://purl.org/dc/terms/hasVersion'].values.unshift(\"$latest\");\n\n\n var groupUri = DatabusUtils.navigateUp(artifactNode.uri);\n ctrl.view.artifacts[artifactNode.uri].facets = result.data;\n ctrl.mergeFacets(ctrl.view.groups[groupUri], result.data);\n\n });\n\n\n \n */\n }\n }\n }\n }\n }\n\n\n\n ctrl.onArtifactDropdownChanged = function (groupNode) {\n ctrl.onChange();\n ctrl.query(groupNode);\n }\n\n ctrl.selectAddFilterValue = function (viewNode, value) {\n viewNode.addFilterValueInput = value;\n viewNode.showValueDrop = false;\n\n ctrl.onAddFilterValueInputChanged(viewNode);\n }\n\n ctrl.selectAddFilterFacet = function (viewNode, value) {\n viewNode.addFilterFacetInput = value;\n viewNode.showFacetDrop = false;\n\n ctrl.onAddFilterFacetInputChanged(viewNode);\n }\n\n ctrl.onAddFilterValueInputChanged = function (viewNode) {\n\n for (var value of viewNode.facets[viewNode.addFilterFacet].values) {\n\n if (viewNode.addFilterValueInput == value) {\n viewNode.addFilterValue = value;\n return;\n }\n }\n\n viewNode.addFilterValue = null;\n }\n\n ctrl.onAddFilterFacetInputChanged = function (viewNode) {\n\n for (var facet in viewNode.facets) {\n\n if (viewNode.addFilterFacetInput == viewNode.facets[facet].label) {\n\n if (viewNode.addFilterFacet != facet) {\n viewNode.addFilterFacet = facet;\n viewNode.addFilterValue = [];\n }\n\n return;\n }\n }\n\n viewNode.addFilterFacet = null;\n viewNode.addFilterValue = [];\n }\n\n ctrl.includesValue = function (objs, value) {\n if (objs == undefined) {\n return false;\n }\n\n for (var obj of objs) {\n if (obj.value == value) {\n return true;\n }\n }\n\n return false;\n }\n\n ctrl.isLocalDatabusNode = function (node) {\n return node.uri == DATABUS_RESOURCE_BASE_URL;\n }\n ctrl.addFilter = function (node, facet, values, checked) {\n\n if (values == null) {\n return;\n }\n\n if (node.facetSettings[facet] == undefined) {\n node.facetSettings[facet] = [];\n }\n\n for (var value of values) {\n\n if (!ctrl.includesValue(node.facetSettings[facet], value.value)) {\n node.facetSettings[facet].push(value);\n }\n }\n\n ctrl.onChange();\n ctrl.query(node);\n }\n\n ctrl.query = function (node) {\n\n if (node.childNodes != undefined && node.childNodes.length > 0) {\n\n node.files = null;\n for (var child of node.childNodes) {\n ctrl.query(child);\n }\n\n return;\n }\n\n var queryNode = QueryNode.createSubTree(node);\n\n var fullQuery = QueryBuilder.build({\n node: queryNode,\n template: QueryTemplates.NODE_FILE_TEMPLATE,\n resourceBaseUrl: DATABUS_RESOURCE_BASE_URL,\n root: ctrl.root\n });\n\n this.querySparql(fullQuery).then(function (result) {\n node.files = result;\n ctrl.$scope.$apply();\n\n });\n }\n\n ctrl.removeFilter = function (node, facet) {\n\n if (node.facetSettings[facet] == undefined) {\n return;\n }\n\n delete node.facetSettings[facet];\n\n ctrl.onChange();\n\n ctrl.query(node);\n }\n\n ctrl.onActiveFilterChanged = function (node) {\n ctrl.onChange();\n ctrl.query(node);\n }\n\n ctrl.getFacetLabels = function (viewNode) {\n\n if (viewNode.facetLabels != undefined) {\n return viewNode.facetLabels;\n }\n var result = [];\n\n for (var f in viewNode.facets) {\n result.push(viewNode.facets[f].label);\n }\n\n viewNode.facetLabels = result;\n return result;\n }\n\n\n ctrl.sortBy = function (property) {\n\n if (ctrl.sortProperty == property) {\n ctrl.sortReverse = !ctrl.sortReverse;\n }\n ctrl.sortProperty = property;\n }\n\n ctrl.formatFileSize = function (size) {\n return DatabusUtils.formatFileSize(size);\n };\n\n ctrl.toHTML = function (html) {\n return $sce.trustAsHtml(html);\n };\n\n ctrl.onComponentAdded = function () {\n\n }\n\n ctrl.customExpanded = function () {\n return ctrl.customNode.expanded && ctrl.collection.content.customQueries.length > 0;\n }\n\n ctrl.generatedExpanded = function () {\n return ctrl.generatedNode.expanded && ctrl.collection.content.groups.length > 0;\n }\n\n ctrl.publishCollection = function () {\n ctrl.onPublish();\n }\n\n ctrl.delete = function () {\n ctrl.onDelete();\n }\n\n ctrl.goToResource = function (node) {\n window.location = node.uri;\n }\n\n ctrl.formatGroupPrefix = function (uri) {\n return DatabusUtils.uriToName(DatabusUtils.navigateUp(uri));\n }\n\n ctrl.formatArtifactPrefix = function (uri) {\n var nav = DatabusUtils.navigateUp(uri);\n var groupName = DatabusUtils.uriToName(nav);\n var userName = DatabusUtils.uriToName(DatabusUtils.navigateUp(nav));\n\n return userName + '/' + groupName;\n }\n\n ctrl.uriToName = function (uri) {\n return DatabusUtils.uriToName(uri);\n }\n\n ctrl.objSize = function (obj) {\n return DatabusUtils.objSize(obj);\n }\n\n ctrl.showCollectionSearch = function () {\n ctrl.open = false;\n ctrl.viewMode = 0;\n ctrl.activeNode = ctrl.rootNode;\n\n $location.hash('search');\n }\n\n // ctrl.printJSON = function() {\n // console.log(JSON.stringify(ctrl.collection));\n // }\n\n // SHOW NODES\n ctrl.showGroupNode = function (groupNode) {\n ctrl.open = true;\n ctrl.viewMode = 3;\n ctrl.activeNode = QueryNode.createFrom(groupNode);\n\n this.updateQuery();\n }\n\n ctrl.showArtifactNode = function (artifactNode, groupNode) {\n\n ctrl.open = true;\n ctrl.viewMode = 1;\n ctrl.activeNode = QueryNode.createFrom(artifactNode);\n\n this.updateQuery();\n }\n\n ctrl.querySparql = async function (query) {\n\n\n try {\n\n var req = {\n method: 'POST',\n url: DatabusConstants.DATABUS_SPARQL_ENDPOINT_URL,\n data: \"format=json&query=\" + encodeURIComponent(query),\n headers: {\n \"Content-type\": \"application/x-www-form-urlencoded\"\n },\n }\n\n var updateResponse = await ctrl.$http(req);\n\n var data = updateResponse.data;\n var bindings = data.results.bindings;\n\n for (var b in bindings) {\n ctrl.reduceBinding(bindings[b]);\n }\n\n return bindings;\n\n\n } catch (e) {\n console.log(e);\n }\n }\n\n ctrl.reduceBinding = function (binding) {\n for (var key in binding) {\n binding[key] = binding[key].value;\n }\n\n return binding;\n }\n\n\n\n ctrl.updateQuery = function () {\n var queryNode = QueryNode.createSubTree(ctrl.activeNode);\n\n ctrl.activeFileQuery = QueryBuilder.build({\n node: queryNode,\n template: QueryTemplates.DEFAULT_FILE_TEMPLATE,\n resourceBaseUrl: DATABUS_RESOURCE_BASE_URL\n });\n\n ctrl.activeFullQuery = QueryBuilder.build({\n node: queryNode,\n template: QueryTemplates.NODE_FILE_TEMPLATE,\n resourceBaseUrl: DATABUS_RESOURCE_BASE_URL\n });\n }\n\n ctrl.onActiveNodeChanged = function () {\n this.updateQuery();\n\n ctrl.onChange();\n }\n\n ctrl.addCustomNode = function (sourceNode, label, desc, query) {\n\n var node = new QueryNode(label, query);\n sourceNode.childNodes.push(node);\n\n\n ctrl.updateViewModel();\n ctrl.onChange();\n }\n\n ctrl.removeNode = function (node) {\n\n var parent = ctrl.collectionWrapper.getParentNode(node);\n ctrl.collectionWrapper.removeNodeByUri(node.uri);\n\n if (parent != null) {\n ctrl.query(parent);\n }\n\n ctrl.onChange();\n }\n\n ctrl.showCustomQueryNode = function (customQueryNode) {\n ctrl.open = true;\n ctrl.viewMode = 2;\n ctrl.activeNode = customQueryNode;\n }\n\n ctrl.list = function (setting) {\n\n var allEntries = Object.keys(setting).map(function (key, index) {\n\n var label = undefined;\n var entry = setting[key];\n\n if (entry.value == '') {\n label = 'None';\n } else if (entry.value == '$latest') {\n label = 'Latest Version';\n } else {\n label = entry.value;\n }\n\n if (entry.checked) {\n return label;\n } else {\n return `${label}`;\n }\n });\n\n\n var list = [];\n var maxLength = 50;\n var length = 0;\n var hasOverflow = false;\n\n for (var entry of allEntries) {\n if (entry.length + length > maxLength) {\n hasOverflow = true;\n break;\n }\n\n length += entry.length;\n list.push(entry);\n }\n\n if (hasOverflow) {\n list.push('...');\n }\n\n return ctrl.$sce.trustAsHtml(list.join(', '));\n // return setting.map(function (v) { return v.value }).join(', ');\n }\n}\n\n\nmodule.exports = CollectionHierarchyControllerTwo;\n\n//# sourceURL=webpack://databus-webapp/./js/components/collection-hierarchy-two/collection-hierarchy.js?\n}"); -/***/ }), +/***/ }, -/***/ "./js/components/collection-node/collection-node.js": +/***/ "./js/components/collection-node/collection-node.js" /*!**********************************************************!*\ !*** ./js/components/collection-node/collection-node.js ***! \**********************************************************/ -/***/ ((module) => { +(module) { -eval("// TODO Fabian evtl bug\n\n// hinzufügen eines Controllers zum Modul\nfunction CollectionNodeController() {\n\n var ctrl = this;\n\n ctrl.$onInit = function() {\n\n }\n\n ctrl.removeNode = function() {\n ctrl.onRemoveNode();\n }\n\n ctrl.click = function() {\n ctrl.onClick();\n }\n}\n\nmodule.exports = CollectionNodeController;\n\n//# sourceURL=webpack://databus-webapp/./js/components/collection-node/collection-node.js?"); +eval("{// TODO Fabian evtl bug\n\n// hinzufügen eines Controllers zum Modul\nfunction CollectionNodeController() {\n\n var ctrl = this;\n\n ctrl.$onInit = function() {\n\n }\n\n ctrl.removeNode = function() {\n ctrl.onRemoveNode();\n }\n\n ctrl.click = function() {\n ctrl.onClick();\n }\n}\n\nmodule.exports = CollectionNodeController;\n\n//# sourceURL=webpack://databus-webapp/./js/components/collection-node/collection-node.js?\n}"); -/***/ }), +/***/ }, -/***/ "./js/components/collection-search/collection-search.js": +/***/ "./js/components/collection-search/collection-search.js" /*!**************************************************************!*\ !*** ./js/components/collection-search/collection-search.js ***! \**************************************************************/ -/***/ ((module) => { +(module) { -eval("// hinzufügen eines Controllers zum Modul\nfunction CollectionSearchController(collectionManager, $http, $interval, $sce) {\n\n var ctrl = this;\n\n ctrl.results = [];\n ctrl.collectionManager = collectionManager;\n\n\n\n \n\n\n\n ctrl.formatResult = function (result) {\n return $sce.trustAsHtml(result);\n }\n\n ctrl.getDatabusUrls = function () {\n\n if (ctrl.databusUrls != undefined) {\n return ctrl.databusUrls;\n }\n\n ctrl.databusUrls = [];\n var root = ctrl.collection.content.root;\n\n for (var sourceNode of root.childNodes) {\n ctrl.databusUrls.push(sourceNode.uri);\n }\n\n return ctrl.databusUrls;\n }\n\n ctrl.$onInit = function () {\n\n ctrl.searchInput = '';\n ctrl.filters = {};\n ctrl.filters.filterArtifact = false;\n ctrl.filters.filterGroup = false;\n ctrl.searchCooldown = 1000;\n\n ctrl.root = QueryNode.createFrom(ctrl.collection.content.root);\n\n ctrl.collectionWrapper = new DatabusCollectionWrapper(ctrl.collection);\n ctrl.autoFocus = true;\n }\n\n // TODO Fabian\n ctrl.isInCollection = function (result) {\n let uri = result.id[0].value;\n let node = QueryNode.findChildByUri(ctrl.root, uri);\n\n return node != null;\n }\n\n\n ctrl.addToCollection = function (result) {\n\n var currentSource = ctrl.targetDatabusUrl;\n var sourceNode = QueryNode.findChildByUri(ctrl.root, currentSource);\n\n if (result.inCollection) {\n QueryNode.removeChildByUri(ctrl.root, result.id[0].value);\n }\n else {\n if (result.typeName[0].value == 'Group') {\n let node = new QueryNode(result.id[0].value, 'databus:group');\n\n sourceNode.addChild(node);\n ctrl.onComponentAdded();\n }\n\n if (result.typeName[0].value == 'Artifact') {\n\n var artifactUri = result.id[0].value;\n let groupUri = DatabusUtils.navigateUp(artifactUri);\n let groupNode = QueryNode.findChildByUri(ctrl.root, groupUri);\n\n if (groupNode == null) {\n groupNode = new QueryNode(groupUri, 'databus:group');\n sourceNode.addChild(groupNode);\n }\n\n let node = new QueryNode(artifactUri, 'databus:artifact');\n groupNode.addChild(node);\n\n ctrl.onComponentAdded();\n }\n }\n\n for (let r in ctrl.results) {\n ctrl.results[r].inCollection = ctrl.isInCollection(ctrl.results[r]);\n }\n\n ctrl.collectionManager.saveLocally();\n\n console.log(ctrl.root);\n }\n\n $interval(function () {\n\n if (ctrl.searchChanged) {\n\n if (!DatabusUtils.isValidHttpUrl(ctrl.targetDatabusUrl)) {\n return;\n }\n\n var typeFilters = '?typeName=Artifact Group';\n\n if (ctrl.filters.filterArtifact || ctrl.filters.filterGroup) {\n\n typeFilters = '?typeName='\n if (ctrl.filters.filterArtifact) {\n typeFilters += 'Artifact ';\n }\n if (ctrl.filters.filterGroup) {\n typeFilters += 'Group ';\n }\n }\n\n ctrl.lastQuery = ctrl.searchInput;\n\n try {\n\n $http({\n method: 'GET',\n url: ctrl.targetDatabusUrl + '/api/search' + typeFilters + '&format=JSON_FULL&minRelevance=10&maxResults=10&query='\n + ctrl.searchInput,\n }).then(function successCallback(response) {\n\n if (ctrl.lastQuery != response.data.query) {\n return;\n }\n\n ctrl.results = response.data.docs;\n\n for (var r in ctrl.results) {\n ctrl.results[r].inCollection = ctrl.isInCollection(ctrl.results[r]);\n }\n\n }, function errorCallback(response) {\n });\n } catch (err) {\n\n }\n\n ctrl.searchChanged = false;\n };\n }, ctrl.searchCooldown);\n\n ctrl.search = function () {\n ctrl.searchChanged = true;\n };\n}\n\n\nmodule.exports = CollectionSearchController;\n\n//# sourceURL=webpack://databus-webapp/./js/components/collection-search/collection-search.js?"); +eval("{// hinzufügen eines Controllers zum Modul\nfunction CollectionSearchController(collectionManager, $http, $interval, $sce) {\n\n var ctrl = this;\n\n ctrl.results = [];\n ctrl.collectionManager = collectionManager;\n\n\n\n \n\n\n\n ctrl.formatResult = function (result) {\n return $sce.trustAsHtml(result);\n }\n\n ctrl.getDatabusUrls = function () {\n\n if (ctrl.databusUrls != undefined) {\n return ctrl.databusUrls;\n }\n\n ctrl.databusUrls = [];\n var root = ctrl.collection.content.root;\n\n for (var sourceNode of root.childNodes) {\n ctrl.databusUrls.push(sourceNode.uri);\n }\n\n return ctrl.databusUrls;\n }\n\n ctrl.$onInit = function () {\n\n ctrl.searchInput = '';\n ctrl.filters = {};\n ctrl.filters.filterArtifact = false;\n ctrl.filters.filterGroup = false;\n ctrl.searchCooldown = 1000;\n\n ctrl.root = QueryNode.createFrom(ctrl.collection.content.root);\n\n ctrl.collectionWrapper = new DatabusCollectionWrapper(ctrl.collection);\n ctrl.autoFocus = true;\n }\n\n // TODO Fabian\n ctrl.isInCollection = function (result) {\n let uri = result.id[0].value;\n let node = QueryNode.findChildByUri(ctrl.root, uri);\n\n return node != null;\n }\n\n\n ctrl.addToCollection = function (result) {\n\n var currentSource = ctrl.targetDatabusUrl;\n var sourceNode = QueryNode.findChildByUri(ctrl.root, currentSource);\n\n if (result.inCollection) {\n QueryNode.removeChildByUri(ctrl.root, result.id[0].value);\n }\n else {\n if (result.typeName[0].value == 'Group') {\n let node = new QueryNode(result.id[0].value, 'databus:group');\n\n sourceNode.addChild(node);\n ctrl.onComponentAdded();\n }\n\n if (result.typeName[0].value == 'Artifact') {\n\n var artifactUri = result.id[0].value;\n let groupUri = DatabusUtils.navigateUp(artifactUri);\n let groupNode = QueryNode.findChildByUri(ctrl.root, groupUri);\n\n if (groupNode == null) {\n groupNode = new QueryNode(groupUri, 'databus:group');\n sourceNode.addChild(groupNode);\n }\n\n let node = new QueryNode(artifactUri, 'databus:artifact');\n groupNode.addChild(node);\n\n ctrl.onComponentAdded();\n }\n }\n\n for (let r in ctrl.results) {\n ctrl.results[r].inCollection = ctrl.isInCollection(ctrl.results[r]);\n }\n\n ctrl.collectionManager.saveLocally();\n\n console.log(ctrl.root);\n }\n\n $interval(function () {\n\n if (ctrl.searchChanged) {\n\n if (!DatabusUtils.isValidHttpUrl(ctrl.targetDatabusUrl)) {\n return;\n }\n\n var typeFilters = '?typeName=Artifact Group';\n\n if (ctrl.filters.filterArtifact || ctrl.filters.filterGroup) {\n\n typeFilters = '?typeName='\n if (ctrl.filters.filterArtifact) {\n typeFilters += 'Artifact ';\n }\n if (ctrl.filters.filterGroup) {\n typeFilters += 'Group ';\n }\n }\n\n ctrl.lastQuery = ctrl.searchInput;\n\n try {\n\n $http({\n method: 'GET',\n url: ctrl.targetDatabusUrl + '/api/search' + typeFilters + '&format=JSON_FULL&minRelevance=10&maxResults=10&query='\n + ctrl.searchInput,\n }).then(function successCallback(response) {\n\n if (ctrl.lastQuery != response.data.query) {\n return;\n }\n\n ctrl.results = response.data.docs;\n\n for (var r in ctrl.results) {\n ctrl.results[r].inCollection = ctrl.isInCollection(ctrl.results[r]);\n }\n\n }, function errorCallback(response) {\n });\n } catch (err) {\n\n }\n\n ctrl.searchChanged = false;\n };\n }, ctrl.searchCooldown);\n\n ctrl.search = function () {\n ctrl.searchChanged = true;\n };\n}\n\n\nmodule.exports = CollectionSearchController;\n\n//# sourceURL=webpack://databus-webapp/./js/components/collection-search/collection-search.js?\n}"); -/***/ }), +/***/ }, -/***/ "./js/components/collection-statistics/collection-statistics.js": +/***/ "./js/components/collection-statistics/collection-statistics.js" /*!**********************************************************************!*\ !*** ./js/components/collection-statistics/collection-statistics.js ***! \**********************************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +(module, __unused_webpack_exports, __webpack_require__) { -eval("const DatabusCollectionUtils = __webpack_require__(/*! ../../collections/databus-collection-utils */ \"./js/collections/databus-collection-utils.js\");\nconst DatabusUtils = __webpack_require__(/*! ../../utils/databus-utils */ \"./js/utils/databus-utils.js\");\nconst DatabusWebappUtils = __webpack_require__(/*! ../../utils/databus-webapp-utils */ \"./js/utils/databus-webapp-utils.js\");\n\n// hinzufügen eines Controllers zum Modul\nfunction CollectionStatisticsController($http, $scope, $location, $sce) {\n\n var ctrl = this;\n ctrl.$http = $http;\n ctrl.utils = new DatabusWebappUtils($scope, $sce);\n\n\n ctrl.$onInit = function() {\n ctrl.isLoading = true;\n DatabusCollectionUtils.getCollectionStatistics(ctrl.$http, ctrl.collection).then(function(result) {\n ctrl.statistics = result;\n ctrl.isLoading = false;\n $scope.$apply();\n }, function(err) {\n ctrl.statistics = null;\n ctrl.isLoading = false;\n });\n }\n\n ctrl.markdownToHtml = function(markdown) {\n return ctrl.utils.markdownToHtml(markdown);\n };\n\n ctrl.formatUploadSize = function(size) {\n return DatabusUtils.formatFileSize(size);\n };\n}\n\nmodule.exports = CollectionStatisticsController;\n\n\n\n//# sourceURL=webpack://databus-webapp/./js/components/collection-statistics/collection-statistics.js?"); +eval("{const DatabusCollectionUtils = __webpack_require__(/*! ../../collections/databus-collection-utils */ \"./js/collections/databus-collection-utils.js\");\nconst DatabusUtils = __webpack_require__(/*! ../../utils/databus-utils */ \"./js/utils/databus-utils.js\");\nconst DatabusWebappUtils = __webpack_require__(/*! ../../utils/databus-webapp-utils */ \"./js/utils/databus-webapp-utils.js\");\n\n// hinzufügen eines Controllers zum Modul\nfunction CollectionStatisticsController($http, $scope, $location, $sce) {\n\n var ctrl = this;\n ctrl.$http = $http;\n ctrl.utils = new DatabusWebappUtils($scope, $sce);\n\n\n ctrl.$onInit = function() {\n ctrl.isLoading = true;\n DatabusCollectionUtils.getCollectionStatistics(ctrl.$http, ctrl.collection).then(function(result) {\n ctrl.statistics = result;\n ctrl.isLoading = false;\n $scope.$apply();\n }, function(err) {\n ctrl.statistics = null;\n ctrl.isLoading = false;\n });\n }\n\n ctrl.markdownToHtml = function(markdown) {\n return ctrl.utils.markdownToHtml(markdown);\n };\n\n ctrl.formatUploadSize = function(size) {\n return DatabusUtils.formatFileSize(size);\n };\n}\n\nmodule.exports = CollectionStatisticsController;\n\n\n\n//# sourceURL=webpack://databus-webapp/./js/components/collection-statistics/collection-statistics.js?\n}"); -/***/ }), +/***/ }, -/***/ "./js/components/collection-status/collection-status.js": +/***/ "./js/components/collection-status/collection-status.js" /*!**************************************************************!*\ !*** ./js/components/collection-status/collection-status.js ***! \**************************************************************/ -/***/ ((module) => { +(module) { -eval("\n\n// hinzufügen eines Controllers zum Modul\nfunction CollectionStatusController($http, $location, $sce) {\n\n var ctrl = this;\n\n ctrl.$onInit = function() {\n\n ctrl.colors = [];\n ctrl.colors.push('#b54c4c');\n ctrl.colors.push('#aaa');\n ctrl.colors.push('#aaa');\n ctrl.colors.push('#e8ca5f');\n ctrl.colors.push('#3a3');\n\n ctrl.labels = [];\n ctrl.labels.push('Draft');\n ctrl.labels.push('Hidden, Uncommitted Changes');\n ctrl.labels.push('Hidden');\n ctrl.labels.push('Visible, Uncommitted Changes');\n ctrl.labels.push('Visible');\n }\n\n ctrl.$doCheck = function() {\n if(ctrl.isDraft) {\n ctrl.status = 0;\n return;\n }\n\n if(ctrl.isPublished) {\n ctrl.status = ctrl.hasLocalChanges ? 3 : 4;\n } else {\n ctrl.status = ctrl.hasLocalChanges ? 1 : 2;\n }\n }\n}\n\nmodule.exports = CollectionStatusController;\n\n\n//# sourceURL=webpack://databus-webapp/./js/components/collection-status/collection-status.js?"); +eval("{\n\n// hinzufügen eines Controllers zum Modul\nfunction CollectionStatusController($http, $location, $sce) {\n\n var ctrl = this;\n\n ctrl.$onInit = function() {\n\n ctrl.colors = [];\n ctrl.colors.push('#b54c4c');\n ctrl.colors.push('#aaa');\n ctrl.colors.push('#aaa');\n ctrl.colors.push('#e8ca5f');\n ctrl.colors.push('#3a3');\n\n ctrl.labels = [];\n ctrl.labels.push('Draft');\n ctrl.labels.push('Hidden, Uncommitted Changes');\n ctrl.labels.push('Hidden');\n ctrl.labels.push('Visible, Uncommitted Changes');\n ctrl.labels.push('Visible');\n }\n\n ctrl.$doCheck = function() {\n if(ctrl.isDraft) {\n ctrl.status = 0;\n return;\n }\n\n if(ctrl.isPublished) {\n ctrl.status = ctrl.hasLocalChanges ? 3 : 4;\n } else {\n ctrl.status = ctrl.hasLocalChanges ? 1 : 2;\n }\n }\n}\n\nmodule.exports = CollectionStatusController;\n\n\n//# sourceURL=webpack://databus-webapp/./js/components/collection-status/collection-status.js?\n}"); -/***/ }), +/***/ }, -/***/ "./js/components/databus-alert/databus-alert-controller.js": +/***/ "./js/components/databus-alert/databus-alert-controller.js" /*!*****************************************************************!*\ !*** ./js/components/databus-alert/databus-alert-controller.js ***! \*****************************************************************/ -/***/ ((module) => { +(module) { -eval("\n// hinzufügen eines Controllers zum Modul\nfunction DatabusAlertController($scope, $timeout) {\n\n var ctrl = this;\n\n $scope.$on('onDatabusAlert', function(e, data) {\n ctrl.isSuccess = data.isSuccess;\n ctrl.message = data.message;\n ctrl.isVisible = false;\n\n if(ctrl.hidePromise != null) {\n $timeout.cancel(ctrl.hidePromise);\n }\n\n $timeout(function() {\n ctrl.isVisible = true;\n }, 0);\n\n ctrl.hidePromise = $timeout(function() {\n ctrl.isVisible = false;\n }, data.ms);\n });\n\n ctrl.$onInit = function() {\n\n }\n\n ctrl.isSuccess = function() {\n return ctrl.isSuccess;\n }\n\n ctrl.$doCheck = function() {\n \n }\n}\n\nmodule.exports = DatabusAlertController;\n\n\n//# sourceURL=webpack://databus-webapp/./js/components/databus-alert/databus-alert-controller.js?"); +eval("{\n// hinzufügen eines Controllers zum Modul\nfunction DatabusAlertController($scope, $timeout) {\n\n var ctrl = this;\n\n $scope.$on('onDatabusAlert', function(e, data) {\n ctrl.isSuccess = data.isSuccess;\n ctrl.message = data.message;\n ctrl.isVisible = false;\n\n if(ctrl.hidePromise != null) {\n $timeout.cancel(ctrl.hidePromise);\n }\n\n $timeout(function() {\n ctrl.isVisible = true;\n }, 0);\n\n ctrl.hidePromise = $timeout(function() {\n ctrl.isVisible = false;\n }, data.ms);\n });\n\n ctrl.$onInit = function() {\n\n }\n\n ctrl.isSuccess = function() {\n return ctrl.isSuccess;\n }\n\n ctrl.$doCheck = function() {\n \n }\n}\n\nmodule.exports = DatabusAlertController;\n\n\n//# sourceURL=webpack://databus-webapp/./js/components/databus-alert/databus-alert-controller.js?\n}"); -/***/ }), +/***/ }, -/***/ "./js/components/databus-alert/databus-alert.js": +/***/ "./js/components/databus-alert/databus-alert.js" /*!******************************************************!*\ !*** ./js/components/databus-alert/databus-alert.js ***! \******************************************************/ -/***/ ((module) => { +(module) { -eval("\nclass DatabusAlert {\n static alert($scope, isSuccess, message, ms) {\n if(ms == undefined) {\n ms = 3000; \n }\n $scope.$broadcast('onDatabusAlert', { isSuccess: isSuccess, message: message, ms: ms});\n }\n\n static alertCode($scope, code, ms) {\n if(ms == undefined) {\n ms = 3000; \n }\n\n var isSuccess = code >= 200 && code < 400;\n $scope.$broadcast('onDatabusAlert', { isSuccess: isSuccess, message: message, ms: ms});\n }\n}\n\n\nmodule.exports = DatabusAlert;\n\n\n//# sourceURL=webpack://databus-webapp/./js/components/databus-alert/databus-alert.js?"); +eval("{\nclass DatabusAlert {\n static alert($scope, isSuccess, message, ms) {\n if(ms == undefined) {\n ms = 3000; \n }\n $scope.$broadcast('onDatabusAlert', { isSuccess: isSuccess, message: message, ms: ms});\n }\n\n static alertCode($scope, code, ms) {\n if(ms == undefined) {\n ms = 3000; \n }\n\n var isSuccess = code >= 200 && code < 400;\n $scope.$broadcast('onDatabusAlert', { isSuccess: isSuccess, message: message, ms: ms});\n }\n}\n\n\nmodule.exports = DatabusAlert;\n\n\n//# sourceURL=webpack://databus-webapp/./js/components/databus-alert/databus-alert.js?\n}"); -/***/ }), +/***/ }, -/***/ "./js/components/databus-icon/databus-icon.js": +/***/ "./js/components/databus-icon/databus-icon.js" /*!****************************************************!*\ !*** ./js/components/databus-icon/databus-icon.js ***! \****************************************************/ -/***/ ((module) => { +(module) { -eval("// hinzufügen eines Controllers zum Modul\nfunction DatabusIconController() {\n\n var ctrl = this;\n\n ctrl.iconMap = {};\n ctrl.iconMap['databus'] = \"m 1.8847 0.3851 v 2.6248 l 14.6656 -0.0005 l 3.1363 4.4338 l -0.001 16.0412 l 2.3606 -0.001 V 0.3851 Z m 9.2176 4.1976 l -2.8418 0.003 l 3.5989 5.2742 l -0.002 13.6233 l 2.352 -0.001 l 0.0083 -14.3005 z m -4.7365 0.001 l -4.4826 0.001 l 0.002 18.898 l 8.3978 -0.002 l 0.0005 -13.1455 z m 6.6256 0 l 2.7991 4.1094 l -0.0198 14.7881 l 2.3515 -0.001 l 0.003 -15.5479 l -2.2793 -3.347 z\";\n ctrl.iconMap['add'] = \"M 11 11 M 2 12 L 11 12 L 11 21 L 12 21 L 12 12 L 21 12 L 21 11 L 12 11 L 12 2 L 11 2 L 11 11 L 2 11 L 2 12\";\n ctrl.iconMap['remove'] = \"M 11 11 M 2 12 L 21 12 L 21 11 L 2 11 L 2 12\";\n ctrl.iconMap['add-thick'] = \"m11 11h-7.25c-.414 0-.75.336-.75.75s.336.75.75.75h7.25v7.25c0 .414.336.75.75.75s.75-.336.75-.75v-7.25h7.25c.414 0 .75-.336.75-.75s-.336-.75-.75-.75h-7.25v-7.25c0-.414-.336-.75-.75-.75s-.75.336-.75.75z\";\n ctrl.iconMap['close'] = \"m12 10.93 5.719-5.72c.146-.146.339-.219.531-.219.404 0 .75.324.75.749 0 .193-.073.385-.219.532l-5.72 5.719 5.719 5.719c.147.147.22.339.22.531 0 .427-.349.75-.75.75-.192 0-.385-.073-.531-.219l-5.719-5.719-5.719 5.719c-.146.146-.339.219-.531.219-.401 0-.75-.323-.75-.75 0-.192.073-.384.22-.531l5.719-5.719-5.72-5.719c-.146-.147-.219-.339-.219-.532 0-.425.346-.749.75-.749.192 0 .385.073.531.219z\";\n ctrl.iconMap['delete'] = \"M9 3h6v-1.75c0-.066-.026-.13-.073-.177-.047-.047-.111-.073-.177-.073h-5.5c-.066 0-.13.026-.177.073-.047.047-.073.111-.073.177v1.75zm11 1h-16v18c0 .552.448 1 1 1h14c.552 0 1-.448 1-1v-18zm-10 3.5c0-.276-.224-.5-.5-.5s-.5.224-.5.5v12c0 .276.224.5.5.5s.5-.224.5-.5v-12zm5 0c0-.276-.224-.5-.5-.5s-.5.224-.5.5v12c0 .276.224.5.5.5s.5-.224.5-.5v-12zm8-4.5v1h-2v18c0 1.105-.895 2-2 2h-14c-1.105 0-2-.895-2-2v-18h-2v-1h7v-2c0-.552.448-1 1-1h6c.552 0 1 .448 1 1v2h7z\";\n ctrl.iconMap['goto'] = \"M21.883 12l-7.527 6.235.644.765 9-7.521-9-7.479-.645.764 7.529 6.236h-21.884v1h21.883z\";\n ctrl.iconMap['edit'] = \"M8.071 21.586l-7.071 1.414 1.414-7.071 14.929-14.929 5.657 5.657-14.929 14.929zm-.493-.921l-4.243-4.243-1.06 5.303 5.303-1.06zm9.765-18.251l-13.3 13.301 4.242 4.242 13.301-13.3-4.243-4.243z\";\n ctrl.iconMap['edit-thick'] = \"M7.127 22.564l-7.126 1.436 1.438-7.125 5.688 5.689zm-4.274-7.104l5.688 5.689 15.46-15.46-5.689-5.689-15.459 15.46z\";\n ctrl.iconMap['goback'] = \"M2.117 12l7.527 6.235-.644.765-9-7.521 9-7.479.645.764-7.529 6.236h21.884v1h-21.883z\";\n ctrl.iconMap['right'] = \"M4 .755l14.374 11.245-14.374 11.219.619.781 15.381-12-15.391-12-.609.755z\";\n ctrl.iconMap['left'] = \"M20 .755l-14.374 11.245 14.374 11.219-.619.781-15.381-12 15.391-12 .609.755z\";\n ctrl.iconMap['down'] = \"M23.245 4l-11.245 14.374-11.219-14.374-.781.619 12 15.381 12-15.391-.755-.609z\";\n ctrl.iconMap['left-thick'] = \"M16.67 0l2.83 2.829-9.339 9.175 9.339 9.167-2.83 2.829-12.17-11.996z\";\n ctrl.iconMap['help'] = \"M12 0c6.623 0 12 5.377 12 12s-5.377 12-12 12-12-5.377-12-12 5.377-12 12-12zm0 1c6.071 0 11 4.929 11 11s-4.929 11-11 11-11-4.929-11-11 4.929-11 11-11zm.053 17c.466 0 .844-.378.844-.845 0-.466-.378-.844-.844-.844-.466 0-.845.378-.845.844 0 .467.379.845.845.845zm.468-2.822h-.998c-.035-1.162.182-2.054.939-2.943.491-.57 1.607-1.479 1.945-2.058.722-1.229.077-3.177-2.271-3.177-1.439 0-2.615.877-2.928 2.507l-1.018-.102c.28-2.236 1.958-3.405 3.922-3.405 1.964 0 3.615 1.25 3.615 3.22 0 1.806-1.826 2.782-2.638 3.868-.422.563-.555 1.377-.568 2.09z\";\n ctrl.iconMap['max'] = \"M24 22h-24v-20h24v20zm-7-1v-15h-16v15h16zm1 0h5v-18h-22v2h17v16zm-6-6h-1v-3.241l-7.241 7.241-.759-.759 7.241-7.241h-3.241v-1h5v5z\";\n ctrl.iconMap['min'] = \"M24 22h-24v-20h24v20zm-23-9v8h10v-8h-10zm22 8v-18h-22v9h11v9h11zm-4-9h-5v-5h1v3.241l5.241-5.241.759.759-5.241 5.241h3.241v1z\";\n ctrl.iconMap['error'] = \"M24 23h-24l12-22 12 22zm-22.315-1h20.63l-10.315-18.912-10.315 18.912zm10.315-2c.466 0 .845-.378.845-.845 0-.466-.379-.844-.845-.844-.466 0-.845.378-.845.844 0 .467.379.845.845.845zm.5-11v8h-1v-8h1z\";\n ctrl.iconMap['info'] = \"M12 0c6.623 0 12 5.377 12 12s-5.377 12-12 12-12-5.377-12-12 5.377-12 12-12zm0 1c6.071 0 11 4.929 11 11s-4.929 11-11 11-11-4.929-11-11 4.929-11 11-11zm.5 17h-1v-9h1v9zm-.5-12c.466 0 .845.378.845.845 0 .466-.379.844-.845.844-.466 0-.845-.378-.845-.844 0-.467.379-.845.845-.845z\";\n ctrl.iconMap['eye'] = \"M12.01 20c-5.065 0-9.586-4.211-12.01-8.424 2.418-4.103 6.943-7.576 12.01-7.576 5.135 0 9.635 3.453 11.999 7.564-2.241 4.43-6.726 8.436-11.999 8.436zm-10.842-8.416c.843 1.331 5.018 7.416 10.842 7.416 6.305 0 10.112-6.103 10.851-7.405-.772-1.198-4.606-6.595-10.851-6.595-6.116 0-10.025 5.355-10.842 6.584zm10.832-4.584c2.76 0 5 2.24 5 5s-2.24 5-5 5-5-2.24-5-5 2.24-5 5-5zm0 1c2.208 0 4 1.792 4 4s-1.792 4-4 4-4-1.792-4-4 1.792-4 4-4z\";\n ctrl.iconMap['add-artifact'] = \"M 12 0 M 12.016 1.424 L 21.756 12.053 L 12.016 22.563 L 2.204 12.005 L 3.396 10.721 L 2.774 10.058 L 1 12 L 12 24 L 23 12 L 12 0 L 10.153 2.078 L 10.837 2.741 Z M 6 6 L 6 2 L 7 2 L 7 6 L 11 6 L 11 7 L 7 7 L 7 11 L 6 11 L 6 7 L 2 7 L 2 6 L 6 6\";\n ctrl.iconMap['add-button'] = \"M24 10h-10v-10h-4v10h-10v4h10v10h4v-10h10z\";\n ctrl.iconMap['collections'] = \"M11.499 12.03v11.971l-10.5-5.603v-11.835l10.5 5.467zm11.501 6.368l-10.501 5.602v-11.968l10.501-5.404v11.77zm-16.889-15.186l10.609 5.524-4.719 2.428-10.473-5.453 4.583-2.499zm16.362 2.563l-4.664 2.4-10.641-5.54 4.831-2.635 10.474 5.775z\";\n ctrl.iconMap['collections-thin'] = \"M23 6.066v12.065l-11.001 5.869-11-5.869v-12.131l11-6 11.001 6.066zm-21.001 11.465l9.5 5.069v-10.57l-9.5-4.946v10.447zm20.001-10.388l-9.501 4.889v10.568l9.501-5.069v-10.388zm-5.52 1.716l-9.534-4.964-4.349 2.373 9.404 4.896 4.479-2.305zm-8.476-5.541l9.565 4.98 3.832-1.972-9.405-5.185-3.992 2.177z\";\n ctrl.iconMap['content'] = \"M9.484 15.696l-.711-.696-2.552 2.607-1.539-1.452-.698.709 2.25 2.136 3.25-3.304zm0-5l-.711-.696-2.552 2.607-1.539-1.452-.698.709 2.25 2.136 3.25-3.304zm0-5l-.711-.696-2.552 2.607-1.539-1.452-.698.709 2.25 2.136 3.25-3.304zm10.516 11.304h-8v1h8v-1zm0-5h-8v1h8v-1zm0-5h-8v1h8v-1zm4-5h-24v20h24v-20zm-1 19h-22v-18h22v18z\"\n ctrl.iconMap['menu'] = \"M24 18v1h-24v-1h24zm0-6v1h-24v-1h24zm0-6v1h-24v-1h24z\";\n ctrl.iconMap['copy'] = \"M17 7h6v16h-16v-6h-6v-16h16v6zm5 1h-14v14h14v-14zm-6-1v-5h-14v14h5v-9h9z\";\n ctrl.iconMap['upload'] = \"M9 16h-8v6h22v-6h-8v-1h9v8h-24v-8h9v1zm11 2c.552 0 1 .448 1 1s-.448 1-1 1-1-.448-1-1 .448-1 1-1zm-7.5 0h-1v-14.883l-4.735 5.732-.765-.644 6.021-7.205 5.979 7.195-.764.645-4.736-5.724v14.884z\";\n ctrl.iconMap['hide'] = \"M8.137 15.147c-.71-.857-1.146-1.947-1.146-3.147 0-2.76 2.241-5 5-5 1.201 0 2.291.435 3.148 1.145l1.897-1.897c-1.441-.738-3.122-1.248-5.035-1.248-6.115 0-10.025 5.355-10.842 6.584.529.834 2.379 3.527 5.113 5.428l1.865-1.865zm6.294-6.294c-.673-.53-1.515-.853-2.44-.853-2.207 0-4 1.792-4 4 0 .923.324 1.765.854 2.439l5.586-5.586zm7.56-6.146l-19.292 19.293-.708-.707 3.548-3.548c-2.298-1.612-4.234-3.885-5.548-6.169 2.418-4.103 6.943-7.576 12.01-7.576 2.065 0 4.021.566 5.782 1.501l3.501-3.501.707.707zm-2.465 3.879l-.734.734c2.236 1.619 3.628 3.604 4.061 4.274-.739 1.303-4.546 7.406-10.852 7.406-1.425 0-2.749-.368-3.951-.938l-.748.748c1.475.742 3.057 1.19 4.699 1.19 5.274 0 9.758-4.006 11.999-8.436-1.087-1.891-2.63-3.637-4.474-4.978zm-3.535 5.414c0-.554-.113-1.082-.317-1.562l.734-.734c.361.69.583 1.464.583 2.296 0 2.759-2.24 5-5 5-.832 0-1.604-.223-2.295-.583l.734-.735c.48.204 1.007.318 1.561.318 2.208 0 4-1.792 4-4z\";\n ctrl.iconMap['download'] = \"M6 16h-5v6h22v-6h-5v-1h6v8h-24v-8h6v1zm14 2c.552 0 1 .448 1 1s-.448 1-1 1-1-.448-1-1 .448-1 1-1zm-7.5-17v14.884l4.736-5.724.764.645-5.979 7.195-6.021-7.205.765-.644 4.735 5.732v-14.883h1z\";\n ctrl.iconMap['import'] = \"M16.965 2.381c3.593 1.946 6.035 5.749 6.035 10.119 0 6.347-5.153 11.5-11.5 11.5s-11.5-5.153-11.5-11.5c0-4.37 2.442-8.173 6.035-10.119l.608.809c-3.353 1.755-5.643 5.267-5.643 9.31 0 5.795 4.705 10.5 10.5 10.5s10.5-4.705 10.5-10.5c0-4.043-2.29-7.555-5.643-9.31l.608-.809zm-4.965-2.381v14.826l3.747-4.604.753.666-5 6.112-5-6.101.737-.679 3.763 4.608v-14.828h1z\";\n ctrl.iconMap['filter'] = \"M23 0l-9 14.146v7.73l-3.996 2.124v-9.853l-9.004-14.147h22zm-20.249 1l8.253 12.853v8.491l1.996-1.071v-7.419l8.229-12.854h-18.478z\";\n ctrl.iconMap['check'] = \"M9 22l-10-10.598 2.798-2.859 7.149 7.473 13.144-14.016 2.909 2.806z\";\n ctrl.iconMap['settings'] = \"M12 8.666c-1.838 0-3.333 1.496-3.333 3.334s1.495 3.333 3.333 3.333 3.333-1.495 3.333-3.333-1.495-3.334-3.333-3.334m0 7.667c-2.39 0-4.333-1.943-4.333-4.333s1.943-4.334 4.333-4.334 4.333 1.944 4.333 4.334c0 2.39-1.943 4.333-4.333 4.333m-1.193 6.667h2.386c.379-1.104.668-2.451 2.107-3.05 1.496-.617 2.666.196 3.635.672l1.686-1.688c-.508-1.047-1.266-2.199-.669-3.641.567-1.369 1.739-1.663 3.048-2.099v-2.388c-1.235-.421-2.471-.708-3.047-2.098-.572-1.38.057-2.395.669-3.643l-1.687-1.686c-1.117.547-2.221 1.257-3.642.668-1.374-.571-1.656-1.734-2.1-3.047h-2.386c-.424 1.231-.704 2.468-2.099 3.046-.365.153-.718.226-1.077.226-.843 0-1.539-.392-2.566-.893l-1.687 1.686c.574 1.175 1.251 2.237.669 3.643-.571 1.375-1.734 1.654-3.047 2.098v2.388c1.226.418 2.468.705 3.047 2.098.581 1.403-.075 2.432-.669 3.643l1.687 1.687c1.45-.725 2.355-1.204 3.642-.669 1.378.572 1.655 1.738 2.1 3.047m3.094 1h-3.803c-.681-1.918-.785-2.713-1.773-3.123-1.005-.419-1.731.132-3.466.952l-2.689-2.689c.873-1.837 1.367-2.465.953-3.465-.412-.991-1.192-1.087-3.123-1.773v-3.804c1.906-.678 2.712-.782 3.123-1.773.411-.991-.071-1.613-.953-3.466l2.689-2.688c1.741.828 2.466 1.365 3.465.953.992-.412 1.082-1.185 1.775-3.124h3.802c.682 1.918.788 2.714 1.774 3.123 1.001.416 1.709-.119 3.467-.952l2.687 2.688c-.878 1.847-1.361 2.477-.952 3.465.411.992 1.192 1.087 3.123 1.774v3.805c-1.906.677-2.713.782-3.124 1.773-.403.975.044 1.561.954 3.464l-2.688 2.689c-1.728-.82-2.467-1.37-3.456-.955-.988.41-1.08 1.146-1.785 3.126\";\n ctrl.iconMap['clipboard'] = \"M 17 17 L 7 17 L 7 16 L 17 16 L 17 17 Z M 17 14 L 7 14 L 7 13 L 17 13 L 17 14 Z M 17 11 L 7 11 L 7 10 L 17 10 L 17 11 Z M 16 6 L 8 6 L 7 1 L 17 1 L 16 6 Z M 15.7 2 L 8.25 2 L 8.9 5 L 15.1 5 L 15.7 2 Z M 22 23 L 2 23 L 2 3 L 5.5 3 L 5.7 4 L 3 4 L 3 22 L 21 22 L 21 4 L 18.3 4 L 18.5 3 L 22 3 L 22 23 Z\";\n ctrl.iconMap['sort-desc'] = \"M11 21.883l-6.235-7.527-.765.644 7.521 9 7.479-9-.764-.645-6.236 7.529v-21.884h-1v21.883z\";\n ctrl.iconMap['sort-asc'] = \"M11 2.206l-6.235 7.528-.765-.645 7.521-9 7.479 9-.764.646-6.236-7.53v21.884h-1v-21.883z\";\n ctrl.iconMap['key'] = \"M12.451 17.337l-2.451 2.663h-2v2h-2v2h-6v-5l6.865-6.949c1.08 2.424 3.095 4.336 5.586 5.286zm11.549-9.337c0 4.418-3.582 8-8 8s-8-3.582-8-8 3.582-8 8-8 8 3.582 8 8zm-3-3c0-1.104-.896-2-2-2s-2 .896-2 2 .896 2 2 2 2-.896 2-2z\";\n ctrl.iconMap['gears'] = \"M17 10.645v-2.29c-1.17-.417-1.907-.533-2.28-1.431-.373-.9.07-1.512.6-2.625l-1.618-1.619c-1.105.525-1.723.974-2.626.6-.9-.373-1.017-1.116-1.431-2.28h-2.29c-.412 1.158-.53 1.907-1.431 2.28h-.001c-.9.374-1.51-.07-2.625-.6l-1.617 1.619c.527 1.11.973 1.724.6 2.625-.375.901-1.123 1.019-2.281 1.431v2.289c1.155.412 1.907.531 2.28 1.431.376.908-.081 1.534-.6 2.625l1.618 1.619c1.107-.525 1.724-.974 2.625-.6h.001c.9.373 1.018 1.118 1.431 2.28h2.289c.412-1.158.53-1.905 1.437-2.282h.001c.894-.372 1.501.071 2.619.602l1.618-1.619c-.525-1.107-.974-1.723-.601-2.625.374-.899 1.126-1.019 2.282-1.43zm-8.5 1.689c-1.564 0-2.833-1.269-2.833-2.834s1.269-2.834 2.833-2.834 2.833 1.269 2.833 2.834-1.269 2.834-2.833 2.834zm15.5 4.205v-1.077c-.55-.196-.897-.251-1.073-.673-.176-.424.033-.711.282-1.236l-.762-.762c-.52.248-.811.458-1.235.283-.424-.175-.479-.525-.674-1.073h-1.076c-.194.545-.25.897-.674 1.073-.424.176-.711-.033-1.235-.283l-.762.762c.248.523.458.812.282 1.236-.176.424-.528.479-1.073.673v1.077c.544.193.897.25 1.073.673.177.427-.038.722-.282 1.236l.762.762c.521-.248.812-.458 1.235-.283.424.175.479.526.674 1.073h1.076c.194-.545.25-.897.676-1.074h.001c.421-.175.706.034 1.232.284l.762-.762c-.247-.521-.458-.812-.282-1.235s.529-.481 1.073-.674zm-4 .794c-.736 0-1.333-.597-1.333-1.333s.597-1.333 1.333-1.333 1.333.597 1.333 1.333-.597 1.333-1.333 1.333zm-4 3.071v-.808c-.412-.147-.673-.188-.805-.505s.024-.533.212-.927l-.572-.571c-.389.186-.607.344-.926.212s-.359-.394-.506-.805h-.807c-.146.409-.188.673-.506.805-.317.132-.533-.024-.926-.212l-.572.571c.187.393.344.609.212.927-.132.318-.396.359-.805.505v.808c.408.145.673.188.805.505.133.32-.028.542-.212.927l.572.571c.39-.186.608-.344.926-.212.318.132.359.395.506.805h.807c.146-.409.188-.673.507-.805h.001c.315-.131.529.025.924.213l.572-.571c-.186-.391-.344-.609-.212-.927s.397-.361.805-.506zm-3 .596c-.552 0-1-.447-1-1s.448-1 1-1 1 .447 1 1-.448 1-1 1z\";\n ctrl.iconMap['wand'] = \"M4.908 2.081l-2.828 2.828 19.092 19.091 2.828-2.828-19.092-19.091zm2.121 6.363l-3.535-3.535 1.414-1.414 3.535 3.535-1.414 1.414zm1.731-5.845c1.232.376 2.197 1.341 2.572 2.573.377-1.232 1.342-2.197 2.573-2.573-1.231-.376-2.196-1.34-2.573-2.573-.375 1.232-1.34 2.197-2.572 2.573zm-5.348 6.954c-.498 1.635-1.777 2.914-3.412 3.413 1.635.499 2.914 1.777 3.412 3.411.499-1.634 1.778-2.913 3.412-3.411-1.634-.5-2.913-1.778-3.412-3.413zm9.553-3.165c.872.266 1.553.948 1.819 1.82.266-.872.948-1.554 1.819-1.82-.871-.266-1.553-.948-1.819-1.82-.266.871-.948 1.554-1.819 1.82zm4.426-6.388c-.303.994-1.082 1.772-2.075 2.076.995.304 1.772 1.082 2.077 2.077.303-.994 1.082-1.772 2.074-2.077-.992-.303-1.772-1.082-2.076-2.076z\";\n ctrl.iconMap['user'] = \"M19 7.001c0 3.865-3.134 7-7 7s-7-3.135-7-7c0-3.867 3.134-7.001 7-7.001s7 3.134 7 7.001zm-1.598 7.18c-1.506 1.137-3.374 1.82-5.402 1.82-2.03 0-3.899-.685-5.407-1.822-4.072 1.793-6.593 7.376-6.593 9.821h24c0-2.423-2.6-8.006-6.598-9.819z\"; \n ctrl.iconMap['version'] = \"M 14.9 1 L 12.293 1.005 L 16.507 7.18 L 16.5 23.1 L 18.5 23.1 L 18.5 6.4 L 14.9 1 Z M 10.4 1 L 1.581 1.004 L 1.584 23.13 L 15 23.1 L 15 7.7 L 10.4 1 Z M 16.8 1 L 20 5.8 L 20 23.1 L 22 23.1 L 22 4.9 L 19.3 1 L 16.8 1 Z\";\n ctrl.iconMap['group'] = \"M21.698 10.658l2.302 1.342-12.002 7-11.998-7 2.301-1.342 9.697 5.658 9.7-5.658zm-9.7 10.657l-9.697-5.658-2.301 1.343 11.998 7 12.002-7-2.302-1.342-9.7 5.657zm12.002-14.315l-12.002-7-11.998 7 11.998 7 12.002-7z\";\n ctrl.iconMap['artifact'] = \"M12,0 L2,12 L12,24 L22,12 L12,0z\";\n \n ctrl.$onInit = function() {\n ctrl.path = ctrl.iconMap[ctrl.shape];\n }\n}\n\n\nmodule.exports = DatabusIconController;\n\n//# sourceURL=webpack://databus-webapp/./js/components/databus-icon/databus-icon.js?"); +eval("{// hinzufügen eines Controllers zum Modul\nfunction DatabusIconController() {\n\n var ctrl = this;\n\n ctrl.iconMap = {};\n ctrl.iconMap['databus'] = \"m 1.8847 0.3851 v 2.6248 l 14.6656 -0.0005 l 3.1363 4.4338 l -0.001 16.0412 l 2.3606 -0.001 V 0.3851 Z m 9.2176 4.1976 l -2.8418 0.003 l 3.5989 5.2742 l -0.002 13.6233 l 2.352 -0.001 l 0.0083 -14.3005 z m -4.7365 0.001 l -4.4826 0.001 l 0.002 18.898 l 8.3978 -0.002 l 0.0005 -13.1455 z m 6.6256 0 l 2.7991 4.1094 l -0.0198 14.7881 l 2.3515 -0.001 l 0.003 -15.5479 l -2.2793 -3.347 z\";\n ctrl.iconMap['add'] = \"M 11 11 M 2 12 L 11 12 L 11 21 L 12 21 L 12 12 L 21 12 L 21 11 L 12 11 L 12 2 L 11 2 L 11 11 L 2 11 L 2 12\";\n ctrl.iconMap['remove'] = \"M 11 11 M 2 12 L 21 12 L 21 11 L 2 11 L 2 12\";\n ctrl.iconMap['add-thick'] = \"m11 11h-7.25c-.414 0-.75.336-.75.75s.336.75.75.75h7.25v7.25c0 .414.336.75.75.75s.75-.336.75-.75v-7.25h7.25c.414 0 .75-.336.75-.75s-.336-.75-.75-.75h-7.25v-7.25c0-.414-.336-.75-.75-.75s-.75.336-.75.75z\";\n ctrl.iconMap['close'] = \"m12 10.93 5.719-5.72c.146-.146.339-.219.531-.219.404 0 .75.324.75.749 0 .193-.073.385-.219.532l-5.72 5.719 5.719 5.719c.147.147.22.339.22.531 0 .427-.349.75-.75.75-.192 0-.385-.073-.531-.219l-5.719-5.719-5.719 5.719c-.146.146-.339.219-.531.219-.401 0-.75-.323-.75-.75 0-.192.073-.384.22-.531l5.719-5.719-5.72-5.719c-.146-.147-.219-.339-.219-.532 0-.425.346-.749.75-.749.192 0 .385.073.531.219z\";\n ctrl.iconMap['delete'] = \"M9 3h6v-1.75c0-.066-.026-.13-.073-.177-.047-.047-.111-.073-.177-.073h-5.5c-.066 0-.13.026-.177.073-.047.047-.073.111-.073.177v1.75zm11 1h-16v18c0 .552.448 1 1 1h14c.552 0 1-.448 1-1v-18zm-10 3.5c0-.276-.224-.5-.5-.5s-.5.224-.5.5v12c0 .276.224.5.5.5s.5-.224.5-.5v-12zm5 0c0-.276-.224-.5-.5-.5s-.5.224-.5.5v12c0 .276.224.5.5.5s.5-.224.5-.5v-12zm8-4.5v1h-2v18c0 1.105-.895 2-2 2h-14c-1.105 0-2-.895-2-2v-18h-2v-1h7v-2c0-.552.448-1 1-1h6c.552 0 1 .448 1 1v2h7z\";\n ctrl.iconMap['goto'] = \"M21.883 12l-7.527 6.235.644.765 9-7.521-9-7.479-.645.764 7.529 6.236h-21.884v1h21.883z\";\n ctrl.iconMap['edit'] = \"M8.071 21.586l-7.071 1.414 1.414-7.071 14.929-14.929 5.657 5.657-14.929 14.929zm-.493-.921l-4.243-4.243-1.06 5.303 5.303-1.06zm9.765-18.251l-13.3 13.301 4.242 4.242 13.301-13.3-4.243-4.243z\";\n ctrl.iconMap['edit-thick'] = \"M7.127 22.564l-7.126 1.436 1.438-7.125 5.688 5.689zm-4.274-7.104l5.688 5.689 15.46-15.46-5.689-5.689-15.459 15.46z\";\n ctrl.iconMap['goback'] = \"M2.117 12l7.527 6.235-.644.765-9-7.521 9-7.479.645.764-7.529 6.236h21.884v1h-21.883z\";\n ctrl.iconMap['right'] = \"M4 .755l14.374 11.245-14.374 11.219.619.781 15.381-12-15.391-12-.609.755z\";\n ctrl.iconMap['left'] = \"M20 .755l-14.374 11.245 14.374 11.219-.619.781-15.381-12 15.391-12 .609.755z\";\n ctrl.iconMap['down'] = \"M23.245 4l-11.245 14.374-11.219-14.374-.781.619 12 15.381 12-15.391-.755-.609z\";\n ctrl.iconMap['left-thick'] = \"M16.67 0l2.83 2.829-9.339 9.175 9.339 9.167-2.83 2.829-12.17-11.996z\";\n ctrl.iconMap['help'] = \"M12 0c6.623 0 12 5.377 12 12s-5.377 12-12 12-12-5.377-12-12 5.377-12 12-12zm0 1c6.071 0 11 4.929 11 11s-4.929 11-11 11-11-4.929-11-11 4.929-11 11-11zm.053 17c.466 0 .844-.378.844-.845 0-.466-.378-.844-.844-.844-.466 0-.845.378-.845.844 0 .467.379.845.845.845zm.468-2.822h-.998c-.035-1.162.182-2.054.939-2.943.491-.57 1.607-1.479 1.945-2.058.722-1.229.077-3.177-2.271-3.177-1.439 0-2.615.877-2.928 2.507l-1.018-.102c.28-2.236 1.958-3.405 3.922-3.405 1.964 0 3.615 1.25 3.615 3.22 0 1.806-1.826 2.782-2.638 3.868-.422.563-.555 1.377-.568 2.09z\";\n ctrl.iconMap['max'] = \"M24 22h-24v-20h24v20zm-7-1v-15h-16v15h16zm1 0h5v-18h-22v2h17v16zm-6-6h-1v-3.241l-7.241 7.241-.759-.759 7.241-7.241h-3.241v-1h5v5z\";\n ctrl.iconMap['min'] = \"M24 22h-24v-20h24v20zm-23-9v8h10v-8h-10zm22 8v-18h-22v9h11v9h11zm-4-9h-5v-5h1v3.241l5.241-5.241.759.759-5.241 5.241h3.241v1z\";\n ctrl.iconMap['error'] = \"M24 23h-24l12-22 12 22zm-22.315-1h20.63l-10.315-18.912-10.315 18.912zm10.315-2c.466 0 .845-.378.845-.845 0-.466-.379-.844-.845-.844-.466 0-.845.378-.845.844 0 .467.379.845.845.845zm.5-11v8h-1v-8h1z\";\n ctrl.iconMap['info'] = \"M12 0c6.623 0 12 5.377 12 12s-5.377 12-12 12-12-5.377-12-12 5.377-12 12-12zm0 1c6.071 0 11 4.929 11 11s-4.929 11-11 11-11-4.929-11-11 4.929-11 11-11zm.5 17h-1v-9h1v9zm-.5-12c.466 0 .845.378.845.845 0 .466-.379.844-.845.844-.466 0-.845-.378-.845-.844 0-.467.379-.845.845-.845z\";\n ctrl.iconMap['eye'] = \"M12.01 20c-5.065 0-9.586-4.211-12.01-8.424 2.418-4.103 6.943-7.576 12.01-7.576 5.135 0 9.635 3.453 11.999 7.564-2.241 4.43-6.726 8.436-11.999 8.436zm-10.842-8.416c.843 1.331 5.018 7.416 10.842 7.416 6.305 0 10.112-6.103 10.851-7.405-.772-1.198-4.606-6.595-10.851-6.595-6.116 0-10.025 5.355-10.842 6.584zm10.832-4.584c2.76 0 5 2.24 5 5s-2.24 5-5 5-5-2.24-5-5 2.24-5 5-5zm0 1c2.208 0 4 1.792 4 4s-1.792 4-4 4-4-1.792-4-4 1.792-4 4-4z\";\n ctrl.iconMap['add-artifact'] = \"M 12 0 M 12.016 1.424 L 21.756 12.053 L 12.016 22.563 L 2.204 12.005 L 3.396 10.721 L 2.774 10.058 L 1 12 L 12 24 L 23 12 L 12 0 L 10.153 2.078 L 10.837 2.741 Z M 6 6 L 6 2 L 7 2 L 7 6 L 11 6 L 11 7 L 7 7 L 7 11 L 6 11 L 6 7 L 2 7 L 2 6 L 6 6\";\n ctrl.iconMap['add-button'] = \"M24 10h-10v-10h-4v10h-10v4h10v10h4v-10h10z\";\n ctrl.iconMap['collections'] = \"M11.499 12.03v11.971l-10.5-5.603v-11.835l10.5 5.467zm11.501 6.368l-10.501 5.602v-11.968l10.501-5.404v11.77zm-16.889-15.186l10.609 5.524-4.719 2.428-10.473-5.453 4.583-2.499zm16.362 2.563l-4.664 2.4-10.641-5.54 4.831-2.635 10.474 5.775z\";\n ctrl.iconMap['collections-thin'] = \"M23 6.066v12.065l-11.001 5.869-11-5.869v-12.131l11-6 11.001 6.066zm-21.001 11.465l9.5 5.069v-10.57l-9.5-4.946v10.447zm20.001-10.388l-9.501 4.889v10.568l9.501-5.069v-10.388zm-5.52 1.716l-9.534-4.964-4.349 2.373 9.404 4.896 4.479-2.305zm-8.476-5.541l9.565 4.98 3.832-1.972-9.405-5.185-3.992 2.177z\";\n ctrl.iconMap['content'] = \"M9.484 15.696l-.711-.696-2.552 2.607-1.539-1.452-.698.709 2.25 2.136 3.25-3.304zm0-5l-.711-.696-2.552 2.607-1.539-1.452-.698.709 2.25 2.136 3.25-3.304zm0-5l-.711-.696-2.552 2.607-1.539-1.452-.698.709 2.25 2.136 3.25-3.304zm10.516 11.304h-8v1h8v-1zm0-5h-8v1h8v-1zm0-5h-8v1h8v-1zm4-5h-24v20h24v-20zm-1 19h-22v-18h22v18z\"\n ctrl.iconMap['menu'] = \"M24 18v1h-24v-1h24zm0-6v1h-24v-1h24zm0-6v1h-24v-1h24z\";\n ctrl.iconMap['copy'] = \"M17 7h6v16h-16v-6h-6v-16h16v6zm5 1h-14v14h14v-14zm-6-1v-5h-14v14h5v-9h9z\";\n ctrl.iconMap['upload'] = \"M9 16h-8v6h22v-6h-8v-1h9v8h-24v-8h9v1zm11 2c.552 0 1 .448 1 1s-.448 1-1 1-1-.448-1-1 .448-1 1-1zm-7.5 0h-1v-14.883l-4.735 5.732-.765-.644 6.021-7.205 5.979 7.195-.764.645-4.736-5.724v14.884z\";\n ctrl.iconMap['hide'] = \"M8.137 15.147c-.71-.857-1.146-1.947-1.146-3.147 0-2.76 2.241-5 5-5 1.201 0 2.291.435 3.148 1.145l1.897-1.897c-1.441-.738-3.122-1.248-5.035-1.248-6.115 0-10.025 5.355-10.842 6.584.529.834 2.379 3.527 5.113 5.428l1.865-1.865zm6.294-6.294c-.673-.53-1.515-.853-2.44-.853-2.207 0-4 1.792-4 4 0 .923.324 1.765.854 2.439l5.586-5.586zm7.56-6.146l-19.292 19.293-.708-.707 3.548-3.548c-2.298-1.612-4.234-3.885-5.548-6.169 2.418-4.103 6.943-7.576 12.01-7.576 2.065 0 4.021.566 5.782 1.501l3.501-3.501.707.707zm-2.465 3.879l-.734.734c2.236 1.619 3.628 3.604 4.061 4.274-.739 1.303-4.546 7.406-10.852 7.406-1.425 0-2.749-.368-3.951-.938l-.748.748c1.475.742 3.057 1.19 4.699 1.19 5.274 0 9.758-4.006 11.999-8.436-1.087-1.891-2.63-3.637-4.474-4.978zm-3.535 5.414c0-.554-.113-1.082-.317-1.562l.734-.734c.361.69.583 1.464.583 2.296 0 2.759-2.24 5-5 5-.832 0-1.604-.223-2.295-.583l.734-.735c.48.204 1.007.318 1.561.318 2.208 0 4-1.792 4-4z\";\n ctrl.iconMap['download'] = \"M6 16h-5v6h22v-6h-5v-1h6v8h-24v-8h6v1zm14 2c.552 0 1 .448 1 1s-.448 1-1 1-1-.448-1-1 .448-1 1-1zm-7.5-17v14.884l4.736-5.724.764.645-5.979 7.195-6.021-7.205.765-.644 4.735 5.732v-14.883h1z\";\n ctrl.iconMap['import'] = \"M16.965 2.381c3.593 1.946 6.035 5.749 6.035 10.119 0 6.347-5.153 11.5-11.5 11.5s-11.5-5.153-11.5-11.5c0-4.37 2.442-8.173 6.035-10.119l.608.809c-3.353 1.755-5.643 5.267-5.643 9.31 0 5.795 4.705 10.5 10.5 10.5s10.5-4.705 10.5-10.5c0-4.043-2.29-7.555-5.643-9.31l.608-.809zm-4.965-2.381v14.826l3.747-4.604.753.666-5 6.112-5-6.101.737-.679 3.763 4.608v-14.828h1z\";\n ctrl.iconMap['filter'] = \"M23 0l-9 14.146v7.73l-3.996 2.124v-9.853l-9.004-14.147h22zm-20.249 1l8.253 12.853v8.491l1.996-1.071v-7.419l8.229-12.854h-18.478z\";\n ctrl.iconMap['check'] = \"M9 22l-10-10.598 2.798-2.859 7.149 7.473 13.144-14.016 2.909 2.806z\";\n ctrl.iconMap['settings'] = \"M12 8.666c-1.838 0-3.333 1.496-3.333 3.334s1.495 3.333 3.333 3.333 3.333-1.495 3.333-3.333-1.495-3.334-3.333-3.334m0 7.667c-2.39 0-4.333-1.943-4.333-4.333s1.943-4.334 4.333-4.334 4.333 1.944 4.333 4.334c0 2.39-1.943 4.333-4.333 4.333m-1.193 6.667h2.386c.379-1.104.668-2.451 2.107-3.05 1.496-.617 2.666.196 3.635.672l1.686-1.688c-.508-1.047-1.266-2.199-.669-3.641.567-1.369 1.739-1.663 3.048-2.099v-2.388c-1.235-.421-2.471-.708-3.047-2.098-.572-1.38.057-2.395.669-3.643l-1.687-1.686c-1.117.547-2.221 1.257-3.642.668-1.374-.571-1.656-1.734-2.1-3.047h-2.386c-.424 1.231-.704 2.468-2.099 3.046-.365.153-.718.226-1.077.226-.843 0-1.539-.392-2.566-.893l-1.687 1.686c.574 1.175 1.251 2.237.669 3.643-.571 1.375-1.734 1.654-3.047 2.098v2.388c1.226.418 2.468.705 3.047 2.098.581 1.403-.075 2.432-.669 3.643l1.687 1.687c1.45-.725 2.355-1.204 3.642-.669 1.378.572 1.655 1.738 2.1 3.047m3.094 1h-3.803c-.681-1.918-.785-2.713-1.773-3.123-1.005-.419-1.731.132-3.466.952l-2.689-2.689c.873-1.837 1.367-2.465.953-3.465-.412-.991-1.192-1.087-3.123-1.773v-3.804c1.906-.678 2.712-.782 3.123-1.773.411-.991-.071-1.613-.953-3.466l2.689-2.688c1.741.828 2.466 1.365 3.465.953.992-.412 1.082-1.185 1.775-3.124h3.802c.682 1.918.788 2.714 1.774 3.123 1.001.416 1.709-.119 3.467-.952l2.687 2.688c-.878 1.847-1.361 2.477-.952 3.465.411.992 1.192 1.087 3.123 1.774v3.805c-1.906.677-2.713.782-3.124 1.773-.403.975.044 1.561.954 3.464l-2.688 2.689c-1.728-.82-2.467-1.37-3.456-.955-.988.41-1.08 1.146-1.785 3.126\";\n ctrl.iconMap['clipboard'] = \"M 17 17 L 7 17 L 7 16 L 17 16 L 17 17 Z M 17 14 L 7 14 L 7 13 L 17 13 L 17 14 Z M 17 11 L 7 11 L 7 10 L 17 10 L 17 11 Z M 16 6 L 8 6 L 7 1 L 17 1 L 16 6 Z M 15.7 2 L 8.25 2 L 8.9 5 L 15.1 5 L 15.7 2 Z M 22 23 L 2 23 L 2 3 L 5.5 3 L 5.7 4 L 3 4 L 3 22 L 21 22 L 21 4 L 18.3 4 L 18.5 3 L 22 3 L 22 23 Z\";\n ctrl.iconMap['sort-desc'] = \"M11 21.883l-6.235-7.527-.765.644 7.521 9 7.479-9-.764-.645-6.236 7.529v-21.884h-1v21.883z\";\n ctrl.iconMap['sort-asc'] = \"M11 2.206l-6.235 7.528-.765-.645 7.521-9 7.479 9-.764.646-6.236-7.53v21.884h-1v-21.883z\";\n ctrl.iconMap['key'] = \"M12.451 17.337l-2.451 2.663h-2v2h-2v2h-6v-5l6.865-6.949c1.08 2.424 3.095 4.336 5.586 5.286zm11.549-9.337c0 4.418-3.582 8-8 8s-8-3.582-8-8 3.582-8 8-8 8 3.582 8 8zm-3-3c0-1.104-.896-2-2-2s-2 .896-2 2 .896 2 2 2 2-.896 2-2z\";\n ctrl.iconMap['gears'] = \"M17 10.645v-2.29c-1.17-.417-1.907-.533-2.28-1.431-.373-.9.07-1.512.6-2.625l-1.618-1.619c-1.105.525-1.723.974-2.626.6-.9-.373-1.017-1.116-1.431-2.28h-2.29c-.412 1.158-.53 1.907-1.431 2.28h-.001c-.9.374-1.51-.07-2.625-.6l-1.617 1.619c.527 1.11.973 1.724.6 2.625-.375.901-1.123 1.019-2.281 1.431v2.289c1.155.412 1.907.531 2.28 1.431.376.908-.081 1.534-.6 2.625l1.618 1.619c1.107-.525 1.724-.974 2.625-.6h.001c.9.373 1.018 1.118 1.431 2.28h2.289c.412-1.158.53-1.905 1.437-2.282h.001c.894-.372 1.501.071 2.619.602l1.618-1.619c-.525-1.107-.974-1.723-.601-2.625.374-.899 1.126-1.019 2.282-1.43zm-8.5 1.689c-1.564 0-2.833-1.269-2.833-2.834s1.269-2.834 2.833-2.834 2.833 1.269 2.833 2.834-1.269 2.834-2.833 2.834zm15.5 4.205v-1.077c-.55-.196-.897-.251-1.073-.673-.176-.424.033-.711.282-1.236l-.762-.762c-.52.248-.811.458-1.235.283-.424-.175-.479-.525-.674-1.073h-1.076c-.194.545-.25.897-.674 1.073-.424.176-.711-.033-1.235-.283l-.762.762c.248.523.458.812.282 1.236-.176.424-.528.479-1.073.673v1.077c.544.193.897.25 1.073.673.177.427-.038.722-.282 1.236l.762.762c.521-.248.812-.458 1.235-.283.424.175.479.526.674 1.073h1.076c.194-.545.25-.897.676-1.074h.001c.421-.175.706.034 1.232.284l.762-.762c-.247-.521-.458-.812-.282-1.235s.529-.481 1.073-.674zm-4 .794c-.736 0-1.333-.597-1.333-1.333s.597-1.333 1.333-1.333 1.333.597 1.333 1.333-.597 1.333-1.333 1.333zm-4 3.071v-.808c-.412-.147-.673-.188-.805-.505s.024-.533.212-.927l-.572-.571c-.389.186-.607.344-.926.212s-.359-.394-.506-.805h-.807c-.146.409-.188.673-.506.805-.317.132-.533-.024-.926-.212l-.572.571c.187.393.344.609.212.927-.132.318-.396.359-.805.505v.808c.408.145.673.188.805.505.133.32-.028.542-.212.927l.572.571c.39-.186.608-.344.926-.212.318.132.359.395.506.805h.807c.146-.409.188-.673.507-.805h.001c.315-.131.529.025.924.213l.572-.571c-.186-.391-.344-.609-.212-.927s.397-.361.805-.506zm-3 .596c-.552 0-1-.447-1-1s.448-1 1-1 1 .447 1 1-.448 1-1 1z\";\n ctrl.iconMap['wand'] = \"M4.908 2.081l-2.828 2.828 19.092 19.091 2.828-2.828-19.092-19.091zm2.121 6.363l-3.535-3.535 1.414-1.414 3.535 3.535-1.414 1.414zm1.731-5.845c1.232.376 2.197 1.341 2.572 2.573.377-1.232 1.342-2.197 2.573-2.573-1.231-.376-2.196-1.34-2.573-2.573-.375 1.232-1.34 2.197-2.572 2.573zm-5.348 6.954c-.498 1.635-1.777 2.914-3.412 3.413 1.635.499 2.914 1.777 3.412 3.411.499-1.634 1.778-2.913 3.412-3.411-1.634-.5-2.913-1.778-3.412-3.413zm9.553-3.165c.872.266 1.553.948 1.819 1.82.266-.872.948-1.554 1.819-1.82-.871-.266-1.553-.948-1.819-1.82-.266.871-.948 1.554-1.819 1.82zm4.426-6.388c-.303.994-1.082 1.772-2.075 2.076.995.304 1.772 1.082 2.077 2.077.303-.994 1.082-1.772 2.074-2.077-.992-.303-1.772-1.082-2.076-2.076z\";\n ctrl.iconMap['user'] = \"M19 7.001c0 3.865-3.134 7-7 7s-7-3.135-7-7c0-3.867 3.134-7.001 7-7.001s7 3.134 7 7.001zm-1.598 7.18c-1.506 1.137-3.374 1.82-5.402 1.82-2.03 0-3.899-.685-5.407-1.822-4.072 1.793-6.593 7.376-6.593 9.821h24c0-2.423-2.6-8.006-6.598-9.819z\"; \n ctrl.iconMap['version'] = \"M 14.9 1 L 12.293 1.005 L 16.507 7.18 L 16.5 23.1 L 18.5 23.1 L 18.5 6.4 L 14.9 1 Z M 10.4 1 L 1.581 1.004 L 1.584 23.13 L 15 23.1 L 15 7.7 L 10.4 1 Z M 16.8 1 L 20 5.8 L 20 23.1 L 22 23.1 L 22 4.9 L 19.3 1 L 16.8 1 Z\";\n ctrl.iconMap['group'] = \"M21.698 10.658l2.302 1.342-12.002 7-11.998-7 2.301-1.342 9.697 5.658 9.7-5.658zm-9.7 10.657l-9.697-5.658-2.301 1.343 11.998 7 12.002-7-2.302-1.342-9.7 5.657zm12.002-14.315l-12.002-7-11.998 7 11.998 7 12.002-7z\";\n ctrl.iconMap['artifact'] = \"M12,0 L2,12 L12,24 L22,12 L12,0z\";\n \n ctrl.$onInit = function() {\n ctrl.path = ctrl.iconMap[ctrl.shape];\n }\n}\n\n\nmodule.exports = DatabusIconController;\n\n//# sourceURL=webpack://databus-webapp/./js/components/databus-icon/databus-icon.js?\n}"); -/***/ }), +/***/ }, -/***/ "./js/components/entity-api-view/entity-api-view.js": +/***/ "./js/components/entity-api-view/entity-api-view.js" /*!**********************************************************!*\ !*** ./js/components/entity-api-view/entity-api-view.js ***! \**********************************************************/ -/***/ ((module) => { +(module) { -eval("function EntityApiViewController() {\n const ctrl = this;\n\n ctrl.copyToClipboard = function (text) {\n navigator.clipboard.writeText(text).then(() => {\n console.log(\"Copied to clipboard\");\n });\n };\n\n ctrl.register = async function () {\n ctrl.isRegistering = true;\n ctrl.isSuccess = false;\n ctrl.isError = false;\n \n if (ctrl.entity && ctrl.entity.register) {\n try {\n let response = await ctrl.entity.register();\n ctrl.log = response.data.log;\n ctrl.isSuccess = true;\n } catch(err) {\n ctrl.log = err.data.log;\n ctrl.isError = true;\n }\n }\n\n ctrl.isRegistering = false;\n };\n\n ctrl.setApiKeyName = function (name) {\n if (ctrl.entity && ctrl.entity.setApiKeyName) {\n ctrl.entity.setApiKeyName(name);\n }\n };\n}\n\nmodule.exports = EntityApiViewController;\n\n\n//# sourceURL=webpack://databus-webapp/./js/components/entity-api-view/entity-api-view.js?"); +eval("{function EntityApiViewController() {\n const ctrl = this;\n\n ctrl.copyToClipboard = function (text) {\n navigator.clipboard.writeText(text).then(() => {\n console.log(\"Copied to clipboard\");\n });\n };\n\n ctrl.register = async function () {\n ctrl.isRegistering = true;\n ctrl.isSuccess = false;\n ctrl.isError = false;\n \n if (ctrl.entity && ctrl.entity.register) {\n try {\n let response = await ctrl.entity.register();\n ctrl.log = response.data.log;\n ctrl.isSuccess = true;\n } catch(err) {\n ctrl.log = err.data.log;\n ctrl.isError = true;\n }\n }\n\n ctrl.isRegistering = false;\n };\n\n ctrl.setApiKeyName = function (name) {\n if (ctrl.entity && ctrl.entity.setApiKeyName) {\n ctrl.entity.setApiKeyName(name);\n }\n };\n}\n\nmodule.exports = EntityApiViewController;\n\n\n//# sourceURL=webpack://databus-webapp/./js/components/entity-api-view/entity-api-view.js?\n}"); -/***/ }), +/***/ }, -/***/ "./js/components/entity-card/entity-card.js": +/***/ "./js/components/entity-card/entity-card.js" /*!**************************************************!*\ !*** ./js/components/entity-card/entity-card.js ***! \**************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +(module, __unused_webpack_exports, __webpack_require__) { -eval("const DatabusUtils = __webpack_require__(/*! ../../utils/databus-utils */ \"./js/utils/databus-utils.js\");\n\n// hinzufügen eines Controllers zum Modul\nfunction EntityCardController($sce) {\n\n var ctrl = this;\n\n ctrl.$onInit = function() {\n\n if(ctrl.label == null || ctrl.label == \"\") {\n ctrl.label = DatabusUtils.uriToTitle(ctrl.uri);\n }\n }\n\n ctrl.formatResult = function(result) {\n return $sce.trustAsHtml(result);\n }\n}\n\n\nmodule.exports = EntityCardController;\n\n//# sourceURL=webpack://databus-webapp/./js/components/entity-card/entity-card.js?"); +eval("{const DatabusUtils = __webpack_require__(/*! ../../utils/databus-utils */ \"./js/utils/databus-utils.js\");\n\n// hinzufügen eines Controllers zum Modul\nfunction EntityCardController($sce) {\n\n var ctrl = this;\n\n ctrl.$onInit = function() {\n\n if(ctrl.label == null || ctrl.label == \"\") {\n ctrl.label = DatabusUtils.uriToTitle(ctrl.uri);\n }\n }\n\n ctrl.formatResult = function(result) {\n return $sce.trustAsHtml(result);\n }\n}\n\n\nmodule.exports = EntityCardController;\n\n//# sourceURL=webpack://databus-webapp/./js/components/entity-card/entity-card.js?\n}"); -/***/ }), +/***/ }, -/***/ "./js/components/entity-dropdown/entity-dropdown.js": +/***/ "./js/components/entity-dropdown/entity-dropdown.js" /*!**********************************************************!*\ !*** ./js/components/entity-dropdown/entity-dropdown.js ***! \**********************************************************/ -/***/ ((module) => { +(module) { -eval("function EntityDropdownController() {\n var ctrl = this;\n\n ctrl.showDrop = false;\n ctrl.selectedLabel = '';\n ctrl.searchQuery = '';\n ctrl.filteredItems = [];\n\n ctrl.$onInit = function () {\n ctrl.updateFilteredItems();\n ctrl.setSelectedLabel();\n };\n\n ctrl.$onChanges = function (changes) {\n if (changes.items || changes.selected) {\n ctrl.updateFilteredItems();\n\n if (ctrl.selected && Array.isArray(ctrl.items) && !ctrl.items?.some(i => i[ctrl.displayProperty] === ctrl.selected)) {\n ctrl.selected = null;\n ctrl.onSelect({ item: null }); \n }\n\n ctrl.setSelectedLabel();\n }\n };\n\n ctrl.toggleDropdown = function () {\n if (!ctrl.loading && ctrl.items && ctrl.items.length > 0) {\n ctrl.showDrop = !ctrl.showDrop;\n ctrl.searchQuery = '';\n ctrl.updateFilteredItems();\n }\n };\n\n ctrl.selectItem = function (item) {\n ctrl.selectedLabel = item[ctrl.displayProperty];\n ctrl.showDrop = false;\n ctrl.onSelect({ item: item });\n };\n\n ctrl.updateFilteredItems = function () {\n if (!ctrl.items || !ctrl.displayProperty) {\n ctrl.filteredItems = [];\n return;\n }\n\n ctrl.filteredItems = ctrl.items.filter(function (item) {\n var val = item[ctrl.displayProperty] || '';\n return val.toLowerCase().indexOf(ctrl.searchQuery.toLowerCase()) !== -1;\n });\n };\n\n ctrl.setSelectedLabel = function () {\n if (!ctrl.selected || !ctrl.displayProperty) {\n ctrl.selectedLabel = ctrl.placeholder || 'Please select...';\n return;\n }\n\n // Attempt to match selected value in the list\n var match = (ctrl.items || []).find(function (item) {\n return item[ctrl.displayProperty] === ctrl.selected;\n });\n\n if (match) {\n ctrl.selectedLabel = match[ctrl.displayProperty];\n } else {\n // fallback in case selected value is not in the list\n ctrl.selectedLabel = ctrl.placeholder || 'Please select...';\n // ctrl.onSelect(null);\n }\n };\n}\n\nmodule.exports = EntityDropdownController;\n\n\n//# sourceURL=webpack://databus-webapp/./js/components/entity-dropdown/entity-dropdown.js?"); +eval("{function EntityDropdownController() {\n var ctrl = this;\n\n ctrl.showDrop = false;\n ctrl.selectedLabel = '';\n ctrl.searchQuery = '';\n ctrl.filteredItems = [];\n\n ctrl.$onInit = function () {\n ctrl.updateFilteredItems();\n ctrl.setSelectedLabel();\n };\n\n ctrl.$onChanges = function (changes) {\n if (changes.items || changes.selected) {\n ctrl.updateFilteredItems();\n\n if (ctrl.selected && Array.isArray(ctrl.items) && !ctrl.items?.some(i => i[ctrl.displayProperty] === ctrl.selected)) {\n ctrl.selected = null;\n ctrl.onSelect({ item: null }); \n }\n\n ctrl.setSelectedLabel();\n }\n };\n\n ctrl.toggleDropdown = function () {\n if (!ctrl.loading && ctrl.items && ctrl.items.length > 0) {\n ctrl.showDrop = !ctrl.showDrop;\n ctrl.searchQuery = '';\n ctrl.updateFilteredItems();\n }\n };\n\n ctrl.selectItem = function (item) {\n ctrl.selectedLabel = item[ctrl.displayProperty];\n ctrl.showDrop = false;\n ctrl.onSelect({ item: item });\n };\n\n ctrl.updateFilteredItems = function () {\n if (!ctrl.items || !ctrl.displayProperty) {\n ctrl.filteredItems = [];\n return;\n }\n\n ctrl.filteredItems = ctrl.items.filter(function (item) {\n var val = item[ctrl.displayProperty] || '';\n return val.toLowerCase().indexOf(ctrl.searchQuery.toLowerCase()) !== -1;\n });\n };\n\n ctrl.setSelectedLabel = function () {\n if (!ctrl.selected || !ctrl.displayProperty) {\n ctrl.selectedLabel = ctrl.placeholder || 'Please select...';\n return;\n }\n\n // Attempt to match selected value in the list\n var match = (ctrl.items || []).find(function (item) {\n return item[ctrl.displayProperty] === ctrl.selected;\n });\n\n if (match) {\n ctrl.selectedLabel = match[ctrl.displayProperty];\n } else {\n // fallback in case selected value is not in the list\n ctrl.selectedLabel = ctrl.placeholder || 'Please select...';\n // ctrl.onSelect(null);\n }\n };\n}\n\nmodule.exports = EntityDropdownController;\n\n\n//# sourceURL=webpack://databus-webapp/./js/components/entity-dropdown/entity-dropdown.js?\n}"); -/***/ }), +/***/ }, -/***/ "./js/components/error-notification/error-notifcation.js": +/***/ "./js/components/error-notification/error-notifcation.js" /*!***************************************************************!*\ !*** ./js/components/error-notification/error-notifcation.js ***! \***************************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +(module, __unused_webpack_exports, __webpack_require__) { -eval("const { DatabusMsg } = __webpack_require__(/*! ../../utils/messages */ \"./js/utils/messages.js\");\n\nfunction ErrorNotificationController() {\n var ctrl = this;\n ctrl.expanded = false;\n\n ctrl.toggleExpand = function () {\n ctrl.expanded = !ctrl.expanded;\n };\n\n ctrl.get = function(key) {\n return DatabusMsg.get(key);\n }\n}\n\nmodule.exports = ErrorNotificationController;\n\n\n//# sourceURL=webpack://databus-webapp/./js/components/error-notification/error-notifcation.js?"); +eval("{const { DatabusMsg } = __webpack_require__(/*! ../../utils/messages */ \"./js/utils/messages.js\");\n\nfunction ErrorNotificationController() {\n var ctrl = this;\n ctrl.expanded = false;\n\n ctrl.toggleExpand = function () {\n ctrl.expanded = !ctrl.expanded;\n };\n\n ctrl.get = function(key) {\n return DatabusMsg.get(key);\n }\n}\n\nmodule.exports = ErrorNotificationController;\n\n\n//# sourceURL=webpack://databus-webapp/./js/components/error-notification/error-notifcation.js?\n}"); -/***/ }), +/***/ }, -/***/ "./js/components/expandable-arrow/expandable-arrow.js": +/***/ "./js/components/expandable-arrow/expandable-arrow.js" /*!************************************************************!*\ !*** ./js/components/expandable-arrow/expandable-arrow.js ***! \************************************************************/ -/***/ ((module) => { +(module) { -eval("// hinzufügen eines Controllers zum Modul\nfunction ExpandableArrowController() {\n\n var ctrl = this;\n\n ctrl.$onInit = function() {\n if(ctrl.isReadonly == undefined) {\n ctrl.isReadonly = false;\n }\n\n \n }\n\n ctrl.change = function() {\n\n if(!ctrl.isReadonly) {\n ctrl.expanded = !ctrl.expanded;\n ctrl.onChange();\n }\n }\n}\n\nmodule.exports = ExpandableArrowController;\n\n\n\n//# sourceURL=webpack://databus-webapp/./js/components/expandable-arrow/expandable-arrow.js?"); +eval("{// hinzufügen eines Controllers zum Modul\nfunction ExpandableArrowController() {\n\n var ctrl = this;\n\n ctrl.$onInit = function() {\n if(ctrl.isReadonly == undefined) {\n ctrl.isReadonly = false;\n }\n\n \n }\n\n ctrl.change = function() {\n\n if(!ctrl.isReadonly) {\n ctrl.expanded = !ctrl.expanded;\n ctrl.onChange();\n }\n }\n}\n\nmodule.exports = ExpandableArrowController;\n\n\n\n//# sourceURL=webpack://databus-webapp/./js/components/expandable-arrow/expandable-arrow.js?\n}"); -/***/ }), +/***/ }, -/***/ "./js/components/facets-view/facets-view.js": +/***/ "./js/components/facets-view/facets-view.js" /*!**************************************************!*\ !*** ./js/components/facets-view/facets-view.js ***! \**************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +(module, __unused_webpack_exports, __webpack_require__) { -eval("const QueryNode = __webpack_require__(/*! ../../query-builder/query-node */ \"./js/query-builder/query-node.js\");\nconst DatabusConstants = __webpack_require__(/*! ../../utils/databus-constants */ \"./js/utils/databus-constants.js\");\nconst DatabusUris = __webpack_require__(/*! ../../utils/databus-uris */ \"./js/utils/databus-uris.js\");\nconst DatabusUtils = __webpack_require__(/*! ../../utils/databus-utils */ \"./js/utils/databus-utils.js\");\n\n/**\n * Manages an array of facets with respect to a parent facets array.\n * Provides some convenient\\ce methods to write to the facets array and\n * read from the parents facets.\n * DO NOT change the parent facets array in here.\n */\nclass FacetSettings {\n\n /**\n * Locally manages a facets array with respect to a parent\n * facets array\n * @param {[type]} facets [description]\n * @param {[type]} parentFacets [description]\n */\n constructor(facets, parentFacets) {\n this.facets = facets;\n this.parentFacets = parentFacets;\n }\n\n /**\n * Change a setting (key, value) to a state (bool)\n * @param {[type]} key [description]\n * @param {[type]} value [description]\n * @param {[type]} setState [description]\n * @return {[type]} [description]\n */\n changeSetting(key, value, targetState) {\n var parentState = this.findParentSettingState(key, value);\n\n if (parentState != targetState) {\n this.createOrAddSetting(key, value, targetState);\n } else {\n this.removeSetting(key, value);\n }\n\n return targetState;\n }\n\n /**\n * Find the checked state specified in the parent setting array (if set)\n * based on a key and value\n * @param {[type]} key [description]\n * @param {[type]} value [description]\n * @return {[type]} [description]\n */\n findParentSettingState(key, value) {\n if (this.parentFacets == undefined) {\n return false;\n }\n\n for (var p in this.parentFacets) {\n var setting = this.parentFacets[p];\n if (setting.key == key && setting.value == value) {\n return setting.checked;\n }\n }\n\n return false;\n }\n\n findOwnSettingState(key, value) {\n for (var p in this.facets) {\n var setting = this.facets[p];\n if (setting.key == key && setting.value == value) {\n return setting.checked;\n }\n }\n\n return false;\n }\n\n isOverride(key, value, state) {\n var parentState = this.findParentSettingState(key, value);\n return parentState != state;\n }\n\n createOrAddSetting(key, value, state) {\n for (var p in this.facets) {\n var setting = this.facets[p];\n if (p == key && setting.value == value) {\n setting.checked = state;\n return;\n }\n }\n\n this.facets[key] = { value: value, checked: state };\n }\n\n removeSetting(key, value) {\n for (var p in this.facets) {\n var setting = this.facets[p];\n if (setting.key == key && setting.value == value) {\n this.facets.splice(p, 1);\n return;\n }\n }\n }\n\n}\n\nfunction FacetsViewController($http, $scope) {\n\n var ctrl = this;\n ctrl.$http = $http;\n ctrl.maxEntries = 6;\n\n ctrl.$onInit = function () {\n\n }\n\n ctrl.$onChanges = function () {\n // create the queries...\n ctrl.isLoading = true;\n\n // wrap the node in the query node class\n ctrl.node = QueryNode.createFrom(ctrl.node);\n\n // Holds the view state as json\n ctrl.viewModel = {};\n\n if (ctrl.facets == undefined) {\n ctrl.facets = [];\n }\n\n var queryUri = ctrl.resourceType == 'version' ?\n ctrl.node.uri + '/' + ctrl.node.facetSettings[DatabusUris.DCT_HAS_VERSION][0].value\n : ctrl.node.uri;\n\n // Load the available resource facets\n // TODO: Remove resource type, can be derived from uri\n ctrl.$http.get('/app/utils/facets', {\n params: { uri: queryUri, type: ctrl.resourceType }\n }).then(function (result) {\n\n // Facets data has been loaded\n ctrl.facetsData = result.data;\n\n // Fix artifact facet values for groups, change URIs into artifact names\n var artifactFacetData = ctrl.facetsData[DatabusUris.DATABUS_ARTIFACT_PROPERTY];\n\n if (artifactFacetData != null) {\n for (var i in artifactFacetData.values) {\n artifactFacetData.values[i] = DatabusUtils.uriToName(artifactFacetData.values[i]);\n }\n }\n\n // Facet setting in this view is\n\n // - SETTING\n // ---- VALUE\n // ---- IS_CHECKED\n\n // Prepare visible facet settings and autofill data based on the facet data returned by the API\n // Create key base entries (unset, not overriden)\n for (var key in ctrl.facetsData) {\n\n var facetData = ctrl.facetsData[key];\n\n // Create a view data object for each facet\n ctrl.viewModel[key] = {};\n ctrl.viewModel[key].key = key;\n ctrl.viewModel[key].label = facetData.label;\n ctrl.viewModel[key].visibleFacetSettings = [];\n ctrl.viewModel[key].autofill = {};\n ctrl.viewModel[key].autofill.values = facetData.values;\n ctrl.viewModel[key].autofill.selectedValues = [];\n ctrl.viewModel[key].autofill.input = '';\n\n\n for (var v in facetData.values) {\n var value = facetData.values[v];\n ctrl.viewModel[key].visibleFacetSettings.push({\n value: value,\n checked: false,\n isOverride: false\n });\n }\n\n ctrl.viewModel[key].visibleFacetSettings.sort(function (a, b) {\n const valueA = a.value.toUpperCase();\n const valueB = b.value.toUpperCase();\n if (valueA > valueB) {\n return 1;\n }\n if (valueA < valueB) {\n return -1;\n }\n\n return 0;\n });\n\n // Show latest versions first\n if (key == DatabusUris.DCT_HAS_VERSION) {\n ctrl.viewModel[key].visibleFacetSettings.reverse();\n }\n\n // Only show the top few\n var length = ctrl.viewModel[key].visibleFacetSettings.length;\n ctrl.viewModel[key].visibleFacetSettings.length = Math.min(ctrl.maxEntries, length);\n }\n\n // If we show the browser for a version, remove the version facet\n if (ctrl.resourceType == 'version') {\n delete ctrl.viewModel[DatabusUris.DCT_HAS_VERSION];\n }\n\n // Add the \"Latest Version\" facet to the visible settings of the version facet\n if (ctrl.resourceType != 'version' && ctrl.viewModel[DatabusUris.DCT_HAS_VERSION] != undefined) {\n ctrl.viewModel[DatabusUris.DCT_HAS_VERSION].visibleFacetSettings.unshift({\n value: DatabusConstants.FACET_LATEST_VERSION_VALUE,\n checked: false,\n isOverride: false\n });\n\n // Apply the existing settings to the view model\n var fullFacets = ctrl.node.createFullFacetSettings();\n\n for (var key in fullFacets) {\n var facetSettingList = fullFacets[key];\n\n for (var i in facetSettingList) {\n var facetSetting = facetSettingList[i];\n\n var visibleFacetSetting = ctrl.getOrCreateVisibleFacetSetting(key, facetSetting.value);\n\n if (visibleFacetSetting != null) {\n visibleFacetSetting.checked = facetSetting.checked;\n visibleFacetSetting.isOverride = ctrl.node.isOverride(key, facetSetting.value, facetSetting.checked);\n }\n }\n }\n\n // If we're a group node, check for artifact nodes and add them as facets\n if (ctrl.resourceType == 'group') {\n\n for (var i in ctrl.node.childNodes) {\n var artifactNode = ctrl.node.childNodes[i];\n var facetValue = DatabusUtils.uriToName(artifactNode.uri)\n var visibleFacetSetting =\n ctrl.getOrCreateVisibleFacetSetting(DatabusUris.DATABUS_ARTIFACT_PROPERTY, facetValue);\n visibleFacetSetting.checked = true;\n visibleFacetSetting.isOverride = true;\n }\n\n if (ctrl.node.childNodes.length == 0) {\n\n\n ctrl.updateArtifactFilters(ctrl.node);\n\n var artifactFacetData = ctrl.facetsData[DatabusUris.DATABUS_ARTIFACT_PROPERTY];\n\n if (artifactFacetData != null) {\n\n // Add artifact nodes \n for (var i in artifactFacetData.values) {\n artifactFacetData.values[i] = DatabusUtils.uriToName(artifactFacetData.values[i]);\n }\n }\n\n /*\n // Add artifact nodes per default\n for (var v of ctrl.viewModel[DatabusUris.DATABUS_ARTIFACT_PROPERTY].visibleFacetSettings) {\n var childUri = ctrl.node.uri + '/' + v.value;\n var artifactNode = new QueryNode(childUri, 'databus:artifact');\n QueryNode.addChild(ctrl.node, artifactNode);\n }*/\n\n\n }\n }\n\n ctrl.onChange();\n ctrl.onLoaded();\n }\n\n ctrl.isLoading = false;\n });\n }\n\n ctrl.updateArtifactFilters = function (groupNode) {\n\n // Clear all child nodes\n groupNode.childNodes.length = 0;\n\n var hasCheckedArtifactFacets = false;\n\n for (var setting of ctrl.viewModel[DatabusUris.DATABUS_ARTIFACT_PROPERTY].visibleFacetSettings) {\n hasCheckedArtifactFacets = hasCheckedArtifactFacets || setting.checked;\n }\n\n if (hasCheckedArtifactFacets) {\n\n for (var setting of ctrl.viewModel[DatabusUris.DATABUS_ARTIFACT_PROPERTY].visibleFacetSettings) {\n if (setting.checked) {\n var artifactUri = `${groupNode.uri}/${setting.value}`;\n if (QueryNode.findChildByUri(groupNode, artifactUri) == null) {\n var artifactNode = new QueryNode(artifactUri, 'databus:artifact');\n QueryNode.addChild(groupNode, artifactNode);\n }\n }\n }\n\n } else {\n\n var latestVersionSetting = QueryNode.findFacetSetting(groupNode,\n DatabusUris.DCT_HAS_VERSION,\n DatabusConstants.FACET_LATEST_VERSION_VALUE);\n\n if (latestVersionSetting != undefined && latestVersionSetting.checked) {\n\n var artifactFacetData = ctrl.facetsData[DatabusUris.DATABUS_ARTIFACT_PROPERTY];\n\n if (artifactFacetData != null) {\n\n // Add artifact nodes \n for (var value of artifactFacetData.values) {\n var artifactUri = `${groupNode.uri}/${value}`;\n if (QueryNode.findChildByUri(groupNode, artifactUri) == null) {\n var artifactNode = new QueryNode(artifactUri, 'databus:artifact');\n QueryNode.addChild(groupNode, artifactNode);\n }\n }\n\n }\n }\n }\n\n }\n\n\n ctrl.getFacetLabel = function (value) {\n if (value == DatabusConstants.FACET_LATEST_VERSION_VALUE) {\n return DatabusConstants.FACET_LATEST_VERSION_LABEL;\n }\n\n return value;\n }\n /**\n * Changes the value of a key value (also applies to facets)\n * @param {[type]} key [description]\n * @param {[type]} value [description]\n * @param {[type]} state [description]\n * @return {[type]} [description]\n */\n ctrl.changeFacetValueState = function (key, value, targetState) {\n\n if (ctrl.resourceType == 'group' && key == DatabusUris.DATABUS_ARTIFACT_PROPERTY) {\n\n var visibleSetting = ctrl.getOrCreateVisibleFacetSetting(key, value);\n\n if (visibleSetting != null) {\n visibleSetting.checked = targetState;\n visibleSetting.isOverride = targetState;\n }\n\n ctrl.updateArtifactFilters(ctrl.node);\n\n }\n else {\n // apply change to view model\n ctrl.node.setFacet(key, value, targetState);\n\n var visibleSetting = ctrl.getOrCreateVisibleFacetSetting(key, value);\n\n if (visibleSetting != null) {\n visibleSetting.checked = targetState;\n visibleSetting.isOverride = ctrl.node.isOverride(key, value, targetState);\n }\n }\n\n if (ctrl.viewModel[key].autofill.selectedValues.length > 0) {\n ctrl.complete(ctrl.viewModel[key]);\n }\n\n ctrl.onChange();\n }\n\n /**\n * Gets or creates a new entry for a key value\n * for a given key and value\n * @param {[type]} key [description]\n * @param {[type]} value [description]\n * @return {[type]} [description]\n */\n ctrl.getOrCreateVisibleFacetSetting = function (key, value) {\n\n if (ctrl.viewModel[key] == undefined) {\n // This is a facet that the node does not have, but a parent has\n\n var label = DatabusUtils.uriToName(key);\n label = label[0].toUpperCase() + label.slice(1);\n\n ctrl.viewModel[key] = {};\n ctrl.viewModel[key].key = key;\n ctrl.viewModel[key].label = label;\n ctrl.viewModel[key].visibleFacetSettings = [];\n ctrl.viewModel[key].autofill = {};\n ctrl.viewModel[key].autofill.values = [];\n ctrl.viewModel[key].autofill.selectedValues = [];\n ctrl.viewModel[key].autofill.input = '';\n }\n\n for (var i in ctrl.viewModel[key].visibleFacetSettings) {\n var facetSetting = ctrl.viewModel[key].visibleFacetSettings[i];\n if (facetSetting.value == value) {\n return facetSetting; // ctrl.facetSettings[key];\n }\n }\n\n var visibleSetting = {\n value: value,\n };\n\n ctrl.viewModel[key].visibleFacetSettings.push(visibleSetting);\n return visibleSetting;\n }\n\n // Get all active facets of a certain key\n ctrl.getActiveFilters = function (key) {\n var activeFilters = [];\n\n for (var f in ctrl.facets[key].items) {\n var filter = ctrl.facets[key].items[f];\n if (filter.checked) {\n activeFilters.push(filter);\n }\n }\n\n return activeFilters;\n }\n\n // Checks whether any filter for a key is set\n ctrl.hasActiveFilters = function (key) {\n for (var f in ctrl.facets[key].items) {\n var filter = ctrl.facets[key].items[f];\n if (filter.checked) {\n return true;\n }\n }\n\n return false;\n }\n\n ctrl.complete = function (facetData) {\n facetData.autofill.selectedValues.length = 0;\n for (var a in facetData.autofill.values) {\n var e = facetData.autofill.values[a];\n if (e.toLowerCase().indexOf(facetData.autofill.input.toLowerCase()) >= 0) {\n\n var include = true;\n\n for (var v in facetData.visibleFacetSettings) {\n var visibleSettings = facetData.visibleFacetSettings[v];\n if (visibleSettings.value == e.toLowerCase()) {\n include = false;\n }\n }\n\n if (include) {\n facetData.autofill.selectedValues.push(e);\n }\n }\n }\n }\n\n // Clears the autofill lists\n ctrl.clearAutofill = function () {\n var self = ctrl;\n for (var f in self.viewModel) {\n var data = self.viewModel[f];\n data.autofill.selectedValues.length = 0;\n }\n }\n}\n\nmodule.exports = FacetsViewController;\n\n\n//# sourceURL=webpack://databus-webapp/./js/components/facets-view/facets-view.js?"); +eval("{const QueryNode = __webpack_require__(/*! ../../query-builder/query-node */ \"./js/query-builder/query-node.js\");\nconst DatabusConstants = __webpack_require__(/*! ../../utils/databus-constants */ \"./js/utils/databus-constants.js\");\nconst DatabusUris = __webpack_require__(/*! ../../utils/databus-uris */ \"./js/utils/databus-uris.js\");\nconst DatabusUtils = __webpack_require__(/*! ../../utils/databus-utils */ \"./js/utils/databus-utils.js\");\n\n/**\n * Manages an array of facets with respect to a parent facets array.\n * Provides some convenient\\ce methods to write to the facets array and\n * read from the parents facets.\n * DO NOT change the parent facets array in here.\n */\nclass FacetSettings {\n\n /**\n * Locally manages a facets array with respect to a parent\n * facets array\n * @param {[type]} facets [description]\n * @param {[type]} parentFacets [description]\n */\n constructor(facets, parentFacets) {\n this.facets = facets;\n this.parentFacets = parentFacets;\n }\n\n /**\n * Change a setting (key, value) to a state (bool)\n * @param {[type]} key [description]\n * @param {[type]} value [description]\n * @param {[type]} setState [description]\n * @return {[type]} [description]\n */\n changeSetting(key, value, targetState) {\n var parentState = this.findParentSettingState(key, value);\n\n if (parentState != targetState) {\n this.createOrAddSetting(key, value, targetState);\n } else {\n this.removeSetting(key, value);\n }\n\n return targetState;\n }\n\n /**\n * Find the checked state specified in the parent setting array (if set)\n * based on a key and value\n * @param {[type]} key [description]\n * @param {[type]} value [description]\n * @return {[type]} [description]\n */\n findParentSettingState(key, value) {\n if (this.parentFacets == undefined) {\n return false;\n }\n\n for (var p in this.parentFacets) {\n var setting = this.parentFacets[p];\n if (setting.key == key && setting.value == value) {\n return setting.checked;\n }\n }\n\n return false;\n }\n\n findOwnSettingState(key, value) {\n for (var p in this.facets) {\n var setting = this.facets[p];\n if (setting.key == key && setting.value == value) {\n return setting.checked;\n }\n }\n\n return false;\n }\n\n isOverride(key, value, state) {\n var parentState = this.findParentSettingState(key, value);\n return parentState != state;\n }\n\n createOrAddSetting(key, value, state) {\n for (var p in this.facets) {\n var setting = this.facets[p];\n if (p == key && setting.value == value) {\n setting.checked = state;\n return;\n }\n }\n\n this.facets[key] = { value: value, checked: state };\n }\n\n removeSetting(key, value) {\n for (var p in this.facets) {\n var setting = this.facets[p];\n if (setting.key == key && setting.value == value) {\n this.facets.splice(p, 1);\n return;\n }\n }\n }\n\n}\n\nfunction FacetsViewController($http, $scope) {\n\n var ctrl = this;\n ctrl.$http = $http;\n ctrl.maxEntries = 6;\n\n ctrl.$onInit = function () {\n\n }\n\n ctrl.$onChanges = function () {\n // create the queries...\n ctrl.isLoading = true;\n\n // wrap the node in the query node class\n ctrl.node = QueryNode.createFrom(ctrl.node);\n\n // Holds the view state as json\n ctrl.viewModel = {};\n\n if (ctrl.facets == undefined) {\n ctrl.facets = [];\n }\n\n var queryUri = ctrl.resourceType == 'version' ?\n ctrl.node.uri + '/' + ctrl.node.facetSettings[DatabusUris.DCT_HAS_VERSION][0].value\n : ctrl.node.uri;\n\n // Load the available resource facets\n // TODO: Remove resource type, can be derived from uri\n ctrl.$http.get('/app/utils/facets', {\n params: { uri: queryUri, type: ctrl.resourceType }\n }).then(function (result) {\n\n // Facets data has been loaded\n ctrl.facetsData = result.data;\n\n // Fix artifact facet values for groups, change URIs into artifact names\n var artifactFacetData = ctrl.facetsData[DatabusUris.DATABUS_ARTIFACT_PROPERTY];\n\n if (artifactFacetData != null) {\n for (var i in artifactFacetData.values) {\n artifactFacetData.values[i] = DatabusUtils.uriToName(artifactFacetData.values[i]);\n }\n }\n\n // Facet setting in this view is\n\n // - SETTING\n // ---- VALUE\n // ---- IS_CHECKED\n\n // Prepare visible facet settings and autofill data based on the facet data returned by the API\n // Create key base entries (unset, not overriden)\n for (var key in ctrl.facetsData) {\n\n var facetData = ctrl.facetsData[key];\n\n // Create a view data object for each facet\n ctrl.viewModel[key] = {};\n ctrl.viewModel[key].key = key;\n ctrl.viewModel[key].label = facetData.label;\n ctrl.viewModel[key].visibleFacetSettings = [];\n ctrl.viewModel[key].autofill = {};\n ctrl.viewModel[key].autofill.values = facetData.values;\n ctrl.viewModel[key].autofill.selectedValues = [];\n ctrl.viewModel[key].autofill.input = '';\n\n\n for (var v in facetData.values) {\n var value = facetData.values[v];\n ctrl.viewModel[key].visibleFacetSettings.push({\n value: value,\n checked: false,\n isOverride: false\n });\n }\n\n ctrl.viewModel[key].visibleFacetSettings.sort(function (a, b) {\n const valueA = a.value.toUpperCase();\n const valueB = b.value.toUpperCase();\n if (valueA > valueB) {\n return 1;\n }\n if (valueA < valueB) {\n return -1;\n }\n\n return 0;\n });\n\n // Show latest versions first\n if (key == DatabusUris.DCT_HAS_VERSION) {\n ctrl.viewModel[key].visibleFacetSettings.reverse();\n }\n\n // Only show the top few\n var length = ctrl.viewModel[key].visibleFacetSettings.length;\n ctrl.viewModel[key].visibleFacetSettings.length = Math.min(ctrl.maxEntries, length);\n }\n\n // If we show the browser for a version, remove the version facet\n if (ctrl.resourceType == 'version') {\n delete ctrl.viewModel[DatabusUris.DCT_HAS_VERSION];\n }\n\n // Add the \"Latest Version\" facet to the visible settings of the version facet\n if (ctrl.resourceType != 'version' && ctrl.viewModel[DatabusUris.DCT_HAS_VERSION] != undefined) {\n ctrl.viewModel[DatabusUris.DCT_HAS_VERSION].visibleFacetSettings.unshift({\n value: DatabusConstants.FACET_LATEST_VERSION_VALUE,\n checked: false,\n isOverride: false\n });\n\n // Apply the existing settings to the view model\n var fullFacets = ctrl.node.createFullFacetSettings();\n\n for (var key in fullFacets) {\n var facetSettingList = fullFacets[key];\n\n for (var i in facetSettingList) {\n var facetSetting = facetSettingList[i];\n\n var visibleFacetSetting = ctrl.getOrCreateVisibleFacetSetting(key, facetSetting.value);\n\n if (visibleFacetSetting != null) {\n visibleFacetSetting.checked = facetSetting.checked;\n visibleFacetSetting.isOverride = ctrl.node.isOverride(key, facetSetting.value, facetSetting.checked);\n }\n }\n }\n\n // If we're a group node, check for artifact nodes and add them as facets\n if (ctrl.resourceType == 'group') {\n\n for (var i in ctrl.node.childNodes) {\n var artifactNode = ctrl.node.childNodes[i];\n var facetValue = DatabusUtils.uriToName(artifactNode.uri)\n var visibleFacetSetting =\n ctrl.getOrCreateVisibleFacetSetting(DatabusUris.DATABUS_ARTIFACT_PROPERTY, facetValue);\n visibleFacetSetting.checked = true;\n visibleFacetSetting.isOverride = true;\n }\n\n if (ctrl.node.childNodes.length == 0) {\n\n\n ctrl.updateArtifactFilters(ctrl.node);\n\n var artifactFacetData = ctrl.facetsData[DatabusUris.DATABUS_ARTIFACT_PROPERTY];\n\n if (artifactFacetData != null) {\n\n // Add artifact nodes \n for (var i in artifactFacetData.values) {\n artifactFacetData.values[i] = DatabusUtils.uriToName(artifactFacetData.values[i]);\n }\n }\n\n /*\n // Add artifact nodes per default\n for (var v of ctrl.viewModel[DatabusUris.DATABUS_ARTIFACT_PROPERTY].visibleFacetSettings) {\n var childUri = ctrl.node.uri + '/' + v.value;\n var artifactNode = new QueryNode(childUri, 'databus:artifact');\n QueryNode.addChild(ctrl.node, artifactNode);\n }*/\n\n\n }\n }\n\n ctrl.onChange();\n ctrl.onLoaded();\n }\n\n ctrl.isLoading = false;\n });\n }\n\n ctrl.updateArtifactFilters = function (groupNode) {\n\n // Clear all child nodes\n groupNode.childNodes.length = 0;\n\n var hasCheckedArtifactFacets = false;\n\n for (var setting of ctrl.viewModel[DatabusUris.DATABUS_ARTIFACT_PROPERTY].visibleFacetSettings) {\n hasCheckedArtifactFacets = hasCheckedArtifactFacets || setting.checked;\n }\n\n if (hasCheckedArtifactFacets) {\n\n for (var setting of ctrl.viewModel[DatabusUris.DATABUS_ARTIFACT_PROPERTY].visibleFacetSettings) {\n if (setting.checked) {\n var artifactUri = `${groupNode.uri}/${setting.value}`;\n if (QueryNode.findChildByUri(groupNode, artifactUri) == null) {\n var artifactNode = new QueryNode(artifactUri, 'databus:artifact');\n QueryNode.addChild(groupNode, artifactNode);\n }\n }\n }\n\n } else {\n\n var latestVersionSetting = QueryNode.findFacetSetting(groupNode,\n DatabusUris.DCT_HAS_VERSION,\n DatabusConstants.FACET_LATEST_VERSION_VALUE);\n\n if (latestVersionSetting != undefined && latestVersionSetting.checked) {\n\n var artifactFacetData = ctrl.facetsData[DatabusUris.DATABUS_ARTIFACT_PROPERTY];\n\n if (artifactFacetData != null) {\n\n // Add artifact nodes \n for (var value of artifactFacetData.values) {\n var artifactUri = `${groupNode.uri}/${value}`;\n if (QueryNode.findChildByUri(groupNode, artifactUri) == null) {\n var artifactNode = new QueryNode(artifactUri, 'databus:artifact');\n QueryNode.addChild(groupNode, artifactNode);\n }\n }\n\n }\n }\n }\n\n }\n\n\n ctrl.getFacetLabel = function (value) {\n if (value == DatabusConstants.FACET_LATEST_VERSION_VALUE) {\n return DatabusConstants.FACET_LATEST_VERSION_LABEL;\n }\n\n return value;\n }\n /**\n * Changes the value of a key value (also applies to facets)\n * @param {[type]} key [description]\n * @param {[type]} value [description]\n * @param {[type]} state [description]\n * @return {[type]} [description]\n */\n ctrl.changeFacetValueState = function (key, value, targetState) {\n\n if (ctrl.resourceType == 'group' && key == DatabusUris.DATABUS_ARTIFACT_PROPERTY) {\n\n var visibleSetting = ctrl.getOrCreateVisibleFacetSetting(key, value);\n\n if (visibleSetting != null) {\n visibleSetting.checked = targetState;\n visibleSetting.isOverride = targetState;\n }\n\n ctrl.updateArtifactFilters(ctrl.node);\n\n }\n else {\n // apply change to view model\n ctrl.node.setFacet(key, value, targetState);\n\n var visibleSetting = ctrl.getOrCreateVisibleFacetSetting(key, value);\n\n if (visibleSetting != null) {\n visibleSetting.checked = targetState;\n visibleSetting.isOverride = ctrl.node.isOverride(key, value, targetState);\n }\n }\n\n if (ctrl.viewModel[key].autofill.selectedValues.length > 0) {\n ctrl.complete(ctrl.viewModel[key]);\n }\n\n ctrl.onChange();\n }\n\n /**\n * Gets or creates a new entry for a key value\n * for a given key and value\n * @param {[type]} key [description]\n * @param {[type]} value [description]\n * @return {[type]} [description]\n */\n ctrl.getOrCreateVisibleFacetSetting = function (key, value) {\n\n if (ctrl.viewModel[key] == undefined) {\n // This is a facet that the node does not have, but a parent has\n\n var label = DatabusUtils.uriToName(key);\n label = label[0].toUpperCase() + label.slice(1);\n\n ctrl.viewModel[key] = {};\n ctrl.viewModel[key].key = key;\n ctrl.viewModel[key].label = label;\n ctrl.viewModel[key].visibleFacetSettings = [];\n ctrl.viewModel[key].autofill = {};\n ctrl.viewModel[key].autofill.values = [];\n ctrl.viewModel[key].autofill.selectedValues = [];\n ctrl.viewModel[key].autofill.input = '';\n }\n\n for (var i in ctrl.viewModel[key].visibleFacetSettings) {\n var facetSetting = ctrl.viewModel[key].visibleFacetSettings[i];\n if (facetSetting.value == value) {\n return facetSetting; // ctrl.facetSettings[key];\n }\n }\n\n var visibleSetting = {\n value: value,\n };\n\n ctrl.viewModel[key].visibleFacetSettings.push(visibleSetting);\n return visibleSetting;\n }\n\n // Get all active facets of a certain key\n ctrl.getActiveFilters = function (key) {\n var activeFilters = [];\n\n for (var f in ctrl.facets[key].items) {\n var filter = ctrl.facets[key].items[f];\n if (filter.checked) {\n activeFilters.push(filter);\n }\n }\n\n return activeFilters;\n }\n\n // Checks whether any filter for a key is set\n ctrl.hasActiveFilters = function (key) {\n for (var f in ctrl.facets[key].items) {\n var filter = ctrl.facets[key].items[f];\n if (filter.checked) {\n return true;\n }\n }\n\n return false;\n }\n\n ctrl.complete = function (facetData) {\n facetData.autofill.selectedValues.length = 0;\n for (var a in facetData.autofill.values) {\n var e = facetData.autofill.values[a];\n if (e.toLowerCase().indexOf(facetData.autofill.input.toLowerCase()) >= 0) {\n\n var include = true;\n\n for (var v in facetData.visibleFacetSettings) {\n var visibleSettings = facetData.visibleFacetSettings[v];\n if (visibleSettings.value == e.toLowerCase()) {\n include = false;\n }\n }\n\n if (include) {\n facetData.autofill.selectedValues.push(e);\n }\n }\n }\n }\n\n // Clears the autofill lists\n ctrl.clearAutofill = function () {\n var self = ctrl;\n for (var f in self.viewModel) {\n var data = self.viewModel[f];\n data.autofill.selectedValues.length = 0;\n }\n }\n}\n\nmodule.exports = FacetsViewController;\n\n\n//# sourceURL=webpack://databus-webapp/./js/components/facets-view/facets-view.js?\n}"); -/***/ }), +/***/ }, -/***/ "./js/components/file-browser/file-browser.js": +/***/ "./js/components/file-browser/file-browser.js" /*!****************************************************!*\ !*** ./js/components/file-browser/file-browser.js ***! \****************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +(module, __unused_webpack_exports, __webpack_require__) { -eval("const DatabusConstants = __webpack_require__(/*! ../../utils/databus-constants */ \"./js/utils/databus-constants.js\");\nconst DatabusUtils = __webpack_require__(/*! ../../utils/databus-utils */ \"./js/utils/databus-utils.js\");\n// hinzufügen eines Controllers zum Modul\nfunction FileBrowserController($http, $scope) {\n\n var ctrl = this;\n\n ctrl.$http = $http;\n ctrl.activeTab = 0;\n ctrl.$scope = $scope;\n\n ctrl.$onInit = function () {\n\n ctrl.lastRequestRevision = 0;\n ctrl.tableLimit = 20;\n ctrl.sortProperty = 'version.value';\n ctrl.sortReverse = false;\n ctrl.isLoading = true;\n ctrl.queryResult = {};\n }\n\n ctrl.loadPreview = async function (binding) {\n binding.preview = { state: 'loading', value: null };\n\n try {\n const params = new URLSearchParams({\n url: binding.file.value,\n compression: binding.compression?.value || ''\n });\n\n const res = await fetch('/app/file/preview?' + params.toString(), {\n credentials: 'same-origin'\n });\n\n if (!res.ok) throw new Error('Network error');\n\n const data = await res.json();\n if (data.preview != null) {\n binding.preview.state = 'success';\n binding.preview.value = data.preview;\n } else {\n binding.preview.state = 'error';\n binding.preview.value = 'Preview could not be loaded';\n }\n\n } catch (e) {\n binding.preview.state = 'error';\n binding.preview.value = 'Preview could not be loaded';\n }\n\n if (!ctrl.$scope.$root.$$phase) ctrl.$scope.$apply();\n };\n\n ctrl.sortBy = function (property) {\n\n\n if (ctrl.sortProperty == property) {\n ctrl.sortReverse = !ctrl.sortReverse;\n }\n ctrl.sortProperty = property;\n }\n\n ctrl.getCellValues = function (binding, column) {\n\n if (binding[column.field] == undefined) {\n return \"\";\n }\n\n var value = binding[column.field].value;\n\n if (column.uriToName) {\n value = DatabusUtils.uriToName(value);\n }\n\n\n return value;\n\n }\n\n ctrl.formatUploadSize = function (size) {\n return DatabusUtils.formatFileSize(size);\n };\n\n ctrl.createRelativeUri = function (url) {\n var u = new URL(url);\n return u.pathname;\n }\n\n ctrl.formatVariant = function (value) {\n var variants = value.split(', ');\n value = \"\";\n for (variant of variants) {\n if (variant != undefined && variant != \"\") {\n value += variant + \", \";\n }\n }\n\n if (value == \"\") {\n return \"none\";\n }\n\n return value.substr(0, value.length - 2);\n }\n\n ctrl.querySparql = async function (query) {\n\n ctrl.isLoading = true;\n ctrl.totalSize = 0;\n ctrl.numFiles = 0;\n\n try {\n\n var req = {\n method: 'POST',\n url: DatabusConstants.DATABUS_SPARQL_ENDPOINT_URL,\n data: \"format=json&query=\" + encodeURIComponent(query),\n headers: {\n \"Content-type\": \"application/x-www-form-urlencoded\"\n },\n }\n\n var updateResponse = await ctrl.$http(req);\n\n var data = updateResponse.data;\n\n ctrl.isLoading = false;\n\n\n ctrl.queryResult.bindings = data.results.bindings;\n\n ctrl.queryResult.uriList = \"\";\n\n for (var b in ctrl.queryResult.bindings) {\n var binding = ctrl.queryResult.bindings[b];\n binding.size.numericalValue = parseInt(binding.size.value);\n ctrl.queryResult.uriList += binding.file.value + \"\\n\";\n\n if (binding.variant != undefined) {\n binding.variant.value = ctrl.formatVariant(binding.variant.value);\n }\n\n\n\n\n ctrl.totalSize += binding.size.numericalValue;\n ctrl.numFiles++;\n }\n\n ctrl.totalSize = ctrl.formatUploadSize(ctrl.totalSize);\n\n if (!$scope.$root.$$phase) {\n ctrl.$scope.$apply();\n }\n\n } catch (e) {\n console.log(e);\n }\n }\n\n /**\n * On each digest, check whether the settings array has changed, if so create new QUERIES\n * using the query builders\n * @return {[type]} [description]\n */\n ctrl.$doCheck = function () {\n\n if (ctrl.query != ctrl.fileQuery) {\n ctrl.fileQuery = ctrl.query;\n ctrl.querySparql(ctrl.fullQuery);\n }\n }\n\n function decodeBz2(uint8array) {\n try {\n const decompressed = decompress(uint8array);\n return new TextDecoder().decode(decompressed);\n } catch (e) {\n return null;\n }\n }\n}\n\n\n\nmodule.exports = FileBrowserController;\n\n//# sourceURL=webpack://databus-webapp/./js/components/file-browser/file-browser.js?"); +eval("{const DatabusConstants = __webpack_require__(/*! ../../utils/databus-constants */ \"./js/utils/databus-constants.js\");\nconst DatabusUtils = __webpack_require__(/*! ../../utils/databus-utils */ \"./js/utils/databus-utils.js\");\n// hinzufügen eines Controllers zum Modul\nfunction FileBrowserController($http, $scope) {\n\n var ctrl = this;\n\n ctrl.$http = $http;\n ctrl.activeTab = 0;\n ctrl.$scope = $scope;\n\n ctrl.$onInit = function () {\n\n ctrl.lastRequestRevision = 0;\n ctrl.tableLimit = 20;\n ctrl.sortProperty = 'version.value';\n ctrl.sortReverse = false;\n ctrl.isLoading = true;\n ctrl.queryResult = {};\n }\n\n ctrl.loadPreview = async function (binding) {\n binding.preview = { state: 'loading', value: null };\n\n try {\n const params = new URLSearchParams({\n url: binding.file.value,\n compression: binding.compression?.value || ''\n });\n\n const res = await fetch('/app/file/preview?' + params.toString(), {\n credentials: 'same-origin'\n });\n\n if (!res.ok) throw new Error('Network error');\n\n const data = await res.json();\n if (data.preview != null) {\n binding.preview.state = 'success';\n binding.preview.value = data.preview;\n } else {\n binding.preview.state = 'error';\n binding.preview.value = 'Preview could not be loaded';\n }\n\n } catch (e) {\n binding.preview.state = 'error';\n binding.preview.value = 'Preview could not be loaded';\n }\n\n if (!ctrl.$scope.$root.$$phase) ctrl.$scope.$apply();\n };\n\n ctrl.sortBy = function (property) {\n\n\n if (ctrl.sortProperty == property) {\n ctrl.sortReverse = !ctrl.sortReverse;\n }\n ctrl.sortProperty = property;\n }\n\n ctrl.getCellValues = function (binding, column) {\n\n if (binding[column.field] == undefined) {\n return \"\";\n }\n\n var value = binding[column.field].value;\n\n if (column.uriToName) {\n value = DatabusUtils.uriToName(value);\n }\n\n\n return value;\n\n }\n\n ctrl.formatUploadSize = function (size) {\n return DatabusUtils.formatFileSize(size);\n };\n\n ctrl.createRelativeUri = function (url) {\n var u = new URL(url);\n return u.pathname;\n }\n\n ctrl.formatVariant = function (value) {\n var variants = value.split(', ');\n value = \"\";\n for (variant of variants) {\n if (variant != undefined && variant != \"\") {\n value += variant + \", \";\n }\n }\n\n if (value == \"\") {\n return \"none\";\n }\n\n return value.substr(0, value.length - 2);\n }\n\n ctrl.querySparql = async function (query) {\n\n ctrl.isLoading = true;\n ctrl.totalSize = 0;\n ctrl.numFiles = 0;\n\n try {\n\n var req = {\n method: 'POST',\n url: DatabusConstants.DATABUS_SPARQL_ENDPOINT_URL,\n data: \"format=json&query=\" + encodeURIComponent(query),\n headers: {\n \"Content-type\": \"application/x-www-form-urlencoded\"\n },\n }\n\n var updateResponse = await ctrl.$http(req);\n\n var data = updateResponse.data;\n\n ctrl.isLoading = false;\n\n\n ctrl.queryResult.bindings = data.results.bindings;\n\n ctrl.queryResult.uriList = \"\";\n\n for (var b in ctrl.queryResult.bindings) {\n var binding = ctrl.queryResult.bindings[b];\n binding.size.numericalValue = parseInt(binding.size.value);\n ctrl.queryResult.uriList += binding.file.value + \"\\n\";\n\n if (binding.variant != undefined) {\n binding.variant.value = ctrl.formatVariant(binding.variant.value);\n }\n\n\n\n\n ctrl.totalSize += binding.size.numericalValue;\n ctrl.numFiles++;\n }\n\n ctrl.totalSize = ctrl.formatUploadSize(ctrl.totalSize);\n\n if (!$scope.$root.$$phase) {\n ctrl.$scope.$apply();\n }\n\n } catch (e) {\n console.log(e);\n }\n }\n\n /**\n * On each digest, check whether the settings array has changed, if so create new QUERIES\n * using the query builders\n * @return {[type]} [description]\n */\n ctrl.$doCheck = function () {\n\n if (ctrl.query != ctrl.fileQuery) {\n ctrl.fileQuery = ctrl.query;\n ctrl.querySparql(ctrl.fullQuery);\n }\n }\n\n function decodeBz2(uint8array) {\n try {\n const decompressed = decompress(uint8array);\n return new TextDecoder().decode(decompressed);\n } catch (e) {\n return null;\n }\n }\n}\n\n\n\nmodule.exports = FileBrowserController;\n\n//# sourceURL=webpack://databus-webapp/./js/components/file-browser/file-browser.js?\n}"); -/***/ }), +/***/ }, -/***/ "./js/components/multiselect-dropdown/multiselect-dropdown.js": +/***/ "./js/components/multiselect-dropdown/multiselect-dropdown.js" /*!********************************************************************!*\ !*** ./js/components/multiselect-dropdown/multiselect-dropdown.js ***! \********************************************************************/ -/***/ ((module) => { +(module) { -eval("// hinzufügen eines Controllers zum Modul\nfunction MultiselectDropdownController($timeout, $sce) {\n\n var ctrl = this;\n ctrl.$sce = $sce;\n ctrl.searchInput = \"\";\n\n\n ctrl.$onInit = function () {\n\n }\n\n ctrl.handleKey = function (e) {\n if (e.which === 9 || e.which === 13) {\n ctrl.showDrop = false;\n }\n }\n\n ctrl.getLabel = function (value) {\n\n if (value == '$latest') {\n return 'Latest Version';\n }\n\n if (value == '') {\n return 'None';\n }\n\n return value;\n }\n\n ctrl.hasContent = function () {\n return !((ctrl.input == undefined || ctrl.input.length == 0) && (ctrl.parentInput == undefined ||\n ctrl.parentInput.length == 0));\n }\n\n ctrl.valueComparator = function(v1, v2) {\n var isV1Included = ctrl.includesValue(ctrl.input, v1.value) \n || ctrl.includesValue(ctrl.parentInput, v1.value);\n var isV2Included = ctrl.includesValue(ctrl.input, v2.value) \n || ctrl.includesValue(ctrl.parentInput, v2.value);\n\n if(isV1Included != isV2Included) {\n return isV1Included ? -1 : 1;\n }\n\n if(v1.value == \"None\") {\n return -1;\n }\n\n\n if(v2.value == \"None\") {\n return 1;\n }\n\n return v1.value.localeCompare(v2.value);\n }\n \n \n ctrl.mergeSettings = function (parentSettings, childSettings) {\n var mergedSettings = {};\n\n // Set parent settings state\n if (parentSettings != undefined) {\n for (var setting of parentSettings) {\n mergedSettings[setting.value] = setting.checked;\n }\n }\n\n // Override with child settings\n for (var s in childSettings) {\n var setting = childSettings[s];\n mergedSettings[setting.value] = setting.checked;\n }\n\n return mergedSettings;\n }\n\n ctrl.list = function () {\n\n var mergedSettings = ctrl.mergeSettings(ctrl.parentInput, ctrl.input);\n\n var allEntries = Object.keys(mergedSettings).map(function (key, index) {\n\n var label = undefined;\n\n if (key == '') {\n label = 'None';\n } else {\n label = ctrl.getLabel(key);\n }\n\n if (mergedSettings[key]) {\n return label;\n } else {\n return `${label}`;\n }\n });\n\n\n var list = [];\n var maxLength = 50;\n var length = 0;\n var hasOverflow = false;\n\n for(var entry of allEntries) {\n if(entry.length + length > maxLength) {\n hasOverflow = true;\n break;\n }\n\n length += entry.length;\n list.push(entry);\n }\n\n if(hasOverflow) {\n list.push('...');\n }\n \n return ctrl.$sce.trustAsHtml(list.join(', '));\n }\n\n\n ctrl.hideDropDelayed = function () {\n $timeout(function () {\n ctrl.showDrop = false;\n }, 120);\n }\n\n ctrl.includesValue = function (objs, value) {\n if (objs == undefined) {\n return false;\n }\n\n for (var obj of objs) {\n if (obj.value == value) {\n return true;\n }\n }\n\n return false;\n }\n\n ctrl.matchesSearch = function(value) {\n return value.includes(ctrl.searchInput);\n }\n\n ctrl.isChecked = function (objs, value) {\n if (objs == undefined) {\n return false;\n }\n\n for (var obj of objs) {\n if (obj.value == value) {\n return obj.checked;\n }\n }\n\n return false;\n }\n\n ctrl.veryStupidDelete = function (objs, value) {\n\n let index = -1;\n let k = 0;\n\n if (objs == undefined) {\n return false;\n }\n\n for (var obj of objs) {\n if (obj.value == value) {\n index = k;\n break;\n }\n\n k++;\n }\n\n objs.splice(k, 1);\n }\n\n ctrl.toggle = function (value) {\n\n if (ctrl.input == undefined) {\n ctrl.input = [];\n }\n\n var isSetByParent = ctrl.parentInput != undefined && ctrl.includesValue(ctrl.parentInput, value);\n\n if (!ctrl.includesValue(ctrl.input, value)) {\n ctrl.input.push({ value: value, checked: !isSetByParent });\n\n } else {\n\n ctrl.veryStupidDelete(ctrl.input, value);\n }\n\n ctrl.change();\n }\n\n\n ctrl.change = function () {\n $timeout(function () {\n ctrl.onChange();\n }, 50);;\n }\n}\n\n\nmodule.exports = MultiselectDropdownController;\n\n//# sourceURL=webpack://databus-webapp/./js/components/multiselect-dropdown/multiselect-dropdown.js?"); +eval("{// hinzufügen eines Controllers zum Modul\nfunction MultiselectDropdownController($timeout, $sce) {\n\n var ctrl = this;\n ctrl.$sce = $sce;\n ctrl.searchInput = \"\";\n\n\n ctrl.$onInit = function () {\n\n }\n\n ctrl.handleKey = function (e) {\n if (e.which === 9 || e.which === 13) {\n ctrl.showDrop = false;\n }\n }\n\n ctrl.getLabel = function (value) {\n\n if (value == '$latest') {\n return 'Latest Version';\n }\n\n if (value == '') {\n return 'None';\n }\n\n return value;\n }\n\n ctrl.hasContent = function () {\n return !((ctrl.input == undefined || ctrl.input.length == 0) && (ctrl.parentInput == undefined ||\n ctrl.parentInput.length == 0));\n }\n\n ctrl.valueComparator = function(v1, v2) {\n var isV1Included = ctrl.includesValue(ctrl.input, v1.value) \n || ctrl.includesValue(ctrl.parentInput, v1.value);\n var isV2Included = ctrl.includesValue(ctrl.input, v2.value) \n || ctrl.includesValue(ctrl.parentInput, v2.value);\n\n if(isV1Included != isV2Included) {\n return isV1Included ? -1 : 1;\n }\n\n if(v1.value == \"None\") {\n return -1;\n }\n\n\n if(v2.value == \"None\") {\n return 1;\n }\n\n return v1.value.localeCompare(v2.value);\n }\n \n \n ctrl.mergeSettings = function (parentSettings, childSettings) {\n var mergedSettings = {};\n\n // Set parent settings state\n if (parentSettings != undefined) {\n for (var setting of parentSettings) {\n mergedSettings[setting.value] = setting.checked;\n }\n }\n\n // Override with child settings\n for (var s in childSettings) {\n var setting = childSettings[s];\n mergedSettings[setting.value] = setting.checked;\n }\n\n return mergedSettings;\n }\n\n ctrl.list = function () {\n\n var mergedSettings = ctrl.mergeSettings(ctrl.parentInput, ctrl.input);\n\n var allEntries = Object.keys(mergedSettings).map(function (key, index) {\n\n var label = undefined;\n\n if (key == '') {\n label = 'None';\n } else {\n label = ctrl.getLabel(key);\n }\n\n if (mergedSettings[key]) {\n return label;\n } else {\n return `${label}`;\n }\n });\n\n\n var list = [];\n var maxLength = 50;\n var length = 0;\n var hasOverflow = false;\n\n for(var entry of allEntries) {\n if(entry.length + length > maxLength) {\n hasOverflow = true;\n break;\n }\n\n length += entry.length;\n list.push(entry);\n }\n\n if(hasOverflow) {\n list.push('...');\n }\n \n return ctrl.$sce.trustAsHtml(list.join(', '));\n }\n\n\n ctrl.hideDropDelayed = function () {\n $timeout(function () {\n ctrl.showDrop = false;\n }, 120);\n }\n\n ctrl.includesValue = function (objs, value) {\n if (objs == undefined) {\n return false;\n }\n\n for (var obj of objs) {\n if (obj.value == value) {\n return true;\n }\n }\n\n return false;\n }\n\n ctrl.matchesSearch = function(value) {\n return value.includes(ctrl.searchInput);\n }\n\n ctrl.isChecked = function (objs, value) {\n if (objs == undefined) {\n return false;\n }\n\n for (var obj of objs) {\n if (obj.value == value) {\n return obj.checked;\n }\n }\n\n return false;\n }\n\n ctrl.veryStupidDelete = function (objs, value) {\n\n let index = -1;\n let k = 0;\n\n if (objs == undefined) {\n return false;\n }\n\n for (var obj of objs) {\n if (obj.value == value) {\n index = k;\n break;\n }\n\n k++;\n }\n\n objs.splice(k, 1);\n }\n\n ctrl.toggle = function (value) {\n\n if (ctrl.input == undefined) {\n ctrl.input = [];\n }\n\n var isSetByParent = ctrl.parentInput != undefined && ctrl.includesValue(ctrl.parentInput, value);\n\n if (!ctrl.includesValue(ctrl.input, value)) {\n ctrl.input.push({ value: value, checked: !isSetByParent });\n\n } else {\n\n ctrl.veryStupidDelete(ctrl.input, value);\n }\n\n ctrl.change();\n }\n\n\n ctrl.change = function () {\n $timeout(function () {\n ctrl.onChange();\n }, 50);;\n }\n}\n\n\nmodule.exports = MultiselectDropdownController;\n\n//# sourceURL=webpack://databus-webapp/./js/components/multiselect-dropdown/multiselect-dropdown.js?\n}"); -/***/ }), +/***/ }, -/***/ "./js/components/nav-search/nav-search-controller.js": +/***/ "./js/components/nav-search/nav-search-controller.js" /*!***********************************************************!*\ !*** ./js/components/nav-search/nav-search-controller.js ***! \***********************************************************/ -/***/ ((module) => { +(module) { -eval("\n\n// hinzufügen eines Controllers zum Modul\nfunction NavSearchController($http, $interval, $sce, searchManager) {\n\n var ctrl = this;\n\n // TODO: get search extensions from the logged in user\n\n ctrl.searchManager = searchManager;\n ctrl.results = [];\n\n ctrl.formatResult = function (result) {\n return $sce.trustAsHtml(result);\n }\n\n ctrl.toggleFilter = function (key) {\n ctrl.filterActive[key] = !ctrl.filterActive[key];\n ctrl.search();\n }\n\n ctrl.navigateTo = function(uri) {\n window.location = uri;\n }\n\n ctrl.hideDropdown = function() {\n\n }\n\n ctrl.availableResourceTypes = ['Collection', 'Artifact', 'Group', 'Account', 'Version' ];\n\n ctrl.$onInit = function () {\n\n ctrl.searchInput = '';\n ctrl.isSearching = false;\n ctrl.searchCooldown = 1000;\n\n\n ctrl.filterActive = {};\n ctrl.filterVisible = {};\n\n\n if (ctrl.settings == undefined) {\n ctrl.minRelevance = 0.01;\n ctrl.maxResults = 50;\n ctrl.searchFilter = \"\";\n ctrl.resourceTypes = null;\n ctrl.placeholder = \"Search the Databus...\"\n } else {\n ctrl.minRelevance = ctrl.settings.minRelevance;\n ctrl.maxResults = ctrl.settings.maxResults;\n ctrl.searchFilter = ctrl.settings.filter;\n ctrl.resourceTypes = ctrl.settings.resourceTypes;\n ctrl.placeholder = ctrl.settings.placeholder;\n }\n\n for (var resourceType of ctrl.availableResourceTypes) {\n ctrl.filterActive[resourceType] = false;\n ctrl.filterVisible[resourceType] = ctrl.resourceTypes == null;\n }\n\n ctrl.numFilters = 0;\n\n if (ctrl.resourceTypes != null) {\n for (var resourceType of ctrl.resourceTypes) {\n ctrl.filterVisible[resourceType] = true;\n ctrl.numFilters++;\n }\n }\n }\n\n ctrl.isAnyFilterActive = function () {\n\n for (var resourceType of ctrl.availableResourceTypes) {\n\n if (!ctrl.filterVisible[resourceType]) {\n continue;\n }\n\n if (ctrl.filterActive[resourceType]) {\n return true;\n }\n }\n\n return false;\n }\n\n ctrl.baseQueryFormatter = function(query) {\n return `?query=${query}${ctrl.searchFilter}${ctrl.baseFilters}${ctrl.typeFilters}`\n }\n\n $interval(function () {\n\n if (ctrl.searchChanged) {\n\n var baseFilters = `&minRelevance=${ctrl.minRelevance}&maxResults=${ctrl.maxResults}`;\n var typeFilters = ``;\n var isAnyFilterActive = ctrl.isAnyFilterActive();\n\n\n for (var resourceType of ctrl.availableResourceTypes) {\n\n if (!ctrl.filterVisible[resourceType]) {\n continue;\n }\n\n if (ctrl.filterActive[resourceType] || !isAnyFilterActive) {\n\n if (typeFilters == ``) {\n typeFilters = `&typeName=`;\n }\n\n typeFilters += ` ${resourceType}`;\n }\n }\n\n ctrl.baseFilters = baseFilters;\n ctrl.typeFilters = typeFilters;\n ctrl.searchManager.baseAdapter.queryFormatter = ctrl.baseQueryFormatter;\n\n ctrl.searchManager.search(ctrl.searchInput).then(function success(results) {\n \n for(var result of results) {\n\n if(result.abstract != null) {\n result.abstract = result.abstract[result.abstract.length - 1];\n }\n }\n \n ctrl.results = results;\n\n \n ctrl.isSearching = false;\n }, function error(response) {\n ctrl.isSearching = false;\n });\n\n ctrl.searchChanged = false;\n };\n }, ctrl.searchCooldown);\n\n ctrl.search = function () {\n ctrl.isSearching = true;\n ctrl.searchChanged = true;\n };\n\n};\n\nmodule.exports = NavSearchController;\n\n\n\n//# sourceURL=webpack://databus-webapp/./js/components/nav-search/nav-search-controller.js?"); +eval("{\n\n// hinzufügen eines Controllers zum Modul\nfunction NavSearchController($http, $interval, $sce, searchManager) {\n\n var ctrl = this;\n\n // TODO: get search extensions from the logged in user\n\n ctrl.searchManager = searchManager;\n ctrl.results = [];\n\n ctrl.formatResult = function (result) {\n return $sce.trustAsHtml(result);\n }\n\n ctrl.toggleFilter = function (key) {\n ctrl.filterActive[key] = !ctrl.filterActive[key];\n ctrl.search();\n }\n\n ctrl.navigateTo = function(uri) {\n window.location = uri;\n }\n\n ctrl.hideDropdown = function() {\n\n }\n\n ctrl.availableResourceTypes = ['Collection', 'Artifact', 'Group', 'Account', 'Version' ];\n\n ctrl.$onInit = function () {\n\n ctrl.searchInput = '';\n ctrl.isSearching = false;\n ctrl.searchCooldown = 1000;\n\n\n ctrl.filterActive = {};\n ctrl.filterVisible = {};\n\n\n if (ctrl.settings == undefined) {\n ctrl.minRelevance = 0.01;\n ctrl.maxResults = 50;\n ctrl.searchFilter = \"\";\n ctrl.resourceTypes = null;\n ctrl.placeholder = \"Search the Databus...\"\n } else {\n ctrl.minRelevance = ctrl.settings.minRelevance;\n ctrl.maxResults = ctrl.settings.maxResults;\n ctrl.searchFilter = ctrl.settings.filter;\n ctrl.resourceTypes = ctrl.settings.resourceTypes;\n ctrl.placeholder = ctrl.settings.placeholder;\n }\n\n for (var resourceType of ctrl.availableResourceTypes) {\n ctrl.filterActive[resourceType] = false;\n ctrl.filterVisible[resourceType] = ctrl.resourceTypes == null;\n }\n\n ctrl.numFilters = 0;\n\n if (ctrl.resourceTypes != null) {\n for (var resourceType of ctrl.resourceTypes) {\n ctrl.filterVisible[resourceType] = true;\n ctrl.numFilters++;\n }\n }\n }\n\n ctrl.isAnyFilterActive = function () {\n\n for (var resourceType of ctrl.availableResourceTypes) {\n\n if (!ctrl.filterVisible[resourceType]) {\n continue;\n }\n\n if (ctrl.filterActive[resourceType]) {\n return true;\n }\n }\n\n return false;\n }\n\n ctrl.baseQueryFormatter = function(query) {\n return `?query=${query}${ctrl.searchFilter}${ctrl.baseFilters}${ctrl.typeFilters}`\n }\n\n $interval(function () {\n\n if (ctrl.searchChanged) {\n\n var baseFilters = `&minRelevance=${ctrl.minRelevance}&maxResults=${ctrl.maxResults}`;\n var typeFilters = ``;\n var isAnyFilterActive = ctrl.isAnyFilterActive();\n\n\n for (var resourceType of ctrl.availableResourceTypes) {\n\n if (!ctrl.filterVisible[resourceType]) {\n continue;\n }\n\n if (ctrl.filterActive[resourceType] || !isAnyFilterActive) {\n\n if (typeFilters == ``) {\n typeFilters = `&typeName=`;\n }\n\n typeFilters += ` ${resourceType}`;\n }\n }\n\n ctrl.baseFilters = baseFilters;\n ctrl.typeFilters = typeFilters;\n ctrl.searchManager.baseAdapter.queryFormatter = ctrl.baseQueryFormatter;\n\n ctrl.searchManager.search(ctrl.searchInput).then(function success(results) {\n \n for(var result of results) {\n\n if(result.abstract != null) {\n result.abstract = result.abstract[result.abstract.length - 1];\n }\n }\n \n ctrl.results = results;\n\n \n ctrl.isSearching = false;\n }, function error(response) {\n ctrl.isSearching = false;\n });\n\n ctrl.searchChanged = false;\n };\n }, ctrl.searchCooldown);\n\n ctrl.search = function () {\n ctrl.isSearching = true;\n ctrl.searchChanged = true;\n };\n\n};\n\nmodule.exports = NavSearchController;\n\n\n\n//# sourceURL=webpack://databus-webapp/./js/components/nav-search/nav-search-controller.js?\n}"); -/***/ }), +/***/ }, -/***/ "./js/components/override-checkbox/override-checkbox.js": +/***/ "./js/components/override-checkbox/override-checkbox.js" /*!**************************************************************!*\ !*** ./js/components/override-checkbox/override-checkbox.js ***! \**************************************************************/ -/***/ ((module) => { +(module) { -eval("\n\n// hinzufügen eines Controllers zum Modul\nfunction OverrideCheckboxController() {\n\n var ctrl = this;\n\n ctrl.$onInit = function() {\n\n if(ctrl.id == undefined) {\n ctrl.id = ctrl.label;\n }\n }\n\n ctrl.change = function() {\n\n if(!ctrl.readonly) {\n ctrl.onChange();\n }\n }\n}\n\nmodule.exports = OverrideCheckboxController;\n\n//# sourceURL=webpack://databus-webapp/./js/components/override-checkbox/override-checkbox.js?"); +eval("{\n\n// hinzufügen eines Controllers zum Modul\nfunction OverrideCheckboxController() {\n\n var ctrl = this;\n\n ctrl.$onInit = function() {\n\n if(ctrl.id == undefined) {\n ctrl.id = ctrl.label;\n }\n }\n\n ctrl.change = function() {\n\n if(!ctrl.readonly) {\n ctrl.onChange();\n }\n }\n}\n\nmodule.exports = OverrideCheckboxController;\n\n//# sourceURL=webpack://databus-webapp/./js/components/override-checkbox/override-checkbox.js?\n}"); -/***/ }), +/***/ }, -/***/ "./js/components/search/search-controller.js": +/***/ "./js/components/search/search-controller.js" /*!***************************************************!*\ !*** ./js/components/search/search-controller.js ***! \***************************************************/ -/***/ ((module) => { +(module) { -eval("\n\n// hinzufügen eines Controllers zum Modul\nfunction SearchController($http, $interval, $sce, searchManager) {\n\n var ctrl = this;\n\n // TODO: get search extensions from the logged in user\n\n ctrl.searchManager = searchManager;\n ctrl.results = [];\n\n ctrl.formatResult = function (result) {\n return $sce.trustAsHtml(result);\n }\n\n ctrl.toggleFilter = function (key) {\n ctrl.filterActive[key] = !ctrl.filterActive[key];\n ctrl.search();\n }\n\n ctrl.availableResourceTypes = ['Collection', 'Artifact', 'Group', 'Account', 'Version' ];\n\n ctrl.$onInit = function () {\n\n ctrl.searchInput = '';\n ctrl.isSearching = false;\n ctrl.searchCooldown = 300;\n\n if (ctrl.settings == undefined) {\n ctrl.minRelevance = 0.01;\n ctrl.maxResults = 50;\n ctrl.searchFilter = \"\";\n ctrl.resourceTypes = null;\n ctrl.placeholder = \"Search the Databus...\"\n } else {\n ctrl.minRelevance = ctrl.settings.minRelevance;\n ctrl.maxResults = ctrl.settings.maxResults;\n ctrl.searchFilter = ctrl.settings.filter;\n ctrl.resourceTypes = ctrl.settings.resourceTypes;\n ctrl.placeholder = ctrl.settings.placeholder;\n }\n\n ctrl.filterActive = {};\n ctrl.filterVisible = {};\n\n for (var resourceType of ctrl.availableResourceTypes) {\n ctrl.filterActive[resourceType] = false;\n ctrl.filterVisible[resourceType] = ctrl.resourceTypes == null;\n }\n\n ctrl.numFilters = 0;\n\n if (ctrl.resourceTypes != null) {\n for (var resourceType of ctrl.resourceTypes) {\n ctrl.filterVisible[resourceType] = true;\n ctrl.numFilters++;\n }\n }\n }\n\n ctrl.isAnyFilterActive = function () {\n\n for (var resourceType of ctrl.availableResourceTypes) {\n\n if (!ctrl.filterVisible[resourceType]) {\n continue;\n }\n\n if (ctrl.filterActive[resourceType]) {\n return true;\n }\n }\n\n return false;\n }\n\n ctrl.baseQueryFormatter = function(query) {\n return `?query=${query}${ctrl.searchFilter}${ctrl.baseFilters}${ctrl.typeFilters}`\n }\n\n $interval(function () {\n\n if (ctrl.searchChanged) {\n\n var baseFilters = `&minRelevance=${ctrl.minRelevance}&maxResults=${ctrl.maxResults}`;\n var typeFilters = ``;\n var isAnyFilterActive = ctrl.isAnyFilterActive();\n\n\n for (var resourceType of ctrl.availableResourceTypes) {\n\n if (!ctrl.filterVisible[resourceType]) {\n continue;\n }\n\n if (ctrl.filterActive[resourceType] || !isAnyFilterActive) {\n\n if (typeFilters == ``) {\n typeFilters = `&typeName=`;\n }\n\n typeFilters += ` ${resourceType}`;\n }\n }\n\n ctrl.baseFilters = baseFilters;\n ctrl.typeFilters = typeFilters;\n ctrl.searchManager.baseAdapter.queryFormatter = ctrl.baseQueryFormatter;\n\n ctrl.searchManager.search(ctrl.searchInput).then(function success(results) {\n ctrl.results = results;\n ctrl.isSearching = false;\n }, function error(response) {\n ctrl.isSearching = false;\n });\n\n ctrl.searchChanged = false;\n };\n }, ctrl.searchCooldown);\n\n ctrl.search = function () {\n ctrl.isSearching = true;\n ctrl.searchChanged = true;\n };\n\n};\n\nmodule.exports = SearchController;\n\n\n\n//# sourceURL=webpack://databus-webapp/./js/components/search/search-controller.js?"); +eval("{\n\n// hinzufügen eines Controllers zum Modul\nfunction SearchController($http, $interval, $sce, searchManager) {\n\n var ctrl = this;\n\n // TODO: get search extensions from the logged in user\n\n ctrl.searchManager = searchManager;\n ctrl.results = [];\n\n ctrl.formatResult = function (result) {\n return $sce.trustAsHtml(result);\n }\n\n ctrl.toggleFilter = function (key) {\n ctrl.filterActive[key] = !ctrl.filterActive[key];\n ctrl.search();\n }\n\n ctrl.availableResourceTypes = ['Collection', 'Artifact', 'Group', 'Account', 'Version' ];\n\n ctrl.$onInit = function () {\n\n ctrl.searchInput = '';\n ctrl.isSearching = false;\n ctrl.searchCooldown = 300;\n\n if (ctrl.settings == undefined) {\n ctrl.minRelevance = 0.01;\n ctrl.maxResults = 50;\n ctrl.searchFilter = \"\";\n ctrl.resourceTypes = null;\n ctrl.placeholder = \"Search the Databus...\"\n } else {\n ctrl.minRelevance = ctrl.settings.minRelevance;\n ctrl.maxResults = ctrl.settings.maxResults;\n ctrl.searchFilter = ctrl.settings.filter;\n ctrl.resourceTypes = ctrl.settings.resourceTypes;\n ctrl.placeholder = ctrl.settings.placeholder;\n }\n\n ctrl.filterActive = {};\n ctrl.filterVisible = {};\n\n for (var resourceType of ctrl.availableResourceTypes) {\n ctrl.filterActive[resourceType] = false;\n ctrl.filterVisible[resourceType] = ctrl.resourceTypes == null;\n }\n\n ctrl.numFilters = 0;\n\n if (ctrl.resourceTypes != null) {\n for (var resourceType of ctrl.resourceTypes) {\n ctrl.filterVisible[resourceType] = true;\n ctrl.numFilters++;\n }\n }\n }\n\n ctrl.isAnyFilterActive = function () {\n\n for (var resourceType of ctrl.availableResourceTypes) {\n\n if (!ctrl.filterVisible[resourceType]) {\n continue;\n }\n\n if (ctrl.filterActive[resourceType]) {\n return true;\n }\n }\n\n return false;\n }\n\n ctrl.baseQueryFormatter = function(query) {\n return `?query=${query}${ctrl.searchFilter}${ctrl.baseFilters}${ctrl.typeFilters}`\n }\n\n $interval(function () {\n\n if (ctrl.searchChanged) {\n\n var baseFilters = `&minRelevance=${ctrl.minRelevance}&maxResults=${ctrl.maxResults}`;\n var typeFilters = ``;\n var isAnyFilterActive = ctrl.isAnyFilterActive();\n\n\n for (var resourceType of ctrl.availableResourceTypes) {\n\n if (!ctrl.filterVisible[resourceType]) {\n continue;\n }\n\n if (ctrl.filterActive[resourceType] || !isAnyFilterActive) {\n\n if (typeFilters == ``) {\n typeFilters = `&typeName=`;\n }\n\n typeFilters += ` ${resourceType}`;\n }\n }\n\n ctrl.baseFilters = baseFilters;\n ctrl.typeFilters = typeFilters;\n ctrl.searchManager.baseAdapter.queryFormatter = ctrl.baseQueryFormatter;\n\n ctrl.searchManager.search(ctrl.searchInput).then(function success(results) {\n ctrl.results = results;\n ctrl.isSearching = false;\n }, function error(response) {\n ctrl.isSearching = false;\n });\n\n ctrl.searchChanged = false;\n };\n }, ctrl.searchCooldown);\n\n ctrl.search = function () {\n ctrl.isSearching = true;\n ctrl.searchChanged = true;\n };\n\n};\n\nmodule.exports = SearchController;\n\n\n\n//# sourceURL=webpack://databus-webapp/./js/components/search/search-controller.js?\n}"); -/***/ }), +/***/ }, -/***/ "./js/components/table-editor/table-editor.js": +/***/ "./js/components/table-editor/table-editor.js" /*!****************************************************!*\ !*** ./js/components/table-editor/table-editor.js ***! \****************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +(module, __unused_webpack_exports, __webpack_require__) { -eval("const DatabusUtils = __webpack_require__(/*! ../../utils/databus-utils */ \"./js/utils/databus-utils.js\");\n\n// hinzufügen eines Controllers zum Modul\nfunction TableEditorController() {\n\n var ctrl = this;\n\n ctrl.$onInit = function() {\n\n ctrl.selection = {};\n ctrl.edit = {};\n\n if(ctrl.model.groupMode == undefined) {\n ctrl.model.groupMode = true;\n }\n\n ctrl.setupColumns();\n ctrl.updateViewModel();\n }\n\n ctrl.getSpanWidth = function(row, cv) {\n var span = $(`#${row}_${cv}`);\n var width = span.width();\n\n if(width == undefined) {\n return 0;\n }\n\n return width + 22;\n }\n\n ctrl.editContentVariant = function(index) {\n\n ctrl.onEditContentVariant({ index: index});\n }\n\n ctrl.setupColumns = function() {\n\n ctrl.columns = [];\n ctrl.columns.push({ title:'File', width: 400, isReadonly : true });\n\n for(var c in ctrl.model.contentVariants) {\n var cv = ctrl.model.contentVariants[c];\n ctrl.columns.push({ title: cv.label, width: 120, isReadonly : false });\n }\n\n ctrl.columns.push({ title:'Actions', width: 120, isReadonly : true });\n ctrl.progressWidth = (115 + 200) + 'px';\n }\n\n ctrl.toggleGroupMode = function() {\n ctrl.model.groupMode = ! ctrl.model.groupMode;\n ctrl.updateViewModel();\n }\n\n ctrl.onShowInput = function($event) {\n \n }\n\n ctrl.deselect = function() {\n ctrl.edit.x = undefined;\n ctrl.edit.y = undefined;\n ctrl.selection.x = undefined;\n ctrl.selection.y = undefined;\n ctrl.selection.width = 0;\n ctrl.selection.height = 0;\n }\n\n ctrl.selectCell = function($event, x, y) {\n\n \n ctrl.edit.x = undefined;\n ctrl.edit.y = undefined;\n\n ctrl.edit.x = x;\n ctrl.edit.y = y; \n ctrl.selection.x = x;\n ctrl.selection.y = y;\n ctrl.selection.width = 1;\n ctrl.selection.height = 1;\n \n }\n\n ctrl.analyzeFile = function(file) {\n ctrl.onAnalyzeFile({ file : file });\n }\n\n ctrl.onChangeCv = function(file, cv) {\n\n var index = ctrl.model.files.findIndex(f => f.uri == file.uri);\n \n for(var i = index + 1; i < index + file.rowspan; i++) {\n ctrl.model.files[i].contentVariants[cv.id] = file.contentVariants[cv.id];\n }\n \n ctrl.model.onChange();\n }\n\n ctrl.updateViewModel = function() {\n\n for(var f in ctrl.model.files) {\n ctrl.model.files[f].rowspan = 1;\n }\n\n /*\n if(ctrl.model.groupMode) {\n\n var i = 0;\n var step = 1;\n\n while(i + step < ctrl.model.files.length) {\n\n if(ctrl.model.files[i].name == ctrl.model.files[i + step].name) {\n // Swallow the cv setting of the next row\n // ctrl.model.files[i].rowspan++;\n // ctrl.model.files[i + step].rowspan = 0;\n\n for(var c in ctrl.model.contentVariants) {\n var cv = ctrl.model.contentVariants[c];\n ctrl.model.files[i + step].contentVariants[cv.id] = ctrl.model.files[i].contentVariants[cv.id];\n }\n\n step++;\n } else {\n i += step;\n step = 1;\n }\n }\n }*/\n\n\n }\n /**\n * Removes a specific distribution from an artifact\n * @param {*} artifact \n * @param {*} file \n */\n ctrl.removeFileFromArtifact = function(file, index) {\n ctrl.onRemoveFile({ file : file, index: index});\n }\n\n ctrl.$doCheck = function() { \n\n var numFiles = DatabusUtils.objSize(ctrl.model.files);\n if(ctrl.numFiles != numFiles) {\n ctrl.updateViewModel();\n ctrl.numFiles = numFiles;\n }\n\n\n if(ctrl.columns == undefined) {\n return;\n }\n\n var columnCount = 4;\n\n for(var c in ctrl.model.contentVariants) {\n columnCount++;\n }\n\n ctrl.progressPosition = 45;\n for(var i = 0; i < columnCount - 3; i++) {\n ctrl.progressPosition += ctrl.columns[i].width;\n }\n ctrl.progressPosition = ctrl.progressPosition + 'px'\n\n if(ctrl.columns.length == columnCount) {\n return;\n }\n\n ctrl.setupColumns();\n }\n\n ctrl.change = function() {\n\n }\n};\n\nmodule.exports = TableEditorController;\n\n//# sourceURL=webpack://databus-webapp/./js/components/table-editor/table-editor.js?"); +eval("{const DatabusUtils = __webpack_require__(/*! ../../utils/databus-utils */ \"./js/utils/databus-utils.js\");\n\n// hinzufügen eines Controllers zum Modul\nfunction TableEditorController() {\n\n var ctrl = this;\n\n ctrl.$onInit = function() {\n\n ctrl.selection = {};\n ctrl.edit = {};\n\n if(ctrl.model.groupMode == undefined) {\n ctrl.model.groupMode = true;\n }\n\n ctrl.setupColumns();\n ctrl.updateViewModel();\n }\n\n ctrl.getSpanWidth = function(row, cv) {\n var span = $(`#${row}_${cv}`);\n var width = span.width();\n\n if(width == undefined) {\n return 0;\n }\n\n return width + 22;\n }\n\n ctrl.editContentVariant = function(index) {\n\n ctrl.onEditContentVariant({ index: index});\n }\n\n ctrl.setupColumns = function() {\n\n ctrl.columns = [];\n ctrl.columns.push({ title:'File', width: 400, isReadonly : true });\n\n for(var c in ctrl.model.contentVariants) {\n var cv = ctrl.model.contentVariants[c];\n ctrl.columns.push({ title: cv.label, width: 120, isReadonly : false });\n }\n\n ctrl.columns.push({ title:'Actions', width: 120, isReadonly : true });\n ctrl.progressWidth = (115 + 200) + 'px';\n }\n\n ctrl.toggleGroupMode = function() {\n ctrl.model.groupMode = ! ctrl.model.groupMode;\n ctrl.updateViewModel();\n }\n\n ctrl.onShowInput = function($event) {\n \n }\n\n ctrl.deselect = function() {\n ctrl.edit.x = undefined;\n ctrl.edit.y = undefined;\n ctrl.selection.x = undefined;\n ctrl.selection.y = undefined;\n ctrl.selection.width = 0;\n ctrl.selection.height = 0;\n }\n\n ctrl.selectCell = function($event, x, y) {\n\n \n ctrl.edit.x = undefined;\n ctrl.edit.y = undefined;\n\n ctrl.edit.x = x;\n ctrl.edit.y = y; \n ctrl.selection.x = x;\n ctrl.selection.y = y;\n ctrl.selection.width = 1;\n ctrl.selection.height = 1;\n \n }\n\n ctrl.analyzeFile = function(file) {\n ctrl.onAnalyzeFile({ file : file });\n }\n\n ctrl.onChangeCv = function(file, cv) {\n\n var index = ctrl.model.files.findIndex(f => f.uri == file.uri);\n \n for(var i = index + 1; i < index + file.rowspan; i++) {\n ctrl.model.files[i].contentVariants[cv.id] = file.contentVariants[cv.id];\n }\n \n ctrl.model.onChange();\n }\n\n ctrl.updateViewModel = function() {\n\n for(var f in ctrl.model.files) {\n ctrl.model.files[f].rowspan = 1;\n }\n\n /*\n if(ctrl.model.groupMode) {\n\n var i = 0;\n var step = 1;\n\n while(i + step < ctrl.model.files.length) {\n\n if(ctrl.model.files[i].name == ctrl.model.files[i + step].name) {\n // Swallow the cv setting of the next row\n // ctrl.model.files[i].rowspan++;\n // ctrl.model.files[i + step].rowspan = 0;\n\n for(var c in ctrl.model.contentVariants) {\n var cv = ctrl.model.contentVariants[c];\n ctrl.model.files[i + step].contentVariants[cv.id] = ctrl.model.files[i].contentVariants[cv.id];\n }\n\n step++;\n } else {\n i += step;\n step = 1;\n }\n }\n }*/\n\n\n }\n /**\n * Removes a specific distribution from an artifact\n * @param {*} artifact \n * @param {*} file \n */\n ctrl.removeFileFromArtifact = function(file, index) {\n ctrl.onRemoveFile({ file : file, index: index});\n }\n\n ctrl.$doCheck = function() { \n\n var numFiles = DatabusUtils.objSize(ctrl.model.files);\n if(ctrl.numFiles != numFiles) {\n ctrl.updateViewModel();\n ctrl.numFiles = numFiles;\n }\n\n\n if(ctrl.columns == undefined) {\n return;\n }\n\n var columnCount = 4;\n\n for(var c in ctrl.model.contentVariants) {\n columnCount++;\n }\n\n ctrl.progressPosition = 45;\n for(var i = 0; i < columnCount - 3; i++) {\n ctrl.progressPosition += ctrl.columns[i].width;\n }\n ctrl.progressPosition = ctrl.progressPosition + 'px'\n\n if(ctrl.columns.length == columnCount) {\n return;\n }\n\n ctrl.setupColumns();\n }\n\n ctrl.change = function() {\n\n }\n};\n\nmodule.exports = TableEditorController;\n\n//# sourceURL=webpack://databus-webapp/./js/components/table-editor/table-editor.js?\n}"); -/***/ }), +/***/ }, -/***/ "./js/components/type-tag/type-tag.js": +/***/ "./js/components/type-tag/type-tag.js" /*!********************************************!*\ !*** ./js/components/type-tag/type-tag.js ***! \********************************************/ -/***/ ((module) => { +(module) { -eval("// hinzufügen eines Controllers zum Modul\nfunction TypeTagController() {\n\n var ctrl = this;\n\n ctrl.typeMap = {};\n ctrl.typeMap[\"Artifact\"] = \"is-artifact\";\n ctrl.typeMap[\"Version\"] = \"is-version\";\n ctrl.typeMap[\"Group\"] = \"is-group\";\n ctrl.typeMap[\"Service\"] = \"is-service\";\n ctrl.typeMap[\"Account\"] = \"is-consumer\";\n ctrl.typeMap[\"Collection\"] = \"is-collection\";\n ctrl.typeMap[\"BlogEntry\"] = \"is-blog\";\n ctrl.typeMap[\"Databus\"] = \"is-version\";\n ctrl.typeMap[\"Sparql\"] = \"is-grey\";\n\n ctrl.iconMap = {};\n ctrl.iconMap[\"Artifact\"] = \"M12,0 L1,12 l11,12 l11,-12 L12,0z\"; \n ctrl.iconMap[\"Version\"] = \"M 14.9 1 L 12.293 1.005 L 16.507 7.18 L 16.5 23.1 L 18.5 23.1 L 18.5 6.4 L 14.9 1 Z M 10.4 1 L 1.581 1.004 L 1.584 23.13 L 15 23.1 L 15 7.7 L 10.4 1 Z M 16.8 1 L 20 5.8 L 20 23.1 L 22 23.1 L 22 4.9 L 19.3 1 L 16.8 1 Z\";\n ctrl.iconMap[\"Group\"] = \"M21.698 10.658l2.302 1.342-12.002 7-11.998-7 2.301-1.342 9.697 5.658 9.7-5.658zm-9.7 10.657l-9.697-5.658-2.301 1.343 11.998 7 12.002-7-2.302-1.342-9.7 5.657zm12.002-14.315l-12.002-7-11.998 7 11.998 7 12.002-7z\";\n ctrl.iconMap[\"Service\"] = \"M24 13.616v-3.232l-2.869-1.02c-.198-.687-.472-1.342-.811-1.955l1.308-2.751-2.285-2.285-2.751 1.307c-.613-.339-1.269-.613-1.955-.811l-1.021-2.869h-3.232l-1.021 2.869c-.686.198-1.342.471-1.955.811l-2.751-1.308-2.285 2.285 1.308 2.752c-.339.613-.614 1.268-.811 1.955l-2.869 1.02v3.232l2.869 1.02c.197.687.472 1.342.811 1.955l-1.308 2.751 2.285 2.286 2.751-1.308c.613.339 1.269.613 1.955.811l1.021 2.869h3.232l1.021-2.869c.687-.198 1.342-.472 1.955-.811l2.751 1.308 2.285-2.286-1.308-2.751c.339-.613.613-1.268.811-1.955l2.869-1.02zm-12 2.384c-2.209 0-4-1.791-4-4s1.791-4 4-4 4 1.791 4 4-1.791 4-4 4z\";\n ctrl.iconMap[\"Account\"] = \"M19 7.001c0 3.865-3.134 7-7 7s-7-3.135-7-7c0-3.867 3.134-7.001 7-7.001s7 3.134 7 7.001zm-1.598 7.18c-1.506 1.137-3.374 1.82-5.402 1.82-2.03 0-3.899-.685-5.407-1.822-4.072 1.793-6.593 7.376-6.593 9.821h24c0-2.423-2.6-8.006-6.598-9.819z\";\n ctrl.iconMap[\"Collection\"] = \"M11.499 12.03v11.971l-10.5-5.603v-11.835l10.5 5.467zm11.501 6.368l-10.501 5.602v-11.968l10.501-5.404v11.77zm-16.889-15.186l10.609 5.524-4.719 2.428-10.473-5.453 4.583-2.499zm16.362 2.563l-4.664 2.4-10.641-5.54 4.831-2.635 10.474 5.775z\";\n ctrl.iconMap[\"BlogEntry\"] = \"M21 9.662c-2.287.194-5.197 1.038-7 1.794v-1.064c1.933-.721 4.598-1.54 7-1.745v1.015zm0 2.031c-2.287.194-5.197 1.038-7 1.794v-1.064c1.933-.721 4.598-1.54 7-1.745v1.015zm0 2.031c-2.287.194-5.197 1.038-7 1.794v-1.064c1.933-.721 4.598-1.54 7-1.745v1.015zm0 2.031c-2.287.194-5.197 1.038-7 1.794v-1.064c1.933-.721 4.598-1.54 7-1.745v1.015zm0-9.951c-2.402.204-5.068 1.024-7 1.745v1.933c1.804-.756 4.713-1.6 7-1.794v-1.884zm-18 2.843c2.402.205 5.067 1.024 7 1.745v1.064c-1.803-.756-4.713-1.6-7-1.794v-1.015zm0 2.031c2.402.205 5.067 1.024 7 1.745v1.064c-1.803-.756-4.713-1.6-7-1.794v-1.015zm0 2.031c2.402.205 5.067 1.024 7 1.745v1.064c-1.803-.756-4.713-1.6-7-1.794v-1.015zm0 2.032c2.402.205 5.067 1.024 7 1.745v1.064c-1.803-.756-4.713-1.6-7-1.794v-1.015zm0-7.054c2.287.194 5.196 1.038 7 1.794v-1.933c-1.932-.72-4.598-1.54-7-1.744v1.883zm9-2.724c-3.063-1.671-7.776-2.755-12-2.963v17c4.289.206 8.195 1.249 12 3 3.805-1.751 7.711-2.794 12-3v-17c-4.224.208-8.937 1.292-12 2.963zm-10-.791c4.264.496 6.86 1.467 9 2.545v12.702c-2.968-1.184-5.939-1.95-9-2.271v-12.976zm20 12.975c-3.061.321-6.032 1.088-9 2.271v-12.701c2.187-1.103 4.757-2.051 9-2.544v12.974z\";\n ctrl.iconMap[\"Databus\"] = \"m 0.76949155,0.7702454 v 5.24959 l 29.33129045,-10e-4 6.27262,8.8675006 -0.002,32.0824 4.7212,-0.002 V 0.7702354 Z m 18.43511045,8.3952603 -5.68354,0.006 7.1979,10.5484003 -0.004,27.24663 4.70393,-0.002 0.0167,-28.60108 z m -9.4730904,0.002 -8.96510005,0.002 0.004,37.7960503 16.79563045,-0.004 0.001,-26.29103 z m 13.2512904,0 5.59825,8.2188903 -0.0396,29.57614 4.70307,-0.002 0.006,-31.09587 -4.55858,-6.6940403 z\";\n ctrl.iconMap[\"Sparql\"] = \"M383.476,267.343c-2.544-1.346-5.14-2.493-7.743-3.516l1.863-0.15c0,0-16.608-7.354-18.057-60.722 c-1.438-53.372,15.828-62.478,15.828-62.478l-2.48,0.109c13.045-6.69,24.265-17.267,31.669-31.216 c19.295-36.291,5.488-81.362-30.81-100.657C337.436-10.563,292.374,3.207,273.09,39.53c-7.927,14.899-10.178,31.273-7.677,46.733 l-0.851-1.306c0,0,4.373,19.365-41.032,47.55c-45.397,28.2-65.877,14.159-65.877,14.159l1.302,1.925 c-1.298-0.803-2.544-1.624-3.901-2.333c-36.306-19.294-81.38-5.509-100.667,30.804c-19.281,36.309-5.489,81.365,30.813,100.668 c27.064,14.364,58.974,10.36,81.461-7.655l-0.487,0.946c0,0,16.531-13.599,64.16,11.973c37.601,20.178,43.184,39.956,43.899,47.383 c-0.983,27.57,13.388,54.618,39.389,68.433c36.301,19.299,81.374,5.498,100.657-30.804 C433.571,331.704,419.786,286.624,383.476,267.343z M299.542,277.128c-6.018,2.129-23.203,4.487-59.389-14.921 c-39.187-21.04-45.005-38.615-45.855-43.891c0.557-6.401,0.202-12.791-0.891-19.02l0.239,0.359c0,0-3.189-17.096,41.65-44.943 c40.133-24.908,58.376-19.955,61.771-18.653c2.185,1.485,4.45,2.867,6.825,4.131c4.518,2.398,9.174,4.283,13.888,5.672 c5.52,5.257,15.678,20.178,16.733,59.413c1.078,39.535-10.533,54.779-16.865,60.168C311.122,268.399,305.022,272.34,299.542,277.128 z\";\n\n ctrl.$onInit = function() {\n ctrl.class = ctrl.typeMap[ctrl.type];\n ctrl.icon = ctrl.iconMap[ctrl.type];\n ctrl.style = {};\n ctrl.style.width = ctrl.width + \"px\";\n ctrl.style.height = ctrl.height + \"px\";\n ctrl.viewBox = \"0 0 24 24\";\n\n if(ctrl.type == 'Databus') {\n ctrl.viewBox = \"2 0 42 40\";\n }\n\n if(ctrl.type == 'Sparql') {\n ctrl.viewBox = \"40 0 430 420\";\n }\n }\n}\n\nmodule.exports = TypeTagController;\n\n//# sourceURL=webpack://databus-webapp/./js/components/type-tag/type-tag.js?"); +eval("{// hinzufügen eines Controllers zum Modul\nfunction TypeTagController() {\n\n var ctrl = this;\n\n ctrl.typeMap = {};\n ctrl.typeMap[\"Artifact\"] = \"is-artifact\";\n ctrl.typeMap[\"Version\"] = \"is-version\";\n ctrl.typeMap[\"Group\"] = \"is-group\";\n ctrl.typeMap[\"Service\"] = \"is-service\";\n ctrl.typeMap[\"Account\"] = \"is-consumer\";\n ctrl.typeMap[\"Collection\"] = \"is-collection\";\n ctrl.typeMap[\"BlogEntry\"] = \"is-blog\";\n ctrl.typeMap[\"Databus\"] = \"is-version\";\n ctrl.typeMap[\"Sparql\"] = \"is-grey\";\n\n ctrl.iconMap = {};\n ctrl.iconMap[\"Artifact\"] = \"M12,0 L1,12 l11,12 l11,-12 L12,0z\"; \n ctrl.iconMap[\"Version\"] = \"M 14.9 1 L 12.293 1.005 L 16.507 7.18 L 16.5 23.1 L 18.5 23.1 L 18.5 6.4 L 14.9 1 Z M 10.4 1 L 1.581 1.004 L 1.584 23.13 L 15 23.1 L 15 7.7 L 10.4 1 Z M 16.8 1 L 20 5.8 L 20 23.1 L 22 23.1 L 22 4.9 L 19.3 1 L 16.8 1 Z\";\n ctrl.iconMap[\"Group\"] = \"M21.698 10.658l2.302 1.342-12.002 7-11.998-7 2.301-1.342 9.697 5.658 9.7-5.658zm-9.7 10.657l-9.697-5.658-2.301 1.343 11.998 7 12.002-7-2.302-1.342-9.7 5.657zm12.002-14.315l-12.002-7-11.998 7 11.998 7 12.002-7z\";\n ctrl.iconMap[\"Service\"] = \"M24 13.616v-3.232l-2.869-1.02c-.198-.687-.472-1.342-.811-1.955l1.308-2.751-2.285-2.285-2.751 1.307c-.613-.339-1.269-.613-1.955-.811l-1.021-2.869h-3.232l-1.021 2.869c-.686.198-1.342.471-1.955.811l-2.751-1.308-2.285 2.285 1.308 2.752c-.339.613-.614 1.268-.811 1.955l-2.869 1.02v3.232l2.869 1.02c.197.687.472 1.342.811 1.955l-1.308 2.751 2.285 2.286 2.751-1.308c.613.339 1.269.613 1.955.811l1.021 2.869h3.232l1.021-2.869c.687-.198 1.342-.472 1.955-.811l2.751 1.308 2.285-2.286-1.308-2.751c.339-.613.613-1.268.811-1.955l2.869-1.02zm-12 2.384c-2.209 0-4-1.791-4-4s1.791-4 4-4 4 1.791 4 4-1.791 4-4 4z\";\n ctrl.iconMap[\"Account\"] = \"M19 7.001c0 3.865-3.134 7-7 7s-7-3.135-7-7c0-3.867 3.134-7.001 7-7.001s7 3.134 7 7.001zm-1.598 7.18c-1.506 1.137-3.374 1.82-5.402 1.82-2.03 0-3.899-.685-5.407-1.822-4.072 1.793-6.593 7.376-6.593 9.821h24c0-2.423-2.6-8.006-6.598-9.819z\";\n ctrl.iconMap[\"Collection\"] = \"M11.499 12.03v11.971l-10.5-5.603v-11.835l10.5 5.467zm11.501 6.368l-10.501 5.602v-11.968l10.501-5.404v11.77zm-16.889-15.186l10.609 5.524-4.719 2.428-10.473-5.453 4.583-2.499zm16.362 2.563l-4.664 2.4-10.641-5.54 4.831-2.635 10.474 5.775z\";\n ctrl.iconMap[\"BlogEntry\"] = \"M21 9.662c-2.287.194-5.197 1.038-7 1.794v-1.064c1.933-.721 4.598-1.54 7-1.745v1.015zm0 2.031c-2.287.194-5.197 1.038-7 1.794v-1.064c1.933-.721 4.598-1.54 7-1.745v1.015zm0 2.031c-2.287.194-5.197 1.038-7 1.794v-1.064c1.933-.721 4.598-1.54 7-1.745v1.015zm0 2.031c-2.287.194-5.197 1.038-7 1.794v-1.064c1.933-.721 4.598-1.54 7-1.745v1.015zm0-9.951c-2.402.204-5.068 1.024-7 1.745v1.933c1.804-.756 4.713-1.6 7-1.794v-1.884zm-18 2.843c2.402.205 5.067 1.024 7 1.745v1.064c-1.803-.756-4.713-1.6-7-1.794v-1.015zm0 2.031c2.402.205 5.067 1.024 7 1.745v1.064c-1.803-.756-4.713-1.6-7-1.794v-1.015zm0 2.031c2.402.205 5.067 1.024 7 1.745v1.064c-1.803-.756-4.713-1.6-7-1.794v-1.015zm0 2.032c2.402.205 5.067 1.024 7 1.745v1.064c-1.803-.756-4.713-1.6-7-1.794v-1.015zm0-7.054c2.287.194 5.196 1.038 7 1.794v-1.933c-1.932-.72-4.598-1.54-7-1.744v1.883zm9-2.724c-3.063-1.671-7.776-2.755-12-2.963v17c4.289.206 8.195 1.249 12 3 3.805-1.751 7.711-2.794 12-3v-17c-4.224.208-8.937 1.292-12 2.963zm-10-.791c4.264.496 6.86 1.467 9 2.545v12.702c-2.968-1.184-5.939-1.95-9-2.271v-12.976zm20 12.975c-3.061.321-6.032 1.088-9 2.271v-12.701c2.187-1.103 4.757-2.051 9-2.544v12.974z\";\n ctrl.iconMap[\"Databus\"] = \"m 0.76949155,0.7702454 v 5.24959 l 29.33129045,-10e-4 6.27262,8.8675006 -0.002,32.0824 4.7212,-0.002 V 0.7702354 Z m 18.43511045,8.3952603 -5.68354,0.006 7.1979,10.5484003 -0.004,27.24663 4.70393,-0.002 0.0167,-28.60108 z m -9.4730904,0.002 -8.96510005,0.002 0.004,37.7960503 16.79563045,-0.004 0.001,-26.29103 z m 13.2512904,0 5.59825,8.2188903 -0.0396,29.57614 4.70307,-0.002 0.006,-31.09587 -4.55858,-6.6940403 z\";\n ctrl.iconMap[\"Sparql\"] = \"M383.476,267.343c-2.544-1.346-5.14-2.493-7.743-3.516l1.863-0.15c0,0-16.608-7.354-18.057-60.722 c-1.438-53.372,15.828-62.478,15.828-62.478l-2.48,0.109c13.045-6.69,24.265-17.267,31.669-31.216 c19.295-36.291,5.488-81.362-30.81-100.657C337.436-10.563,292.374,3.207,273.09,39.53c-7.927,14.899-10.178,31.273-7.677,46.733 l-0.851-1.306c0,0,4.373,19.365-41.032,47.55c-45.397,28.2-65.877,14.159-65.877,14.159l1.302,1.925 c-1.298-0.803-2.544-1.624-3.901-2.333c-36.306-19.294-81.38-5.509-100.667,30.804c-19.281,36.309-5.489,81.365,30.813,100.668 c27.064,14.364,58.974,10.36,81.461-7.655l-0.487,0.946c0,0,16.531-13.599,64.16,11.973c37.601,20.178,43.184,39.956,43.899,47.383 c-0.983,27.57,13.388,54.618,39.389,68.433c36.301,19.299,81.374,5.498,100.657-30.804 C433.571,331.704,419.786,286.624,383.476,267.343z M299.542,277.128c-6.018,2.129-23.203,4.487-59.389-14.921 c-39.187-21.04-45.005-38.615-45.855-43.891c0.557-6.401,0.202-12.791-0.891-19.02l0.239,0.359c0,0-3.189-17.096,41.65-44.943 c40.133-24.908,58.376-19.955,61.771-18.653c2.185,1.485,4.45,2.867,6.825,4.131c4.518,2.398,9.174,4.283,13.888,5.672 c5.52,5.257,15.678,20.178,16.733,59.413c1.078,39.535-10.533,54.779-16.865,60.168C311.122,268.399,305.022,272.34,299.542,277.128 z\";\n\n ctrl.$onInit = function() {\n ctrl.class = ctrl.typeMap[ctrl.type];\n ctrl.icon = ctrl.iconMap[ctrl.type];\n ctrl.style = {};\n ctrl.style.width = ctrl.width + \"px\";\n ctrl.style.height = ctrl.height + \"px\";\n ctrl.viewBox = \"0 0 24 24\";\n\n if(ctrl.type == 'Databus') {\n ctrl.viewBox = \"2 0 42 40\";\n }\n\n if(ctrl.type == 'Sparql') {\n ctrl.viewBox = \"40 0 430 420\";\n }\n }\n}\n\nmodule.exports = TypeTagController;\n\n//# sourceURL=webpack://databus-webapp/./js/components/type-tag/type-tag.js?\n}"); -/***/ }), +/***/ }, -/***/ "./js/components/uri-breadcrumbs/uri-breadcrumbs.js": +/***/ "./js/components/uri-breadcrumbs/uri-breadcrumbs.js" /*!**********************************************************!*\ !*** ./js/components/uri-breadcrumbs/uri-breadcrumbs.js ***! \**********************************************************/ -/***/ ((module) => { +(module) { -eval("// hinzufügen eines Controllers zum Modul\n// TODO update base\nfunction UriBreadcrumbsController() {\n\n var ctrl = this;\n\n ctrl.$onInit = function() {\n\n ctrl.entries = [];\n\n var uri = ctrl.uri;\n\n if(uri == undefined || uri == null) {\n return;\n }\n\n var url = new URL(uri);\n\n var extensions = url.pathname.split('/');\n var pathSoFar = '';\n\n if(ctrl.absolute == true) {\n pathSoFar = url.origin;\n }\n\n for(var e in extensions) {\n var extension = extensions[e];\n\n if(extension == '') {\n continue;\n }\n\n pathSoFar += \"/\" + extension;\n\n ctrl.entries.push({\n label: extension,\n uri: pathSoFar\n });\n }\n }\n}\n\nmodule.exports = UriBreadcrumbsController;\n\n\n\n//# sourceURL=webpack://databus-webapp/./js/components/uri-breadcrumbs/uri-breadcrumbs.js?"); +eval("{// hinzufügen eines Controllers zum Modul\n// TODO update base\nfunction UriBreadcrumbsController() {\n\n var ctrl = this;\n\n ctrl.$onInit = function() {\n\n ctrl.entries = [];\n\n var uri = ctrl.uri;\n\n if(uri == undefined || uri == null) {\n return;\n }\n\n var url = new URL(uri);\n\n var extensions = url.pathname.split('/');\n var pathSoFar = '';\n\n if(ctrl.absolute == true) {\n pathSoFar = url.origin;\n }\n\n for(var e in extensions) {\n var extension = extensions[e];\n\n if(extension == '') {\n continue;\n }\n\n pathSoFar += \"/\" + extension;\n\n ctrl.entries.push({\n label: extension,\n uri: pathSoFar\n });\n }\n }\n}\n\nmodule.exports = UriBreadcrumbsController;\n\n\n\n//# sourceURL=webpack://databus-webapp/./js/components/uri-breadcrumbs/uri-breadcrumbs.js?\n}"); -/***/ }), +/***/ }, -/***/ "./js/components/yasqe-text/yasqe-text.js": +/***/ "./js/components/yasqe-text/yasqe-text.js" /*!************************************************!*\ !*** ./js/components/yasqe-text/yasqe-text.js ***! \************************************************/ -/***/ ((module) => { +(module) { -eval("function YasqeTextController($scope, $element) {\n\n var ctrl = this;\n\n ctrl.textField = $element.find('#custom-query');\n ctrl.$scope = $scope;\n\n ctrl.$onInit = function () {\n\n ctrl.yasqe = new Yasqe(ctrl.textField[0], {\n lineNumbers: true,\n viewportMargin: Infinity,\n readOnly: ctrl.readOnly,\n autorefresh: true\n });\n\n if (ctrl.autoSize || !ctrl.hasSend) {\n var styleSheet = document.createElement(\"style\")\n styleSheet.innerText = \"\";\n\n if (ctrl.autoSize) {\n styleSheet.innerText += \".CodeMirror { height: auto !important; } .CodeMirror-vscrollbar { display: none !important; } .resizeWrapper { display: none !important; }\";\n }\n\n if (!ctrl.hasSend) {\n styleSheet.innerText += \".yasqe_buttons { display: none !important; }\";\n }\n\n ctrl.textField[0].appendChild(styleSheet)\n }\n\n ctrl.yasqe.on('query', function() {\n ctrl.onSend();\n });\n\n ctrl.yasqe.on('change', function () {\n ctrl.query = ctrl.yasqe.getValue();\n ctrl.valid = !ctrl.yasqe.queryValid;\n\n if (!$scope.$root.$$phase) {\n ctrl.$scope.$apply();\n }\n\n ctrl.onChange();\n });\n\n if (ctrl.query != undefined) {\n ctrl.yasqe.setValue(ctrl.query);\n }\n }\n\n ctrl.$doCheck = function () {\n if (ctrl.yasqe != undefined && ctrl.yasqe.getValue() != ctrl.query) {\n if (ctrl.query != undefined) {\n ctrl.yasqe.setValue(ctrl.query);\n }\n }\n\n setTimeout(function () {\n ctrl.yasqe.refresh();\n }, 10);\n\n }\n}\n\nmodule.exports = YasqeTextController;\n\n//# sourceURL=webpack://databus-webapp/./js/components/yasqe-text/yasqe-text.js?"); +eval("{function YasqeTextController($scope, $element) {\n\n var ctrl = this;\n\n ctrl.textField = $element.find('#custom-query');\n ctrl.$scope = $scope;\n\n ctrl.$onInit = function () {\n\n ctrl.yasqe = new Yasqe(ctrl.textField[0], {\n lineNumbers: true,\n viewportMargin: Infinity,\n readOnly: ctrl.readOnly,\n autorefresh: true\n });\n\n if (ctrl.autoSize || !ctrl.hasSend) {\n var styleSheet = document.createElement(\"style\")\n styleSheet.innerText = \"\";\n\n if (ctrl.autoSize) {\n styleSheet.innerText += \".CodeMirror { height: auto !important; } .CodeMirror-vscrollbar { display: none !important; } .resizeWrapper { display: none !important; }\";\n }\n\n if (!ctrl.hasSend) {\n styleSheet.innerText += \".yasqe_buttons { display: none !important; }\";\n }\n\n ctrl.textField[0].appendChild(styleSheet)\n }\n\n ctrl.yasqe.on('query', function() {\n ctrl.onSend();\n });\n\n ctrl.yasqe.on('change', function () {\n ctrl.query = ctrl.yasqe.getValue();\n ctrl.valid = !ctrl.yasqe.queryValid;\n\n if (!$scope.$root.$$phase) {\n ctrl.$scope.$apply();\n }\n\n ctrl.onChange();\n });\n\n if (ctrl.query != undefined) {\n ctrl.yasqe.setValue(ctrl.query);\n }\n }\n\n ctrl.$doCheck = function () {\n if (ctrl.yasqe != undefined && ctrl.yasqe.getValue() != ctrl.query) {\n if (ctrl.query != undefined) {\n ctrl.yasqe.setValue(ctrl.query);\n }\n }\n\n setTimeout(function () {\n ctrl.yasqe.refresh();\n }, 10);\n\n }\n}\n\nmodule.exports = YasqeTextController;\n\n//# sourceURL=webpack://databus-webapp/./js/components/yasqe-text/yasqe-text.js?\n}"); -/***/ }), +/***/ }, -/***/ "./js/components/yasr-view/yasr-view.js": +/***/ "./js/components/yasr-view/yasr-view.js" /*!**********************************************!*\ !*** ./js/components/yasr-view/yasr-view.js ***! \**********************************************/ -/***/ ((module) => { +(module) { -eval("function YasrViewController($scope, $element) {\n\n var ctrl = this;\n\n ctrl.textField = $element.find('#custom-query');\n ctrl.$scope = $scope;\n\n ctrl.$onInit = function () {\n\n\n ctrl.yasr = new Yasr(ctrl.textField[0], {\n //lineNumbers: true,\n //viewportMargin: Infinity,\n //readOnly: ctrl.readOnly,\n //autorefresh: true\n prefixes : {\n rdf: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',\n rdfs: 'http://www.w3.org/2000/01/rdf-schema#',\n dct: 'http://purl.org/dc/terms/',\n dcat: 'http://www.w3.org/ns/dcat#',\n databus: 'https://dataid.dbpedia.org/databus#',\n sec: 'https://w3id.org/security#',\n cert: 'http://www.w3.org/ns/auth/cert#',\n foaf: 'http://xmlns.com/foaf/0.1/',\n dbo: 'http://dbpedia.org/ontology/',\n \"databus-cv\": 'https://dataid.dbpedia.org/databus-cv#'\n }\n\n });\n\n \n\n\n /*\n if(ctrl.autoSize) {\n\n var styleSheet = document.createElement(\"style\")\n styleSheet.innerText = \".CodeMirror { height: auto !important; } .CodeMirror-vscrollbar { display: none !important; } .resizeWrapper { display: none !important; }\";\n ctrl.textField[0].appendChild(styleSheet)\n }\n\n ctrl.yasr.on('change', function() {\n ctrl.query = ctrl.yasqe.getValue();\n ctrl.valid = !ctrl.yasqe.queryValid;\n\n if(!$scope.$root.$$phase) {\n ctrl.$scope.$apply();\n }\n\n ctrl.onChange();\n });\n\n ctrl.yasqe.setValue(ctrl.query);*/\n }\n\n\n ctrl.$doCheck = function () {\n var dataString = JSON.stringify(ctrl.data);\n if (ctrl.yasr != undefined && dataString != ctrl.currentDataString) {\n ctrl.yasr.setResponse(ctrl.data)\n ctrl.currentDataString = dataString;\n }\n\n\n /*\n setTimeout(function() {\n ctrl.yasqe.refresh();\n }, 10);*/\n }\n}\n\nmodule.exports = YasrViewController;\n\n//# sourceURL=webpack://databus-webapp/./js/components/yasr-view/yasr-view.js?"); +eval("{function YasrViewController($scope, $element) {\n\n var ctrl = this;\n\n ctrl.textField = $element.find('#custom-query');\n ctrl.$scope = $scope;\n\n ctrl.$onInit = function () {\n\n\n ctrl.yasr = new Yasr(ctrl.textField[0], {\n //lineNumbers: true,\n //viewportMargin: Infinity,\n //readOnly: ctrl.readOnly,\n //autorefresh: true\n prefixes : {\n rdf: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',\n rdfs: 'http://www.w3.org/2000/01/rdf-schema#',\n dct: 'http://purl.org/dc/terms/',\n dcat: 'http://www.w3.org/ns/dcat#',\n databus: 'https://dataid.dbpedia.org/databus#',\n sec: 'https://w3id.org/security#',\n cert: 'http://www.w3.org/ns/auth/cert#',\n foaf: 'http://xmlns.com/foaf/0.1/',\n dbo: 'http://dbpedia.org/ontology/',\n \"databus-cv\": 'https://dataid.dbpedia.org/databus-cv#'\n }\n\n });\n\n \n\n\n /*\n if(ctrl.autoSize) {\n\n var styleSheet = document.createElement(\"style\")\n styleSheet.innerText = \".CodeMirror { height: auto !important; } .CodeMirror-vscrollbar { display: none !important; } .resizeWrapper { display: none !important; }\";\n ctrl.textField[0].appendChild(styleSheet)\n }\n\n ctrl.yasr.on('change', function() {\n ctrl.query = ctrl.yasqe.getValue();\n ctrl.valid = !ctrl.yasqe.queryValid;\n\n if(!$scope.$root.$$phase) {\n ctrl.$scope.$apply();\n }\n\n ctrl.onChange();\n });\n\n ctrl.yasqe.setValue(ctrl.query);*/\n }\n\n\n ctrl.$doCheck = function () {\n var dataString = JSON.stringify(ctrl.data);\n if (ctrl.yasr != undefined && dataString != ctrl.currentDataString) {\n ctrl.yasr.setResponse(ctrl.data)\n ctrl.currentDataString = dataString;\n }\n\n\n /*\n setTimeout(function() {\n ctrl.yasqe.refresh();\n }, 10);*/\n }\n}\n\nmodule.exports = YasrViewController;\n\n//# sourceURL=webpack://databus-webapp/./js/components/yasr-view/yasr-view.js?\n}"); -/***/ }), +/***/ }, -/***/ "./js/page-controller/account-controller.js": +/***/ "./js/page-controller/account-controller.js" /*!**************************************************!*\ !*** ./js/page-controller/account-controller.js ***! \**************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +(module, __unused_webpack_exports, __webpack_require__) { -eval("const DatabusCollectionManager = __webpack_require__(/*! ../collections/databus-collection-manager */ \"./js/collections/databus-collection-manager.js\");\nconst DatabusUtils = __webpack_require__(/*! ../utils/databus-utils */ \"./js/utils/databus-utils.js\");\nconst DatabusWebappUtils = __webpack_require__(/*! ../utils/databus-webapp-utils */ \"./js/utils/databus-webapp-utils.js\");\nconst TabNavigation = __webpack_require__(/*! ../utils/tab-navigation */ \"./js/utils/tab-navigation.js\");\n\nvar DEFAULT_IMAGE = \"https://picsum.photos/id/223/320/320\";\n\n// Controller for the header section\n\n/**\n * \n * @param {*} $scope \n * @param {*} $http \n * @param {*} $location \n * @param {DatabusCollectionManager} collectionManager \n * @returns \n */\nfunction AccountPageController($scope, $http, $location, collectionManager) {\n\n $scope.collectionManager = collectionManager;\n\n\n // Pick up the profile data\n $scope.auth = data.auth;\n $scope.location = $location;\n $scope.account = data.account;\n\n // Exit if there is no profile\n if ($scope.account == undefined) {\n return;\n }\n\n\n // Create a tab navigation object for the tab navigation with locato\n $scope.tabNavigation = new TabNavigation($scope, $location, [\n 'data', 'collections', 'settings'\n ]);\n\n // Make some util functions available in the template\n $scope.utils = new DatabusWebappUtils($scope);\n $scope.accountName = $scope.utils.getAccountName();\n $scope.account.isOwn = $scope.accountName != null; //.auth.authenticated && $scope.auth.info.accountName == $scope.account.accountName;\n\n\n $scope.dataSearchInput = '';\n $scope.dataSearchSettings = {\n minRelevance: 0.01,\n maxResults: 10,\n placeholder: `Search ${$scope.account.accountName}'s data...`,\n resourceTypes: ['Group', 'Artifact'],\n filter: `&publisher=${$scope.account.accountName}&typeNameWeight=0`\n };\n\n $scope.collectionSearchInput = '';\n $scope.collectionSearchSettings = {\n minRelevance: 0.01,\n maxResults: 10,\n placeholder: `Search ${$scope.account.accountName}'s collections...`,\n resourceTypes: ['Collection'],\n filter: `&publisher=${$scope.account.accountName}&publisherWeight=0&typeNameWeight=0`\n };\n\n\n // Wait for additional artifact data to arrive\n $scope.publishedData = {};\n $scope.publishedData.isLoading = true;\n\n $http.get(`/app/account/content?account=${encodeURIComponent($scope.account.accountName)}`)\n .then(function (response) {\n\n $scope.publishedData.isLoading = false;\n $scope.publishedData.groups = response.data.groups;\n $scope.publishedData.artifacts = response.data.artifacts;\n\n for (var artifact of $scope.publishedData.artifacts) {\n artifact.group = DatabusUtils.navigateUp(artifact.uri, 1);\n artifact.title = DatabusUtils.stringOrFallback(artifact.title, artifact.latestVersionTitle);\n artifact.abstract = DatabusUtils.stringOrFallback(artifact.abstract, artifact.latestVersionAbstract);\n artifact.description = DatabusUtils.stringOrFallback(artifact.description, artifact.latestVersionDescription);\n }\n\n for (var group of $scope.publishedData.groups) {\n group.artifacts = $scope.publishedData.artifacts.filter(function (a) {\n return a.group == group.uri;\n });\n }\n\n // Order by latest version date\n $scope.recentUploads = $scope.publishedData.artifacts.filter(function (v) {\n return v.latestVersionDate != null;\n });\n $scope.recentUploads.sort(function (a, b) {\n return new Date(b.latestVersionDate) - new Date(a.latestVersionDate);\n });\n\n $scope.recentUploads = $scope.recentUploads.slice(0, 3);\n\n $scope.refreshFeaturedContent();\n }, function (err) {\n console.log(err);\n });\n\n\n // Wait for stats data to arrive\n $scope.statsData = {};\n $scope.statsData.isLoading = true;\n\n $http.get(`/app/account/stats?account=${encodeURIComponent($scope.account.accountName)}`).then(function (response) {\n $scope.statsData.stats = response.data;\n $scope.statsData.isLoading = false;\n }, function (err) {\n console.log(err);\n });\n\n // Wait for activity chart data to arrive\n $scope.activityData = {};\n $scope.activityData.isLoading = true;\n\n $http.get(`/app/account/activity?account=${encodeURIComponent($scope.account.accountName)}`).then(function (response) {\n $scope.activityData.entries = response.data;\n $scope.activityData.isLoading = false;\n }, function (err) {\n console.log(err);\n });\n\n $scope.collectionsData = {};\n $scope.collectionsData.isLoading = true;\n\n if (!$scope.account.isOwn) {\n $http.get(`/app/account/collections?account=${encodeURIComponent($scope.account.accountName)}`)\n .then(function (response) {\n\n $scope.collectionsData.collections = response.data;\n $scope.collectionsData.isLoading = false;\n $scope.refreshFeaturedContent();\n }, function (err) {\n console.log(err);\n });\n } else {\n\n function onCollectionManagerInitialized() {\n for (let guid in $scope.collectionManager.local) {\n let collection = $scope.collectionManager.local[guid];\n\n if(collection.accountName == undefined && collection.uri != undefined) {\n collection.accountName = DatabusUtils.getFirstSegment(collection.uri);\n }\n\n if (collection.accountName == $scope.accountName) {\n $scope.collectionList.push(collection);\n }\n }\n }\n\n $scope.collectionList = [];\n\n if(collectionManager.isInitialized) {\n onCollectionManagerInitialized();\n } else {\n collectionManager.subscribeOnInitialized(onCollectionManagerInitialized);\n }\n }\n\n\n\n $scope.getImageUrl = function () {\n if ($scope.account.imageUrl == undefined) {\n return DEFAULT_IMAGE;\n } else {\n return $scope.account.imageUrl;\n }\n }\n\n /**\n * COLLECTION FUNCTIONS \n */\n\n // Collection List Search\n $scope.collectionSearch = {};\n $scope.collectionSearch.sortVisible = false;\n $scope.collectionSearch.sortProperty = 'title';\n $scope.collectionSearch.sortProperties = [\n { key: 'title', label: 'Title' },\n { key: 'issued', label: 'Issued Date' },\n ];\n $scope.collectionSearch.sortReverse = false;\n $scope.collectionSearch.toggleSort = function (value) {\n if ($scope.collectionSearch.sortProperty == value) {\n $scope.collectionSearch.sortReverse = !$scope.collectionSearch.sortReverse;\n } else {\n $scope.collectionSearch.sortProperty = value;\n }\n }\n\n /**\n * Pencil icon for edit pressed\n * @param {*} collection \n */\n $scope.onEditCollectionClicked = function (collection) {\n $scope.collectionManager.setActive(collection.uuid);\n window.location.href = `/app/collection-editor?uuid=${collection.uuid}`;\n }\n\n /**\n * Create new collection\n */\n $scope.createNewCollection = function () {\n $scope.collectionManager.createNew($scope.accountName, 'New Collection', 'Replace this description with a description of your choice.',\n function (collection) {\n window.location.href = `/app/collection-editor?uuid=${collection.uuid}`;\n });\n }\n\n /**\n * Create a copy of the clicked collection\n */\n $scope.createCopy = function (collection) {\n let copy = $scope.collectionManager.createCopy(collection);\n window.location.href = `/app/collection-editor?uuid=${copy.uuid}`;\n }\n\n\n $scope.findFeaturedContent = function (uri) {\n\n for (var g in $scope.publishedData.groups) {\n var group = $scope.publishedData.groups[g];\n\n if (uri == group.uri) {\n return {\n type: 'Group',\n title: group.title,\n uri: uri,\n description: group.description\n }\n }\n\n for (var a in group.artifacts) {\n var artifact = group.artifacts[a];\n\n if (uri == artifact.artifactUri) {\n return {\n type: 'Artifact',\n title: artifact.title,\n uri: uri,\n description: artifact.description\n }\n }\n }\n }\n\n for (var c in $scope.collectionsData.collections) {\n var collection = $scope.collectionsData.collections[c];\n\n if (uri == collection.uri) {\n return {\n type: 'Collection',\n title: collection.title,\n uri: uri,\n description: collection.description\n }\n }\n }\n\n }\n\n $scope.refreshFeaturedContent = function () {\n if ($scope.account.featuredContent == undefined) {\n return;\n }\n\n var featuredContentUris = $scope.account.featuredContent.split('\\n');\n $scope.featuredContent = [];\n\n for (var f in featuredContentUris) {\n var content = $scope.findFeaturedContent(featuredContentUris[f]);\n\n if (content != undefined) {\n $scope.featuredContent.push(content);\n }\n }\n }\n\n /** ACCOUNT MANAGEMENT FOR OWNER */\n\n}\n\nmodule.exports = AccountPageController;\n\n//# sourceURL=webpack://databus-webapp/./js/page-controller/account-controller.js?"); +eval("{const DatabusCollectionManager = __webpack_require__(/*! ../collections/databus-collection-manager */ \"./js/collections/databus-collection-manager.js\");\nconst DatabusUtils = __webpack_require__(/*! ../utils/databus-utils */ \"./js/utils/databus-utils.js\");\nconst DatabusWebappUtils = __webpack_require__(/*! ../utils/databus-webapp-utils */ \"./js/utils/databus-webapp-utils.js\");\nconst TabNavigation = __webpack_require__(/*! ../utils/tab-navigation */ \"./js/utils/tab-navigation.js\");\n\nvar DEFAULT_IMAGE = \"https://picsum.photos/id/223/320/320\";\n\n// Controller for the header section\n\n/**\n * \n * @param {*} $scope \n * @param {*} $http \n * @param {*} $location \n * @param {DatabusCollectionManager} collectionManager \n * @returns \n */\nfunction AccountPageController($scope, $http, $location, collectionManager) {\n\n $scope.collectionManager = collectionManager;\n\n\n // Pick up the profile data\n $scope.auth = data.auth;\n $scope.location = $location;\n $scope.account = data.account;\n\n // Exit if there is no profile\n if ($scope.account == undefined) {\n return;\n }\n\n\n // Create a tab navigation object for the tab navigation with locato\n $scope.tabNavigation = new TabNavigation($scope, $location, [\n 'data', 'collections', 'settings'\n ]);\n\n // Make some util functions available in the template\n $scope.utils = new DatabusWebappUtils($scope);\n $scope.accountName = $scope.utils.getAccountName();\n $scope.account.isOwn = $scope.accountName != null; //.auth.authenticated && $scope.auth.info.accountName == $scope.account.accountName;\n\n\n $scope.dataSearchInput = '';\n $scope.dataSearchSettings = {\n minRelevance: 0.01,\n maxResults: 10,\n placeholder: `Search ${$scope.account.accountName}'s data...`,\n resourceTypes: ['Group', 'Artifact'],\n filter: `&publisher=${$scope.account.accountName}&typeNameWeight=0`\n };\n\n $scope.collectionSearchInput = '';\n $scope.collectionSearchSettings = {\n minRelevance: 0.01,\n maxResults: 10,\n placeholder: `Search ${$scope.account.accountName}'s collections...`,\n resourceTypes: ['Collection'],\n filter: `&publisher=${$scope.account.accountName}&publisherWeight=0&typeNameWeight=0`\n };\n\n\n // Wait for additional artifact data to arrive\n $scope.publishedData = {};\n $scope.publishedData.isLoading = true;\n\n $http.get(`/app/account/content?account=${encodeURIComponent($scope.account.accountName)}`)\n .then(function (response) {\n\n $scope.publishedData.isLoading = false;\n $scope.publishedData.groups = response.data.groups;\n $scope.publishedData.artifacts = response.data.artifacts;\n\n for (var artifact of $scope.publishedData.artifacts) {\n artifact.group = DatabusUtils.navigateUp(artifact.uri, 1);\n artifact.title = DatabusUtils.stringOrFallback(artifact.title, artifact.latestVersionTitle);\n artifact.abstract = DatabusUtils.stringOrFallback(artifact.abstract, artifact.latestVersionAbstract);\n artifact.description = DatabusUtils.stringOrFallback(artifact.description, artifact.latestVersionDescription);\n }\n\n for (var group of $scope.publishedData.groups) {\n group.artifacts = $scope.publishedData.artifacts.filter(function (a) {\n return a.group == group.uri;\n });\n }\n\n // Order by latest version date\n $scope.recentUploads = $scope.publishedData.artifacts.filter(function (v) {\n return v.latestVersionDate != null;\n });\n $scope.recentUploads.sort(function (a, b) {\n return new Date(b.latestVersionDate) - new Date(a.latestVersionDate);\n });\n\n $scope.recentUploads = $scope.recentUploads.slice(0, 3);\n\n $scope.refreshFeaturedContent();\n }, function (err) {\n console.log(err);\n });\n\n\n // Wait for stats data to arrive\n $scope.statsData = {};\n $scope.statsData.isLoading = true;\n\n $http.get(`/app/account/stats?account=${encodeURIComponent($scope.account.accountName)}`).then(function (response) {\n $scope.statsData.stats = response.data;\n $scope.statsData.isLoading = false;\n }, function (err) {\n console.log(err);\n });\n\n // Wait for activity chart data to arrive\n $scope.activityData = {};\n $scope.activityData.isLoading = true;\n\n $http.get(`/app/account/activity?account=${encodeURIComponent($scope.account.accountName)}`).then(function (response) {\n $scope.activityData.entries = response.data;\n $scope.activityData.isLoading = false;\n }, function (err) {\n console.log(err);\n });\n\n $scope.collectionsData = {};\n $scope.collectionsData.isLoading = true;\n\n if (!$scope.account.isOwn) {\n $http.get(`/app/account/collections?account=${encodeURIComponent($scope.account.accountName)}`)\n .then(function (response) {\n\n $scope.collectionsData.collections = response.data;\n $scope.collectionsData.isLoading = false;\n $scope.refreshFeaturedContent();\n }, function (err) {\n console.log(err);\n });\n } else {\n\n function onCollectionManagerInitialized() {\n for (let guid in $scope.collectionManager.local) {\n let collection = $scope.collectionManager.local[guid];\n\n if(collection.accountName == undefined && collection.uri != undefined) {\n collection.accountName = DatabusUtils.getFirstSegment(collection.uri);\n }\n\n if (collection.accountName == $scope.accountName) {\n $scope.collectionList.push(collection);\n }\n }\n }\n\n $scope.collectionList = [];\n\n if(collectionManager.isInitialized) {\n onCollectionManagerInitialized();\n } else {\n collectionManager.subscribeOnInitialized(onCollectionManagerInitialized);\n }\n }\n\n\n\n $scope.getImageUrl = function () {\n if ($scope.account.imageUrl == undefined) {\n return DEFAULT_IMAGE;\n } else {\n return $scope.account.imageUrl;\n }\n }\n\n /**\n * COLLECTION FUNCTIONS \n */\n\n // Collection List Search\n $scope.collectionSearch = {};\n $scope.collectionSearch.sortVisible = false;\n $scope.collectionSearch.sortProperty = 'title';\n $scope.collectionSearch.sortProperties = [\n { key: 'title', label: 'Title' },\n { key: 'issued', label: 'Issued Date' },\n ];\n $scope.collectionSearch.sortReverse = false;\n $scope.collectionSearch.toggleSort = function (value) {\n if ($scope.collectionSearch.sortProperty == value) {\n $scope.collectionSearch.sortReverse = !$scope.collectionSearch.sortReverse;\n } else {\n $scope.collectionSearch.sortProperty = value;\n }\n }\n\n /**\n * Pencil icon for edit pressed\n * @param {*} collection \n */\n $scope.onEditCollectionClicked = function (collection) {\n $scope.collectionManager.setActive(collection.uuid);\n window.location.href = `/app/collection-editor?uuid=${collection.uuid}`;\n }\n\n /**\n * Create new collection\n */\n $scope.createNewCollection = function () {\n $scope.collectionManager.createNew($scope.accountName, 'New Collection', 'Replace this description with a description of your choice.',\n function (collection) {\n window.location.href = `/app/collection-editor?uuid=${collection.uuid}`;\n });\n }\n\n /**\n * Create a copy of the clicked collection\n */\n $scope.createCopy = function (collection) {\n let copy = $scope.collectionManager.createCopy(collection);\n window.location.href = `/app/collection-editor?uuid=${copy.uuid}`;\n }\n\n\n $scope.findFeaturedContent = function (uri) {\n\n for (var g in $scope.publishedData.groups) {\n var group = $scope.publishedData.groups[g];\n\n if (uri == group.uri) {\n return {\n type: 'Group',\n title: group.title,\n uri: uri,\n description: group.description\n }\n }\n\n for (var a in group.artifacts) {\n var artifact = group.artifacts[a];\n\n if (uri == artifact.artifactUri) {\n return {\n type: 'Artifact',\n title: artifact.title,\n uri: uri,\n description: artifact.description\n }\n }\n }\n }\n\n for (var c in $scope.collectionsData.collections) {\n var collection = $scope.collectionsData.collections[c];\n\n if (uri == collection.uri) {\n return {\n type: 'Collection',\n title: collection.title,\n uri: uri,\n description: collection.description\n }\n }\n }\n\n }\n\n $scope.refreshFeaturedContent = function () {\n if ($scope.account.featuredContent == undefined) {\n return;\n }\n\n var featuredContentUris = $scope.account.featuredContent.split('\\n');\n $scope.featuredContent = [];\n\n for (var f in featuredContentUris) {\n var content = $scope.findFeaturedContent(featuredContentUris[f]);\n\n if (content != undefined) {\n $scope.featuredContent.push(content);\n }\n }\n }\n\n /** ACCOUNT MANAGEMENT FOR OWNER */\n\n}\n\nmodule.exports = AccountPageController;\n\n//# sourceURL=webpack://databus-webapp/./js/page-controller/account-controller.js?\n}"); -/***/ }), +/***/ }, -/***/ "./js/page-controller/artifact-controller.js": +/***/ "./js/page-controller/artifact-controller.js" /*!***************************************************!*\ !*** ./js/page-controller/artifact-controller.js ***! \***************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +(module, __unused_webpack_exports, __webpack_require__) { -eval("const DatabusCollectionWrapper = __webpack_require__(/*! ../collections/databus-collection-wrapper */ \"./js/collections/databus-collection-wrapper.js\");\nconst DatabusAlert = __webpack_require__(/*! ../components/databus-alert/databus-alert */ \"./js/components/databus-alert/databus-alert.js\");\nconst DataIdCreator = __webpack_require__(/*! ../publish/dataid-creator */ \"./js/publish/dataid-creator.js\");\nconst QueryBuilder = __webpack_require__(/*! ../query-builder/query-builder */ \"./js/query-builder/query-builder.js\");\nconst QueryNode = __webpack_require__(/*! ../query-builder/query-node */ \"./js/query-builder/query-node.js\");\nconst QueryTemplates = __webpack_require__(/*! ../query-builder/query-templates */ \"./js/query-builder/query-templates.js\");\nconst DatabusUtils = __webpack_require__(/*! ../utils/databus-utils */ \"./js/utils/databus-utils.js\");\nconst DatabusWebappUtils = __webpack_require__(/*! ../utils/databus-webapp-utils */ \"./js/utils/databus-webapp-utils.js\");\nconst TabNavigation = __webpack_require__(/*! ../utils/tab-navigation */ \"./js/utils/tab-navigation.js\");\n\n// hinzufügen eines Controllers zum Modul\nfunction ArtifactPageController($scope, $http, $sce, $location, collectionManager) {\n\n $scope.collectionManager = collectionManager;\n $scope.authenticated = data.auth.authenticated;\n $scope.auth = data.auth;\n $scope.utils = new DatabusWebappUtils($scope, $sce);\n $scope.accountName = $scope.utils.getAccountName();\n\n $scope.tabNavigation = new TabNavigation($scope, $location, [\n 'files', 'versions', 'edit'\n ]);\n\n $scope.versions = data.versions;\n $scope.artifact = data.artifact;\n $scope.canEdit = $scope.accountName != null;\n $scope.pageTitle = DatabusUtils.stringOrFallback($scope.artifact.title,\n DatabusUtils.uriToTitle($scope.artifact.uri));\n\n if (data.auth.authenticated && $scope.canEdit) {\n\n $scope.formData = {};\n $scope.formData.group = {};\n $scope.formData.group.name = DatabusUtils.uriToName(DatabusUtils.navigateUp($scope.artifact.uri));\n $scope.formData.artifact = {};\n\n var abstract = DatabusUtils.createAbstractFromDescription($scope.artifact.description);\n $scope.formData.artifact.generateAbstract = abstract == $scope.artifact.abstract;\n $scope.formData.artifact.name = $scope.artifact.name;\n $scope.formData.artifact.title = $scope.artifact.title;\n $scope.formData.artifact.abstract = $scope.artifact.abstract;\n $scope.formData.artifact.description = $scope.artifact.description;\n\n $scope.dataidCreator = new DataIdCreator($scope.formData, $scope.accountName);\n }\n\n $scope.fileSelector = {};\n $scope.fileSelector.config = {};\n $scope.fileSelector.config.authenticated = $scope.authenticated;\n $scope.fileSelector.config.columns = [];\n $scope.fileSelector.config.columns.push({ field: 'version', label: 'Version', width: '30%' });\n $scope.fileSelector.config.columns.push({ field: 'variant', label: 'Variant', width: '30%' });\n $scope.fileSelector.config.columns.push({ field: 'format', label: 'Format', width: '12%' });\n $scope.fileSelector.config.columns.push({ field: 'compression', label: 'Compression', width: '12%' });\n\n $scope.artifactNode = new QueryNode($scope.artifact.uri, 'databus:artifact');\n $scope.artifactNode.setFacet('http://purl.org/dc/terms/hasVersion', '$latest', true);\n\n $scope.groupNode = new QueryNode(DatabusUtils.navigateUp($scope.artifact.uri), 'databus:group');\n $scope.groupNode.addChild($scope.artifactNode);\n\n $scope.collectionWidgetSelectionData = {};\n $scope.collectionWidgetSelectionData.groupNode = $scope.groupNode;\n\n $scope.onFacetSettingsChanged = function () {\n $scope.fileSelector.query = QueryBuilder.build({\n node: $scope.artifactNode,\n template: QueryTemplates.DEFAULT_FILE_TEMPLATE,\n resourceBaseUrl: DATABUS_RESOURCE_BASE_URL\n });\n\n $scope.fileSelector.fullQuery = QueryBuilder.build({\n node: $scope.artifactNode,\n template: QueryTemplates.GROUP_PAGE_FILE_BROWSER_TEMPLATE,\n resourceBaseUrl: DATABUS_RESOURCE_BASE_URL\n });\n }\n\n $scope.onFacetSettingsChanged();\n\n\n $scope.onFileSelectionChanged = function (numFiles, totalSize) {\n $scope.fileSelector.numFiles = numFiles;\n $scope.fileSelector.totalSize = totalSize;\n };\n\n $scope.formatId = function (id) {\n return DatabusCollectionUtils.formatId(id);\n };\n\n $scope.addArtifactNodeToCollection = function () {\n\n if ($scope.collectionManager.activeCollection == null) {\n return;\n }\n\n var wrapper = new DatabusCollectionWrapper($scope.collectionManager.activeCollection);\n wrapper.addArtifactNode(\n $scope.artifact.uri,\n $scope.artifact.title,\n $scope.fileSelector.settings);\n\n $scope.collectionManager.saveLocally();\n $scope.statusCode = 1;\n };\n\n $scope.changeCollection = function (collection) {\n if (!$scope.authenticated) {\n return;\n }\n\n $scope.collectionManager.setActive(collection.uuid);\n }\n\n\n $scope.hideAutofill = function () {\n $scope.fileSelector.clearAutofill(function () {\n $scope.$apply();\n });\n }\n\n\n $scope.onDescriptionChanged = function () {\n if ($scope.formData == null) {\n return;\n }\n\n if (!$scope.formData.artifact.generateAbstract) {\n return;\n }\n\n $scope.formData.artifact.abstract =\n DatabusUtils.createAbstractFromDescription($scope.formData.artifact.description);\n }\n\n $scope.resetEdits = function () {\n $scope.formData.artifact.title = $scope.artifact.title;\n $scope.formData.artifact.abstract = $scope.artifact.abstract;\n $scope.formData.artifact.description = $scope.artifact.description;\n }\n\n $scope.saveArtifact = async function () {\n\n if ($scope.dataidCreator == null) {\n return;\n }\n\n var artifactUpdate = $scope.dataidCreator.createArtifactUpdate();\n\n var response = await $http.post(`/api/register`, artifactUpdate);\n\n if (response.status == 200) {\n $scope.artifact.title = $scope.formData.artifact.title;\n $scope.artifact.abstract = $scope.formData.artifact.abstract;\n $scope.artifact.description = $scope.formData.artifact.description;\n\n $scope.pageTitle = DatabusUtils.stringOrFallback($scope.artifact.title,\n DatabusUtils.uriToTitle($scope.artifact.uri));\n\n DatabusAlert.alert($scope, true, \"Artifact Saved!\");\n $scope.$apply();\n }\n }\n\n\n}\n\n\nmodule.exports = ArtifactPageController;\n\n\n//# sourceURL=webpack://databus-webapp/./js/page-controller/artifact-controller.js?"); +eval("{const DatabusCollectionWrapper = __webpack_require__(/*! ../collections/databus-collection-wrapper */ \"./js/collections/databus-collection-wrapper.js\");\nconst DatabusAlert = __webpack_require__(/*! ../components/databus-alert/databus-alert */ \"./js/components/databus-alert/databus-alert.js\");\nconst DataIdCreator = __webpack_require__(/*! ../publish/dataid-creator */ \"./js/publish/dataid-creator.js\");\nconst QueryBuilder = __webpack_require__(/*! ../query-builder/query-builder */ \"./js/query-builder/query-builder.js\");\nconst QueryNode = __webpack_require__(/*! ../query-builder/query-node */ \"./js/query-builder/query-node.js\");\nconst QueryTemplates = __webpack_require__(/*! ../query-builder/query-templates */ \"./js/query-builder/query-templates.js\");\nconst DatabusUtils = __webpack_require__(/*! ../utils/databus-utils */ \"./js/utils/databus-utils.js\");\nconst DatabusWebappUtils = __webpack_require__(/*! ../utils/databus-webapp-utils */ \"./js/utils/databus-webapp-utils.js\");\nconst TabNavigation = __webpack_require__(/*! ../utils/tab-navigation */ \"./js/utils/tab-navigation.js\");\n\n// hinzufügen eines Controllers zum Modul\nfunction ArtifactPageController($scope, $http, $sce, $location, collectionManager) {\n\n $scope.collectionManager = collectionManager;\n $scope.authenticated = data.auth.authenticated;\n $scope.auth = data.auth;\n $scope.utils = new DatabusWebappUtils($scope, $sce);\n $scope.accountName = $scope.utils.getAccountName();\n\n $scope.tabNavigation = new TabNavigation($scope, $location, [\n 'files', 'versions', 'edit'\n ]);\n\n $scope.versions = data.versions;\n $scope.artifact = data.artifact;\n $scope.canEdit = $scope.accountName != null;\n $scope.pageTitle = DatabusUtils.stringOrFallback($scope.artifact.title,\n DatabusUtils.uriToTitle($scope.artifact.uri));\n\n if (data.auth.authenticated && $scope.canEdit) {\n\n $scope.formData = {};\n $scope.formData.group = {};\n $scope.formData.group.name = DatabusUtils.uriToName(DatabusUtils.navigateUp($scope.artifact.uri));\n $scope.formData.artifact = {};\n\n var abstract = DatabusUtils.createAbstractFromDescription($scope.artifact.description);\n $scope.formData.artifact.generateAbstract = abstract == $scope.artifact.abstract;\n $scope.formData.artifact.name = $scope.artifact.name;\n $scope.formData.artifact.title = $scope.artifact.title;\n $scope.formData.artifact.abstract = $scope.artifact.abstract;\n $scope.formData.artifact.description = $scope.artifact.description;\n\n $scope.dataidCreator = new DataIdCreator($scope.formData, $scope.accountName);\n }\n\n $scope.fileSelector = {};\n $scope.fileSelector.config = {};\n $scope.fileSelector.config.authenticated = $scope.authenticated;\n $scope.fileSelector.config.columns = [];\n $scope.fileSelector.config.columns.push({ field: 'version', label: 'Version', width: '30%' });\n $scope.fileSelector.config.columns.push({ field: 'variant', label: 'Variant', width: '30%' });\n $scope.fileSelector.config.columns.push({ field: 'format', label: 'Format', width: '12%' });\n $scope.fileSelector.config.columns.push({ field: 'compression', label: 'Compression', width: '12%' });\n\n $scope.artifactNode = new QueryNode($scope.artifact.uri, 'databus:artifact');\n $scope.artifactNode.setFacet('http://purl.org/dc/terms/hasVersion', '$latest', true);\n\n $scope.groupNode = new QueryNode(DatabusUtils.navigateUp($scope.artifact.uri), 'databus:group');\n $scope.groupNode.addChild($scope.artifactNode);\n\n $scope.collectionWidgetSelectionData = {};\n $scope.collectionWidgetSelectionData.groupNode = $scope.groupNode;\n\n $scope.onFacetSettingsChanged = function () {\n $scope.fileSelector.query = QueryBuilder.build({\n node: $scope.artifactNode,\n template: QueryTemplates.DEFAULT_FILE_TEMPLATE,\n resourceBaseUrl: DATABUS_RESOURCE_BASE_URL\n });\n\n $scope.fileSelector.fullQuery = QueryBuilder.build({\n node: $scope.artifactNode,\n template: QueryTemplates.GROUP_PAGE_FILE_BROWSER_TEMPLATE,\n resourceBaseUrl: DATABUS_RESOURCE_BASE_URL\n });\n }\n\n $scope.onFacetSettingsChanged();\n\n\n $scope.onFileSelectionChanged = function (numFiles, totalSize) {\n $scope.fileSelector.numFiles = numFiles;\n $scope.fileSelector.totalSize = totalSize;\n };\n\n $scope.formatId = function (id) {\n return DatabusCollectionUtils.formatId(id);\n };\n\n $scope.addArtifactNodeToCollection = function () {\n\n if ($scope.collectionManager.activeCollection == null) {\n return;\n }\n\n var wrapper = new DatabusCollectionWrapper($scope.collectionManager.activeCollection);\n wrapper.addArtifactNode(\n $scope.artifact.uri,\n $scope.artifact.title,\n $scope.fileSelector.settings);\n\n $scope.collectionManager.saveLocally();\n $scope.statusCode = 1;\n };\n\n $scope.changeCollection = function (collection) {\n if (!$scope.authenticated) {\n return;\n }\n\n $scope.collectionManager.setActive(collection.uuid);\n }\n\n\n $scope.hideAutofill = function () {\n $scope.fileSelector.clearAutofill(function () {\n $scope.$apply();\n });\n }\n\n\n $scope.onDescriptionChanged = function () {\n if ($scope.formData == null) {\n return;\n }\n\n if (!$scope.formData.artifact.generateAbstract) {\n return;\n }\n\n $scope.formData.artifact.abstract =\n DatabusUtils.createAbstractFromDescription($scope.formData.artifact.description);\n }\n\n $scope.resetEdits = function () {\n $scope.formData.artifact.title = $scope.artifact.title;\n $scope.formData.artifact.abstract = $scope.artifact.abstract;\n $scope.formData.artifact.description = $scope.artifact.description;\n }\n\n $scope.saveArtifact = async function () {\n\n if ($scope.dataidCreator == null) {\n return;\n }\n\n var artifactUpdate = $scope.dataidCreator.createArtifactUpdate();\n\n var response = await $http.post(`/api/register`, artifactUpdate);\n\n if (response.status == 200) {\n $scope.artifact.title = $scope.formData.artifact.title;\n $scope.artifact.abstract = $scope.formData.artifact.abstract;\n $scope.artifact.description = $scope.formData.artifact.description;\n\n $scope.pageTitle = DatabusUtils.stringOrFallback($scope.artifact.title,\n DatabusUtils.uriToTitle($scope.artifact.uri));\n\n DatabusAlert.alert($scope, true, \"Artifact Saved!\");\n $scope.$apply();\n }\n }\n\n\n}\n\n\nmodule.exports = ArtifactPageController;\n\n\n//# sourceURL=webpack://databus-webapp/./js/page-controller/artifact-controller.js?\n}"); -/***/ }), +/***/ }, -/***/ "./js/page-controller/collection-controller.js": +/***/ "./js/page-controller/collection-controller.js" /*!*****************************************************!*\ !*** ./js/page-controller/collection-controller.js ***! \*****************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +(module, __unused_webpack_exports, __webpack_require__) { -eval("const DatabusCollectionUtils = __webpack_require__(/*! ../collections/databus-collection-utils */ \"./js/collections/databus-collection-utils.js\");\nconst DatabusCollectionWrapper = __webpack_require__(/*! ../collections/databus-collection-wrapper */ \"./js/collections/databus-collection-wrapper.js\");\nconst DatabusAlert = __webpack_require__(/*! ../components/databus-alert/databus-alert */ \"./js/components/databus-alert/databus-alert.js\");\nconst DatabusUtils = __webpack_require__(/*! ../utils/databus-utils */ \"./js/utils/databus-utils.js\");\nconst DatabusWebappUtils = __webpack_require__(/*! ../utils/databus-webapp-utils */ \"./js/utils/databus-webapp-utils.js\");\n\nfunction CollectionController($scope, $sce, $http, collectionManager) {\n\n $scope.auth = data.auth;\n $scope.collection = new DatabusCollectionWrapper(data.collection);\n $scope.authenticated = data.auth.authenticated;\n $scope.activeTab = 0;\n $scope.collectionManager = collectionManager;\n\n // Make some util functions available in the template\n $scope.utils = new DatabusWebappUtils($scope, $sce);\n $scope.accountName = $scope.utils.getAccountName();\n\n $scope.isOwn = false;\n\n if ($scope.authenticated) {\n $scope.collectionAccountName = DatabusUtils.uriToName(DatabusUtils.navigateUp($scope.collection.uri, 2));\n $scope.isOwn = $scope.accountName === $scope.collectionAccountName;\n }\n\n\n $scope.collectionViewModel = {};\n $scope.collectionViewModel.downloadScript = [];\n $scope.collectionViewModel.downloadScript.length = 3;\n $scope.collectionViewModel.downloadScript[0] = `query=$(curl -H \"Accept:text/sparql\" ${$scope.collection.uri})`;\n $scope.collectionViewModel.downloadScript[1] = `files=$(curl -X POST -H \"Accept: text/csv\" --data-urlencode \"query=\\${query}\" ${DATABUS_RESOURCE_BASE_URL}/sparql | tail -n +2 | sed 's/\\\\r$//' | sed 's/\"//g')`;\n $scope.collectionViewModel.downloadScript[2] = `while IFS= read -r file ; do wget $file; done <<< \"$files\"`;\n\n $scope.collectionViewModel.downloadManual = 'To fetch the query via *curl* run \\n``` shell\\n'\n + $scope.collectionViewModel.downloadScript[0] + '\\n```'\n + '\\n\\n\\nTo download the files additionally run\\n``` shell\\n'\n + $scope.collectionViewModel.downloadScript[1] + '\\n'\n + $scope.collectionViewModel.downloadScript[2]\n + '\\n```';\n\n $scope.collectionQuery = $scope.collection.createQuery();\n $scope.collectionManager = collectionManager;\n $scope.collectionFiles = \"\";\n\n\n DatabusCollectionUtils.getCollectionFileURLs($http, $scope.collection).then(function (result) {\n $scope.collectionFiles = result;\n $scope.$apply();\n }, function (err) {\n console.log(err);\n });\n\n\n if ($scope.authenticated) {\n $scope.username = data.auth.info.username;\n }\n\n $scope.formatUploadSize = function (size) {\n return DatabusUtils.formatFileSize(size);\n };\n\n\n\n $scope.editCopy = function () {\n if (!$scope.collectionManager.isInitialized) {\n return;\n }\n\n let localCopy = $scope.collectionManager.createCopy($scope.collection);\n\n window.location.href = `/app/collection-editor?uuid${localCopy.uuid}`;\n }\n\n $scope.createSnapshot = function () {\n if (!$scope.collectionManager.isInitialized) {\n return;\n }\n\n\n let collectionSnapshot = $scope.collectionManager.createSnapshot($scope.collection);\n window.location.href = `/app/collection-editor?uuid${collectionSnapshot.uuid}`;\n }\n\n \n $scope.editCollection = function () {\n\n if (!$scope.collectionManager.isInitialized) {\n return;\n }\n\n let localCopy = $scope.collectionManager.getCollectionByUri($scope.collection.uri);\n\n /// TODO Fabian - das sollte nicht passieren!\n if (localCopy === null) {\n console.log(\"editCollection failed. There is no collection with that uri: \" + $scope.collection.uri)\n $scope.editCopy();\n return;\n }\n\n window.location.href = `/app/collection-editor?uuid=${localCopy.uuid}`;\n }\n\n\n $scope.downloadAsJson = function () {\n DatabusCollectionUtils.exportToJsonFile($scope.collection);\n }\n\n $scope.queryToClipboard = function () {\n\n $scope.utils.copyToClipboard($scope.collectionQuery);\n DatabusAlert.alert($scope, true, DatabusMessages.GENERIC_COPIED_TO_CLIPBOARD);\n\n }\n\n $scope.openInYasgui = function () {\n window.location.href = 'https://databus.dbpedia.org/yasgui?query=' + encodeURIComponent($scope.collectionQuery);\n }\n\n $scope.bashScriptToClipboard = function () {\n\n var bashscript = `${$scope.collectionViewModel.downloadScript[0]}\n${$scope.collectionViewModel.downloadScript[1]}\n${$scope.collectionViewModel.downloadScript[2]}`\n\n $scope.utils.copyToClipboard(bashscript);\n DatabusAlert.alert($scope, true, DatabusMessages.GENERIC_COPIED_TO_CLIPBOARD);\n }\n\n\n $scope.filesToClipboard = function () {\n $scope.utils.copyToClipboard($scope.collectionFiles);\n DatabusAlert.alert($scope, true, DatabusMessages.GENERIC_COPIED_TO_CLIPBOARD);\n }\n\n}\n\nmodule.exports = CollectionController;\n\n\n//# sourceURL=webpack://databus-webapp/./js/page-controller/collection-controller.js?"); +eval("{const DatabusCollectionUtils = __webpack_require__(/*! ../collections/databus-collection-utils */ \"./js/collections/databus-collection-utils.js\");\nconst DatabusCollectionWrapper = __webpack_require__(/*! ../collections/databus-collection-wrapper */ \"./js/collections/databus-collection-wrapper.js\");\nconst DatabusAlert = __webpack_require__(/*! ../components/databus-alert/databus-alert */ \"./js/components/databus-alert/databus-alert.js\");\nconst DatabusUtils = __webpack_require__(/*! ../utils/databus-utils */ \"./js/utils/databus-utils.js\");\nconst DatabusWebappUtils = __webpack_require__(/*! ../utils/databus-webapp-utils */ \"./js/utils/databus-webapp-utils.js\");\n\nfunction CollectionController($scope, $sce, $http, collectionManager) {\n\n $scope.auth = data.auth;\n $scope.collection = new DatabusCollectionWrapper(data.collection);\n $scope.authenticated = data.auth.authenticated;\n $scope.activeTab = 0;\n $scope.collectionManager = collectionManager;\n\n // Make some util functions available in the template\n $scope.utils = new DatabusWebappUtils($scope, $sce);\n $scope.accountName = $scope.utils.getAccountName();\n\n $scope.isOwn = false;\n\n if ($scope.authenticated) {\n $scope.collectionAccountName = DatabusUtils.uriToName(DatabusUtils.navigateUp($scope.collection.uri, 2));\n $scope.isOwn = $scope.accountName === $scope.collectionAccountName;\n }\n\n\n $scope.collectionViewModel = {};\n $scope.collectionViewModel.downloadScript = [];\n $scope.collectionViewModel.downloadScript.length = 3;\n $scope.collectionViewModel.downloadScript[0] = `query=$(curl -H \"Accept:text/sparql\" ${$scope.collection.uri})`;\n $scope.collectionViewModel.downloadScript[1] = `files=$(curl -X POST -H \"Accept: text/csv\" --data-urlencode \"query=\\${query}\" ${DATABUS_RESOURCE_BASE_URL}/sparql | tail -n +2 | sed 's/\\\\r$//' | sed 's/\"//g')`;\n $scope.collectionViewModel.downloadScript[2] = `while IFS= read -r file ; do wget $file; done <<< \"$files\"`;\n\n $scope.collectionViewModel.downloadManual = 'To fetch the query via *curl* run \\n``` shell\\n'\n + $scope.collectionViewModel.downloadScript[0] + '\\n```'\n + '\\n\\n\\nTo download the files additionally run\\n``` shell\\n'\n + $scope.collectionViewModel.downloadScript[1] + '\\n'\n + $scope.collectionViewModel.downloadScript[2]\n + '\\n```';\n\n $scope.collectionQuery = $scope.collection.createQuery();\n $scope.collectionManager = collectionManager;\n $scope.collectionFiles = \"\";\n\n\n DatabusCollectionUtils.getCollectionFileURLs($http, $scope.collection).then(function (result) {\n $scope.collectionFiles = result;\n $scope.$apply();\n }, function (err) {\n console.log(err);\n });\n\n\n if ($scope.authenticated) {\n $scope.username = data.auth.info.username;\n }\n\n $scope.formatUploadSize = function (size) {\n return DatabusUtils.formatFileSize(size);\n };\n\n\n\n $scope.editCopy = function () {\n if (!$scope.collectionManager.isInitialized) {\n return;\n }\n\n let localCopy = $scope.collectionManager.createCopy($scope.collection);\n\n window.location.href = `/app/collection-editor?uuid${localCopy.uuid}`;\n }\n\n $scope.createSnapshot = function () {\n if (!$scope.collectionManager.isInitialized) {\n return;\n }\n\n\n let collectionSnapshot = $scope.collectionManager.createSnapshot($scope.collection);\n window.location.href = `/app/collection-editor?uuid${collectionSnapshot.uuid}`;\n }\n\n \n $scope.editCollection = function () {\n\n if (!$scope.collectionManager.isInitialized) {\n return;\n }\n\n let localCopy = $scope.collectionManager.getCollectionByUri($scope.collection.uri);\n\n /// TODO Fabian - das sollte nicht passieren!\n if (localCopy === null) {\n console.log(\"editCollection failed. There is no collection with that uri: \" + $scope.collection.uri)\n $scope.editCopy();\n return;\n }\n\n window.location.href = `/app/collection-editor?uuid=${localCopy.uuid}`;\n }\n\n\n $scope.downloadAsJson = function () {\n DatabusCollectionUtils.exportToJsonFile($scope.collection);\n }\n\n $scope.queryToClipboard = function () {\n\n $scope.utils.copyToClipboard($scope.collectionQuery);\n DatabusAlert.alert($scope, true, DatabusMessages.GENERIC_COPIED_TO_CLIPBOARD);\n\n }\n\n $scope.openInYasgui = function () {\n window.location.href = 'https://databus.dbpedia.org/yasgui?query=' + encodeURIComponent($scope.collectionQuery);\n }\n\n $scope.bashScriptToClipboard = function () {\n\n var bashscript = `${$scope.collectionViewModel.downloadScript[0]}\n${$scope.collectionViewModel.downloadScript[1]}\n${$scope.collectionViewModel.downloadScript[2]}`\n\n $scope.utils.copyToClipboard(bashscript);\n DatabusAlert.alert($scope, true, DatabusMessages.GENERIC_COPIED_TO_CLIPBOARD);\n }\n\n\n $scope.filesToClipboard = function () {\n $scope.utils.copyToClipboard($scope.collectionFiles);\n DatabusAlert.alert($scope, true, DatabusMessages.GENERIC_COPIED_TO_CLIPBOARD);\n }\n\n}\n\nmodule.exports = CollectionController;\n\n\n//# sourceURL=webpack://databus-webapp/./js/page-controller/collection-controller.js?\n}"); -/***/ }), +/***/ }, -/***/ "./js/page-controller/collections-editor-controller.js": +/***/ "./js/page-controller/collections-editor-controller.js" /*!*************************************************************!*\ !*** ./js/page-controller/collections-editor-controller.js ***! \*************************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +(module, __unused_webpack_exports, __webpack_require__) { -eval("const DatabusCollectionUtils = __webpack_require__(/*! ../collections/databus-collection-utils */ \"./js/collections/databus-collection-utils.js\");\nconst DatabusCollectionWrapper = __webpack_require__(/*! ../collections/databus-collection-wrapper */ \"./js/collections/databus-collection-wrapper.js\");\nconst DatabusAlert = __webpack_require__(/*! ../components/databus-alert/databus-alert */ \"./js/components/databus-alert/databus-alert.js\");\nconst QueryNode = __webpack_require__(/*! ../query-builder/query-node */ \"./js/query-builder/query-node.js\");\nconst DatabusMessages = __webpack_require__(/*! ../utils/databus-messages */ \"./js/utils/databus-messages.js\");\nconst DatabusUris = __webpack_require__(/*! ../utils/databus-uris */ \"./js/utils/databus-uris.js\");\nconst DatabusUtils = __webpack_require__(/*! ../utils/databus-utils */ \"./js/utils/databus-utils.js\");\nconst DatabusWebappUtils = __webpack_require__(/*! ../utils/databus-webapp-utils */ \"./js/utils/databus-webapp-utils.js\");\nconst TabNavigation = __webpack_require__(/*! ../utils/tab-navigation */ \"./js/utils/tab-navigation.js\");\n\n/**\n * Controls the collection editor page\n * @param {*} $scope \n * @param {*} $timeout \n * @param {*} $http \n * @param {*} $location \n * @param {*} collectionManager \n * @returns \n */\nasync function CollectionsEditorController($scope, $timeout, $http, $location, collectionManager) {\n\n $scope.auth = data.auth;\n $scope.authenticated = data.auth.authenticated;\n $scope.baseUrl = DATABUS_RESOURCE_BASE_URL;\n\n // Check for proper authentication\n if (!$scope.authenticated) {\n return;\n }\n\n const params = new URLSearchParams(window.location.search);\n $scope.uuid = params.get('uuid');\n\n // Make some util functions available in the template\n $scope.utils = new DatabusWebappUtils($scope);\n $scope.collectionManager = collectionManager;\n \n let collection = $scope.collectionManager.local[$scope.uuid];\n\n if(collection == null) {\n // No working copy found\n return;\n }\n\n try {\n let collection = $scope.collectionManager.local[$scope.uuid];\n await $scope.collectionManager.tryInitialize(collection.accountName);\n } catch(err) {\n\n }\n\n $scope.collectionManager.setActive($scope.uuid);\n let activeCollection = $scope.collectionManager.activeCollection;\n \n $scope.accountName = $scope.utils.getOwnedAccountName(activeCollection.accountName);\n $scope.hasAccount = $scope.accountName != undefined;\n\n //if (!$scope.hasAccount) {\n // return;\n //}\n\n // Create a tab navigation object for the tab navigation with locato\n $scope.tabNavigation = new TabNavigation($scope, $location, [\n 'docu', 'content', 'preview', 'query', 'json', 'import'\n ]);\n\n // Make the manager available in the template\n // $scope.collectionManager.setActiveCollection($scope.guid);\n\n // Form data object for input errors and extra fields and toggles\n $scope.form = {};\n $scope.form.title = {};\n $scope.form.identifier = {};\n $scope.form.identifier.value = \"\";\n $scope.form.abstract = {};\n $scope.form.description = {};\n $scope.form.isHidden = $scope.collectionManager.activeCollection.issued == undefined;\n $scope.form.collectionPublishTag = '';\n var description = $scope.collectionManager.activeCollection.description;\n var generatedAbstract = DatabusUtils.createAbstractFromDescription(description);\n $scope.form.generateAbstract = $scope.collectionManager.activeCollection.abstract == generatedAbstract;\n\n /**\n * Triggered when the description field gets changed.\n * Generates an abstract from the description. \n * @returns \n */\n $scope.onDescriptionChanged = function () {\n if ($scope.form == null) {\n return;\n }\n\n if ($scope.form.generateAbstract) {\n var description = $scope.collectionManager.activeCollection.description;\n var generatedAbstract = DatabusUtils.createAbstractFromDescription(description);\n $scope.collectionManager.activeCollection.abstract = generatedAbstract;\n }\n\n // Triggers saving to the local storage\n $scope.onActiveCollectionChanged();\n }\n\n\n /**\n * Called whenever an input field or similar gets changed. Persists the local changes in the local storage\n */\n $scope.onActiveCollectionChanged = function () {\n\n let collection = $scope.collectionManager.activeCollection;\n\n // Save to storage\n if ($scope.collectionManager.isInitialized) {\n $scope.collectionManager.saveLocally();\n }\n\n // Refresh query and json representation\n $scope.collectionQuery = new DatabusCollectionWrapper(collection).createQuery();\n $scope.collectionJson = $scope.getCollectionJson();\n\n if (collection != null) {\n collection.hasLocalChanges = $scope.collectionManager.hasLocalChanges(collection);\n }\n\n DatabusCollectionUtils.checkCollectionForm($scope.form, collection)\n }\n\n $scope.getStatusMessage = function (code) {\n return DatabusResponse.Message[code];\n }\n\n $scope.getStatusSuccess = function () {\n return $scope.statusCode >= 2000 && $scope.statusCode < 3000;\n }\n\n $scope.resetStatus = function () {\n $scope.statusCode = 0;\n }\n\n $scope.preview = function () {\n if ($scope.collectionManager.activeCollection.isDraft) {\n return;\n }\n\n var identifier = DatabusUtils.uriToName($scope.collectionManager.activeCollection.uri);\n window.location.href = `/${$scope.accountName}/collections/${identifier}`;\n }\n\n /**\n * Saves the collection to the remote server\n * @returns \n */\n $scope.saveCollection = async function () {\n\n try {\n // Needs initialized CM\n if (!$scope.collectionManager.isInitialized) {\n return;\n }\n\n let collection = $scope.collectionManager.activeCollection;\n\n // Check whether the form values are correct\n if (!DatabusCollectionUtils.checkCollectionForm($scope.form, collection)) {\n return;\n }\n\n // Look for an existing identifier\n var identifier = undefined;\n\n // Either take the identifier from the form (draft) or the collection uri (published)\n if (collection.isDraft) {\n identifier = $scope.form.identifier.value;\n } else {\n identifier = DatabusUtils.uriToName($scope.collectionManager.activeCollection.uri);\n }\n\n $scope.isSaving = true;\n $scope.collectionManager.updateCollection($scope.accountName, identifier).then(function (response) {\n DatabusAlert.alert($scope, true, DatabusMessages.CEDIT_COLLECTION_SAVED);\n $scope.isSaving = false;\n $scope.$apply();\n }).catch(function (err) {\n console.log(err);\n DatabusAlert.alert($scope, false, DatabusMessages.CEDIT_COLLECTION_SAVE_FAILED);\n $scope.isSaving = false;\n $scope.$apply();\n });\n\n } catch (err) {\n console.log(err);\n DatabusAlert.alert($scope, false, err);\n }\n }\n\n $scope.unpublishCollection = async function () {\n\n if ($scope.collectionManager.activeCollection.isDraft) {\n return;\n }\n\n try {\n await $scope.collectionManager.unpublishActiveCollection();\n DatabusAlert.alert($scope, true, DatabusMessages.CEDIT_COLLECTION_UNPUBLISHED);\n } catch (err) {\n DatabusAlert.alert($scope, false, err);\n console.log(err);\n }\n }\n\n $scope.showDeleteModal = function () {\n $scope.deleteModalVisible = true;\n }\n\n $scope.hideDeleteModal = function () {\n $scope.deleteModalVisible = false;\n }\n\n $scope.deleteCollection = function () {\n if (!$scope.collectionManager.isInitialized) {\n return;\n }\n\n $scope.deleteModalVisible = false;\n\n $scope.collectionManager.deleteCollection($scope.username, $scope.form.identifier.value).then(function (response) {\n $scope.statusCode = response.code;\n $scope.collectionManager.selectFirstOrCreate();\n $scope.setActiveCollection($scope.collectionManager.activeCollection);\n $scope.$apply();\n $timeout($scope.resetStatus, $scope.modalTime);\n }).catch(function (err) {\n $scope.statusCode = err.code;\n $scope.$apply();\n $timeout($scope.resetStatus, $scope.modalTime);\n });\n }\n\n\n $scope.deleteLocally = function () {\n if (!$scope.collectionManager.isInitialized) {\n return;\n }\n\n if (!$scope.collectionManager.activeCollection.isDraft) {\n return;\n }\n\n $scope.collectionManager.deleteLocally();\n window.location.href = `/${$scope.accountName}/collections`;\n }\n\n $scope.downloadAsJson = function () {\n DatabusCollectionUtils.exportToJsonFile($scope.collectionManager.activeCollection);\n }\n\n /**\n * Discard local changes of the active collection and revert to the remote collection state\n * @returns \n */\n $scope.discardChanges = function () {\n\n if (!$scope.collectionManager.activeCollection.hasLocalChanges) {\n return;\n }\n\n if ($scope.collectionManager.activeCollection.isDraft) {\n return;\n }\n\n $scope.collectionManager.discardLocalChanges();\n DatabusAlert.alert($scope, true, DatabusMessages.CEDIT_LOCAL_CHANGES_DISCARDED);\n }\n\n\n $scope.showLoadFromJson = function () {\n $scope.isLoadFromJsonVisible = true;\n }\n\n $scope.hideLoadFromJson = function () {\n $scope.isLoadFromJsonVisible = false;\n }\n\n $scope.loadFromJsonString = '';\n\n $scope.loadFromJson = function (loadFromJsonString) {\n try {\n\n \n var toLoad = JSON.parse(loadFromJsonString);\n\n var target = $scope.collectionManager.activeCollection;\n\n if (toLoad.label != undefined) {\n target.title = toLoad.label;\n }\n\n if (toLoad.title != undefined) {\n target.title = toLoad.title;\n }\n\n target.description = toLoad.description;\n target.abstract = toLoad.abstract;\n\n if (toLoad.content.generatedQuery != undefined || toLoad.content.customQueries) {\n // Datbaus 1.0 Syntax detected\n var replacedJson = loadFromJsonString\n .replace(\"dataid:\", \"databus:\")\n .replace(\"http://dataid.dbpedia.org/ns/cv#\",\n DatabusUris.DATABUS_CONTENT_VARIANT_PREFIX);\n\n var toLoad = JSON.parse(replacedJson);\n var databusNode = new QueryNode(DATABUS_RESOURCE_BASE_URL, null);\n\n target.content.root = new QueryNode(null, null);\n target.content.root.addChild(databusNode);\n\n for(var groupNode of toLoad.content.generatedQuery.root.childNodes) {\n databusNode.addChild(groupNode);\n }\n\n for(var customNode of toLoad.content.customQueries) {\n\n var label = customNode.label;\n var query = customNode.query;\n\n databusNode.addChild(new QueryNode(label, query));\n }\n\n } else {\n target.content = toLoad.content;\n }\n\n DatabusAlert.alert($scope, true, DatabusMessages.CEDIT_COLLECTION_IMPORTED);\n $scope.isLoadFromJsonVisible = false;\n } catch (e) {\n $scope.statusCode = DatabusMessages.CEDIT_COLLECTION_IMPORT_FAILED;\n console.log(e);\n }\n }\n\n $scope.getCollectionJson = function () {\n var copy = DatabusCollectionUtils.createCleanCopy($scope.collectionManager.activeCollection);\n delete copy.uuid;\n return copy;\n }\n\n $scope.onActiveCollectionChanged();\n}\n\nmodule.exports = CollectionsEditorController;\n\n//# sourceURL=webpack://databus-webapp/./js/page-controller/collections-editor-controller.js?"); +eval("{const DatabusCollectionUtils = __webpack_require__(/*! ../collections/databus-collection-utils */ \"./js/collections/databus-collection-utils.js\");\nconst DatabusCollectionWrapper = __webpack_require__(/*! ../collections/databus-collection-wrapper */ \"./js/collections/databus-collection-wrapper.js\");\nconst DatabusAlert = __webpack_require__(/*! ../components/databus-alert/databus-alert */ \"./js/components/databus-alert/databus-alert.js\");\nconst QueryNode = __webpack_require__(/*! ../query-builder/query-node */ \"./js/query-builder/query-node.js\");\nconst DatabusMessages = __webpack_require__(/*! ../utils/databus-messages */ \"./js/utils/databus-messages.js\");\nconst DatabusUris = __webpack_require__(/*! ../utils/databus-uris */ \"./js/utils/databus-uris.js\");\nconst DatabusUtils = __webpack_require__(/*! ../utils/databus-utils */ \"./js/utils/databus-utils.js\");\nconst DatabusWebappUtils = __webpack_require__(/*! ../utils/databus-webapp-utils */ \"./js/utils/databus-webapp-utils.js\");\nconst TabNavigation = __webpack_require__(/*! ../utils/tab-navigation */ \"./js/utils/tab-navigation.js\");\n\n/**\n * Controls the collection editor page\n * @param {*} $scope \n * @param {*} $timeout \n * @param {*} $http \n * @param {*} $location \n * @param {*} collectionManager \n * @returns \n */\nasync function CollectionsEditorController($scope, $timeout, $http, $location, collectionManager) {\n\n $scope.auth = data.auth;\n $scope.authenticated = data.auth.authenticated;\n $scope.baseUrl = DATABUS_RESOURCE_BASE_URL;\n\n // Check for proper authentication\n if (!$scope.authenticated) {\n return;\n }\n\n const params = new URLSearchParams(window.location.search);\n $scope.uuid = params.get('uuid');\n\n // Make some util functions available in the template\n $scope.utils = new DatabusWebappUtils($scope);\n $scope.collectionManager = collectionManager;\n \n let collection = $scope.collectionManager.local[$scope.uuid];\n\n if(collection == null) {\n // No working copy found\n return;\n }\n\n try {\n let collection = $scope.collectionManager.local[$scope.uuid];\n await $scope.collectionManager.tryInitialize(collection.accountName);\n } catch(err) {\n\n }\n\n $scope.collectionManager.setActive($scope.uuid);\n let activeCollection = $scope.collectionManager.activeCollection;\n \n $scope.accountName = $scope.utils.getOwnedAccountName(activeCollection.accountName);\n $scope.hasAccount = $scope.accountName != undefined;\n\n //if (!$scope.hasAccount) {\n // return;\n //}\n\n // Create a tab navigation object for the tab navigation with locato\n $scope.tabNavigation = new TabNavigation($scope, $location, [\n 'docu', 'content', 'preview', 'query', 'json', 'import'\n ]);\n\n // Make the manager available in the template\n // $scope.collectionManager.setActiveCollection($scope.guid);\n\n // Form data object for input errors and extra fields and toggles\n $scope.form = {};\n $scope.form.title = {};\n $scope.form.identifier = {};\n $scope.form.identifier.value = \"\";\n $scope.form.abstract = {};\n $scope.form.description = {};\n $scope.form.isHidden = $scope.collectionManager.activeCollection.issued == undefined;\n $scope.form.collectionPublishTag = '';\n var description = $scope.collectionManager.activeCollection.description;\n var generatedAbstract = DatabusUtils.createAbstractFromDescription(description);\n $scope.form.generateAbstract = $scope.collectionManager.activeCollection.abstract == generatedAbstract;\n\n /**\n * Triggered when the description field gets changed.\n * Generates an abstract from the description. \n * @returns \n */\n $scope.onDescriptionChanged = function () {\n if ($scope.form == null) {\n return;\n }\n\n if ($scope.form.generateAbstract) {\n var description = $scope.collectionManager.activeCollection.description;\n var generatedAbstract = DatabusUtils.createAbstractFromDescription(description);\n $scope.collectionManager.activeCollection.abstract = generatedAbstract;\n }\n\n // Triggers saving to the local storage\n $scope.onActiveCollectionChanged();\n }\n\n\n /**\n * Called whenever an input field or similar gets changed. Persists the local changes in the local storage\n */\n $scope.onActiveCollectionChanged = function () {\n\n let collection = $scope.collectionManager.activeCollection;\n\n // Save to storage\n if ($scope.collectionManager.isInitialized) {\n $scope.collectionManager.saveLocally();\n }\n\n // Refresh query and json representation\n $scope.collectionQuery = new DatabusCollectionWrapper(collection).createQuery();\n $scope.collectionJson = $scope.getCollectionJson();\n\n if (collection != null) {\n collection.hasLocalChanges = $scope.collectionManager.hasLocalChanges(collection);\n }\n\n DatabusCollectionUtils.checkCollectionForm($scope.form, collection)\n }\n\n $scope.getStatusMessage = function (code) {\n return DatabusResponse.Message[code];\n }\n\n $scope.getStatusSuccess = function () {\n return $scope.statusCode >= 2000 && $scope.statusCode < 3000;\n }\n\n $scope.resetStatus = function () {\n $scope.statusCode = 0;\n }\n\n $scope.preview = function () {\n if ($scope.collectionManager.activeCollection.isDraft) {\n return;\n }\n\n var identifier = DatabusUtils.uriToName($scope.collectionManager.activeCollection.uri);\n window.location.href = `/${$scope.accountName}/collections/${identifier}`;\n }\n\n /**\n * Saves the collection to the remote server\n * @returns \n */\n $scope.saveCollection = async function () {\n\n try {\n // Needs initialized CM\n if (!$scope.collectionManager.isInitialized) {\n return;\n }\n\n let collection = $scope.collectionManager.activeCollection;\n\n // Check whether the form values are correct\n if (!DatabusCollectionUtils.checkCollectionForm($scope.form, collection)) {\n return;\n }\n\n // Look for an existing identifier\n var identifier = undefined;\n\n // Either take the identifier from the form (draft) or the collection uri (published)\n if (collection.isDraft) {\n identifier = $scope.form.identifier.value;\n } else {\n identifier = DatabusUtils.uriToName($scope.collectionManager.activeCollection.uri);\n }\n\n $scope.isSaving = true;\n $scope.collectionManager.updateCollection($scope.accountName, identifier).then(function (response) {\n DatabusAlert.alert($scope, true, DatabusMessages.CEDIT_COLLECTION_SAVED);\n $scope.isSaving = false;\n $scope.$apply();\n }).catch(function (err) {\n console.log(err);\n DatabusAlert.alert($scope, false, DatabusMessages.CEDIT_COLLECTION_SAVE_FAILED);\n $scope.isSaving = false;\n $scope.$apply();\n });\n\n } catch (err) {\n console.log(err);\n DatabusAlert.alert($scope, false, err);\n }\n }\n\n $scope.unpublishCollection = async function () {\n\n if ($scope.collectionManager.activeCollection.isDraft) {\n return;\n }\n\n try {\n await $scope.collectionManager.unpublishActiveCollection();\n DatabusAlert.alert($scope, true, DatabusMessages.CEDIT_COLLECTION_UNPUBLISHED);\n } catch (err) {\n DatabusAlert.alert($scope, false, err);\n console.log(err);\n }\n }\n\n $scope.showDeleteModal = function () {\n $scope.deleteModalVisible = true;\n }\n\n $scope.hideDeleteModal = function () {\n $scope.deleteModalVisible = false;\n }\n\n $scope.deleteCollection = function () {\n if (!$scope.collectionManager.isInitialized) {\n return;\n }\n\n $scope.deleteModalVisible = false;\n\n $scope.collectionManager.deleteCollection($scope.username, $scope.form.identifier.value).then(function (response) {\n $scope.statusCode = response.code;\n $scope.collectionManager.selectFirstOrCreate();\n $scope.setActiveCollection($scope.collectionManager.activeCollection);\n $scope.$apply();\n $timeout($scope.resetStatus, $scope.modalTime);\n }).catch(function (err) {\n $scope.statusCode = err.code;\n $scope.$apply();\n $timeout($scope.resetStatus, $scope.modalTime);\n });\n }\n\n\n $scope.deleteLocally = function () {\n if (!$scope.collectionManager.isInitialized) {\n return;\n }\n\n if (!$scope.collectionManager.activeCollection.isDraft) {\n return;\n }\n\n $scope.collectionManager.deleteLocally();\n window.location.href = `/${$scope.accountName}/collections`;\n }\n\n $scope.downloadAsJson = function () {\n DatabusCollectionUtils.exportToJsonFile($scope.collectionManager.activeCollection);\n }\n\n /**\n * Discard local changes of the active collection and revert to the remote collection state\n * @returns \n */\n $scope.discardChanges = function () {\n\n if (!$scope.collectionManager.activeCollection.hasLocalChanges) {\n return;\n }\n\n if ($scope.collectionManager.activeCollection.isDraft) {\n return;\n }\n\n $scope.collectionManager.discardLocalChanges();\n DatabusAlert.alert($scope, true, DatabusMessages.CEDIT_LOCAL_CHANGES_DISCARDED);\n }\n\n\n $scope.showLoadFromJson = function () {\n $scope.isLoadFromJsonVisible = true;\n }\n\n $scope.hideLoadFromJson = function () {\n $scope.isLoadFromJsonVisible = false;\n }\n\n $scope.loadFromJsonString = '';\n\n $scope.loadFromJson = function (loadFromJsonString) {\n try {\n\n \n var toLoad = JSON.parse(loadFromJsonString);\n\n var target = $scope.collectionManager.activeCollection;\n\n if (toLoad.label != undefined) {\n target.title = toLoad.label;\n }\n\n if (toLoad.title != undefined) {\n target.title = toLoad.title;\n }\n\n target.description = toLoad.description;\n target.abstract = toLoad.abstract;\n\n if (toLoad.content.generatedQuery != undefined || toLoad.content.customQueries) {\n // Datbaus 1.0 Syntax detected\n var replacedJson = loadFromJsonString\n .replace(\"dataid:\", \"databus:\")\n .replace(\"http://dataid.dbpedia.org/ns/cv#\",\n DatabusUris.DATABUS_CONTENT_VARIANT_PREFIX);\n\n var toLoad = JSON.parse(replacedJson);\n var databusNode = new QueryNode(DATABUS_RESOURCE_BASE_URL, null);\n\n target.content.root = new QueryNode(null, null);\n target.content.root.addChild(databusNode);\n\n for(var groupNode of toLoad.content.generatedQuery.root.childNodes) {\n databusNode.addChild(groupNode);\n }\n\n for(var customNode of toLoad.content.customQueries) {\n\n var label = customNode.label;\n var query = customNode.query;\n\n databusNode.addChild(new QueryNode(label, query));\n }\n\n } else {\n target.content = toLoad.content;\n }\n\n DatabusAlert.alert($scope, true, DatabusMessages.CEDIT_COLLECTION_IMPORTED);\n $scope.isLoadFromJsonVisible = false;\n } catch (e) {\n $scope.statusCode = DatabusMessages.CEDIT_COLLECTION_IMPORT_FAILED;\n console.log(e);\n }\n }\n\n $scope.getCollectionJson = function () {\n var copy = DatabusCollectionUtils.createCleanCopy($scope.collectionManager.activeCollection);\n delete copy.uuid;\n return copy;\n }\n\n $scope.onActiveCollectionChanged();\n}\n\nmodule.exports = CollectionsEditorController;\n\n//# sourceURL=webpack://databus-webapp/./js/page-controller/collections-editor-controller.js?\n}"); -/***/ }), +/***/ }, -/***/ "./js/page-controller/frontpage-controller.js": +/***/ "./js/page-controller/frontpage-controller.js" /*!****************************************************!*\ !*** ./js/page-controller/frontpage-controller.js ***! \****************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +(module, __unused_webpack_exports, __webpack_require__) { -eval("const DatabusUris = __webpack_require__(/*! ../utils/databus-uris */ \"./js/utils/databus-uris.js\");\nconst DatabusUtils = __webpack_require__(/*! ../utils/databus-utils */ \"./js/utils/databus-utils.js\");\nconst DatabusWebappUtils = __webpack_require__(/*! ../utils/databus-webapp-utils */ \"./js/utils/databus-webapp-utils.js\");\n\n/**\n * Controller of the front page\n * @param {scope} $scope [description]\n * @param {http} $http [description]\n * @param {sce} $sce [description]\n */\nfunction FrontPageController($scope, $sce, $http) {\n\n $scope.databusName = DATABUS_NAME;\n\n $scope.auth = data.auth;\n\n $scope.activityChartData = {};\n $scope.activityChartData.isLoading = true;\n $scope.utils = new DatabusWebappUtils();\n\n $scope.searchQuery = \"\";\n $scope.searchSettings = {\n minRelevance: 20,\n maxResults: 25,\n placeholder: `Search the Databus...`,\n resourceTypes: undefined,\n filter: `&typeNameWeight=0`\n };\n\n $http.get(`/app/index/activity`).then(function (response) {\n $scope.activityChartData.entries = response.data;\n $scope.activityChartData.isLoading = false;\n }, function (err) {\n console.log(err);\n });\n\n $scope.uploadRankingData = {};\n $scope.uploadRankingData.isLoading = true;\n\n $http.get(`/app/index/ranking`).then(function (response) {\n $scope.uploadRankingData.data = response.data;\n $scope.uploadRankingData.isLoading = false;\n }, function (err) {\n console.log(err);\n });\n\n $scope.recentUploadsData = {};\n $scope.recentUploadsData.isLoading = true;\n\n $http.get(`/app/index/recent`).then(function (response) {\n $scope.recentUploadsData.data = response.data;\n $scope.recentUploadsData.isLoading = false;\n }, function (err) {\n console.log(err);\n });\n\n // Login function\n $scope.login = function () {\n window.location = '/app/login?redirectUrl=' + encodeURIComponent(window.location);\n }\n\n $scope.goToPage = function(path) {\n window.location = path;\n }\n\n $scope.account = function() {\n window.location = '/app/account';\n }\n\n for(var d in $scope.uploadRankingData) {\n $scope.uploadRankingData[d].uploadSize = DatabusUtils.formatFileSize($scope.uploadRankingData[d].uploadSize);\n }\n\n for(var d in $scope.recentUploadsData) {\n $scope.recentUploadsData[d].date = DatabusUtils.formatDate($scope.recentUploadsData[d].date);\n }\n}\n\n\nmodule.exports = FrontPageController;\n\n\n//# sourceURL=webpack://databus-webapp/./js/page-controller/frontpage-controller.js?"); +eval("{const DatabusUris = __webpack_require__(/*! ../utils/databus-uris */ \"./js/utils/databus-uris.js\");\nconst DatabusUtils = __webpack_require__(/*! ../utils/databus-utils */ \"./js/utils/databus-utils.js\");\nconst DatabusWebappUtils = __webpack_require__(/*! ../utils/databus-webapp-utils */ \"./js/utils/databus-webapp-utils.js\");\n\n/**\n * Controller of the front page\n * @param {scope} $scope [description]\n * @param {http} $http [description]\n * @param {sce} $sce [description]\n */\nfunction FrontPageController($scope, $sce, $http) {\n\n $scope.databusName = DATABUS_NAME;\n\n $scope.auth = data.auth;\n\n $scope.activityChartData = {};\n $scope.activityChartData.isLoading = true;\n $scope.utils = new DatabusWebappUtils();\n\n $scope.searchQuery = \"\";\n $scope.searchSettings = {\n minRelevance: 20,\n maxResults: 25,\n placeholder: `Search the Databus...`,\n resourceTypes: undefined,\n filter: `&typeNameWeight=0`\n };\n\n $http.get(`/app/index/activity`).then(function (response) {\n $scope.activityChartData.entries = response.data;\n $scope.activityChartData.isLoading = false;\n }, function (err) {\n console.log(err);\n });\n\n $scope.uploadRankingData = {};\n $scope.uploadRankingData.isLoading = true;\n\n $http.get(`/app/index/ranking`).then(function (response) {\n $scope.uploadRankingData.data = response.data;\n $scope.uploadRankingData.isLoading = false;\n }, function (err) {\n console.log(err);\n });\n\n $scope.recentUploadsData = {};\n $scope.recentUploadsData.isLoading = true;\n\n $http.get(`/app/index/recent`).then(function (response) {\n $scope.recentUploadsData.data = response.data;\n $scope.recentUploadsData.isLoading = false;\n }, function (err) {\n console.log(err);\n });\n\n // Login function\n $scope.login = function () {\n window.location = '/app/login?redirectUrl=' + encodeURIComponent(window.location);\n }\n\n $scope.goToPage = function(path) {\n window.location = path;\n }\n\n $scope.account = function() {\n window.location = '/app/account';\n }\n\n for(var d in $scope.uploadRankingData) {\n $scope.uploadRankingData[d].uploadSize = DatabusUtils.formatFileSize($scope.uploadRankingData[d].uploadSize);\n }\n\n for(var d in $scope.recentUploadsData) {\n $scope.recentUploadsData[d].date = DatabusUtils.formatDate($scope.recentUploadsData[d].date);\n }\n}\n\n\nmodule.exports = FrontPageController;\n\n\n//# sourceURL=webpack://databus-webapp/./js/page-controller/frontpage-controller.js?\n}"); -/***/ }), +/***/ }, -/***/ "./js/page-controller/group-controller.js": +/***/ "./js/page-controller/group-controller.js" /*!************************************************!*\ !*** ./js/page-controller/group-controller.js ***! \************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +(module, __unused_webpack_exports, __webpack_require__) { -eval("const DatabusCollectionWrapper = __webpack_require__(/*! ../collections/databus-collection-wrapper */ \"./js/collections/databus-collection-wrapper.js\");\nconst DatabusAlert = __webpack_require__(/*! ../components/databus-alert/databus-alert */ \"./js/components/databus-alert/databus-alert.js\");\nconst DataIdCreator = __webpack_require__(/*! ../publish/dataid-creator */ \"./js/publish/dataid-creator.js\");\nconst QueryBuilder = __webpack_require__(/*! ../query-builder/query-builder */ \"./js/query-builder/query-builder.js\");\nconst QueryNode = __webpack_require__(/*! ../query-builder/query-node */ \"./js/query-builder/query-node.js\");\nconst QueryTemplates = __webpack_require__(/*! ../query-builder/query-templates */ \"./js/query-builder/query-templates.js\");\nconst DatabusConstants = __webpack_require__(/*! ../utils/databus-constants */ \"./js/utils/databus-constants.js\");\nconst DatabusUtils = __webpack_require__(/*! ../utils/databus-utils */ \"./js/utils/databus-utils.js\");\nconst DatabusWebappUtils = __webpack_require__(/*! ../utils/databus-webapp-utils */ \"./js/utils/databus-webapp-utils.js\");\nconst TabNavigation = __webpack_require__(/*! ../utils/tab-navigation */ \"./js/utils/tab-navigation.js\");\n\nfunction GroupPageController($scope, $http, $sce, $interval, $location, collectionManager) {\n\n $scope.group = data.group;\n // $scope.accountName = DatabusUtils.uriToName(DatabusUtils.navigateUp($scope.group.uri));\n $scope.auth = data.auth;\n\n $scope.utils = new DatabusWebappUtils($scope, $sce);\n $scope.accountName = $scope.utils.getAccountName();\n\n\n $scope.tabNavigation = new TabNavigation($scope, $location, [\n 'files', 'artifacts', 'edit'\n ]);\n\n $scope.dataSearchInput = \"\";\n $scope.dataSearchSettings = {\n minRelevance: 0.01,\n maxResults: 10,\n placeholder: `Search ${$scope.accountName}'s data...`,\n resourceTypes: ['Artifact'],\n filter: `&publisher=${$scope.accountName}&typeNameWeight=0&group=${$scope.group.name}`\n };\n\n\n $scope.group.hasData = false;\n $scope.group.hasArtifacts = false;\n $scope.isLoading = true;\n\n $http({\n method: 'GET',\n url: `/app/group/get-artifacts?uri=${encodeURIComponent($scope.group.uri)}`\n }).then(function successCallback(response) {\n\n $scope.artifacts = response.data;\n\n for (var artifact of $scope.artifacts) {\n if (artifact.latestVersionDate != undefined) {\n $scope.group.hasData = true;\n }\n\n artifact.title = DatabusUtils.stringOrFallback(artifact.title, artifact.latestVersionTitle);\n artifact.abstract = DatabusUtils.stringOrFallback(artifact.abstract, artifact.latestVersionAbstract);\n artifact.description = DatabusUtils.stringOrFallback(artifact.description, artifact.latestVersionDescription);\n }\n\n $scope.group.hasArtifacts = $scope.artifacts.length > 0;\n $scope.isLoading = false;\n }, function errorCallback(response) {\n $scope.isLoading = false;\n });\n\n\n $scope.pageTitle = DatabusUtils.stringOrFallback($scope.group.title,\n DatabusUtils.uriToTitle($scope.group.uri));\n\n\n $scope.canEdit = $scope.accountName != null;\n\n if (data.auth.authenticated && $scope.canEdit) {\n\n var abstract = DatabusUtils.createAbstractFromDescription($scope.group.description);\n $scope.formData = {};\n $scope.formData.group = {};\n $scope.formData.group.generateAbstract = abstract == $scope.group.abstract;\n $scope.formData.group.name = $scope.group.name;\n $scope.formData.group.title = $scope.group.title;\n $scope.formData.group.abstract = $scope.group.abstract;\n $scope.formData.group.description = $scope.group.description;\n\n $scope.dataidCreator = new DataIdCreator($scope.formData, $scope.accountName);\n }\n\n $scope.onDescriptionChanged = function () {\n if ($scope.formData == null) {\n return;\n }\n\n if (!$scope.formData.group.generateAbstract) {\n return;\n }\n\n $scope.formData.group.abstract =\n DatabusUtils.createAbstractFromDescription($scope.formData.group.description);\n }\n\n $scope.resetEdits = function () {\n $scope.formData.group.title = $scope.group.title;\n $scope.formData.group.abstract = $scope.group.abstract;\n $scope.formData.group.description = $scope.group.description;\n }\n\n $scope.saveGroup = async function () {\n\n if ($scope.dataidCreator == null) {\n return;\n }\n\n var groupUpdate = $scope.dataidCreator.createGroupUpdate();\n\n var relativeUri = new URL($scope.group.uri).pathname;\n var response = await $http.post('/api/register', groupUpdate);\n\n if (response.status == 200) {\n $scope.group.title = $scope.formData.group.title;\n $scope.group.abstract = $scope.formData.group.abstract;\n $scope.group.description = $scope.formData.group.description;\n\n\n $scope.pageTitle = DatabusUtils.stringOrFallback($scope.group.title,\n DatabusUtils.uriToTitle($scope.group.uri));\n\n DatabusAlert.alert($scope, true, \"Group Saved!\");\n $scope.$apply();\n }\n }\n\n $scope.facetsView = {};\n $scope.facetsView.resourceUri = $scope.group.uri;\n $scope.facetsView.settings = [];\n $scope.facetsView.parentSettings = null;\n $scope.authenticated = data.auth.authenticated;\n $scope.selection = [];\n\n $scope.input = {};\n $scope.input.search = '';\n $scope.searchCooldown = 500;\n $scope.searchChanged = true;\n $scope.searchReady = true;\n\n $scope.fileSelector = {};\n $scope.fileSelector.config = {};\n $scope.fileSelector.config.authenticated = $scope.authenticated;\n $scope.fileSelector.config.columns = [];\n $scope.fileSelector.config.columns.push({ field: 'artifact', label: 'Artifact', width: '30%', uriToName: true });\n $scope.fileSelector.config.columns.push({ field: 'version', label: 'Version', width: '21%' });\n $scope.fileSelector.config.columns.push({ field: 'variant', label: 'Variant', width: '16%' });\n $scope.fileSelector.config.columns.push({ field: 'format', label: 'Format', width: '9%' });\n $scope.fileSelector.config.columns.push({ field: 'compression', label: 'Compression', width: '6%' });\n\n $scope.groupNode = new QueryNode($scope.group.uri, 'databus:group');\n $scope.groupNode.setFacet('http://purl.org/dc/terms/hasVersion', DatabusConstants.FACET_LATEST_VERSION_VALUE, true);\n\n $scope.onFacetSettingsChanged = function () {\n $scope.fileSelector.query = QueryBuilder.build({\n node: $scope.groupNode,\n template: QueryTemplates.DEFAULT_FILE_TEMPLATE,\n resourceBaseUrl: DATABUS_RESOURCE_BASE_URL\n });\n\n $scope.fileSelector.fullQuery = QueryBuilder.build({\n node: $scope.groupNode,\n template: QueryTemplates.GROUP_PAGE_FILE_BROWSER_TEMPLATE,\n resourceBaseUrl: DATABUS_RESOURCE_BASE_URL\n });\n }\n\n // $scope.onFacetSettingsChanged();\n\n $scope.collectionWidgetSelectionData = {};\n $scope.collectionWidgetSelectionData.groupNode = $scope.groupNode;\n\n $scope.onFileQueryResult = function (args) {\n if (args == null) return;\n $scope.collectionWidgetSelectionData.query = args.query;\n }\n\n $scope.collectionManager = collectionManager;\n\n $scope.findArtifact = function (uri) {\n return $scope.artifacts.find(function (a) { a.uri === uri; });\n }\n\n $scope.formatResult = function (result) {\n return $sce.trustAsHtml(result);\n }\n\n\n $scope.formatLicense = function (licenseUri) {\n var licenseName = DatabusUtils.uriToName(licenseUri);\n\n var html = '
' + licenseName + '
'\n return $sce.trustAsHtml(html);\n }\n\n for (var a in $scope.artifacts) {\n $scope.artifacts[a].date = $scope.formatDate($scope.artifacts[a].date);\n $scope.artifacts[a].licenseTag = $scope.formatLicense($scope.artifacts[a].license);\n }\n\n $scope.setSelectionStateAll = function (val) {\n if (val) {\n for (var a in $scope.artifacts) {\n $scope.select($scope.artifacts[a]);\n }\n } else {\n for (var a in $scope.artifacts) {\n $scope.deselect($scope.artifacts[a]);\n }\n }\n }\n\n $scope.toggleSelect = function (artifact) {\n if ($scope.isSelected(artifact)) {\n $scope.deselect(artifact);\n } else {\n $scope.select(artifact);\n }\n }\n\n $scope.select = function (artifact) {\n artifact.isSelected = true;\n $scope.selection.push(artifact.uri);\n }\n\n $scope.deselect = function (artifact) {\n artifact.isSelected = false;\n $scope.selection = $scope.selection.filter(function (value, index, arr) {\n return value !== artifact.uri;\n });\n }\n\n $scope.isSelected = function (artifact) {\n for (var s in $scope.selection) {\n if ($scope.selection[s] === artifact.uri) {\n return true;\n }\n }\n return false;\n }\n\n $scope.changeCollection = function (collection) {\n $scope.collectionManager.setActive(collection.uuid);\n $scope.search();\n }\n\n $scope.showCollectionModal = function () {\n $('#add-to-collection-modal').addClass('is-active');\n }\n\n $scope.hideCollectionModal = function () {\n $('#add-to-collection-modal').removeClass('is-active');\n }\n\n $scope.markdownToHtml = function (markdown) {\n\n var converter = window.markdownit();\n return $sce.trustAsHtml(converter.render(markdown));\n };\n\n\n $scope.invokeSearch = function () {\n if ($scope.searchReady) {\n $scope.search();\n $scope.searchReady = false;\n } else {\n $scope.searchChanged = true;\n }\n }\n\n $interval(function () {\n if ($scope.searchChanged) {\n $scope.search();\n $scope.searchChanged = false;\n }\n $scope.searchReady = true;\n }, $scope.searchCooldown);\n\n\n $scope.addSelectionToCollection = function () {\n\n if ($scope.collectionManager.activeCollection == null) {\n return;\n }\n\n var wrapper = new DatabusCollectionWrapper($scope.collectionManager.activeCollection);\n\n for (var s in $scope.selection) {\n var artifact = $scope.artifacts.find(function (a) { return a.uri === $scope.selection[s]; });\n wrapper.addArtifactNode(artifact.uri, artifact.label);\n }\n $scope.collectionManager.saveLocally();\n $scope.search();\n }\n\n $scope.updateArtifactState = function (wrapper, artifact) {\n artifact.alreadyAdded = wrapper.hasArtifact(artifact.uri);\n artifact.isSelected = artifact.alreadyAdded || $scope.selection.includes(artifact.uri);\n }\n\n\n\n $scope.search = function () {\n\n $scope.searchResult = [];\n\n var typeFilters = `&publisher=${$scope.accountName}&publisherWeight=0&typeName=Artifact&typeNameWeight=0&group=${$scope.group.name}&minRelevance=0.1`;\n\n $http({\n method: 'GET',\n url: '/api/search?query=' + $scope.input.search + typeFilters\n }).then(function successCallback(response) {\n\n for (var r in response.data.docs) {\n var result = response.data.docs[r];\n\n for (var artifact of $scope.artifacts) {\n if (result.id[0] == artifact.uri) {\n $scope.searchResult.push(artifact);\n }\n }\n }\n }, function errorCallback(response) {\n });\n }\n}\n\nmodule.exports = GroupPageController;\n\n//# sourceURL=webpack://databus-webapp/./js/page-controller/group-controller.js?"); +eval("{const DatabusCollectionWrapper = __webpack_require__(/*! ../collections/databus-collection-wrapper */ \"./js/collections/databus-collection-wrapper.js\");\nconst DatabusAlert = __webpack_require__(/*! ../components/databus-alert/databus-alert */ \"./js/components/databus-alert/databus-alert.js\");\nconst DataIdCreator = __webpack_require__(/*! ../publish/dataid-creator */ \"./js/publish/dataid-creator.js\");\nconst QueryBuilder = __webpack_require__(/*! ../query-builder/query-builder */ \"./js/query-builder/query-builder.js\");\nconst QueryNode = __webpack_require__(/*! ../query-builder/query-node */ \"./js/query-builder/query-node.js\");\nconst QueryTemplates = __webpack_require__(/*! ../query-builder/query-templates */ \"./js/query-builder/query-templates.js\");\nconst DatabusConstants = __webpack_require__(/*! ../utils/databus-constants */ \"./js/utils/databus-constants.js\");\nconst DatabusUtils = __webpack_require__(/*! ../utils/databus-utils */ \"./js/utils/databus-utils.js\");\nconst DatabusWebappUtils = __webpack_require__(/*! ../utils/databus-webapp-utils */ \"./js/utils/databus-webapp-utils.js\");\nconst TabNavigation = __webpack_require__(/*! ../utils/tab-navigation */ \"./js/utils/tab-navigation.js\");\n\nfunction GroupPageController($scope, $http, $sce, $interval, $location, collectionManager) {\n\n $scope.group = data.group;\n // $scope.accountName = DatabusUtils.uriToName(DatabusUtils.navigateUp($scope.group.uri));\n $scope.auth = data.auth;\n\n $scope.utils = new DatabusWebappUtils($scope, $sce);\n $scope.accountName = $scope.utils.getAccountName();\n\n\n $scope.tabNavigation = new TabNavigation($scope, $location, [\n 'files', 'artifacts', 'edit'\n ]);\n\n $scope.dataSearchInput = \"\";\n $scope.dataSearchSettings = {\n minRelevance: 0.01,\n maxResults: 10,\n placeholder: `Search ${$scope.accountName}'s data...`,\n resourceTypes: ['Artifact'],\n filter: `&publisher=${$scope.accountName}&typeNameWeight=0&group=${$scope.group.name}`\n };\n\n\n $scope.group.hasData = false;\n $scope.group.hasArtifacts = false;\n $scope.isLoading = true;\n\n $http({\n method: 'GET',\n url: `/app/group/get-artifacts?uri=${encodeURIComponent($scope.group.uri)}`\n }).then(function successCallback(response) {\n\n $scope.artifacts = response.data;\n\n for (var artifact of $scope.artifacts) {\n if (artifact.latestVersionDate != undefined) {\n $scope.group.hasData = true;\n }\n\n artifact.title = DatabusUtils.stringOrFallback(artifact.title, artifact.latestVersionTitle);\n artifact.abstract = DatabusUtils.stringOrFallback(artifact.abstract, artifact.latestVersionAbstract);\n artifact.description = DatabusUtils.stringOrFallback(artifact.description, artifact.latestVersionDescription);\n }\n\n $scope.group.hasArtifacts = $scope.artifacts.length > 0;\n $scope.isLoading = false;\n }, function errorCallback(response) {\n $scope.isLoading = false;\n });\n\n\n $scope.pageTitle = DatabusUtils.stringOrFallback($scope.group.title,\n DatabusUtils.uriToTitle($scope.group.uri));\n\n\n $scope.canEdit = $scope.accountName != null;\n\n if (data.auth.authenticated && $scope.canEdit) {\n\n var abstract = DatabusUtils.createAbstractFromDescription($scope.group.description);\n $scope.formData = {};\n $scope.formData.group = {};\n $scope.formData.group.generateAbstract = abstract == $scope.group.abstract;\n $scope.formData.group.name = $scope.group.name;\n $scope.formData.group.title = $scope.group.title;\n $scope.formData.group.abstract = $scope.group.abstract;\n $scope.formData.group.description = $scope.group.description;\n\n $scope.dataidCreator = new DataIdCreator($scope.formData, $scope.accountName);\n }\n\n $scope.onDescriptionChanged = function () {\n if ($scope.formData == null) {\n return;\n }\n\n if (!$scope.formData.group.generateAbstract) {\n return;\n }\n\n $scope.formData.group.abstract =\n DatabusUtils.createAbstractFromDescription($scope.formData.group.description);\n }\n\n $scope.resetEdits = function () {\n $scope.formData.group.title = $scope.group.title;\n $scope.formData.group.abstract = $scope.group.abstract;\n $scope.formData.group.description = $scope.group.description;\n }\n\n $scope.saveGroup = async function () {\n\n if ($scope.dataidCreator == null) {\n return;\n }\n\n var groupUpdate = $scope.dataidCreator.createGroupUpdate();\n\n var relativeUri = new URL($scope.group.uri).pathname;\n var response = await $http.post('/api/register', groupUpdate);\n\n if (response.status == 200) {\n $scope.group.title = $scope.formData.group.title;\n $scope.group.abstract = $scope.formData.group.abstract;\n $scope.group.description = $scope.formData.group.description;\n\n\n $scope.pageTitle = DatabusUtils.stringOrFallback($scope.group.title,\n DatabusUtils.uriToTitle($scope.group.uri));\n\n DatabusAlert.alert($scope, true, \"Group Saved!\");\n $scope.$apply();\n }\n }\n\n $scope.facetsView = {};\n $scope.facetsView.resourceUri = $scope.group.uri;\n $scope.facetsView.settings = [];\n $scope.facetsView.parentSettings = null;\n $scope.authenticated = data.auth.authenticated;\n $scope.selection = [];\n\n $scope.input = {};\n $scope.input.search = '';\n $scope.searchCooldown = 500;\n $scope.searchChanged = true;\n $scope.searchReady = true;\n\n $scope.fileSelector = {};\n $scope.fileSelector.config = {};\n $scope.fileSelector.config.authenticated = $scope.authenticated;\n $scope.fileSelector.config.columns = [];\n $scope.fileSelector.config.columns.push({ field: 'artifact', label: 'Artifact', width: '30%', uriToName: true });\n $scope.fileSelector.config.columns.push({ field: 'version', label: 'Version', width: '21%' });\n $scope.fileSelector.config.columns.push({ field: 'variant', label: 'Variant', width: '16%' });\n $scope.fileSelector.config.columns.push({ field: 'format', label: 'Format', width: '9%' });\n $scope.fileSelector.config.columns.push({ field: 'compression', label: 'Compression', width: '6%' });\n\n $scope.groupNode = new QueryNode($scope.group.uri, 'databus:group');\n $scope.groupNode.setFacet('http://purl.org/dc/terms/hasVersion', DatabusConstants.FACET_LATEST_VERSION_VALUE, true);\n\n $scope.onFacetSettingsChanged = function () {\n $scope.fileSelector.query = QueryBuilder.build({\n node: $scope.groupNode,\n template: QueryTemplates.DEFAULT_FILE_TEMPLATE,\n resourceBaseUrl: DATABUS_RESOURCE_BASE_URL\n });\n\n $scope.fileSelector.fullQuery = QueryBuilder.build({\n node: $scope.groupNode,\n template: QueryTemplates.GROUP_PAGE_FILE_BROWSER_TEMPLATE,\n resourceBaseUrl: DATABUS_RESOURCE_BASE_URL\n });\n }\n\n // $scope.onFacetSettingsChanged();\n\n $scope.collectionWidgetSelectionData = {};\n $scope.collectionWidgetSelectionData.groupNode = $scope.groupNode;\n\n $scope.onFileQueryResult = function (args) {\n if (args == null) return;\n $scope.collectionWidgetSelectionData.query = args.query;\n }\n\n $scope.collectionManager = collectionManager;\n\n $scope.findArtifact = function (uri) {\n return $scope.artifacts.find(function (a) { a.uri === uri; });\n }\n\n $scope.formatResult = function (result) {\n return $sce.trustAsHtml(result);\n }\n\n\n $scope.formatLicense = function (licenseUri) {\n var licenseName = DatabusUtils.uriToName(licenseUri);\n\n var html = '
' + licenseName + '
'\n return $sce.trustAsHtml(html);\n }\n\n for (var a in $scope.artifacts) {\n $scope.artifacts[a].date = $scope.formatDate($scope.artifacts[a].date);\n $scope.artifacts[a].licenseTag = $scope.formatLicense($scope.artifacts[a].license);\n }\n\n $scope.setSelectionStateAll = function (val) {\n if (val) {\n for (var a in $scope.artifacts) {\n $scope.select($scope.artifacts[a]);\n }\n } else {\n for (var a in $scope.artifacts) {\n $scope.deselect($scope.artifacts[a]);\n }\n }\n }\n\n $scope.toggleSelect = function (artifact) {\n if ($scope.isSelected(artifact)) {\n $scope.deselect(artifact);\n } else {\n $scope.select(artifact);\n }\n }\n\n $scope.select = function (artifact) {\n artifact.isSelected = true;\n $scope.selection.push(artifact.uri);\n }\n\n $scope.deselect = function (artifact) {\n artifact.isSelected = false;\n $scope.selection = $scope.selection.filter(function (value, index, arr) {\n return value !== artifact.uri;\n });\n }\n\n $scope.isSelected = function (artifact) {\n for (var s in $scope.selection) {\n if ($scope.selection[s] === artifact.uri) {\n return true;\n }\n }\n return false;\n }\n\n $scope.changeCollection = function (collection) {\n $scope.collectionManager.setActive(collection.uuid);\n $scope.search();\n }\n\n $scope.showCollectionModal = function () {\n $('#add-to-collection-modal').addClass('is-active');\n }\n\n $scope.hideCollectionModal = function () {\n $('#add-to-collection-modal').removeClass('is-active');\n }\n\n $scope.markdownToHtml = function (markdown) {\n\n var converter = window.markdownit();\n return $sce.trustAsHtml(converter.render(markdown));\n };\n\n\n $scope.invokeSearch = function () {\n if ($scope.searchReady) {\n $scope.search();\n $scope.searchReady = false;\n } else {\n $scope.searchChanged = true;\n }\n }\n\n $interval(function () {\n if ($scope.searchChanged) {\n $scope.search();\n $scope.searchChanged = false;\n }\n $scope.searchReady = true;\n }, $scope.searchCooldown);\n\n\n $scope.addSelectionToCollection = function () {\n\n if ($scope.collectionManager.activeCollection == null) {\n return;\n }\n\n var wrapper = new DatabusCollectionWrapper($scope.collectionManager.activeCollection);\n\n for (var s in $scope.selection) {\n var artifact = $scope.artifacts.find(function (a) { return a.uri === $scope.selection[s]; });\n wrapper.addArtifactNode(artifact.uri, artifact.label);\n }\n $scope.collectionManager.saveLocally();\n $scope.search();\n }\n\n $scope.updateArtifactState = function (wrapper, artifact) {\n artifact.alreadyAdded = wrapper.hasArtifact(artifact.uri);\n artifact.isSelected = artifact.alreadyAdded || $scope.selection.includes(artifact.uri);\n }\n\n\n\n $scope.search = function () {\n\n $scope.searchResult = [];\n\n var typeFilters = `&publisher=${$scope.accountName}&publisherWeight=0&typeName=Artifact&typeNameWeight=0&group=${$scope.group.name}&minRelevance=0.1`;\n\n $http({\n method: 'GET',\n url: '/api/search?query=' + $scope.input.search + typeFilters\n }).then(function successCallback(response) {\n\n for (var r in response.data.docs) {\n var result = response.data.docs[r];\n\n for (var artifact of $scope.artifacts) {\n if (result.id[0] == artifact.uri) {\n $scope.searchResult.push(artifact);\n }\n }\n }\n }, function errorCallback(response) {\n });\n }\n}\n\nmodule.exports = GroupPageController;\n\n//# sourceURL=webpack://databus-webapp/./js/page-controller/group-controller.js?\n}"); -/***/ }), +/***/ }, -/***/ "./js/page-controller/header-controller.js": +/***/ "./js/page-controller/header-controller.js" /*!*************************************************!*\ !*** ./js/page-controller/header-controller.js ***! \*************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +(module, __unused_webpack_exports, __webpack_require__) { -eval("var DatabusWebappUtils = __webpack_require__(/*! ../utils/databus-webapp-utils */ \"./js/utils/databus-webapp-utils.js\");\n\n// Controller for the header section\nfunction HeaderController($scope, $http, collectionManager, searchManager) {\n\n $scope.auth = data.auth;\n $scope.authenticated = data.auth.authenticated;\n\n $scope.utils = new DatabusWebappUtils($scope);\n $scope.accountName = $scope.utils.getAccountName();\n \n\n // Check for cookie settings\n $scope.databusCookieConsentKey = 'databus_cookie_consent';\n let cookieConsent = window.localStorage.getItem($scope.databusCookieConsentKey);\n $scope.showCookieDialogue = cookieConsent === undefined;\n\n $scope.collectionManager = collectionManager;\n\n if ($scope.authenticated) {\n\n $scope.collectionManager.tryInitialize($scope.accountName);\n // Collection Manager Init\n // Initialize search manager\n searchManager.initialize();\n } else {\n $scope.collectionManager.clearSession();\n }\n\n $scope.hideAccountMenu = function() {\n $scope.isAccountMenuActive = false;\n }\n\n $scope.showAccountMenu = function() {\n $scope.isAccountMenuActive = true;\n }\n\n // Finds a display name for the account\n $scope.getAccountName = function () {\n if ($scope.auth.info.accountName) {\n return $scope.auth.info.accountName;\n }\n\n if ($scope.auth.info.oidc_email) {\n return $scope.auth.info.oidc_email;\n }\n\n if ($scope.auth.info.oidc_name) {\n return $scope.auth.info.oidc_name;\n }\n\n return null;\n }\n\n $scope.isMenuActive = false;\n $scope.isAccountMenuActive = false;\n\n // Coookieees\n $scope.giveCookieConsent = function () {\n window.localStorage.setItem($scope.databusCookieConsentKey, true);\n $scope.showCookieDialogue = false;\n }\n\n // Login function\n $scope.login = function () {\n window.location = '/app/login?redirectUrl=' + encodeURIComponent(window.location);\n }\n\n // Logout function\n $scope.logout = function () {\n $scope.hideAccountMenu();\n window.location = '/app/logout?redirectUrl=' + encodeURIComponent(window.location);\n }\n\n // ???\n $scope.size = function () {\n if ($scope.collectionManager == null) {\n return \"\";\n }\n\n var first = $scope.collectionManager.current;\n return first != null ? first.elements.length : \"\";\n }\n}\n\nmodule.exports = HeaderController;\n\n\n//# sourceURL=webpack://databus-webapp/./js/page-controller/header-controller.js?"); +eval("{var DatabusWebappUtils = __webpack_require__(/*! ../utils/databus-webapp-utils */ \"./js/utils/databus-webapp-utils.js\");\n\n// Controller for the header section\nfunction HeaderController($scope, $http, collectionManager, searchManager) {\n\n $scope.auth = data.auth;\n $scope.authenticated = data.auth.authenticated;\n\n $scope.utils = new DatabusWebappUtils($scope);\n $scope.accountName = $scope.utils.getAccountName();\n \n\n // Check for cookie settings\n $scope.databusCookieConsentKey = 'databus_cookie_consent';\n let cookieConsent = window.localStorage.getItem($scope.databusCookieConsentKey);\n $scope.showCookieDialogue = cookieConsent === undefined;\n\n $scope.collectionManager = collectionManager;\n\n if ($scope.authenticated) {\n\n $scope.collectionManager.tryInitialize($scope.accountName);\n // Collection Manager Init\n // Initialize search manager\n searchManager.initialize();\n } else {\n $scope.collectionManager.clearSession();\n }\n\n $scope.hideAccountMenu = function() {\n $scope.isAccountMenuActive = false;\n }\n\n $scope.showAccountMenu = function() {\n $scope.isAccountMenuActive = true;\n }\n\n // Finds a display name for the account\n $scope.getAccountName = function () {\n if ($scope.auth.info.accountName) {\n return $scope.auth.info.accountName;\n }\n\n if ($scope.auth.info.oidc_email) {\n return $scope.auth.info.oidc_email;\n }\n\n if ($scope.auth.info.oidc_name) {\n return $scope.auth.info.oidc_name;\n }\n\n return null;\n }\n\n $scope.isMenuActive = false;\n $scope.isAccountMenuActive = false;\n\n // Coookieees\n $scope.giveCookieConsent = function () {\n window.localStorage.setItem($scope.databusCookieConsentKey, true);\n $scope.showCookieDialogue = false;\n }\n\n // Login function\n $scope.login = function () {\n window.location = '/app/login?redirectUrl=' + encodeURIComponent(window.location);\n }\n\n // Logout function\n $scope.logout = function () {\n $scope.hideAccountMenu();\n window.location = '/app/logout?redirectUrl=' + encodeURIComponent(window.location);\n }\n\n // ???\n $scope.size = function () {\n if ($scope.collectionManager == null) {\n return \"\";\n }\n\n var first = $scope.collectionManager.current;\n return first != null ? first.elements.length : \"\";\n }\n}\n\nmodule.exports = HeaderController;\n\n\n//# sourceURL=webpack://databus-webapp/./js/page-controller/header-controller.js?\n}"); -/***/ }), +/***/ }, -/***/ "./js/page-controller/profile-controller.js": +/***/ "./js/page-controller/profile-controller.js" /*!**************************************************!*\ !*** ./js/page-controller/profile-controller.js ***! \**************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +(module, __unused_webpack_exports, __webpack_require__) { -eval("const DatabusUtils = __webpack_require__(/*! ../utils/databus-utils */ \"./js/utils/databus-utils.js\");\nconst DatabusWebappUtils = __webpack_require__(/*! ../utils/databus-webapp-utils */ \"./js/utils/databus-webapp-utils.js\");\nconst DatabusAlert = __webpack_require__(/*! ../components/databus-alert/databus-alert */ \"./js/components/databus-alert/databus-alert.js\");\nconst SearchAdapter = __webpack_require__(/*! ../search/search-adapter */ \"./js/search/search-adapter.js\");\nconst DatabusMessages = __webpack_require__(/*! ../utils/databus-messages */ \"./js/utils/databus-messages.js\");\nconst DatabusConstants = __webpack_require__(/*! ../utils/databus-constants */ \"./js/utils/databus-constants.js\");\nconst AppJsonFormatter = __webpack_require__(/*! ../utils/app-json-formatter */ \"./js/utils/app-json-formatter.js\");\n\nfunction ProfileController($scope, $http) {\n\n $scope.account = data.account;\n $scope.auth = data.auth;\n\n if (data.owner != null) {\n $scope.account.apiKeys = data.owner.apiKeys;\n }\n $scope.auth = data.auth;\n $scope.preferredDatabusUsername = \"\";\n $scope.createApiKeyName = \"\"\n $scope.createAccountError = \"\";\n $scope.createApiKeyError = \"\";\n $scope.addWebIdUri = \"\";\n $scope.deleteAccountName = \"\";\n $scope.grantAccessUri = \"\";\n $scope.adapters = SearchAdapter.list;\n $scope.utils = new DatabusWebappUtils($scope);\n\n $scope.accountName = $scope.utils.getAccountName();\n\n $scope.personUri = `${DATABUS_RESOURCE_BASE_URL}/${$scope.accountName}${DatabusConstants.WEBID_THIS}`;\n\n $scope.putProfile = function (accountName) {\n\n var accountUri = `${DATABUS_RESOURCE_BASE_URL}/${accountName}`;\n var accountJsonLd = AppJsonFormatter.createAccountData(\n accountUri,\n accountName,\n null,\n null);\n\n $http.post(`/api/register`, accountJsonLd).then(function (result) {\n window.location.reload(true);\n }, function (err) {\n console.log(err);\n $scope.createAccountError = err.data;\n });\n }\n\n\n if ($scope.account == undefined) {\n\n $scope.createProfile = function () {\n\n if ($scope.isSubmitting) {\n return;\n }\n\n $scope.isSubmitting = true;\n\n if (!$scope.auth.authenticated) {\n return;\n }\n\n var accountName = $scope.preferredDatabusUsername;\n\n if (accountName == undefined || !DatabusUtils.isValidAccountName(accountName)) {\n $scope.createAccountError = \"Enter a valid account name.\"\n $scope.showAccountNameHints = true;\n return;\n }\n\n $scope.showAccountNameHints = false;\n $scope.putProfile(accountName);\n }\n\n return;\n }\n\n $scope.addApiKey = async function () {\n // Validate the name input only\n\n if (!$scope.createApiKeyName) {\n DatabusAlert.alert(\"API key name must be provided.\");\n return;\n }\n\n let account = $scope.account;\n\n const postData = {\n accountName: account.accountName,\n keyname: $scope.createApiKeyName\n };\n\n try {\n // Send POST request to create the API key\n let response = await $http.post('/api/account/api-key/create', postData);\n\n if (response.data && response.data.apikey && response.data.keyname) {\n // Append new key to the list\n account.apiKeys.push({\n keyname: response.data.keyname,\n apikey: response.data.apikey\n });\n\n // Clear the name input field\n $scope.createApiKeyName = '';\n\n DatabusAlert.alert($scope, true, \"API key created.\");\n } else {\n DatabusAlert.alert($scope, false, \"Failed to create API key.\");\n }\n\n } catch (error) {\n console.error('Error creating API key:', error);\n const message = error.data || error.message || \"Unknown error occurred.\";\n DatabusAlert.alert($scope, false, message);\n }\n };\n\n\n $scope.deleteApiKey = async function (apiKey) {\n try {\n\n let account = $scope.account;\n // Find index of the account using accountName\n const index = account.apiKeys.findIndex(key => key.keyname === apiKey.keyname);\n\n if (index === -1) {\n throw new Error(`API key with name \"${apiKey.keyname}\" not found.`);\n }\n\n console.log(\"Deleting API key with keyname:\", apiKey.keyname);\n\n // Send delete request to server\n await $http.post(`/api/account/api-key/delete`, { accountName: account.accountName, keyname: apiKey.keyname });\n account.apiKeys.splice(index, 1);\n\n // Show success alert\n DatabusAlert.alert($scope, true, \"API key deleted.\");\n\n } catch (err) {\n console.error(err);\n\n\n\n const message = err.data || err.message || \"Unknown error occurred.\";\n DatabusAlert.alert($scope, false, message);\n }\n };\n\n $scope.addSecretary = function (account) {\n if (!$scope.editData.secretaries) {\n $scope.editData.secretaries = [];\n }\n\n $scope.editData.secretaries.push({\n accountName: '',\n hasWriteAccessTo: []\n });\n };\n\n $scope.removeSecretary = function (account, index) {\n $scope.editData.secretaries.splice(index, 1);\n };\n\n $scope.addNamespace = function (account, secIndex) {\n $scope.editData.secretaries[secIndex].hasWriteAccessTo.push('');\n };\n\n $scope.removeNamespace = function (account, secIndex, nsIndex) {\n $scope.editData.secretaries[secIndex].hasWriteAccessTo.splice(nsIndex, 1);\n };\n\n\n $scope.onCreateApiKeyNameChanged = function () {\n var hasError = !DatabusUtils.isValidResourceLabel($scope.createApiKeyName, 3, 20);\n $scope.createApiKeyError = hasError ? \" API key name must have between 3 and 20 characters and match [A-Za-z0-9\\\\s_()\\\\.\\\\,\\\\-]*\" : \"\";\n }\n\n\n $scope.removeSearchExtension = function (uri) {\n $http.post(`/api/account/mods/search-extensions/remove?uri=${encodeURIComponent(uri)}`)\n .then(function (result) {\n console.log(result);\n DatabusAlert.alert($scope, true, result.data);\n\n $scope.account.searchExtensions = $scope.account.searchExtensions.filter(function (e) {\n return e.endpointUri != uri;\n });\n\n }, function (err) {\n console.log(err);\n DatabusAlert.alert($scope, false, err.data);\n });\n }\n\n $scope.addSearchExtension = function () {\n var uri = $scope.modsSettings.searchExtensionURI;\n var adapter = $scope.modsSettings.searchExtensionAdapter.name;\n\n $http.post(`/api/account/mods/search-extensions/add?uri=${encodeURIComponent(uri)}&adapter=${adapter}`)\n .then(function (result) {\n console.log(result);\n DatabusAlert.alert($scope, true, result.data);\n $scope.account.searchExtensions.push({\n endpointUri: uri,\n adapter: adapter\n });\n }, function (err) {\n console.log(err);\n DatabusAlert.alert($scope, false, err.data);\n });\n }\n\n $scope.grantAccess = function () {\n $http.post(`/api/account/access/grant?uri=${encodeURIComponent($scope.grantAccessUri)}`).then(function (result) {\n $scope.account.authorizedAccounts.push($scope.grantAccessUri);\n }, function (err) {\n console.log(err);\n $scope.grantAccessError = err.data;\n });\n }\n\n $scope.revokeAccess = function (uri) {\n $http.post(`/api/account/access/revoke?uri=${encodeURIComponent(uri)}`).then(function (result) {\n $scope.account.authorizedAccounts = $scope.account.webIds.filter(function (value, index, arr) {\n return value != uri;\n });\n }, function (err) {\n console.log(err);\n $scope.grantAccessError = err.data;\n });\n }\n\n $scope.connectWebid = function () {\n\n $http.post(`/api/account/webid/add?uri=${encodeURIComponent($scope.addWebIdUri)}`).then(function (result) {\n $scope.account.webIds.push($scope.addWebIdUri);\n DatabusAlert.alert($scope, true, DatabusMessages.ACCOUNT_WEBID_LINKED);\n\n }, function (err) {\n console.log(err);\n $scope.addWebIdError = err.data;\n });\n }\n\n $scope.removeWebId = function (webIdToRemove) {\n\n $http.post(`/api/account/webid/remove?uri=${encodeURIComponent(webIdToRemove)}`).then(function (result) {\n\n $scope.account.webIds = $scope.account.webIds.filter(function (value, index, arr) {\n return value != webIdToRemove;\n });\n\n }, function (err) {\n console.log(err);\n $scope.addWebIdError = err.data;\n });\n }\n\n\n $scope.deleteAccount = async function () {\n let account = $scope.account;\n let name = $scope.deleteAccountName;\n\n try {\n let response = await $http.post(`/api/account/delete`, { accountName: name });\n\n window.location = `/app/user`;\n\n } catch (err) {\n console.error(err);\n DatabusAlert.alert($scope, false, err.data);\n }\n\n }\n\n $scope.updateAccount = async function () {\n\n if (!$scope.auth.authenticated) {\n return;\n }\n\n let account = {};\n account.uri = $scope.editData.uri;\n\n account.accountName = $scope.editData.accountName;\n account.label = $scope.editData.label;\n account.status = $scope.editData.about;\n account.imageUrl = $scope.editData.imageUrl;\n account.secretaries = $scope.editData.secretaries;\n\n\n try {\n await $http.post(`/api/account/update`, account);\n DatabusAlert.alert($scope, true, \"Account saved.\");\n\n } catch (err) {\n console.error(err);\n DatabusAlert.alert($scope, false, err.data);\n }\n }\n\n\n // We have profile data in $scope.account!\n\n if (!$scope.account.isOwn) {\n return;\n }\n\n $scope.modsSettings = {}\n $scope.modsSettings.searchExtensionURI = \"\";\n $scope.modsSettings.searchExtensionAdapter = $scope.adapters[0];\n\n\n $scope.editData = DatabusUtils.createCleanCopy($scope.account);\n\n $scope.resetEdits = function () {\n $scope.editData = DatabusUtils.createCleanCopy($scope.account);\n }\n\n}\n\nmodule.exports = ProfileController;\n\n//# sourceURL=webpack://databus-webapp/./js/page-controller/profile-controller.js?"); +eval("{const DatabusUtils = __webpack_require__(/*! ../utils/databus-utils */ \"./js/utils/databus-utils.js\");\nconst DatabusWebappUtils = __webpack_require__(/*! ../utils/databus-webapp-utils */ \"./js/utils/databus-webapp-utils.js\");\nconst DatabusAlert = __webpack_require__(/*! ../components/databus-alert/databus-alert */ \"./js/components/databus-alert/databus-alert.js\");\nconst SearchAdapter = __webpack_require__(/*! ../search/search-adapter */ \"./js/search/search-adapter.js\");\nconst DatabusMessages = __webpack_require__(/*! ../utils/databus-messages */ \"./js/utils/databus-messages.js\");\nconst DatabusConstants = __webpack_require__(/*! ../utils/databus-constants */ \"./js/utils/databus-constants.js\");\nconst AppJsonFormatter = __webpack_require__(/*! ../utils/app-json-formatter */ \"./js/utils/app-json-formatter.js\");\n\nfunction ProfileController($scope, $http) {\n\n $scope.account = data.account;\n $scope.auth = data.auth;\n\n if (data.owner != null) {\n $scope.account.apiKeys = data.owner.apiKeys;\n }\n $scope.auth = data.auth;\n $scope.preferredDatabusUsername = \"\";\n $scope.createApiKeyName = \"\"\n $scope.createAccountError = \"\";\n $scope.createApiKeyError = \"\";\n $scope.addWebIdUri = \"\";\n $scope.deleteAccountName = \"\";\n $scope.grantAccessUri = \"\";\n $scope.adapters = SearchAdapter.list;\n $scope.utils = new DatabusWebappUtils($scope);\n\n $scope.accountName = $scope.utils.getAccountName();\n\n $scope.personUri = `${DATABUS_RESOURCE_BASE_URL}/${$scope.accountName}${DatabusConstants.WEBID_THIS}`;\n\n $scope.putProfile = function (accountName) {\n\n var accountUri = `${DATABUS_RESOURCE_BASE_URL}/${accountName}`;\n var accountJsonLd = AppJsonFormatter.createAccountData(\n accountUri,\n accountName,\n null,\n null);\n\n $http.post(`/api/register`, accountJsonLd).then(function (result) {\n window.location.reload(true);\n }, function (err) {\n console.log(err);\n $scope.createAccountError = err.data;\n });\n }\n\n\n if ($scope.account == undefined) {\n\n $scope.createProfile = function () {\n\n if ($scope.isSubmitting) {\n return;\n }\n\n $scope.isSubmitting = true;\n\n if (!$scope.auth.authenticated) {\n return;\n }\n\n var accountName = $scope.preferredDatabusUsername;\n\n if (accountName == undefined || !DatabusUtils.isValidAccountName(accountName)) {\n $scope.createAccountError = \"Enter a valid account name.\"\n $scope.showAccountNameHints = true;\n return;\n }\n\n $scope.showAccountNameHints = false;\n $scope.putProfile(accountName);\n }\n\n return;\n }\n\n $scope.addApiKey = async function () {\n // Validate the name input only\n\n if (!$scope.createApiKeyName) {\n DatabusAlert.alert(\"API key name must be provided.\");\n return;\n }\n\n let account = $scope.account;\n\n const postData = {\n accountName: account.accountName,\n keyname: $scope.createApiKeyName\n };\n\n try {\n // Send POST request to create the API key\n let response = await $http.post('/api/account/api-key/create', postData);\n\n if (response.data && response.data.apikey && response.data.keyname) {\n // Append new key to the list\n account.apiKeys.push({\n keyname: response.data.keyname,\n apikey: response.data.apikey\n });\n\n // Clear the name input field\n $scope.createApiKeyName = '';\n\n DatabusAlert.alert($scope, true, \"API key created.\");\n } else {\n DatabusAlert.alert($scope, false, \"Failed to create API key.\");\n }\n\n } catch (error) {\n console.error('Error creating API key:', error);\n const message = error.data || error.message || \"Unknown error occurred.\";\n DatabusAlert.alert($scope, false, message);\n }\n };\n\n\n $scope.deleteApiKey = async function (apiKey) {\n try {\n\n let account = $scope.account;\n // Find index of the account using accountName\n const index = account.apiKeys.findIndex(key => key.keyname === apiKey.keyname);\n\n if (index === -1) {\n throw new Error(`API key with name \"${apiKey.keyname}\" not found.`);\n }\n\n console.log(\"Deleting API key with keyname:\", apiKey.keyname);\n\n // Send delete request to server\n await $http.post(`/api/account/api-key/delete`, { accountName: account.accountName, keyname: apiKey.keyname });\n account.apiKeys.splice(index, 1);\n\n // Show success alert\n DatabusAlert.alert($scope, true, \"API key deleted.\");\n\n } catch (err) {\n console.error(err);\n\n\n\n const message = err.data || err.message || \"Unknown error occurred.\";\n DatabusAlert.alert($scope, false, message);\n }\n };\n\n $scope.addSecretary = function (account) {\n if (!$scope.editData.secretaries) {\n $scope.editData.secretaries = [];\n }\n\n $scope.editData.secretaries.push({\n accountName: '',\n hasWriteAccessTo: []\n });\n };\n\n $scope.removeSecretary = function (account, index) {\n $scope.editData.secretaries.splice(index, 1);\n };\n\n $scope.addNamespace = function (account, secIndex) {\n $scope.editData.secretaries[secIndex].hasWriteAccessTo.push('');\n };\n\n $scope.removeNamespace = function (account, secIndex, nsIndex) {\n $scope.editData.secretaries[secIndex].hasWriteAccessTo.splice(nsIndex, 1);\n };\n\n\n $scope.onCreateApiKeyNameChanged = function () {\n var hasError = !DatabusUtils.isValidResourceLabel($scope.createApiKeyName, 3, 20);\n $scope.createApiKeyError = hasError ? \" API key name must have between 3 and 20 characters and match [A-Za-z0-9\\\\s_()\\\\.\\\\,\\\\-]*\" : \"\";\n }\n\n\n $scope.removeSearchExtension = function (uri) {\n $http.post(`/api/account/mods/search-extensions/remove?uri=${encodeURIComponent(uri)}`)\n .then(function (result) {\n console.log(result);\n DatabusAlert.alert($scope, true, result.data);\n\n $scope.account.searchExtensions = $scope.account.searchExtensions.filter(function (e) {\n return e.endpointUri != uri;\n });\n\n }, function (err) {\n console.log(err);\n DatabusAlert.alert($scope, false, err.data);\n });\n }\n\n $scope.addSearchExtension = function () {\n var uri = $scope.modsSettings.searchExtensionURI;\n var adapter = $scope.modsSettings.searchExtensionAdapter.name;\n\n $http.post(`/api/account/mods/search-extensions/add?uri=${encodeURIComponent(uri)}&adapter=${adapter}`)\n .then(function (result) {\n console.log(result);\n DatabusAlert.alert($scope, true, result.data);\n $scope.account.searchExtensions.push({\n endpointUri: uri,\n adapter: adapter\n });\n }, function (err) {\n console.log(err);\n DatabusAlert.alert($scope, false, err.data);\n });\n }\n\n $scope.grantAccess = function () {\n $http.post(`/api/account/access/grant?uri=${encodeURIComponent($scope.grantAccessUri)}`).then(function (result) {\n $scope.account.authorizedAccounts.push($scope.grantAccessUri);\n }, function (err) {\n console.log(err);\n $scope.grantAccessError = err.data;\n });\n }\n\n $scope.revokeAccess = function (uri) {\n $http.post(`/api/account/access/revoke?uri=${encodeURIComponent(uri)}`).then(function (result) {\n $scope.account.authorizedAccounts = $scope.account.webIds.filter(function (value, index, arr) {\n return value != uri;\n });\n }, function (err) {\n console.log(err);\n $scope.grantAccessError = err.data;\n });\n }\n\n $scope.connectWebid = function () {\n\n $http.post(`/api/account/webid/add?uri=${encodeURIComponent($scope.addWebIdUri)}`).then(function (result) {\n $scope.account.webIds.push($scope.addWebIdUri);\n DatabusAlert.alert($scope, true, DatabusMessages.ACCOUNT_WEBID_LINKED);\n\n }, function (err) {\n console.log(err);\n $scope.addWebIdError = err.data;\n });\n }\n\n $scope.removeWebId = function (webIdToRemove) {\n\n $http.post(`/api/account/webid/remove?uri=${encodeURIComponent(webIdToRemove)}`).then(function (result) {\n\n $scope.account.webIds = $scope.account.webIds.filter(function (value, index, arr) {\n return value != webIdToRemove;\n });\n\n }, function (err) {\n console.log(err);\n $scope.addWebIdError = err.data;\n });\n }\n\n\n $scope.deleteAccount = async function () {\n let account = $scope.account;\n let name = $scope.deleteAccountName;\n\n try {\n let response = await $http.post(`/api/account/delete`, { accountName: name });\n\n window.location = `/app/user`;\n\n } catch (err) {\n console.error(err);\n DatabusAlert.alert($scope, false, err.data);\n }\n\n }\n\n $scope.updateAccount = async function () {\n\n if (!$scope.auth.authenticated) {\n return;\n }\n\n let account = {};\n account.uri = $scope.editData.uri;\n\n account.accountName = $scope.editData.accountName;\n account.label = $scope.editData.label;\n account.status = $scope.editData.about;\n account.imageUrl = $scope.editData.imageUrl;\n account.secretaries = $scope.editData.secretaries;\n\n\n try {\n await $http.post(`/api/account/update`, account);\n DatabusAlert.alert($scope, true, \"Account saved.\");\n\n } catch (err) {\n console.error(err);\n DatabusAlert.alert($scope, false, err.data);\n }\n }\n\n\n // We have profile data in $scope.account!\n\n if (!$scope.account.isOwn) {\n return;\n }\n\n $scope.modsSettings = {}\n $scope.modsSettings.searchExtensionURI = \"\";\n $scope.modsSettings.searchExtensionAdapter = $scope.adapters[0];\n\n\n $scope.editData = DatabusUtils.createCleanCopy($scope.account);\n\n $scope.resetEdits = function () {\n $scope.editData = DatabusUtils.createCleanCopy($scope.account);\n }\n\n}\n\nmodule.exports = ProfileController;\n\n//# sourceURL=webpack://databus-webapp/./js/page-controller/profile-controller.js?\n}"); -/***/ }), +/***/ }, -/***/ "./js/page-controller/publish-wizard-controller.js": +/***/ "./js/page-controller/publish-wizard-controller.js" /*!*********************************************************!*\ !*** ./js/page-controller/publish-wizard-controller.js ***! \*********************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +(module, __unused_webpack_exports, __webpack_require__) { -eval("const DatabusWebappUtils = __webpack_require__(/*! ../utils/databus-webapp-utils */ \"./js/utils/databus-webapp-utils.js\");\nconst PublishSession = __webpack_require__(/*! ../publish/publish-session */ \"./js/publish/publish-session.js\");\nconst TabNavigation = __webpack_require__(/*! ../utils/tab-navigation */ \"./js/utils/tab-navigation.js\");\n\n// Controller for the header section\nasync function PublishWizardController($scope, $http, $interval, focus, $q, $location) {\n\n $scope.login = function () {\n window.location = '/app/login?redirectUrl=' + encodeURIComponent(window.location);\n }\n\n $scope.utils = new DatabusWebappUtils($scope);\n\n $scope.tabNavigation = new TabNavigation($scope, $location, [\n '', 'group', 'artifact', 'version'\n ]);\n\n\n $scope.createAccount = function () {\n window.location = '/app/user';\n }\n\n // Login function\n $scope.login = function () {\n window.location = '/app/login?redirectUrl=' + encodeURIComponent(window.location);\n }\n\n $scope.authenticated = data.auth.authenticated;\n $scope.loadRequestCount = 0;\n $scope.texts = data.texts;\n\n $scope.nerdMode = {};\n $scope.nerdMode.enabled = false;\n $scope.nerdMode.customJson = \"\";\n $scope.nerdMode.logLevelOptions = ['error', 'info', 'debug'];\n $scope.nerdMode.logLevel = 'error';\n\n // controller does not work without authentication\n if (!$scope.authenticated) {\n return;\n }\n\n let accounts = data.auth.info.accounts;\n $scope.hasAccount = accounts != undefined && accounts.length > 0;\n\n $scope.accounts = [];\n\n for(let account of accounts) {\n $scope.accounts.push({\n accountName: account.accountName,\n apiKeys: account.apiKeys\n });\n }\n\n if (!$scope.hasAccount) {\n return;\n }\n\n // $scope.session = await PublishSession.createOrResume($http, data.auth.sub, $scope.accounts);\n\n $scope.session = new PublishSession($http, $interval, $scope.accounts, $scope.apiKeys);\n\n}\n /**\n * Fetches existing groups and artifacts\n \n $scope.getContentForAccount = async function (accountName) {\n\n $scope.isAccountDataLoading = true;\n var uri = `/app/account/content?account=${encodeURIComponent(accountName)}`;\n var response = await $http.get(uri);\n $scope.isAccountDataLoading = false;\n\n // Put account artifacts, groups and name in one object\n var accountData = response.data;\n accountData.accountName = accountName;\n\n accountData.publisherUris = [];\n for (var p of data.publisherData) {\n accountData.publisherUris.push(p.publisherUri);\n }\n\n $scope.session = new PublishSession($http);\n\n /*\n $scope.$watch('session', function () {\n $scope.session.onChange();\n }, true);\n\n $scope.$apply();\n \n }\n\n // $scope.getContentForAccount(data.auth.info.accounts[0]);\n\n /**\n * LICENSES\n \n\n \n\n $scope.addFile = function (input) {\n\n var session = $scope.session;\n\n if (input == undefined || input.length == 0) {\n return;\n }\n\n $scope.loadRequestCount++;\n\n $http.get('/app/publish-wizard/fetch-file?url=' + encodeURIComponent(input)).then(function (response) {\n\n $scope.loadRequestCount--;\n if (response.data == null || response.data == \"\" || response.status != 200) {\n return;\n }\n\n session.addFile(response.data);\n\n }, function (err) { });\n }\n\n $scope.objSize = function (obj) {\n return DatabusUtils.objSize(obj);\n }\n\n $scope.removeFile = function (fileGroup) {\n var files = $scope.session.formData.version.files;\n files.splice(files.findIndex(f => f.uri == fileGroup.uri), 1);\n $scope.session.formData.version.isConfigDirty = true;\n }\n\n $scope.hasError = function (errorList, error) {\n return errorList.includes(error);\n }\n\n // Fetch links using the fetch-links API of the Databus\n $scope.fetchFiles = function (parentUri) {\n\n $http.get('/app/publish-wizard/fetch-resource-page?url=' + encodeURIComponent(parentUri)).then(function (response) {\n for (var i in response.data) {\n var uri = response.data[i];\n $scope.addFile(uri);\n }\n }, function (err) {\n });\n }\n\n $scope.addFiles = function (input) {\n var lines = input.split('\\n');\n\n for (var line of lines) {\n if (line != undefined && line.length > 0) {\n $scope.addFile(line);\n }\n }\n }\n\n $scope.createTractate = function () {\n $scope.creatingTractate = true;\n $http.post('/api/tractate/v1/canonicalize', $scope.session.inputs.dataid).then(function (response) {\n $scope.session.formData.signature.tractate = response.data;\n $scope.creatingTractate = false;\n }, function (err) {\n $scope.creatingTractate = false;\n console.log(err);\n });\n }\n\n\n $scope.customPublish = async function () {\n var options = {}\n options.headers = {\n 'Accept': 'application/json, text/plain',\n 'Content-Type': 'application/json',\n }\n\n\n $scope.isPublishing = true;\n $http.post(`/api/publish?fetch-file-properties=true&log-level=${$scope.nerdMode.logLevel}`, $scope.nerdMode.customJson, options)\n .then(function (response) {\n $scope.publishLog = response.data.log;\n $scope.isPublishing = false;\n }, function (err) {\n $scope.publishLog = err.data.log;\n $scope.isPublishing = false;\n console.log(err);\n });\n }\n\n\n $scope.publish = async function () {\n var options = {}\n options.headers = {\n 'Accept': 'application/json, text/plain',\n 'Content-Type': 'application/json',\n }\n\n $scope.isPublishing = true;\n $http.post('/api/publish?fetch-file-properties=true&log-level=info', $scope.session.inputs.all, options)\n .then(function (response) {\n $scope.publishLog = response.data.log;\n $scope.isPublishing = false;\n }, function (err) {\n $scope.publishLog = err.data.log;\n $scope.isPublishing = false;\n console.log(err);\n });\n } */\n\n\n\n\nmodule.exports = PublishWizardController;\n\n//# sourceURL=webpack://databus-webapp/./js/page-controller/publish-wizard-controller.js?"); +eval("{const DatabusWebappUtils = __webpack_require__(/*! ../utils/databus-webapp-utils */ \"./js/utils/databus-webapp-utils.js\");\nconst PublishSession = __webpack_require__(/*! ../publish/publish-session */ \"./js/publish/publish-session.js\");\nconst TabNavigation = __webpack_require__(/*! ../utils/tab-navigation */ \"./js/utils/tab-navigation.js\");\n\n// Controller for the header section\nasync function PublishWizardController($scope, $http, $interval, focus, $q, $location) {\n\n $scope.login = function () {\n window.location = '/app/login?redirectUrl=' + encodeURIComponent(window.location);\n }\n\n $scope.utils = new DatabusWebappUtils($scope);\n\n $scope.tabNavigation = new TabNavigation($scope, $location, [\n '', 'group', 'artifact', 'version'\n ]);\n\n\n $scope.createAccount = function () {\n window.location = '/app/user';\n }\n\n // Login function\n $scope.login = function () {\n window.location = '/app/login?redirectUrl=' + encodeURIComponent(window.location);\n }\n\n $scope.authenticated = data.auth.authenticated;\n $scope.loadRequestCount = 0;\n $scope.texts = data.texts;\n\n $scope.nerdMode = {};\n $scope.nerdMode.enabled = false;\n $scope.nerdMode.customJson = \"\";\n $scope.nerdMode.logLevelOptions = ['error', 'info', 'debug'];\n $scope.nerdMode.logLevel = 'error';\n\n // controller does not work without authentication\n if (!$scope.authenticated) {\n return;\n }\n\n let accounts = data.auth.info.accounts;\n $scope.hasAccount = accounts != undefined && accounts.length > 0;\n\n $scope.accounts = [];\n\n for(let account of accounts) {\n $scope.accounts.push({\n accountName: account.accountName,\n apiKeys: account.apiKeys\n });\n }\n\n if (!$scope.hasAccount) {\n return;\n }\n\n // $scope.session = await PublishSession.createOrResume($http, data.auth.sub, $scope.accounts);\n\n $scope.session = new PublishSession($http, $interval, $scope.accounts, $scope.apiKeys);\n\n}\n /**\n * Fetches existing groups and artifacts\n \n $scope.getContentForAccount = async function (accountName) {\n\n $scope.isAccountDataLoading = true;\n var uri = `/app/account/content?account=${encodeURIComponent(accountName)}`;\n var response = await $http.get(uri);\n $scope.isAccountDataLoading = false;\n\n // Put account artifacts, groups and name in one object\n var accountData = response.data;\n accountData.accountName = accountName;\n\n accountData.publisherUris = [];\n for (var p of data.publisherData) {\n accountData.publisherUris.push(p.publisherUri);\n }\n\n $scope.session = new PublishSession($http);\n\n /*\n $scope.$watch('session', function () {\n $scope.session.onChange();\n }, true);\n\n $scope.$apply();\n \n }\n\n // $scope.getContentForAccount(data.auth.info.accounts[0]);\n\n /**\n * LICENSES\n \n\n \n\n $scope.addFile = function (input) {\n\n var session = $scope.session;\n\n if (input == undefined || input.length == 0) {\n return;\n }\n\n $scope.loadRequestCount++;\n\n $http.get('/app/publish-wizard/fetch-file?url=' + encodeURIComponent(input)).then(function (response) {\n\n $scope.loadRequestCount--;\n if (response.data == null || response.data == \"\" || response.status != 200) {\n return;\n }\n\n session.addFile(response.data);\n\n }, function (err) { });\n }\n\n $scope.objSize = function (obj) {\n return DatabusUtils.objSize(obj);\n }\n\n $scope.removeFile = function (fileGroup) {\n var files = $scope.session.formData.version.files;\n files.splice(files.findIndex(f => f.uri == fileGroup.uri), 1);\n $scope.session.formData.version.isConfigDirty = true;\n }\n\n $scope.hasError = function (errorList, error) {\n return errorList.includes(error);\n }\n\n // Fetch links using the fetch-links API of the Databus\n $scope.fetchFiles = function (parentUri) {\n\n $http.get('/app/publish-wizard/fetch-resource-page?url=' + encodeURIComponent(parentUri)).then(function (response) {\n for (var i in response.data) {\n var uri = response.data[i];\n $scope.addFile(uri);\n }\n }, function (err) {\n });\n }\n\n $scope.addFiles = function (input) {\n var lines = input.split('\\n');\n\n for (var line of lines) {\n if (line != undefined && line.length > 0) {\n $scope.addFile(line);\n }\n }\n }\n\n $scope.createTractate = function () {\n $scope.creatingTractate = true;\n $http.post('/api/tractate/v1/canonicalize', $scope.session.inputs.dataid).then(function (response) {\n $scope.session.formData.signature.tractate = response.data;\n $scope.creatingTractate = false;\n }, function (err) {\n $scope.creatingTractate = false;\n console.log(err);\n });\n }\n\n\n $scope.customPublish = async function () {\n var options = {}\n options.headers = {\n 'Accept': 'application/json, text/plain',\n 'Content-Type': 'application/json',\n }\n\n\n $scope.isPublishing = true;\n $http.post(`/api/publish?fetch-file-properties=true&log-level=${$scope.nerdMode.logLevel}`, $scope.nerdMode.customJson, options)\n .then(function (response) {\n $scope.publishLog = response.data.log;\n $scope.isPublishing = false;\n }, function (err) {\n $scope.publishLog = err.data.log;\n $scope.isPublishing = false;\n console.log(err);\n });\n }\n\n\n $scope.publish = async function () {\n var options = {}\n options.headers = {\n 'Accept': 'application/json, text/plain',\n 'Content-Type': 'application/json',\n }\n\n $scope.isPublishing = true;\n $http.post('/api/publish?fetch-file-properties=true&log-level=info', $scope.session.inputs.all, options)\n .then(function (response) {\n $scope.publishLog = response.data.log;\n $scope.isPublishing = false;\n }, function (err) {\n $scope.publishLog = err.data.log;\n $scope.isPublishing = false;\n console.log(err);\n });\n } */\n\n\n\n\nmodule.exports = PublishWizardController;\n\n//# sourceURL=webpack://databus-webapp/./js/page-controller/publish-wizard-controller.js?\n}"); -/***/ }), +/***/ }, -/***/ "./js/page-controller/sparql-editor-controller.js": +/***/ "./js/page-controller/sparql-editor-controller.js" /*!********************************************************!*\ !*** ./js/page-controller/sparql-editor-controller.js ***! \********************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +(module, __unused_webpack_exports, __webpack_require__) { -eval("var DatabusWebappUtils = __webpack_require__(/*! ../utils/databus-webapp-utils */ \"./js/utils/databus-webapp-utils.js\");\nconst SparqlExamples = __webpack_require__(/*! ../utils/sparql-examples */ \"./js/utils/sparql-examples.js\");\n\n// Controller for the header section\nfunction SparqlEditorController($scope, $http, $location) {\n\n\n $scope.storageKey = `${DATABUS_RESOURCE_BASE_URL}/sparql`;\n\n $scope.auth = data.auth;\n $scope.authenticated = data.auth.authenticated;\n $scope.utils = new DatabusWebappUtils($scope);\n\n\n $scope.editor = {};\n\n\n\n $scope.$on('$locationChangeSuccess', function () {\n var hash = $location.hash();\n\n if (hash && hash.startsWith('query')) {\n var tabIndex = parseInt(hash.replace('query', '')) - 1;\n\n // Only change if the tab exists and is different from current\n if (!isNaN(tabIndex) &&\n tabIndex >= 0 &&\n tabIndex < $scope.queryData.pages.length &&\n $scope.queryData.activeTab !== tabIndex) {\n $scope.goToTab(tabIndex);\n $scope.$applyAsync();\n }\n }\n });\n\n $scope.editor.exampleQueries = {};\n $scope.editor.exampleQueries.label = \"Databus Example Queries\";\n $scope.editor.exampleQueries.children = [];\n\n var simpleQueries = {\n label: \"Simple Queries\",\n children: []\n };\n\n var intermediateQueries = {\n label: \"Intermediate Queries\",\n children: []\n };\n\n simpleQueries.children.push({\n label: \"Select all Databus Groups\",\n query: `PREFIX databus: \nPREFIX rdf: \nPREFIX rdfs: \nPREFIX dct: \nPREFIX dcat: \nPREFIX sec: \nPREFIX cert: \nPREFIX foaf: \nPREFIX databus-cv: \nPREFIX dbo: \n\nSELECT DISTINCT * WHERE {\n ?s a databus:Group .\n}`\n });\n\n simpleQueries.children.push({\n label: \"Select all Databus Artifacts\",\n query: `PREFIX databus: \nPREFIX rdf: \nPREFIX rdfs: \nPREFIX dct: \nPREFIX dcat: \nPREFIX sec: \nPREFIX cert: \nPREFIX foaf: \nPREFIX databus-cv: \nPREFIX dbo: \n\nSELECT DISTINCT * WHERE {\n ?s a databus:Artifact .\n}`\n });\n\n simpleQueries.children.push({\n label: \"Select all Databus Versions\",\n query: `PREFIX databus: \nPREFIX rdf: \nPREFIX rdfs: \nPREFIX dct: \nPREFIX dcat: \nPREFIX sec: \nPREFIX cert: \nPREFIX foaf: \nPREFIX databus-cv: \nPREFIX dbo: \n\nSELECT DISTINCT * WHERE {\n ?s a databus:Version .\n}`\n });\n\n intermediateQueries.children.push({\n label: \"Latest Version of Artifact\",\n query: `PREFIX databus: \nPREFIX rdf: \nPREFIX rdfs: \nPREFIX dct: \nPREFIX dcat: \nPREFIX sec: \nPREFIX cert: \nPREFIX foaf: \nPREFIX databus-cv: \nPREFIX dbo: \n\nSELECT ?version WHERE\n{\n GRAPH ?g\n {\n ?version databus:artifact .\n ?version dct:hasVersion ?v . \n }\n} \nORDER BY DESC (STR(?v)) LIMIT 1`\n });\n\n\n $scope.editor.exampleQueries.children.push(simpleQueries);\n $scope.editor.exampleQueries.children.push(intermediateQueries);\n\n $scope.onExampleQueryClicked = function (node) {\n\n if (node.query == null) {\n return;\n }\n\n $scope.createQueryPage();\n\n var queryPage = $scope.queryData.pages[$scope.queryData.activeTab];\n\n queryPage.query = node.query;\n $scope.saveToStorage();\n }\n\n $scope.goToTab = function (index) {\n $scope.queryData.activeTab = index;\n $scope.saveToStorage();\n\n $location.hash(`query${index + 1}`);\n\n\n var queryPage = $scope.queryData.pages[$scope.queryData.activeTab];\n\n if ($scope.resultCache != null && $scope.resultCache[queryPage.name] != null) {\n $scope.editor.result = $scope.resultCache[queryPage.name];\n } else {\n $scope.editor.result = null;\n }\n }\n\n $scope.saveToStorage = function () {\n localStorage.setItem($scope.storageKey, JSON.stringify($scope.queryData));\n }\n\n $scope.deleteQueryPage = function ($index) {\n\n // Delete result cache entry\n var queryPage = $scope.queryData.pages[$scope.queryData.activeTab];\n if ($scope.resultCache != null && $scope.resultCache[queryPage.name] != null) {\n delete $scope.resultCache[queryPage.name];\n $scope.saveResultCache();\n }\n\n $scope.queryData.pages.splice($index, 1);\n\n if ($scope.queryData.pages.length == 0) {\n $scope.initialize();\n }\n else {\n var validTab = Math.min($scope.queryData.activeTab, $scope.queryData.pages.length - 1);\n\n if (validTab != $scope.queryData.activeTab) {\n $scope.goToTab(validTab);\n }\n }\n }\n\n $scope.createQueryPage = function () {\n\n var queryName = null;\n var queryNameIndex = 1;\n\n // find unoccupied name\n while (queryNameIndex < 100000) {\n\n // Create a candidate\n var hasName = true;\n queryName = `Query ${queryNameIndex}`;\n\n // Check if already in use\n for (var queryPage of $scope.queryData.pages) {\n if (queryPage.name == queryName) {\n hasName = false;\n }\n }\n\n // Found name, stop searching.\n if (hasName) {\n break;\n }\n\n queryNameIndex++;\n }\n\n $scope.queryData.pages.push({\n name: queryName,\n query: simpleQueries.children[0].query,\n endpoint: defaultEndpoint\n });\n\n $scope.goToTab($scope.queryData.pages.length - 1);\n\n $scope.saveToStorage();\n }\n\n $scope.saveResultCache = function () {\n sessionStorage.setItem($scope.storageKey, JSON.stringify($scope.resultCache));\n }\n\n $scope.initialize = function () {\n $scope.queryData = {};\n $scope.queryData.activeTab = 0;\n $scope.queryData.pages = [];\n $scope.createQueryPage();\n\n $scope.resultCache = {};\n $scope.saveResultCache();\n }\n\n var defaultEndpoint = `${DATABUS_RESOURCE_BASE_URL}/sparql`;\n\n var queryDataString = localStorage.getItem($scope.storageKey);\n var resultCacheString = sessionStorage.getItem($scope.storageKey);\n\n\n $scope.queryData = null;\n $scope.resultCache = JSON.parse(resultCacheString);\n\n try {\n $scope.queryData = JSON.parse(queryDataString);\n\n if ($scope.queryData == null || $scope.queryData.pages.length == 0) {\n $scope.initialize();\n }\n\n var queryPage = $scope.queryData.pages[$scope.queryData.activeTab];\n\n if ($scope.resultCache != null && $scope.resultCache[queryPage.name] != null) {\n $scope.editor.result = $scope.resultCache[queryPage.name];\n } else {\n $scope.editor.result = null;\n }\n\n }\n\n\n catch (e) {\n // Could not parse query data, create new!\n $scope.initialize();\n }\n\n var initialHash = $location.hash();\n if (initialHash && initialHash.startsWith('query')) {\n var initialTab = parseInt(initialHash.replace('query', '')) - 1;\n if (!isNaN(initialTab) &&\n initialTab >= 0 &&\n initialTab < $scope.queryData.pages.length) {\n $scope.queryData.activeTab = initialTab;\n }\n }\n\n $scope.editor.query = $scope.editor.exampleQueries[0];\n\n $scope.send = async function () {\n\n var queryPage = $scope.queryData.pages[$scope.queryData.activeTab];\n\n try {\n\n var res = await $http.post(queryPage.endpoint, { query: queryPage.query });\n\n if ($scope.resultCache == null) {\n $scope.resultCache = {};\n }\n\n $scope.resultCache[queryPage.name] = res.data;\n $scope.saveResultCache();\n\n delete queryPage.err;\n $scope.editor.result = res.data;\n } catch (err) {\n console.log(err);\n queryPage.err = err;\n }\n\n $scope.$apply();\n }\n\n $scope.insertExampleQuery = function (query) {\n $scope.editor.query = query;\n }\n\n}\n\nmodule.exports = SparqlEditorController;\n\n\n//# sourceURL=webpack://databus-webapp/./js/page-controller/sparql-editor-controller.js?"); +eval("{var DatabusWebappUtils = __webpack_require__(/*! ../utils/databus-webapp-utils */ \"./js/utils/databus-webapp-utils.js\");\nconst SparqlExamples = __webpack_require__(/*! ../utils/sparql-examples */ \"./js/utils/sparql-examples.js\");\n\n// Controller for the header section\nfunction SparqlEditorController($scope, $http, $location) {\n\n\n $scope.storageKey = `${DATABUS_RESOURCE_BASE_URL}/sparql`;\n\n $scope.auth = data.auth;\n $scope.authenticated = data.auth.authenticated;\n $scope.utils = new DatabusWebappUtils($scope);\n\n\n $scope.editor = {};\n\n\n\n $scope.$on('$locationChangeSuccess', function () {\n var hash = $location.hash();\n\n if (hash && hash.startsWith('query')) {\n var tabIndex = parseInt(hash.replace('query', '')) - 1;\n\n // Only change if the tab exists and is different from current\n if (!isNaN(tabIndex) &&\n tabIndex >= 0 &&\n tabIndex < $scope.queryData.pages.length &&\n $scope.queryData.activeTab !== tabIndex) {\n $scope.goToTab(tabIndex);\n $scope.$applyAsync();\n }\n }\n });\n\n $scope.editor.exampleQueries = {};\n $scope.editor.exampleQueries.label = \"Databus Example Queries\";\n $scope.editor.exampleQueries.children = [];\n\n var simpleQueries = {\n label: \"Simple Queries\",\n children: []\n };\n\n var intermediateQueries = {\n label: \"Intermediate Queries\",\n children: []\n };\n\n simpleQueries.children.push({\n label: \"Select all Databus Groups\",\n query: `PREFIX databus: \nPREFIX rdf: \nPREFIX rdfs: \nPREFIX dct: \nPREFIX dcat: \nPREFIX sec: \nPREFIX cert: \nPREFIX foaf: \nPREFIX databus-cv: \nPREFIX dbo: \n\nSELECT DISTINCT * WHERE {\n ?s a databus:Group .\n}`\n });\n\n simpleQueries.children.push({\n label: \"Select all Databus Artifacts\",\n query: `PREFIX databus: \nPREFIX rdf: \nPREFIX rdfs: \nPREFIX dct: \nPREFIX dcat: \nPREFIX sec: \nPREFIX cert: \nPREFIX foaf: \nPREFIX databus-cv: \nPREFIX dbo: \n\nSELECT DISTINCT * WHERE {\n ?s a databus:Artifact .\n}`\n });\n\n simpleQueries.children.push({\n label: \"Select all Databus Versions\",\n query: `PREFIX databus: \nPREFIX rdf: \nPREFIX rdfs: \nPREFIX dct: \nPREFIX dcat: \nPREFIX sec: \nPREFIX cert: \nPREFIX foaf: \nPREFIX databus-cv: \nPREFIX dbo: \n\nSELECT DISTINCT * WHERE {\n ?s a databus:Version .\n}`\n });\n\n intermediateQueries.children.push({\n label: \"Latest Version of Artifact\",\n query: `PREFIX databus: \nPREFIX rdf: \nPREFIX rdfs: \nPREFIX dct: \nPREFIX dcat: \nPREFIX sec: \nPREFIX cert: \nPREFIX foaf: \nPREFIX databus-cv: \nPREFIX dbo: \n\nSELECT ?version WHERE\n{\n GRAPH ?g\n {\n ?version databus:artifact .\n ?version dct:hasVersion ?v . \n }\n} \nORDER BY DESC (STR(?v)) LIMIT 1`\n });\n\n\n $scope.editor.exampleQueries.children.push(simpleQueries);\n $scope.editor.exampleQueries.children.push(intermediateQueries);\n\n $scope.onExampleQueryClicked = function (node) {\n\n if (node.query == null) {\n return;\n }\n\n $scope.createQueryPage();\n\n var queryPage = $scope.queryData.pages[$scope.queryData.activeTab];\n\n queryPage.query = node.query;\n $scope.saveToStorage();\n }\n\n $scope.goToTab = function (index) {\n $scope.queryData.activeTab = index;\n $scope.saveToStorage();\n\n $location.hash(`query${index + 1}`);\n\n\n var queryPage = $scope.queryData.pages[$scope.queryData.activeTab];\n\n if ($scope.resultCache != null && $scope.resultCache[queryPage.name] != null) {\n $scope.editor.result = $scope.resultCache[queryPage.name];\n } else {\n $scope.editor.result = null;\n }\n }\n\n $scope.saveToStorage = function () {\n localStorage.setItem($scope.storageKey, JSON.stringify($scope.queryData));\n }\n\n $scope.deleteQueryPage = function ($index) {\n\n // Delete result cache entry\n var queryPage = $scope.queryData.pages[$scope.queryData.activeTab];\n if ($scope.resultCache != null && $scope.resultCache[queryPage.name] != null) {\n delete $scope.resultCache[queryPage.name];\n $scope.saveResultCache();\n }\n\n $scope.queryData.pages.splice($index, 1);\n\n if ($scope.queryData.pages.length == 0) {\n $scope.initialize();\n }\n else {\n var validTab = Math.min($scope.queryData.activeTab, $scope.queryData.pages.length - 1);\n\n if (validTab != $scope.queryData.activeTab) {\n $scope.goToTab(validTab);\n }\n }\n }\n\n $scope.createQueryPage = function () {\n\n var queryName = null;\n var queryNameIndex = 1;\n\n // find unoccupied name\n while (queryNameIndex < 100000) {\n\n // Create a candidate\n var hasName = true;\n queryName = `Query ${queryNameIndex}`;\n\n // Check if already in use\n for (var queryPage of $scope.queryData.pages) {\n if (queryPage.name == queryName) {\n hasName = false;\n }\n }\n\n // Found name, stop searching.\n if (hasName) {\n break;\n }\n\n queryNameIndex++;\n }\n\n $scope.queryData.pages.push({\n name: queryName,\n query: simpleQueries.children[0].query,\n endpoint: defaultEndpoint\n });\n\n $scope.goToTab($scope.queryData.pages.length - 1);\n\n $scope.saveToStorage();\n }\n\n $scope.saveResultCache = function () {\n sessionStorage.setItem($scope.storageKey, JSON.stringify($scope.resultCache));\n }\n\n $scope.initialize = function () {\n $scope.queryData = {};\n $scope.queryData.activeTab = 0;\n $scope.queryData.pages = [];\n $scope.createQueryPage();\n\n $scope.resultCache = {};\n $scope.saveResultCache();\n }\n\n var defaultEndpoint = `${DATABUS_RESOURCE_BASE_URL}/sparql`;\n\n var queryDataString = localStorage.getItem($scope.storageKey);\n var resultCacheString = sessionStorage.getItem($scope.storageKey);\n\n\n $scope.queryData = null;\n $scope.resultCache = JSON.parse(resultCacheString);\n\n try {\n $scope.queryData = JSON.parse(queryDataString);\n\n if ($scope.queryData == null || $scope.queryData.pages.length == 0) {\n $scope.initialize();\n }\n\n var queryPage = $scope.queryData.pages[$scope.queryData.activeTab];\n\n if ($scope.resultCache != null && $scope.resultCache[queryPage.name] != null) {\n $scope.editor.result = $scope.resultCache[queryPage.name];\n } else {\n $scope.editor.result = null;\n }\n\n }\n\n\n catch (e) {\n // Could not parse query data, create new!\n $scope.initialize();\n }\n\n var initialHash = $location.hash();\n if (initialHash && initialHash.startsWith('query')) {\n var initialTab = parseInt(initialHash.replace('query', '')) - 1;\n if (!isNaN(initialTab) &&\n initialTab >= 0 &&\n initialTab < $scope.queryData.pages.length) {\n $scope.queryData.activeTab = initialTab;\n }\n }\n\n $scope.editor.query = $scope.editor.exampleQueries[0];\n\n $scope.send = async function () {\n\n var queryPage = $scope.queryData.pages[$scope.queryData.activeTab];\n\n try {\n\n var res = await $http.post(queryPage.endpoint, { query: queryPage.query });\n\n if ($scope.resultCache == null) {\n $scope.resultCache = {};\n }\n\n $scope.resultCache[queryPage.name] = res.data;\n $scope.saveResultCache();\n\n delete queryPage.err;\n $scope.editor.result = res.data;\n } catch (err) {\n console.log(err);\n queryPage.err = err;\n }\n\n $scope.$apply();\n }\n\n $scope.insertExampleQuery = function (query) {\n $scope.editor.query = query;\n }\n\n}\n\nmodule.exports = SparqlEditorController;\n\n\n//# sourceURL=webpack://databus-webapp/./js/page-controller/sparql-editor-controller.js?\n}"); -/***/ }), +/***/ }, -/***/ "./js/page-controller/user-settings-controller.js": +/***/ "./js/page-controller/user-settings-controller.js" /*!********************************************************!*\ !*** ./js/page-controller/user-settings-controller.js ***! \********************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +(module, __unused_webpack_exports, __webpack_require__) { -eval("const DatabusAlert = __webpack_require__(/*! ../components/databus-alert/databus-alert */ \"./js/components/databus-alert/databus-alert.js\");\nconst DatabusUris = __webpack_require__(/*! ../utils/databus-uris */ \"./js/utils/databus-uris.js\");\nconst DatabusUtils = __webpack_require__(/*! ../utils/databus-utils */ \"./js/utils/databus-utils.js\");\nconst JsonldUtils = __webpack_require__(/*! ../utils/jsonld-utils */ \"./js/utils/jsonld-utils.js\");\nconst TabNavigation = __webpack_require__(/*! ../utils/tab-navigation */ \"./js/utils/tab-navigation.js\");\n\nfunction UserSettingsController($scope, $http, $sce, $location) {\n $scope.auth = data.auth;\n $scope.accounts = data.accounts;\n\n $scope.inputs = {};\n\n $scope.inputs.newAccountLabel = \"\";\n $scope.inputs.newAccountName = \"\";\n $scope.inputs.newApiKeyName = \"\";\n\n $scope.tabNavigation = new TabNavigation($scope, $location, [\n ''\n ], function (index) {\n $scope.activeAccount = $scope.accounts[index - 1];\n });\n\n $scope.$watchCollection('accounts', function (newAccounts) {\n const accountNames = newAccounts.map(a => a.accountName);\n $scope.tabNavigation.tabKeys = [''].concat(accountNames);\n\n const currentHash = $location.hash();\n\n $scope.tabNavigation.onLocationHashChanged(currentHash, currentHash)\n\n if (currentHash && !$scope.tabNavigation.tabKeys.includes(currentHash)) {\n $location.hash('');\n }\n });\n\n // Iterate over each account and load its data\n $scope.accounts.forEach(function (account) {\n // Set loading state\n account.loading = true;\n\n var requestParams = {\n method: 'GET',\n url: '/' + encodeURIComponent(account.accountName),\n headers: {\n 'Accept': 'application/ld+json',\n 'X-Jsonld-Formatting': 'flatten'\n }\n }\n\n // Perform HTTP GET request to fetch additional data\n $http(requestParams)\n .then(function (response) {\n // Set loading to false when data is received\n account.loading = false;\n\n // Store additional info (stub)\n var graphs = response.data;\n var personGraph = JsonldUtils.getTypedGraph(graphs, DatabusUris.FOAF_PERSON);\n\n account.uri = `${DATABUS_RESOURCE_BASE_URL}/${account.accountName}`;\n account.label = JsonldUtils.getFirstProperty(personGraph, DatabusUris.FOAF_NAME);\n account.status = JsonldUtils.getFirstProperty(personGraph, DatabusUris.FOAF_STATUS);\n account.imageUrl = JsonldUtils.getProperty(personGraph, DatabusUris.FOAF_IMG);\n account.secretaries = [];\n\n let accountGraph = JsonldUtils.getTypedGraph(graphs, DatabusUris.DATABUS_ACCOUNT);\n let secretaryIds = JsonldUtils.getRefArrayProperty(accountGraph, DatabusUris.DATABUS_SECRETARY_PROPERTY);\n\n for (let secretaryId of secretaryIds) {\n let secretaryGraph = JsonldUtils.getGraphById(graphs, secretaryId);\n\n let secretary = {};\n secretary.accountName = DatabusUtils.uriToName(JsonldUtils.getProperty(secretaryGraph, DatabusUris.DATABUS_ACCOUNT_PROPERTY));\n secretary.hasWriteAccessTo = JsonldUtils.getRefArrayProperty(secretaryGraph, DatabusUris.DATABUS_HAS_WRITE_ACCESS_TO);\n\n account.secretaries.push(secretary);\n }\n\n })\n .catch(function (error) {\n // Handle error and set loading to false\n account.loading = false;\n console.error('Failed to load account data for', account.name, error);\n });\n });\n\n // Button click handler to add account\n $scope.addAccount = async function () {\n\n try {\n\n await $http.post(`/api/account/create`, {\n name: $scope.inputs.newAccountName,\n label: $scope.inputs.newAccountLabel\n });\n\n $scope.accounts.push({\n label: $scope.inputs.newAccountLabel,\n accountName: $scope.inputs.newAccountName,\n uri: `${DATABUS_RESOURCE_BASE_URL}/${$scope.inputs.newAccountName}`\n });\n\n DatabusAlert.alert($scope, true, \"Account created.\");\n\n } catch (err) {\n console.error(err);\n DatabusAlert.alert($scope, false, err.data);\n }\n };\n\n // Button click handler to save account\n $scope.saveAccount = async function (account) {\n try {\n await $http.post(`/api/account/update`, account);\n DatabusAlert.alert($scope, true, \"Account saved.\");\n\n } catch (err) {\n console.error(err);\n DatabusAlert.alert($scope, false, err.data);\n }\n\n };\n\n // Button click handler to delete account\n $scope.deleteAccount = async function (account) {\n try {\n // Find index of the account using accountName\n const index = $scope.accounts.findIndex(acc => acc.accountName === account.accountName);\n\n if (index === -1) {\n throw new Error(`Account with name \"${account.accountName}\" not found.`);\n }\n\n console.log(\"Deleting account with accountName:\", account.accountName);\n\n // Send delete request to server\n await $http.post(`/api/account/delete`, account);\n\n // Show success alert\n DatabusAlert.alert($scope, true, \"Account deleted.\");\n\n // Remove account from local array\n $scope.accounts.splice(index, 1);\n\n } catch (err) {\n console.error(err);\n const message = err.data || err.message || \"Unknown error occurred.\";\n DatabusAlert.alert($scope, false, message);\n }\n };\n\n\n\n\n $scope.goToUserSettings = function (accountName) {\n window.location.href = '/' + encodeURIComponent(accountName) + '#settings';\n }\n\n $scope.addWriteAccessUrl = function (account) {\n account.writeAccess.push('');\n };\n\n $scope.removeWriteAccessUrl = function (account, index) {\n account.writeAccess.splice(index, 1);\n };\n\n $scope.addApiKey = async function (account) {\n // Validate the name input only\n\n if (!$scope.inputs.newApiKeyName) {\n DatabusAlert.alert(\"API key name must be provided.\");\n return;\n }\n\n const postData = {\n accountName: account.accountName,\n name: $scope.inputs.newApiKeyName\n };\n\n try {\n // Send POST request to create the API key\n let response = await $http.post('/api/account/api-key/create', postData);\n\n if (response.data && response.data.apikey && response.data.keyname) {\n // Append new key to the list\n account.apiKeys.push({\n keyname: response.data.keyname,\n apikey: response.data.apikey\n });\n\n // Clear the name input field\n $scope.inputs.newApiKeyName = '';\n\n DatabusAlert.alert($scope, true, \"API key created.\");\n } else {\n DatabusAlert.alert($scope, false, \"Failed to create API key.\");\n }\n\n } catch (error) {\n console.error('Error creating API key:', error);\n const message = err.data || err.message || \"Unknown error occurred.\";\n DatabusAlert.alert($scope, false, message);\n }\n };\n\n\n $scope.deleteApiKey = async function (account, apiKey) {\n try {\n // Find index of the account using accountName\n const index = account.apiKeys.findIndex(key => key.keyname === apiKey.keyname);\n\n if (index === -1) {\n throw new Error(`API key with name \"${apiKey.keyname}\" not found.`);\n }\n\n console.log(\"Deleting API key with keyname:\", apiKey.keyname);\n\n // Send delete request to server\n await $http.post(`/api/account/api-key/delete`, { accountName: account.accountName, keyname: apiKey.keyname });\n account.apiKeys.splice(index, 1);\n\n // Show success alert\n DatabusAlert.alert($scope, true, \"API key deleted.\");\n\n } catch (err) {\n console.error(err);\n\n\n\n const message = err.data || err.message || \"Unknown error occurred.\";\n DatabusAlert.alert($scope, false, message);\n }\n };\n\n $scope.addSecretary = function (account) {\n if (!account.secretaries) {\n account.secretaries = [];\n }\n\n account.secretaries.push({\n accountName: '',\n hasWriteAccessTo: []\n });\n };\n\n $scope.removeSecretary = function (account, index) {\n account.secretaries.splice(index, 1);\n };\n\n $scope.addNamespace = function (account, secIndex) {\n account.secretaries[secIndex].hasWriteAccessTo.push('');\n };\n\n $scope.removeNamespace = function (account, secIndex, nsIndex) {\n account.secretaries[secIndex].hasWriteAccessTo.splice(nsIndex, 1);\n };\n}\n\nmodule.exports = UserSettingsController;\n\n//# sourceURL=webpack://databus-webapp/./js/page-controller/user-settings-controller.js?"); +eval("{const DatabusAlert = __webpack_require__(/*! ../components/databus-alert/databus-alert */ \"./js/components/databus-alert/databus-alert.js\");\nconst DatabusUris = __webpack_require__(/*! ../utils/databus-uris */ \"./js/utils/databus-uris.js\");\nconst DatabusUtils = __webpack_require__(/*! ../utils/databus-utils */ \"./js/utils/databus-utils.js\");\nconst JsonldUtils = __webpack_require__(/*! ../utils/jsonld-utils */ \"./js/utils/jsonld-utils.js\");\nconst TabNavigation = __webpack_require__(/*! ../utils/tab-navigation */ \"./js/utils/tab-navigation.js\");\n\nfunction UserSettingsController($scope, $http, $sce, $location) {\n $scope.auth = data.auth;\n $scope.accounts = data.accounts;\n\n $scope.inputs = {};\n\n $scope.inputs.newAccountLabel = \"\";\n $scope.inputs.newAccountName = \"\";\n $scope.inputs.newApiKeyName = \"\";\n\n $scope.tabNavigation = new TabNavigation($scope, $location, [\n ''\n ], function (index) {\n $scope.activeAccount = $scope.accounts[index - 1];\n });\n\n $scope.$watchCollection('accounts', function (newAccounts) {\n const accountNames = newAccounts.map(a => a.accountName);\n $scope.tabNavigation.tabKeys = [''].concat(accountNames);\n\n const currentHash = $location.hash();\n\n $scope.tabNavigation.onLocationHashChanged(currentHash, currentHash)\n\n if (currentHash && !$scope.tabNavigation.tabKeys.includes(currentHash)) {\n $location.hash('');\n }\n });\n\n // Iterate over each account and load its data\n $scope.accounts.forEach(function (account) {\n // Set loading state\n account.loading = true;\n\n var requestParams = {\n method: 'GET',\n url: '/' + encodeURIComponent(account.accountName),\n headers: {\n 'Accept': 'application/ld+json',\n 'X-Jsonld-Formatting': 'flatten'\n }\n }\n\n // Perform HTTP GET request to fetch additional data\n $http(requestParams)\n .then(function (response) {\n // Set loading to false when data is received\n account.loading = false;\n\n // Store additional info (stub)\n var graphs = response.data;\n var personGraph = JsonldUtils.getTypedGraph(graphs, DatabusUris.FOAF_PERSON);\n\n account.uri = `${DATABUS_RESOURCE_BASE_URL}/${account.accountName}`;\n account.label = JsonldUtils.getFirstProperty(personGraph, DatabusUris.FOAF_NAME);\n account.status = JsonldUtils.getFirstProperty(personGraph, DatabusUris.FOAF_STATUS);\n account.imageUrl = JsonldUtils.getProperty(personGraph, DatabusUris.FOAF_IMG);\n account.secretaries = [];\n\n let accountGraph = JsonldUtils.getTypedGraph(graphs, DatabusUris.DATABUS_ACCOUNT);\n let secretaryIds = JsonldUtils.getRefArrayProperty(accountGraph, DatabusUris.DATABUS_SECRETARY_PROPERTY);\n\n for (let secretaryId of secretaryIds) {\n let secretaryGraph = JsonldUtils.getGraphById(graphs, secretaryId);\n\n let secretary = {};\n secretary.accountName = DatabusUtils.uriToName(JsonldUtils.getProperty(secretaryGraph, DatabusUris.DATABUS_ACCOUNT_PROPERTY));\n secretary.hasWriteAccessTo = JsonldUtils.getRefArrayProperty(secretaryGraph, DatabusUris.DATABUS_HAS_WRITE_ACCESS_TO);\n\n account.secretaries.push(secretary);\n }\n\n })\n .catch(function (error) {\n // Handle error and set loading to false\n account.loading = false;\n console.error('Failed to load account data for', account.name, error);\n });\n });\n\n // Button click handler to add account\n $scope.addAccount = async function () {\n\n try {\n\n await $http.post(`/api/account/create`, {\n name: $scope.inputs.newAccountName,\n label: $scope.inputs.newAccountLabel\n });\n\n $scope.accounts.push({\n label: $scope.inputs.newAccountLabel,\n accountName: $scope.inputs.newAccountName,\n uri: `${DATABUS_RESOURCE_BASE_URL}/${$scope.inputs.newAccountName}`\n });\n\n DatabusAlert.alert($scope, true, \"Account created.\");\n\n } catch (err) {\n console.error(err);\n DatabusAlert.alert($scope, false, err.data);\n }\n };\n\n // Button click handler to save account\n $scope.saveAccount = async function (account) {\n try {\n await $http.post(`/api/account/update`, account);\n DatabusAlert.alert($scope, true, \"Account saved.\");\n\n } catch (err) {\n console.error(err);\n DatabusAlert.alert($scope, false, err.data);\n }\n\n };\n\n // Button click handler to delete account\n $scope.deleteAccount = async function (account) {\n try {\n // Find index of the account using accountName\n const index = $scope.accounts.findIndex(acc => acc.accountName === account.accountName);\n\n if (index === -1) {\n throw new Error(`Account with name \"${account.accountName}\" not found.`);\n }\n\n console.log(\"Deleting account with accountName:\", account.accountName);\n\n // Send delete request to server\n await $http.post(`/api/account/delete`, account);\n\n // Show success alert\n DatabusAlert.alert($scope, true, \"Account deleted.\");\n\n // Remove account from local array\n $scope.accounts.splice(index, 1);\n\n } catch (err) {\n console.error(err);\n const message = err.data || err.message || \"Unknown error occurred.\";\n DatabusAlert.alert($scope, false, message);\n }\n };\n\n\n\n\n $scope.goToUserSettings = function (accountName) {\n window.location.href = '/' + encodeURIComponent(accountName) + '#settings';\n }\n\n $scope.addWriteAccessUrl = function (account) {\n account.writeAccess.push('');\n };\n\n $scope.removeWriteAccessUrl = function (account, index) {\n account.writeAccess.splice(index, 1);\n };\n\n $scope.addApiKey = async function (account) {\n // Validate the name input only\n\n if (!$scope.inputs.newApiKeyName) {\n DatabusAlert.alert(\"API key name must be provided.\");\n return;\n }\n\n const postData = {\n accountName: account.accountName,\n name: $scope.inputs.newApiKeyName\n };\n\n try {\n // Send POST request to create the API key\n let response = await $http.post('/api/account/api-key/create', postData);\n\n if (response.data && response.data.apikey && response.data.keyname) {\n // Append new key to the list\n account.apiKeys.push({\n keyname: response.data.keyname,\n apikey: response.data.apikey\n });\n\n // Clear the name input field\n $scope.inputs.newApiKeyName = '';\n\n DatabusAlert.alert($scope, true, \"API key created.\");\n } else {\n DatabusAlert.alert($scope, false, \"Failed to create API key.\");\n }\n\n } catch (error) {\n console.error('Error creating API key:', error);\n const message = err.data || err.message || \"Unknown error occurred.\";\n DatabusAlert.alert($scope, false, message);\n }\n };\n\n\n $scope.deleteApiKey = async function (account, apiKey) {\n try {\n // Find index of the account using accountName\n const index = account.apiKeys.findIndex(key => key.keyname === apiKey.keyname);\n\n if (index === -1) {\n throw new Error(`API key with name \"${apiKey.keyname}\" not found.`);\n }\n\n console.log(\"Deleting API key with keyname:\", apiKey.keyname);\n\n // Send delete request to server\n await $http.post(`/api/account/api-key/delete`, { accountName: account.accountName, keyname: apiKey.keyname });\n account.apiKeys.splice(index, 1);\n\n // Show success alert\n DatabusAlert.alert($scope, true, \"API key deleted.\");\n\n } catch (err) {\n console.error(err);\n\n\n\n const message = err.data || err.message || \"Unknown error occurred.\";\n DatabusAlert.alert($scope, false, message);\n }\n };\n\n $scope.addSecretary = function (account) {\n if (!account.secretaries) {\n account.secretaries = [];\n }\n\n account.secretaries.push({\n accountName: '',\n hasWriteAccessTo: []\n });\n };\n\n $scope.removeSecretary = function (account, index) {\n account.secretaries.splice(index, 1);\n };\n\n $scope.addNamespace = function (account, secIndex) {\n account.secretaries[secIndex].hasWriteAccessTo.push('');\n };\n\n $scope.removeNamespace = function (account, secIndex, nsIndex) {\n account.secretaries[secIndex].hasWriteAccessTo.splice(nsIndex, 1);\n };\n}\n\nmodule.exports = UserSettingsController;\n\n//# sourceURL=webpack://databus-webapp/./js/page-controller/user-settings-controller.js?\n}"); -/***/ }), +/***/ }, -/***/ "./js/page-controller/version-controller.js": +/***/ "./js/page-controller/version-controller.js" /*!**************************************************!*\ !*** ./js/page-controller/version-controller.js ***! \**************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +(module, __unused_webpack_exports, __webpack_require__) { -eval("const DatabusWebappUtils = __webpack_require__(/*! ../utils/databus-webapp-utils */ \"./js/utils/databus-webapp-utils.js\");\nconst JsonldUtils = __webpack_require__(/*! ../utils/jsonld-utils */ \"./js/utils/jsonld-utils.js\");\nconst DatabusUtils = __webpack_require__(/*! ../utils/databus-utils */ \"./js/utils/databus-utils.js\");\nconst DatabusAlert = __webpack_require__(/*! ../components/databus-alert/databus-alert */ \"./js/components/databus-alert/databus-alert.js\");\nconst QueryNode = __webpack_require__(/*! ../query-builder/query-node */ \"./js/query-builder/query-node.js\");\nconst TabNavigation = __webpack_require__(/*! ../utils/tab-navigation */ \"./js/utils/tab-navigation.js\");\nconst DatabusUris = __webpack_require__(/*! ../utils/databus-uris */ \"./js/utils/databus-uris.js\");\nconst DataIdCreator = __webpack_require__(/*! ../publish/dataid-creator */ \"./js/publish/dataid-creator.js\");\nconst QueryTemplates = __webpack_require__(/*! ../query-builder/query-templates */ \"./js/query-builder/query-templates.js\");\nconst DatabusCollectionWrapper = __webpack_require__(/*! ../collections/databus-collection-wrapper */ \"./js/collections/databus-collection-wrapper.js\");\nconst QueryBuilder = __webpack_require__(/*! ../query-builder/query-builder */ \"./js/query-builder/query-builder.js\");\nconst AppJsonFormatter = __webpack_require__(/*! ../utils/app-json-formatter */ \"./js/utils/app-json-formatter.js\");\n\nfunction VersionPageController($scope, $http, $sce, $location, collectionManager) {\n\n $scope.navigation = new TabNavigation($scope, $location, [\n 'files', 'mods', 'edit'\n ]);\n\n $scope.auth = data.auth;\n $scope.utils = new DatabusWebappUtils($scope, $sce);\n $scope.accountName = $scope.utils.getAccountName();\n\n $scope.collectionManager = collectionManager;\n $scope.authenticated = data.auth.authenticated;\n $scope.versionGraph = data.graph;\n $scope.version = AppJsonFormatter.formatVersionData(data.graph);\n\n $scope.queryResult = {};\n $scope.addToCollectionQuery = \"\";\n $scope.collectionModalVisible = false;\n\n $scope.publisherName = DatabusUtils.uriToName(DatabusUtils.navigateUp($scope.version.uri, 3));\n $scope.canEdit = $scope.accountName != null;\n\n if (data.auth.authenticated && $scope.canEdit) {\n\n $scope.licenseQuery = \"\";\n $scope.filterLicenses = function (licenseQuery) {\n\n if (data.licenseData == null) {\n return;\n }\n\n // billo-suche mit lowercase und tokenization \n var tokens = licenseQuery.toLowerCase().split(' ');\n $scope.filteredLicenseList = data.licenseData.results.bindings.filter(function (l) {\n for (var token of tokens) {\n if (!l.title.value.toLowerCase().includes(token)) {\n return false;\n }\n }\n\n return true;\n });\n }\n\n $scope.filterLicenses(\"\");\n\n $scope.formData = {};\n\n $scope.formData.group = {};\n $scope.formData.group.name = DatabusUtils.uriToName(DatabusUtils.navigateUp($scope.version.uri, 2));\n\n $scope.formData.artifact = {};\n $scope.formData.artifact.name = DatabusUtils.uriToName(DatabusUtils.navigateUp($scope.version.uri, 1));\n\n var abstract = DatabusUtils.createAbstractFromDescription($scope.version.description);\n\n $scope.formData.version = {};\n $scope.formData.version.generateAbstract = abstract == $scope.version.abstract;\n $scope.formData.version.name = $scope.version.name;\n $scope.formData.version.title = $scope.version.title;\n $scope.formData.version.abstract = $scope.version.abstract;\n $scope.formData.version.description = $scope.version.description;\n $scope.formData.version.license = $scope.version.license;\n $scope.formData.version.attribution = $scope.version.attribution;\n $scope.formData.version.wasDerivedFrom = $scope.version.wasDerivedFrom;\n\n $scope.formData.signature = {};\n $scope.formData.signature.autoGenerateSignature = true;\n $scope.formData.signature.selectedPublisherUri = $scope.version.publisher;\n\n $scope.dataidCreator = new DataIdCreator($scope.formData, data.auth.info.accountName);\n }\n\n $scope.onDescriptionChanged = function () {\n if ($scope.formData == null) {\n return;\n }\n\n if (!$scope.formData.version.generateAbstract) {\n return;\n }\n\n $scope.formData.version.abstract =\n DatabusUtils.createAbstractFromDescription($scope.formData.version.description);\n }\n\n $scope.resetEdits = function () {\n $scope.formData.version.title = $scope.version.title;\n $scope.formData.version.abstract = $scope.version.abstract;\n $scope.formData.version.description = $scope.version.description;\n }\n\n $scope.saveVersion = async function () {\n\n try {\n if ($scope.dataidCreator == null) {\n return;\n }\n var relativeUri = new URL($scope.version.uri).pathname;\n\n var response = await $http({\n method: 'GET',\n url: relativeUri,\n headers: {\n 'Accept': 'application/ld+json',\n 'X-Jsonld-Formatting': 'flatten'\n }\n });\n\n var graphs = response.data;\n var versionGraph = JsonldUtils.getTypedGraph(graphs, DatabusUris.DATABUS_VERSION);\n\n JsonldUtils.setLiteral(versionGraph, DatabusUris.DCT_TITLE, DatabusUris.XSD_STRING,\n $scope.formData.version.title);\n JsonldUtils.setLiteral(versionGraph, DatabusUris.DCT_ABSTRACT, DatabusUris.XSD_STRING,\n $scope.formData.version.abstract);\n JsonldUtils.setLiteral(versionGraph, DatabusUris.DCT_DESCRIPTION, DatabusUris.XSD_STRING,\n $scope.formData.version.description);\n JsonldUtils.setLink(versionGraph, DatabusUris.DCT_LICENSE, $scope.formData.version.license);\n JsonldUtils.setLiteral(versionGraph, DatabusUris.DATABUS_ATTRIBUTION, DatabusUris.XSD_STRING,\n $scope.formData.version.attribution);\n\n if ($scope.formData.version.wasDerivedFrom) {\n JsonldUtils.setLink(versionGraph, DatabusUris.PROV_WAS_DERIVED_FROM,\n $scope.formData.version.wasDerivedFrom);\n }\n\n var response = await $http.put(`/api/register`, graphs);\n\n if (response.status == 200) {\n $scope.version.title = $scope.formData.version.title;\n $scope.version.abstract = $scope.formData.version.abstract;\n $scope.version.description = $scope.formData.version.description;\n $scope.version.license = $scope.formData.version.license;\n $scope.version.attribution = $scope.formData.version.attribution;\n $scope.version.wasDerivedFrom = $scope.formData.version.wasDerivedFrom;\n\n DatabusAlert.alert($scope, true, \"Version Saved!\");\n $scope.$apply();\n }\n } catch (err) {\n DatabusAlert.alert($scope, false, \"Failed to save version!\");\n }\n }\n\n $scope.modsAmountMinimized = 5;\n $scope.modsMaxAmount = $scope.modsAmountMinimized;\n\n $scope.showAllMods = function () {\n $scope.modsMaxAmount = 10000000;\n }\n\n $scope.hideAllMods = function () {\n $scope.modsMaxAmount = $scope.modsAmountMinimized;\n }\n\n $scope.fileSelector = {};\n $scope.fileSelector.config = {};\n $scope.fileSelector.config.authenticated = $scope.authenticated;\n $scope.fileSelector.config.columns = [];\n $scope.fileSelector.config.columns.push({ field: 'variant', label: 'Variant', width: '45%' });\n $scope.fileSelector.config.columns.push({ field: 'format', label: 'Format', width: '15%' });\n $scope.fileSelector.config.columns.push({ field: 'compression', label: 'Compression', width: '15%' });\n\n $scope.artifactNode = new QueryNode($scope.version.artifact, 'databus:artifact');\n $scope.artifactNode.setFacet('http://purl.org/dc/terms/hasVersion', $scope.version.name, true);\n\n $scope.groupNode = new QueryNode(DatabusUtils.navigateUp($scope.version.artifact), 'databus:group');\n $scope.groupNode.addChild($scope.artifactNode);\n\n $scope.collectionWidgetSelectionData = {};\n $scope.collectionWidgetSelectionData.groupNode = $scope.groupNode;\n\n $scope.onFacetSettingsChanged = function () {\n $scope.fileSelector.query = QueryBuilder.build({\n node: $scope.artifactNode,\n template: QueryTemplates.DEFAULT_FILE_TEMPLATE,\n resourceBaseUrl: DATABUS_RESOURCE_BASE_URL\n });\n\n $scope.fileSelector.fullQuery = QueryBuilder.build({\n node: $scope.artifactNode,\n template: QueryTemplates.GROUP_PAGE_FILE_BROWSER_TEMPLATE,\n resourceBaseUrl: DATABUS_RESOURCE_BASE_URL\n });\n }\n\n $scope.onFacetSettingsChanged();\n\n $scope.hideAutofill = function () {\n $scope.fileSelector.clearAutofill(function () {\n $scope.$apply();\n });\n }\n\n $scope.onFileSelectionChanged = function (numFiles, totalSize, query) {\n $scope.addToCollectionQuery = query;\n }\n\n $scope.showCollectionModal = function () {\n $scope.collectionModalVisible = true;\n }\n\n $scope.hideCollectionModal = function () {\n $scope.collectionModalVisible = false;\n }\n\n $scope.addFilter = function (selected, key) {\n $scope.fileSelector.addFilter(selected, key);\n $scope.updateQueryBuilder();\n }\n\n $scope.addQueryToCollection = function () {\n $scope.collectionManager.addElement($scope.queryBuilder.query);\n $scope.hideCollectionModal();\n };\n\n $scope.addQueryToCollection = function () {\n\n if ($scope.collectionManager.activeCollection == null) {\n return;\n }\n\n var wrapper = new DatabusCollectionWrapper($scope.collectionManager.activeCollection);\n wrapper.addCustomQueryNode('Select ' + $scope.versionData.label + ' files', $scope.addToCollectionQuery);\n $scope.collectionManager.saveLocally();\n $scope.collectionModalVisible = false;\n }\n\n $scope.formatMods = function (results) {\n var mods = results.replace(\",\", \" \");\n return $sce.trustAsHtml(mods);\n }\n\n $scope.formatModFile = function (uri) {\n return DatabusUtils.uriToName(uri);\n }\n\n $scope.downloadMetadataAsFile = async function () {\n var response = await $http({\n method: 'GET',\n url: $scope.version.uri,\n headers: {\n 'Accept': 'application/ld+json',\n }\n });\n\n $scope.download(`${$scope.version.name}.jsonld`, JSON.stringify(response.data, null, 3));\n }\n\n $scope.download = function (filename, text) {\n var element = document.createElement('a');\n element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text));\n element.setAttribute('download', filename);\n element.style.display = 'none';\n document.body.appendChild(element);\n\n element.click();\n\n document.body.removeChild(element);\n }\n\n\n}\n\nmodule.exports = VersionPageController;\n\n//# sourceURL=webpack://databus-webapp/./js/page-controller/version-controller.js?"); +eval("{const DatabusWebappUtils = __webpack_require__(/*! ../utils/databus-webapp-utils */ \"./js/utils/databus-webapp-utils.js\");\nconst JsonldUtils = __webpack_require__(/*! ../utils/jsonld-utils */ \"./js/utils/jsonld-utils.js\");\nconst DatabusUtils = __webpack_require__(/*! ../utils/databus-utils */ \"./js/utils/databus-utils.js\");\nconst DatabusAlert = __webpack_require__(/*! ../components/databus-alert/databus-alert */ \"./js/components/databus-alert/databus-alert.js\");\nconst QueryNode = __webpack_require__(/*! ../query-builder/query-node */ \"./js/query-builder/query-node.js\");\nconst TabNavigation = __webpack_require__(/*! ../utils/tab-navigation */ \"./js/utils/tab-navigation.js\");\nconst DatabusUris = __webpack_require__(/*! ../utils/databus-uris */ \"./js/utils/databus-uris.js\");\nconst DataIdCreator = __webpack_require__(/*! ../publish/dataid-creator */ \"./js/publish/dataid-creator.js\");\nconst QueryTemplates = __webpack_require__(/*! ../query-builder/query-templates */ \"./js/query-builder/query-templates.js\");\nconst DatabusCollectionWrapper = __webpack_require__(/*! ../collections/databus-collection-wrapper */ \"./js/collections/databus-collection-wrapper.js\");\nconst QueryBuilder = __webpack_require__(/*! ../query-builder/query-builder */ \"./js/query-builder/query-builder.js\");\nconst AppJsonFormatter = __webpack_require__(/*! ../utils/app-json-formatter */ \"./js/utils/app-json-formatter.js\");\n\nfunction VersionPageController($scope, $http, $sce, $location, collectionManager) {\n\n $scope.navigation = new TabNavigation($scope, $location, [\n 'files', 'mods', 'edit'\n ]);\n\n $scope.auth = data.auth;\n $scope.utils = new DatabusWebappUtils($scope, $sce);\n $scope.accountName = $scope.utils.getAccountName();\n\n $scope.collectionManager = collectionManager;\n $scope.authenticated = data.auth.authenticated;\n $scope.versionGraph = data.graph;\n $scope.version = AppJsonFormatter.formatVersionData(data.graph);\n\n $scope.queryResult = {};\n $scope.addToCollectionQuery = \"\";\n $scope.collectionModalVisible = false;\n\n $scope.publisherName = DatabusUtils.uriToName(DatabusUtils.navigateUp($scope.version.uri, 3));\n $scope.canEdit = $scope.accountName != null;\n\n if (data.auth.authenticated && $scope.canEdit) {\n\n $scope.licenseQuery = \"\";\n $scope.filterLicenses = function (licenseQuery) {\n\n if (data.licenseData == null) {\n return;\n }\n\n // billo-suche mit lowercase und tokenization \n var tokens = licenseQuery.toLowerCase().split(' ');\n $scope.filteredLicenseList = data.licenseData.results.bindings.filter(function (l) {\n for (var token of tokens) {\n if (!l.title.value.toLowerCase().includes(token)) {\n return false;\n }\n }\n\n return true;\n });\n }\n\n $scope.filterLicenses(\"\");\n\n $scope.formData = {};\n\n $scope.formData.group = {};\n $scope.formData.group.name = DatabusUtils.uriToName(DatabusUtils.navigateUp($scope.version.uri, 2));\n\n $scope.formData.artifact = {};\n $scope.formData.artifact.name = DatabusUtils.uriToName(DatabusUtils.navigateUp($scope.version.uri, 1));\n\n var abstract = DatabusUtils.createAbstractFromDescription($scope.version.description);\n\n $scope.formData.version = {};\n $scope.formData.version.generateAbstract = abstract == $scope.version.abstract;\n $scope.formData.version.name = $scope.version.name;\n $scope.formData.version.title = $scope.version.title;\n $scope.formData.version.abstract = $scope.version.abstract;\n $scope.formData.version.description = $scope.version.description;\n $scope.formData.version.license = $scope.version.license;\n $scope.formData.version.attribution = $scope.version.attribution;\n $scope.formData.version.wasDerivedFrom = $scope.version.wasDerivedFrom;\n\n $scope.formData.signature = {};\n $scope.formData.signature.autoGenerateSignature = true;\n $scope.formData.signature.selectedPublisherUri = $scope.version.publisher;\n\n $scope.dataidCreator = new DataIdCreator($scope.formData, data.auth.info.accountName);\n }\n\n $scope.onDescriptionChanged = function () {\n if ($scope.formData == null) {\n return;\n }\n\n if (!$scope.formData.version.generateAbstract) {\n return;\n }\n\n $scope.formData.version.abstract =\n DatabusUtils.createAbstractFromDescription($scope.formData.version.description);\n }\n\n $scope.resetEdits = function () {\n $scope.formData.version.title = $scope.version.title;\n $scope.formData.version.abstract = $scope.version.abstract;\n $scope.formData.version.description = $scope.version.description;\n }\n\n $scope.saveVersion = async function () {\n\n try {\n if ($scope.dataidCreator == null) {\n return;\n }\n var relativeUri = new URL($scope.version.uri).pathname;\n\n var response = await $http({\n method: 'GET',\n url: relativeUri,\n headers: {\n 'Accept': 'application/ld+json',\n 'X-Jsonld-Formatting': 'flatten'\n }\n });\n\n var graphs = response.data;\n var versionGraph = JsonldUtils.getTypedGraph(graphs, DatabusUris.DATABUS_VERSION);\n\n JsonldUtils.setLiteral(versionGraph, DatabusUris.DCT_TITLE, DatabusUris.XSD_STRING,\n $scope.formData.version.title);\n JsonldUtils.setLiteral(versionGraph, DatabusUris.DCT_ABSTRACT, DatabusUris.XSD_STRING,\n $scope.formData.version.abstract);\n JsonldUtils.setLiteral(versionGraph, DatabusUris.DCT_DESCRIPTION, DatabusUris.XSD_STRING,\n $scope.formData.version.description);\n JsonldUtils.setLink(versionGraph, DatabusUris.DCT_LICENSE, $scope.formData.version.license);\n JsonldUtils.setLiteral(versionGraph, DatabusUris.DATABUS_ATTRIBUTION, DatabusUris.XSD_STRING,\n $scope.formData.version.attribution);\n\n if ($scope.formData.version.wasDerivedFrom) {\n JsonldUtils.setLink(versionGraph, DatabusUris.PROV_WAS_DERIVED_FROM,\n $scope.formData.version.wasDerivedFrom);\n }\n\n var response = await $http.put(`/api/register`, graphs);\n\n if (response.status == 200) {\n $scope.version.title = $scope.formData.version.title;\n $scope.version.abstract = $scope.formData.version.abstract;\n $scope.version.description = $scope.formData.version.description;\n $scope.version.license = $scope.formData.version.license;\n $scope.version.attribution = $scope.formData.version.attribution;\n $scope.version.wasDerivedFrom = $scope.formData.version.wasDerivedFrom;\n\n DatabusAlert.alert($scope, true, \"Version Saved!\");\n $scope.$apply();\n }\n } catch (err) {\n DatabusAlert.alert($scope, false, \"Failed to save version!\");\n }\n }\n\n $scope.modsAmountMinimized = 5;\n $scope.modsMaxAmount = $scope.modsAmountMinimized;\n\n $scope.showAllMods = function () {\n $scope.modsMaxAmount = 10000000;\n }\n\n $scope.hideAllMods = function () {\n $scope.modsMaxAmount = $scope.modsAmountMinimized;\n }\n\n $scope.fileSelector = {};\n $scope.fileSelector.config = {};\n $scope.fileSelector.config.authenticated = $scope.authenticated;\n $scope.fileSelector.config.columns = [];\n $scope.fileSelector.config.columns.push({ field: 'variant', label: 'Variant', width: '45%' });\n $scope.fileSelector.config.columns.push({ field: 'format', label: 'Format', width: '15%' });\n $scope.fileSelector.config.columns.push({ field: 'compression', label: 'Compression', width: '15%' });\n\n $scope.artifactNode = new QueryNode($scope.version.artifact, 'databus:artifact');\n $scope.artifactNode.setFacet('http://purl.org/dc/terms/hasVersion', $scope.version.name, true);\n\n $scope.groupNode = new QueryNode(DatabusUtils.navigateUp($scope.version.artifact), 'databus:group');\n $scope.groupNode.addChild($scope.artifactNode);\n\n $scope.collectionWidgetSelectionData = {};\n $scope.collectionWidgetSelectionData.groupNode = $scope.groupNode;\n\n $scope.onFacetSettingsChanged = function () {\n $scope.fileSelector.query = QueryBuilder.build({\n node: $scope.artifactNode,\n template: QueryTemplates.DEFAULT_FILE_TEMPLATE,\n resourceBaseUrl: DATABUS_RESOURCE_BASE_URL\n });\n\n $scope.fileSelector.fullQuery = QueryBuilder.build({\n node: $scope.artifactNode,\n template: QueryTemplates.GROUP_PAGE_FILE_BROWSER_TEMPLATE,\n resourceBaseUrl: DATABUS_RESOURCE_BASE_URL\n });\n }\n\n $scope.onFacetSettingsChanged();\n\n $scope.hideAutofill = function () {\n $scope.fileSelector.clearAutofill(function () {\n $scope.$apply();\n });\n }\n\n $scope.onFileSelectionChanged = function (numFiles, totalSize, query) {\n $scope.addToCollectionQuery = query;\n }\n\n $scope.showCollectionModal = function () {\n $scope.collectionModalVisible = true;\n }\n\n $scope.hideCollectionModal = function () {\n $scope.collectionModalVisible = false;\n }\n\n $scope.addFilter = function (selected, key) {\n $scope.fileSelector.addFilter(selected, key);\n $scope.updateQueryBuilder();\n }\n\n $scope.addQueryToCollection = function () {\n $scope.collectionManager.addElement($scope.queryBuilder.query);\n $scope.hideCollectionModal();\n };\n\n $scope.addQueryToCollection = function () {\n\n if ($scope.collectionManager.activeCollection == null) {\n return;\n }\n\n var wrapper = new DatabusCollectionWrapper($scope.collectionManager.activeCollection);\n wrapper.addCustomQueryNode('Select ' + $scope.versionData.label + ' files', $scope.addToCollectionQuery);\n $scope.collectionManager.saveLocally();\n $scope.collectionModalVisible = false;\n }\n\n $scope.formatMods = function (results) {\n var mods = results.replace(\",\", \" \");\n return $sce.trustAsHtml(mods);\n }\n\n $scope.formatModFile = function (uri) {\n return DatabusUtils.uriToName(uri);\n }\n\n $scope.downloadMetadataAsFile = async function () {\n var response = await $http({\n method: 'GET',\n url: $scope.version.uri,\n headers: {\n 'Accept': 'application/ld+json',\n }\n });\n\n $scope.download(`${$scope.version.name}.jsonld`, JSON.stringify(response.data, null, 3));\n }\n\n $scope.download = function (filename, text) {\n var element = document.createElement('a');\n element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text));\n element.setAttribute('download', filename);\n element.style.display = 'none';\n document.body.appendChild(element);\n\n element.click();\n\n document.body.removeChild(element);\n }\n\n\n}\n\nmodule.exports = VersionPageController;\n\n//# sourceURL=webpack://databus-webapp/./js/page-controller/version-controller.js?\n}"); -/***/ }), +/***/ }, -/***/ "./js/publish/artifact-data.js": +/***/ "./js/publish/artifact-data.js" /*!*************************************!*\ !*** ./js/publish/artifact-data.js ***! \*************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +(module, __unused_webpack_exports, __webpack_require__) { -eval("const EntityHandler = __webpack_require__(/*! ./entity-handler */ \"./js/publish/entity-handler.js\");\nconst DatabusUtils = __webpack_require__(/*! ../utils/databus-utils */ \"./js/utils/databus-utils.js\");\nconst DatabusUris = __webpack_require__(/*! ../utils/databus-uris */ \"./js/utils/databus-uris.js\");\nconst GroupData = __webpack_require__(/*! ./group-data */ \"./js/publish/group-data.js\");\n\nclass ArtifactData extends EntityHandler {\n constructor($http, accounts, apiKeys) {\n super('databus_registration_artifact_data', $http, null, accounts, apiKeys);\n }\n\n initialize(data) {\n const validAccount = data && this.accounts.some(acc => acc.accountName === data.accountName);\n\n if (validAccount) {\n Object.assign(this, data);\n } else {\n this.accountName = this.accounts[0]?.name;\n }\n\n if(this.apiKeyName == null && this.apiKeys != null && this.apiKeys.length > 0) {\n this.apiKeyName = this.apiKeys[0].keyname;\n }\n\n\n this.sendmode ??= 'register';\n this.onAccountNameChanged();\n this.onGroupNameChanged();\n }\n\n validate() {\n this.errors = [];\n this.warnings = [];\n\n if (!DatabusUtils.isValidArtifactName(this.name)) {\n this.errors.push('err_invalid_artifact_name');\n }\n\n if (!DatabusUtils.isValidGroupName(this.groupName)) {\n this.errors.push('err_no_group_selected');\n }\n\n const exists = this.artifactList?.some(a => a.name === this.name);\n if (exists) {\n this.warnings.push('warning_artifact_exists');\n }\n }\n \n getURI() {\n return `${DATABUS_RESOURCE_BASE_URL}/${this.accountName}/${this.groupName}/${this.name}`;\n }\n\n getSaveData() {\n return {\n accountName: this.accountName,\n groupName: this.groupName,\n name: this.name,\n title: this.title,\n abstract: this.abstract,\n description: this.description,\n sendmode: this.sendmode,\n apiKeyName: this.apiKeyName,\n };\n }\n\n\n async setGroupName(groupName) {\n if (this.groupName !== groupName) {\n this.groupName = groupName;\n await this.onGroupNameChanged();\n }\n }\n\n async onGroupNameChanged() {\n this.isLoadingArtifacts = true;\n this.artifactList = await this.sparqlClient.getArtifacts(this.accountName, this.groupName);\n this.isLoadingArtifacts = false;\n this.onChange();\n }\n\n \n\n updateOutputs() {\n const groupUri = `${DATABUS_RESOURCE_BASE_URL}/${GroupData.getStringOrMissing(this.accountName)}/${GroupData.getStringOrMissing(this.groupName)}`;\n\n this.postBody = {\n \"@context\": this.getContext(),\n \"@graph\": [\n {\n \"@id\": `${groupUri}/${GroupData.getStringOrMissing(this.name)}`,\n \"@type\": \"Artifact\",\n \"title\": this.getValidString(this.title),\n \"abstract\": this.getValidString(this.abstract),\n \"description\": this.getValidString(this.description),\n }\n ]\n };\n\n const payload = JSON.stringify(this.postBody, null, 2);\n const apiKey = this.apiKeys?.find(k => k.keyname === this.apiKeyName)?.apikey;\n\n this.curlCommand = [\n `curl -X POST ${DATABUS_RESOURCE_BASE_URL}/api/register \\\\`,\n ` -H \"X-API-KEY: ${GroupData.getStringOrMissing(apiKey)}\" \\\\`,\n ` -H \"Content-Type: application/json\" \\\\`,\n ` -d '${payload}'`\n ].join('\\n');\n }\n}\n\nmodule.exports = ArtifactData;\n\n\n//# sourceURL=webpack://databus-webapp/./js/publish/artifact-data.js?"); +eval("{const EntityHandler = __webpack_require__(/*! ./entity-handler */ \"./js/publish/entity-handler.js\");\nconst DatabusUtils = __webpack_require__(/*! ../utils/databus-utils */ \"./js/utils/databus-utils.js\");\nconst DatabusUris = __webpack_require__(/*! ../utils/databus-uris */ \"./js/utils/databus-uris.js\");\nconst GroupData = __webpack_require__(/*! ./group-data */ \"./js/publish/group-data.js\");\n\nclass ArtifactData extends EntityHandler {\n constructor($http, accounts, apiKeys) {\n super('databus_registration_artifact_data', $http, null, accounts, apiKeys);\n }\n\n initialize(data) {\n const validAccount = data && this.accounts.some(acc => acc.accountName === data.accountName);\n\n if (validAccount) {\n Object.assign(this, data);\n } else {\n this.accountName = this.accounts[0]?.name;\n }\n\n if(this.apiKeyName == null && this.apiKeys != null && this.apiKeys.length > 0) {\n this.apiKeyName = this.apiKeys[0].keyname;\n }\n\n\n this.sendmode ??= 'register';\n this.onAccountNameChanged();\n this.onGroupNameChanged();\n }\n\n validate() {\n this.errors = [];\n this.warnings = [];\n\n if (!DatabusUtils.isValidArtifactName(this.name)) {\n this.errors.push('err_invalid_artifact_name');\n }\n\n if (!DatabusUtils.isValidGroupName(this.groupName)) {\n this.errors.push('err_no_group_selected');\n }\n\n const exists = this.artifactList?.some(a => a.name === this.name);\n if (exists) {\n this.warnings.push('warning_artifact_exists');\n }\n }\n \n getURI() {\n return `${DATABUS_RESOURCE_BASE_URL}/${this.accountName}/${this.groupName}/${this.name}`;\n }\n\n getSaveData() {\n return {\n accountName: this.accountName,\n groupName: this.groupName,\n name: this.name,\n title: this.title,\n abstract: this.abstract,\n description: this.description,\n sendmode: this.sendmode,\n apiKeyName: this.apiKeyName,\n };\n }\n\n\n async setGroupName(groupName) {\n if (this.groupName !== groupName) {\n this.groupName = groupName;\n await this.onGroupNameChanged();\n }\n }\n\n async onGroupNameChanged() {\n this.isLoadingArtifacts = true;\n this.artifactList = await this.sparqlClient.getArtifacts(this.accountName, this.groupName);\n this.isLoadingArtifacts = false;\n this.onChange();\n }\n\n \n\n updateOutputs() {\n const groupUri = `${DATABUS_RESOURCE_BASE_URL}/${GroupData.getStringOrMissing(this.accountName)}/${GroupData.getStringOrMissing(this.groupName)}`;\n\n this.postBody = {\n \"@context\": this.getContext(),\n \"@graph\": [\n {\n \"@id\": `${groupUri}/${GroupData.getStringOrMissing(this.name)}`,\n \"@type\": \"Artifact\",\n \"title\": this.getValidString(this.title),\n \"abstract\": this.getValidString(this.abstract),\n \"description\": this.getValidString(this.description),\n }\n ]\n };\n\n const payload = JSON.stringify(this.postBody, null, 2);\n const apiKey = this.apiKeys?.find(k => k.keyname === this.apiKeyName)?.apikey;\n\n this.curlCommand = [\n `curl -X POST ${DATABUS_RESOURCE_BASE_URL}/api/register \\\\`,\n ` -H \"X-API-KEY: ${GroupData.getStringOrMissing(apiKey)}\" \\\\`,\n ` -H \"Content-Type: application/json\" \\\\`,\n ` -d '${payload}'`\n ].join('\\n');\n }\n}\n\nmodule.exports = ArtifactData;\n\n\n//# sourceURL=webpack://databus-webapp/./js/publish/artifact-data.js?\n}"); -/***/ }), +/***/ }, -/***/ "./js/publish/databus-sparql-client.js": +/***/ "./js/publish/databus-sparql-client.js" /*!*********************************************!*\ !*** ./js/publish/databus-sparql-client.js ***! \*********************************************/ -/***/ ((module) => { +(module) { -eval("class DatabusSparqlClient {\n\n constructor($http) {\n this.$http = $http;\n }\n\n /**\n * Generic SPARQL query runner.\n * @param {string} query - SPARQL query string.\n * @returns {Promise} - Query result bindings.\n */\n async runQuery(query) {\n const config = {\n method: 'POST',\n url: `/sparql`,\n headers: {\n 'Accept': 'application/sparql-results+json',\n 'Content-Type': 'application/x-www-form-urlencoded'\n },\n data: `query=${encodeURIComponent(query)}`\n };\n\n try {\n const response = await this.$http(config);\n return response.data.results.bindings || [];\n } catch (err) {\n console.error('SPARQL query failed:', err);\n return [];\n }\n }\n\n /**\n * Fetches groups for a given Databus account.\n * @param {string} accountName - The account name (e.g., 'myaccount').\n * @returns {Promise} - List of groups with basic metadata.\n */\n async getGroups(accountName) {\n const query = `\n PREFIX databus: \n\n SELECT DISTINCT ?group WHERE {\n ?group a databus:Group .\n ?group databus:account <${DATABUS_RESOURCE_BASE_URL}/${accountName}> .\n }\n `;\n\n const bindings = await this.runQuery(query);\n\n return bindings.map(binding => ({\n uri: binding.group.value,\n name: binding.group.value.split('/').pop(),\n }));\n }\n\n async getArtifacts(accountName, groupName) {\n const query = `\n PREFIX databus: \n\n SELECT DISTINCT ?group WHERE {\n ?group a databus:Artifact .\n ?group databus:group <${DATABUS_RESOURCE_BASE_URL}/${accountName}/${groupName}> .\n }\n `;\n\n const bindings = await this.runQuery(query);\n\n return bindings.map(binding => ({\n uri: binding.group.value,\n name: binding.group.value.split('/').pop(),\n }));\n }\n\n async getVersions(accountName, groupName, artifactName) {\n const query = `\n PREFIX databus: \n\n SELECT DISTINCT ?group WHERE {\n ?group a databus:Version .\n ?group databus:artifact <${DATABUS_RESOURCE_BASE_URL}/${accountName}/${groupName}/${artifactName}> .\n }\n `;\n\n const bindings = await this.runQuery(query);\n\n return bindings.map(binding => ({\n uri: binding.group.value,\n name: binding.group.value.split('/').pop(),\n }));\n }\n}\n\nmodule.exports = DatabusSparqlClient;\n\n\n//# sourceURL=webpack://databus-webapp/./js/publish/databus-sparql-client.js?"); +eval("{class DatabusSparqlClient {\n\n constructor($http) {\n this.$http = $http;\n }\n\n /**\n * Generic SPARQL query runner.\n * @param {string} query - SPARQL query string.\n * @returns {Promise} - Query result bindings.\n */\n async runQuery(query) {\n const config = {\n method: 'POST',\n url: `/sparql`,\n headers: {\n 'Accept': 'application/sparql-results+json',\n 'Content-Type': 'application/x-www-form-urlencoded'\n },\n data: `query=${encodeURIComponent(query)}`\n };\n\n try {\n const response = await this.$http(config);\n return response.data.results.bindings || [];\n } catch (err) {\n console.error('SPARQL query failed:', err);\n return [];\n }\n }\n\n /**\n * Fetches groups for a given Databus account.\n * @param {string} accountName - The account name (e.g., 'myaccount').\n * @returns {Promise} - List of groups with basic metadata.\n */\n async getGroups(accountName) {\n const query = `\n PREFIX databus: \n\n SELECT DISTINCT ?group WHERE {\n ?group a databus:Group .\n ?group databus:account <${DATABUS_RESOURCE_BASE_URL}/${accountName}> .\n }\n `;\n\n const bindings = await this.runQuery(query);\n\n return bindings.map(binding => ({\n uri: binding.group.value,\n name: binding.group.value.split('/').pop(),\n }));\n }\n\n async getArtifacts(accountName, groupName) {\n const query = `\n PREFIX databus: \n\n SELECT DISTINCT ?group WHERE {\n ?group a databus:Artifact .\n ?group databus:group <${DATABUS_RESOURCE_BASE_URL}/${accountName}/${groupName}> .\n }\n `;\n\n const bindings = await this.runQuery(query);\n\n return bindings.map(binding => ({\n uri: binding.group.value,\n name: binding.group.value.split('/').pop(),\n }));\n }\n\n async getVersions(accountName, groupName, artifactName) {\n const query = `\n PREFIX databus: \n\n SELECT DISTINCT ?group WHERE {\n ?group a databus:Version .\n ?group databus:artifact <${DATABUS_RESOURCE_BASE_URL}/${accountName}/${groupName}/${artifactName}> .\n }\n `;\n\n const bindings = await this.runQuery(query);\n\n return bindings.map(binding => ({\n uri: binding.group.value,\n name: binding.group.value.split('/').pop(),\n }));\n }\n}\n\nmodule.exports = DatabusSparqlClient;\n\n\n//# sourceURL=webpack://databus-webapp/./js/publish/databus-sparql-client.js?\n}"); -/***/ }), +/***/ }, -/***/ "./js/publish/dataid-creator.js": +/***/ "./js/publish/dataid-creator.js" /*!**************************************!*\ !*** ./js/publish/dataid-creator.js ***! \**************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +(module, __unused_webpack_exports, __webpack_require__) { -eval("const DatabusUris = __webpack_require__(/*! ../utils/databus-uris */ \"./js/utils/databus-uris.js\");\nconst DatabusUtils = __webpack_require__(/*! ../utils/databus-utils */ \"./js/utils/databus-utils.js\");\n\nclass DataIdCreator {\n\n constructor(formData, accountName) {\n this.accountName = accountName;\n this.formData = formData;\n }\n\n createInputs() {\n var group = this.createGroupUpdate();\n var artifact = this.createArtifactUpdate();\n var dataid = this.createVersionUpdate();\n\n var result = {\n \"@context\": this.getContext(),\n \"@graph\": []\n };\n\n if (group != undefined) {\n for (var graph of group[\"@graph\"]) {\n result[\"@graph\"].push(graph);\n }\n }\n\n if (artifact != undefined) {\n for (var graph of artifact[\"@graph\"]) {\n result[\"@graph\"].push(graph);\n }\n }\n\n if (dataid != undefined) {\n for (var graph of dataid[\"@graph\"]) {\n result[\"@graph\"].push(graph);\n }\n }\n\n return {\n context: this.getContext(),\n group: group,\n artifact: artifact,\n dataid: dataid,\n all: result\n };\n }\n\n getValidString(value) {\n if(value == undefined || value.length == 0) {\n return undefined;\n }\n\n return value;\n }\n\n getContext() {\n if(DATABUS_CONTEXT_URL != undefined && DatabusUtils.isValidHttpUrl(DATABUS_CONTEXT_URL)) {\n return DATABUS_CONTEXT_URL;\n }\n\n return DATABUS_CONTEXT[DatabusUris.JSONLD_CONTEXT];\n }\n\n createGroupUpdate() {\n\n var accountUri = `${DATABUS_RESOURCE_BASE_URL}/${this.accountName}`;\n\n return {\n \"@context\": this.getContext(),\n \"@graph\": [\n {\n \"@id\": `${accountUri}/${this.formData.group.name}`,\n \"@type\": \"Group\",\n \"title\": this.getValidString(this.formData.group.title),\n \"abstract\": this.getValidString(this.formData.group.abstract),\n \"description\": this.getValidString(this.formData.group.description)\n }\n ]\n };\n }\n\n createArtifactUpdate() {\n \n if (this.formData.artifact.generateMetadata == 'none') {\n return undefined;\n }\n\n var accountUri = `${DATABUS_RESOURCE_BASE_URL}/${this.accountName}`;\n\n return {\n \"@context\": this.getContext(),\n \"@graph\": [\n {\n \"@id\": `${accountUri}/${this.formData.group.name}/${this.formData.artifact.name}`,\n \"@type\": \"Artifact\",\n \"title\": this.getValidString(this.formData.artifact.title),\n \"abstract\": this.getValidString(this.formData.artifact.abstract),\n \"description\": this.getValidString(this.formData.artifact.description)\n }\n ]\n };\n }\n\n createVersionUpdate() {\n\n if (this.formData.version.generateMetadata == 'none') {\n return undefined;\n }\n\n var accountUri = `${DATABUS_RESOURCE_BASE_URL}/${this.accountName}`;\n var versionUri = `${accountUri}/${this.formData.group.name}/${this.formData.artifact.name}/${this.formData.version.name}`\n\n var artifact = this.formData.artifact;\n var version = this.formData.version;\n\n var graph = {\n \"@type\": [ \"Version\", \"Dataset\" ],\n \"@id\": versionUri,\n \"publisher\": this.formData.signature.selectedPublisherUri,\n \"hasVersion\": version.name,\n \"title\": version.title,\n \"abstract\": version.abstract,\n \"description\": version.description,\n \"license\": version.license,\n \"attribution\": version.attribution,\n \"wasDerivedFrom\": version.wasDerivedFrom,\n \"distribution\": []\n }\n\n if (this.formData.signature.selectedPublisherUri == this.formData.signature.defaultPublisherUri) {\n delete graph.publisher;\n }\n\n if (!this.formData.signature.autoGenerateSignature) {\n graph[\"proof\"] = {\n '@type': \"DatabusTractateV1\",\n 'signature': this.formData.signature.userSignature\n };\n }\n\n var customVariants = [];\n\n for (var fg in version.files) {\n\n var file = version.files[fg];\n\n var variantSuffix = '';\n for (var c in version.contentVariants) {\n var cv = version.contentVariants[c];\n var value = file.contentVariants[cv.id];\n\n if (value == undefined || value == \"\") {\n continue;\n }\n\n variantSuffix += '_' + cv.id + '=' + value;\n }\n\n var fileName = artifact.name; \n\n var distributionUri = `${versionUri}#${fileName}`;\n var fileUri = `${versionUri}/${fileName}${variantSuffix}`;\n\n distributionUri += variantSuffix;\n\n if (file.formatExtension != 'none') {\n distributionUri += '.' + file.formatExtension;\n fileUri += '.' + file.formatExtension;\n }\n\n if (file.compression != 'none') {\n distributionUri += '.' + file.compression;\n fileUri += '.' + file.compression;\n }\n\n var distribution = {\n \"@type\": \"Part\",\n \"formatExtension\": file.formatExtension,\n \"compression\": file.compression,\n \"downloadURL\": file.uri,\n \"byteSize\": file.byteSize,\n \"sha256sum\": file.sha256sum,\n };\n\n for (var c in version.contentVariants) {\n var cv = version.contentVariants[c];\n var value = file.contentVariants[cv.id];\n\n if (value == undefined || value == \"\") {\n continue;\n // value = \"\";\n }\n\n distribution['dcv:' + cv.id] = value;\n\n if (!customVariants.includes(cv.id)) {\n customVariants.push(cv.id);\n }\n }\n\n graph.distribution.push(distribution);\n }\n\n var result = {\n \"@context\": this.getContext(),\n \"@graph\": [graph]\n }\n\n return result;\n }\n}\n\nmodule.exports = DataIdCreator;\n\n\n//# sourceURL=webpack://databus-webapp/./js/publish/dataid-creator.js?"); +eval("{const DatabusUris = __webpack_require__(/*! ../utils/databus-uris */ \"./js/utils/databus-uris.js\");\nconst DatabusUtils = __webpack_require__(/*! ../utils/databus-utils */ \"./js/utils/databus-utils.js\");\n\nclass DataIdCreator {\n\n constructor(formData, accountName) {\n this.accountName = accountName;\n this.formData = formData;\n }\n\n createInputs() {\n var group = this.createGroupUpdate();\n var artifact = this.createArtifactUpdate();\n var dataid = this.createVersionUpdate();\n\n var result = {\n \"@context\": this.getContext(),\n \"@graph\": []\n };\n\n if (group != undefined) {\n for (var graph of group[\"@graph\"]) {\n result[\"@graph\"].push(graph);\n }\n }\n\n if (artifact != undefined) {\n for (var graph of artifact[\"@graph\"]) {\n result[\"@graph\"].push(graph);\n }\n }\n\n if (dataid != undefined) {\n for (var graph of dataid[\"@graph\"]) {\n result[\"@graph\"].push(graph);\n }\n }\n\n return {\n context: this.getContext(),\n group: group,\n artifact: artifact,\n dataid: dataid,\n all: result\n };\n }\n\n getValidString(value) {\n if(value == undefined || value.length == 0) {\n return undefined;\n }\n\n return value;\n }\n\n getContext() {\n if(DATABUS_CONTEXT_URL != undefined && DatabusUtils.isValidHttpUrl(DATABUS_CONTEXT_URL)) {\n return DATABUS_CONTEXT_URL;\n }\n\n return DATABUS_CONTEXT[DatabusUris.JSONLD_CONTEXT];\n }\n\n createGroupUpdate() {\n\n var accountUri = `${DATABUS_RESOURCE_BASE_URL}/${this.accountName}`;\n\n return {\n \"@context\": this.getContext(),\n \"@graph\": [\n {\n \"@id\": `${accountUri}/${this.formData.group.name}`,\n \"@type\": \"Group\",\n \"title\": this.getValidString(this.formData.group.title),\n \"abstract\": this.getValidString(this.formData.group.abstract),\n \"description\": this.getValidString(this.formData.group.description)\n }\n ]\n };\n }\n\n createArtifactUpdate() {\n \n if (this.formData.artifact.generateMetadata == 'none') {\n return undefined;\n }\n\n var accountUri = `${DATABUS_RESOURCE_BASE_URL}/${this.accountName}`;\n\n return {\n \"@context\": this.getContext(),\n \"@graph\": [\n {\n \"@id\": `${accountUri}/${this.formData.group.name}/${this.formData.artifact.name}`,\n \"@type\": \"Artifact\",\n \"title\": this.getValidString(this.formData.artifact.title),\n \"abstract\": this.getValidString(this.formData.artifact.abstract),\n \"description\": this.getValidString(this.formData.artifact.description)\n }\n ]\n };\n }\n\n createVersionUpdate() {\n\n if (this.formData.version.generateMetadata == 'none') {\n return undefined;\n }\n\n var accountUri = `${DATABUS_RESOURCE_BASE_URL}/${this.accountName}`;\n var versionUri = `${accountUri}/${this.formData.group.name}/${this.formData.artifact.name}/${this.formData.version.name}`\n\n var artifact = this.formData.artifact;\n var version = this.formData.version;\n\n var graph = {\n \"@type\": [ \"Version\", \"Dataset\" ],\n \"@id\": versionUri,\n \"publisher\": this.formData.signature.selectedPublisherUri,\n \"hasVersion\": version.name,\n \"title\": version.title,\n \"abstract\": version.abstract,\n \"description\": version.description,\n \"license\": version.license,\n \"attribution\": version.attribution,\n \"wasDerivedFrom\": version.wasDerivedFrom,\n \"distribution\": []\n }\n\n if (this.formData.signature.selectedPublisherUri == this.formData.signature.defaultPublisherUri) {\n delete graph.publisher;\n }\n\n if (!this.formData.signature.autoGenerateSignature) {\n graph[\"proof\"] = {\n '@type': \"DatabusTractateV1\",\n 'signature': this.formData.signature.userSignature\n };\n }\n\n var customVariants = [];\n\n for (var fg in version.files) {\n\n var file = version.files[fg];\n\n var variantSuffix = '';\n for (var c in version.contentVariants) {\n var cv = version.contentVariants[c];\n var value = file.contentVariants[cv.id];\n\n if (value == undefined || value == \"\") {\n continue;\n }\n\n variantSuffix += '_' + cv.id + '=' + value;\n }\n\n var fileName = artifact.name; \n\n var distributionUri = `${versionUri}#${fileName}`;\n var fileUri = `${versionUri}/${fileName}${variantSuffix}`;\n\n distributionUri += variantSuffix;\n\n if (file.formatExtension != 'none') {\n distributionUri += '.' + file.formatExtension;\n fileUri += '.' + file.formatExtension;\n }\n\n if (file.compression != 'none') {\n distributionUri += '.' + file.compression;\n fileUri += '.' + file.compression;\n }\n\n var distribution = {\n \"@type\": \"Part\",\n \"formatExtension\": file.formatExtension,\n \"compression\": file.compression,\n \"downloadURL\": file.uri,\n \"byteSize\": file.byteSize,\n \"sha256sum\": file.sha256sum,\n };\n\n for (var c in version.contentVariants) {\n var cv = version.contentVariants[c];\n var value = file.contentVariants[cv.id];\n\n if (value == undefined || value == \"\") {\n continue;\n // value = \"\";\n }\n\n distribution['dcv:' + cv.id] = value;\n\n if (!customVariants.includes(cv.id)) {\n customVariants.push(cv.id);\n }\n }\n\n graph.distribution.push(distribution);\n }\n\n var result = {\n \"@context\": this.getContext(),\n \"@graph\": [graph]\n }\n\n return result;\n }\n}\n\nmodule.exports = DataIdCreator;\n\n\n//# sourceURL=webpack://databus-webapp/./js/publish/dataid-creator.js?\n}"); -/***/ }), +/***/ }, -/***/ "./js/publish/entity-handler.js": +/***/ "./js/publish/entity-handler.js" /*!**************************************!*\ !*** ./js/publish/entity-handler.js ***! \**************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +(module, __unused_webpack_exports, __webpack_require__) { -eval("const DatabusUris = __webpack_require__(/*! ../utils/databus-uris */ \"./js/utils/databus-uris.js\");\nconst DatabusUtils = __webpack_require__(/*! ../utils/databus-utils */ \"./js/utils/databus-utils.js\");\nconst DatabusSparqlClient = __webpack_require__(/*! ./databus-sparql-client */ \"./js/publish/databus-sparql-client.js\");\n\nclass EntityHandler {\n constructor(storageKey, $http, $interval, accounts, apiKeys) {\n this.storageKey = storageKey;\n this.$http = $http;\n this.$interval = $interval;\n this.accounts = accounts;\n this.apiKeys = apiKeys;\n this.sparqlClient = new DatabusSparqlClient($http);\n\n const data = this._loadFromSession();\n this.initialize(data);\n }\n\n _loadFromSession() {\n try {\n const raw = window.sessionStorage.getItem(this.storageKey);\n return raw ? JSON.parse(raw) : null;\n } catch (e) {\n console.error(\"Failed to load session data:\", e);\n return null;\n }\n }\n\n save() {\n try {\n const data = this.getSaveData();\n const json = JSON.stringify(data);\n window.sessionStorage.setItem(this.storageKey, json);\n } catch (e) {\n console.error(\"Failed to save session data:\", e);\n }\n }\n\n // Abstract methods\n initialize(data) {\n throw new Error(\"Method 'initialize(data)' must be implemented.\");\n }\n\n getSaveData() {\n throw new Error(\"Method 'getSaveData()' must be implemented.\");\n }\n\n validate() {\n throw new Error(\"Method 'validate()' must be implemented.\");\n }\n\n updateOutputs() {\n throw new Error(\"Method 'updateOutputs()' must be implemented.\");\n }\n\n getURI() {\n throw new Error(\"Method 'updateOutputs()' must be implemented.\");\n }\n\n getValidString(value) {\n return value?.length > 0 ? value : undefined;\n }\n\n static getStringOrMissing(value) {\n return value?.length > 0 ? value : '!!!missing!!!';\n }\n\n hasError(errorKey) {\n return this.errors?.includes(errorKey) ?? false;\n }\n\n setSendMode(sendmode) {\n this.sendmode = sendmode;\n this.onChange();\n }\n\n getContext() {\n if (DATABUS_CONTEXT_URL && DatabusUtils.isValidHttpUrl(DATABUS_CONTEXT_URL)) {\n return DATABUS_CONTEXT_URL;\n }\n return DATABUS_CONTEXT[DatabusUris.JSONLD_CONTEXT];\n }\n\n async setAccountName(accountName) {\n if (this.accountName !== accountName) {\n this.accountName = accountName;\n await this.onAccountNameChanged();\n }\n }\n\n async onAccountNameChanged() {\n this.isLoadingGroups = true;\n this.groupList = await this.sparqlClient.getGroups(this.accountName);\n this.isLoadingGroups = false;\n this.onChange();\n }\n\n async setAccountName(accountName) {\n if (this.accountName !== accountName) {\n this.accountName = accountName;\n \n this.activeAccount = this.accounts?.find(a => a.accountName === this.accountName);\n await this.onAccountNameChanged();\n }\n }\n\n getAccount() {\n return this.activeAccount;\n \n }\n\n onChange() {\n this.updateOutputs();\n this.validate();\n this.save();\n }\n\n getApiKey() {\n return this.getAccount()?.apiKeys?.find(k => k.keyname === this.apiKeyName)?.apikey;\n }\n\n setApiKeyName(keyname) {\n this.apiKeyName = keyname;\n this.onChange();\n }\n\n async register() {\n try {\n const response = await this.$http({\n method: 'POST',\n url: `/api/register?log-level=info`,\n headers: {\n 'Accept': 'application/json',\n 'Content-Type': 'application/json'\n },\n data: this.postBody\n });\n\n return response;\n } catch (err) {\n console.error('Entity registration failed:', err);\n throw err;\n }\n }\n}\n\nmodule.exports = EntityHandler;\n\n\n//# sourceURL=webpack://databus-webapp/./js/publish/entity-handler.js?"); +eval("{const DatabusUris = __webpack_require__(/*! ../utils/databus-uris */ \"./js/utils/databus-uris.js\");\nconst DatabusUtils = __webpack_require__(/*! ../utils/databus-utils */ \"./js/utils/databus-utils.js\");\nconst DatabusSparqlClient = __webpack_require__(/*! ./databus-sparql-client */ \"./js/publish/databus-sparql-client.js\");\n\nclass EntityHandler {\n constructor(storageKey, $http, $interval, accounts, apiKeys) {\n this.storageKey = storageKey;\n this.$http = $http;\n this.$interval = $interval;\n this.accounts = accounts;\n this.apiKeys = apiKeys;\n this.sparqlClient = new DatabusSparqlClient($http);\n\n const data = this._loadFromSession();\n this.initialize(data);\n }\n\n _loadFromSession() {\n try {\n const raw = window.sessionStorage.getItem(this.storageKey);\n return raw ? JSON.parse(raw) : null;\n } catch (e) {\n console.error(\"Failed to load session data:\", e);\n return null;\n }\n }\n\n save() {\n try {\n const data = this.getSaveData();\n const json = JSON.stringify(data);\n window.sessionStorage.setItem(this.storageKey, json);\n } catch (e) {\n console.error(\"Failed to save session data:\", e);\n }\n }\n\n // Abstract methods\n initialize(data) {\n throw new Error(\"Method 'initialize(data)' must be implemented.\");\n }\n\n getSaveData() {\n throw new Error(\"Method 'getSaveData()' must be implemented.\");\n }\n\n validate() {\n throw new Error(\"Method 'validate()' must be implemented.\");\n }\n\n updateOutputs() {\n throw new Error(\"Method 'updateOutputs()' must be implemented.\");\n }\n\n getURI() {\n throw new Error(\"Method 'updateOutputs()' must be implemented.\");\n }\n\n getValidString(value) {\n return value?.length > 0 ? value : undefined;\n }\n\n static getStringOrMissing(value) {\n return value?.length > 0 ? value : '!!!missing!!!';\n }\n\n hasError(errorKey) {\n return this.errors?.includes(errorKey) ?? false;\n }\n\n setSendMode(sendmode) {\n this.sendmode = sendmode;\n this.onChange();\n }\n\n getContext() {\n if (DATABUS_CONTEXT_URL && DatabusUtils.isValidHttpUrl(DATABUS_CONTEXT_URL)) {\n return DATABUS_CONTEXT_URL;\n }\n return DATABUS_CONTEXT[DatabusUris.JSONLD_CONTEXT];\n }\n\n async setAccountName(accountName) {\n if (this.accountName !== accountName) {\n this.accountName = accountName;\n await this.onAccountNameChanged();\n }\n }\n\n async onAccountNameChanged() {\n this.isLoadingGroups = true;\n this.groupList = await this.sparqlClient.getGroups(this.accountName);\n this.isLoadingGroups = false;\n this.onChange();\n }\n\n async setAccountName(accountName) {\n if (this.accountName !== accountName) {\n this.accountName = accountName;\n \n this.activeAccount = this.accounts?.find(a => a.accountName === this.accountName);\n await this.onAccountNameChanged();\n }\n }\n\n getAccount() {\n return this.activeAccount;\n \n }\n\n onChange() {\n this.updateOutputs();\n this.validate();\n this.save();\n }\n\n getApiKey() {\n return this.getAccount()?.apiKeys?.find(k => k.keyname === this.apiKeyName)?.apikey;\n }\n\n setApiKeyName(keyname) {\n this.apiKeyName = keyname;\n this.onChange();\n }\n\n async register() {\n try {\n const response = await this.$http({\n method: 'POST',\n url: `/api/register?log-level=info`,\n headers: {\n 'Accept': 'application/json',\n 'Content-Type': 'application/json'\n },\n data: this.postBody\n });\n\n return response;\n } catch (err) {\n console.error('Entity registration failed:', err);\n throw err;\n }\n }\n}\n\nmodule.exports = EntityHandler;\n\n\n//# sourceURL=webpack://databus-webapp/./js/publish/entity-handler.js?\n}"); -/***/ }), +/***/ }, -/***/ "./js/publish/group-data.js": +/***/ "./js/publish/group-data.js" /*!**********************************!*\ !*** ./js/publish/group-data.js ***! \**********************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +(module, __unused_webpack_exports, __webpack_require__) { -eval("const EntityHandler = __webpack_require__(/*! ./entity-handler */ \"./js/publish/entity-handler.js\");\nconst DatabusUtils = __webpack_require__(/*! ../utils/databus-utils */ \"./js/utils/databus-utils.js\");\nconst DatabusUris = __webpack_require__(/*! ../utils/databus-uris */ \"./js/utils/databus-uris.js\");\nconst DatabusSparqlClient = __webpack_require__(/*! ./databus-sparql-client */ \"./js/publish/databus-sparql-client.js\");\n\nclass GroupData extends EntityHandler {\n constructor($http, accounts, apiKeys) {\n super('databus_registration_group_data', $http, null, accounts, apiKeys);\n \n }\n\n initialize(data) {\n const validAccount = data && this.accounts.some(acc => acc.accountName === data.accountName);\n \n if (validAccount) {\n Object.assign(this, data);\n } else {\n this.accountName = this.accounts[0]?.name;\n }\n\n if(this.apiKeyName == null && this.apiKeys != null && this.apiKeys.length > 0) {\n this.apiKeyName = this.apiKeys[0].keyname;\n }\n\n this.sendmode ??= 'register';\n this.onAccountNameChanged();\n }\n\n getSaveData() {\n return {\n accountName: this.accountName,\n name: this.name,\n title: this.title,\n abstract: this.abstract,\n description: this.description,\n sendmode: this.sendmode,\n apiKeyName: this.apiKeyName,\n };\n }\n\n getURI() {\n return `${DATABUS_RESOURCE_BASE_URL}/${this.accountName}/${this.name}`;\n }\n\n validate() {\n this.errors = [];\n this.warnings = [];\n\n if (!DatabusUtils.isValidGroupName(this.name)) {\n this.errors.push('err_invalid_group_name');\n }\n\n if(this.sendmode == 'curl' && !this.apiKeyName) {\n this.errors.push('err_no_api_key');\n }\n\n const exists = this.groupList?.some(g => g.name === this.name);\n if (exists) {\n this.warnings.push('warning_group_exists');\n }\n }\n\n updateOutputs() {\n const accountUri = `${DATABUS_RESOURCE_BASE_URL}/${GroupData.getStringOrMissing(this.accountName)}`;\n\n this.postBody = {\n \"@context\": this.getContext(),\n \"@graph\": [\n {\n \"@id\": `${accountUri}/${GroupData.getStringOrMissing(this.name)}`,\n \"@type\": \"Group\",\n \"title\": this.getValidString(this.title),\n \"abstract\": this.getValidString(this.abstract),\n \"description\": this.getValidString(this.description),\n }\n ]\n };\n\n const payload = JSON.stringify(this.postBody, null, 2);\n const apiKey = this.getApiKey();\n\n this.curlCommand = [\n `curl -X POST ${DATABUS_RESOURCE_BASE_URL}/api/register \\\\`,\n ` -H \"X-API-KEY: ${GroupData.getStringOrMissing(apiKey)}\" \\\\`,\n ` -H \"Content-Type: application/json\" \\\\`,\n ` -d '${payload}'`\n ].join('\\n');\n }\n}\n\nmodule.exports = GroupData;\n\n\n//# sourceURL=webpack://databus-webapp/./js/publish/group-data.js?"); +eval("{const EntityHandler = __webpack_require__(/*! ./entity-handler */ \"./js/publish/entity-handler.js\");\nconst DatabusUtils = __webpack_require__(/*! ../utils/databus-utils */ \"./js/utils/databus-utils.js\");\nconst DatabusUris = __webpack_require__(/*! ../utils/databus-uris */ \"./js/utils/databus-uris.js\");\nconst DatabusSparqlClient = __webpack_require__(/*! ./databus-sparql-client */ \"./js/publish/databus-sparql-client.js\");\n\nclass GroupData extends EntityHandler {\n constructor($http, accounts, apiKeys) {\n super('databus_registration_group_data', $http, null, accounts, apiKeys);\n \n }\n\n initialize(data) {\n const validAccount = data && this.accounts.some(acc => acc.accountName === data.accountName);\n \n if (validAccount) {\n Object.assign(this, data);\n } else {\n this.accountName = this.accounts[0]?.name;\n }\n\n if(this.apiKeyName == null && this.apiKeys != null && this.apiKeys.length > 0) {\n this.apiKeyName = this.apiKeys[0].keyname;\n }\n\n this.sendmode ??= 'register';\n this.onAccountNameChanged();\n }\n\n getSaveData() {\n return {\n accountName: this.accountName,\n name: this.name,\n title: this.title,\n abstract: this.abstract,\n description: this.description,\n sendmode: this.sendmode,\n apiKeyName: this.apiKeyName,\n };\n }\n\n getURI() {\n return `${DATABUS_RESOURCE_BASE_URL}/${this.accountName}/${this.name}`;\n }\n\n validate() {\n this.errors = [];\n this.warnings = [];\n\n if (!DatabusUtils.isValidGroupName(this.name)) {\n this.errors.push('err_invalid_group_name');\n }\n\n if(this.sendmode == 'curl' && !this.apiKeyName) {\n this.errors.push('err_no_api_key');\n }\n\n const exists = this.groupList?.some(g => g.name === this.name);\n if (exists) {\n this.warnings.push('warning_group_exists');\n }\n }\n\n updateOutputs() {\n const accountUri = `${DATABUS_RESOURCE_BASE_URL}/${GroupData.getStringOrMissing(this.accountName)}`;\n\n this.postBody = {\n \"@context\": this.getContext(),\n \"@graph\": [\n {\n \"@id\": `${accountUri}/${GroupData.getStringOrMissing(this.name)}`,\n \"@type\": \"Group\",\n \"title\": this.getValidString(this.title),\n \"abstract\": this.getValidString(this.abstract),\n \"description\": this.getValidString(this.description),\n }\n ]\n };\n\n const payload = JSON.stringify(this.postBody, null, 2);\n const apiKey = this.getApiKey();\n\n this.curlCommand = [\n `curl -X POST ${DATABUS_RESOURCE_BASE_URL}/api/register \\\\`,\n ` -H \"X-API-KEY: ${GroupData.getStringOrMissing(apiKey)}\" \\\\`,\n ` -H \"Content-Type: application/json\" \\\\`,\n ` -d '${payload}'`\n ].join('\\n');\n }\n}\n\nmodule.exports = GroupData;\n\n\n//# sourceURL=webpack://databus-webapp/./js/publish/group-data.js?\n}"); -/***/ }), +/***/ }, -/***/ "./js/publish/publish-data.js": +/***/ "./js/publish/publish-data.js" /*!************************************!*\ !*** ./js/publish/publish-data.js ***! \************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +(module, __unused_webpack_exports, __webpack_require__) { -eval("const DatabusUtils = __webpack_require__(/*! ../utils/databus-utils */ \"./js/utils/databus-utils.js\");\n\n/**\n * Handles shasum creation (and possibly other file stats)\n */\nclass PublishData {\n\n constructor(data) {\n\n if (data != null) {\n this.account = data.account ?? {};\n this.group = data.group ?? {};\n this.artifact = data.artifact ?? {};\n this.version = data.version ?? {};\n this.files = data.files ?? {};\n this.signature = data.signature;\n }\n\n if (data == null) {\n\n this.account = {};\n this.group = {};\n this.artifact = {};\n this.version = {};\n this.files = {};\n this.signature = undefined;\n\n this.group.generateMetadata = 'create';\n this.group.generateAbstract = true;\n this.artifact.generateMetadata = 'create';\n this.artifact.generateAbstract = true;\n this.version.generateMetadata = 'create';\n this.version.generateAbstract = true;\n this.version.useArtifactTitle = true;\n this.signature = this.createSignatureData();\n }\n }\n\n createSignatureData() {\n var signature = {};\n signature.publisherUris = [];\n\n signature.publisherUris = this.account.publisherUris;\n signature.defaultPublisherUri = `${DATABUS_RESOURCE_BASE_URL}/${this.account.accountName}#this`\n signature.selectedPublisherUri = signature.defaultPublisherUri;\n signature.autoGenerateSignature = true;\n signature.autoGenerateSignatureLocked = false;\n signature.userSignature = '';\n\n return signature;\n }\n\n hasError(error) {\n\n }\n\n clearErrors() {\n this.group.errors = [];\n this.artifact.errors = [];\n this.version.errors = [];\n this.files.errors = [];\n this.group.warnings = [];\n this.artifact.warnings = [];\n this.version.warnings = [];\n }\n /**\n * Validates the tree\n */\n validate() {\n\n var hasErrors = false;\n this.group.errors = [];\n this.artifact.errors = [];\n this.version.errors = [];\n this.files.errors = [];\n this.group.warnings = [];\n this.artifact.warnings = [];\n this.version.warnings = [];\n\n\n if (!DatabusUtils.isValidGroupName(this.group.name)) {\n this.group.errors.push('err_invalid_group_title');\n hasErrors = true;\n }\n\n var self = this;\n\n var existingGroup = this.account.groups.filter(function (value) {\n return value.name == self.group.name;\n });\n\n if (existingGroup.length > 0 && this.group.generateMetadata == 'create') {\n this.group.warnings.push('warning_group_exists');\n }\n\n var existingArtifact = this.account.artifacts.filter(function (value) {\n return value.groupName == self.group.name && value.name == self.artifact.name;\n });\n\n if (existingArtifact.length > 0 && this.artifact.generateMetadata == 'create') {\n this.artifact.warnings.push('warning_artifact_exists');\n }\n\n if (this.group.generateAbstract) {\n this.group.abstract = DatabusUtils.createAbstractFromDescription(this.group.description);\n }\n\n if (this.version.generateAbstract) {\n this.version.abstract = DatabusUtils.createAbstractFromDescription(this.version.description);\n }\n\n if (this.version.useArtifactTitle) {\n this.version.title = this.artifact.title;\n }\n\n if (this.artifact.generateAbstract) {\n this.artifact.abstract = DatabusUtils.createAbstractFromDescription(this.artifact.description);\n }\n\n if (this.group.publishGroupOnly) {\n this.hasConfigurationError = hasErrors;\n return;\n }\n\n if (this.artifact.generateMetadata != 'none') {\n if (!DatabusUtils.isValidArtifactName(this.artifact.name)) {\n this.artifact.errors.push('err_invalid_artifact_title');\n hasErrors = true;\n }\n }\n\n var versionUri = `${DATABUS_RESOURCE_BASE_URL}/${this.account.accountName}/${this.group.name}/${this.artifact.name}/${this.version.name}`;\n\n var existingVersion = this.account.versions.filter(function (value) {\n return value == versionUri;\n });\n\n if (existingVersion.length > 0) {\n this.version.warnings.push('warning_version_exists');\n }\n\n if (this.version.generateMetadata != 'none') {\n\n if (!DatabusUtils.isValidVersionIdentifier(this.version.name)) {\n this.version.errors.push('err_invalid_version_title');\n hasErrors = true;\n }\n\n if (!DatabusUtils.isValidUrl(this.version.license)) {\n this.version.errors.push('err_invalid_version_license');\n hasErrors = true;\n }\n\n if (!DatabusUtils.isValidResourceText(this.version.abstract, 1)) {\n this.version.errors.push('err_invalid_version_abstract');\n hasErrors = true;\n }\n\n if (!DatabusUtils.isValidResourceText(this.version.description, 1)) {\n this.version.errors.push('err_invalid_version_description');\n hasErrors = true;\n }\n\n\n if (DatabusUtils.objSize(this.version.files) == 0) {\n this.files.errors.push('err_no_files');\n hasErrors = true;\n }\n\n if (this.version.isConfigDirty) {\n\n\n var files = [];\n for (var f in this.version.files) {\n this.version.files[f].errors = [];\n files.push(this.version.files[f]);\n }\n\n this.cvSplit(this.version, files, 0);\n this.version.isConfigDirty = false;\n }\n }\n\n this.hasConfigurationError = hasErrors;\n }\n\n addFile(file) {\n\n\n if (this.version.files == undefined) {\n this.version.files = [];\n }\n\n\n for (var f in this.version.files) {\n if (file.url == this.version.files[f].url) {\n return;\n }\n }\n\n var uri = file.url;\n var uriParts = uri.split('/');\n var name = uriParts.pop();\n var nameComponents = name.split('.');\n name = nameComponents[0];\n\n if (name.length > 50) {\n name = name.substr(0, 50) + '...';\n }\n\n name = decodeURIComponent(name);\n // Files with uri as key!!\n\n this.version.files.push({\n id: uri,\n uri: file.url,\n name: name,\n contentVariants: file.contentVariants != null ? file.contentVariants : {},\n compression: file.compression,\n formatExtension: file.formatExtension,\n rowspan: 1,\n });\n\n this.version.files.sort(function (a, b) {\n var nameA = a.name;\n var nameB = b.name;\n\n if (nameA < nameB) {\n return -1;\n }\n if (nameA > nameB) {\n return 1;\n }\n\n return 0;\n });\n\n this.version.isConfigDirty = true;\n }\n\n addContentVariant(variant) {\n\n if (variant == undefined || variant == '') {\n return;\n }\n\n if (this.version.contentVariants == undefined) {\n this.version.contentVariants = [];\n }\n\n for (var c in this.version.contentVariants) {\n if (this.version.contentVariants[c].id == variant) {\n return;\n }\n }\n\n this.version.contentVariants.push({\n label: variant,\n id: variant,\n fillRegex: '',\n toLower: true,\n pruneWhitespaces: true\n });\n\n this.version.isConfigDirty = true;\n }\n\n\n removeContentVariant(variant) {\n\n this.version.contentVariants = this.version.contentVariants.filter(function (d) {\n return d.id != variant.id;\n });\n\n for (var f in this.version.files) {\n var file = this.version.files[f];\n delete file.contentVariants[variant.id];\n }\n\n this.version.isConfigDirty = true;\n }\n\n fill(variant) {\n\n var val = variant.fillRegex;\n\n for (var file of this.version.files) {\n\n if (variant.toLower) {\n val = val.toLowerCase();\n }\n\n if (variant.pruneWhitespaces) {\n val = val.replaceAll(' ', '');\n }\n\n if (!variant.overwrite && file.contentVariants[variant.id] != undefined\n && file.contentVariants[variant.id].length > 0) {\n continue;\n }\n\n file.contentVariants[variant.id] = val;\n }\n\n this.version.isConfigDirty = true;\n }\n\n fillByRegex(variant) {\n var regex = new RegExp(variant.fillRegex);\n\n for (var f in this.version.files) {\n var file = this.version.files[f];\n var matches = file.name.match(regex);\n\n if (matches != null) {\n var val = matches[0];\n\n if (variant.toLower) {\n val = val.toLowerCase();\n }\n\n if (variant.pruneWhitespaces) {\n val = val.replaceAll(' ', '');\n }\n\n if (!variant.overwrite && file.contentVariants[variant.id] != undefined\n && file.contentVariants[variant.id].length > 0) {\n continue;\n }\n\n file.contentVariants[variant.id] = val;\n }\n }\n\n this.version.isConfigDirty = true;\n }\n\n createVersionName(v) {\n if (v == 0) {\n this.version.name = new Date().toISOString().slice(0, 10);\n }\n\n if (v == 1) {\n this.version.name = new Date().toISOString().slice(0, 13);\n }\n }\n\n getRowIndex(files, name) {\n var k = 1;\n for (var f in files) {\n if (files[f].name == name) {\n return k;\n }\n\n k++;\n }\n\n return -1;\n }\n\n\n cvSplit(artifact, files, cvIndex) {\n\n if (files.length <= 1) {\n return;\n }\n\n if (artifact.contentVariants == undefined) {\n artifact.contentVariants = [];\n }\n // if end of cvs, assign errors to all files if files.length > 1\n if (cvIndex - 2 >= artifact.contentVariants.length) {\n\n if (files.length > 1) {\n\n var cvHints = [];\n\n if (artifact.contentVariants.length == 0) {\n cvHints.push('No content variants have been added yet. Add content variants in the files panel in order to tag your files.');\n } else {\n for (var c in artifact.contentVariants) {\n var cv = artifact.contentVariants[c];\n var value = files[0].contentVariants[cv.id];\n\n if (value == undefined || value == '') {\n value = 'none';\n }\n\n cvHints.push(cv.id + ': ' + value);\n }\n }\n\n for (var f in files) {\n\n var index = 0;\n\n if (f == 0) {\n var index = this.getRowIndex(artifact.files, files[1].name);\n } else {\n var index = this.getRowIndex(artifact.files, files[0].name);\n }\n\n var errorMessage = 'The Databus requires any two files to be distinguishable by either their format, compression or any content variant. You have added a file with the exact same format, compression and content variants at row '\n + index + ' (' +\n cvHints.join(', ') + ').';\n\n files[f].errors.push({ key: 'err_duplicate_file', message: errorMessage });\n }\n }\n\n return;\n }\n\n // else create buckets and sort files into buckets\n var buckets = {};\n\n for (var f in files) {\n var file = files[f];\n\n var key = null;\n\n if (cvIndex == 0) {\n key = file.formatExtension;\n } else if (cvIndex == 1) {\n key = file.compression;\n } else {\n key = file.contentVariants[artifact.contentVariants[cvIndex - 2].id];\n }\n\n if (key == undefined || key == '') {\n key = '$_none$';\n }\n\n if (buckets[key] == undefined) {\n buckets[key] = [];\n }\n\n buckets[key].push(file);\n }\n\n // iterate buckets and call recursively\n for (var b in buckets) {\n this.cvSplit(artifact, buckets[b], cvIndex + 1);\n }\n }\n\n\n getOrCreateFileGroup(fileGroupId, name) {\n\n if (this.version.files == null) {\n this.version.files = {};\n }\n\n if (this.version.files[fileGroupId] == undefined) {\n\n this.version.files[fileGroupId] = {\n id: fileGroupId,\n name: name,\n contentVariants: {},\n distributions: [],\n artifactId: undefined,\n groupId: undefined,\n };\n }\n\n return this.version.files[fileGroupId];\n }\n\n}\n\nmodule.exports = PublishData;\n\n//# sourceURL=webpack://databus-webapp/./js/publish/publish-data.js?"); +eval("{const DatabusUtils = __webpack_require__(/*! ../utils/databus-utils */ \"./js/utils/databus-utils.js\");\n\n/**\n * Handles shasum creation (and possibly other file stats)\n */\nclass PublishData {\n\n constructor(data) {\n\n if (data != null) {\n this.account = data.account ?? {};\n this.group = data.group ?? {};\n this.artifact = data.artifact ?? {};\n this.version = data.version ?? {};\n this.files = data.files ?? {};\n this.signature = data.signature;\n }\n\n if (data == null) {\n\n this.account = {};\n this.group = {};\n this.artifact = {};\n this.version = {};\n this.files = {};\n this.signature = undefined;\n\n this.group.generateMetadata = 'create';\n this.group.generateAbstract = true;\n this.artifact.generateMetadata = 'create';\n this.artifact.generateAbstract = true;\n this.version.generateMetadata = 'create';\n this.version.generateAbstract = true;\n this.version.useArtifactTitle = true;\n this.signature = this.createSignatureData();\n }\n }\n\n createSignatureData() {\n var signature = {};\n signature.publisherUris = [];\n\n signature.publisherUris = this.account.publisherUris;\n signature.defaultPublisherUri = `${DATABUS_RESOURCE_BASE_URL}/${this.account.accountName}#this`\n signature.selectedPublisherUri = signature.defaultPublisherUri;\n signature.autoGenerateSignature = true;\n signature.autoGenerateSignatureLocked = false;\n signature.userSignature = '';\n\n return signature;\n }\n\n hasError(error) {\n\n }\n\n clearErrors() {\n this.group.errors = [];\n this.artifact.errors = [];\n this.version.errors = [];\n this.files.errors = [];\n this.group.warnings = [];\n this.artifact.warnings = [];\n this.version.warnings = [];\n }\n /**\n * Validates the tree\n */\n validate() {\n\n var hasErrors = false;\n this.group.errors = [];\n this.artifact.errors = [];\n this.version.errors = [];\n this.files.errors = [];\n this.group.warnings = [];\n this.artifact.warnings = [];\n this.version.warnings = [];\n\n\n if (!DatabusUtils.isValidGroupName(this.group.name)) {\n this.group.errors.push('err_invalid_group_title');\n hasErrors = true;\n }\n\n var self = this;\n\n var existingGroup = this.account.groups.filter(function (value) {\n return value.name == self.group.name;\n });\n\n if (existingGroup.length > 0 && this.group.generateMetadata == 'create') {\n this.group.warnings.push('warning_group_exists');\n }\n\n var existingArtifact = this.account.artifacts.filter(function (value) {\n return value.groupName == self.group.name && value.name == self.artifact.name;\n });\n\n if (existingArtifact.length > 0 && this.artifact.generateMetadata == 'create') {\n this.artifact.warnings.push('warning_artifact_exists');\n }\n\n if (this.group.generateAbstract) {\n this.group.abstract = DatabusUtils.createAbstractFromDescription(this.group.description);\n }\n\n if (this.version.generateAbstract) {\n this.version.abstract = DatabusUtils.createAbstractFromDescription(this.version.description);\n }\n\n if (this.version.useArtifactTitle) {\n this.version.title = this.artifact.title;\n }\n\n if (this.artifact.generateAbstract) {\n this.artifact.abstract = DatabusUtils.createAbstractFromDescription(this.artifact.description);\n }\n\n if (this.group.publishGroupOnly) {\n this.hasConfigurationError = hasErrors;\n return;\n }\n\n if (this.artifact.generateMetadata != 'none') {\n if (!DatabusUtils.isValidArtifactName(this.artifact.name)) {\n this.artifact.errors.push('err_invalid_artifact_title');\n hasErrors = true;\n }\n }\n\n var versionUri = `${DATABUS_RESOURCE_BASE_URL}/${this.account.accountName}/${this.group.name}/${this.artifact.name}/${this.version.name}`;\n\n var existingVersion = this.account.versions.filter(function (value) {\n return value == versionUri;\n });\n\n if (existingVersion.length > 0) {\n this.version.warnings.push('warning_version_exists');\n }\n\n if (this.version.generateMetadata != 'none') {\n\n if (!DatabusUtils.isValidVersionIdentifier(this.version.name)) {\n this.version.errors.push('err_invalid_version_title');\n hasErrors = true;\n }\n\n if (!DatabusUtils.isValidUrl(this.version.license)) {\n this.version.errors.push('err_invalid_version_license');\n hasErrors = true;\n }\n\n if (!DatabusUtils.isValidResourceText(this.version.abstract, 1)) {\n this.version.errors.push('err_invalid_version_abstract');\n hasErrors = true;\n }\n\n if (!DatabusUtils.isValidResourceText(this.version.description, 1)) {\n this.version.errors.push('err_invalid_version_description');\n hasErrors = true;\n }\n\n\n if (DatabusUtils.objSize(this.version.files) == 0) {\n this.files.errors.push('err_no_files');\n hasErrors = true;\n }\n\n if (this.version.isConfigDirty) {\n\n\n var files = [];\n for (var f in this.version.files) {\n this.version.files[f].errors = [];\n files.push(this.version.files[f]);\n }\n\n this.cvSplit(this.version, files, 0);\n this.version.isConfigDirty = false;\n }\n }\n\n this.hasConfigurationError = hasErrors;\n }\n\n addFile(file) {\n\n\n if (this.version.files == undefined) {\n this.version.files = [];\n }\n\n\n for (var f in this.version.files) {\n if (file.url == this.version.files[f].url) {\n return;\n }\n }\n\n var uri = file.url;\n var uriParts = uri.split('/');\n var name = uriParts.pop();\n var nameComponents = name.split('.');\n name = nameComponents[0];\n\n if (name.length > 50) {\n name = name.substr(0, 50) + '...';\n }\n\n name = decodeURIComponent(name);\n // Files with uri as key!!\n\n this.version.files.push({\n id: uri,\n uri: file.url,\n name: name,\n contentVariants: file.contentVariants != null ? file.contentVariants : {},\n compression: file.compression,\n formatExtension: file.formatExtension,\n rowspan: 1,\n });\n\n this.version.files.sort(function (a, b) {\n var nameA = a.name;\n var nameB = b.name;\n\n if (nameA < nameB) {\n return -1;\n }\n if (nameA > nameB) {\n return 1;\n }\n\n return 0;\n });\n\n this.version.isConfigDirty = true;\n }\n\n addContentVariant(variant) {\n\n if (variant == undefined || variant == '') {\n return;\n }\n\n if (this.version.contentVariants == undefined) {\n this.version.contentVariants = [];\n }\n\n for (var c in this.version.contentVariants) {\n if (this.version.contentVariants[c].id == variant) {\n return;\n }\n }\n\n this.version.contentVariants.push({\n label: variant,\n id: variant,\n fillRegex: '',\n toLower: true,\n pruneWhitespaces: true\n });\n\n this.version.isConfigDirty = true;\n }\n\n\n removeContentVariant(variant) {\n\n this.version.contentVariants = this.version.contentVariants.filter(function (d) {\n return d.id != variant.id;\n });\n\n for (var f in this.version.files) {\n var file = this.version.files[f];\n delete file.contentVariants[variant.id];\n }\n\n this.version.isConfigDirty = true;\n }\n\n fill(variant) {\n\n var val = variant.fillRegex;\n\n for (var file of this.version.files) {\n\n if (variant.toLower) {\n val = val.toLowerCase();\n }\n\n if (variant.pruneWhitespaces) {\n val = val.replaceAll(' ', '');\n }\n\n if (!variant.overwrite && file.contentVariants[variant.id] != undefined\n && file.contentVariants[variant.id].length > 0) {\n continue;\n }\n\n file.contentVariants[variant.id] = val;\n }\n\n this.version.isConfigDirty = true;\n }\n\n fillByRegex(variant) {\n var regex = new RegExp(variant.fillRegex);\n\n for (var f in this.version.files) {\n var file = this.version.files[f];\n var matches = file.name.match(regex);\n\n if (matches != null) {\n var val = matches[0];\n\n if (variant.toLower) {\n val = val.toLowerCase();\n }\n\n if (variant.pruneWhitespaces) {\n val = val.replaceAll(' ', '');\n }\n\n if (!variant.overwrite && file.contentVariants[variant.id] != undefined\n && file.contentVariants[variant.id].length > 0) {\n continue;\n }\n\n file.contentVariants[variant.id] = val;\n }\n }\n\n this.version.isConfigDirty = true;\n }\n\n createVersionName(v) {\n if (v == 0) {\n this.version.name = new Date().toISOString().slice(0, 10);\n }\n\n if (v == 1) {\n this.version.name = new Date().toISOString().slice(0, 13);\n }\n }\n\n getRowIndex(files, name) {\n var k = 1;\n for (var f in files) {\n if (files[f].name == name) {\n return k;\n }\n\n k++;\n }\n\n return -1;\n }\n\n\n cvSplit(artifact, files, cvIndex) {\n\n if (files.length <= 1) {\n return;\n }\n\n if (artifact.contentVariants == undefined) {\n artifact.contentVariants = [];\n }\n // if end of cvs, assign errors to all files if files.length > 1\n if (cvIndex - 2 >= artifact.contentVariants.length) {\n\n if (files.length > 1) {\n\n var cvHints = [];\n\n if (artifact.contentVariants.length == 0) {\n cvHints.push('No content variants have been added yet. Add content variants in the files panel in order to tag your files.');\n } else {\n for (var c in artifact.contentVariants) {\n var cv = artifact.contentVariants[c];\n var value = files[0].contentVariants[cv.id];\n\n if (value == undefined || value == '') {\n value = 'none';\n }\n\n cvHints.push(cv.id + ': ' + value);\n }\n }\n\n for (var f in files) {\n\n var index = 0;\n\n if (f == 0) {\n var index = this.getRowIndex(artifact.files, files[1].name);\n } else {\n var index = this.getRowIndex(artifact.files, files[0].name);\n }\n\n var errorMessage = 'The Databus requires any two files to be distinguishable by either their format, compression or any content variant. You have added a file with the exact same format, compression and content variants at row '\n + index + ' (' +\n cvHints.join(', ') + ').';\n\n files[f].errors.push({ key: 'err_duplicate_file', message: errorMessage });\n }\n }\n\n return;\n }\n\n // else create buckets and sort files into buckets\n var buckets = {};\n\n for (var f in files) {\n var file = files[f];\n\n var key = null;\n\n if (cvIndex == 0) {\n key = file.formatExtension;\n } else if (cvIndex == 1) {\n key = file.compression;\n } else {\n key = file.contentVariants[artifact.contentVariants[cvIndex - 2].id];\n }\n\n if (key == undefined || key == '') {\n key = '$_none$';\n }\n\n if (buckets[key] == undefined) {\n buckets[key] = [];\n }\n\n buckets[key].push(file);\n }\n\n // iterate buckets and call recursively\n for (var b in buckets) {\n this.cvSplit(artifact, buckets[b], cvIndex + 1);\n }\n }\n\n\n getOrCreateFileGroup(fileGroupId, name) {\n\n if (this.version.files == null) {\n this.version.files = {};\n }\n\n if (this.version.files[fileGroupId] == undefined) {\n\n this.version.files[fileGroupId] = {\n id: fileGroupId,\n name: name,\n contentVariants: {},\n distributions: [],\n artifactId: undefined,\n groupId: undefined,\n };\n }\n\n return this.version.files[fileGroupId];\n }\n\n}\n\nmodule.exports = PublishData;\n\n//# sourceURL=webpack://databus-webapp/./js/publish/publish-data.js?\n}"); -/***/ }), +/***/ }, -/***/ "./js/publish/publish-session.js": +/***/ "./js/publish/publish-session.js" /*!***************************************!*\ !*** ./js/publish/publish-session.js ***! \***************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +(module, __unused_webpack_exports, __webpack_require__) { -eval("\nconst DatabusUtils = __webpack_require__(/*! ../utils/databus-utils */ \"./js/utils/databus-utils.js\");\nconst DatabusUris = __webpack_require__(/*! ../utils/databus-uris */ \"./js/utils/databus-uris.js\");\nconst JsonldUtils = __webpack_require__(/*! ../utils/jsonld-utils */ \"./js/utils/jsonld-utils.js\");\nconst PublishData = __webpack_require__(/*! ./publish-data */ \"./js/publish/publish-data.js\");\nconst DataIdCreator = __webpack_require__(/*! ./dataid-creator */ \"./js/publish/dataid-creator.js\");\nconst DatabusSparqlClient = __webpack_require__(/*! ./databus-sparql-client */ \"./js/publish/databus-sparql-client.js\");\nconst GroupHandler = __webpack_require__(/*! ./group-data */ \"./js/publish/group-data.js\");\nconst ArtifactHandler = __webpack_require__(/*! ./artifact-data */ \"./js/publish/artifact-data.js\");\nconst VersionHandler = __webpack_require__(/*! ./version-handler */ \"./js/publish/version-handler.js\");\n\nclass PublishSession {\n\n static sessionStorageKey = 'databus_upload';\n static sessionStorageIgnoreKeys = [\n '$$hashKey',\n 'eventListeners',\n 'hasLocalChanges',\n 'fileFilterInput',\n 'fileSuggestions',\n 'progress',\n 'streamQueue'\n ];\n\n\n constructor($http, $interval, accounts, apiKeys) {\n\n this.$http = $http;\n this.accounts = accounts;\n this.sparqlClient = new DatabusSparqlClient($http);\n this.formData = new PublishData();\n\n this.group = new GroupHandler($http, accounts, apiKeys);\n this.artifact = new ArtifactHandler($http, accounts, apiKeys);\n this.version = new VersionHandler($http, $interval, accounts, apiKeys);\n\n this.reset();\n }\n\n\n\n reset() {\n this.accountData = {};\n this.groupData = {};\n this.artifactData = {};\n this.versionData = {};\n }\n\n update() {\n this.validate();\n this.save();\n }\n\n async selectAccount(account) {\n this.accountData = {\n name: account.name,\n isValid: true\n };\n\n // Fetch groups for account here:\n this.groups = await this.sparqlClient.getGroups(this.accountData.name);\n \n\n this.save();\n }\n\n async selectGroup(targetGroup) {\n\n if (targetGroup == null) {\n return;\n }\n\n var group = this.formData.group;\n var artifact = this.formData.artifact;\n\n group.name = targetGroup.name;\n group.title = targetGroup.title;\n group.abstract = targetGroup.abstract;\n group.description = targetGroup.description;\n\n if (this.currentGroup == null || this.currentGroup.name != targetGroup.name) {\n this.currentGroup = targetGroup;\n\n if (this.formData.artifact.generateMetadata == 'existing') {\n this.currentArtifact = null;\n this.setCreateNewArtifact('create');\n }\n }\n }\n\n createNewGroup() {\n this.formData.group.name = \"\";\n this.formData.group.title = \"\";\n this.formData.group.abstract = \"\";\n this.formData.group.description = \"\";\n\n this.save();\n }\n\n selectArtifact(targetArtifact) {\n if (targetArtifact == null) {\n return;\n }\n\n var artifact = this.formData.artifact;\n artifact.name = targetArtifact.name;\n artifact.title = targetArtifact.title;\n artifact.abstract = targetArtifact.abstract;\n artifact.description = targetArtifact.description;\n this.currentArtifact = targetArtifact;\n\n this.availableVersions = this.accountData.versions.filter(function (v) {\n return v.startsWith(targetArtifact.uri);\n });\n }\n\n selectVersion = function (versionUri) {\n\n try {\n var relativeUri = new URL(versionUri).pathname;\n var options = {\n method: 'GET',\n url: relativeUri,\n headers: {\n 'Accept': 'application/ld+json',\n 'X-Jsonld-Formatting': 'flatten'\n }\n };\n\n var version = this.formData.version;\n version.isLoading = true;\n\n var self = this;\n\n this.$http(options).then(function (response) {\n\n var version = self.formData.version;\n version.isLoading = false;\n\n var versionData = response.data;\n var versionGraph = JsonldUtils.getTypedGraph(versionData, DatabusUris.DATABUS_VERSION);\n\n version.name = DatabusUtils.uriToName(versionGraph[DatabusUris.JSONLD_ID]);\n version.title = JsonldUtils.getProperty(versionGraph, DatabusUris.DCT_TITLE);\n version.abstract = JsonldUtils.getProperty(versionGraph, DatabusUris.DCT_ABSTRACT);\n version.description = JsonldUtils.getProperty(versionGraph, DatabusUris.DCT_DESCRIPTION);\n version.attribution = JsonldUtils.getProperty(versionGraph, DatabusUris.DATABUS_ATTRIBUTION);\n version.license = JsonldUtils.getProperty(versionGraph, DatabusUris.DCT_LICENSE);\n version.derivedFrom = JsonldUtils.getProperty(versionGraph, DatabusUris.PROV_WAS_DERIVED_FROM);\n version.contentVariants = [];\n\n var contentVariantGraphs = JsonldUtils.getTypedGraphs(versionData, DatabusUris.RDF_PROPERTY);\n\n for (var contentVariantGraph of contentVariantGraphs) {\n\n var variantName = DatabusUtils.uriToName(contentVariantGraph[DatabusUris.JSONLD_ID]);\n self.formData.addContentVariant(variantName);\n }\n\n // Add Files!\n var fileGraphs = JsonldUtils.getTypedGraphs(versionData, DatabusUris.DATABUS_PART);\n version.files = [];\n\n for (var fileGraph of fileGraphs) {\n\n var fileUri = JsonldUtils.getProperty(fileGraph, DatabusUris.DCAT_DOWNLOAD_URL);\n\n\n\n var file = {\n id: fileUri,\n url: fileUri,\n name: DatabusUtils.uriToName(fileUri),\n compression: JsonldUtils.getProperty(fileGraph, DatabusUris.DATABUS_COMPRESSION),\n formatExtension: JsonldUtils.getProperty(fileGraph, DatabusUris.DATABUS_FORMAT_EXTENSION),\n contentVariants: {}\n }\n\n for (var contentVariant of version.contentVariants) {\n var variantUri = `${DatabusUris.DATABUS_CONTENT_VARIANT_PREFIX}${contentVariant.id}`;\n var variantValue = JsonldUtils.getProperty(fileGraph, variantUri);\n\n if (variantValue != null) {\n file.contentVariants[contentVariant.id] = variantValue;\n }\n }\n\n self.formData.addFile(file);\n }\n\n\n // Save the preset values\n delete version.preset;\n version.preset = JSON.parse(JSON.stringify(version));\n });\n\n\n } catch (err) {\n console.log(err);\n }\n }\n\n addFile(file) {\n this.formData.addFile(file);\n }\n\n\n setCreateNewGroup(value) {\n this.formData.group.generateMetadata = value;\n if (value == 'create') {\n this.formData.group.name = \"\";\n this.formData.group.title = \"\";\n this.formData.group.abstract = \"\";\n this.formData.group.description = \"\";\n this.formData.group.generateAbstract = true;\n this.currentGroup = null;\n\n if (this.formData.artifact.generateMetadata == 'existing') {\n this.setCreateNewArtifact('create');\n }\n } else if (value == 'existing') {\n var hasGroups = DatabusUtils.objSize(this.accountData.groups) > 0;\n\n if (!hasGroups) {\n this.setCreateNewGroup('create');\n return;\n }\n\n if (this.currentGroup == null) {\n for (var group of this.accountData.groups) {\n this.selectGroup(group);\n break;\n }\n }\n }\n }\n\n setCreateNewArtifact(value) {\n this.formData.artifact.generateMetadata = value;\n\n if (value == 'create') {\n\n this.availableVersions = [];\n this.formData.artifact.name = \"\";\n this.formData.artifact.title = \"\";\n this.formData.artifact.description = \"\";\n this.currentArtifact = null;\n\n if (this.formData.version.generateMetadata == 'existing') {\n this.setCreateNewVersion('create');\n }\n\n } else if (value == 'existing') {\n\n if (!this.currentGroup.hasArtifacts) {\n this.setCreateNewArtifact('create');\n return;\n }\n\n if (this.currentArtifact == null) {\n this.selectArtifact(this.currentGroup.artifacts[0]);\n }\n } else {\n\n this.availableVersions = [];\n if (this.formData.version.generateMetadata != 'none') {\n this.setCreateNewVersion('none');\n }\n }\n }\n\n setCreateNewVersion(value) {\n this.formData.version.generateMetadata = value;\n\n if (value == 'create') {\n\n\n } else if (value == 'existing') {\n\n if (this.availableVersions.length == 0) {\n this.setCreateNewVersion('create');\n return;\n }\n\n this.selectVersion(this.availableVersions[0]);\n }\n\n }\n currentGroupHasArtifacts() {\n if (this.formData.group.generateMetadata == 'create') {\n return false;\n }\n\n return this.currentGroup.artifacts != null && this.currentGroup.artifacts.length > 0;\n }\n\n initializeField(source, name, defaultValue) {\n this[name] = source != null ? source[name] : defaultValue;\n }\n\n save() {\n\n let data = {\n accountData: this.accountData,\n groupData: this.groupData,\n artifactData: this.artifactData,\n versionData: this.versionData,\n formData: this.formData,\n }\n\n\n try {\n var sessionDataString = JSON.stringify(data, function (key, value) {\n if (PublishSession.sessionStorageIgnoreKeys.includes(key)) {\n return undefined;\n }\n return value;\n });\n\n window.sessionStorage.setItem(PublishSession.sessionStorageKey, sessionDataString);\n } catch (e) {\n console.log(e);\n }\n }\n\n static resume($http, sub, accountData) {\n\n var sessionData = JSON.parse(window.sessionStorage.getItem(PublishSession.sessionStorageKey));\n\n if (sessionData == null || sessionData.sub == null) {\n return null;\n }\n\n if (sub != sessionData.sub) {\n return null;\n }\n\n var publishSession = new PublishSession($http, sessionData, accountData);\n\n return publishSession;\n }\n\n onChange() {\n this.validate();\n this.inputs = this.dataIdCreator.createInputs();\n this.save();\n\n if (this.dataIdCreator != undefined) {\n this.inputs = this.dataIdCreator.createInputs();\n\n this.isReadyForUpload =\n !this.formData.artifact.errors.length > 0 &&\n !this.formData.group.errors.length > 0 &&\n !this.formData.version.errors.length > 0 &&\n !this.formData.files.errors.length > 0;\n }\n }\n\n onChangeGroup() {\n\n let group = this.formData.group;\n\n group.errors = [];\n group.warnings = [];\n\n if (!DatabusUtils.isValidGroupName(group.name)) {\n group.errors.push('err_invalid_group_name');\n }\n\n var existingGroup = this.groups.filter(function (value) {\n return value.name == self.group.name;\n });\n\n if (existingGroup.length > 0 && group.mode == 'create') {\n group.warnings.push('warning_group_exists');\n }\n\n this.save();\n }\n\n getValidString(value) {\n if (value == undefined || value.length == 0) {\n return undefined;\n }\n\n return value;\n }\n\n updateGroupBody() {\n var accountUri = `${DATABUS_RESOURCE_BASE_URL}/${this.accountData.name}`;\n\n this.groupBody = {\n \"@context\": this.getContext(),\n \"@graph\": [\n {\n \"@id\": `${accountUri}/${this.formData.group.name}`,\n \"@type\": \"Group\",\n \"title\": this.getValidString(this.formData.group.title),\n \"abstract\": this.getValidString(this.formData.group.abstract),\n \"description\": this.getValidString(this.formData.group.description)\n }\n ]\n };\n }\n\n getContext() {\n if (DATABUS_CONTEXT_URL != undefined && DatabusUtils.isValidHttpUrl(DATABUS_CONTEXT_URL)) {\n return DATABUS_CONTEXT_URL;\n }\n\n return DATABUS_CONTEXT[DatabusUris.JSONLD_CONTEXT];\n }\n\n onChangeArtifact() {\n\n let artifact = this.formData.artifact;\n\n artifact.errors = [];\n artifact.warnings = [];\n\n if (!DatabusUtils.isValidArtifactName(artifact.name)) {\n artifact.errors.push('err_invalid_artifact_name');\n }\n\n if (this.artifacts != null) {\n var existingArtifact = this.artifacts.filter(function (value) {\n return value.name == self.group.name;\n });\n\n if (existingArtifact.length > 0 && artifact.mode == 'create') {\n artifact.warnings.push('warning_group_exists');\n }\n }\n\n this.save();\n\n }\n}\n\nmodule.exports = PublishSession;\n\n\n//# sourceURL=webpack://databus-webapp/./js/publish/publish-session.js?"); +eval("{\nconst DatabusUtils = __webpack_require__(/*! ../utils/databus-utils */ \"./js/utils/databus-utils.js\");\nconst DatabusUris = __webpack_require__(/*! ../utils/databus-uris */ \"./js/utils/databus-uris.js\");\nconst JsonldUtils = __webpack_require__(/*! ../utils/jsonld-utils */ \"./js/utils/jsonld-utils.js\");\nconst PublishData = __webpack_require__(/*! ./publish-data */ \"./js/publish/publish-data.js\");\nconst DataIdCreator = __webpack_require__(/*! ./dataid-creator */ \"./js/publish/dataid-creator.js\");\nconst DatabusSparqlClient = __webpack_require__(/*! ./databus-sparql-client */ \"./js/publish/databus-sparql-client.js\");\nconst GroupHandler = __webpack_require__(/*! ./group-data */ \"./js/publish/group-data.js\");\nconst ArtifactHandler = __webpack_require__(/*! ./artifact-data */ \"./js/publish/artifact-data.js\");\nconst VersionHandler = __webpack_require__(/*! ./version-handler */ \"./js/publish/version-handler.js\");\n\nclass PublishSession {\n\n static sessionStorageKey = 'databus_upload';\n static sessionStorageIgnoreKeys = [\n '$$hashKey',\n 'eventListeners',\n 'hasLocalChanges',\n 'fileFilterInput',\n 'fileSuggestions',\n 'progress',\n 'streamQueue'\n ];\n\n\n constructor($http, $interval, accounts, apiKeys) {\n\n this.$http = $http;\n this.accounts = accounts;\n this.sparqlClient = new DatabusSparqlClient($http);\n this.formData = new PublishData();\n\n this.group = new GroupHandler($http, accounts, apiKeys);\n this.artifact = new ArtifactHandler($http, accounts, apiKeys);\n this.version = new VersionHandler($http, $interval, accounts, apiKeys);\n\n this.reset();\n }\n\n\n\n reset() {\n this.accountData = {};\n this.groupData = {};\n this.artifactData = {};\n this.versionData = {};\n }\n\n update() {\n this.validate();\n this.save();\n }\n\n async selectAccount(account) {\n this.accountData = {\n name: account.name,\n isValid: true\n };\n\n // Fetch groups for account here:\n this.groups = await this.sparqlClient.getGroups(this.accountData.name);\n \n\n this.save();\n }\n\n async selectGroup(targetGroup) {\n\n if (targetGroup == null) {\n return;\n }\n\n var group = this.formData.group;\n var artifact = this.formData.artifact;\n\n group.name = targetGroup.name;\n group.title = targetGroup.title;\n group.abstract = targetGroup.abstract;\n group.description = targetGroup.description;\n\n if (this.currentGroup == null || this.currentGroup.name != targetGroup.name) {\n this.currentGroup = targetGroup;\n\n if (this.formData.artifact.generateMetadata == 'existing') {\n this.currentArtifact = null;\n this.setCreateNewArtifact('create');\n }\n }\n }\n\n createNewGroup() {\n this.formData.group.name = \"\";\n this.formData.group.title = \"\";\n this.formData.group.abstract = \"\";\n this.formData.group.description = \"\";\n\n this.save();\n }\n\n selectArtifact(targetArtifact) {\n if (targetArtifact == null) {\n return;\n }\n\n var artifact = this.formData.artifact;\n artifact.name = targetArtifact.name;\n artifact.title = targetArtifact.title;\n artifact.abstract = targetArtifact.abstract;\n artifact.description = targetArtifact.description;\n this.currentArtifact = targetArtifact;\n\n this.availableVersions = this.accountData.versions.filter(function (v) {\n return v.startsWith(targetArtifact.uri);\n });\n }\n\n selectVersion = function (versionUri) {\n\n try {\n var relativeUri = new URL(versionUri).pathname;\n var options = {\n method: 'GET',\n url: relativeUri,\n headers: {\n 'Accept': 'application/ld+json',\n 'X-Jsonld-Formatting': 'flatten'\n }\n };\n\n var version = this.formData.version;\n version.isLoading = true;\n\n var self = this;\n\n this.$http(options).then(function (response) {\n\n var version = self.formData.version;\n version.isLoading = false;\n\n var versionData = response.data;\n var versionGraph = JsonldUtils.getTypedGraph(versionData, DatabusUris.DATABUS_VERSION);\n\n version.name = DatabusUtils.uriToName(versionGraph[DatabusUris.JSONLD_ID]);\n version.title = JsonldUtils.getProperty(versionGraph, DatabusUris.DCT_TITLE);\n version.abstract = JsonldUtils.getProperty(versionGraph, DatabusUris.DCT_ABSTRACT);\n version.description = JsonldUtils.getProperty(versionGraph, DatabusUris.DCT_DESCRIPTION);\n version.attribution = JsonldUtils.getProperty(versionGraph, DatabusUris.DATABUS_ATTRIBUTION);\n version.license = JsonldUtils.getProperty(versionGraph, DatabusUris.DCT_LICENSE);\n version.derivedFrom = JsonldUtils.getProperty(versionGraph, DatabusUris.PROV_WAS_DERIVED_FROM);\n version.contentVariants = [];\n\n var contentVariantGraphs = JsonldUtils.getTypedGraphs(versionData, DatabusUris.RDF_PROPERTY);\n\n for (var contentVariantGraph of contentVariantGraphs) {\n\n var variantName = DatabusUtils.uriToName(contentVariantGraph[DatabusUris.JSONLD_ID]);\n self.formData.addContentVariant(variantName);\n }\n\n // Add Files!\n var fileGraphs = JsonldUtils.getTypedGraphs(versionData, DatabusUris.DATABUS_PART);\n version.files = [];\n\n for (var fileGraph of fileGraphs) {\n\n var fileUri = JsonldUtils.getProperty(fileGraph, DatabusUris.DCAT_DOWNLOAD_URL);\n\n\n\n var file = {\n id: fileUri,\n url: fileUri,\n name: DatabusUtils.uriToName(fileUri),\n compression: JsonldUtils.getProperty(fileGraph, DatabusUris.DATABUS_COMPRESSION),\n formatExtension: JsonldUtils.getProperty(fileGraph, DatabusUris.DATABUS_FORMAT_EXTENSION),\n contentVariants: {}\n }\n\n for (var contentVariant of version.contentVariants) {\n var variantUri = `${DatabusUris.DATABUS_CONTENT_VARIANT_PREFIX}${contentVariant.id}`;\n var variantValue = JsonldUtils.getProperty(fileGraph, variantUri);\n\n if (variantValue != null) {\n file.contentVariants[contentVariant.id] = variantValue;\n }\n }\n\n self.formData.addFile(file);\n }\n\n\n // Save the preset values\n delete version.preset;\n version.preset = JSON.parse(JSON.stringify(version));\n });\n\n\n } catch (err) {\n console.log(err);\n }\n }\n\n addFile(file) {\n this.formData.addFile(file);\n }\n\n\n setCreateNewGroup(value) {\n this.formData.group.generateMetadata = value;\n if (value == 'create') {\n this.formData.group.name = \"\";\n this.formData.group.title = \"\";\n this.formData.group.abstract = \"\";\n this.formData.group.description = \"\";\n this.formData.group.generateAbstract = true;\n this.currentGroup = null;\n\n if (this.formData.artifact.generateMetadata == 'existing') {\n this.setCreateNewArtifact('create');\n }\n } else if (value == 'existing') {\n var hasGroups = DatabusUtils.objSize(this.accountData.groups) > 0;\n\n if (!hasGroups) {\n this.setCreateNewGroup('create');\n return;\n }\n\n if (this.currentGroup == null) {\n for (var group of this.accountData.groups) {\n this.selectGroup(group);\n break;\n }\n }\n }\n }\n\n setCreateNewArtifact(value) {\n this.formData.artifact.generateMetadata = value;\n\n if (value == 'create') {\n\n this.availableVersions = [];\n this.formData.artifact.name = \"\";\n this.formData.artifact.title = \"\";\n this.formData.artifact.description = \"\";\n this.currentArtifact = null;\n\n if (this.formData.version.generateMetadata == 'existing') {\n this.setCreateNewVersion('create');\n }\n\n } else if (value == 'existing') {\n\n if (!this.currentGroup.hasArtifacts) {\n this.setCreateNewArtifact('create');\n return;\n }\n\n if (this.currentArtifact == null) {\n this.selectArtifact(this.currentGroup.artifacts[0]);\n }\n } else {\n\n this.availableVersions = [];\n if (this.formData.version.generateMetadata != 'none') {\n this.setCreateNewVersion('none');\n }\n }\n }\n\n setCreateNewVersion(value) {\n this.formData.version.generateMetadata = value;\n\n if (value == 'create') {\n\n\n } else if (value == 'existing') {\n\n if (this.availableVersions.length == 0) {\n this.setCreateNewVersion('create');\n return;\n }\n\n this.selectVersion(this.availableVersions[0]);\n }\n\n }\n currentGroupHasArtifacts() {\n if (this.formData.group.generateMetadata == 'create') {\n return false;\n }\n\n return this.currentGroup.artifacts != null && this.currentGroup.artifacts.length > 0;\n }\n\n initializeField(source, name, defaultValue) {\n this[name] = source != null ? source[name] : defaultValue;\n }\n\n save() {\n\n let data = {\n accountData: this.accountData,\n groupData: this.groupData,\n artifactData: this.artifactData,\n versionData: this.versionData,\n formData: this.formData,\n }\n\n\n try {\n var sessionDataString = JSON.stringify(data, function (key, value) {\n if (PublishSession.sessionStorageIgnoreKeys.includes(key)) {\n return undefined;\n }\n return value;\n });\n\n window.sessionStorage.setItem(PublishSession.sessionStorageKey, sessionDataString);\n } catch (e) {\n console.log(e);\n }\n }\n\n static resume($http, sub, accountData) {\n\n var sessionData = JSON.parse(window.sessionStorage.getItem(PublishSession.sessionStorageKey));\n\n if (sessionData == null || sessionData.sub == null) {\n return null;\n }\n\n if (sub != sessionData.sub) {\n return null;\n }\n\n var publishSession = new PublishSession($http, sessionData, accountData);\n\n return publishSession;\n }\n\n onChange() {\n this.validate();\n this.inputs = this.dataIdCreator.createInputs();\n this.save();\n\n if (this.dataIdCreator != undefined) {\n this.inputs = this.dataIdCreator.createInputs();\n\n this.isReadyForUpload =\n !this.formData.artifact.errors.length > 0 &&\n !this.formData.group.errors.length > 0 &&\n !this.formData.version.errors.length > 0 &&\n !this.formData.files.errors.length > 0;\n }\n }\n\n onChangeGroup() {\n\n let group = this.formData.group;\n\n group.errors = [];\n group.warnings = [];\n\n if (!DatabusUtils.isValidGroupName(group.name)) {\n group.errors.push('err_invalid_group_name');\n }\n\n var existingGroup = this.groups.filter(function (value) {\n return value.name == self.group.name;\n });\n\n if (existingGroup.length > 0 && group.mode == 'create') {\n group.warnings.push('warning_group_exists');\n }\n\n this.save();\n }\n\n getValidString(value) {\n if (value == undefined || value.length == 0) {\n return undefined;\n }\n\n return value;\n }\n\n updateGroupBody() {\n var accountUri = `${DATABUS_RESOURCE_BASE_URL}/${this.accountData.name}`;\n\n this.groupBody = {\n \"@context\": this.getContext(),\n \"@graph\": [\n {\n \"@id\": `${accountUri}/${this.formData.group.name}`,\n \"@type\": \"Group\",\n \"title\": this.getValidString(this.formData.group.title),\n \"abstract\": this.getValidString(this.formData.group.abstract),\n \"description\": this.getValidString(this.formData.group.description)\n }\n ]\n };\n }\n\n getContext() {\n if (DATABUS_CONTEXT_URL != undefined && DatabusUtils.isValidHttpUrl(DATABUS_CONTEXT_URL)) {\n return DATABUS_CONTEXT_URL;\n }\n\n return DATABUS_CONTEXT[DatabusUris.JSONLD_CONTEXT];\n }\n\n onChangeArtifact() {\n\n let artifact = this.formData.artifact;\n\n artifact.errors = [];\n artifact.warnings = [];\n\n if (!DatabusUtils.isValidArtifactName(artifact.name)) {\n artifact.errors.push('err_invalid_artifact_name');\n }\n\n if (this.artifacts != null) {\n var existingArtifact = this.artifacts.filter(function (value) {\n return value.name == self.group.name;\n });\n\n if (existingArtifact.length > 0 && artifact.mode == 'create') {\n artifact.warnings.push('warning_group_exists');\n }\n }\n\n this.save();\n\n }\n}\n\nmodule.exports = PublishSession;\n\n\n//# sourceURL=webpack://databus-webapp/./js/publish/publish-session.js?\n}"); -/***/ }), +/***/ }, -/***/ "./js/publish/version-handler.js": +/***/ "./js/publish/version-handler.js" /*!***************************************!*\ !*** ./js/publish/version-handler.js ***! \***************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +(module, __unused_webpack_exports, __webpack_require__) { -eval("const EntityHandler = __webpack_require__(/*! ./entity-handler */ \"./js/publish/entity-handler.js\");\nconst DatabusUtils = __webpack_require__(/*! ../utils/databus-utils */ \"./js/utils/databus-utils.js\");\nconst DatabusUris = __webpack_require__(/*! ../utils/databus-uris */ \"./js/utils/databus-uris.js\");\nconst GroupData = __webpack_require__(/*! ./group-data */ \"./js/publish/group-data.js\");\n\nclass VersionHandler extends EntityHandler {\n constructor($http, $interval, accounts, apiKeys) {\n super('databus_registration_version_data', $http, $interval, accounts, apiKeys);\n }\n\n initialize(data) {\n const validAccount = data && this.accounts.some(acc => acc.accountName === data.accountName);\n\n if (validAccount) {\n Object.assign(this, data);\n } else {\n this.accountName = this.accounts[0]?.name;\n }\n\n if (this.apiKeyName == null && this.apiKeys != null && this.apiKeys.length > 0) {\n this.apiKeyName = this.apiKeys[0].keyname;\n }\n\n this.pageIndex ??= 0;\n this.sendmode ??= 'register';\n this.files ??= [];\n this.contentVariants ??= [];\n\n if (!this.contentVariants.some(v => v.id == 'formatExtension')) {\n this.contentVariants.push({\n label: 'Format',\n id: 'formatExtension',\n custom: false\n });\n }\n\n if (!this.contentVariants.some(v => v.id == 'compression')) {\n this.contentVariants.push({\n label: 'Compression',\n id: 'compression',\n custom: false\n });\n }\n\n let self = this;\n\n this.$interval(function () {\n if (self.hasLicenseQueryChanged) {\n\n self.$http.get(`/app/publish-wizard/licenses?limit=30&keyword=${self.licenseQuery}`)\n .then(function (response) {\n self.filteredLicenseList = response.data.results.bindings;\n });\n\n self.hasLicenseQueryChanged = false;\n }\n\n }, 300);\n\n this.licenseQuery = \"\";\n this.filterLicenses();\n this.onAccountNameChanged();\n this.onGroupNameChanged();\n this.onArtifactNameChanged();\n }\n\n getURI() {\n return `${DATABUS_RESOURCE_BASE_URL}/${this.accountName}/${this.groupName}/${this.artifactName}/${this.name}`;\n }\n\n setLicense(license) {\n this.license = license;\n this.onChange();\n }\n\n filterLicenses() {\n this.hasLicenseQueryChanged = true;\n }\n\n validate() {\n this.errors = [];\n this.warnings = [];\n\n if (!DatabusUtils.isValidVersionIdentifier(this.name)) {\n this.errors.push('err_invalid_version_name');\n }\n\n if (!DatabusUtils.isValidGroupName(this.groupName)) {\n this.errors.push('err_no_group_selected');\n }\n\n if (!DatabusUtils.isValidArtifactName(this.artifactName)) {\n this.errors.push('err_no_artifact_selected');\n }\n\n if (!DatabusUtils.isValidResourceLabel(this.title, 1)) {\n this.errors.push('err_invalid_version_title');\n }\n\n if (!DatabusUtils.isValidResourceText(this.abstract, 1)) {\n this.errors.push('err_invalid_version_abstract');\n }\n\n if (!DatabusUtils.isValidResourceText(this.description, 1)) {\n this.errors.push('err_invalid_version_description');\n }\n\n if (!DatabusUtils.isValidUrl(this.license)) {\n this.errors.push('err_invalid_version_license');\n }\n\n if (this.files.length == 0) {\n this.errors.push('err_no_files');\n }\n\n for (let file of this.files) {\n file.errors = [];\n }\n\n this.fileErrors = [];\n\n this.cvSplit(this.files, 0);\n\n for (let file of this.files) {\n for (let error of file.errors) {\n this.errors.push(error);\n this.fileErrors.push(error);\n }\n }\n\n const exists = this.artifactList?.some(a => a.name === this.name);\n if (exists) {\n this.warnings.push('warning_artifact_exists');\n }\n }\n\n getSaveData() {\n return {\n accountName: this.accountName,\n groupName: this.groupName,\n artifactName: this.artifactName,\n name: this.name,\n title: this.title,\n abstract: this.abstract,\n description: this.description,\n sendmode: this.sendmode,\n apiKeyName: this.apiKeyName,\n wasDerivedFrom: this.wasDerivedFrom,\n attribution: this.attribution,\n license: this.license,\n pageIndex: this.pageIndex,\n contentVariants: this.contentVariants,\n files: this.files\n };\n }\n\n\n async setGroupName(groupName) {\n if (this.groupName !== groupName) {\n this.groupName = groupName;\n await this.onGroupNameChanged();\n }\n }\n\n async onGroupNameChanged() {\n this.isLoadingArtifacts = true;\n this.artifactList = await this.sparqlClient.getArtifacts(this.accountName, this.groupName);\n this.isLoadingArtifacts = false;\n this.onChange();\n }\n\n async setArtifactName(artifactName) {\n if (this.artifactName !== artifactName) {\n this.artifactName = artifactName;\n await this.onArtifactNameChanged();\n }\n }\n\n async onArtifactNameChanged() {\n this.isLoadingVersions = true;\n this.versionList = await this.sparqlClient.getVersions(this.accountName, this.groupName, this.artifactName);\n this.isLoadingVersions = false;\n this.onChange();\n }\n\n\n updateOutputs() {\n\n const artifactUri = `${DATABUS_RESOURCE_BASE_URL}/${GroupData.getStringOrMissing(this.accountName)}/${GroupData.getStringOrMissing(this.groupName)}/${GroupData.getStringOrMissing(this.artifactName)}`;\n let versionUri = `${artifactUri}/${GroupData.getStringOrMissing(this.name)}`;\n\n let graph = {\n \"@id\": versionUri,\n \"@type\": \"Version\",\n \"title\": this.getValidString(this.title),\n \"abstract\": this.getValidString(this.abstract),\n \"description\": this.getValidString(this.description),\n \"license\": this.getValidString(this.license),\n \"attribution\": this.getValidString(this.attribution),\n \"wasDerivedFrom\": this.getValidString(this.wasDerivedFrom),\n }\n\n graph.distribution = [];\n\n\n let customVariants = [];\n\n for (var fg in this.files) {\n\n var file = this.files[fg];\n\n var variantSuffix = '';\n for (var c in this.contentVariants) {\n var cv = this.contentVariants[c];\n var value = file.contentVariants[cv.id];\n\n if (value == undefined || value == \"\") {\n continue;\n }\n\n variantSuffix += '_' + cv.id + '=' + value;\n }\n\n let fileName = this.artifactName;\n\n var distributionUri = `${versionUri}#${fileName}`;\n var fileUri = `${versionUri}/${fileName}${variantSuffix}`;\n\n distributionUri += variantSuffix;\n\n let formatExtension = this.getValidString(file.contentVariants['formatExtension']);\n\n if (formatExtension == undefined) {\n formatExtension = 'none';\n }\n\n if (formatExtension != 'none') {\n distributionUri += '.' + formatExtension;\n fileUri += '.' + formatExtension;\n }\n\n let compression = this.getValidString(file.contentVariants['compression']);\n\n if (compression == undefined) {\n compression = 'none';\n }\n\n if (compression != 'none') {\n distributionUri += '.' + compression;\n fileUri += '.' + compression;\n }\n\n var distribution = {\n \"@type\": \"Part\",\n \"formatExtension\": formatExtension,\n \"compression\": compression,\n \"downloadURL\": file.uri,\n \"byteSize\": file.byteSize,\n \"sha256sum\": file.sha256sum,\n };\n\n for (var c in this.contentVariants) {\n var cv = this.contentVariants[c];\n\n if (!cv.custom) {\n continue;\n }\n\n var value = file.contentVariants[cv.id];\n\n if (value == undefined || value == \"\") {\n continue;\n }\n\n distribution['dcv:' + cv.label] = value;\n\n if (!customVariants.includes(cv.id)) {\n customVariants.push(cv.id);\n }\n }\n\n graph.distribution.push(distribution);\n }\n\n\n\n\n this.postBody = {\n \"@context\": this.getContext(),\n \"@graph\": [\n graph\n ]\n };\n\n\n\n const payload = JSON.stringify(this.postBody, null, 2);\n const apiKey = this.apiKeys?.find(k => k.keyname === this.apiKeyName)?.apikey;\n\n this.curlCommand = [\n `curl -X POST ${DATABUS_RESOURCE_BASE_URL}/api/register \\\\`,\n ` -H \"X-API-KEY: ${GroupData.getStringOrMissing(apiKey)}\" \\\\`,\n ` -H \"Content-Type: application/json\" \\\\`,\n ` -d '${payload}'`\n ].join('\\n');\n }\n\n createVersionName(v) {\n if (v == 0) {\n this.name = new Date().toISOString().slice(0, 10);\n }\n\n if (v == 1) {\n this.name = new Date().toISOString().slice(0, 13);\n }\n\n this.onChange();\n }\n\n changePage(diff) {\n this.pageIndex = Math.max(0, this.pageIndex + diff);\n this.onChange();\n };\n\n addContentVariant(variant) {\n\n if (variant == undefined || variant == '') {\n return;\n }\n\n if (this.contentVariants == undefined) {\n this.contentVariants = [];\n }\n\n for (var c in this.contentVariants) {\n if (this.contentVariants[c].id == variant) {\n return;\n }\n }\n\n this.contentVariants.push({\n label: variant,\n id: DatabusUtils.uuidv4(),\n fillRegex: '',\n toLower: true,\n pruneWhitespaces: true,\n custom: true,\n });\n\n this.onChange();\n }\n\n\n removeContentVariant(variant) {\n this.contentVariants = this.contentVariants.filter(function (d) {\n return d.id != variant.id;\n });\n\n for (var f in this.files) {\n var file = this.files[f];\n delete file.contentVariants[variant.id];\n }\n\n this.editContentVariant = null;\n this.onChange();\n }\n\n addFiles(input) {\n var lines = input.split('\\n');\n for (var line of lines) {\n if (line != undefined && line.length > 0) {\n this.addFile(line);\n }\n }\n }\n\n addFile(file) {\n\n if (typeof file === 'string') {\n file = { url: file };\n }\n\n if (this.files == undefined) {\n this.files = [];\n }\n\n // Check if already added\n for (var f in this.files) {\n if (file.url == this.files[f].url) {\n return;\n }\n }\n\n var uri = file.url;\n var uriParts = uri.split('/');\n var name = uriParts.pop();\n var nameComponents = name.split('.');\n name = nameComponents[0];\n\n if (name.length > 50) {\n name = name.substr(0, 50) + '...';\n }\n\n name = decodeURIComponent(name);\n // Files with uri as key!!\n\n this.files.push({\n id: uri,\n uri: file.url,\n name: name,\n contentVariants: file.contentVariants != null ? file.contentVariants : {},\n rowspan: 1,\n });\n\n this.files.sort(function (a, b) {\n var nameA = a.name;\n var nameB = b.name;\n\n if (nameA < nameB) {\n return -1;\n }\n if (nameA > nameB) {\n return 1;\n }\n\n return 0;\n });\n\n let k = 1;\n\n for (let file of this.files) {\n file.rowIndex = k++;\n }\n\n this.onChange();\n }\n\n removeFile = function (file, index) {\n this.files.splice(index, 1);\n this.onChange();\n }\n\n\n fill(variant) {\n\n var val = variant.fillRegex;\n\n for (var file of this.files) {\n\n if (variant.toLower) {\n val = val.toLowerCase();\n }\n\n if (variant.pruneWhitespaces) {\n val = val.replaceAll(' ', '');\n }\n\n if (!variant.overwrite && file.contentVariants[variant.id] != undefined\n && file.contentVariants[variant.id].length > 0) {\n continue;\n }\n\n file.contentVariants[variant.id] = val;\n }\n\n this.onChange();\n }\n\n fillByRegex(variant) {\n var regex = new RegExp(variant.fillRegex);\n\n for (var file of this.files) {\n var matches = file.name.match(regex);\n\n if (matches != null) {\n var val = matches[0];\n\n if (variant.toLower) {\n val = val.toLowerCase();\n }\n\n if (variant.pruneWhitespaces) {\n val = val.replaceAll(' ', '');\n }\n\n if (!variant.overwrite && file.contentVariants[variant.id] != undefined\n && file.contentVariants[variant.id].length > 0) {\n continue;\n }\n\n file.contentVariants[variant.id] = val;\n }\n }\n\n this.onChange();\n }\n\n getRowIndex(files, name) {\n var k = 1;\n for (var f in files) {\n if (files[f].name == name) {\n return k;\n }\n\n k++;\n }\n\n return -1;\n }\n\n\n cvSplit(files, cvIndex) {\n\n if (files.length <= 1) {\n return;\n }\n\n if (this.contentVariants == undefined) {\n this.contentVariants = [];\n }\n // if end of cvs, assign errors to all files if files.length > 1\n if (cvIndex - 2 >= this.contentVariants.length) {\n\n if (files.length > 1) {\n\n var cvHints = [];\n\n if (this.contentVariants.length == 0) {\n cvHints.push('No content variants have been added yet. Add content variants in the files panel in order to tag your files.');\n } else {\n for (var c in this.contentVariants) {\n var cv = this.contentVariants[c];\n var value = files[0].contentVariants[cv.id];\n\n if (value == undefined || value == '') {\n value = 'none';\n }\n\n cvHints.push(cv.id + ': ' + value);\n }\n }\n\n for (let file of files) {\n\n var errorMessage = 'Row ' + file.rowIndex + ' (' +\n cvHints.join(', ') + ').';\n\n file.errors.push({ key: 'err_duplicate_file', message: errorMessage });\n }\n }\n\n return;\n }\n\n // else create buckets and sort files into buckets\n var buckets = {};\n\n for (var f in files) {\n var file = files[f];\n\n var key = null;\n\n if (cvIndex == 0) {\n key = file.formatExtension;\n } else if (cvIndex == 1) {\n key = file.compression;\n } else {\n key = file.contentVariants[this.contentVariants[cvIndex - 2].id];\n }\n\n if (key == undefined || key == '') {\n key = '$_none$';\n }\n\n if (buckets[key] == undefined) {\n buckets[key] = [];\n }\n\n buckets[key].push(file);\n }\n\n // iterate buckets and call recursively\n for (var b in buckets) {\n this.cvSplit(buckets[b], cvIndex + 1);\n }\n }\n\n onEditContentVariant(index) {\n this.editContentVariant = this.contentVariants[index];\n }\n\n}\n\nmodule.exports = VersionHandler;\n\n\n//# sourceURL=webpack://databus-webapp/./js/publish/version-handler.js?"); +eval("{const EntityHandler = __webpack_require__(/*! ./entity-handler */ \"./js/publish/entity-handler.js\");\nconst DatabusUtils = __webpack_require__(/*! ../utils/databus-utils */ \"./js/utils/databus-utils.js\");\nconst DatabusUris = __webpack_require__(/*! ../utils/databus-uris */ \"./js/utils/databus-uris.js\");\nconst GroupData = __webpack_require__(/*! ./group-data */ \"./js/publish/group-data.js\");\n\nclass VersionHandler extends EntityHandler {\n constructor($http, $interval, accounts, apiKeys) {\n super('databus_registration_version_data', $http, $interval, accounts, apiKeys);\n }\n\n initialize(data) {\n const validAccount = data && this.accounts.some(acc => acc.accountName === data.accountName);\n\n if (validAccount) {\n Object.assign(this, data);\n } else {\n this.accountName = this.accounts[0]?.name;\n }\n\n if (this.apiKeyName == null && this.apiKeys != null && this.apiKeys.length > 0) {\n this.apiKeyName = this.apiKeys[0].keyname;\n }\n\n this.pageIndex ??= 0;\n this.sendmode ??= 'register';\n this.files ??= [];\n this.contentVariants ??= [];\n\n if (!this.contentVariants.some(v => v.id == 'formatExtension')) {\n this.contentVariants.push({\n label: 'Format',\n id: 'formatExtension',\n custom: false\n });\n }\n\n if (!this.contentVariants.some(v => v.id == 'compression')) {\n this.contentVariants.push({\n label: 'Compression',\n id: 'compression',\n custom: false\n });\n }\n\n let self = this;\n\n this.$interval(function () {\n if (self.hasLicenseQueryChanged) {\n\n self.$http.get(`/app/publish-wizard/licenses?limit=30&keyword=${self.licenseQuery}`)\n .then(function (response) {\n self.filteredLicenseList = response.data.results.bindings;\n });\n\n self.hasLicenseQueryChanged = false;\n }\n\n }, 300);\n\n this.licenseQuery = \"\";\n this.filterLicenses();\n this.onAccountNameChanged();\n this.onGroupNameChanged();\n this.onArtifactNameChanged();\n }\n\n getURI() {\n return `${DATABUS_RESOURCE_BASE_URL}/${this.accountName}/${this.groupName}/${this.artifactName}/${this.name}`;\n }\n\n setLicense(license) {\n this.license = license;\n this.onChange();\n }\n\n filterLicenses() {\n this.hasLicenseQueryChanged = true;\n }\n\n validate() {\n this.errors = [];\n this.warnings = [];\n\n if (!DatabusUtils.isValidVersionIdentifier(this.name)) {\n this.errors.push('err_invalid_version_name');\n }\n\n if (!DatabusUtils.isValidGroupName(this.groupName)) {\n this.errors.push('err_no_group_selected');\n }\n\n if (!DatabusUtils.isValidArtifactName(this.artifactName)) {\n this.errors.push('err_no_artifact_selected');\n }\n\n if (!DatabusUtils.isValidResourceLabel(this.title, 1)) {\n this.errors.push('err_invalid_version_title');\n }\n\n if (!DatabusUtils.isValidResourceText(this.abstract, 1)) {\n this.errors.push('err_invalid_version_abstract');\n }\n\n if (!DatabusUtils.isValidResourceText(this.description, 1)) {\n this.errors.push('err_invalid_version_description');\n }\n\n if (!DatabusUtils.isValidUrl(this.license)) {\n this.errors.push('err_invalid_version_license');\n }\n\n if (this.files.length == 0) {\n this.errors.push('err_no_files');\n }\n\n for (let file of this.files) {\n file.errors = [];\n }\n\n this.fileErrors = [];\n\n this.cvSplit(this.files, 0);\n\n for (let file of this.files) {\n for (let error of file.errors) {\n this.errors.push(error);\n this.fileErrors.push(error);\n }\n }\n\n const exists = this.artifactList?.some(a => a.name === this.name);\n if (exists) {\n this.warnings.push('warning_artifact_exists');\n }\n }\n\n getSaveData() {\n return {\n accountName: this.accountName,\n groupName: this.groupName,\n artifactName: this.artifactName,\n name: this.name,\n title: this.title,\n abstract: this.abstract,\n description: this.description,\n sendmode: this.sendmode,\n apiKeyName: this.apiKeyName,\n wasDerivedFrom: this.wasDerivedFrom,\n attribution: this.attribution,\n license: this.license,\n pageIndex: this.pageIndex,\n contentVariants: this.contentVariants,\n files: this.files\n };\n }\n\n\n async setGroupName(groupName) {\n if (this.groupName !== groupName) {\n this.groupName = groupName;\n await this.onGroupNameChanged();\n }\n }\n\n async onGroupNameChanged() {\n this.isLoadingArtifacts = true;\n this.artifactList = await this.sparqlClient.getArtifacts(this.accountName, this.groupName);\n this.isLoadingArtifacts = false;\n this.onChange();\n }\n\n async setArtifactName(artifactName) {\n if (this.artifactName !== artifactName) {\n this.artifactName = artifactName;\n await this.onArtifactNameChanged();\n }\n }\n\n async onArtifactNameChanged() {\n this.isLoadingVersions = true;\n this.versionList = await this.sparqlClient.getVersions(this.accountName, this.groupName, this.artifactName);\n this.isLoadingVersions = false;\n this.onChange();\n }\n\n\n updateOutputs() {\n\n const artifactUri = `${DATABUS_RESOURCE_BASE_URL}/${GroupData.getStringOrMissing(this.accountName)}/${GroupData.getStringOrMissing(this.groupName)}/${GroupData.getStringOrMissing(this.artifactName)}`;\n let versionUri = `${artifactUri}/${GroupData.getStringOrMissing(this.name)}`;\n\n let graph = {\n \"@id\": versionUri,\n \"@type\": \"Version\",\n \"title\": this.getValidString(this.title),\n \"abstract\": this.getValidString(this.abstract),\n \"description\": this.getValidString(this.description),\n \"license\": this.getValidString(this.license),\n \"attribution\": this.getValidString(this.attribution),\n \"wasDerivedFrom\": this.getValidString(this.wasDerivedFrom),\n }\n\n graph.distribution = [];\n\n\n let customVariants = [];\n\n for (var fg in this.files) {\n\n var file = this.files[fg];\n\n var variantSuffix = '';\n for (var c in this.contentVariants) {\n var cv = this.contentVariants[c];\n var value = file.contentVariants[cv.id];\n\n if (value == undefined || value == \"\") {\n continue;\n }\n\n variantSuffix += '_' + cv.id + '=' + value;\n }\n\n let fileName = this.artifactName;\n\n var distributionUri = `${versionUri}#${fileName}`;\n var fileUri = `${versionUri}/${fileName}${variantSuffix}`;\n\n distributionUri += variantSuffix;\n\n let formatExtension = this.getValidString(file.contentVariants['formatExtension']);\n\n if (formatExtension == undefined) {\n formatExtension = 'none';\n }\n\n if (formatExtension != 'none') {\n distributionUri += '.' + formatExtension;\n fileUri += '.' + formatExtension;\n }\n\n let compression = this.getValidString(file.contentVariants['compression']);\n\n if (compression == undefined) {\n compression = 'none';\n }\n\n if (compression != 'none') {\n distributionUri += '.' + compression;\n fileUri += '.' + compression;\n }\n\n var distribution = {\n \"@type\": \"Part\",\n \"formatExtension\": formatExtension,\n \"compression\": compression,\n \"downloadURL\": file.uri,\n \"byteSize\": file.byteSize,\n \"sha256sum\": file.sha256sum,\n };\n\n for (var c in this.contentVariants) {\n var cv = this.contentVariants[c];\n\n if (!cv.custom) {\n continue;\n }\n\n var value = file.contentVariants[cv.id];\n\n if (value == undefined || value == \"\") {\n continue;\n }\n\n distribution['dcv:' + cv.label] = value;\n\n if (!customVariants.includes(cv.id)) {\n customVariants.push(cv.id);\n }\n }\n\n graph.distribution.push(distribution);\n }\n\n\n\n\n this.postBody = {\n \"@context\": this.getContext(),\n \"@graph\": [\n graph\n ]\n };\n\n\n\n const payload = JSON.stringify(this.postBody, null, 2);\n const apiKey = this.apiKeys?.find(k => k.keyname === this.apiKeyName)?.apikey;\n\n this.curlCommand = [\n `curl -X POST ${DATABUS_RESOURCE_BASE_URL}/api/register \\\\`,\n ` -H \"X-API-KEY: ${GroupData.getStringOrMissing(apiKey)}\" \\\\`,\n ` -H \"Content-Type: application/json\" \\\\`,\n ` -d '${payload}'`\n ].join('\\n');\n }\n\n createVersionName(v) {\n if (v == 0) {\n this.name = new Date().toISOString().slice(0, 10);\n }\n\n if (v == 1) {\n this.name = new Date().toISOString().slice(0, 13);\n }\n\n this.onChange();\n }\n\n changePage(diff) {\n this.pageIndex = Math.max(0, this.pageIndex + diff);\n this.onChange();\n };\n\n addContentVariant(variant) {\n\n if (variant == undefined || variant == '') {\n return;\n }\n\n if (this.contentVariants == undefined) {\n this.contentVariants = [];\n }\n\n for (var c in this.contentVariants) {\n if (this.contentVariants[c].id == variant) {\n return;\n }\n }\n\n this.contentVariants.push({\n label: variant,\n id: DatabusUtils.uuidv4(),\n fillRegex: '',\n toLower: true,\n pruneWhitespaces: true,\n custom: true,\n });\n\n this.onChange();\n }\n\n\n removeContentVariant(variant) {\n this.contentVariants = this.contentVariants.filter(function (d) {\n return d.id != variant.id;\n });\n\n for (var f in this.files) {\n var file = this.files[f];\n delete file.contentVariants[variant.id];\n }\n\n this.editContentVariant = null;\n this.onChange();\n }\n\n addFiles(input) {\n var lines = input.split('\\n');\n for (var line of lines) {\n if (line != undefined && line.length > 0) {\n this.addFile(line);\n }\n }\n }\n\n addFile(file) {\n\n if (typeof file === 'string') {\n file = { url: file };\n }\n\n if (this.files == undefined) {\n this.files = [];\n }\n\n // Check if already added\n for (var f in this.files) {\n if (file.url == this.files[f].url) {\n return;\n }\n }\n\n var uri = file.url;\n var uriParts = uri.split('/');\n var name = uriParts.pop();\n var nameComponents = name.split('.');\n name = nameComponents[0];\n\n if (name.length > 50) {\n name = name.substr(0, 50) + '...';\n }\n\n name = decodeURIComponent(name);\n // Files with uri as key!!\n\n this.files.push({\n id: uri,\n uri: file.url,\n name: name,\n contentVariants: file.contentVariants != null ? file.contentVariants : {},\n rowspan: 1,\n });\n\n this.files.sort(function (a, b) {\n var nameA = a.name;\n var nameB = b.name;\n\n if (nameA < nameB) {\n return -1;\n }\n if (nameA > nameB) {\n return 1;\n }\n\n return 0;\n });\n\n let k = 1;\n\n for (let file of this.files) {\n file.rowIndex = k++;\n }\n\n this.onChange();\n }\n\n removeFile = function (file, index) {\n this.files.splice(index, 1);\n this.onChange();\n }\n\n\n fill(variant) {\n\n var val = variant.fillRegex;\n\n for (var file of this.files) {\n\n if (variant.toLower) {\n val = val.toLowerCase();\n }\n\n if (variant.pruneWhitespaces) {\n val = val.replaceAll(' ', '');\n }\n\n if (!variant.overwrite && file.contentVariants[variant.id] != undefined\n && file.contentVariants[variant.id].length > 0) {\n continue;\n }\n\n file.contentVariants[variant.id] = val;\n }\n\n this.onChange();\n }\n\n fillByRegex(variant) {\n var regex = new RegExp(variant.fillRegex);\n\n for (var file of this.files) {\n var matches = file.name.match(regex);\n\n if (matches != null) {\n var val = matches[0];\n\n if (variant.toLower) {\n val = val.toLowerCase();\n }\n\n if (variant.pruneWhitespaces) {\n val = val.replaceAll(' ', '');\n }\n\n if (!variant.overwrite && file.contentVariants[variant.id] != undefined\n && file.contentVariants[variant.id].length > 0) {\n continue;\n }\n\n file.contentVariants[variant.id] = val;\n }\n }\n\n this.onChange();\n }\n\n getRowIndex(files, name) {\n var k = 1;\n for (var f in files) {\n if (files[f].name == name) {\n return k;\n }\n\n k++;\n }\n\n return -1;\n }\n\n\n cvSplit(files, cvIndex) {\n\n if (files.length <= 1) {\n return;\n }\n\n if (this.contentVariants == undefined) {\n this.contentVariants = [];\n }\n // if end of cvs, assign errors to all files if files.length > 1\n if (cvIndex - 2 >= this.contentVariants.length) {\n\n if (files.length > 1) {\n\n var cvHints = [];\n\n if (this.contentVariants.length == 0) {\n cvHints.push('No content variants have been added yet. Add content variants in the files panel in order to tag your files.');\n } else {\n for (var c in this.contentVariants) {\n var cv = this.contentVariants[c];\n var value = files[0].contentVariants[cv.id];\n\n if (value == undefined || value == '') {\n value = 'none';\n }\n\n cvHints.push(cv.id + ': ' + value);\n }\n }\n\n for (let file of files) {\n\n var errorMessage = 'Row ' + file.rowIndex + ' (' +\n cvHints.join(', ') + ').';\n\n file.errors.push({ key: 'err_duplicate_file', message: errorMessage });\n }\n }\n\n return;\n }\n\n // else create buckets and sort files into buckets\n var buckets = {};\n\n for (var f in files) {\n var file = files[f];\n\n var key = null;\n\n if (cvIndex == 0) {\n key = file.formatExtension;\n } else if (cvIndex == 1) {\n key = file.compression;\n } else {\n key = file.contentVariants[this.contentVariants[cvIndex - 2].id];\n }\n\n if (key == undefined || key == '') {\n key = '$_none$';\n }\n\n if (buckets[key] == undefined) {\n buckets[key] = [];\n }\n\n buckets[key].push(file);\n }\n\n // iterate buckets and call recursively\n for (var b in buckets) {\n this.cvSplit(buckets[b], cvIndex + 1);\n }\n }\n\n onEditContentVariant(index) {\n this.editContentVariant = this.contentVariants[index];\n }\n\n}\n\nmodule.exports = VersionHandler;\n\n\n//# sourceURL=webpack://databus-webapp/./js/publish/version-handler.js?\n}"); -/***/ }), +/***/ }, -/***/ "./js/query-builder/query-builder.js": +/***/ "./js/query-builder/query-builder.js" /*!*******************************************!*\ !*** ./js/query-builder/query-builder.js ***! \*******************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +(module, __unused_webpack_exports, __webpack_require__) { -eval("const QueryNode = __webpack_require__(/*! ./query-node */ \"./js/query-builder/query-node.js\");\n\nclass QueryBuilder {\n\n static build(config) {\n var builder = new QueryBuilder();\n return builder.createQuery(config.node, config.template, config.resourceBaseUrl, config.root);\n }\n\n\n isValidHttpUrl(string) {\n let url;\n\n try {\n url = new URL(string);\n } catch (_) {\n return false;\n }\n\n return url.protocol === \"http:\" || url.protocol === \"https:\";\n }\n\n uniqueList(arr) {\n var u = {}, a = [];\n for (var i = 0, l = arr.length; i < l; ++i) {\n if (!u.hasOwnProperty(arr[i])) {\n a.push(arr[i]);\n u[arr[i]] = 1;\n }\n }\n return a;\n }\n\n createQuery(node, template, resourceBaseUrl, root) {\n\n this.result = '';\n this.baseNode = node;\n this.root = root != undefined ? root : node;\n this.cvCounter = 0;\n this.resourceBaseUrl = resourceBaseUrl;\n this.select = template.select;\n this.template = template.body;\n this.templateInsertionKey = template.placeholder != undefined ? template.placeholder : `%QUERY%`;\n this.prefixes = template.prefixes;\n this.aggregate = template.aggregate;\n this.stringSuffix = '';\n\n this.appendLine(this.select, 0);\n this.appendLine(`{`, 0);\n this.createNodeSubquery(node, template.indent, false);\n this.appendLine(`}`, 0);\n\n if (this.aggregate != undefined) {\n this.appendLine(this.aggregate, 0);\n }\n\n this.prependPrefixes();\n return this.result;\n }\n\n removeAndCollectPrefixes(query) {\n var lines = query.split('\\n');\n var result = \"\";\n\n for (var line of lines) {\n if (line.toLowerCase().startsWith('prefix')) {\n this.prefixes.push(line);\n } else {\n result += line + '\\n';\n }\n }\n\n return result.substring(0, result.length - 1);\n }\n\n prependPrefixes() {\n\n this.prefixes = this.uniqueList(this.prefixes);\n\n for (var line of this.prefixes) {\n this.prependLine(line, 0);\n }\n }\n\n appendTemplateHeader(indent) {\n for (var line of this.template) {\n\n if (line == this.templateInsertionKey) {\n break;\n }\n\n this.appendLine(line, indent);\n }\n }\n\n appendTemplateFooter(indent) {\n var write = false;\n\n for (var line of this.template) {\n\n if (write) {\n this.appendLine(line, indent);\n }\n\n if (line == this.templateInsertionKey) {\n write = true;\n }\n }\n }\n\n appendTemplate(node, indent) {\n\n this.appendTemplateHeader(indent);\n this.createNodeSubquery(node, indent + 1, true);\n\n if (node.property == null && node.childNodes.length == 0) {\n this.appendLine(`?distribution a dataid:Nonsense .`, indent + 1)\n }\n\n this.appendTemplateFooter(indent);\n }\n\n /**\n * Create a subquery for any query node. The subquery consist of the node facets and\n * a UNION of child node queries (this function is called revursively on the child nodes)\n * @param {*} node \n */\n createNodeSubquery(node, indent, hasService) {\n // Initialize empty result\n\n if (hasService == undefined) {\n hasService = false;\n }\n\n // Get source...\n var sourceUri = this.findSourceUri(node);\n\n if (!hasService && sourceUri != null) {\n\n if (sourceUri != this.resourceBaseUrl) {\n this.appendLine(`SERVICE <${sourceUri}/sparql>`, indent);\n this.appendLine(`{`, indent);\n\n this.appendTemplate(node, indent + 1);\n this.appendLine(`}`, indent);\n\n } else {\n this.appendTemplate(node, indent);\n }\n\n return;\n }\n\n if (node.uri != null) {\n\n if (!this.isValidHttpUrl(node.uri)) {\n\n // Custom query node\n var query = this.removeAndCollectPrefixes(node.property);\n var lines = query.split('\\n');\n for (var line of lines) {\n this.appendLine(line, indent);\n }\n\n return;\n }\n }\n\n // If a node property was set, add it as a restriction\n if (node.property != undefined) {\n this.appendLine(`?dataset ${node.property} <${node.uri}> .`, indent);\n // If no property was set, we are dealing with a source node\n } else {\n\n }\n\n // Create the node facets sub query \n this.createNodeFacetsSubquery(node, indent);\n\n // Call recursively on the children and UNION the results\n\n var k = 0;\n\n for (var i in node.childNodes) {\n if (k > 0) this.appendLine('UNION', indent);\n\n if (node.childNodes[i].childNodes == null) {\n return;\n }\n\n if (node.childNodes[i].property == undefined && node.childNodes[i].childNodes.length == 0) {\n continue;\n }\n\n this.appendLine('{', indent);\n this.createNodeSubquery(node.childNodes[i], indent + 1, hasService);\n this.appendLine('}', indent);\n k++\n }\n\n return this.result;\n }\n\n findSourceUri(node) {\n if (node.uri == null) {\n return null;\n }\n\n if (!this.isValidHttpUrl(node.uri)) {\n return null;\n }\n\n var url = new URL(node.uri);\n return url.origin;\n }\n\n /**\n * Create restrictions that only occur on this node and none of its children\n * Added restriction have to be enriched with their parent node settings\n * @param {*} groupNode \n */\n createNodeFacetsSubquery(node, indent) {\n\n var facetUris = this.findAllNodeFacets(node);\n\n // Iterate over all the facet settings of the node\n for (var i in facetUris) {\n\n var facetUri = facetUris[i];\n\n // We only add facets to the node if the facet is not overriden by any child nodes\n if (!this.hasFacetOverride(node, facetUri)) {\n\n // We create the subquery while merging the facet settings from this node to the root of the query tree\n this.createFacetSubquery(node, facetUri, indent);\n }\n }\n }\n\n // Check whether any child node of the passed node overrides a specific facet\n hasFacetOverride(node, facetUri) {\n\n // If we don't have any children, there are no overrides\n if (node.childNodes.length == 0) {\n return false;\n }\n\n // ======= SPECIAL TREATMENT OF VERSION/LATEST =======\n // Treat as if overriden (leaf nodes already excluded)\n // ===================================================\n if (facetUri == 'http://purl.org/dc/terms/hasVersion') {\n for (var i in node.facetSettings[facetUri]) {\n if (node.facetSettings[facetUri][i].value == '$latest') {\n return true;\n }\n }\n }\n\n // Iterate through the child nodes\n for (var i in node.childNodes) {\n var childNode = node.childNodes[i];\n\n // If the child node overrides the facet then yes, we have an override\n if (childNode.facetSettings[facetUri] != undefined) {\n return true;\n }\n\n // If any of the child node's children has an override, we have an override\n if (this.hasFacetOverride(childNode, facetUri)) {\n return true;\n }\n }\n\n // Nothing found in the children? No override!\n return false;\n }\n\n /**\n * Generates the sub query for a specific node and facet\n * @param {*} node \n * @param {*} facetUri \n */\n createFacetSubquery(node, facetUri, indent) {\n var first = true;\n\n\n // If we add a facet setting, we have to include the facets of all the ancestor nodes\n var settings = this.createEnrichedSettings(node, facetUri);\n settings = settings.filter(function (s) {\n return s.checked;\n });\n\n if (settings.length == 1) {\n var facetSettingEntry = settings[0];\n if (!facetSettingEntry.checked) return;\n\n if (facetSettingEntry.value == '$latest' && facetUri == 'http://purl.org/dc/terms/hasVersion') {\n // Add the special latest version facet value restriction.\n this.appendLine('{', indent);\n this.appendLine('?distribution dct:hasVersion ?version {', indent + 1);\n this.appendLine('SELECT (?v as ?version) { ', indent + 2);\n this.appendLine('GRAPH ?g2 { ', indent + 3);\n this.appendLine(`?dataset ${node.property} <${node.uri}> . `, indent + 4);\n this.appendLine('?dataset dct:hasVersion ?v . ', indent + 4);\n this.appendLine('}', indent + 3);\n this.appendLine('} ORDER BY DESC (STR(?version)) LIMIT 1 ', indent + 2);\n this.appendLine('}', indent + 1);\n this.appendLine('}', indent);\n }\n else {\n // Add the facet value restriction\n this.appendLine(`{ ?distribution <${facetUri}> '${facetSettingEntry.value}'${this.stringSuffix} . }`, indent);\n }\n }\n else if (settings.length > 1) {\n\n // More than one value for this facet\n\n if (facetUri == 'http://purl.org/dc/terms/hasVersion') {\n\n // Iterate..\n for (var i in settings) {\n\n var facetSettingEntry = settings[i];\n if (!facetSettingEntry.checked) continue;\n\n if (!first) this.appendLine(\"UNION\", indent);\n\n if (facetSettingEntry.value == '$latest' && facetUri == 'http://purl.org/dc/terms/hasVersion') {\n // Add the special latest version facet value restriction.\n this.appendLine('{', indent);\n this.appendLine('?distribution dct:hasVersion ?version {', indent + 1);\n this.appendLine('SELECT (?v as ?version) { ', indent + 2);\n this.appendLine('GRAPH ?g2 { ', indent + 3);\n this.appendLine(`?dataset ${node.property} <${node.uri}> . `, indent + 4);\n this.appendLine('?dataset dct:hasVersion ?v . ', indent + 4);\n this.appendLine('}', indent + 3);\n this.appendLine('} ORDER BY DESC (STR(?version)) LIMIT 1 ', indent + 2);\n this.appendLine('}', indent + 1);\n this.appendLine('}', indent);\n }\n else {\n // Add the facet value restriction\n this.appendLine(`{ ?distribution <${facetUri}> '${facetSettingEntry.value}'${this.stringSuffix} . }`, indent);\n }\n\n // If we have more than one value for this facet we need a UNION\n first = false;\n }\n\n } else {\n this.appendLine('{', indent);\n this.appendLine(`?distribution <${facetUri}> ?c${this.cvCounter} .`, indent + 1);\n this.appendLine(`VALUES ?c${this.cvCounter} {`, indent + 1);\n\n for (var i in settings) {\n var facetSettingEntry = settings[i];\n if (!facetSettingEntry.checked) continue;\n this.appendLine(`'${facetSettingEntry.value}'${this.stringSuffix}`, indent + 2);\n }\n this.appendLine(`}`, indent + 1);\n this.appendLine(`}`, indent);\n this.cvCounter++;\n }\n }\n }\n\n /**\n * Create a list of all the node facets and all overriden ancestor facets that might not be explicitly\n * included in the node facet list\n * @param {*} node \n */\n findAllNodeFacets(node) {\n var facetUris = [];\n\n for (var facetUri in node.facetSettings) {\n facetUris.push(facetUri);\n }\n\n var parentNode = QueryNode.findParentNodeRecursive(this.root, node); // node.parent;\n\n while (parentNode != undefined) {\n\n for (var facetUri in parentNode.facetSettings) {\n\n // check the base node -> if current node is the base, include all parent facets\n // on the way too the root\n if (node != this.baseNode && !this.hasFacetOverride(parentNode, facetUri)) {\n continue;\n }\n\n\n if (facetUris.includes(facetUri)) {\n continue;\n }\n\n facetUris.push(facetUri);\n }\n\n parentNode = QueryNode.findParentNodeRecursive(this.root, parentNode); // parentNode.parent;\n }\n\n return facetUris;\n }\n\n /**\n * For a given facet, add up all the active settings up to the root node of the\n * query tree. Node settings override ancestor node settings.\n * @param {*} node \n * @param {*} facetUri \n */\n createEnrichedSettings(node, facetUri) {\n var result = [];\n for (var i in node.facetSettings[facetUri]) {\n result.push(node.facetSettings[facetUri][i]);\n }\n\n var parentNode = QueryNode.findParentNodeRecursive(this.root, node); // node.parent;\n\n while (parentNode != undefined) {\n\n for (var i in parentNode.facetSettings[facetUri]) {\n var parentSetting = parentNode.facetSettings[facetUri][i];\n var hasSetting = false;\n for (var j in result) {\n if (result[j].value == parentSetting.value) {\n hasSetting = true;\n break;\n }\n }\n\n if (!hasSetting) {\n result.push(parentSetting);\n }\n }\n\n parentNode = QueryNode.findParentNodeRecursive(this.root, parentNode); //parentNode.parent;\n }\n\n\n return result;\n }\n\n /**\n * Appens a line to the global result prepending a specified number of tab characters\n * @param {*} line \n * @param {*} indent \n */\n appendLine(line, indent) {\n for (var i = 0; i < indent; i++) this.result += '\\t';\n this.result += line;\n this.result += '\\n';\n }\n\n /**\n * Appens a line to the global result prepending a specified number of tab characters\n * @param {*} line \n * @param {*} indent \n */\n prependLine(line, indent) {\n var text = '';\n for (var i = 0; i < indent; i++) text += '\\t';\n text += line;\n this.result = text + '\\n' + this.result;\n }\n}\n\nmodule.exports = QueryBuilder;\n\n\n//# sourceURL=webpack://databus-webapp/./js/query-builder/query-builder.js?"); +eval("{const QueryNode = __webpack_require__(/*! ./query-node */ \"./js/query-builder/query-node.js\");\n\nclass QueryBuilder {\n\n static build(config) {\n var builder = new QueryBuilder();\n return builder.createQuery(config.node, config.template, config.resourceBaseUrl, config.root);\n }\n\n\n isValidHttpUrl(string) {\n let url;\n\n try {\n url = new URL(string);\n } catch (_) {\n return false;\n }\n\n return url.protocol === \"http:\" || url.protocol === \"https:\";\n }\n\n uniqueList(arr) {\n var u = {}, a = [];\n for (var i = 0, l = arr.length; i < l; ++i) {\n if (!u.hasOwnProperty(arr[i])) {\n a.push(arr[i]);\n u[arr[i]] = 1;\n }\n }\n return a;\n }\n\n createQuery(node, template, resourceBaseUrl, root) {\n\n this.result = '';\n this.baseNode = node;\n this.root = root != undefined ? root : node;\n this.cvCounter = 0;\n this.resourceBaseUrl = resourceBaseUrl;\n this.select = template.select;\n this.template = template.body;\n this.templateInsertionKey = template.placeholder != undefined ? template.placeholder : `%QUERY%`;\n this.prefixes = template.prefixes;\n this.aggregate = template.aggregate;\n this.stringSuffix = '';\n\n this.appendLine(this.select, 0);\n this.appendLine(`{`, 0);\n this.createNodeSubquery(node, template.indent, false);\n this.appendLine(`}`, 0);\n\n if (this.aggregate != undefined) {\n this.appendLine(this.aggregate, 0);\n }\n\n this.prependPrefixes();\n return this.result;\n }\n\n removeAndCollectPrefixes(query) {\n var lines = query.split('\\n');\n var result = \"\";\n\n for (var line of lines) {\n if (line.toLowerCase().startsWith('prefix')) {\n this.prefixes.push(line);\n } else {\n result += line + '\\n';\n }\n }\n\n return result.substring(0, result.length - 1);\n }\n\n prependPrefixes() {\n\n this.prefixes = this.uniqueList(this.prefixes);\n\n for (var line of this.prefixes) {\n this.prependLine(line, 0);\n }\n }\n\n appendTemplateHeader(indent) {\n for (var line of this.template) {\n\n if (line == this.templateInsertionKey) {\n break;\n }\n\n this.appendLine(line, indent);\n }\n }\n\n appendTemplateFooter(indent) {\n var write = false;\n\n for (var line of this.template) {\n\n if (write) {\n this.appendLine(line, indent);\n }\n\n if (line == this.templateInsertionKey) {\n write = true;\n }\n }\n }\n\n appendTemplate(node, indent) {\n\n this.appendTemplateHeader(indent);\n this.createNodeSubquery(node, indent + 1, true);\n\n if (node.property == null && node.childNodes.length == 0) {\n this.appendLine(`?distribution a dataid:Nonsense .`, indent + 1)\n }\n\n this.appendTemplateFooter(indent);\n }\n\n /**\n * Create a subquery for any query node. The subquery consist of the node facets and\n * a UNION of child node queries (this function is called revursively on the child nodes)\n * @param {*} node \n */\n createNodeSubquery(node, indent, hasService) {\n // Initialize empty result\n\n if (hasService == undefined) {\n hasService = false;\n }\n\n // Get source...\n var sourceUri = this.findSourceUri(node);\n\n if (!hasService && sourceUri != null) {\n\n if (sourceUri != this.resourceBaseUrl) {\n this.appendLine(`SERVICE <${sourceUri}/sparql>`, indent);\n this.appendLine(`{`, indent);\n\n this.appendTemplate(node, indent + 1);\n this.appendLine(`}`, indent);\n\n } else {\n this.appendTemplate(node, indent);\n }\n\n return;\n }\n\n if (node.uri != null) {\n\n if (!this.isValidHttpUrl(node.uri)) {\n\n // Custom query node\n var query = this.removeAndCollectPrefixes(node.property);\n var lines = query.split('\\n');\n for (var line of lines) {\n this.appendLine(line, indent);\n }\n\n return;\n }\n }\n\n // If a node property was set, add it as a restriction\n if (node.property != undefined) {\n this.appendLine(`?dataset ${node.property} <${node.uri}> .`, indent);\n // If no property was set, we are dealing with a source node\n } else {\n\n }\n\n // Create the node facets sub query \n this.createNodeFacetsSubquery(node, indent);\n\n // Call recursively on the children and UNION the results\n\n var k = 0;\n\n for (var i in node.childNodes) {\n if (k > 0) this.appendLine('UNION', indent);\n\n if (node.childNodes[i].childNodes == null) {\n return;\n }\n\n if (node.childNodes[i].property == undefined && node.childNodes[i].childNodes.length == 0) {\n continue;\n }\n\n this.appendLine('{', indent);\n this.createNodeSubquery(node.childNodes[i], indent + 1, hasService);\n this.appendLine('}', indent);\n k++\n }\n\n return this.result;\n }\n\n findSourceUri(node) {\n if (node.uri == null) {\n return null;\n }\n\n if (!this.isValidHttpUrl(node.uri)) {\n return null;\n }\n\n var url = new URL(node.uri);\n return url.origin;\n }\n\n /**\n * Create restrictions that only occur on this node and none of its children\n * Added restriction have to be enriched with their parent node settings\n * @param {*} groupNode \n */\n createNodeFacetsSubquery(node, indent) {\n\n var facetUris = this.findAllNodeFacets(node);\n\n // Iterate over all the facet settings of the node\n for (var i in facetUris) {\n\n var facetUri = facetUris[i];\n\n // We only add facets to the node if the facet is not overriden by any child nodes\n if (!this.hasFacetOverride(node, facetUri)) {\n\n // We create the subquery while merging the facet settings from this node to the root of the query tree\n this.createFacetSubquery(node, facetUri, indent);\n }\n }\n }\n\n // Check whether any child node of the passed node overrides a specific facet\n hasFacetOverride(node, facetUri) {\n\n // If we don't have any children, there are no overrides\n if (node.childNodes.length == 0) {\n return false;\n }\n\n // ======= SPECIAL TREATMENT OF VERSION/LATEST =======\n // Treat as if overriden (leaf nodes already excluded)\n // ===================================================\n if (facetUri == 'http://purl.org/dc/terms/hasVersion') {\n for (var i in node.facetSettings[facetUri]) {\n if (node.facetSettings[facetUri][i].value == '$latest') {\n return true;\n }\n }\n }\n\n // Iterate through the child nodes\n for (var i in node.childNodes) {\n var childNode = node.childNodes[i];\n\n // If the child node overrides the facet then yes, we have an override\n if (childNode.facetSettings[facetUri] != undefined) {\n return true;\n }\n\n // If any of the child node's children has an override, we have an override\n if (this.hasFacetOverride(childNode, facetUri)) {\n return true;\n }\n }\n\n // Nothing found in the children? No override!\n return false;\n }\n\n /**\n * Generates the sub query for a specific node and facet\n * @param {*} node \n * @param {*} facetUri \n */\n createFacetSubquery(node, facetUri, indent) {\n var first = true;\n\n\n // If we add a facet setting, we have to include the facets of all the ancestor nodes\n var settings = this.createEnrichedSettings(node, facetUri);\n settings = settings.filter(function (s) {\n return s.checked;\n });\n\n if (settings.length == 1) {\n var facetSettingEntry = settings[0];\n if (!facetSettingEntry.checked) return;\n\n if (facetSettingEntry.value == '$latest' && facetUri == 'http://purl.org/dc/terms/hasVersion') {\n // Add the special latest version facet value restriction.\n this.appendLine('{', indent);\n this.appendLine('?distribution dct:hasVersion ?version {', indent + 1);\n this.appendLine('SELECT (?v as ?version) { ', indent + 2);\n this.appendLine('GRAPH ?g2 { ', indent + 3);\n this.appendLine(`?dataset ${node.property} <${node.uri}> . `, indent + 4);\n this.appendLine('?dataset dct:hasVersion ?v . ', indent + 4);\n this.appendLine('}', indent + 3);\n this.appendLine('} ORDER BY DESC (STR(?version)) LIMIT 1 ', indent + 2);\n this.appendLine('}', indent + 1);\n this.appendLine('}', indent);\n }\n else {\n // Add the facet value restriction\n this.appendLine(`{ ?distribution <${facetUri}> '${facetSettingEntry.value}'${this.stringSuffix} . }`, indent);\n }\n }\n else if (settings.length > 1) {\n\n // More than one value for this facet\n\n if (facetUri == 'http://purl.org/dc/terms/hasVersion') {\n\n // Iterate..\n for (var i in settings) {\n\n var facetSettingEntry = settings[i];\n if (!facetSettingEntry.checked) continue;\n\n if (!first) this.appendLine(\"UNION\", indent);\n\n if (facetSettingEntry.value == '$latest' && facetUri == 'http://purl.org/dc/terms/hasVersion') {\n // Add the special latest version facet value restriction.\n this.appendLine('{', indent);\n this.appendLine('?distribution dct:hasVersion ?version {', indent + 1);\n this.appendLine('SELECT (?v as ?version) { ', indent + 2);\n this.appendLine('GRAPH ?g2 { ', indent + 3);\n this.appendLine(`?dataset ${node.property} <${node.uri}> . `, indent + 4);\n this.appendLine('?dataset dct:hasVersion ?v . ', indent + 4);\n this.appendLine('}', indent + 3);\n this.appendLine('} ORDER BY DESC (STR(?version)) LIMIT 1 ', indent + 2);\n this.appendLine('}', indent + 1);\n this.appendLine('}', indent);\n }\n else {\n // Add the facet value restriction\n this.appendLine(`{ ?distribution <${facetUri}> '${facetSettingEntry.value}'${this.stringSuffix} . }`, indent);\n }\n\n // If we have more than one value for this facet we need a UNION\n first = false;\n }\n\n } else {\n this.appendLine('{', indent);\n this.appendLine(`?distribution <${facetUri}> ?c${this.cvCounter} .`, indent + 1);\n this.appendLine(`VALUES ?c${this.cvCounter} {`, indent + 1);\n\n for (var i in settings) {\n var facetSettingEntry = settings[i];\n if (!facetSettingEntry.checked) continue;\n this.appendLine(`'${facetSettingEntry.value}'${this.stringSuffix}`, indent + 2);\n }\n this.appendLine(`}`, indent + 1);\n this.appendLine(`}`, indent);\n this.cvCounter++;\n }\n }\n }\n\n /**\n * Create a list of all the node facets and all overriden ancestor facets that might not be explicitly\n * included in the node facet list\n * @param {*} node \n */\n findAllNodeFacets(node) {\n var facetUris = [];\n\n for (var facetUri in node.facetSettings) {\n facetUris.push(facetUri);\n }\n\n var parentNode = QueryNode.findParentNodeRecursive(this.root, node); // node.parent;\n\n while (parentNode != undefined) {\n\n for (var facetUri in parentNode.facetSettings) {\n\n // check the base node -> if current node is the base, include all parent facets\n // on the way too the root\n if (node != this.baseNode && !this.hasFacetOverride(parentNode, facetUri)) {\n continue;\n }\n\n\n if (facetUris.includes(facetUri)) {\n continue;\n }\n\n facetUris.push(facetUri);\n }\n\n parentNode = QueryNode.findParentNodeRecursive(this.root, parentNode); // parentNode.parent;\n }\n\n return facetUris;\n }\n\n /**\n * For a given facet, add up all the active settings up to the root node of the\n * query tree. Node settings override ancestor node settings.\n * @param {*} node \n * @param {*} facetUri \n */\n createEnrichedSettings(node, facetUri) {\n var result = [];\n for (var i in node.facetSettings[facetUri]) {\n result.push(node.facetSettings[facetUri][i]);\n }\n\n var parentNode = QueryNode.findParentNodeRecursive(this.root, node); // node.parent;\n\n while (parentNode != undefined) {\n\n for (var i in parentNode.facetSettings[facetUri]) {\n var parentSetting = parentNode.facetSettings[facetUri][i];\n var hasSetting = false;\n for (var j in result) {\n if (result[j].value == parentSetting.value) {\n hasSetting = true;\n break;\n }\n }\n\n if (!hasSetting) {\n result.push(parentSetting);\n }\n }\n\n parentNode = QueryNode.findParentNodeRecursive(this.root, parentNode); //parentNode.parent;\n }\n\n\n return result;\n }\n\n /**\n * Appens a line to the global result prepending a specified number of tab characters\n * @param {*} line \n * @param {*} indent \n */\n appendLine(line, indent) {\n for (var i = 0; i < indent; i++) this.result += '\\t';\n this.result += line;\n this.result += '\\n';\n }\n\n /**\n * Appens a line to the global result prepending a specified number of tab characters\n * @param {*} line \n * @param {*} indent \n */\n prependLine(line, indent) {\n var text = '';\n for (var i = 0; i < indent; i++) text += '\\t';\n text += line;\n this.result = text + '\\n' + this.result;\n }\n}\n\nmodule.exports = QueryBuilder;\n\n\n//# sourceURL=webpack://databus-webapp/./js/query-builder/query-builder.js?\n}"); -/***/ }), +/***/ }, -/***/ "./js/query-builder/query-node.js": +/***/ "./js/query-builder/query-node.js" /*!****************************************!*\ !*** ./js/query-builder/query-node.js ***! \****************************************/ -/***/ ((module) => { +(module) { -eval("/**\n * A query node is a node in a query tree. A query tree can be built for any hierarchical selection\n * on the databus, such as publishers, groups, artifacts and collections.\n * Each node may declare a range of restrictions. Restrictions can then be overriden again by\n * any child node in the hierarchy.\n * \n * EXAMPLE: Group node says: Select everything in English. One specific artifact child node of the\n * group node then states: I don't want to select English, I will select German. \n * \n * A query tree can then be translated into a SPARQL query that tries to use as few statements as possible\n * to fetch the desired data\n */\nclass QueryNode {\n\n /**\n * Creates a new QueryNode with a resource URI and a property. The property will be added to the\n * query as a forced and non-overrideable restriction\n * @param {*} uri \n * @param {*} property \n */\n constructor(uri, property) {\n this.uri = uri;\n this.property = property;\n this.childNodes = [];\n this.facetSettings = {};\n }\n\n // Set or unset a facet of the query node\n setFacet(key, value, checked) {\n\n var list = this.facetSettings[key];\n\n if(list == undefined) {\n this.facetSettings[key] = [];\n list = this.facetSettings[key];\n }\n\n if(!this.isOverride(key, value, checked)) {\n \n for(var i = 0; i < list.length; i++) {\n if(list[i].value == value) {\n list.splice(i, 1);\n }\n }\n\n if(list.length == 0) {\n delete this.facetSettings[key];\n }\n \n return;\n }\n\n for(var i in list) {\n if(list[i].value == value) {\n list[i].checked = checked;\n return;\n }\n }\n \n list.push({ value : value, checked : checked });\n }\n\n \n\n /**\n * Check whether a certain facet setting is an override in the hierarchy\n * @param {*} key \n * @param {*} value \n * @param {*} checked \n */\n isOverride(key, value, checked) {\n\n if(checked == undefined) {\n var setting = QueryNode.findFacetSetting(this, key, value);\n checked = setting != null ? setting.checked : false;\n }\n\n var parentSetting = QueryNode.findInheritedSetting(this.parent, key, value);\n\n if(parentSetting == undefined) {\n return checked;\n }\n\n return parentSetting.checked != checked;\n }\n\n /**\n * Add a child node to this node\n * @param {*} node \n */\n addChild(node) {\n this.childNodes.push(node);\n // node.parent = this;\n }\n\n static removeChildByUri(node, uri) {\n for(var i = 0; i < node.childNodes.length; i++) {\n if(node.childNodes[i].uri == uri) {\n node.childNodes.splice(i, 1);\n return;\n }\n\n QueryNode.removeChildByUri(node.childNodes[i], uri);\n }\n }\n\n static findChildByUri(node, uri) {\n for(let i = 0; i < node.childNodes.length; i++) {\n if(node.childNodes[i].uri === uri) {\n node.childNodes[i] = QueryNode.createFrom(node.childNodes[i]);\n return node.childNodes[i];\n }\n\n let result = QueryNode.findChildByUri(node.childNodes[i], uri);\n\n if(result != null) {\n return result;\n }\n }\n\n return null; \n }\n\n hasFacetSetting(key, value) {\n for(var i in this.facetSettings[key]) {\n\n var setting = this.facetSettings[key][i];\n\n if(setting.value == value) {\n return true;\n }\n }\n\n return false;\n }\n\n /**\n * Create a settings object with all the facet settings active for this node (inluding inherited settings)\n * @param {*} node \n */\n createFullFacetSettings() {\n \n var fullSettings = {};\n\n for(var facetUri in this.facetSettings) {\n fullSettings[facetUri] = JSON.parse(JSON.stringify(this.facetSettings[facetUri]));\n }\n\n var parentNode = this.parent;\n\n while(parentNode != undefined) {\n\n for(var facetUri in parentNode.facetSettings) {\n\n if(fullSettings[facetUri] == undefined) {\n fullSettings[facetUri] = [];\n }\n \n for(var i in parentNode.facetSettings[facetUri]) {\n\n var parentSetting = parentNode.facetSettings[facetUri][i];\n\n if(!this.hasFacetSetting(facetUri, parentSetting.value)) {\n fullSettings[facetUri].push(JSON.parse(JSON.stringify(parentSetting)));\n }\n }\n }\n\n parentNode = parentNode.parent;\n }\n\n return fullSettings;\n }\n\n static serialize(queryNode) {\n // QueryNode.clearParents(queryNode);\n var result = JSON.stringify(queryNode);\n // QueryNode.assignParents(queryNode);\n return result;\n }\n\n\n static addChild(node, child) {\n node.childNodes.push(child);\n // child.parent = node;\n }\n\n static mergeAddChild(root, child) {\n var existingNode = QueryNode.findChildByUri(root, child.uri);\n\n if(existingNode == null) {\n QueryNode.addChild(root, child); \n return true;\n }\n\n if(child.childNodes.length == 0) {\n return false;\n }\n\n for(var i in child.childNodes) {\n QueryNode.mergeAddChild(existingNode, child.childNodes[i]);\n }\n }\n\n /*\n static clearParents(queryNode) {\n queryNode.parent = null;\n for(var i = 0; i < queryNode.childNodes.length; i++) {\n QueryNode.clearParents(queryNode.childNodes[i]);\n }\n }\n\n static assignParents(queryNode) {\n for(var i = 0; i < queryNode.childNodes.length; i++) {\n queryNode.childNodes[i].parent = queryNode;\n QueryNode.assignParents(queryNode.childNodes[i]);\n }\n }\n*/\n\n static expandAll(queryNode) {\n queryNode.expanded = true;\n for(var i = 0; i < queryNode.childNodes.length; i++) {\n QueryNode.expandAll(queryNode.childNodes[i]);\n }\n }\n\n static findParentNodeRecursive(parent, node) {\n\n if(node.uri == null) {\n return null;\n }\n \n if(parent.childNodes == null || parent.childNodes.length == 0) {\n return null;\n }\n\n for(var child of parent.childNodes) {\n if(child.uri == node.uri) {\n return parent;\n }\n } \n \n for(var child of parent.childNodes) {\n var recParent = QueryNode.findParentNodeRecursive(child, node);\n\n if(recParent != null) {\n return recParent;\n }\n }\n\n return null;\n }\n\n /**\n * Copy constructor to use the QueryNode class inside of angular components\n * @param {*} obj \n */\n static createFrom(obj) {\n var tmpNode = new QueryNode(obj.uri, obj.property);\n tmpNode.childNodes = obj.childNodes;\n tmpNode.facetSettings = obj.facetSettings;\n // tmpNode.parent = obj.parent;\n tmpNode.files = obj.files;\n return tmpNode;\n }\n\n static createSubTree(obj) {\n var node = QueryNode.createFrom(obj);\n node.facetSettings = node.createFullFacetSettings();\n // node.parent = null;\n return node;\n }\n\n /**\n * Search a specific node for a certain facet setting\n * @param {*} node \n * @param {*} key \n * @param {*} value \n */\n static findFacetSetting(node, key, value) {\n if(node == undefined || node.facetSettings == undefined) {\n return undefined;\n }\n\n var settingsList = node.facetSettings[key];\n\n if(settingsList == undefined) {\n return undefined;\n }\n\n for(var i in settingsList) {\n var setting = settingsList[i];\n\n if(setting.value == value) {\n return setting;\n }\n }\n\n return undefined;\n }\n\n static findInheritedSetting(node, key, value) {\n \n if(node == null) {\n return undefined;\n }\n\n var setting = QueryNode.findFacetSetting(node, key, value);\n\n if(setting == undefined) {\n return QueryNode.findInheritedSetting(node.parent, key, value);\n }\n\n return setting;\n }\n}\n\nmodule.exports = QueryNode;\n\n\n//# sourceURL=webpack://databus-webapp/./js/query-builder/query-node.js?"); +eval("{/**\n * A query node is a node in a query tree. A query tree can be built for any hierarchical selection\n * on the databus, such as publishers, groups, artifacts and collections.\n * Each node may declare a range of restrictions. Restrictions can then be overriden again by\n * any child node in the hierarchy.\n * \n * EXAMPLE: Group node says: Select everything in English. One specific artifact child node of the\n * group node then states: I don't want to select English, I will select German. \n * \n * A query tree can then be translated into a SPARQL query that tries to use as few statements as possible\n * to fetch the desired data\n */\nclass QueryNode {\n\n /**\n * Creates a new QueryNode with a resource URI and a property. The property will be added to the\n * query as a forced and non-overrideable restriction\n * @param {*} uri \n * @param {*} property \n */\n constructor(uri, property) {\n this.uri = uri;\n this.property = property;\n this.childNodes = [];\n this.facetSettings = {};\n }\n\n // Set or unset a facet of the query node\n setFacet(key, value, checked) {\n\n var list = this.facetSettings[key];\n\n if(list == undefined) {\n this.facetSettings[key] = [];\n list = this.facetSettings[key];\n }\n\n if(!this.isOverride(key, value, checked)) {\n \n for(var i = 0; i < list.length; i++) {\n if(list[i].value == value) {\n list.splice(i, 1);\n }\n }\n\n if(list.length == 0) {\n delete this.facetSettings[key];\n }\n \n return;\n }\n\n for(var i in list) {\n if(list[i].value == value) {\n list[i].checked = checked;\n return;\n }\n }\n \n list.push({ value : value, checked : checked });\n }\n\n \n\n /**\n * Check whether a certain facet setting is an override in the hierarchy\n * @param {*} key \n * @param {*} value \n * @param {*} checked \n */\n isOverride(key, value, checked) {\n\n if(checked == undefined) {\n var setting = QueryNode.findFacetSetting(this, key, value);\n checked = setting != null ? setting.checked : false;\n }\n\n var parentSetting = QueryNode.findInheritedSetting(this.parent, key, value);\n\n if(parentSetting == undefined) {\n return checked;\n }\n\n return parentSetting.checked != checked;\n }\n\n /**\n * Add a child node to this node\n * @param {*} node \n */\n addChild(node) {\n this.childNodes.push(node);\n // node.parent = this;\n }\n\n static removeChildByUri(node, uri) {\n for(var i = 0; i < node.childNodes.length; i++) {\n if(node.childNodes[i].uri == uri) {\n node.childNodes.splice(i, 1);\n return;\n }\n\n QueryNode.removeChildByUri(node.childNodes[i], uri);\n }\n }\n\n static findChildByUri(node, uri) {\n for(let i = 0; i < node.childNodes.length; i++) {\n if(node.childNodes[i].uri === uri) {\n node.childNodes[i] = QueryNode.createFrom(node.childNodes[i]);\n return node.childNodes[i];\n }\n\n let result = QueryNode.findChildByUri(node.childNodes[i], uri);\n\n if(result != null) {\n return result;\n }\n }\n\n return null; \n }\n\n hasFacetSetting(key, value) {\n for(var i in this.facetSettings[key]) {\n\n var setting = this.facetSettings[key][i];\n\n if(setting.value == value) {\n return true;\n }\n }\n\n return false;\n }\n\n /**\n * Create a settings object with all the facet settings active for this node (inluding inherited settings)\n * @param {*} node \n */\n createFullFacetSettings() {\n \n var fullSettings = {};\n\n for(var facetUri in this.facetSettings) {\n fullSettings[facetUri] = JSON.parse(JSON.stringify(this.facetSettings[facetUri]));\n }\n\n var parentNode = this.parent;\n\n while(parentNode != undefined) {\n\n for(var facetUri in parentNode.facetSettings) {\n\n if(fullSettings[facetUri] == undefined) {\n fullSettings[facetUri] = [];\n }\n \n for(var i in parentNode.facetSettings[facetUri]) {\n\n var parentSetting = parentNode.facetSettings[facetUri][i];\n\n if(!this.hasFacetSetting(facetUri, parentSetting.value)) {\n fullSettings[facetUri].push(JSON.parse(JSON.stringify(parentSetting)));\n }\n }\n }\n\n parentNode = parentNode.parent;\n }\n\n return fullSettings;\n }\n\n static serialize(queryNode) {\n // QueryNode.clearParents(queryNode);\n var result = JSON.stringify(queryNode);\n // QueryNode.assignParents(queryNode);\n return result;\n }\n\n\n static addChild(node, child) {\n node.childNodes.push(child);\n // child.parent = node;\n }\n\n static mergeAddChild(root, child) {\n var existingNode = QueryNode.findChildByUri(root, child.uri);\n\n if(existingNode == null) {\n QueryNode.addChild(root, child); \n return true;\n }\n\n if(child.childNodes.length == 0) {\n return false;\n }\n\n for(var i in child.childNodes) {\n QueryNode.mergeAddChild(existingNode, child.childNodes[i]);\n }\n }\n\n /*\n static clearParents(queryNode) {\n queryNode.parent = null;\n for(var i = 0; i < queryNode.childNodes.length; i++) {\n QueryNode.clearParents(queryNode.childNodes[i]);\n }\n }\n\n static assignParents(queryNode) {\n for(var i = 0; i < queryNode.childNodes.length; i++) {\n queryNode.childNodes[i].parent = queryNode;\n QueryNode.assignParents(queryNode.childNodes[i]);\n }\n }\n*/\n\n static expandAll(queryNode) {\n queryNode.expanded = true;\n for(var i = 0; i < queryNode.childNodes.length; i++) {\n QueryNode.expandAll(queryNode.childNodes[i]);\n }\n }\n\n static findParentNodeRecursive(parent, node) {\n\n if(node.uri == null) {\n return null;\n }\n \n if(parent.childNodes == null || parent.childNodes.length == 0) {\n return null;\n }\n\n for(var child of parent.childNodes) {\n if(child.uri == node.uri) {\n return parent;\n }\n } \n \n for(var child of parent.childNodes) {\n var recParent = QueryNode.findParentNodeRecursive(child, node);\n\n if(recParent != null) {\n return recParent;\n }\n }\n\n return null;\n }\n\n /**\n * Copy constructor to use the QueryNode class inside of angular components\n * @param {*} obj \n */\n static createFrom(obj) {\n var tmpNode = new QueryNode(obj.uri, obj.property);\n tmpNode.childNodes = obj.childNodes;\n tmpNode.facetSettings = obj.facetSettings;\n // tmpNode.parent = obj.parent;\n tmpNode.files = obj.files;\n return tmpNode;\n }\n\n static createSubTree(obj) {\n var node = QueryNode.createFrom(obj);\n node.facetSettings = node.createFullFacetSettings();\n // node.parent = null;\n return node;\n }\n\n /**\n * Search a specific node for a certain facet setting\n * @param {*} node \n * @param {*} key \n * @param {*} value \n */\n static findFacetSetting(node, key, value) {\n if(node == undefined || node.facetSettings == undefined) {\n return undefined;\n }\n\n var settingsList = node.facetSettings[key];\n\n if(settingsList == undefined) {\n return undefined;\n }\n\n for(var i in settingsList) {\n var setting = settingsList[i];\n\n if(setting.value == value) {\n return setting;\n }\n }\n\n return undefined;\n }\n\n static findInheritedSetting(node, key, value) {\n \n if(node == null) {\n return undefined;\n }\n\n var setting = QueryNode.findFacetSetting(node, key, value);\n\n if(setting == undefined) {\n return QueryNode.findInheritedSetting(node.parent, key, value);\n }\n\n return setting;\n }\n}\n\nmodule.exports = QueryNode;\n\n\n//# sourceURL=webpack://databus-webapp/./js/query-builder/query-node.js?\n}"); -/***/ }), +/***/ }, -/***/ "./js/query-builder/query-templates.js": +/***/ "./js/query-builder/query-templates.js" /*!*********************************************!*\ !*** ./js/query-builder/query-templates.js ***! \*********************************************/ -/***/ ((module) => { +(module) { -eval("/**\n * Query Templates can be defined as object with the fields:\n * > select\n * > body\n * > aggregate\n * \n * The select is a SPARQL select statement. The body is an array of strings with each string being a line of a \n * SPARQL query. The string %QUERY% can be used to insert the query generated by the QueryBuilder. The aggregate\n * is a SPARQL aggregate statement.\n */\n class QueryTemplates {\n\n static DEFAULT_PREFIXES = [\n `PREFIX databus: `,\n `PREFIX dcv: `,\n `PREFIX dct: `,\n `PREFIX dcat: `,\n `PREFIX rdf: `,\n `PREFIX rdfs: `\n ];\n\n static COLLECTION_TABLE_ROW_QUERY = `\nPREFIX databus: \nPREFIX dcv: \nPREFIX dct: \nPREFIX dcat: \nPREFIX rdf: \nPREFIX rdfs: \n\nSELECT ?file SAMPLE(?version) SAMPLE(?title) SAMPLE(?abstract) SAMPLE(?license) SAMPLE(?size) SAMPLE(?format) SAMPLE(?compression) (GROUP_CONCAT(DISTINCT ?var; SEPARATOR=', ') AS ?variant) WHERE {\n <%DISTRIBUTION%> databus:file ?file .\n <%DISTRIBUTION%> databus:formatExtension ?format .\n <%DISTRIBUTION%> databus:compression ?compression .\n <%DISTRIBUTION%> dcat:byteSize ?size .\n ?version dcat:distribution <%DISTRIBUTION%> .\n ?version dct:title ?title .\n ?version dct:abstract ?abstract.\n ?version dct:license ?license .\n\n OPTIONAL { <%DISTRIBUTION%> ?p ?var. ?p rdfs:subPropertyOf databus:contentVariant . }\n} GROUP BY ?file\n`;\n\nstatic COLLECTION_TABLE_QUERY = `\nPREFIX databus: \nPREFIX dcv: \nPREFIX dct: \nPREFIX dcat: \nPREFIX rdf: \nPREFIX rdfs: \n\nSELECT ?distribution SAMPLE(?file) AS ?file SAMPLE(?version) AS ?version SAMPLE(?title) AS ?title SAMPLE(?abstract) AS ?abstract SAMPLE(?license) AS ?license SAMPLE(?size) AS ?size SAMPLE(?format) AS ?format SAMPLE(?compression) AS ?compression (GROUP_CONCAT(DISTINCT ?var; SEPARATOR=', ') AS ?variant) WHERE {\n VALUES ?distribution {\n %DISTRIBUTIONS%\n }\n ?distribution databus:file ?file .\n ?distribution databus:formatExtension ?format .\n ?distribution databus:compression ?compression .\n ?distribution dcat:byteSize ?size .\n ?version dcat:distribution ?distribution .\n ?version dct:title ?title .\n ?version dct:abstract ?abstract.\n ?version dct:license ?license .\n OPTIONAL { ?distribution ?p ?var. ?p rdfs:subPropertyOf databus:contentVariant . }\n} GROUP BY ?distribution\n`;\n\n static COLLECTION_STATISTICS_TEMPLATE = {\n indent: 1,\n prefixes: QueryTemplates.DEFAULT_PREFIXES,\n select: `SELECT DISTINCT ?dataset ?file ?license ?size WHERE`,\n body: [\n `GRAPH ?g`,\n `{`,\n `%QUERY%`,\n `\\t?dataset dcat:distribution ?distribution .`,\n `\\t?distribution databus:file ?file .`,\n `\\tOPTIONAL { ?dataset dct:license ?license . }`,\n `\\tOPTIONAL { ?distribution dcat:byteSize ?size . }`,\n `}`\n ]\n };\n\n static COLLECTION_FILES_TEMPLATE = {\n prefixes: QueryTemplates.DEFAULT_PREFIXES,\n indent: 1,\n select: `SELECT DISTINCT ?version ?dataset ?distribution ?title ?description (GROUP_CONCAT(DISTINCT ?file; SEPARATOR=\", \") AS ?files) ?license ?size ?format (GROUP_CONCAT(DISTINCT ?var; SEPARATOR=', ') AS ?variant) WHERE`,\n body: [\n `GRAPH ?g`,\n `{`,\n `%QUERY%`,\n `\\t?distribution databus:file ?file .`,\n `\\t?distribution databus:formatExtension ?format .`,\n `\\tOPTIONAL { ?distribution ?p ?var. ?p rdfs:subPropertyOf databus:contentVariant . }`,\n `\\tOPTIONAL { ?dataset dct:license ?license . }`,\n `\\tOPTIONAL { ?distribution dcat:byteSize ?size . }`,\n `\\t?dataset dcat:distribution ?distribution .`,\n `\\t?dataset dct:hasVersion ?version .`,\n `\\t?dataset dct:title ?title .`,\n `\\t?dataset dct:description ?description.`,\n `}`\n ],\n aggregate: `GROUP BY ?version ?dataset ?distribution ?title ?description ?license ?size ?format`\n };\n\n /**\n * Selects files with additional information for group pages\n */\n static GROUP_PAGE_FILE_BROWSER_TEMPLATE = {\n prefixes: QueryTemplates.DEFAULT_PREFIXES,\n indent: 1,\n select: `SELECT DISTINCT ?file ?version ?artifact ?license ?size ?format ?compression (GROUP_CONCAT(DISTINCT ?var; SEPARATOR=', ') AS ?variant) WHERE`,\n body: [\n\n `GRAPH ?g`,\n `{`,\n `%QUERY%`,\n `\\t?dataset dcat:distribution ?distribution .`,\n `\\t?distribution databus:file ?file .`,\n `\\t?distribution databus:formatExtension ?format .`,\n `\\t?distribution databus:compression ?compression .`,\n `\\t?dataset dct:license ?license .`,\n `\\t?dataset dct:hasVersion ?version .`,\n `\\t?dataset databus:artifact ?artifact .`,\n `\\tOPTIONAL { ?distribution ?p ?var. ?p rdfs:subPropertyOf databus:contentVariant . }`,\n `\\tOPTIONAL { ?distribution dcat:byteSize ?size . }`,\n `}`\n ],\n aggregate: `GROUP BY ?file ?version ?artifact ?license ?size ?format ?compression`\n };\n\n /**\n * Selects files with additional information\n */\n static NODE_FILE_TEMPLATE = {\n prefixes: QueryTemplates.DEFAULT_PREFIXES,\n indent: 1,\n select: `SELECT DISTINCT ?file ?license ?size ?format ?compression (GROUP_CONCAT(DISTINCT ?var; SEPARATOR=', ') AS ?variant) WHERE`,\n body: [\n\n `GRAPH ?g`,\n `{`,\n `%QUERY%`,\n `\\t?dataset dcat:distribution ?distribution .`,\n `\\t?distribution databus:file ?file .`,\n `\\t?distribution databus:formatExtension ?format .`,\n `\\t?distribution databus:compression ?compression .`,\n `\\t?dataset dct:license ?license .`,\n `\\tOPTIONAL { ?distribution ?p ?var. ?p rdfs:subPropertyOf databus:contentVariant . }`,\n `\\tOPTIONAL { ?distribution dcat:byteSize ?size . }`,\n `}`\n ],\n aggregate: `GROUP BY ?file ?license ?size ?format ?compression`\n };\n\n /**\n * The default selection (only file)\n */\n static DEFAULT_FILE_TEMPLATE = {\n prefixes: QueryTemplates.DEFAULT_PREFIXES,\n indent: 1,\n select: `SELECT ?file WHERE`,\n body: [\n `GRAPH ?g`,\n `{`,\n `%QUERY%`,\n `\\t?dataset dcat:distribution ?distribution .`,\n `\\t?distribution databus:file ?file .`,\n `}`,\n ]\n };\n\n static DISTRIBUTIONS_TEMPLATE = {\n prefixes: QueryTemplates.DEFAULT_PREFIXES,\n indent: 1,\n select: `SELECT ?distribution WHERE`,\n body: [\n `GRAPH ?g`,\n `{`,\n `%QUERY%`,\n `\\t?dataset dcat:distribution ?distribution .`,\n `}`,\n ]\n };\n\n /**\n * The default selection (only file)\n */\n static CUSTOM_QUERY_FILE_TEMPLATE = {\n prefixes: QueryTemplates.DEFAULT_PREFIXES,\n indent: 1,\n select: `SELECT ?file WHERE`,\n body: [\n `{`,\n `%QUERY%`,\n `}`,\n ]\n };\n}\n\nmodule.exports = QueryTemplates;\n\n//# sourceURL=webpack://databus-webapp/./js/query-builder/query-templates.js?"); +eval("{/**\n * Query Templates can be defined as object with the fields:\n * > select\n * > body\n * > aggregate\n * \n * The select is a SPARQL select statement. The body is an array of strings with each string being a line of a \n * SPARQL query. The string %QUERY% can be used to insert the query generated by the QueryBuilder. The aggregate\n * is a SPARQL aggregate statement.\n */\n class QueryTemplates {\n\n static DEFAULT_PREFIXES = [\n `PREFIX databus: `,\n `PREFIX dcv: `,\n `PREFIX dct: `,\n `PREFIX dcat: `,\n `PREFIX rdf: `,\n `PREFIX rdfs: `\n ];\n\n static COLLECTION_TABLE_ROW_QUERY = `\nPREFIX databus: \nPREFIX dcv: \nPREFIX dct: \nPREFIX dcat: \nPREFIX rdf: \nPREFIX rdfs: \n\nSELECT ?file SAMPLE(?version) SAMPLE(?title) SAMPLE(?abstract) SAMPLE(?license) SAMPLE(?size) SAMPLE(?format) SAMPLE(?compression) (GROUP_CONCAT(DISTINCT ?var; SEPARATOR=', ') AS ?variant) WHERE {\n <%DISTRIBUTION%> databus:file ?file .\n <%DISTRIBUTION%> databus:formatExtension ?format .\n <%DISTRIBUTION%> databus:compression ?compression .\n <%DISTRIBUTION%> dcat:byteSize ?size .\n ?version dcat:distribution <%DISTRIBUTION%> .\n ?version dct:title ?title .\n ?version dct:abstract ?abstract.\n ?version dct:license ?license .\n\n OPTIONAL { <%DISTRIBUTION%> ?p ?var. ?p rdfs:subPropertyOf databus:contentVariant . }\n} GROUP BY ?file\n`;\n\nstatic COLLECTION_TABLE_QUERY = `\nPREFIX databus: \nPREFIX dcv: \nPREFIX dct: \nPREFIX dcat: \nPREFIX rdf: \nPREFIX rdfs: \n\nSELECT ?distribution SAMPLE(?file) AS ?file SAMPLE(?version) AS ?version SAMPLE(?title) AS ?title SAMPLE(?abstract) AS ?abstract SAMPLE(?license) AS ?license SAMPLE(?size) AS ?size SAMPLE(?format) AS ?format SAMPLE(?compression) AS ?compression (GROUP_CONCAT(DISTINCT ?var; SEPARATOR=', ') AS ?variant) WHERE {\n VALUES ?distribution {\n %DISTRIBUTIONS%\n }\n ?distribution databus:file ?file .\n ?distribution databus:formatExtension ?format .\n ?distribution databus:compression ?compression .\n ?distribution dcat:byteSize ?size .\n ?version dcat:distribution ?distribution .\n ?version dct:title ?title .\n ?version dct:abstract ?abstract.\n ?version dct:license ?license .\n OPTIONAL { ?distribution ?p ?var. ?p rdfs:subPropertyOf databus:contentVariant . }\n} GROUP BY ?distribution\n`;\n\n static COLLECTION_STATISTICS_TEMPLATE = {\n indent: 1,\n prefixes: QueryTemplates.DEFAULT_PREFIXES,\n select: `SELECT DISTINCT ?dataset ?file ?license ?size WHERE`,\n body: [\n `GRAPH ?g`,\n `{`,\n `%QUERY%`,\n `\\t?dataset dcat:distribution ?distribution .`,\n `\\t?distribution databus:file ?file .`,\n `\\tOPTIONAL { ?dataset dct:license ?license . }`,\n `\\tOPTIONAL { ?distribution dcat:byteSize ?size . }`,\n `}`\n ]\n };\n\n static COLLECTION_FILES_TEMPLATE = {\n prefixes: QueryTemplates.DEFAULT_PREFIXES,\n indent: 1,\n select: `SELECT DISTINCT ?version ?dataset ?distribution ?title ?description (GROUP_CONCAT(DISTINCT ?file; SEPARATOR=\", \") AS ?files) ?license ?size ?format (GROUP_CONCAT(DISTINCT ?var; SEPARATOR=', ') AS ?variant) WHERE`,\n body: [\n `GRAPH ?g`,\n `{`,\n `%QUERY%`,\n `\\t?distribution databus:file ?file .`,\n `\\t?distribution databus:formatExtension ?format .`,\n `\\tOPTIONAL { ?distribution ?p ?var. ?p rdfs:subPropertyOf databus:contentVariant . }`,\n `\\tOPTIONAL { ?dataset dct:license ?license . }`,\n `\\tOPTIONAL { ?distribution dcat:byteSize ?size . }`,\n `\\t?dataset dcat:distribution ?distribution .`,\n `\\t?dataset dct:hasVersion ?version .`,\n `\\t?dataset dct:title ?title .`,\n `\\t?dataset dct:description ?description.`,\n `}`\n ],\n aggregate: `GROUP BY ?version ?dataset ?distribution ?title ?description ?license ?size ?format`\n };\n\n /**\n * Selects files with additional information for group pages\n */\n static GROUP_PAGE_FILE_BROWSER_TEMPLATE = {\n prefixes: QueryTemplates.DEFAULT_PREFIXES,\n indent: 1,\n select: `SELECT DISTINCT ?file ?version ?artifact ?license ?size ?format ?compression (GROUP_CONCAT(DISTINCT ?var; SEPARATOR=', ') AS ?variant) WHERE`,\n body: [\n\n `GRAPH ?g`,\n `{`,\n `%QUERY%`,\n `\\t?dataset dcat:distribution ?distribution .`,\n `\\t?distribution databus:file ?file .`,\n `\\t?distribution databus:formatExtension ?format .`,\n `\\t?distribution databus:compression ?compression .`,\n `\\t?dataset dct:license ?license .`,\n `\\t?dataset dct:hasVersion ?version .`,\n `\\t?dataset databus:artifact ?artifact .`,\n `\\tOPTIONAL { ?distribution ?p ?var. ?p rdfs:subPropertyOf databus:contentVariant . }`,\n `\\tOPTIONAL { ?distribution dcat:byteSize ?size . }`,\n `}`\n ],\n aggregate: `GROUP BY ?file ?version ?artifact ?license ?size ?format ?compression`\n };\n\n /**\n * Selects files with additional information\n */\n static NODE_FILE_TEMPLATE = {\n prefixes: QueryTemplates.DEFAULT_PREFIXES,\n indent: 1,\n select: `SELECT DISTINCT ?file ?license ?size ?format ?compression (GROUP_CONCAT(DISTINCT ?var; SEPARATOR=', ') AS ?variant) WHERE`,\n body: [\n\n `GRAPH ?g`,\n `{`,\n `%QUERY%`,\n `\\t?dataset dcat:distribution ?distribution .`,\n `\\t?distribution databus:file ?file .`,\n `\\t?distribution databus:formatExtension ?format .`,\n `\\t?distribution databus:compression ?compression .`,\n `\\t?dataset dct:license ?license .`,\n `\\tOPTIONAL { ?distribution ?p ?var. ?p rdfs:subPropertyOf databus:contentVariant . }`,\n `\\tOPTIONAL { ?distribution dcat:byteSize ?size . }`,\n `}`\n ],\n aggregate: `GROUP BY ?file ?license ?size ?format ?compression`\n };\n\n /**\n * The default selection (only file)\n */\n static DEFAULT_FILE_TEMPLATE = {\n prefixes: QueryTemplates.DEFAULT_PREFIXES,\n indent: 1,\n select: `SELECT ?file WHERE`,\n body: [\n `GRAPH ?g`,\n `{`,\n `%QUERY%`,\n `\\t?dataset dcat:distribution ?distribution .`,\n `\\t?distribution databus:file ?file .`,\n `}`,\n ]\n };\n\n static DISTRIBUTIONS_TEMPLATE = {\n prefixes: QueryTemplates.DEFAULT_PREFIXES,\n indent: 1,\n select: `SELECT ?distribution WHERE`,\n body: [\n `GRAPH ?g`,\n `{`,\n `%QUERY%`,\n `\\t?dataset dcat:distribution ?distribution .`,\n `}`,\n ]\n };\n\n /**\n * The default selection (only file)\n */\n static CUSTOM_QUERY_FILE_TEMPLATE = {\n prefixes: QueryTemplates.DEFAULT_PREFIXES,\n indent: 1,\n select: `SELECT ?file WHERE`,\n body: [\n `{`,\n `%QUERY%`,\n `}`,\n ]\n };\n}\n\nmodule.exports = QueryTemplates;\n\n//# sourceURL=webpack://databus-webapp/./js/query-builder/query-templates.js?\n}"); -/***/ }), +/***/ }, -/***/ "./js/search/search-adapter.js": +/***/ "./js/search/search-adapter.js" /*!*************************************!*\ !*** ./js/search/search-adapter.js ***! \*************************************/ -/***/ ((module) => { +(module) { -eval("\n\n\n\nclass SearchAdapter {\n\n static list = [\n { \n name: 'lookup',\n label: 'Lookup',\n factory: this.lookup\n }\n /*\n {\n name: 'virtuoso',\n label: 'Virtuoso SPARQL',\n factory: this.virtuoso\n }\n */\n ];\n\n constructor($http, endpoint, queryFormatter, resultFormatter) {\n this.http = $http;\n this.endpoint = endpoint;\n this.queryFormatter = queryFormatter;\n this.resultFormatter = resultFormatter;\n }\n\n static inferResourceTypes(docs) {\n // TODO:\n }\n \n\n static lookup($http, endpoint) {\n return new SearchAdapter($http, endpoint, function(query) {\n return `?query=${query}&format=json`;\n }, function(response) {\n var docs = response.data.docs;\n SearchAdapter.inferResourceTypes(docs);\n return docs;\n });\n }\n\n static virtuoso($http, endpoint) {\n var virtuosoAdapter = new SearchAdapter($http, endpoint, function (query) {\n var querySelector = /(?<=\\?|&)query=[^(&#)]*/;\n\n // TODO: get the query input from the query\n }, function (results) {\n // TODO: format virtuoso search results\n });\n\n return virtuosoAdapter;\n }\n\n \n\n async search(query) {\n try {\n if (this.queryFormatter != null) {\n query = this.queryFormatter(query);\n }\n\n var results = await this.http.get(`${this.endpoint}${query}`);\n\n if (this.resultFormatter != null) {\n return this.resultFormatter(results);\n }\n\n return results;\n } catch (err) {\n console.log(err);\n return null;\n }\n }\n}\n\nmodule.exports = SearchAdapter;\n\n//# sourceURL=webpack://databus-webapp/./js/search/search-adapter.js?"); +eval("{\n\n\n\nclass SearchAdapter {\n\n static list = [\n { \n name: 'lookup',\n label: 'Lookup',\n factory: this.lookup\n }\n /*\n {\n name: 'virtuoso',\n label: 'Virtuoso SPARQL',\n factory: this.virtuoso\n }\n */\n ];\n\n constructor($http, endpoint, queryFormatter, resultFormatter) {\n this.http = $http;\n this.endpoint = endpoint;\n this.queryFormatter = queryFormatter;\n this.resultFormatter = resultFormatter;\n }\n\n static inferResourceTypes(docs) {\n // TODO:\n }\n \n\n static lookup($http, endpoint) {\n return new SearchAdapter($http, endpoint, function(query) {\n return `?query=${query}&format=json`;\n }, function(response) {\n var docs = response.data.docs;\n SearchAdapter.inferResourceTypes(docs);\n return docs;\n });\n }\n\n static virtuoso($http, endpoint) {\n var virtuosoAdapter = new SearchAdapter($http, endpoint, function (query) {\n var querySelector = /(?<=\\?|&)query=[^(&#)]*/;\n\n // TODO: get the query input from the query\n }, function (results) {\n // TODO: format virtuoso search results\n });\n\n return virtuosoAdapter;\n }\n\n \n\n async search(query) {\n try {\n if (this.queryFormatter != null) {\n query = this.queryFormatter(query);\n }\n\n var results = await this.http.get(`${this.endpoint}${query}`);\n\n if (this.resultFormatter != null) {\n return this.resultFormatter(results);\n }\n\n return results;\n } catch (err) {\n console.log(err);\n return null;\n }\n }\n}\n\nmodule.exports = SearchAdapter;\n\n//# sourceURL=webpack://databus-webapp/./js/search/search-adapter.js?\n}"); -/***/ }), +/***/ }, -/***/ "./js/search/search-manager.js": +/***/ "./js/search/search-manager.js" /*!*************************************!*\ !*** ./js/search/search-manager.js ***! \*************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +(module, __unused_webpack_exports, __webpack_require__) { -eval("const AppJsonFormatter = __webpack_require__(/*! ../utils/app-json-formatter */ \"./js/utils/app-json-formatter.js\");\nconst SearchAdapter = __webpack_require__(/*! ./search-adapter */ \"./js/search/search-adapter.js\");\n\nclass SearchManager {\n\n constructor($http, $interval) {\n this.http = $http;\n this.searchExtensions = [];\n\n this.baseAdapter = SearchAdapter.lookup(this.http, `/api/search`);\n this.searchExtensions.push({\n endpointUri: `/api/search`,\n adapterName: `lookup`,\n adapter: this.baseAdapter\n });\n }\n\n mergeResults(results, documents) {\n for(var document of documents) {\n results.push(document);\n }\n\n return results;\n }\n\n async search(queryUrl, documentFilter) {\n\n var results = [];\n\n for (var searchExtension of this.searchExtensions) {\n\n try {\n\n var documents = await searchExtension.adapter.search(queryUrl);\n\n if(documentFilter != undefined) {\n documents = documents.filter(documentFilter);\n }\n \n results = this.mergeResults(results, documents);\n\n } catch(err) {\n\n }\n }\n\n return results;\n }\n\n async initialize() {\n\n var auth = data.auth;\n\n if (!auth.authenticated) {\n return;\n }\n\n if(auth.info.accountName == undefined) {\n return;\n }\n\n /*\n\n var options = {\n method: 'GET',\n url: `/${ auth.info.accountName }`,\n headers: {\n 'Accept': 'application/ld+json',\n 'X-Jsonld-Formatting': 'flatten',\n 'Cache-Control': 'no-cache',\n 'Pragma': 'no-cache'\n }\n }\n\n var response = await this.http(options);\n var accountData = AppJsonFormatter.formatAccountData(response.data);\n var extensions = JSON.parse(JSON.stringify(accountData.searchExtensions));\n\n for (var searchExtension of extensions) {\n\n switch (searchExtension.adapterName) {\n case 'lookup':\n searchExtension.adapter = SearchAdapter.lookup(this.http, searchExtension.endpointUri);\n break;\n }\n\n this.searchExtensions.push(searchExtension);\n\n })*/\n }\n}\n\nmodule.exports = SearchManager;\n\n\n//# sourceURL=webpack://databus-webapp/./js/search/search-manager.js?"); +eval("{const AppJsonFormatter = __webpack_require__(/*! ../utils/app-json-formatter */ \"./js/utils/app-json-formatter.js\");\nconst SearchAdapter = __webpack_require__(/*! ./search-adapter */ \"./js/search/search-adapter.js\");\n\nclass SearchManager {\n\n constructor($http, $interval) {\n this.http = $http;\n this.searchExtensions = [];\n\n this.baseAdapter = SearchAdapter.lookup(this.http, `/api/search`);\n this.searchExtensions.push({\n endpointUri: `/api/search`,\n adapterName: `lookup`,\n adapter: this.baseAdapter\n });\n }\n\n mergeResults(results, documents) {\n for(var document of documents) {\n results.push(document);\n }\n\n return results;\n }\n\n async search(queryUrl, documentFilter) {\n\n var results = [];\n\n for (var searchExtension of this.searchExtensions) {\n\n try {\n\n var documents = await searchExtension.adapter.search(queryUrl);\n\n if(documentFilter != undefined) {\n documents = documents.filter(documentFilter);\n }\n \n results = this.mergeResults(results, documents);\n\n } catch(err) {\n\n }\n }\n\n return results;\n }\n\n async initialize() {\n\n var auth = data.auth;\n\n if (!auth.authenticated) {\n return;\n }\n\n if(auth.info.accountName == undefined) {\n return;\n }\n\n /*\n\n var options = {\n method: 'GET',\n url: `/${ auth.info.accountName }`,\n headers: {\n 'Accept': 'application/ld+json',\n 'X-Jsonld-Formatting': 'flatten',\n 'Cache-Control': 'no-cache',\n 'Pragma': 'no-cache'\n }\n }\n\n var response = await this.http(options);\n var accountData = AppJsonFormatter.formatAccountData(response.data);\n var extensions = JSON.parse(JSON.stringify(accountData.searchExtensions));\n\n for (var searchExtension of extensions) {\n\n switch (searchExtension.adapterName) {\n case 'lookup':\n searchExtension.adapter = SearchAdapter.lookup(this.http, searchExtension.endpointUri);\n break;\n }\n\n this.searchExtensions.push(searchExtension);\n\n })*/\n }\n}\n\nmodule.exports = SearchManager;\n\n\n//# sourceURL=webpack://databus-webapp/./js/search/search-manager.js?\n}"); -/***/ }), +/***/ }, -/***/ "./js/utils/app-json-formatter.js": +/***/ "./js/utils/app-json-formatter.js" /*!****************************************!*\ !*** ./js/utils/app-json-formatter.js ***! \****************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +(module, __unused_webpack_exports, __webpack_require__) { -eval("const DatabusConstants = __webpack_require__(/*! ./databus-constants */ \"./js/utils/databus-constants.js\");\nconst DatabusUris = __webpack_require__(/*! ./databus-uris */ \"./js/utils/databus-uris.js\");\nconst DatabusUtils = __webpack_require__(/*! ./databus-utils */ \"./js/utils/databus-utils.js\");\nconst JsonldUtils = __webpack_require__(/*! ./jsonld-utils */ \"./js/utils/jsonld-utils.js\");\n\n/**\n * Translates expanded jsonld into web-app compatible json\n */\nclass AppJsonFormatter {\n\n static async createAccountGraphs(uri, name, label, img, secretaries, status) {\n var name = UriUtils.uriToName(uri);\n \n var rsaKeyGraph = {};\n rsaKeyGraph[DatabusUris.JSONLD_TYPE] = DatabusUris.CERT_RSA_PUBLIC_KEY;\n rsaKeyGraph[DatabusUris.RDFS_LABEL] = DatabusConstants.WEBID_SHARED_PUBLIC_KEY_LABEL;\n rsaKeyGraph[DatabusUris.CERT_MODULUS] = signer.getModulus();\n rsaKeyGraph[DatabusUris.CERT_EXPONENT] = 65537;\n \n var personUri = `${uri}${DatabusConstants.WEBID_THIS}`;\n\n var personGraph = {};\n personGraph[DatabusUris.JSONLD_ID] = personUri;\n personGraph[DatabusUris.JSONLD_TYPE] = [ DatabusUris.FOAF_PERSON, DatabusUris.DBP_DBPEDIAN ];\n personGraph[DatabusUris.FOAF_ACCOUNT] = JsonldUtils.refTo(uri);\n personGraph[DatabusUris.DATABUS_ACCOUNT_PROPERTY] = uri;\n personGraph[DatabusUris.CERT_KEY] = [ rsaKeyGraph ];\n personGraph[DatabusUris.FOAF_NAME] = label;\n\n if(img != null) {\n personGraph[DatabusUris.FOAF_IMG] = img;\n }\n\n if(status != null) {\n personGraph[DatabusUris.FOAF_STATUS] = status;\n }\n\n var profileUri = `${uri}${DatabusConstants.WEBID_DOCUMENT}`;\n \n var profileDocumentGraph = {};\n profileDocumentGraph[DatabusUris.JSONLD_ID] = profileUri;\n profileDocumentGraph[DatabusUris.JSONLD_TYPE] = DatabusUris.FOAF_PERSONAL_PROFILE_DOCUMENT;\n profileDocumentGraph[DatabusUris.FOAF_MAKER] = JsonldUtils.refTo(personUri);\n profileDocumentGraph[DatabusUris.FOAF_PRIMARY_TOPIC] = JsonldUtils.refTo(personUri);\n \n var accountGraph = {}\n accountGraph[DatabusUris.JSONLD_ID] = uri;\n accountGraph[DatabusUris.JSONLD_TYPE] = DatabusUris.DATABUS_ACCOUNT;\n accountGraph[DatabusUris.FOAF_ACCOUNT_NAME] = name;\n accountGraph[DatabusUris.DATABUS_NAME] = name;\n\n if(secretaries != null) {\n\n accountGraph[DatabusUris.DATABUS_SECRETARY_PROPERTY] = [];\n\n for(var secretary of secretaries) {\n\n let secretaryAccountUri = `${secretary.accountName}`;\n\n let secretaryGraph = {};\n secretaryGraph[DatabusUris.JSONLD_TYPE] = DatabusUris.DATABUS_SECRETARY;\n secretaryGraph[DatabusUris.DATABUS_ACCOUNT_PROPERTY] = JsonldUtils.refTo(secretaryAccountUri);\n\n if(secretary.hasWriteAccessTo != undefined) {\n secretaryGraph[DatabusUris.DATABUS_HAS_WRITE_ACCESS_TO] = [];\n\n for(var writeAccess of secretary.hasWriteAccessTo) {\n secretaryGraph[DatabusUris.DATABUS_HAS_WRITE_ACCESS_TO].push(JsonldUtils.refTo(writeAccess));\n }\n }\n\n accountGraph[DatabusUris.DATABUS_SECRETARY_PROPERTY].push(secretaryGraph);\n }\n }\n\n let expandedGraphs = [\n accountGraph,\n personGraph,\n profileDocumentGraph\n ];\n \n return await jsonld.compact(expandedGraphs, JsonldLoader.DEFAULT_CONTEXT_URL);\n }\n \n static createAccountData(accountUri, accountLabel, accountStatus, accountImage) {\n\n var personUri = `${accountUri}${DatabusConstants.WEBID_THIS}`;\n\n var accountJsonLd = {};\n\n var accountGraph = {};\n accountGraph[DatabusUris.JSONLD_ID] = accountUri;\n accountGraph[DatabusUris.JSONLD_TYPE] = DatabusUris.DATABUS_ACCOUNT;\n\n var personGraph = {};\n personGraph[DatabusUris.JSONLD_ID] = personUri;\n personGraph[DatabusUris.JSONLD_TYPE] = DatabusUris.FOAF_PERSON;\n personGraph[DatabusUris.FOAF_NAME] = accountLabel;\n personGraph[DatabusUris.FOAF_ACCOUNT] = JsonldUtils.refTo(accountUri);\n\n if (accountStatus != null) {\n personGraph[DatabusUris.FOAF_STATUS] = accountStatus;\n }\n\n if (accountImage != null) {\n personGraph[DatabusUris.FOAF_IMG] = JsonldUtils.refTo(accountImage);\n }\n\n\n return [\n accountGraph,\n personGraph\n ];\n }\n\n static formatGroupData(graphs) {\n var result = {};\n\n // ?uri ?title ?abstract ?description\n var groupGraph = JsonldUtils.getTypedGraph(graphs, DatabusUris.DATABUS_GROUP);\n\n result.uri = groupGraph[DatabusUris.JSONLD_ID];\n result.title = JsonldUtils.getProperty(groupGraph, DatabusUris.DCT_TITLE);\n result.abstract = JsonldUtils.getProperty(groupGraph, DatabusUris.DCT_ABSTRACT);\n result.description = JsonldUtils.getProperty(groupGraph, DatabusUris.DCT_DESCRIPTION);\n result.name = DatabusUtils.uriToResourceName(result.uri);\n return result;\n }\n\n static formatArtifactData(graphs) {\n var result = {};\n // ?uri ?title ?abstract ?description\n var artifactGraph = JsonldUtils.getTypedGraph(graphs, DatabusUris.DATABUS_ARTIFACT);\n\n result.uri = artifactGraph[DatabusUris.JSONLD_ID];\n result.title = JsonldUtils.getProperty(artifactGraph, DatabusUris.DCT_TITLE);\n result.abstract = JsonldUtils.getProperty(artifactGraph, DatabusUris.DCT_ABSTRACT);\n result.description = JsonldUtils.getProperty(artifactGraph, DatabusUris.DCT_DESCRIPTION);\n result.name = DatabusUtils.uriToResourceName(result.uri);\n return result;\n\n\n }\n\n static formatAccountData(graphs) {\n var result = {};\n\n var accountGraph = JsonldUtils.getTypedGraph(graphs, DatabusUris.DATABUS_ACCOUNT);\n var personGraph = JsonldUtils.getTypedGraph(graphs, DatabusUris.FOAF_PERSON);\n\n result.uri = accountGraph[DatabusUris.JSONLD_ID];\n result.accountName = DatabusUtils.uriToResourceName(result.uri);\n result.label = JsonldUtils.getFirstProperty(personGraph, DatabusUris.FOAF_NAME);\n result.imageUrl = JsonldUtils.getFirstProperty(personGraph, DatabusUris.FOAF_IMG);\n result.about = JsonldUtils.getFirstProperty(personGraph, DatabusUris.FOAF_STATUS);\n result.webIds = [];\n result.searchExtensions = [];\n\n var extensionGraphs = JsonldUtils.getTypedGraphs(graphs, DatabusUris.DATABUS_SEARCH_EXTENSION);\n\n for (var extensionGraph of extensionGraphs) {\n result.searchExtensions.push({\n endpointUri: JsonldUtils.getProperty(extensionGraph, DatabusUris.DATABUS_SEARCH_EXTENSION_ENDPOINT),\n adapterName: JsonldUtils.getProperty(extensionGraph, DatabusUris.DATABUS_SEARCH_EXTENSION_ADAPTER),\n });\n }\n\n for (var graph of graphs) {\n\n if (graph[DatabusUris.JSONLD_ID] == personGraph[DatabusUris.JSONLD_ID]) {\n continue;\n }\n\n if (graph[DatabusUris.FOAF_ACCOUNT] != undefined) {\n result.webIds.push(graph[DatabusUris.JSONLD_ID]);\n }\n }\n\n result.secretaries = [];\n var secretaryGraphs = JsonldUtils.getTypedGraphs(graphs, DatabusUris.DATABUS_SECRETARY);\n\n for (var secretaryGraph of secretaryGraphs) {\n var secretaryData = {\n accountName: JsonldUtils.getProperty(secretaryGraph, DatabusUris.DATABUS_ACCOUNT_PROPERTY),\n hasWriteAccessTo: []\n };\n\n var writeAccessUris = secretaryGraph[DatabusUris.DATABUS_HAS_WRITE_ACCESS_TO];\n\n if (Array.isArray(writeAccessUris)) {\n for (var item of writeAccessUris) {\n if (typeof item === 'object' && item['@id']) {\n secretaryData.hasWriteAccessTo.push(item['@id']);\n } else if (typeof item === 'string') {\n secretaryData.hasWriteAccessTo.push(item);\n }\n }\n }\n\n result.secretaries.push(secretaryData);\n }\n\n return result;\n }\n\n static formatVersionData(versionGraph) {\n\n\n var version = {};\n version.uri = versionGraph[DatabusUris.JSONLD_ID];\n version.title = JsonldUtils.getProperty(versionGraph, DatabusUris.DCT_TITLE);\n version.abstract = JsonldUtils.getProperty(versionGraph, DatabusUris.DCT_ABSTRACT);\n version.description = JsonldUtils.getProperty(versionGraph, DatabusUris.DCT_DESCRIPTION);\n version.artifact = JsonldUtils.getProperty(versionGraph, DatabusUris.DATABUS_ARTIFACT_PROPERTY);\n version.license = JsonldUtils.getProperty(versionGraph, DatabusUris.DCT_LICENSE);\n version.attribution = JsonldUtils.getProperty(versionGraph, DatabusUris.DATABUS_ATTRIBUTION);\n version.wasDerivedFrom = JsonldUtils.getProperty(versionGraph, DatabusUris.PROV_WAS_DERIVED_FROM);\n version.issued = JsonldUtils.getProperty(versionGraph, DatabusUris.DCT_ISSUED);\n version.name = JsonldUtils.getProperty(versionGraph, DatabusUris.DCT_HAS_VERSION);\n\n return version;\n }\n\n static formatCollectionData(graphs) {\n var collectionGraph = JsonldUtils.getTypedGraph(graphs, DatabusUris.DATABUS_COLLECTION);\n\n var result = {};\n\n result.uri = collectionGraph[DatabusUris.JSONLD_ID];\n result.title = JsonldUtils.getProperty(collectionGraph, DatabusUris.DCT_TITLE);\n result.abstract = JsonldUtils.getProperty(collectionGraph, DatabusUris.DCT_ABSTRACT);\n result.description = JsonldUtils.getProperty(collectionGraph, DatabusUris.DCT_DESCRIPTION);\n result.issued = JsonldUtils.getProperty(collectionGraph, DatabusUris.DCT_ISSUED);\n result.publisher = JsonldUtils.getProperty(collectionGraph, DatabusUris.DCT_PUBLISHER);\n result.account = JsonldUtils.getProperty(collectionGraph, DatabusUris.DATABUS_ACCOUNT_PROPERTY);\n\n var content = JsonldUtils.getProperty(collectionGraph, DatabusUris.DATABUS_COLLECTION_CONTENT)\n result.content = DatabusUtils.tryParseJson(unescape(content));\n\n return result;\n }\n}\n\nmodule.exports = AppJsonFormatter;\n\n\n//# sourceURL=webpack://databus-webapp/./js/utils/app-json-formatter.js?"); +eval("{const DatabusConstants = __webpack_require__(/*! ./databus-constants */ \"./js/utils/databus-constants.js\");\nconst DatabusUris = __webpack_require__(/*! ./databus-uris */ \"./js/utils/databus-uris.js\");\nconst DatabusUtils = __webpack_require__(/*! ./databus-utils */ \"./js/utils/databus-utils.js\");\nconst JsonldUtils = __webpack_require__(/*! ./jsonld-utils */ \"./js/utils/jsonld-utils.js\");\n\n/**\n * Translates expanded jsonld into web-app compatible json\n */\nclass AppJsonFormatter {\n\n static async createAccountGraphs(uri, name, label, img, secretaries, status) {\n var name = UriUtils.uriToName(uri);\n \n var rsaKeyGraph = {};\n rsaKeyGraph[DatabusUris.JSONLD_TYPE] = DatabusUris.CERT_RSA_PUBLIC_KEY;\n rsaKeyGraph[DatabusUris.RDFS_LABEL] = DatabusConstants.WEBID_SHARED_PUBLIC_KEY_LABEL;\n rsaKeyGraph[DatabusUris.CERT_MODULUS] = signer.getModulus();\n rsaKeyGraph[DatabusUris.CERT_EXPONENT] = 65537;\n \n var personUri = `${uri}${DatabusConstants.WEBID_THIS}`;\n\n var personGraph = {};\n personGraph[DatabusUris.JSONLD_ID] = personUri;\n personGraph[DatabusUris.JSONLD_TYPE] = [ DatabusUris.FOAF_PERSON, DatabusUris.DBP_DBPEDIAN ];\n personGraph[DatabusUris.FOAF_ACCOUNT] = JsonldUtils.refTo(uri);\n personGraph[DatabusUris.DATABUS_ACCOUNT_PROPERTY] = uri;\n personGraph[DatabusUris.CERT_KEY] = [ rsaKeyGraph ];\n personGraph[DatabusUris.FOAF_NAME] = label;\n\n if(img != null) {\n personGraph[DatabusUris.FOAF_IMG] = img;\n }\n\n if(status != null) {\n personGraph[DatabusUris.FOAF_STATUS] = status;\n }\n\n var profileUri = `${uri}${DatabusConstants.WEBID_DOCUMENT}`;\n \n var profileDocumentGraph = {};\n profileDocumentGraph[DatabusUris.JSONLD_ID] = profileUri;\n profileDocumentGraph[DatabusUris.JSONLD_TYPE] = DatabusUris.FOAF_PERSONAL_PROFILE_DOCUMENT;\n profileDocumentGraph[DatabusUris.FOAF_MAKER] = JsonldUtils.refTo(personUri);\n profileDocumentGraph[DatabusUris.FOAF_PRIMARY_TOPIC] = JsonldUtils.refTo(personUri);\n \n var accountGraph = {}\n accountGraph[DatabusUris.JSONLD_ID] = uri;\n accountGraph[DatabusUris.JSONLD_TYPE] = DatabusUris.DATABUS_ACCOUNT;\n accountGraph[DatabusUris.FOAF_ACCOUNT_NAME] = name;\n accountGraph[DatabusUris.DATABUS_NAME] = name;\n\n if(secretaries != null) {\n\n accountGraph[DatabusUris.DATABUS_SECRETARY_PROPERTY] = [];\n\n for(var secretary of secretaries) {\n\n let secretaryAccountUri = `${secretary.accountName}`;\n\n let secretaryGraph = {};\n secretaryGraph[DatabusUris.JSONLD_TYPE] = DatabusUris.DATABUS_SECRETARY;\n secretaryGraph[DatabusUris.DATABUS_ACCOUNT_PROPERTY] = JsonldUtils.refTo(secretaryAccountUri);\n\n if(secretary.hasWriteAccessTo != undefined) {\n secretaryGraph[DatabusUris.DATABUS_HAS_WRITE_ACCESS_TO] = [];\n\n for(var writeAccess of secretary.hasWriteAccessTo) {\n secretaryGraph[DatabusUris.DATABUS_HAS_WRITE_ACCESS_TO].push(JsonldUtils.refTo(writeAccess));\n }\n }\n\n accountGraph[DatabusUris.DATABUS_SECRETARY_PROPERTY].push(secretaryGraph);\n }\n }\n\n let expandedGraphs = [\n accountGraph,\n personGraph,\n profileDocumentGraph\n ];\n \n return await jsonld.compact(expandedGraphs, JsonldLoader.DEFAULT_CONTEXT_URL);\n }\n \n static createAccountData(accountUri, accountLabel, accountStatus, accountImage) {\n\n var personUri = `${accountUri}${DatabusConstants.WEBID_THIS}`;\n\n var accountJsonLd = {};\n\n var accountGraph = {};\n accountGraph[DatabusUris.JSONLD_ID] = accountUri;\n accountGraph[DatabusUris.JSONLD_TYPE] = DatabusUris.DATABUS_ACCOUNT;\n\n var personGraph = {};\n personGraph[DatabusUris.JSONLD_ID] = personUri;\n personGraph[DatabusUris.JSONLD_TYPE] = DatabusUris.FOAF_PERSON;\n personGraph[DatabusUris.FOAF_NAME] = accountLabel;\n personGraph[DatabusUris.FOAF_ACCOUNT] = JsonldUtils.refTo(accountUri);\n\n if (accountStatus != null) {\n personGraph[DatabusUris.FOAF_STATUS] = accountStatus;\n }\n\n if (accountImage != null) {\n personGraph[DatabusUris.FOAF_IMG] = JsonldUtils.refTo(accountImage);\n }\n\n\n return [\n accountGraph,\n personGraph\n ];\n }\n\n static formatGroupData(graphs) {\n var result = {};\n\n // ?uri ?title ?abstract ?description\n var groupGraph = JsonldUtils.getTypedGraph(graphs, DatabusUris.DATABUS_GROUP);\n\n result.uri = groupGraph[DatabusUris.JSONLD_ID];\n result.title = JsonldUtils.getProperty(groupGraph, DatabusUris.DCT_TITLE);\n result.abstract = JsonldUtils.getProperty(groupGraph, DatabusUris.DCT_ABSTRACT);\n result.description = JsonldUtils.getProperty(groupGraph, DatabusUris.DCT_DESCRIPTION);\n result.name = DatabusUtils.uriToResourceName(result.uri);\n return result;\n }\n\n static formatArtifactData(graphs) {\n var result = {};\n // ?uri ?title ?abstract ?description\n var artifactGraph = JsonldUtils.getTypedGraph(graphs, DatabusUris.DATABUS_ARTIFACT);\n\n result.uri = artifactGraph[DatabusUris.JSONLD_ID];\n result.title = JsonldUtils.getProperty(artifactGraph, DatabusUris.DCT_TITLE);\n result.abstract = JsonldUtils.getProperty(artifactGraph, DatabusUris.DCT_ABSTRACT);\n result.description = JsonldUtils.getProperty(artifactGraph, DatabusUris.DCT_DESCRIPTION);\n result.name = DatabusUtils.uriToResourceName(result.uri);\n return result;\n\n\n }\n\n static formatAccountData(graphs) {\n var result = {};\n\n var accountGraph = JsonldUtils.getTypedGraph(graphs, DatabusUris.DATABUS_ACCOUNT);\n var personGraph = JsonldUtils.getTypedGraph(graphs, DatabusUris.FOAF_PERSON);\n\n result.uri = accountGraph[DatabusUris.JSONLD_ID];\n result.accountName = DatabusUtils.uriToResourceName(result.uri);\n result.label = JsonldUtils.getFirstProperty(personGraph, DatabusUris.FOAF_NAME);\n result.imageUrl = JsonldUtils.getFirstProperty(personGraph, DatabusUris.FOAF_IMG);\n result.about = JsonldUtils.getFirstProperty(personGraph, DatabusUris.FOAF_STATUS);\n result.webIds = [];\n result.searchExtensions = [];\n\n var extensionGraphs = JsonldUtils.getTypedGraphs(graphs, DatabusUris.DATABUS_SEARCH_EXTENSION);\n\n for (var extensionGraph of extensionGraphs) {\n result.searchExtensions.push({\n endpointUri: JsonldUtils.getProperty(extensionGraph, DatabusUris.DATABUS_SEARCH_EXTENSION_ENDPOINT),\n adapterName: JsonldUtils.getProperty(extensionGraph, DatabusUris.DATABUS_SEARCH_EXTENSION_ADAPTER),\n });\n }\n\n for (var graph of graphs) {\n\n if (graph[DatabusUris.JSONLD_ID] == personGraph[DatabusUris.JSONLD_ID]) {\n continue;\n }\n\n if (graph[DatabusUris.FOAF_ACCOUNT] != undefined) {\n result.webIds.push(graph[DatabusUris.JSONLD_ID]);\n }\n }\n\n result.secretaries = [];\n var secretaryGraphs = JsonldUtils.getTypedGraphs(graphs, DatabusUris.DATABUS_SECRETARY);\n\n for (var secretaryGraph of secretaryGraphs) {\n var secretaryData = {\n accountName: JsonldUtils.getProperty(secretaryGraph, DatabusUris.DATABUS_ACCOUNT_PROPERTY),\n hasWriteAccessTo: []\n };\n\n var writeAccessUris = secretaryGraph[DatabusUris.DATABUS_HAS_WRITE_ACCESS_TO];\n\n if (Array.isArray(writeAccessUris)) {\n for (var item of writeAccessUris) {\n if (typeof item === 'object' && item['@id']) {\n secretaryData.hasWriteAccessTo.push(item['@id']);\n } else if (typeof item === 'string') {\n secretaryData.hasWriteAccessTo.push(item);\n }\n }\n }\n\n result.secretaries.push(secretaryData);\n }\n\n return result;\n }\n\n static formatVersionData(versionGraph) {\n\n\n var version = {};\n version.uri = versionGraph[DatabusUris.JSONLD_ID];\n version.title = JsonldUtils.getProperty(versionGraph, DatabusUris.DCT_TITLE);\n version.abstract = JsonldUtils.getProperty(versionGraph, DatabusUris.DCT_ABSTRACT);\n version.description = JsonldUtils.getProperty(versionGraph, DatabusUris.DCT_DESCRIPTION);\n version.artifact = JsonldUtils.getProperty(versionGraph, DatabusUris.DATABUS_ARTIFACT_PROPERTY);\n version.license = JsonldUtils.getProperty(versionGraph, DatabusUris.DCT_LICENSE);\n version.attribution = JsonldUtils.getProperty(versionGraph, DatabusUris.DATABUS_ATTRIBUTION);\n version.wasDerivedFrom = JsonldUtils.getProperty(versionGraph, DatabusUris.PROV_WAS_DERIVED_FROM);\n version.issued = JsonldUtils.getProperty(versionGraph, DatabusUris.DCT_ISSUED);\n version.name = JsonldUtils.getProperty(versionGraph, DatabusUris.DCT_HAS_VERSION);\n\n return version;\n }\n\n static formatCollectionData(graphs) {\n var collectionGraph = JsonldUtils.getTypedGraph(graphs, DatabusUris.DATABUS_COLLECTION);\n\n var result = {};\n\n result.uri = collectionGraph[DatabusUris.JSONLD_ID];\n result.title = JsonldUtils.getProperty(collectionGraph, DatabusUris.DCT_TITLE);\n result.abstract = JsonldUtils.getProperty(collectionGraph, DatabusUris.DCT_ABSTRACT);\n result.description = JsonldUtils.getProperty(collectionGraph, DatabusUris.DCT_DESCRIPTION);\n result.issued = JsonldUtils.getProperty(collectionGraph, DatabusUris.DCT_ISSUED);\n result.publisher = JsonldUtils.getProperty(collectionGraph, DatabusUris.DCT_PUBLISHER);\n result.account = JsonldUtils.getProperty(collectionGraph, DatabusUris.DATABUS_ACCOUNT_PROPERTY);\n\n var content = JsonldUtils.getProperty(collectionGraph, DatabusUris.DATABUS_COLLECTION_CONTENT)\n result.content = DatabusUtils.tryParseJson(unescape(content));\n\n return result;\n }\n}\n\nmodule.exports = AppJsonFormatter;\n\n\n//# sourceURL=webpack://databus-webapp/./js/utils/app-json-formatter.js?\n}"); -/***/ }), +/***/ }, -/***/ "./js/utils/databus-constants.js": +/***/ "./js/utils/databus-constants.js" /*!***************************************!*\ !*** ./js/utils/databus-constants.js ***! \***************************************/ -/***/ ((module) => { +(module) { -eval("\n\nclass DatabusConstants {\n static FACET_DEFAULT_SUBQUERY =\n \"\\n\\t{ \" +\n \"\\n\\t\\t?distribution <%FACET%> '%VALUE%'^^ . \" +\n \"\\n\\t} \";\n\n static FACET_DEFAULT_SUBQUERY_PLACEHOLDER_FACET = \"%FACET%\";\n static FACET_DEFAULT_SUBQUERY_PLACEHOLDER_VALUE = \"%VALUE%\";\n static FACET_LATEST_VERSION_VALUE = \"$latest\";\n static FACET_LATEST_VERSION_LABEL = \"Latest Version\";\n\n static WEBID_THIS = \"#this\";\n static WEBID_DOCUMENT = \"#doc\";\n static WEBID_SHARED_PUBLIC_KEY_LABEL = \"Shared Databus Public Key\";\n\n static FACET_LASTEST_ARTIFACT_VERSION_SUBQUERY =\n \"\\n\\t{\" +\n \"\\n\\t\\t?distribution dct:hasVersion ?latestVersion \" +\n \"\\n\\t\\t{\" +\n \"\\n\\t\\t\\tSELECT (?version as ?latestVersion) WHERE { \" +\n \"\\n\\t\\t\\t\\t?dataset databus:artifact <%ARTIFACT_URI%> . \" +\n \"\\n\\t\\t\\t\\t?dataset dct:hasVersion ?version . \" +\n \"\\n\\t\\t\\t} ORDER BY DESC (?version) LIMIT 1 \" +\n \"\\n\\t\\t} \" +\n \"\\n\\t}\";\n\n static FACET_LASTEST_GROUP_VERSION_SUBQUERY =\n \"\\n\\t{\" +\n \"\\n\\t\\t?distribution dct:hasVersion ?latestVersion \" +\n \"\\n\\t\\t{\" +\n \"\\n\\t\\t\\tSELECT (?version as ?latestVersion) WHERE { \" +\n \"\\n\\t\\t\\t\\t?dataset databus:group <%ARTIFACT_URI%> . \" +\n \"\\n\\t\\t\\t\\t?dataset dct:hasVersion ?version . \" +\n \"\\n\\t\\t\\t} ORDER BY DESC (?version) LIMIT 1 \" +\n \"\\n\\t\\t} \" +\n \"\\n\\t}\";\n\n static FACET_SUBQUERY_UNION = \"\\n\\tUNION\";\n static DATABUS_SPARQL_ENDPOINT_URL = \"/sparql\";\n}\n\nmodule.exports = DatabusConstants;\n\n//# sourceURL=webpack://databus-webapp/./js/utils/databus-constants.js?"); +eval("{\n\nclass DatabusConstants {\n static FACET_DEFAULT_SUBQUERY =\n \"\\n\\t{ \" +\n \"\\n\\t\\t?distribution <%FACET%> '%VALUE%'^^ . \" +\n \"\\n\\t} \";\n\n static FACET_DEFAULT_SUBQUERY_PLACEHOLDER_FACET = \"%FACET%\";\n static FACET_DEFAULT_SUBQUERY_PLACEHOLDER_VALUE = \"%VALUE%\";\n static FACET_LATEST_VERSION_VALUE = \"$latest\";\n static FACET_LATEST_VERSION_LABEL = \"Latest Version\";\n\n static WEBID_THIS = \"#this\";\n static WEBID_DOCUMENT = \"#doc\";\n static WEBID_SHARED_PUBLIC_KEY_LABEL = \"Shared Databus Public Key\";\n\n static FACET_LASTEST_ARTIFACT_VERSION_SUBQUERY =\n \"\\n\\t{\" +\n \"\\n\\t\\t?distribution dct:hasVersion ?latestVersion \" +\n \"\\n\\t\\t{\" +\n \"\\n\\t\\t\\tSELECT (?version as ?latestVersion) WHERE { \" +\n \"\\n\\t\\t\\t\\t?dataset databus:artifact <%ARTIFACT_URI%> . \" +\n \"\\n\\t\\t\\t\\t?dataset dct:hasVersion ?version . \" +\n \"\\n\\t\\t\\t} ORDER BY DESC (?version) LIMIT 1 \" +\n \"\\n\\t\\t} \" +\n \"\\n\\t}\";\n\n static FACET_LASTEST_GROUP_VERSION_SUBQUERY =\n \"\\n\\t{\" +\n \"\\n\\t\\t?distribution dct:hasVersion ?latestVersion \" +\n \"\\n\\t\\t{\" +\n \"\\n\\t\\t\\tSELECT (?version as ?latestVersion) WHERE { \" +\n \"\\n\\t\\t\\t\\t?dataset databus:group <%ARTIFACT_URI%> . \" +\n \"\\n\\t\\t\\t\\t?dataset dct:hasVersion ?version . \" +\n \"\\n\\t\\t\\t} ORDER BY DESC (?version) LIMIT 1 \" +\n \"\\n\\t\\t} \" +\n \"\\n\\t}\";\n\n static FACET_SUBQUERY_UNION = \"\\n\\tUNION\";\n static DATABUS_SPARQL_ENDPOINT_URL = \"/sparql\";\n}\n\nmodule.exports = DatabusConstants;\n\n//# sourceURL=webpack://databus-webapp/./js/utils/databus-constants.js?\n}"); -/***/ }), +/***/ }, -/***/ "./js/utils/databus-facets-cache.js": +/***/ "./js/utils/databus-facets-cache.js" /*!******************************************!*\ !*** ./js/utils/databus-facets-cache.js ***! \******************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +(module, __unused_webpack_exports, __webpack_require__) { -eval("const { DATABUS_CONTENT_VARIANT_PREFIX } = __webpack_require__(/*! ./databus-uris */ \"./js/utils/databus-uris.js\");\nconst DatabusUris = __webpack_require__(/*! ./databus-uris */ \"./js/utils/databus-uris.js\");\nconst DatabusUtils = __webpack_require__(/*! ./databus-utils */ \"./js/utils/databus-utils.js\");\n\nclass DatabusFacetsCache {\n\n constructor($http) {\n this._facets = {};\n this._http = $http;\n this._regex = new RegExp('%RESOURCE_URI%', \"g\");\n\n this.pathLengthToQueryMap = {\n 2: DatabusFacetsCache.GET_GROUP_FACETS,\n 3: DatabusFacetsCache.GET_ARTIFACT_FACETS\n }\n\n this._facetMetadata = {};\n \n this._facetMetadata[DatabusUris.DCT_HAS_VERSION] = \"Version\";\n this._facetMetadata[DatabusUris.DATABUS_FORMAT_EXTENSION] = \"Format\";\n this._facetMetadata[DatabusUris.DATABUS_CONTENT_VARIANT_PREFIX + \"lang\"] = \"Language\";\n this._facetMetadata[DatabusUris.DATABUS_CONTENT_VARIANT_PREFIX + \"domain\"] = \"Domain\";\n this._facetMetadata[DatabusUris.DATABUS_CONTENT_VARIANT_PREFIX + \"tag\"] = \"Tag\";\n this._facetMetadata[DatabusUris.DATABUS_COMPRESSION] = \"Compression\";\n \n }\n\n async get(resource) {\n\n if (this._facets[resource] != undefined) {\n return {\n uri : resource,\n facets: this._facets[resource]\n };\n }\n\n var url = new URL(resource);\n var origin = url.origin;\n var pathLength = DatabusUtils.getResourcePathLength(resource);\n\n var query = this.pathLengthToQueryMap[pathLength];\n\n\n if (query == undefined) {\n return null;\n }\n\n query = query.replace(this._regex, resource);\n\n var req = {\n method: 'POST',\n url: `${origin}/sparql?query=`,\n data: `format=json&query=${encodeURIComponent(query)}`,\n headers: {\n \"Content-type\": \"application/x-www-form-urlencoded\"\n },\n }\n\n var response = await this._http(req);\n\n var result = {};\n\n for (var binding of response.data.results.bindings) {\n\n var property = binding.property.value;\n\n if (result[property] == undefined) {\n result[property] = {};\n\n var label = this._facetMetadata[property] != undefined ? this._facetMetadata[property] : \n DatabusUtils.uriToName(property);\n\n result[binding.property.value].label = label;\n result[binding.property.value].values = []\n }\n\n result[binding.property.value].values.push(binding.value.value);\n }\n\n this._facets[resource] = result;\n \n return {\n uri : resource,\n facets: this._facets[resource]\n };\n }\n\n\n static GET_GROUP_FACETS = `\n PREFIX databus: \n PREFIX dcv: \n PREFIX dct: \n PREFIX dcat: \n PREFIX rdfs: \n \n SELECT DISTINCT ?property ?value WHERE {\n {\n GRAPH ?g {\n ?dataset databus:group <%RESOURCE_URI%> .\n ?dataset dcat:distribution ?distribution . \n ?distribution dct:hasVersion ?value .\n BIND(dct:hasVersion AS ?property)\n }\n }\n UNION\n {\n GRAPH ?g {\n ?dataset databus:group <%RESOURCE_URI%> .\n ?dataset dcat:distribution ?distribution . \n ?distribution databus:formatExtension ?value .\n BIND(databus:formatExtension AS ?property)\n }\n }\n UNION\n {\n GRAPH ?g {\n ?dataset databus:group <%RESOURCE_URI%> .\n ?dataset dcat:distribution ?distribution . \n ?distribution databus:compression ?value .\n BIND(databus:compression AS ?property)\n }\n }\n UNION\n {\n GRAPH ?g {\n ?dataset databus:group <%RESOURCE_URI%> .\n ?dataset dcat:distribution ?distribution . \n ?distribution ?property ?value .\n ?property rdfs:subPropertyOf databus:contentVariant .\n }\n }\n }\n `;\n\n static GET_ARTIFACT_FACETS = `\n PREFIX databus: \n PREFIX dcv: \n PREFIX dct: \n PREFIX dcat: \n PREFIX rdfs: \n \n SELECT DISTINCT ?property ?value WHERE {\n GRAPH ?g {\n {\n BIND(dct:hasVersion AS ?property)\n ?dataset databus:artifact <%RESOURCE_URI%> .\n ?dataset dcat:distribution ?distribution . \n ?distribution dct:hasVersion ?value .\n }\n UNION\n {\n BIND(databus:formatExtension AS ?property)\n ?dataset databus:artifact <%RESOURCE_URI%> .\n ?dataset dcat:distribution ?distribution . \n ?distribution databus:formatExtension ?value .\n }\n UNION\n {\n BIND(databus:compression AS ?property)\n ?dataset databus:artifact <%RESOURCE_URI%> .\n ?dataset dcat:distribution ?distribution . \n ?distribution databus:compression ?value .\n }\n UNION\n {\n ?dataset databus:artifact <%RESOURCE_URI%> .\n ?dataset dcat:distribution ?distribution . \n ?distribution ?property ?value .\n ?property rdfs:subPropertyOf databus:contentVariant .\n }\n }\n }`;\n\n\n\n}\n\nmodule.exports = DatabusFacetsCache;\n\n//# sourceURL=webpack://databus-webapp/./js/utils/databus-facets-cache.js?"); +eval("{const { DATABUS_CONTENT_VARIANT_PREFIX } = __webpack_require__(/*! ./databus-uris */ \"./js/utils/databus-uris.js\");\nconst DatabusUris = __webpack_require__(/*! ./databus-uris */ \"./js/utils/databus-uris.js\");\nconst DatabusUtils = __webpack_require__(/*! ./databus-utils */ \"./js/utils/databus-utils.js\");\n\nclass DatabusFacetsCache {\n\n constructor($http) {\n this._facets = {};\n this._http = $http;\n this._regex = new RegExp('%RESOURCE_URI%', \"g\");\n\n this.pathLengthToQueryMap = {\n 2: DatabusFacetsCache.GET_GROUP_FACETS,\n 3: DatabusFacetsCache.GET_ARTIFACT_FACETS\n }\n\n this._facetMetadata = {};\n \n this._facetMetadata[DatabusUris.DCT_HAS_VERSION] = \"Version\";\n this._facetMetadata[DatabusUris.DATABUS_FORMAT_EXTENSION] = \"Format\";\n this._facetMetadata[DatabusUris.DATABUS_CONTENT_VARIANT_PREFIX + \"lang\"] = \"Language\";\n this._facetMetadata[DatabusUris.DATABUS_CONTENT_VARIANT_PREFIX + \"domain\"] = \"Domain\";\n this._facetMetadata[DatabusUris.DATABUS_CONTENT_VARIANT_PREFIX + \"tag\"] = \"Tag\";\n this._facetMetadata[DatabusUris.DATABUS_COMPRESSION] = \"Compression\";\n \n }\n\n async get(resource) {\n\n if (this._facets[resource] != undefined) {\n return {\n uri : resource,\n facets: this._facets[resource]\n };\n }\n\n var url = new URL(resource);\n var origin = url.origin;\n var pathLength = DatabusUtils.getResourcePathLength(resource);\n\n var query = this.pathLengthToQueryMap[pathLength];\n\n\n if (query == undefined) {\n return null;\n }\n\n query = query.replace(this._regex, resource);\n\n var req = {\n method: 'POST',\n url: `${origin}/sparql?query=`,\n data: `format=json&query=${encodeURIComponent(query)}`,\n headers: {\n \"Content-type\": \"application/x-www-form-urlencoded\"\n },\n }\n\n var response = await this._http(req);\n\n var result = {};\n\n for (var binding of response.data.results.bindings) {\n\n var property = binding.property.value;\n\n if (result[property] == undefined) {\n result[property] = {};\n\n var label = this._facetMetadata[property] != undefined ? this._facetMetadata[property] : \n DatabusUtils.uriToName(property);\n\n result[binding.property.value].label = label;\n result[binding.property.value].values = []\n }\n\n result[binding.property.value].values.push(binding.value.value);\n }\n\n this._facets[resource] = result;\n \n return {\n uri : resource,\n facets: this._facets[resource]\n };\n }\n\n\n static GET_GROUP_FACETS = `\n PREFIX databus: \n PREFIX dcv: \n PREFIX dct: \n PREFIX dcat: \n PREFIX rdfs: \n \n SELECT DISTINCT ?property ?value WHERE {\n {\n GRAPH ?g {\n ?dataset databus:group <%RESOURCE_URI%> .\n ?dataset dcat:distribution ?distribution . \n ?distribution dct:hasVersion ?value .\n BIND(dct:hasVersion AS ?property)\n }\n }\n UNION\n {\n GRAPH ?g {\n ?dataset databus:group <%RESOURCE_URI%> .\n ?dataset dcat:distribution ?distribution . \n ?distribution databus:formatExtension ?value .\n BIND(databus:formatExtension AS ?property)\n }\n }\n UNION\n {\n GRAPH ?g {\n ?dataset databus:group <%RESOURCE_URI%> .\n ?dataset dcat:distribution ?distribution . \n ?distribution databus:compression ?value .\n BIND(databus:compression AS ?property)\n }\n }\n UNION\n {\n GRAPH ?g {\n ?dataset databus:group <%RESOURCE_URI%> .\n ?dataset dcat:distribution ?distribution . \n ?distribution ?property ?value .\n ?property rdfs:subPropertyOf databus:contentVariant .\n }\n }\n }\n `;\n\n static GET_ARTIFACT_FACETS = `\n PREFIX databus: \n PREFIX dcv: \n PREFIX dct: \n PREFIX dcat: \n PREFIX rdfs: \n \n SELECT DISTINCT ?property ?value WHERE {\n GRAPH ?g {\n {\n BIND(dct:hasVersion AS ?property)\n ?dataset databus:artifact <%RESOURCE_URI%> .\n ?dataset dcat:distribution ?distribution . \n ?distribution dct:hasVersion ?value .\n }\n UNION\n {\n BIND(databus:formatExtension AS ?property)\n ?dataset databus:artifact <%RESOURCE_URI%> .\n ?dataset dcat:distribution ?distribution . \n ?distribution databus:formatExtension ?value .\n }\n UNION\n {\n BIND(databus:compression AS ?property)\n ?dataset databus:artifact <%RESOURCE_URI%> .\n ?dataset dcat:distribution ?distribution . \n ?distribution databus:compression ?value .\n }\n UNION\n {\n ?dataset databus:artifact <%RESOURCE_URI%> .\n ?dataset dcat:distribution ?distribution . \n ?distribution ?property ?value .\n ?property rdfs:subPropertyOf databus:contentVariant .\n }\n }\n }`;\n\n\n\n}\n\nmodule.exports = DatabusFacetsCache;\n\n//# sourceURL=webpack://databus-webapp/./js/utils/databus-facets-cache.js?\n}"); -/***/ }), +/***/ }, -/***/ "./js/utils/databus-messages.js": +/***/ "./js/utils/databus-messages.js" /*!**************************************!*\ !*** ./js/utils/databus-messages.js ***! \**************************************/ -/***/ ((module) => { +(module) { -eval("\nclass DatabusMessages {\n\n // Collection Editor\n static CEDIT_INVALID_IDENTIFIER = 'The identifier must match the following regular expression: #REGEX#';\n static CEDIT_INVALID_TITLE = 'The title must match the following regular expression: #REGEX#';\n static CEDIT_INVALID_ABSTRACT = 'The abstract must match the following regular expression: #REGEX#';\n static CEDIT_INVALID_DESCRIPTION = 'The description must match the following regular expression: #REGEX#';\n static CEDIT_COLLECTION_IMPORT_FAILED = 'Failed to import the collection';\n static CEDIT_COLLECTION_IMPORTED = 'Collection imported successfully';\n static CEDIT_COLLECTION_SAVED = 'Collection saved successfully';\n static CEDIT_COLLECTION_SAVE_FAILED = 'Failed to save the collection';\n static CEDIT_COLLECTION_UNPUBLISHED = 'Collection unpublished successfully';\n static CEDIT_LOCAL_CHANGES_DISCARDED = 'Local changes discarded';\n\n // Generic\n static GENERIC_COPIED_TO_CLIPBOARD = 'Copied to clipboard!';\n\n // Account \n static ACCOUT_PROFILE_SAVED = 'Profile changes have been saved';\n\n static ACCOUNT_API_KEY_CREATED = 'API key created';\n\n static ACCOUNT_WEBID_LINKED = 'External WebId has been linked to your profile';\n\n \n}\n\n module.exports = DatabusMessages;\n\n\n//# sourceURL=webpack://databus-webapp/./js/utils/databus-messages.js?"); +eval("{\nclass DatabusMessages {\n\n // Collection Editor\n static CEDIT_INVALID_IDENTIFIER = 'The identifier must match the following regular expression: #REGEX#';\n static CEDIT_INVALID_TITLE = 'The title must match the following regular expression: #REGEX#';\n static CEDIT_INVALID_ABSTRACT = 'The abstract must match the following regular expression: #REGEX#';\n static CEDIT_INVALID_DESCRIPTION = 'The description must match the following regular expression: #REGEX#';\n static CEDIT_COLLECTION_IMPORT_FAILED = 'Failed to import the collection';\n static CEDIT_COLLECTION_IMPORTED = 'Collection imported successfully';\n static CEDIT_COLLECTION_SAVED = 'Collection saved successfully';\n static CEDIT_COLLECTION_SAVE_FAILED = 'Failed to save the collection';\n static CEDIT_COLLECTION_UNPUBLISHED = 'Collection unpublished successfully';\n static CEDIT_LOCAL_CHANGES_DISCARDED = 'Local changes discarded';\n\n // Generic\n static GENERIC_COPIED_TO_CLIPBOARD = 'Copied to clipboard!';\n\n // Account \n static ACCOUT_PROFILE_SAVED = 'Profile changes have been saved';\n\n static ACCOUNT_API_KEY_CREATED = 'API key created';\n\n static ACCOUNT_WEBID_LINKED = 'External WebId has been linked to your profile';\n\n \n}\n\n module.exports = DatabusMessages;\n\n\n//# sourceURL=webpack://databus-webapp/./js/utils/databus-messages.js?\n}"); -/***/ }), +/***/ }, -/***/ "./js/utils/databus-uris.js": +/***/ "./js/utils/databus-uris.js" /*!**********************************!*\ !*** ./js/utils/databus-uris.js ***! \**********************************/ -/***/ ((module) => { +(module) { -eval("\nclass DatabusUris {\n\n // JSONLD\n static JSONLD_TYPE = '@type';\n static JSONLD_ID = '@id';\n static JSONLD_VALUE = '@value';\n static JSONLD_LANGUAGE = '@language';\n static JSONLD_CONTEXT = '@context';\n static JSONLD_GRAPH = '@graph';\n\n // Databus\n static DATABUS_DATABUS = 'https://dataid.dbpedia.org/databus#Databus';\n static DATABUS_PART = 'https://dataid.dbpedia.org/databus#Part';\n static DATABUS_VERSION = 'https://dataid.dbpedia.org/databus#Version';\n static DATABUS_GROUP = 'https://dataid.dbpedia.org/databus#Group';\n static DATABUS_ACCOUNT = 'https://dataid.dbpedia.org/databus#Account';\n static DATABUS_ARTIFACT = 'https://dataid.dbpedia.org/databus#Artifact';\n static DATABUS_VERSION_PROPERTY = 'https://dataid.dbpedia.org/databus#version';\n static DATABUS_GROUP_PROPERTY = 'https://dataid.dbpedia.org/databus#group';\n static DATABUS_ACCOUNT_PROPERTY = 'https://dataid.dbpedia.org/databus#account';\n static DATABUS_HAS_ARTIFACT = 'https://dataid.dbpedia.org/databus#hasArtifact';\n static DATABUS_HAS_VERSION = 'https://dataid.dbpedia.org/databus#hasVersion';\n static DATABUS_NAME = 'https://dataid.dbpedia.org/databus#name';\n \n static DATABUS_SECRETARY_PROPERTY = 'https://dataid.dbpedia.org/databus#secretary';\n static DATABUS_SECRETARY = 'https://dataid.dbpedia.org/databus#Secretary';\n static DATABUS_HAS_WRITE_ACCESS_TO = 'https://dataid.dbpedia.org/databus#hasWriteAccessTo';\n\n static DATABUS_ARTIFACT_PROPERTY = 'https://dataid.dbpedia.org/databus#artifact';\n static DATABUS_FORMAT = 'https://dataid.dbpedia.org/databus#format';\n static DATABUS_FORMAT_EXTENSION = 'https://dataid.dbpedia.org/databus#formatExtension';\n static DATABUS_CONTENT_VARIANT = 'https://dataid.dbpedia.org/databus#contentVariant';\n static DATABUS_CONTENT_VARIANT_PREFIX = 'https://dataid.dbpedia.org/databus-cv#';\n static DATABUS_SHASUM = 'https://dataid.dbpedia.org/databus#sha256sum';\n static DATABUS_COLLECTION = 'https://dataid.dbpedia.org/databus#Collection';\n static DATABUS_FILE = 'https://dataid.dbpedia.org/databus#file';\n static DATABUS_COMPRESSION = 'https://dataid.dbpedia.org/databus#compression';\n static DATABUS_ATTRIBUTION = 'https://dataid.dbpedia.org/databus#attribution';\n static DATABUS_PREVIEW = 'https://dataid.dbpedia.org/databus#preview';\n static DATABUS_COLLECTION_CONTENT = 'https://dataid.dbpedia.org/databus#collectionContent';\n static DATABUS_TRACTATE_V1 = 'https://dataid.dbpedia.org/databus#DatabusTractateV1';\n static DATABUS_PLUGIN = 'https://dataid.dbpedia.org/databus#Plugin';\n static DATABUS_SEARCH_EXTENSION = 'https://dataid.dbpedia.org/databus#SearchExtension';\n static DATABUS_SEARCH_EXTENSION_ADAPTER = 'https://dataid.dbpedia.org/databus#searchExtensionAdapter';\n static DATABUS_SEARCH_EXTENSION_ENDPOINT = 'https://dataid.dbpedia.org/databus#searchExtensionEndpoint';\n static DATABUS_EXTENDS = 'https://dataid.dbpedia.org/databus#extends';\n \n // DCT\n static DCT_PUBLISHER = 'http://purl.org/dc/terms/publisher';\n static DCT_HAS_VERSION = 'http://purl.org/dc/terms/hasVersion';\n static DCT_ISSUED = 'http://purl.org/dc/terms/issued';\n static DCT_CREATED = 'http://purl.org/dc/terms/created';\n static DCT_MODIFIED = 'http://purl.org/dc/terms/modified';\n static DCT_DISTRIBUTION = 'http://purl.org/dc/terms/distribution';\n static DCT_SUBJECT = 'http://purl.org/dc/terms/subject';\n static DCT_CREATOR = 'http://purl.org/dc/terms/creator'\n static DCT_TITLE = 'http://purl.org/dc/terms/title'\n static DCT_ABSTRACT = 'http://purl.org/dc/terms/abstract'\n static DCT_DESCRIPTION = 'http://purl.org/dc/terms/description'\n static DCT_LICENSE = 'http://purl.org/dc/terms/license';\n\n // DCAT\n static DCAT_DOWNLOAD_URL = 'http://www.w3.org/ns/dcat#downloadURL';\n static DCAT_BYTESIZE = 'http://www.w3.org/ns/dcat#byteSize';\n static DCAT_DISTRIBUTION = 'http://www.w3.org/ns/dcat#distribution';\n\n\n // SEC\n static SEC_PROOF = 'https://w3id.org/security#proof';\n static SEC_SIGNATURE = 'https://w3id.org/security#signature';\n\n // RDF\n static RDF_PROPERTY = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#Property';\n\n // RDFS\n static RDFS_SUB_PROPERTY_OF = 'http://www.w3.org/2000/01/rdf-schema#subPropertyOf';\n static RDFS_LABEL = 'http://www.w3.org/2000/01/rdf-schema#label';\n\n // XSD\n static XSD_DATE_TIME = 'http://www.w3.org/2001/XMLSchema#dateTime';\n static XSD_DECIMAL = 'http://www.w3.org/2001/XMLSchema#decimal';\n static XSD_STRING = 'http://www.w3.org/2001/XMLSchema#string';\n\n // SHACL\n static SHACL_VALIDATION_REPORT = 'http://www.w3.org/ns/shacl#ValidationReport';\n static SHACL_VALIDATION_RESULT = 'http://www.w3.org/ns/shacl#ValidationResult';\n static SHACL_CONFORMS = 'http://www.w3.org/ns/shacl#conforms';\n static SHACL_RESULT_MESSAGE = 'http://www.w3.org/ns/shacl#resultMessage';\n\n // FOAF\n static FOAF_PERSONAL_PROFILE_DOCUMENT = 'http://xmlns.com/foaf/0.1/PersonalProfileDocument';\n static FOAF_ACCOUNT = 'http://xmlns.com/foaf/0.1/account';\n static FOAF_NAME = 'http://xmlns.com/foaf/0.1/name';\n static FOAF_STATUS = 'http://xmlns.com/foaf/0.1/status';\n static FOAF_PERSON = 'http://xmlns.com/foaf/0.1/Person';\n static FOAF_PRIMARY_TOPIC = 'http://xmlns.com/foaf/0.1/primaryTopic';\n static FOAF_MAKER = 'http://xmlns.com/foaf/0.1/maker';\n static FOAF_ACCOUNT_NAME = 'http://xmlns.com/foaf/0.1/accountName';\n static FOAF_IMG = 'http://xmlns.com/foaf/0.1/img';\n\n // S4AC\n static S4AC_ACCESS_POLICY = 'http://ns.inria.fr/s4ac/v2#AccessPolicy';\n static S4AC_ACCESS_CREATE = 'http://ns.inria.fr/s4ac/v2#Create';\n static S4AC_HAS_ACCESS_PRIVILEGE = 'http://ns.inria.fr/s4ac/v2#hasAccessPrivilege';\n\n // CERT\n static CERT_KEY = 'http://www.w3.org/ns/auth/cert#key';\n static CERT_MODULUS = 'http://www.w3.org/ns/auth/cert#modulus';\n static CERT_EXPONENT = 'http://www.w3.org/ns/auth/cert#exponent';\n static CERT_RSA_PUBLIC_KEY = 'http://www.w3.org/ns/auth/cert#RSAPublicKey';\n\n // PROV\n static PROV_WAS_DERIVED_FROM = 'http://www.w3.org/ns/prov-o#wasDerivedFrom';\n\n // DBP\n static DBP_DBPEDIAN = 'http://dbpedia.org/ontology/DBpedian';\n}\n\nmodule.exports = DatabusUris;\n\n\n//# sourceURL=webpack://databus-webapp/./js/utils/databus-uris.js?"); +eval("{\nclass DatabusUris {\n\n // JSONLD\n static JSONLD_TYPE = '@type';\n static JSONLD_ID = '@id';\n static JSONLD_VALUE = '@value';\n static JSONLD_LANGUAGE = '@language';\n static JSONLD_CONTEXT = '@context';\n static JSONLD_GRAPH = '@graph';\n\n // Databus\n static DATABUS_DATABUS = 'https://dataid.dbpedia.org/databus#Databus';\n static DATABUS_PART = 'https://dataid.dbpedia.org/databus#Part';\n static DATABUS_VERSION = 'https://dataid.dbpedia.org/databus#Version';\n static DATABUS_GROUP = 'https://dataid.dbpedia.org/databus#Group';\n static DATABUS_ACCOUNT = 'https://dataid.dbpedia.org/databus#Account';\n static DATABUS_ARTIFACT = 'https://dataid.dbpedia.org/databus#Artifact';\n static DATABUS_VERSION_PROPERTY = 'https://dataid.dbpedia.org/databus#version';\n static DATABUS_GROUP_PROPERTY = 'https://dataid.dbpedia.org/databus#group';\n static DATABUS_ACCOUNT_PROPERTY = 'https://dataid.dbpedia.org/databus#account';\n static DATABUS_HAS_ARTIFACT = 'https://dataid.dbpedia.org/databus#hasArtifact';\n static DATABUS_HAS_VERSION = 'https://dataid.dbpedia.org/databus#hasVersion';\n static DATABUS_NAME = 'https://dataid.dbpedia.org/databus#name';\n \n static DATABUS_SECRETARY_PROPERTY = 'https://dataid.dbpedia.org/databus#secretary';\n static DATABUS_SECRETARY = 'https://dataid.dbpedia.org/databus#Secretary';\n static DATABUS_HAS_WRITE_ACCESS_TO = 'https://dataid.dbpedia.org/databus#hasWriteAccessTo';\n\n static DATABUS_ARTIFACT_PROPERTY = 'https://dataid.dbpedia.org/databus#artifact';\n static DATABUS_FORMAT = 'https://dataid.dbpedia.org/databus#format';\n static DATABUS_FORMAT_EXTENSION = 'https://dataid.dbpedia.org/databus#formatExtension';\n static DATABUS_CONTENT_VARIANT = 'https://dataid.dbpedia.org/databus#contentVariant';\n static DATABUS_CONTENT_VARIANT_PREFIX = 'https://dataid.dbpedia.org/databus-cv#';\n static DATABUS_SHASUM = 'https://dataid.dbpedia.org/databus#sha256sum';\n static DATABUS_COLLECTION = 'https://dataid.dbpedia.org/databus#Collection';\n static DATABUS_FILE = 'https://dataid.dbpedia.org/databus#file';\n static DATABUS_COMPRESSION = 'https://dataid.dbpedia.org/databus#compression';\n static DATABUS_ATTRIBUTION = 'https://dataid.dbpedia.org/databus#attribution';\n static DATABUS_PREVIEW = 'https://dataid.dbpedia.org/databus#preview';\n static DATABUS_COLLECTION_CONTENT = 'https://dataid.dbpedia.org/databus#collectionContent';\n static DATABUS_TRACTATE_V1 = 'https://dataid.dbpedia.org/databus#DatabusTractateV1';\n static DATABUS_PLUGIN = 'https://dataid.dbpedia.org/databus#Plugin';\n static DATABUS_SEARCH_EXTENSION = 'https://dataid.dbpedia.org/databus#SearchExtension';\n static DATABUS_SEARCH_EXTENSION_ADAPTER = 'https://dataid.dbpedia.org/databus#searchExtensionAdapter';\n static DATABUS_SEARCH_EXTENSION_ENDPOINT = 'https://dataid.dbpedia.org/databus#searchExtensionEndpoint';\n static DATABUS_EXTENDS = 'https://dataid.dbpedia.org/databus#extends';\n \n // DCT\n static DCT_PUBLISHER = 'http://purl.org/dc/terms/publisher';\n static DCT_HAS_VERSION = 'http://purl.org/dc/terms/hasVersion';\n static DCT_ISSUED = 'http://purl.org/dc/terms/issued';\n static DCT_CREATED = 'http://purl.org/dc/terms/created';\n static DCT_MODIFIED = 'http://purl.org/dc/terms/modified';\n static DCT_DISTRIBUTION = 'http://purl.org/dc/terms/distribution';\n static DCT_SUBJECT = 'http://purl.org/dc/terms/subject';\n static DCT_CREATOR = 'http://purl.org/dc/terms/creator'\n static DCT_TITLE = 'http://purl.org/dc/terms/title'\n static DCT_ABSTRACT = 'http://purl.org/dc/terms/abstract'\n static DCT_DESCRIPTION = 'http://purl.org/dc/terms/description'\n static DCT_LICENSE = 'http://purl.org/dc/terms/license';\n\n // DCAT\n static DCAT_DOWNLOAD_URL = 'http://www.w3.org/ns/dcat#downloadURL';\n static DCAT_BYTESIZE = 'http://www.w3.org/ns/dcat#byteSize';\n static DCAT_DISTRIBUTION = 'http://www.w3.org/ns/dcat#distribution';\n\n\n // SEC\n static SEC_PROOF = 'https://w3id.org/security#proof';\n static SEC_SIGNATURE = 'https://w3id.org/security#signature';\n\n // RDF\n static RDF_PROPERTY = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#Property';\n\n // RDFS\n static RDFS_SUB_PROPERTY_OF = 'http://www.w3.org/2000/01/rdf-schema#subPropertyOf';\n static RDFS_LABEL = 'http://www.w3.org/2000/01/rdf-schema#label';\n\n // XSD\n static XSD_DATE_TIME = 'http://www.w3.org/2001/XMLSchema#dateTime';\n static XSD_DECIMAL = 'http://www.w3.org/2001/XMLSchema#decimal';\n static XSD_STRING = 'http://www.w3.org/2001/XMLSchema#string';\n\n // SHACL\n static SHACL_VALIDATION_REPORT = 'http://www.w3.org/ns/shacl#ValidationReport';\n static SHACL_VALIDATION_RESULT = 'http://www.w3.org/ns/shacl#ValidationResult';\n static SHACL_CONFORMS = 'http://www.w3.org/ns/shacl#conforms';\n static SHACL_RESULT_MESSAGE = 'http://www.w3.org/ns/shacl#resultMessage';\n\n // FOAF\n static FOAF_PERSONAL_PROFILE_DOCUMENT = 'http://xmlns.com/foaf/0.1/PersonalProfileDocument';\n static FOAF_ACCOUNT = 'http://xmlns.com/foaf/0.1/account';\n static FOAF_NAME = 'http://xmlns.com/foaf/0.1/name';\n static FOAF_STATUS = 'http://xmlns.com/foaf/0.1/status';\n static FOAF_PERSON = 'http://xmlns.com/foaf/0.1/Person';\n static FOAF_PRIMARY_TOPIC = 'http://xmlns.com/foaf/0.1/primaryTopic';\n static FOAF_MAKER = 'http://xmlns.com/foaf/0.1/maker';\n static FOAF_ACCOUNT_NAME = 'http://xmlns.com/foaf/0.1/accountName';\n static FOAF_IMG = 'http://xmlns.com/foaf/0.1/img';\n\n // S4AC\n static S4AC_ACCESS_POLICY = 'http://ns.inria.fr/s4ac/v2#AccessPolicy';\n static S4AC_ACCESS_CREATE = 'http://ns.inria.fr/s4ac/v2#Create';\n static S4AC_HAS_ACCESS_PRIVILEGE = 'http://ns.inria.fr/s4ac/v2#hasAccessPrivilege';\n\n // CERT\n static CERT_KEY = 'http://www.w3.org/ns/auth/cert#key';\n static CERT_MODULUS = 'http://www.w3.org/ns/auth/cert#modulus';\n static CERT_EXPONENT = 'http://www.w3.org/ns/auth/cert#exponent';\n static CERT_RSA_PUBLIC_KEY = 'http://www.w3.org/ns/auth/cert#RSAPublicKey';\n\n // PROV\n static PROV_WAS_DERIVED_FROM = 'http://www.w3.org/ns/prov-o#wasDerivedFrom';\n\n // DBP\n static DBP_DBPEDIAN = 'http://dbpedia.org/ontology/DBpedian';\n}\n\nmodule.exports = DatabusUris;\n\n\n//# sourceURL=webpack://databus-webapp/./js/utils/databus-uris.js?\n}"); -/***/ }), +/***/ }, -/***/ "./js/utils/databus-utils.js": +/***/ "./js/utils/databus-utils.js" /*!***********************************!*\ !*** ./js/utils/databus-utils.js ***! \***********************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +(module, __unused_webpack_exports, __webpack_require__) { -eval("const DatabusCollectionUtils = __webpack_require__(/*! ../collections/databus-collection-utils */ \"./js/collections/databus-collection-utils.js\");\nvar markdownit = __webpack_require__(/*! markdown-it */ \"markdown-it\");\nconst moment = __webpack_require__(/*! moment/moment */ \"moment/moment\");\nconst DatabusUris = __webpack_require__(/*! ./databus-uris */ \"./js/utils/databus-uris.js\");\nconst ApiError = __webpack_require__(/*! ../../../server/app/common/utils/api-error */ \"../server/app/common/utils/api-error.js\");\n\nclass DatabusUtils {\n\n static stringOrFallback(value, fallback) {\n if (value != null && value.length > 0) {\n return value;\n }\n\n return fallback;\n }\n\n static resemblesTrue(value) {\n if (typeof value === 'boolean') {\n return value;\n }\n\n if (typeof value === 'string') {\n const normalized = value.trim().toLowerCase();\n return ['true', '1', 'yes', 'on'].includes(normalized);\n }\n\n if (typeof value === 'number') {\n return value === 1;\n }\n\n return false;\n }\n\n static isValidResourceIdentifier(identifier, min) {\n var identifierRegex = /^[a-z-]+$/;\n return this.checkField(identifier, identifierRegex, min, 50);\n }\n\n static formatQuery(query, placeholderMappings) {\n\n if (placeholderMappings == undefined) {\n return query;\n }\n\n for (var placeholder in placeholderMappings) {\n var re = new RegExp('%' + placeholder + '%', \"g\");\n query = query.replace(re, placeholderMappings[placeholder]);\n }\n\n return query;\n }\n\n static isValidVersionIdentifier(identifier) {\n var labelRegex = /^[A-Za-z0-9_\\.\\-]*$/;\n return this.checkField(identifier, labelRegex, 3, 50);\n }\n\n static isValidResourceText(value, min, max) {\n var textRegex = /^[\\x00-\\x7F\\n]*$/;\n return this.checkField(value, textRegex, min, max);\n }\n\n static isValidAccountName(identifier) {\n var labelRegex = /^[a-z][0-9a-z_\\-]+[0-9a-z]$/;\n return this.checkField(identifier, labelRegex, 3, 15);\n }\n\n static timeStringNow() {\n return new Date(Date.now()).toISOString();\n }\n\n static isValidGroupName(name) {\n var labelRegex = /[a-zA-Z0-9_\\-\\.]{3,50}$/;\n return this.checkField(name, labelRegex, 3, 50);\n }\n\n static isValidArtifactName(name) {\n var labelRegex = /[a-zA-Z0-9_\\-\\.]{3,50}$/;\n return this.checkField(name, labelRegex, 3, 50);\n }\n\n static isValidUrl(value) {\n var textRegex = /https?:\\/\\/(www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{1,256}\\.[a-zA-Z0-9()]{1,6}\\b([-a-zA-Z0-9()@:%_\\+.~#?&//=]*)/g;\n return textRegex.test(value);\n }\n\n static isValidResourceLabel(value, min, max) {\n var labelRegex = /^[A-Za-z0-9\\s_()\\.\\,\\-]*$/;\n return this.checkField(value, labelRegex, min, max);\n }\n\n static objSize(obj) {\n var size = 0, key;\n for (key in obj) {\n if (obj.hasOwnProperty(key)) size++;\n }\n return size;\n }\n\n static uniqueList(arr) {\n var u = {}, a = [];\n for (var i = 0, l = arr.length; i < l; ++i) {\n if (!u.hasOwnProperty(arr[i])) {\n a.push(arr[i]);\n u[arr[i]] = 1;\n }\n }\n return a;\n }\n\n\n static formatFileSize(size) {\n if (size == undefined) {\n return '0 KB'\n }\n\n if (size < 1024) return size + \" B\";\n else if (size < 1048576) return Math.round(size / 1024) + \" KB\";\n else if (size < 1073741824) return (Math.round(10 * size / 1048576) / 10) + \" MB\";\n else return (Math.round(100 * size / 1073741824) / 100) + \" GB\";\n };\n\n static checkField(value, regex, min, max) {\n if (value == undefined) {\n return false;\n }\n\n if (max > 0 && value.length > max) {\n return false;\n }\n\n if (value.length < min) {\n return false;\n }\n\n return regex.test(value);\n }\n\n // Creates a v4 uuid\n static uuidv4() {\n return '___xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {\n var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);\n return v.toString(16);\n });\n }\n\n static tryParseJson(str) {\n return JSON.parse(str);\n }\n\n static uriToTitle(uri) {\n if (uri == null) {\n return null;\n }\n\n var result = uri.substr(uri.lastIndexOf('/') + 1);\n result = result.substr(result.lastIndexOf('#') + 1);\n\n return result.charAt(0).toUpperCase() + result.slice(1);\n }\n\n static uriToName(uri) {\n if (uri == null) {\n return null;\n }\n\n var result = uri.substr(uri.lastIndexOf('/') + 1);\n result = result.substr(result.lastIndexOf('#') + 1);\n\n if (result.includes('.')) {\n result = result.substr(0, result.lastIndexOf('.'));\n }\n\n return result;\n }\n\n static uriToResourceName(uri) {\n if (uri == null) {\n return null;\n }\n\n var result = uri.substr(uri.lastIndexOf('/') + 1);\n\n if (result.includes('#')) {\n result = result.substr(0, result.indexOf('#'));\n }\n\n return result;\n }\n\n static isValidHttpUrl(string) {\n let url;\n\n try {\n url = new URL(string);\n } catch (_) {\n return false;\n }\n\n return url.protocol === \"http:\" || url.protocol === \"https:\";\n }\n\n static isValidHttpsUrl(string) {\n let url;\n\n try {\n url = new URL(string);\n } catch (_) {\n return false;\n }\n\n return url.protocol === \"https:\";\n }\n\n\n static navigateUp(uri, steps) {\n\n if (steps == undefined) {\n steps = 1;\n }\n\n for (var i = 0; i < steps; i++) {\n uri = uri.substr(0, uri.lastIndexOf('/'));\n }\n\n if (uri.includes('#')) {\n uri = uri.substr(0, uri.lastIndexOf('#'));\n }\n\n return uri;\n }\n\n static copyStringToClipboard(str) {\n // Create new element\n var el = document.createElement('textarea');\n // Set value (string to be copied)\n el.value = str;\n // Set non-editable to avoid focus and move outside of view\n el.setAttribute('readonly', '');\n el.style = { position: 'absolute', left: '-9999px' };\n document.body.appendChild(el);\n // Select text inside element\n el.select();\n // Copy text to clipboard\n document.execCommand('copy');\n // Remove temporary element\n document.body.removeChild(el);\n }\n\n static serialize(collectionObject, ignoreKeys) {\n\n if (ignoreKeys == undefined) {\n ignoreKeys = [\n 'parent',\n '$$hashKey',\n 'expanded',\n 'files',\n 'eventListeners',\n 'hasLocalChanges',\n 'published'\n ];\n }\n\n return JSON.stringify(collectionObject, function (key, value) {\n if (ignoreKeys.includes(key)) {\n return undefined;\n }\n\n return value;\n });\n }\n\n static createCleanCopy(jsonData) {\n var data = JSON.parse(DatabusCollectionUtils.serialize(jsonData));\n return data;\n }\n\n static lineCount(text) {\n return (text.match(/^\\s*\\S/gm) || \"\").length\n }\n\n\n static getResourcePathLength(uri) {\n var parts = DatabusUtils.splitResourceUri(uri);\n\n if (parts.length == 1 && parts[0] == \"\") {\n return 0;\n }\n\n return parts.length;\n }\n\n static splitResourceUri(uri) {\n\n var url = new URL(uri);\n uri = url.pathname;\n\n if (uri.startsWith('/')) {\n uri = uri.substr(1);\n }\n if (uri.endsWith('/')) {\n uri = uri.substr(0, uri.length - 1);\n }\n\n return uri.split('/');\n }\n\n static formatDate(date) {\n return moment(date).format('MMM Do YYYY') + \" (\" + moment(date).fromNow() + \")\";\n }\n\n static exportToJsonFile(jsonData) {\n\n var ignoreKeys = [\n 'parent',\n '$$hashKey',\n 'expanded',\n 'files',\n 'eventListeners',\n 'hasLocalChanges',\n 'published',\n 'uuid'\n ];\n\n let dataStr = DatabusCollectionUtils.serialize(jsonData, ignoreKeys);\n let dataUri = 'data:application/json;charset=utf-8,' + encodeURIComponent(dataStr);\n\n let exportFileDefaultName = 'data.json';\n\n let linkElement = document.createElement('a');\n linkElement.setAttribute('href', dataUri);\n linkElement.setAttribute('download', exportFileDefaultName);\n linkElement.click();\n }\n\n static async parseN3(data, maxQuads) {\n return new Promise((resolve, reject) => {\n\n const quads = [];\n const prefixes = [];\n\n const parser = new N3.Parser();\n\n parser.parse(data, (e, q, p) => {\n if (e) {\n reject(e);\n return;\n }\n\n if (quads.length > maxQuads || q == null) {\n resolve({ quads: quads, prefixes: prefixes });\n }\n\n if (q) {\n quads.push(q);\n }\n });\n });\n }\n\n static async parseDatabusManifest(data) {\n\n var parsedData = await DatabusUtils.parseN3(data, 100);\n\n for (var quad of parsedData.quads) {\n\n if (quad.predicate.id == `http://www.w3.org/1999/02/22-rdf-syntax-ns#type`\n && quad.object.id == DatabusUris.DATABUS_DATABUS) {\n\n return {\n uri: quad.subject.id\n }\n }\n }\n\n return undefined;\n }\n\n static getFirstSegment(uri) {\n try {\n const url = new URL(uri);\n return url.pathname.split('/').filter(Boolean)[0] || null;\n } catch {\n return null;\n }\n }\n\n static parseMarkdown(markdown) {\n\n if (markdown == null) {\n return null;\n }\n\n var markdownParser = markdownit();\n return markdownParser.parse(markdown);\n }\n\n static renderMarkdown(markdown) {\n\n if (markdown == null) {\n return null;\n }\n\n var markdownParser = markdownit();\n return markdownParser.render(markdown);\n }\n\n /**\n * Create a dct:abstract from the content of a dct:description\n * @param {*} description \n */\n static createAbstractFromDescription(description) {\n\n if (description == null) {\n return null;\n }\n\n try {\n var tokens = this.parseMarkdown(description);\n\n\n var paragraphFound = false;\n var result = \"\";\n\n if (tokens == null) {\n return result;\n }\n\n var firstParagraphText = null;\n\n for (var i = 0; i < tokens.length; i++) {\n\n var token = tokens[i];\n var appendText = null;\n\n if (token.type == 'inline' && tokens[i - 1].type == 'paragraph_open' && token.level == 1) {\n result = token.content;\n break;\n }\n\n }\n\n return result;\n\n } catch (err) {\n console.log(err);\n return undefined;\n }\n }\n\n /**\n * Find groups files that are not distinguishable\n * @param {Array of file URIs} files \n * @param {Array of content variant names} contentVariants \n * @param {Index in the array of content variants} index \n * @returns \n */\n static cvSplit(distributionGraphs, contentVariantUris, contentVariantIndex) {\n\n var errorList = [];\n\n if (distributionGraphs.length <= 1) {\n return errorList;\n }\n\n if (contentVariantIndex >= contentVariantUris.length) {\n\n // Check buckets for double entries if (files.length > 1) {\n if (distributionGraphs.length > 1) {\n\n var error = {};\n error.downloadURLs = [];\n\n for (var distribution of distributionGraphs) {\n\n error.downloadURLs.push(distribution[DatabusUris.DCAT_DOWNLOAD_URL][0][DatabusUris.JSONLD_ID]);\n }\n\n error[DatabusUris.DATABUS_FORMAT_EXTENSION] =\n distributionGraphs[0][DatabusUris.DATABUS_FORMAT_EXTENSION][0][DatabusUris.JSONLD_VALUE];\n\n error[DatabusUris.DATABUS_COMPRESSION] =\n distributionGraphs[0][DatabusUris.DATABUS_COMPRESSION][0][DatabusUris.JSONLD_VALUE];\n\n for (var contentVariantUri of contentVariantUris) {\n error[contentVariantUri] = distributionGraphs[0][contentVariantUri] != null ?\n distributionGraphs[0][contentVariantUri][0][DatabusUris.JSONLD_VALUE] : 'none'\n }\n\n errorList.push(error);\n }\n } else {\n\n var contentVariantUri = contentVariantUris[contentVariantIndex];\n\n // else create buckets and sort files into buckets\n var buckets = {};\n\n for (var distribution of distributionGraphs) {\n\n var variantValue = distribution[contentVariantUri];\n\n if (variantValue != undefined) {\n variantValue = variantValue[0]['@value'];\n }\n\n if (variantValue == undefined || variantValue == '') {\n variantValue = '$_none$';\n }\n\n if (buckets[variantValue] == undefined) {\n buckets[variantValue] = [];\n }\n\n buckets[variantValue].push(distribution);\n }\n\n\n // iterate buckets and call recursively\n for (var b in buckets) {\n\n for (var error of DatabusUtils.cvSplit(buckets[b],\n contentVariantUris, contentVariantIndex + 1, errorList)) {\n errorList.push(error);\n }\n }\n }\n\n return errorList;\n }\n\n}\n\nmodule.exports = DatabusUtils;\n\n\n//# sourceURL=webpack://databus-webapp/./js/utils/databus-utils.js?"); +eval("{const DatabusCollectionUtils = __webpack_require__(/*! ../collections/databus-collection-utils */ \"./js/collections/databus-collection-utils.js\");\nvar markdownit = __webpack_require__(/*! markdown-it */ \"markdown-it\");\nconst moment = __webpack_require__(/*! moment/moment */ \"moment/moment\");\nconst DatabusUris = __webpack_require__(/*! ./databus-uris */ \"./js/utils/databus-uris.js\");\nconst ApiError = __webpack_require__(/*! ../../../server/app/common/utils/api-error */ \"../server/app/common/utils/api-error.js\");\n\nclass DatabusUtils {\n\n static stringOrFallback(value, fallback) {\n if (value != null && value.length > 0) {\n return value;\n }\n\n return fallback;\n }\n\n static resemblesTrue(value) {\n if (typeof value === 'boolean') {\n return value;\n }\n\n if (typeof value === 'string') {\n const normalized = value.trim().toLowerCase();\n return ['true', '1', 'yes', 'on'].includes(normalized);\n }\n\n if (typeof value === 'number') {\n return value === 1;\n }\n\n return false;\n }\n\n static isValidResourceIdentifier(identifier, min) {\n var identifierRegex = /^[a-z-]+$/;\n return this.checkField(identifier, identifierRegex, min, 50);\n }\n\n static formatQuery(query, placeholderMappings) {\n\n if (placeholderMappings == undefined) {\n return query;\n }\n\n for (var placeholder in placeholderMappings) {\n var re = new RegExp('%' + placeholder + '%', \"g\");\n query = query.replace(re, placeholderMappings[placeholder]);\n }\n\n return query;\n }\n\n static isValidVersionIdentifier(identifier) {\n var labelRegex = /^[A-Za-z0-9_\\.\\-]*$/;\n return this.checkField(identifier, labelRegex, 3, 50);\n }\n\n static isValidResourceText(value, min, max) {\n var textRegex = /^[\\x00-\\x7F\\n]*$/;\n return this.checkField(value, textRegex, min, max);\n }\n\n static isValidAccountName(identifier) {\n var labelRegex = /^[a-z][0-9a-z_\\-]+[0-9a-z]$/;\n return this.checkField(identifier, labelRegex, 3, 15);\n }\n\n static timeStringNow() {\n return new Date(Date.now()).toISOString();\n }\n\n static isValidGroupName(name) {\n var labelRegex = /[a-zA-Z0-9_\\-\\.]{3,50}$/;\n return this.checkField(name, labelRegex, 3, 50);\n }\n\n static isValidArtifactName(name) {\n var labelRegex = /[a-zA-Z0-9_\\-\\.]{3,50}$/;\n return this.checkField(name, labelRegex, 3, 50);\n }\n\n static isValidUrl(value) {\n var textRegex = /https?:\\/\\/(www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{1,256}\\.[a-zA-Z0-9()]{1,6}\\b([-a-zA-Z0-9()@:%_\\+.~#?&//=]*)/g;\n return textRegex.test(value);\n }\n\n static isValidResourceLabel(value, min, max) {\n var labelRegex = /^[A-Za-z0-9\\s_()\\.\\,\\-]*$/;\n return this.checkField(value, labelRegex, min, max);\n }\n\n static objSize(obj) {\n var size = 0, key;\n for (key in obj) {\n if (obj.hasOwnProperty(key)) size++;\n }\n return size;\n }\n\n static uniqueList(arr) {\n var u = {}, a = [];\n for (var i = 0, l = arr.length; i < l; ++i) {\n if (!u.hasOwnProperty(arr[i])) {\n a.push(arr[i]);\n u[arr[i]] = 1;\n }\n }\n return a;\n }\n\n\n static formatFileSize(size) {\n if (size == undefined) {\n return '0 KiB'\n }\n\n if (size < 1024) return size + \" B\";\n else if (size < 1048576) return Math.round(size / 1024) + \" KiB\";\n else if (size < 1073741824) return (Math.round(10 * size / 1048576) / 10) + \" MiB\";\n else return (Math.round(100 * size / 1073741824) / 100) + \" GiB\";\n };\n\n static checkField(value, regex, min, max) {\n if (value == undefined) {\n return false;\n }\n\n if (max > 0 && value.length > max) {\n return false;\n }\n\n if (value.length < min) {\n return false;\n }\n\n return regex.test(value);\n }\n\n // Creates a v4 uuid\n static uuidv4() {\n return '___xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {\n var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);\n return v.toString(16);\n });\n }\n\n static tryParseJson(str) {\n return JSON.parse(str);\n }\n\n static uriToTitle(uri) {\n if (uri == null) {\n return null;\n }\n\n var result = uri.substr(uri.lastIndexOf('/') + 1);\n result = result.substr(result.lastIndexOf('#') + 1);\n\n return result.charAt(0).toUpperCase() + result.slice(1);\n }\n\n static uriToName(uri) {\n if (uri == null) {\n return null;\n }\n\n var result = uri.substr(uri.lastIndexOf('/') + 1);\n result = result.substr(result.lastIndexOf('#') + 1);\n\n if (result.includes('.')) {\n result = result.substr(0, result.lastIndexOf('.'));\n }\n\n return result;\n }\n\n static uriToResourceName(uri) {\n if (uri == null) {\n return null;\n }\n\n var result = uri.substr(uri.lastIndexOf('/') + 1);\n\n if (result.includes('#')) {\n result = result.substr(0, result.indexOf('#'));\n }\n\n return result;\n }\n\n static isValidHttpUrl(string) {\n let url;\n\n try {\n url = new URL(string);\n } catch (_) {\n return false;\n }\n\n return url.protocol === \"http:\" || url.protocol === \"https:\";\n }\n\n static isValidHttpsUrl(string) {\n let url;\n\n try {\n url = new URL(string);\n } catch (_) {\n return false;\n }\n\n return url.protocol === \"https:\";\n }\n\n\n static navigateUp(uri, steps) {\n\n if (steps == undefined) {\n steps = 1;\n }\n\n for (var i = 0; i < steps; i++) {\n uri = uri.substr(0, uri.lastIndexOf('/'));\n }\n\n if (uri.includes('#')) {\n uri = uri.substr(0, uri.lastIndexOf('#'));\n }\n\n return uri;\n }\n\n static copyStringToClipboard(str) {\n // Create new element\n var el = document.createElement('textarea');\n // Set value (string to be copied)\n el.value = str;\n // Set non-editable to avoid focus and move outside of view\n el.setAttribute('readonly', '');\n el.style = { position: 'absolute', left: '-9999px' };\n document.body.appendChild(el);\n // Select text inside element\n el.select();\n // Copy text to clipboard\n document.execCommand('copy');\n // Remove temporary element\n document.body.removeChild(el);\n }\n\n static serialize(collectionObject, ignoreKeys) {\n\n if (ignoreKeys == undefined) {\n ignoreKeys = [\n 'parent',\n '$$hashKey',\n 'expanded',\n 'files',\n 'eventListeners',\n 'hasLocalChanges',\n 'published'\n ];\n }\n\n return JSON.stringify(collectionObject, function (key, value) {\n if (ignoreKeys.includes(key)) {\n return undefined;\n }\n\n return value;\n });\n }\n\n static createCleanCopy(jsonData) {\n var data = JSON.parse(DatabusCollectionUtils.serialize(jsonData));\n return data;\n }\n\n static lineCount(text) {\n return (text.match(/^\\s*\\S/gm) || \"\").length\n }\n\n\n static getResourcePathLength(uri) {\n var parts = DatabusUtils.splitResourceUri(uri);\n\n if (parts.length == 1 && parts[0] == \"\") {\n return 0;\n }\n\n return parts.length;\n }\n\n static splitResourceUri(uri) {\n\n var url = new URL(uri);\n uri = url.pathname;\n\n if (uri.startsWith('/')) {\n uri = uri.substr(1);\n }\n if (uri.endsWith('/')) {\n uri = uri.substr(0, uri.length - 1);\n }\n\n return uri.split('/');\n }\n\n static formatDate(date) {\n return moment(date).format('MMM Do YYYY') + \" (\" + moment(date).fromNow() + \")\";\n }\n\n static exportToJsonFile(jsonData) {\n\n var ignoreKeys = [\n 'parent',\n '$$hashKey',\n 'expanded',\n 'files',\n 'eventListeners',\n 'hasLocalChanges',\n 'published',\n 'uuid'\n ];\n\n let dataStr = DatabusCollectionUtils.serialize(jsonData, ignoreKeys);\n let dataUri = 'data:application/json;charset=utf-8,' + encodeURIComponent(dataStr);\n\n let exportFileDefaultName = 'data.json';\n\n let linkElement = document.createElement('a');\n linkElement.setAttribute('href', dataUri);\n linkElement.setAttribute('download', exportFileDefaultName);\n linkElement.click();\n }\n\n static async parseN3(data, maxQuads) {\n return new Promise((resolve, reject) => {\n\n const quads = [];\n const prefixes = [];\n\n const parser = new N3.Parser();\n\n parser.parse(data, (e, q, p) => {\n if (e) {\n reject(e);\n return;\n }\n\n if (quads.length > maxQuads || q == null) {\n resolve({ quads: quads, prefixes: prefixes });\n }\n\n if (q) {\n quads.push(q);\n }\n });\n });\n }\n\n static async parseDatabusManifest(data) {\n\n var parsedData = await DatabusUtils.parseN3(data, 100);\n\n for (var quad of parsedData.quads) {\n\n if (quad.predicate.id == `http://www.w3.org/1999/02/22-rdf-syntax-ns#type`\n && quad.object.id == DatabusUris.DATABUS_DATABUS) {\n\n return {\n uri: quad.subject.id\n }\n }\n }\n\n return undefined;\n }\n\n static getFirstSegment(uri) {\n try {\n const url = new URL(uri);\n return url.pathname.split('/').filter(Boolean)[0] || null;\n } catch {\n return null;\n }\n }\n\n static parseMarkdown(markdown) {\n\n if (markdown == null) {\n return null;\n }\n\n var markdownParser = markdownit();\n return markdownParser.parse(markdown);\n }\n\n static renderMarkdown(markdown) {\n\n if (markdown == null) {\n return null;\n }\n\n var markdownParser = markdownit();\n return markdownParser.render(markdown);\n }\n\n /**\n * Create a dct:abstract from the content of a dct:description\n * @param {*} description \n */\n static createAbstractFromDescription(description) {\n\n if (description == null) {\n return null;\n }\n\n try {\n var tokens = this.parseMarkdown(description);\n\n\n var paragraphFound = false;\n var result = \"\";\n\n if (tokens == null) {\n return result;\n }\n\n var firstParagraphText = null;\n\n for (var i = 0; i < tokens.length; i++) {\n\n var token = tokens[i];\n var appendText = null;\n\n if (token.type == 'inline' && tokens[i - 1].type == 'paragraph_open' && token.level == 1) {\n result = token.content;\n break;\n }\n\n }\n\n return result;\n\n } catch (err) {\n console.log(err);\n return undefined;\n }\n }\n\n /**\n * Find groups files that are not distinguishable\n * @param {Array of file URIs} files \n * @param {Array of content variant names} contentVariants \n * @param {Index in the array of content variants} index \n * @returns \n */\n static cvSplit(distributionGraphs, contentVariantUris, contentVariantIndex) {\n\n var errorList = [];\n\n if (distributionGraphs.length <= 1) {\n return errorList;\n }\n\n if (contentVariantIndex >= contentVariantUris.length) {\n\n // Check buckets for double entries if (files.length > 1) {\n if (distributionGraphs.length > 1) {\n\n var error = {};\n error.downloadURLs = [];\n\n for (var distribution of distributionGraphs) {\n\n error.downloadURLs.push(distribution[DatabusUris.DCAT_DOWNLOAD_URL][0][DatabusUris.JSONLD_ID]);\n }\n\n error[DatabusUris.DATABUS_FORMAT_EXTENSION] =\n distributionGraphs[0][DatabusUris.DATABUS_FORMAT_EXTENSION][0][DatabusUris.JSONLD_VALUE];\n\n error[DatabusUris.DATABUS_COMPRESSION] =\n distributionGraphs[0][DatabusUris.DATABUS_COMPRESSION][0][DatabusUris.JSONLD_VALUE];\n\n for (var contentVariantUri of contentVariantUris) {\n error[contentVariantUri] = distributionGraphs[0][contentVariantUri] != null ?\n distributionGraphs[0][contentVariantUri][0][DatabusUris.JSONLD_VALUE] : 'none'\n }\n\n errorList.push(error);\n }\n } else {\n\n var contentVariantUri = contentVariantUris[contentVariantIndex];\n\n // else create buckets and sort files into buckets\n var buckets = {};\n\n for (var distribution of distributionGraphs) {\n\n var variantValue = distribution[contentVariantUri];\n\n if (variantValue != undefined) {\n variantValue = variantValue[0]['@value'];\n }\n\n if (variantValue == undefined || variantValue == '') {\n variantValue = '$_none$';\n }\n\n if (buckets[variantValue] == undefined) {\n buckets[variantValue] = [];\n }\n\n buckets[variantValue].push(distribution);\n }\n\n\n // iterate buckets and call recursively\n for (var b in buckets) {\n\n for (var error of DatabusUtils.cvSplit(buckets[b],\n contentVariantUris, contentVariantIndex + 1, errorList)) {\n errorList.push(error);\n }\n }\n }\n\n return errorList;\n }\n\n}\n\nmodule.exports = DatabusUtils;\n\n\n//# sourceURL=webpack://databus-webapp/./js/utils/databus-utils.js?\n}"); -/***/ }), +/***/ }, -/***/ "./js/utils/databus-webapp-utils.js": +/***/ "./js/utils/databus-webapp-utils.js" /*!******************************************!*\ !*** ./js/utils/databus-webapp-utils.js ***! \******************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +(module, __unused_webpack_exports, __webpack_require__) { -eval("const DatabusAlert = __webpack_require__(/*! ../components/databus-alert/databus-alert */ \"./js/components/databus-alert/databus-alert.js\");\nconst DatabusUtils = __webpack_require__(/*! ../utils/databus-utils */ \"./js/utils/databus-utils.js\");\nconst DatabusMessages = __webpack_require__(/*! ./databus-messages */ \"./js/utils/databus-messages.js\");\n\nclass DatabusWebappUtils {\n\n constructor($scope, $sce) {\n this.scope = $scope;\n this.sce = $sce;\n }\n\n goTo(page) {\n window.location = page;\n }\n \n createAccount() {\n window.location = '/app/account';\n }\n\n \n getAccountName() {\n\n let accountName = window.location.pathname.split('/')[1];\n\n if(accountName.length < 4) {\n return null;\n }\n\n return this.getOwnedAccountName(accountName);\n }\n\n getOwnedAccountName(accountName) {\n if(!this.scope.auth.authenticated || this.scope.auth.info == null) {\n return null;\n }\n\n let userInfo = this.scope.auth.info;\n\n if(!Array.isArray(userInfo.accounts) || userInfo.accounts.length == 0) {\n return null;\n }\n\n let account = userInfo.accounts.find(a => a.accountName == accountName);\n\n if(account == null) {\n return null;\n }\n\n return account.accountName;\n }\n\n login() {\n window.location = '/app/login?redirectUrl=' + encodeURIComponent(window.location);\n }\n\n logout() {\n window.location = '/app/logout?redirectUrl=' + encodeURIComponent(window.location);\n }\n\n formatDateFromNow(date) {\n return moment(date).fromNow();\n }\n\n markdownToHtml(markdown) {\n\n if(this.sce == null) {\n return markdown;\n }\n\n var markdown = DatabusUtils.renderMarkdown(markdown);\n\n return this.sce.trustAsHtml(markdown);\n };\n\n formatDate(date) {\n return DatabusUtils.formatDate(date); // moment(date).format('MMM Do YYYY') + \" (\" + moment(date).fromNow() + \")\";\n }\n\n formatLongDate(longString) {\n var number = new Number(longString);\n var dateTime = new Date(number);\n return this.formatDate(dateTime);\n }\n\n formatFileSize (size) {\n return DatabusUtils.formatFileSize(size);\n }\n\n getPathname(uri) {\n var url = new URL(uri);\n return url.pathname;\n }\n\n objSize(obj) {\n return DatabusUtils.objSize(obj);\n }\n\n navigateUp(uri) {\n return DatabusUtils.navigateUp(uri);\n }\n\n uriToName(uri) {\n return DatabusUtils.uriToName(uri); \n }\n\n uriToResourceName(uri) {\n return DatabusUtils.uriToResourceName(uri);\n }\n\n isValidHttpsUrl(url) {\n return DatabusUtils.isValidHttpsUrl(url);\n }\n\n copyToClipboard(str) {\n\n if(typeof str === 'object') {\n str = JSON.stringify(str, null, 3);\n }\n\n // Create new element\n var el = document.createElement('textarea');\n // Set value (string to be copied)\n el.value = str;\n // Set non-editable to avoid focus and move outside of view\n el.setAttribute('readonly', '');\n el.style = { position: 'absolute', left: '-9999px' };\n document.body.appendChild(el);\n // Select text inside element\n el.select();\n // Copy text to clipboard\n document.execCommand('copy');\n // Remove temporary element\n document.body.removeChild(el);\n\n DatabusAlert.alert(this.scope, true, DatabusMessages.GENERIC_COPIED_TO_CLIPBOARD);\n }\n}\n\nmodule.exports = DatabusWebappUtils;\n\n\n//# sourceURL=webpack://databus-webapp/./js/utils/databus-webapp-utils.js?"); +eval("{const DatabusAlert = __webpack_require__(/*! ../components/databus-alert/databus-alert */ \"./js/components/databus-alert/databus-alert.js\");\nconst DatabusUtils = __webpack_require__(/*! ../utils/databus-utils */ \"./js/utils/databus-utils.js\");\nconst DatabusMessages = __webpack_require__(/*! ./databus-messages */ \"./js/utils/databus-messages.js\");\n\nclass DatabusWebappUtils {\n\n constructor($scope, $sce) {\n this.scope = $scope;\n this.sce = $sce;\n }\n\n goTo(page) {\n window.location = page;\n }\n \n createAccount() {\n window.location = '/app/account';\n }\n\n \n getAccountName() {\n\n let accountName = window.location.pathname.split('/')[1];\n\n if(accountName.length < 4) {\n return null;\n }\n\n return this.getOwnedAccountName(accountName);\n }\n\n getOwnedAccountName(accountName) {\n if(!this.scope.auth.authenticated || this.scope.auth.info == null) {\n return null;\n }\n\n let userInfo = this.scope.auth.info;\n\n if(!Array.isArray(userInfo.accounts) || userInfo.accounts.length == 0) {\n return null;\n }\n\n let account = userInfo.accounts.find(a => a.accountName == accountName);\n\n if(account == null) {\n return null;\n }\n\n return account.accountName;\n }\n\n login() {\n window.location = '/app/login?redirectUrl=' + encodeURIComponent(window.location);\n }\n\n logout() {\n window.location = '/app/logout?redirectUrl=' + encodeURIComponent(window.location);\n }\n\n formatDateFromNow(date) {\n return moment(date).fromNow();\n }\n\n markdownToHtml(markdown) {\n\n if(this.sce == null) {\n return markdown;\n }\n\n var markdown = DatabusUtils.renderMarkdown(markdown);\n\n return this.sce.trustAsHtml(markdown);\n };\n\n formatDate(date) {\n return DatabusUtils.formatDate(date); // moment(date).format('MMM Do YYYY') + \" (\" + moment(date).fromNow() + \")\";\n }\n\n formatLongDate(longString) {\n var number = new Number(longString);\n var dateTime = new Date(number);\n return this.formatDate(dateTime);\n }\n\n formatFileSize (size) {\n return DatabusUtils.formatFileSize(size);\n }\n\n getPathname(uri) {\n var url = new URL(uri);\n return url.pathname;\n }\n\n objSize(obj) {\n return DatabusUtils.objSize(obj);\n }\n\n navigateUp(uri) {\n return DatabusUtils.navigateUp(uri);\n }\n\n uriToName(uri) {\n return DatabusUtils.uriToName(uri); \n }\n\n uriToResourceName(uri) {\n return DatabusUtils.uriToResourceName(uri);\n }\n\n isValidHttpsUrl(url) {\n return DatabusUtils.isValidHttpsUrl(url);\n }\n\n copyToClipboard(str) {\n\n if(typeof str === 'object') {\n str = JSON.stringify(str, null, 3);\n }\n\n // Create new element\n var el = document.createElement('textarea');\n // Set value (string to be copied)\n el.value = str;\n // Set non-editable to avoid focus and move outside of view\n el.setAttribute('readonly', '');\n el.style = { position: 'absolute', left: '-9999px' };\n document.body.appendChild(el);\n // Select text inside element\n el.select();\n // Copy text to clipboard\n document.execCommand('copy');\n // Remove temporary element\n document.body.removeChild(el);\n\n DatabusAlert.alert(this.scope, true, DatabusMessages.GENERIC_COPIED_TO_CLIPBOARD);\n }\n}\n\nmodule.exports = DatabusWebappUtils;\n\n\n//# sourceURL=webpack://databus-webapp/./js/utils/databus-webapp-utils.js?\n}"); -/***/ }), +/***/ }, -/***/ "./js/utils/jsonld-utils.js": +/***/ "./js/utils/jsonld-utils.js" /*!**********************************!*\ !*** ./js/utils/jsonld-utils.js ***! \**********************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +(module, __unused_webpack_exports, __webpack_require__) { -eval("/* module decorator */ module = __webpack_require__.nmd(module);\nconst DatabusUris = __webpack_require__(/*! ./databus-uris */ \"./js/utils/databus-uris.js\");\n\n\nclass JsonldUtils {\n\n static refTo(uri) {\n var result = {};\n result[DatabusUris.JSONLD_ID] = uri;\n return result;\n }\n\n static getTypedGraph(graphs, graphType) {\n\n for (var g in graphs) {\n var graph = graphs[g];\n\n if (graph[DatabusUris.JSONLD_TYPE] != undefined && graph[DatabusUris.JSONLD_TYPE].includes(graphType)) {\n return graph;\n }\n }\n\n return null;\n }\n\n static setLiteral(graph, property, type, value) {\n graph[property] = [];\n\n var entry = {};\n entry[DatabusUris.JSONLD_TYPE] = type;\n entry[DatabusUris.JSONLD_VALUE] = value;\n\n graph[property].push(entry);\n }\n\n static setLink(graph, property, uri) {\n graph[property] = [];\n\n var entry = {};\n entry[DatabusUris.JSONLD_ID] = uri;\n\n graph[property].push(entry);\n }\n\n static getGraphById = function (graphs, id) {\n return graphs.find(g => g[DatabusUris.JSONLD_ID] === id);\n };\n\n static getRefArrayProperty = function (graph, propertyUri) {\n const val = graph[propertyUri];\n if (!val) return [];\n return val.map(v => v[DatabusUris.JSONLD_ID]);\n };\n\n static getProperty(graph, property) {\n if (graph[property] == undefined) {\n return null;\n }\n\n if (graph[property].length == 1) {\n var value = graph[property][0];\n\n if (value[DatabusUris.JSONLD_VALUE] != null) {\n return value[DatabusUris.JSONLD_VALUE];\n }\n\n if (value[DatabusUris.JSONLD_ID] != null) {\n return value[DatabusUris.JSONLD_ID];\n }\n\n return null;\n } else {\n var result = [];\n\n for (var value of graph[property]) {\n\n if (value[DatabusUris.JSONLD_VALUE] != null) {\n result.push(value[DatabusUris.JSONLD_VALUE]);\n }\n\n if (value[DatabusUris.JSONLD_ID] != null) {\n result.push(value[DatabusUris.JSONLD_ID]);\n }\n }\n\n if (result.length > 0) {\n return result;\n }\n }\n\n return null;\n }\n\n static getFirstProperty(graph, property) {\n if (graph[property] == undefined) {\n return null;\n }\n\n const values = graph[property];\n\n if (values.length === 0) {\n return null;\n }\n\n if (values.length === 1) {\n const value = values[0];\n\n if (value[DatabusUris.JSONLD_VALUE] != null) {\n return value[DatabusUris.JSONLD_VALUE];\n }\n\n if (value[DatabusUris.JSONLD_ID] != null) {\n return value[DatabusUris.JSONLD_ID];\n }\n\n return null;\n }\n\n for (const value of values) {\n if (value[DatabusUris.JSONLD_VALUE] != null) {\n return value[DatabusUris.JSONLD_VALUE];\n }\n\n if (value[DatabusUris.JSONLD_ID] != null) {\n return value[DatabusUris.JSONLD_ID];\n }\n }\n\n return null;\n }\n\n\n static getGraphById(graphs, id) {\n for (var g in graphs) {\n var graph = graphs[g];\n\n if (graph[DatabusUris.JSONLD_ID] != undefined && graph[DatabusUris.JSONLD_ID] == id) {\n return graph;\n }\n }\n\n return null;\n }\n\n static getTypedGraphs(graphs, graphType) {\n var result = [];\n\n for (var g in graphs) {\n var graph = graphs[g];\n\n if (graph[DatabusUris.JSONLD_TYPE] != undefined &&\n graph[DatabusUris.JSONLD_TYPE].includes(graphType)) {\n result.push(graph);\n }\n }\n\n return result;\n }\n\n static getSubPropertyGraphs(graphs, propertyUri) {\n\n var result = [];\n\n for (var graph of graphs) {\n if (graph[DatabusUris.RDFS_SUB_PROPERTY_OF] == undefined) {\n continue;\n }\n\n for (var property of graph[DatabusUris.RDFS_SUB_PROPERTY_OF]) {\n if (property[DatabusUris.JSONLD_ID] == propertyUri) {\n result.push(graph);\n }\n }\n }\n\n return result;\n }\n\n\n static getFirstObject(graph, key) {\n var obj = graph[key];\n\n if (obj == undefined || obj.length < 1) {\n return null;\n }\n\n return obj[0];\n }\n\n static getFirstObjectUri(graph, property) {\n // Get the object \n const obj = graph[property];\n\n // Not found -> null\n if (!obj) {\n return null;\n }\n\n // If it is an array...\n if (Array.isArray(obj)) {\n for (const item of obj) {\n if (item && typeof item === 'object' && DatabusUris.JSONLD_ID in item) {\n return item[DatabusUris.JSONLD_ID];\n }\n }\n } else if (typeof obj === 'object' && DatabusUris.JSONLD_ID in obj) {\n return obj[DatabusUris.JSONLD_ID];\n }\n\n return null;\n }\n}\n\n\n\nif ( true && module && module.exports)\n module.exports = JsonldUtils;\n\n//# sourceURL=webpack://databus-webapp/./js/utils/jsonld-utils.js?"); +eval("{/* module decorator */ module = __webpack_require__.nmd(module);\nconst DatabusUris = __webpack_require__(/*! ./databus-uris */ \"./js/utils/databus-uris.js\");\n\n\nclass JsonldUtils {\n\n static refTo(uri) {\n var result = {};\n result[DatabusUris.JSONLD_ID] = uri;\n return result;\n }\n\n static getTypedGraph(graphs, graphType) {\n\n for (var g in graphs) {\n var graph = graphs[g];\n\n if (graph[DatabusUris.JSONLD_TYPE] != undefined && graph[DatabusUris.JSONLD_TYPE].includes(graphType)) {\n return graph;\n }\n }\n\n return null;\n }\n\n static setLiteral(graph, property, type, value) {\n graph[property] = [];\n\n var entry = {};\n entry[DatabusUris.JSONLD_TYPE] = type;\n entry[DatabusUris.JSONLD_VALUE] = value;\n\n graph[property].push(entry);\n }\n\n static setLink(graph, property, uri) {\n graph[property] = [];\n\n var entry = {};\n entry[DatabusUris.JSONLD_ID] = uri;\n\n graph[property].push(entry);\n }\n\n static getGraphById = function (graphs, id) {\n return graphs.find(g => g[DatabusUris.JSONLD_ID] === id);\n };\n\n static getRefArrayProperty = function (graph, propertyUri) {\n const val = graph[propertyUri];\n if (!val) return [];\n return val.map(v => v[DatabusUris.JSONLD_ID]);\n };\n\n static getProperty(graph, property) {\n if (graph[property] == undefined) {\n return null;\n }\n\n if (graph[property].length == 1) {\n var value = graph[property][0];\n\n if (value[DatabusUris.JSONLD_VALUE] != null) {\n return value[DatabusUris.JSONLD_VALUE];\n }\n\n if (value[DatabusUris.JSONLD_ID] != null) {\n return value[DatabusUris.JSONLD_ID];\n }\n\n return null;\n } else {\n var result = [];\n\n for (var value of graph[property]) {\n\n if (value[DatabusUris.JSONLD_VALUE] != null) {\n result.push(value[DatabusUris.JSONLD_VALUE]);\n }\n\n if (value[DatabusUris.JSONLD_ID] != null) {\n result.push(value[DatabusUris.JSONLD_ID]);\n }\n }\n\n if (result.length > 0) {\n return result;\n }\n }\n\n return null;\n }\n\n static getFirstProperty(graph, property) {\n if (graph[property] == undefined) {\n return null;\n }\n\n const values = graph[property];\n\n if (values.length === 0) {\n return null;\n }\n\n if (values.length === 1) {\n const value = values[0];\n\n if (value[DatabusUris.JSONLD_VALUE] != null) {\n return value[DatabusUris.JSONLD_VALUE];\n }\n\n if (value[DatabusUris.JSONLD_ID] != null) {\n return value[DatabusUris.JSONLD_ID];\n }\n\n return null;\n }\n\n for (const value of values) {\n if (value[DatabusUris.JSONLD_VALUE] != null) {\n return value[DatabusUris.JSONLD_VALUE];\n }\n\n if (value[DatabusUris.JSONLD_ID] != null) {\n return value[DatabusUris.JSONLD_ID];\n }\n }\n\n return null;\n }\n\n\n static getGraphById(graphs, id) {\n for (var g in graphs) {\n var graph = graphs[g];\n\n if (graph[DatabusUris.JSONLD_ID] != undefined && graph[DatabusUris.JSONLD_ID] == id) {\n return graph;\n }\n }\n\n return null;\n }\n\n static getTypedGraphs(graphs, graphType) {\n var result = [];\n\n for (var g in graphs) {\n var graph = graphs[g];\n\n if (graph[DatabusUris.JSONLD_TYPE] != undefined &&\n graph[DatabusUris.JSONLD_TYPE].includes(graphType)) {\n result.push(graph);\n }\n }\n\n return result;\n }\n\n static getSubPropertyGraphs(graphs, propertyUri) {\n\n var result = [];\n\n for (var graph of graphs) {\n if (graph[DatabusUris.RDFS_SUB_PROPERTY_OF] == undefined) {\n continue;\n }\n\n for (var property of graph[DatabusUris.RDFS_SUB_PROPERTY_OF]) {\n if (property[DatabusUris.JSONLD_ID] == propertyUri) {\n result.push(graph);\n }\n }\n }\n\n return result;\n }\n\n\n static getFirstObject(graph, key) {\n var obj = graph[key];\n\n if (obj == undefined || obj.length < 1) {\n return null;\n }\n\n return obj[0];\n }\n\n static getFirstObjectUri(graph, property) {\n // Get the object \n const obj = graph[property];\n\n // Not found -> null\n if (!obj) {\n return null;\n }\n\n // If it is an array...\n if (Array.isArray(obj)) {\n for (const item of obj) {\n if (item && typeof item === 'object' && DatabusUris.JSONLD_ID in item) {\n return item[DatabusUris.JSONLD_ID];\n }\n }\n } else if (typeof obj === 'object' && DatabusUris.JSONLD_ID in obj) {\n return obj[DatabusUris.JSONLD_ID];\n }\n\n return null;\n }\n}\n\n\n\nif ( true && module && module.exports)\n module.exports = JsonldUtils;\n\n//# sourceURL=webpack://databus-webapp/./js/utils/jsonld-utils.js?\n}"); -/***/ }), +/***/ }, -/***/ "./js/utils/messages.js": +/***/ "./js/utils/messages.js" /*!******************************!*\ !*** ./js/utils/messages.js ***! \******************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { +(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DatabusMsg: () => (/* binding */ DatabusMsg)\n/* harmony export */ });\nclass DatabusMsg {\n static messages = {\n err_invalid_group_name: \"Please enter between 3 to 50 characters. \\nRegex: [a-zA-Z0-9_\\\\-\\\\.]{3,50}$\",\n err_no_group_selected: \"Please select a group\",\n err_no_artifact_selected: \"Please select an artifact\",\n \n err_invalid_artifact_name: \"Please enter between 3 to 50 characters. \\nRegex: [a-zA-Z0-9_\\\\-\\\\.]{3,50}$\",\n err_invalid_version_name: \"Please enter between 3 to 50 characters. \\nRegex: [a-zA-Z0-9_\\\\-\\\\.]{3,50}$\",\n err_invalid_version_title: \"The version title is missing.\",\n err_invalid_version_abstract: \"The version abstract is missing.\",\n err_invalid_version_description: \"The version description is missing.\",\n err_invalid_version_license: \"The license is invalid. Please enter a license URI.\",\n err_no_files: \"You have to upload at least one file.\",\n err_not_analyzed: \"This file has not been analzyed yet.\",\n warning_group_exists: \"A group with this name already exists. Publishing will overwrite its metadata.\",\n warning_artifact_exists: \"An artifact with this name already exists. Publishing will overwrite its metadata.\",\n warning_version_exists: \"A version with this name already exists. Publishing will overwrite its metadata. This is not recommended, as other users might use your version identifier as a data dependency.\"\n };\n\n static get(key) {\n return this.messages[key] || \"Unknown validation key.\";\n }\n}\n\n\n//# sourceURL=webpack://databus-webapp/./js/utils/messages.js?"); +eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DatabusMsg: () => (/* binding */ DatabusMsg)\n/* harmony export */ });\nclass DatabusMsg {\n static messages = {\n err_invalid_group_name: \"Please enter between 3 to 50 characters. \\nRegex: [a-zA-Z0-9_\\\\-\\\\.]{3,50}$\",\n err_no_group_selected: \"Please select a group\",\n err_no_artifact_selected: \"Please select an artifact\",\n \n err_invalid_artifact_name: \"Please enter between 3 to 50 characters. \\nRegex: [a-zA-Z0-9_\\\\-\\\\.]{3,50}$\",\n err_invalid_version_name: \"Please enter between 3 to 50 characters. \\nRegex: [a-zA-Z0-9_\\\\-\\\\.]{3,50}$\",\n err_invalid_version_title: \"The version title is missing.\",\n err_invalid_version_abstract: \"The version abstract is missing.\",\n err_invalid_version_description: \"The version description is missing.\",\n err_invalid_version_license: \"The license is invalid. Please enter a license URI.\",\n err_no_files: \"You have to upload at least one file.\",\n err_not_analyzed: \"This file has not been analzyed yet.\",\n warning_group_exists: \"A group with this name already exists. Publishing will overwrite its metadata.\",\n warning_artifact_exists: \"An artifact with this name already exists. Publishing will overwrite its metadata.\",\n warning_version_exists: \"A version with this name already exists. Publishing will overwrite its metadata. This is not recommended, as other users might use your version identifier as a data dependency.\"\n };\n\n static get(key) {\n return this.messages[key] || \"Unknown validation key.\";\n }\n}\n\n\n//# sourceURL=webpack://databus-webapp/./js/utils/messages.js?\n}"); -/***/ }), +/***/ }, -/***/ "./js/utils/sparql-examples.js": +/***/ "./js/utils/sparql-examples.js" /*!*************************************!*\ !*** ./js/utils/sparql-examples.js ***! \*************************************/ -/***/ ((module) => { +(module) { -eval("/**\n * Query Templates can be defined as object with the fields:\n * > select\n * > body\n * > aggregate\n * \n * The select is a SPARQL select statement. The body is an array of strings with each string being a line of a \n * SPARQL query. The string %QUERY% can be used to insert the query generated by the QueryBuilder. The aggregate\n * is a SPARQL aggregate statement.\n */\nclass SparqlExamples {\n\n static LIST = `PREFIX databus: \nSELECT DISTINCT * WHERE {\n ?s a databus:Artifact .\n}`;\n}\n\nmodule.exports = SparqlExamples;\n\n//# sourceURL=webpack://databus-webapp/./js/utils/sparql-examples.js?"); +eval("{/**\n * Query Templates can be defined as object with the fields:\n * > select\n * > body\n * > aggregate\n * \n * The select is a SPARQL select statement. The body is an array of strings with each string being a line of a \n * SPARQL query. The string %QUERY% can be used to insert the query generated by the QueryBuilder. The aggregate\n * is a SPARQL aggregate statement.\n */\nclass SparqlExamples {\n\n static LIST = `PREFIX databus: \nSELECT DISTINCT * WHERE {\n ?s a databus:Artifact .\n}`;\n}\n\nmodule.exports = SparqlExamples;\n\n//# sourceURL=webpack://databus-webapp/./js/utils/sparql-examples.js?\n}"); -/***/ }), +/***/ }, -/***/ "./js/utils/tab-navigation.js": +/***/ "./js/utils/tab-navigation.js" /*!************************************!*\ !*** ./js/utils/tab-navigation.js ***! \************************************/ -/***/ ((module) => { - -eval("\nclass TabNavigation {\n\n constructor($scope, $location, tabKeys, onNavigateCallback) {\n this.location = $location;\n this.tabKeys = tabKeys;\n this.activeTab = 0;\n this.onNavigateCallback = onNavigateCallback;\n\n var self = this;\n // Watch the location hash and tell the tabnavigation that it changed\n $scope.$watch(function () {\n return $location.hash();\n }, function (newVal, oldVal) {\n self.onLocationHashChanged(newVal, oldVal)\n }, false);\n }\n\n\n onLocationHashChanged(value, oldVal) {\n for (var i in this.tabKeys) {\n var tabKey = this.tabKeys[i];\n if (value == tabKey) {\n this.activeTab = i;\n\n if(this.onNavigateCallback != null) {\n this.onNavigateCallback(this.activeTab);\n }\n return;\n }\n }\n\n this.activeTab = 0;\n if(this.onNavigateCallback != null) {\n this.onNavigateCallback(this.activeTab);\n }\n }\n\n /**\n * Change the tab - set location hash and scroll up\n * @param {*} value \n */\n navigateTo(value, scrollToTop) {\n this.location.hash(value);\n\n if(scrollToTop == true) {\n window.scrollTo(0, 0);\n }\n }\n\n}\n\nmodule.exports = TabNavigation;\n\n//# sourceURL=webpack://databus-webapp/./js/utils/tab-navigation.js?"); +(module) { -/***/ }), +eval("{\nclass TabNavigation {\n\n constructor($scope, $location, tabKeys, onNavigateCallback) {\n this.location = $location;\n this.tabKeys = tabKeys;\n this.activeTab = 0;\n this.onNavigateCallback = onNavigateCallback;\n\n var self = this;\n // Watch the location hash and tell the tabnavigation that it changed\n $scope.$watch(function () {\n return $location.hash();\n }, function (newVal, oldVal) {\n self.onLocationHashChanged(newVal, oldVal)\n }, false);\n }\n\n\n onLocationHashChanged(value, oldVal) {\n for (var i in this.tabKeys) {\n var tabKey = this.tabKeys[i];\n if (value == tabKey) {\n this.activeTab = i;\n\n if(this.onNavigateCallback != null) {\n this.onNavigateCallback(this.activeTab);\n }\n return;\n }\n }\n\n this.activeTab = 0;\n if(this.onNavigateCallback != null) {\n this.onNavigateCallback(this.activeTab);\n }\n }\n\n /**\n * Change the tab - set location hash and scroll up\n * @param {*} value \n */\n navigateTo(value, scrollToTop) {\n this.location.hash(value);\n\n if(scrollToTop == true) {\n window.scrollTo(0, 0);\n }\n }\n\n}\n\nmodule.exports = TabNavigation;\n\n//# sourceURL=webpack://databus-webapp/./js/utils/tab-navigation.js?\n}"); -/***/ "../server/app/common/utils/api-error.js": -/*!***********************************************!*\ - !*** ../server/app/common/utils/api-error.js ***! - \***********************************************/ -/***/ ((module) => { - -eval("class ApiError extends Error {\r\n constructor(statusCode, resource, message, body) {\r\n super(message);\r\n this.name = \"ApiError\";\r\n this.statusCode = statusCode;\r\n this.resource = resource;\r\n this.body = body;\r\n }\r\n}\r\n\r\nmodule.exports = ApiError;\n\n//# sourceURL=webpack://databus-webapp/../server/app/common/utils/api-error.js?"); +/***/ }, -/***/ }), - -/***/ "markdown-it": +/***/ "markdown-it" /*!*****************************!*\ !*** external "markdownit" ***! \*****************************/ -/***/ ((module) => { +(module) { "use strict"; module.exports = self["markdownit"]; -/***/ }), +/***/ }, -/***/ "moment/moment": +/***/ "moment/moment" /*!*************************!*\ !*** external "moment" ***! \*************************/ -/***/ ((module) => { +(module) { "use strict"; module.exports = self["moment"]; -/***/ }) +/***/ } /******/ }); /************************************************************************/ /******/ // The module cache -/******/ var __webpack_module_cache__ = {}; +/******/ const __webpack_module_cache__ = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache -/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ const cachedModule = __webpack_module_cache__[moduleId]; /******/ if (cachedModule !== undefined) { /******/ return cachedModule.exports; /******/ } /******/ // Create a new module (and put it into the cache) -/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ const module = __webpack_module_cache__[moduleId] = { /******/ id: moduleId, /******/ loaded: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function +/******/ if (!(moduleId in __webpack_modules__)) { +/******/ delete __webpack_module_cache__[moduleId]; +/******/ const e = new Error("Cannot find module '" + moduleId + "'"); +/******/ e.code = 'MODULE_NOT_FOUND'; +/******/ throw e; +/******/ } /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded @@ -764,11 +770,26 @@ module.exports = self["moment"]; /************************************************************************/ /******/ /* webpack/runtime/define property getters */ /******/ (() => { -/******/ // define getter functions for harmony exports +/******/ // define getter/value functions for harmony exports /******/ __webpack_require__.d = (exports, definition) => { -/******/ for(var key in definition) { -/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { -/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); +/******/ if(Array.isArray(definition)) { +/******/ var i = 0; +/******/ while(i < definition.length) { +/******/ var key = definition[i++]; +/******/ var binding = definition[i++]; +/******/ if(!__webpack_require__.o(exports, key)) { +/******/ if(binding === 0) { +/******/ Object.defineProperty(exports, key, { enumerable: true, value: definition[i++] }); +/******/ } else { +/******/ Object.defineProperty(exports, key, { enumerable: true, get: binding }); +/******/ } +/******/ } else if(binding === 0) { i++; } +/******/ } +/******/ } else { +/******/ for(var key in definition) { +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); +/******/ } /******/ } /******/ } /******/ }; @@ -783,7 +804,7 @@ module.exports = self["moment"]; /******/ (() => { /******/ // define __esModule on exports /******/ __webpack_require__.r = (exports) => { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ if(Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); @@ -804,7 +825,7 @@ module.exports = self["moment"]; /******/ // startup /******/ // Load entry module and return exports /******/ // This entry module can't be inlined because the eval devtool is used. -/******/ var __webpack_exports__ = __webpack_require__("./js/angular-application.js"); +/******/ let __webpack_exports__ = __webpack_require__("./js/angular-application.js"); /******/ /******/ })() ; \ No newline at end of file diff --git a/public/js/angular-application.js b/public/js/angular-application.js index 9a808824..ea72a03d 100644 --- a/public/js/angular-application.js +++ b/public/js/angular-application.js @@ -633,7 +633,7 @@ databusApplication.directive('activityChart', function () { .attr("dy", "1em") .attr("font-size", "1.1em") .attr("text-anchor", "end") - .text("Uploaded Data (GByte)"); + .text("Uploaded Data (GiByte)"); var path = g.append("path") .datum(scope.data) diff --git a/public/js/components/collection-data-table/collection-data-table.js b/public/js/components/collection-data-table/collection-data-table.js index febdc3b2..0695c840 100644 --- a/public/js/components/collection-data-table/collection-data-table.js +++ b/public/js/components/collection-data-table/collection-data-table.js @@ -98,9 +98,9 @@ function CollectionDataTableController($http, $scope, $location, $sce) { ctrl.formatUploadSize = function(size) { if(size < 1024) return size + " B"; - else if (size < 1048576) return Math.round(size / 1024) + " KB"; - else if (size < 1073741824) return (Math.round(10 * size / 1048576) / 10) + " MB"; - else return (Math.round(100 * size / 1073741824) / 100) + " GB"; + else if (size < 1048576) return Math.round(size / 1024) + " KiB"; + else if (size < 1073741824) return (Math.round(10 * size / 1048576) / 10) + " MiB"; + else return (Math.round(100 * size / 1073741824) / 100) + " GiB"; } } diff --git a/public/js/utils/databus-utils.js b/public/js/utils/databus-utils.js index a35d0886..17b2fa7b 100644 --- a/public/js/utils/databus-utils.js +++ b/public/js/utils/databus-utils.js @@ -111,13 +111,13 @@ class DatabusUtils { static formatFileSize(size) { if (size == undefined) { - return '0 KB' + return '0 KiB' } if (size < 1024) return size + " B"; - else if (size < 1048576) return Math.round(size / 1024) + " KB"; - else if (size < 1073741824) return (Math.round(10 * size / 1048576) / 10) + " MB"; - else return (Math.round(100 * size / 1073741824) / 100) + " GB"; + else if (size < 1048576) return Math.round(size / 1024) + " KiB"; + else if (size < 1073741824) return (Math.round(10 * size / 1048576) / 10) + " MiB"; + else return (Math.round(100 * size / 1073741824) / 100) + " GiB"; }; static checkField(value, regex, min, max) { diff --git a/server/app/common/queries/query-modules/pages.js b/server/app/common/queries/query-modules/pages.js index 22472f46..b3f1d34b 100644 --- a/server/app/common/queries/query-modules/pages.js +++ b/server/app/common/queries/query-modules/pages.js @@ -107,7 +107,7 @@ function createActivityChartData(bindings) { // Create datestring for entry and map lookup (YYYY-MM) let dateString = date.toISOString().substring(0, 7); - // Create the entry with datestring and scaled value (GB) + // Create the entry with datestring and scaled value (GiB) result.push({ date: dateString, value: totalSize / (1024 * 1024 * 1024) From 1c776d6a3d9c81fc82b07a227387db2fad77d979 Mon Sep 17 00:00:00 2001 From: Palak Bhati Date: Thu, 16 Jul 2026 09:59:52 +0530 Subject: [PATCH 2/2] Address review: delegate formatUploadSize to DatabusUtils.formatFileSize Removes duplicated size-formatting logic and inherits the undefined guard (returns '0 KiB' instead of 'NaN GiB'). --- public/dist/main.js | 2 +- .../collection-data-table/collection-data-table.js | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/public/dist/main.js b/public/dist/main.js index b77f1a63..a894dd8a 100644 --- a/public/dist/main.js +++ b/public/dist/main.js @@ -95,7 +95,7 @@ eval("{\n// hinzufügen eines Controllers zum Modul\nfunction BetterDropdownCont \**********************************************************************/ (module, __unused_webpack_exports, __webpack_require__) { -eval("{const DatabusCollectionUtils = __webpack_require__(/*! ../../collections/databus-collection-utils */ \"./js/collections/databus-collection-utils.js\");\nconst DatabusUtils = __webpack_require__(/*! ../../utils/databus-utils */ \"./js/utils/databus-utils.js\");\n\n\n// hinzufügen eines Controllers zum Modul\nfunction CollectionDataTableController($http, $scope, $location, $sce) {\n\n var ctrl = this;\n ctrl.$http = $http;\n\n\n ctrl.$onInit = function() {\n\n\n ctrl.isLoading = true;\n DatabusCollectionUtils.getCollectionFiles(ctrl.$http, ctrl.collection).then(function(result) {\n ctrl.files = result;\n ctrl.isLoading = false;\n $scope.$apply();\n }, function(err) {\n ctrl.statistics = null;\n ctrl.isLoading = false;\n });\n\n\n if(ctrl.files == null) {\n return;\n }\n\n ctrl.groupedFiles = ctrl.groupBy(ctrl.files, 'version');\n }\n\n ctrl.getRowspan = function(file) {\n\n return file.distributions.length * 2; \n /*\n var span = file.distributions.length * 2;\n if(!file.distributions[file.distributions.length - 1].expanded) {\n span--;\n }\n\n return span;*/\n }\n\n ctrl.groupBy = function(list, key) {\n\n var result = {};\n\n for(var i in list) {\n var element = list[i];\n var keyVal = element[key];\n\n if(result[keyVal] == undefined) {\n result[keyVal] = {}\n result[keyVal].value = keyVal;\n result[keyVal].title = element.title;\n result[keyVal].uri = keyVal;\n result[keyVal].distributions = [];\n result[keyVal].license = element.license;\n }\n\n result[keyVal].distributions.push(element);\n }\n \n return result;\n }\n\n ctrl.calculateRowSpan = function(file) {\n var rowspan = 0;\n\n for(var d in file.distributions) {\n rowspan += 1; //(file.distributions[d].expanded ? 2 : 1);\n }\n\n return rowspan;\n }\n\n ctrl.createRelativeUri = function(url) {\n var u = new URL(url);\n return u.pathname;\n }\n\n ctrl.$doCheck = function() {\n\n if(ctrl.files == null) {\n return;\n }\n\n if(ctrl.previousFileCount != ctrl.files.length) {\n ctrl.previousFileCount = ctrl.files.length;\n ctrl.groupedFiles = ctrl.groupBy(ctrl.files, 'version');\n } \n }\n\n ctrl.uriToName = function(uri) {\n return DatabusUtils.uriToName(uri);\n }\n\n ctrl.formatUploadSize = function(size) {\n if(size < 1024) return size + \" B\";\n else if (size < 1048576) return Math.round(size / 1024) + \" KiB\";\n else if (size < 1073741824) return (Math.round(10 * size / 1048576) / 10) + \" MiB\";\n else return (Math.round(100 * size / 1073741824) / 100) + \" GiB\";\n }\n}\n\n\nmodule.exports = CollectionDataTableController;\n\n//# sourceURL=webpack://databus-webapp/./js/components/collection-data-table/collection-data-table.js?\n}"); +eval("{const DatabusCollectionUtils = __webpack_require__(/*! ../../collections/databus-collection-utils */ \"./js/collections/databus-collection-utils.js\");\nconst DatabusUtils = __webpack_require__(/*! ../../utils/databus-utils */ \"./js/utils/databus-utils.js\");\n\n\n// hinzufügen eines Controllers zum Modul\nfunction CollectionDataTableController($http, $scope, $location, $sce) {\n\n var ctrl = this;\n ctrl.$http = $http;\n\n\n ctrl.$onInit = function() {\n\n\n ctrl.isLoading = true;\n DatabusCollectionUtils.getCollectionFiles(ctrl.$http, ctrl.collection).then(function(result) {\n ctrl.files = result;\n ctrl.isLoading = false;\n $scope.$apply();\n }, function(err) {\n ctrl.statistics = null;\n ctrl.isLoading = false;\n });\n\n\n if(ctrl.files == null) {\n return;\n }\n\n ctrl.groupedFiles = ctrl.groupBy(ctrl.files, 'version');\n }\n\n ctrl.getRowspan = function(file) {\n\n return file.distributions.length * 2; \n /*\n var span = file.distributions.length * 2;\n if(!file.distributions[file.distributions.length - 1].expanded) {\n span--;\n }\n\n return span;*/\n }\n\n ctrl.groupBy = function(list, key) {\n\n var result = {};\n\n for(var i in list) {\n var element = list[i];\n var keyVal = element[key];\n\n if(result[keyVal] == undefined) {\n result[keyVal] = {}\n result[keyVal].value = keyVal;\n result[keyVal].title = element.title;\n result[keyVal].uri = keyVal;\n result[keyVal].distributions = [];\n result[keyVal].license = element.license;\n }\n\n result[keyVal].distributions.push(element);\n }\n \n return result;\n }\n\n ctrl.calculateRowSpan = function(file) {\n var rowspan = 0;\n\n for(var d in file.distributions) {\n rowspan += 1; //(file.distributions[d].expanded ? 2 : 1);\n }\n\n return rowspan;\n }\n\n ctrl.createRelativeUri = function(url) {\n var u = new URL(url);\n return u.pathname;\n }\n\n ctrl.$doCheck = function() {\n\n if(ctrl.files == null) {\n return;\n }\n\n if(ctrl.previousFileCount != ctrl.files.length) {\n ctrl.previousFileCount = ctrl.files.length;\n ctrl.groupedFiles = ctrl.groupBy(ctrl.files, 'version');\n } \n }\n\n ctrl.uriToName = function(uri) {\n return DatabusUtils.uriToName(uri);\n }\n\n ctrl.formatUploadSize = function(size) {\n return DatabusUtils.formatFileSize(size);\n }\n}\n\n\nmodule.exports = CollectionDataTableController;\n\n//# sourceURL=webpack://databus-webapp/./js/components/collection-data-table/collection-data-table.js?\n}"); /***/ }, diff --git a/public/js/components/collection-data-table/collection-data-table.js b/public/js/components/collection-data-table/collection-data-table.js index 0695c840..31cce491 100644 --- a/public/js/components/collection-data-table/collection-data-table.js +++ b/public/js/components/collection-data-table/collection-data-table.js @@ -97,10 +97,7 @@ function CollectionDataTableController($http, $scope, $location, $sce) { } ctrl.formatUploadSize = function(size) { - if(size < 1024) return size + " B"; - else if (size < 1048576) return Math.round(size / 1024) + " KiB"; - else if (size < 1073741824) return (Math.round(10 * size / 1048576) / 10) + " MiB"; - else return (Math.round(100 * size / 1073741824) / 100) + " GiB"; + return DatabusUtils.formatFileSize(size); } }