Skip to content

Commit e2da09a

Browse files
committed
feat: node management UI
1 parent a7778cc commit e2da09a

File tree

30 files changed

+339
-165
lines changed

30 files changed

+339
-165
lines changed

src/main/resources/META-INF/resources/webjars/home/home.js

Lines changed: 3 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ define(['cascade'], function ($cascade) {
8686
return;
8787
}
8888

89-
const service = current.getServiceNameFromId(node);
89+
const service = current.$main.getServiceNameFromId(node);
9090
const path = 'main/service/' + service + '/';
9191
if (path === context.$path) {
9292
// Current context is loaded
@@ -135,8 +135,8 @@ define(['cascade'], function ($cascade) {
135135
}
136136

137137
// Then, load tool dependencies
138-
const service = current.getServiceNameFromId(node);
139-
const tool = current.getToolNameFromId(node);
138+
const service = current.$main.getServiceNameFromId(node);
139+
const tool = current.$main.getToolNameFromId(node);
140140
const path = 'main/service/' + service + '/' + tool;
141141
if (path === context.$path) {
142142
// Current context is loaded
@@ -157,74 +157,6 @@ define(['cascade'], function ($cascade) {
157157
});
158158
},
159159

160-
/**
161-
* Return the tool identifier part from a node identifier. It's the first level of refinement, just
162-
* after service. This corresponds to the first implementation of a service.
163-
*/
164-
getToolFromId: function (id) {
165-
// Pattern is : service:{service name}:{tool name}(:whatever)
166-
const data = id.split(':');
167-
return data.length > 2 && data.slice(0, 3).join('-');
168-
},
169-
170-
/**
171-
* Return the identifier of each hierarchy nodes until the service.
172-
*/
173-
getHierarchyId: function (id) {
174-
// Pattern is : service:{service name}:{tool name}(:whatever)
175-
const data = id.split(':');
176-
let index;
177-
let result = '';
178-
for (index = 2; index <= data.length; index++) {
179-
result += ' ' + data.slice(0, index).join('-');
180-
}
181-
return result;
182-
},
183-
184-
/**
185-
* Return the service identifier part from a node identifier.
186-
*/
187-
getServiceFromId: function (id) {
188-
// Pattern is : service:{service name}:{tool name}(:whatever)
189-
const data = id.split(':');
190-
return data.length > 1 && data.slice(0, 2).join('-');
191-
},
192-
193-
/**
194-
* Return the service simple name part from a node identifier.
195-
*/
196-
getServiceNameFromId: function (id) {
197-
// Pattern is : service:{service name}:{tool name}(:whatever)
198-
return id.split(':')[1];
199-
},
200-
201-
/**
202-
* Return the service simple name part from a node identifier.
203-
*/
204-
getToolNameFromId: function (id) {
205-
// Pattern is : service:{service name}:{tool name}(:whatever)
206-
return id.split(':')[2];
207-
},
208-
209-
/**
210-
* Icon of corresponding tool, and entity's "name".
211-
*/
212-
toIconNameTool: function (node) {
213-
return current.toIcon(node) + '<span class="hidden-xs"' + (node.description ? ' title="' + node.description + '"' : '') + '> ' + current.$main.getNodeName(node) + '</span>';
214-
},
215-
216-
toToolBaseIcon: function (node) {
217-
const fragments = node.split(':');
218-
return 'main/service/' + fragments[1] + '/' + fragments[2] + '/img/' + fragments[2];
219-
},
220-
221-
/**
222-
* Icon of corresponding tool.
223-
*/
224-
toIcon: function (node, suffix, dataSrc) {
225-
return current.$main.toIcon(node, suffix, dataSrc);
226-
},
227-
228160
/**
229161
* Return the "name" of the given entity
230162
*/

src/main/resources/META-INF/resources/webjars/home/home/home.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ define([
402402
if (node.refined && node.refined.refined === undefined) {
403403
// Wrapper
404404
var counters = current.toCounter(node.subscriptions.length, node.nbProjects);
405-
nodeContent = '<div class="node show ' + current.gridClass + ' ' + current.$parent.getHierarchyId(node.id) + '" data-id="' + node.id + '"><div class="thumbnail"><div class="main"><div class="counters"> '+ `<span class="badge nb-total ${counters > 1 ? "" : "hidden"} </span>` + ' data-toggle="tooltip" data-container="#_ucDiv" title="' + current.$messages['node-subscriptions'] + '">' + counters + '</span><span class="badge nb-filtered hidden" data-toggle="tooltip" data-container="#_ucDiv" title="' + current.$messages['node-subscriptions-filtered'] + '"></span></div>' + current.$parent.toIcon(node, 'x64w', true) + '<div class="caption"><h3>' + node.name + ' <i class="fas fa-caret-right" data-toggle="tooltip" data-container="#_ucDiv" title="' + current.$messages['toggle-thumbnail'] + '"></i></h3></div>';
405+
nodeContent = '<div class="node show ' + current.gridClass + ' ' + current.$main.getHierarchyId(node.id) + '" data-id="' + node.id + '"><div class="thumbnail"><div class="main"><div class="counters"> '+ `<span class="badge nb-total ${counters > 1 ? "" : "hidden"} </span>` + ' data-toggle="tooltip" data-container="#_ucDiv" title="' + current.$messages['node-subscriptions'] + '">' + counters + '</span><span class="badge nb-filtered hidden" data-toggle="tooltip" data-container="#_ucDiv" title="' + current.$messages['node-subscriptions-filtered'] + '"></span></div>' + current.$main.toIcon(node, 'x64w', true) + '<div class="caption"><h3>' + node.name + ' <i class="fas fa-caret-right" data-toggle="tooltip" data-container="#_ucDiv" title="' + current.$messages['toggle-thumbnail'] + '"></i></h3></div>';
406406
// Tag
407407
tagUiClasses = node.tag && (node.tagUiClasses || (node.refined && (node.refined.tagUiClasses || (node.refined.refined && node.refined.tagUiClasses))));
408408
if (tagUiClasses) {
@@ -728,7 +728,7 @@ define([
728728
if (!loopStatus.toolDisplayed) {
729729
loopStatus.toolDisplayed = true;
730730
tr += '<td rowspan="' + tool.specifics.length + '" class="status status-' + tool.value.toLowerCase() + '"><div class="status-content">&nbsp;</div></td>';
731-
tr += '<td class="icon-xs" rowspan="' + tool.specifics.length + '">' + current.$parent.toIcon(tool.node) + '<span class="hidden-xs" title="' + tool.description + '"> ' + tool.node.name + '</span></td>';
731+
tr += '<td class="icon-xs" rowspan="' + tool.specifics.length + '">' + current.$main.toIcon(tool.node) + '<span class="hidden-xs" title="' + tool.description + '"> ' + tool.node.name + '</span></td>';
732732
}
733733
tr += '<td class="status status-' + nodeEvent.value.toLowerCase() + '"><div class="status-content">&nbsp;</div></td>';
734734
tr += '<td>' + node.name + '<a class="refresh-node pull-right"><i class="fas fa-sync-alt"></i></a></td><td data-id="' + node.id + '"></td></tr>';

src/main/resources/META-INF/resources/webjars/home/nls/fr/messages.js

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,6 @@
44
define({
55
'title': 'Accueil',
66
'subscription-date': 'Date de souscription',
7-
'actions': 'Actions',
8-
'service': 'Service',
9-
'parameters': 'Paramètres',
10-
'subscription': 'Souscription',
11-
'features': 'Fonctionnalités',
12-
'details': 'Détails',
13-
'mode': 'Mode',
147
'service:help': 'Aide',
158
'status-service': 'État global du service',
169
'status-tool': 'État global de l\'outil',
@@ -21,9 +14,5 @@ define({
2114
'status-subscription-none': 'Pas de souscription',
2215
'statusRefreshed': 'Les statuts ont été mis à jour',
2316
'refreshNodeTitle': 'Rafraîchir le statut des nœuds',
24-
'refreshSubTitle': 'Rafraîchir le statut des souscriptions',
25-
'mode-create': 'Créer',
26-
'mode-link': 'Lier',
27-
'mode-create-description': 'Créer une nouvelle instance dans l\'outil cible. Cette instance sera ensuite liée à ce projet comme dans le mode "lier".',
28-
'mode-link-description': 'Lier ce projet à une instance existante dans l\'outil cible. Utile pour rapprocher le projet à des instances précédemment créées manuellement.'
17+
'refreshSubTitle': 'Rafraîchir le statut des souscriptions'
2918
});

src/main/resources/META-INF/resources/webjars/home/nls/messages.js

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,6 @@ define({
55
root: {
66
'title': 'Home',
77
'subscription-date': 'Subscription date',
8-
'actions': 'Actions',
9-
'service': 'Service',
10-
'parameters': 'Parameters',
11-
'subscription': 'Subscription',
12-
'features': 'Features',
13-
'details': 'Details',
14-
'mode': 'Mode',
158
'service:help': 'Help',
169
'status-service': 'Global status of the service',
1710
'status-tool': 'Global status of the tool',
@@ -22,11 +15,7 @@ define({
2215
'status-subscription-none': 'No subscription',
2316
'statusRefreshed': 'Status has been refreshed',
2417
'refreshNodeTitle': 'Refresh nodes status',
25-
'refreshSubTitle': 'Refresh subscriptions status',
26-
'mode-create': 'Create',
27-
'mode-link': 'Link',
28-
'mode-create-description': 'Create a new instance inside the target tool. Then, this instance will be linked to this project as the "link" mode.',
29-
'mode-link-description': 'Link this project to an existing instance in the target tool. Useful to link this project to a previously and manually created instance in this tool.'
18+
'refreshSubTitle': 'Refresh subscriptions status'
3019
},
3120
fr: true
3221
});

src/main/resources/META-INF/resources/webjars/home/project/project.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,7 @@ define(['cascade'], function ($cascade) {
643643
className: 'hidden-xs service',
644644
render: function (_i, mode, subscription) {
645645
if (mode === 'display') {
646-
return current.$parent.toIcon(subscription.node.refined.refined);
646+
return current.$main.toIcon(subscription.node.refined.refined);
647647
}
648648
return subscription.node.refined.refined.name;
649649
}
@@ -652,7 +652,7 @@ define(['cascade'], function ($cascade) {
652652
className: 'responsive-tool icon-xs tool truncate',
653653
render: function (_i, mode, subscription) {
654654
if (mode === 'display') {
655-
return current.$parent.toIconNameTool(subscription.node.refined);
655+
return current.$main.toIconNameTool(subscription.node.refined);
656656
}
657657
return subscription.node.refined.name;
658658
}
@@ -709,16 +709,16 @@ define(['cascade'], function ($cascade) {
709709
// Add service/too/node TD
710710
if (dataSrc === 'node.id') {
711711
// Node mode
712-
$tr.append('<td>' + current.$parent.toIcon(subscription.node.refined.refined) + '</td>');
713-
$tr.append('<td>' + current.$parent.toIconNameTool(subscription.node.refined) + '</td>');
712+
$tr.append('<td>' + current.$main.toIcon(subscription.node.refined.refined) + '</td>');
713+
$tr.append('<td>' + current.$main.toIconNameTool(subscription.node.refined) + '</td>');
714714
$tr.append('<td colspan="' + (project.manageSubscriptions ? 4 : 3) + '">' + subscription.node.name + '</td>');
715715
} else if (dataSrc === 'node.refined.id' || dataSrc === 'node.id') {
716716
// Tool mode
717-
$tr.append('<td>' + current.$parent.toIcon(subscription.node.refined.refined) + '</td>');
718-
$tr.append('<td colspan="' + (project.manageSubscriptions ? 5 : 4) + '">' + current.$parent.toIconNameTool(subscription.node.refined) + '</td>');
717+
$tr.append('<td>' + current.$main.toIcon(subscription.node.refined.refined) + '</td>');
718+
$tr.append('<td colspan="' + (project.manageSubscriptions ? 5 : 4) + '">' + current.$main.toIconNameTool(subscription.node.refined) + '</td>');
719719
} else if (dataSrc === 'node.refined.refined.id') {
720720
// Service mode
721-
$tr.append('<td colspan="' + (project.manageSubscriptions ? 6 : 5) + '">' + current.$parent.toIcon(subscription.node.refined.refined) + '&nbsp;' + subscription.node.refined.refined.name + '</td>');
721+
$tr.append('<td colspan="' + (project.manageSubscriptions ? 6 : 5) + '">' + current.$main.toIcon(subscription.node.refined.refined) + '&nbsp;' + subscription.node.refined.refined.name + '</td>');
722722
} else {
723723
// Orphan group
724724
$tr.append('<td colspan="' + (project.manageSubscriptions ? 6 : 5) + '">' + current.$messages['group-by-other'] + '</td>');
@@ -779,7 +779,7 @@ define(['cascade'], function ($cascade) {
779779
_('details').addClass('hidden');
780780
current.unloadConfiguration()
781781

782-
$cascade.loadFragment(current, current.$transaction, 'main/home/project/subscribe-wizard', 'subscribe-wizard', {
782+
$cascade.loadFragment(current, current.$transaction, 'main/subscribe-wizard', 'subscribe-wizard', {
783783
callback: function (context) {
784784
context.setModel(project);
785785
},
@@ -835,7 +835,7 @@ define(['cascade'], function ($cascade) {
835835
callback && callback(data);
836836

837837
// Inject the icon
838-
$subscribeWrapper.find('.subscription-icon-tool').html(`${current.$parent.toIcon(service)} <i class="fas fa-chevron-right"></i> ${current.$parent.toIcon(data.node, 'x64')}`);
838+
$subscribeWrapper.find('.subscription-icon-tool').html(`${current.$main.toIcon(service)} <i class="fas fa-chevron-right"></i> ${current.$main.toIcon(data.node, 'x64')}`);
839839
} else {
840840
// Not managed configuration for this service
841841
traceLog('No managed configuration for service ' + service.id);

src/main/resources/META-INF/resources/webjars/main.js

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,67 @@ define(['cascade'], function ($cascade) {
414414
return str.toLowerCase();
415415
},
416416

417+
/**
418+
* Return the tool identifier part from a node identifier. It's the first level of refinement, just
419+
* after service. This corresponds to the first implementation of a service.
420+
*/
421+
getToolFromId: function (id) {
422+
// Pattern is : service:{service name}:{tool name}(:whatever)
423+
const data = id.split(':');
424+
return data.length > 2 && data.slice(0, 3).join('-');
425+
},
426+
427+
/**
428+
* Return the identifier of each hierarchy nodes until the service.
429+
*/
430+
getHierarchyId: function (id) {
431+
// Pattern is : service:{service name}:{tool name}(:whatever)
432+
const data = id.split(':');
433+
let index;
434+
let result = '';
435+
for (index = 2; index <= data.length; index++) {
436+
result += ' ' + data.slice(0, index).join('-');
437+
}
438+
return result;
439+
},
440+
441+
/**
442+
* Return the service identifier part from a node identifier.
443+
*/
444+
getServiceFromId: function (id) {
445+
// Pattern is : service:{service name}:{tool name}(:whatever)
446+
const data = id.split(':');
447+
return data.length > 1 && data.slice(0, 2).join('-');
448+
},
449+
450+
/**
451+
* Return the service simple name part from a node identifier.
452+
*/
453+
getServiceNameFromId: function (id) {
454+
// Pattern is : service:{service name}:{tool name}(:whatever)
455+
return id.split(':')[1];
456+
},
457+
458+
/**
459+
* Return the service simple name part from a node identifier.
460+
*/
461+
getToolNameFromId: function (id) {
462+
// Pattern is : service:{service name}:{tool name}(:whatever)
463+
return id.split(':')[2];
464+
},
465+
466+
/**
467+
* Icon of corresponding tool, and entity's "name".
468+
*/
469+
toIconNameTool: function (node) {
470+
return current.toIcon(node) + '<span class="hidden-xs"' + (node.description ? ' title="' + node.description + '"' : '') + '> ' + current.getNodeName(node) + '</span>';
471+
},
472+
473+
toToolBaseIcon: function (node) {
474+
const fragments = node.split(':');
475+
return 'main/service/' + fragments[1] + '/' + fragments[2] + '/img/' + fragments[2];
476+
},
477+
417478
/**
418479
* Object type to class mapping.
419480
*/

src/main/resources/META-INF/resources/webjars/nls/fr/messages.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,17 @@ define({
9797
'isolated-details': '<i class="fas fa-sign-out"></i> Est également isolé de la société {{this}}',
9898
'low-resolution': 'Résolution actuelle non adaptée pour la meilleure expérience, utilisez un appareil plus large',
9999
'restore-visibility': 'Restaurer',
100+
'actions': 'Actions',
101+
'service': 'Service',
102+
'parameters': 'Paramètres',
103+
'subscription': 'Souscription',
104+
'features': 'Fonctionnalités',
105+
'details': 'Détails',
106+
'mode': 'Mode',
107+
'mode-create': 'Créer',
108+
'mode-link': 'Lier',
109+
'mode-create-description': 'Créer une nouvelle instance dans l\'outil cible. Cette instance sera ensuite liée à ce projet comme dans le mode "lier".',
110+
'mode-link-description': 'Lier ce projet à une instance existante dans l\'outil cible. Utile pour rapprocher le projet à des instances précédemment créées manuellement.',
100111
'menu': {
101112
home: 'Accueil',
102113
about: 'A propos',

src/main/resources/META-INF/resources/webjars/nls/messages.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,17 @@ define({
100100
'isolated-details': '<i class="fas fa-sign-out"></i> Is also isolated from company {{this}}',
101101
'low-resolution': 'Current resolution is not suitable to the best experience, switch to wider device',
102102
'restore-visibility': 'Restore',
103+
'actions': 'Actions',
104+
'service': 'Service',
105+
'parameters': 'Parameters',
106+
'subscription': 'Subscription',
107+
'features': 'Features',
108+
'details': 'Details',
109+
'mode': 'Mode',
110+
'mode-create': 'Create',
111+
'mode-link': 'Link',
112+
'mode-create-description': 'Create a new instance inside the target tool. Then, this instance will be linked to this project as the "link" mode.',
113+
'mode-link-description': 'Link this project to an existing instance in the target tool. Useful to link this project to a previously and manually created instance in this tool.',
103114
'menu': {
104115
home: 'Home',
105116
about: 'About',

src/main/resources/META-INF/resources/webjars/home/node-parameter/nls/fr/messages.js renamed to src/main/resources/META-INF/resources/webjars/node-parameter/nls/fr/messages.js

File renamed without changes.

src/main/resources/META-INF/resources/webjars/home/node-parameter/nls/messages.js renamed to src/main/resources/META-INF/resources/webjars/node-parameter/nls/messages.js

File renamed without changes.

0 commit comments

Comments
 (0)