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:
parent
14129632a3
commit
10c3ed42f0
9 changed files with 108 additions and 174 deletions
|
@ -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');
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue