Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@
"type": "SCRIPT",
"path": "/services/web/platform-core/ui/platform/dialogs.js"
},
{
"type": "SCRIPT",
"path": "/services/web/platform-core/ui/platform/exports-hub.js"
},
{
"type": "SCRIPT",
"path": "/services/web/platform-core/ui/platform/notification-hub.js"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2025 Eclipse Dirigible contributors
* Copyright (c) 2026 Eclipse Dirigible contributors
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2025 Eclipse Dirigible contributors
* Copyright (c) 2026 Eclipse Dirigible contributors
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2025 Eclipse Dirigible contributors
* Copyright (c) 2026 Eclipse Dirigible contributors
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2025 Eclipse Dirigible contributors
* Copyright (c) 2026 Eclipse Dirigible contributors
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2025 Eclipse Dirigible contributors
* Copyright (c) 2026 Eclipse Dirigible contributors
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2025 Eclipse Dirigible contributors
* Copyright (c) 2026 Eclipse Dirigible contributors
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2025 Eclipse Dirigible contributors
* Copyright (c) 2026 Eclipse Dirigible contributors
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2025 Eclipse Dirigible contributors
* Copyright (c) 2026 Eclipse Dirigible contributors
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2025 Eclipse Dirigible contributors
* Copyright (c) 2026 Eclipse Dirigible contributors
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2025 Eclipse Dirigible contributors
* Copyright (c) 2026 Eclipse Dirigible contributors
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2025 Eclipse Dirigible contributors
* Copyright (c) 2026 Eclipse Dirigible contributors
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2025 Eclipse Dirigible contributors
* Copyright (c) 2026 Eclipse Dirigible contributors
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2025 Eclipse Dirigible contributors
* Copyright (c) 2026 Eclipse Dirigible contributors
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2025 Eclipse Dirigible contributors
* Copyright (c) 2026 Eclipse Dirigible contributors
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2025 Eclipse Dirigible contributors
* Copyright (c) 2026 Eclipse Dirigible contributors
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2025 Eclipse Dirigible contributors
* Copyright (c) 2010-2026 Eclipse Dirigible contributors
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2025 Eclipse Dirigible contributors
* Copyright (c) 2010-2026 Eclipse Dirigible contributors
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2025 Eclipse Dirigible contributors
* Copyright (c) 2010-2026 Eclipse Dirigible contributors
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2025 Eclipse Dirigible contributors
* Copyright (c) 2026 Eclipse Dirigible contributors
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2025 Eclipse Dirigible contributors
* Copyright (c) 2026 Eclipse Dirigible contributors
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Copyright (c) 2010-2026 Eclipse Dirigible contributors
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v20.html
*
* SPDX-FileCopyrightText: Eclipse Dirigible contributors
* SPDX-License-Identifier: EPL-2.0
*/
class ExportsHub extends MessageHubApi {
/**
* Event to refresh the exports list.
*/
refresh() {
this.triggerEvent('platform.shell.exports.refresh');
}

/**
* Triggered when the exports should be refreshed.
* @param handler - Callback function.
* @returns - A reference to the listener. In order to remove/disable the listener, you need to use this reference and pass it to the 'removeMessageListener' function.
*/
onRefresh(handler) {
return this.addMessageListener({ topic: 'platform.shell.exports.refresh', handler: handler });
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2025 Eclipse Dirigible contributors
* Copyright (c) 2026 Eclipse Dirigible contributors
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2025 Eclipse Dirigible contributors
* Copyright (c) 2010-2026 Eclipse Dirigible contributors
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2025 Eclipse Dirigible contributors
* Copyright (c) 2026 Eclipse Dirigible contributors
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

/*
* Copyright (c) 2025 Eclipse Dirigible contributors
* Copyright (c) 2026 Eclipse Dirigible contributors
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2025 Eclipse Dirigible contributors
* Copyright (c) 2010-2026 Eclipse Dirigible contributors
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2025 Eclipse Dirigible contributors
* Copyright (c) 2010-2026 Eclipse Dirigible contributors
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2025 Eclipse Dirigible contributors
* Copyright (c) 2010-2026 Eclipse Dirigible contributors
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2025 Eclipse Dirigible contributors
* Copyright (c) 2026 Eclipse Dirigible contributors
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
Expand Down Expand Up @@ -64,13 +64,23 @@ if (window !== top) {
$compileProvider.debugInfoEnabled(false);
$compileProvider.commentDirectivesEnabled(false);
$compileProvider.cssClassDirectivesEnabled(false);
}).directive('shellHeader', ($window, User, Extensions, shellState, notifications, MessageHub, Shell) => ({
}).directive('shellHeader', ($window, $timeout, $http, User, Extensions, shellState, notifications, MessageHub, Shell, LocaleService) => ({
restrict: 'E',
replace: true,
link: (scope, element) => {
let exportButton;
scope.branding = getBrandingInfo();
const notificationStateKey = `${scope.branding.prefix}.notifications`;
const dialogHub = new DialogHub();
const exportsHub = new ExportsHub();
const DB_EXPORT_SERVICE_URL = '/services/data/export-async/';
scope.EXPORT_BASE_URL = '/public/cms/__EXPORTS/';
scope.ExportStatus = {
TRIGGRED: 'TRIGGRED',
FINISHED: 'FINISHED',
FAILED: 'FAILED',
UNKNOWN: 'UNKNOWN'
};
scope.perspectiveId = shellState.perspective.id;
shellState.registerStateListener((data) => {
scope.perspectiveId = data.id;
Expand All @@ -85,6 +95,7 @@ if (window !== top) {
scope.saveNotifications = () => {
localStorage.setItem(notificationStateKey, JSON.stringify(scope.notifications));
};
scope.exports = [];
scope.selectedNotification = '';
scope.username = undefined;
User.getName().then((data) => {
Expand Down Expand Up @@ -186,9 +197,104 @@ if (window !== top) {
return true;
};

scope.deleteExport = (id) => {
$http({
method: 'DELETE',
url: DB_EXPORT_SERVICE_URL + encodeURIComponent(id),
headers: { 'X-Requested-With': 'Fetch' }
}).then(() => {
for (let i = 0; i < scope.exports.length; i++) {
if (scope.exports[i].id === id) {
scope.exports.splice(i, 1);
break;
}
}
}, (reject) => {
dialogHub.showAlert({
type: AlertTypes.Error,
title: LocaleService.t('exports.error.delTitle', 'Could not delete export'),
message: LocaleService.t('exports.error.genericMsg', 'Please check the console log for more information.'),
});
console.error(reject);
});
};

scope.deleteExports = () => {
$http({
method: 'DELETE',
url: DB_EXPORT_SERVICE_URL,
headers: { 'X-Requested-With': 'Fetch' }
}).then(() => {
scope.exports.length = 0;
}, (reject) => {
dialogHub.showAlert({
type: AlertTypes.Error,
title: LocaleService.t('exports.error.delTitle', 'Could not delete export'),
message: LocaleService.t('exports.error.genericMsg', 'Please check the console log for more information.'),
});
console.error(reject);
});
};

scope.getExportDate = (date) => {
return new Intl.DateTimeFormat(undefined, {
dateStyle: 'short',
timeStyle: 'short',
}).format(new Date(date));
};

scope.logout = () => {
location.replace('/logout');
};

let to = 0;
function getExports(open = true) {
if (to) $timeout.cancel(to);
$http({
method: 'GET',
url: DB_EXPORT_SERVICE_URL,
headers: { 'X-Requested-With': 'Fetch' }
}).then((result) => {
scope.exports.length = 0;
scope.exports.push(...result.data.reverse());
if (open) {
scope.$evalAsync(() => {
if (!exportButton) exportButton = element[0].querySelector(`#exports`);
exportButton.focus();
exportButton.click();
});
}
if (open && !scope.exports.length) {
to = $timeout(() => { getExports(false) }, 500);
} else {
for (let i = 0; i < scope.exports.length; i++) {
if (scope.exports[i].status === scope.ExportStatus.TRIGGRED) {
to = $timeout(() => { getExports(false) }, 2000);
break;
}
}
}
}, (reject) => {
dialogHub.showAlert({
type: AlertTypes.Error,
title: LocaleService.t('exports.error.fetchTitle', 'Could not get export list'),
message: LocaleService.t('exports.error.genericMsg', 'Please check the console log for more information.'),
});
console.error(reject);
});
}

LocaleService.onInit(() => {
getExports(false);
});

const exportListener = exportsHub.onRefresh(() => {
getExports(true);
});

scope.$on('$destroy', () => {
exportsHub.removeMessageListener(exportListener);
});
},
templateUrl: '/services/web/platform-core/ui/templates/header.html',
})).directive('submenu', () => ({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2025 Eclipse Dirigible contributors
* Copyright (c) 2026 Eclipse Dirigible contributors
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2025 Eclipse Dirigible contributors
* Copyright (c) 2026 Eclipse Dirigible contributors
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2025 Eclipse Dirigible contributors
* Copyright (c) 2010-2026 Eclipse Dirigible contributors
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
Expand Down
Loading
Loading