1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-20 13:59:40 +02:00

refactor(custom-templates): migrate list component to react [EE-6206] (#10440)

This commit is contained in:
Chaim Lev-Ari 2023-10-23 20:00:50 +03:00 committed by GitHub
parent 14129632a3
commit 10c3ed42f0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 108 additions and 174 deletions

View file

@ -22,11 +22,6 @@ export default class KubeCustomTemplatesViewController {
this.validateForm = this.validateForm.bind(this);
this.confirmDelete = this.confirmDelete.bind(this);
this.selectTemplate = this.selectTemplate.bind(this);
this.isSelected = this.isSelected.bind(this);
}
isSelected(templateId) {
return this.state.selectedTemplate && this.state.selectedTemplate.Id === templateId;
}
selectTemplate(template) {
@ -70,7 +65,7 @@ export default class KubeCustomTemplatesViewController {
var template = _.find(this.templates, { Id: templateId });
await this.CustomTemplateService.remove(templateId);
this.Notifications.success('Template successfully deleted', template && template.Title);
_.remove(this.templates, { Id: templateId });
this.templates = this.templates.filter((template) => template.Id !== templateId);
} catch (err) {
this.Notifications.error('Failure', err, 'Failed to delete template');
}