Skip to content

Commit 6246e9b

Browse files
authored
LKE-14973: Remove custom actions management (#39)
Revert "LKE-14893: Restore custom actions handling (#38)" This reverts commit 09f43bd.
1 parent e1445af commit 6246e9b

9 files changed

Lines changed: 12 additions & 217 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
## Purpose and principles
44
The plugin is used to import Third-Party Data to enrich some nodes in your graph:
55
- For example, you may have a `Company` node in your graph, and you want to enrich it with data from the [French Official Company Information API](https://annuaire-entreprises.data.gouv.fr/).
6-
- You click any `Company` node in the graph, use the `custom action` menu and click `Fetch details for French Company`.
6+
- You click any `Company` node in the graph, use the `Plugins` menu and click `Fetch details for French Company`.
77
- The plugin opens and shows a list of matching results from the French Company Information API.
88
- You select the result you want to import, which creates a new `Person_Details` node in the graph with the data from the API, linked to the original `Person` node.
99

packages/frontend/src/api/api.ts

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import {RestClient} from '@linkurious/rest-client';
2-
import {CustomAction} from '@linkurious/rest-client/dist/src/api/CustomAction/types';
32

43
import {
54
ApiResponse,
@@ -8,10 +7,7 @@ import {
87
} from '../../../shared/api/response';
98
import {MyPluginConfig, MyPluginConfigPublic} from '../../../shared/myPluginConfig';
109
import {STRINGS} from '../../../shared/strings';
11-
import {
12-
IntegrationModel,
13-
IntegrationModelPublic
14-
} from '../../../shared/integration/IntegrationModel.ts';
10+
import {IntegrationModelPublic} from '../../../shared/integration/IntegrationModel.ts';
1511

1612
function getBaseUrl(relativeUrl: string): string {
1713
return new URL(relativeUrl, document.baseURI).toString();
@@ -128,16 +124,6 @@ export class API {
128124
}
129125
}
130126

131-
async getCustomActions(integration: IntegrationModel): Promise<CustomAction[]> {
132-
const actionsR = await this.server.customAction.getCustomActions({
133-
sourceKey: integration.sourceKey
134-
});
135-
if (!actionsR.isSuccess()) {
136-
throw new Error(STRINGS.errors.customActions.loadFailed(actionsR.body));
137-
}
138-
return actionsR.body.filter((a) => a.urlTemplate.includes(`integrationId=${integration.id}`));
139-
}
140-
141127
async updatePluginConfig(config: MyPluginConfig): Promise<void> {
142128
await this.plugin('./api/admin-config', {}, 201, STRINGS.errors.setAdminConfig, config);
143129
}

packages/frontend/src/dev/apiMocks.ts

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {User, CustomAction} from '@linkurious/rest-client';
1+
import {User} from '@linkurious/rest-client';
22

33
import {
44
IntegrationModel,
@@ -264,36 +264,5 @@ export const API_MOCKS: ApiMock[] = [
264264
]
265265
}
266266
}
267-
},
268-
// lit custom actions for valid data-source
269-
{
270-
match: `/api/${validSourceKey}/customAction`,
271-
response: {
272-
body: [
273-
{
274-
id: 1,
275-
name: 'fetch person info from DnB',
276-
description: 'fetch person info from DnB yeah and some details too',
277-
sourceKey: validSourceKey,
278-
urlTemplate: `{{baseURL}}plugin/3d/?integrationId=${defaultIntegrationId}&nodeId={{node}}&sourceKey={{sourceKey}}&noise=1234356743245678543234567865432134567865432`
279-
},
280-
{
281-
id: 2,
282-
name: 'other action',
283-
description: 'this action is unrelated to this plugin',
284-
sourceKey: validSourceKey,
285-
urlTemplate: `{{baseURL}}plugin/image-export/?viz={{visualization}}&sourceKey={{sourceKey}}`
286-
}
287-
] as CustomAction[]
288-
}
289-
},
290-
// create custom action
291-
{
292-
verb: 'POST',
293-
match: `/api/${validSourceKey}/customAction`,
294-
response: {
295-
body: {},
296-
status: 201
297-
}
298267
}
299268
];

packages/frontend/src/serviceFacade.ts

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {LkEdge, LkNode, LkError, Response, User} from '@linkurious/rest-client';
22

