1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-08-31 22:54:11 +00:00
Files
seahub/frontend/src/pages/org-admin/departments/department-node.js
Michael An 31e0b24e07 12.0 department set quota (#7736)
* 01 system admin department set quota

* 02 org admin department set quota
2025-04-15 13:46:17 +08:00

40 lines
842 B
JavaScript

class DepartmentNode {
constructor(props) {
this.id = props.id || '';
this.name = props.name || '';
this.children = props.children || [];
this.parentNode = props.parentNode || null;
this.orgId = props.orgId || '';
this.quota = props.quota || -2;
}
findNodeById(nodeId) {
if (this.id === nodeId) return this;
const s = [...this.children];
while (s.length > 0) {
const node = s.shift();
if (node.id === nodeId) return node;
s.push(...node.children);
}
}
addChildren(nodes) {
this.children.push(...nodes);
}
setChildren(nodes) {
this.children = nodes;
}
hasChildren() {
return this.children.length > 0;
}
deleteChildById(nodeId) {
this.children = this.children.filter(nodeItem => nodeItem.id !== nodeId);
}
}
export default DepartmentNode;