84 lines
3.5 KiB
JavaScript
84 lines
3.5 KiB
JavaScript
(function (w) {
|
|
'use strict';
|
|
var icons = 'c4it-f4sd-icons';
|
|
w.mx = w.mx || {};
|
|
w.mx.workspacesConfig = w.mx.workspacesConfig || {};
|
|
w.mx.workspacesConfig.modules = w.mx.workspacesConfig.modules || {};
|
|
w.mx.workspacesConfig.modules.add = w.mx.workspacesConfig.modules.add || function (name, config) {
|
|
w.mx.workspacesConfig.modules[name] = config;
|
|
};
|
|
|
|
w.mx.workspacesConfig.modules.add('mx.C4IT.F4SD', {
|
|
name: 'mx.C4IT.F4SD',
|
|
config: ['$mdIconProvider', function ($mdIconProvider) {
|
|
$mdIconProvider.iconSet(icons, 'workspaces/C4IT_F4SD/F4SDIcons.svg');
|
|
|
|
w.mx = w.mx || {};
|
|
w.mx.components = w.mx.components || {};
|
|
w.mx.components.Icons = w.mx.components.Icons || {};
|
|
|
|
w.mx.components.Icons.unshift({
|
|
'id': icons,
|
|
'name': 'C4IT F4SD Icons',
|
|
'icons': [{
|
|
'SVG': true,
|
|
'id': icons + ':icon-f4sd',
|
|
'name': 'F4SD Icon',
|
|
'keywords': ['c4it', 'custom', 'f4sd']
|
|
}, {
|
|
'SVG': true,
|
|
'id': icons + ':icon-f4sd-coloured',
|
|
'name': 'F4SD Icon (coloured)',
|
|
'keywords': ['c4it', 'custom', 'f4sd']
|
|
}
|
|
]
|
|
});
|
|
}
|
|
]
|
|
});
|
|
})(window);
|
|
(function (w) {
|
|
'use strict';
|
|
|
|
angular.module("mx.C4IT.F4SD").controller("mx.C4IT.F4SD.Actions.callF4SD", ["mx.shell.Config", "mx.SolutionBuilderAgent.Http", "mx.shell.NotificationService", "mx.internationalization", function (shellConfig, $http, notificationService, i18n) {
|
|
var vm = this;
|
|
this.restHost = shellConfig.settings.restHosts.default;
|
|
this.messageF4SDOpened = i18n.get('c4it.f4sd.action-open-called') || 'F4SD is beeing opened...';
|
|
this.execute = function (conf, para) {
|
|
// called from context menu grid || in dialog
|
|
var eoid = conf[0]['Sys-ObjectId'] || conf[0].ID;
|
|
|
|
// get action parameters
|
|
try {
|
|
vm.controllerParams = new URLSearchParams(para.controllerParams);
|
|
} catch (error) {
|
|
console.log(error);
|
|
notificationService.error("Action config parameters format exception");
|
|
return;
|
|
}
|
|
|
|
// get f4sd url
|
|
const uri = new URL("/api/c4itf4sdwebapi/getdirectlinkf4sd/", vm.restHost);
|
|
uri.searchParams.append("type", vm.controllerParams.get("type") || para.name);
|
|
uri.searchParams.append("eoid", eoid);
|
|
$http.get(uri.pathname + uri.search).then(function (n) {
|
|
try {
|
|
const F4SDUrl = new URL(n);
|
|
if (F4SDUrl.protocol == "f4sdsend:" && F4SDUrl.pathname == "//localhost/") {
|
|
if (vm.controllerParams.has("showNotification") && vm.controllerParams.get("showNotification") == 1)
|
|
notificationService.info(vm.messageF4SDOpened);
|
|
window.location.href = n;
|
|
}
|
|
} catch (error) {
|
|
console.log(error); // => TypeError, "Failed to construct URL: Invalid URL"
|
|
notificationService.error("Service not available");
|
|
}
|
|
}, function errorCallback(response) {
|
|
console.log(response);
|
|
notificationService.error("Service not available");
|
|
});
|
|
};
|
|
}
|
|
]);
|
|
})(window);
|