33
import {VendorResult} from '../../shared/api/response';
4-
import {IntegrationModel, IntegrationModelPublic} from '../../shared/integration/IntegrationModel';
4+
import {IntegrationModelPublic} from '../../shared/integration/IntegrationModel';
55
import {VendorIntegrationPublic} from '../../shared/integration/vendorIntegrationPublic';
66
import {asError, clone, randomString} from '../../shared/utils';
77
import {STRINGS} from '../../shared/strings';
@@ -99,7 +99,7 @@ export class ServiceFacade {
9999
await this.config.saveNewIntegration(newIntegration);
100100
p.update(STRINGS.ui.global.done);
101101
});
102-
await this.ui.showConfirmIntegrationCreated(newIntegration);
102+
await this.ui.showConfirmIntegrationCreated();
103103
}
104104

105105
async editIntegration(integrationId: string): Promise<void> {
@@ -229,17 +229,6 @@ export class ServiceFacade {
229229
}
230230
}
231231

232-
async createCustomAction(
233-
integration: IntegrationModel,
234-
backTo: 'integration-list'
235-
): Promise<void> {
236-
console.log('CREATE_CUSTOM_ACTION: ' + JSON.stringify(integration));
237-
await this.ui.showCustomActionManager(integration);
238-
if (backTo === 'integration-list') {
239-
await this.ui.showIntegrationsList();
240-
}
241-
}
242-
243232
async deleteIntegration(integrationId: string): Promise<void> {
244233
await this.ui.longTask.run(async (p) => {
245234
p.update(STRINGS.ui.editIntegration.deletingIntegration);

packages/frontend/src/ui/edition/customActionManager.ts

Lines changed: 0 additions & 87 deletions
This file was deleted.

packages/frontend/src/ui/integrationList.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,6 @@ export class IntegrationList extends BaseUI {
5353
this.ui.button.create(STRINGS.ui.integrationList.editButton, {small: true}, () =>
5454
this.services.editIntegration(int.id)
5555
),
56-
this.ui.button.create(
57-
STRINGS.ui.integrationList.installButton,
58-
{small: true, outline: true},
59-
() => {
60-
return this.services.createCustomAction(int, 'integration-list');
61-
}
62-
),
6356
this.ui.button.create(
6457
STRINGS.ui.integrationList.deleteButton,
6558
{type: 'danger', outline: true, small: true},

packages/frontend/src/ui/uiFacade.ts

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import {IntegrationList} from './integrationList';
1313
import {IntegrationEditor} from './integrationEditor';
1414
import {Button} from './button';
1515
import {SearchResults} from './searchResults';
16-
import {CustomActionManager} from './edition/customActionManager';
1716

1817
export class UiFacade {
1918
private readonly services: ServiceFacade;
@@ -79,11 +78,6 @@ export class UiFacade {
7978
await integrationList.show();
8079
}
8180

82-
async showCustomActionManager(integration: IntegrationModel): Promise<void> {
83-
const cam = new CustomActionManager(this.services);
84-
await cam.show(integration);
85-
}
86-
8781
async showEmptyState(): Promise<void> {
8882
this.showContent(
8983
$elem('div', {class: 'alert alert-primary', role: 'alert'}, [
@@ -93,20 +87,13 @@ export class UiFacade {
9387
);
9488
}
9589

96-
async showConfirmIntegrationCreated(newIntegration: IntegrationModel): Promise<void> {
90+
async showConfirmIntegrationCreated(): Promise<void> {
9791
await this.popIn.showElement(
9892
STRINGS.ui.integrationCreated.title,
9993
$elem('p', {}, STRINGS.ui.integrationCreated.message),
10094
[
101-
this.button.create(
102-
STRINGS.ui.integrationCreated.dontCreateCustomActionButton,
103-
{type: 'secondary'},
104-
() => this.popIn.close()
105-
),
106-
this.button.create(
107-
STRINGS.ui.integrationCreated.createCustomActionButton,
108-
{},
109-
async () => await this.showCustomActionManager(newIntegration)
95+
this.button.create(STRINGS.ui.integrationCreated.confirmModalCloseButton, {}, () =>
96+
this.popIn.close()
11097
)
11198
]
11299
);

packages/shared/integration/vendorIntegrationPublic.ts

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
import {
2-
ICreateNodeParams,
3-
ICreateEdgeParams,
4-
ICreateCustomActionParams,
5-
SharingMode,
6-
LkNode
7-
} from '@linkurious/rest-client';
1+
import {ICreateNodeParams, ICreateEdgeParams, LkNode} from '@linkurious/rest-client';
82

93
import {PluginAction} from '../../backend/src/server/api';
104
import {NeighborResult, VendorResult} from '../api/response';
@@ -165,21 +159,6 @@ export class VendorIntegrationPublic<VI extends IntegrationModelPublic = Integra
165159
return inputValue;
166160
}
167161

168-
getCustomAction(basePath: string): ICreateCustomActionParams {
169-
return {
170-
sourceKey: this.model.sourceKey,
171-
name: STRINGS.customAction.name(this.vendor),
172-
description: STRINGS.customAction.details(this.vendor),
173-
urlTemplate: `{{baseURL}}plugins/${basePath}/?action=search&integrationId=${
174-
this.model.id
175-
}&sourceKey=${this.model.sourceKey}&nodeId={{node:${JSON.stringify(
176-
this.model.inputNodeCategory
177-
)}}}#linkurious-modal`,
178-
sharing: SharingMode.SOURCE,
179-
sharedWithGroups: undefined
180-
};
181-
}
182-
183162
getPluginAction(): PluginAction {
184163
return {
185164
sourceKey: this.model.sourceKey,

packages/shared/strings/index.ts

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {GraphItemSchema, GraphPropertySchema} from '../api/response';
1111
import {VendorIntegration} from '../integration/vendorIntegration';
1212

1313
export const STRINGS = {
14-
emptyStatePrefix: `To use this plugin, please set up an integration and run it via a Custom Action. For details, please check the `,
14+
emptyStatePrefix: `To use this plugin, please set up an integration. For details, please check the `,
1515
emptyStateLinkText: 'online documentation',
1616
emptyStateLinkUrl: 'https://github.com/Linkurious/lke-plugin-third-party-data#readme',
1717
errors: {
@@ -98,10 +98,6 @@ export const STRINGS = {
9898
getAdminConfig: `Could not get the plugin's admin-configuration`,
9999
setAdminConfig: `Could not update the plugin's admin-configuration`,
100100
getUserConfig: `Could not get the plugin's user-configuration`,
101-
customActions: {
102-
loadFailed: (error: LkError): string => `Failed to get custom actions: ${error.message}`,
103-
deleteFailed: (error: LkError): string => `Failed to delete custom action: ${error.message}`
104-
},
105101
multiSelector: {
106102
listUndefined: 'Unexpected error: list is empty'
107103
},
@@ -131,11 +127,6 @@ export const STRINGS = {
131127
integrationNotFound: (integrationId: string): string =>
132128
`Integration ${integrationId} was not found`
133129
},
134-
customAction: {
135-
name: (vendor: Vendor): string => `Fetch details from ${vendor.name}`,
136-
details: (vendor: Vendor): string =>
137-
`Get details from ${vendor.name} (action auto-generated by the third-party data plugin)`
138-
},
139130
pluginAction: {
140131
name: (vendor: Vendor): string => `Fetch details from ${vendor.name}`
141132
},
@@ -144,16 +135,6 @@ export const STRINGS = {
144135
constant: `Fixed value`,
145136
actionColumnHead: 'Action'
146137
},
147-
customActionManager: {
148-
title: 'Manage custom actions for this integration',
149-
description: `Custom actions are used to launch an integration from a node context-menu`,
150-
deleteButton: 'Delete',
151-
noCustomActions: `No custom action found for this integration, you can create one using the button bellow.`,
152-
addActionDescription: 'This will create a new custom action, shared at the data-source level',
153-
addButton: 'Add custom action',
154-
listTitle: (actions: number): string =>
155-
`Found ${actions} custom action(s) for this integration:`
156-
},
157138
global: {
158139
closeButton: 'Close',
159140
noValue: '(No value)',
@@ -204,7 +185,6 @@ export const STRINGS = {
204185
title: 'Integrations list',
205186
actionsHeader: 'Actions',
206187
editButton: 'Edit',
207-
installButton: 'Install',
208188
deleteButton: 'Delete',
209189
addButton: 'Add integration',
210190
vendorHeader: 'Vendor API',
@@ -238,9 +218,8 @@ export const STRINGS = {
238218
},
239219
integrationCreated: {
240220
title: 'Integration created successfully',
241-
message: `The new integration was successfully saved. You can install this integration by adding a custom action to launch it from a node's context menu.`,
242-
createCustomActionButton: 'Install integration',
243-
dontCreateCustomActionButton: 'Later'
221+
message: 'The new integration was successfully saved.',
222+
confirmModalCloseButton: 'Close'
244223
}
245224
}
246225
};

0 commit comments

Comments
 (0)