mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 03:29:02 +01:00 
			
		
		
		
	chore(client/ts): port bulk_actions/abstract_bulk_action
This commit is contained in:
		
							parent
							
								
									4505564f13
								
							
						
					
					
						commit
						ac75e72491
					
				| @ -2,9 +2,17 @@ import { t } from "../../services/i18n.js"; | |||||||
| import server from "../../services/server.js"; | import server from "../../services/server.js"; | ||||||
| import ws from "../../services/ws.js"; | import ws from "../../services/ws.js"; | ||||||
| import utils from "../../services/utils.js"; | import utils from "../../services/utils.js"; | ||||||
|  | import FAttribute from "../../entities/fattribute.js"; | ||||||
| 
 | 
 | ||||||
| export default class AbstractBulkAction { | interface ActionDefinition { | ||||||
|     constructor(attribute, actionDef) { | 
 | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | export default abstract class AbstractBulkAction { | ||||||
|  |     attribute: FAttribute; | ||||||
|  |     actionDef: ActionDefinition; | ||||||
|  | 
 | ||||||
|  |     constructor(attribute: FAttribute, actionDef: ActionDefinition) { | ||||||
|         this.attribute = attribute; |         this.attribute = attribute; | ||||||
|         this.actionDef = actionDef; |         this.actionDef = actionDef; | ||||||
|     } |     } | ||||||
| @ -20,18 +28,18 @@ export default class AbstractBulkAction { | |||||||
|             utils.initHelpDropdown($rendered); |             utils.initHelpDropdown($rendered); | ||||||
| 
 | 
 | ||||||
|             return $rendered; |             return $rendered; | ||||||
|         } |         } catch (e: any) { | ||||||
|         catch (e) { |  | ||||||
|             logError(`Failed rendering search action: ${JSON.stringify(this.attribute.dto)} with error: ${e.message} ${e.stack}`); |             logError(`Failed rendering search action: ${JSON.stringify(this.attribute.dto)} with error: ${e.message} ${e.stack}`); | ||||||
|             return null; |             return null; | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     // to be overridden
 |     // to be overridden
 | ||||||
|     doRender() {} |     abstract doRender(): JQuery<HTMLElement>; | ||||||
|  |     abstract get actionName(): string; | ||||||
| 
 | 
 | ||||||
|     async saveAction(data) { |     async saveAction(data: {}) { | ||||||
|         const actionObject = Object.assign({ name: this.constructor.actionName }, data); |         const actionObject = Object.assign({ name: (this.constructor as unknown as AbstractBulkAction).actionName }, data); | ||||||
| 
 | 
 | ||||||
|         await server.put(`notes/${this.attribute.noteId}/attribute`, { |         await server.put(`notes/${this.attribute.noteId}/attribute`, { | ||||||
|             attributeId: this.attribute.attributeId, |             attributeId: this.attribute.attributeId, | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Elian Doran
						Elian Doran