MCPcopy Create free account
hub / github.com/DTStack/molecule / closeAll

Method closeAll

src/services/workbench/editorService.ts:692–731  ·  view source on GitHub ↗
(groupId: UniqueId)

Source from the content-addressed store, hash-verified

690 }
691
692 public closeAll(groupId: UniqueId) {
693 const { current, groups = [] } = this.state;
694 const groupIndex = this.getGroupIndexById(groupId);
695
696 if (groupIndex > -1) {
697 const nextGroups = [...groups];
698 let nextCurrentGroup = current;
699
700 const removedGroup = nextGroups.splice(groupIndex, 1);
701
702 const removed = cloneDeep(
703 removedGroup[0].data?.filter(
704 (item) => !this.isOpened(item.id!, nextGroups)
705 ) || []
706 );
707
708 if (current && current.id === groupId) {
709 nextCurrentGroup =
710 groups[groupIndex + 1] || groups[groupIndex - 1];
711 }
712
713 this.setState(
714 {
715 groups: nextGroups,
716 current: nextCurrentGroup,
717 },
718 () => {
719 // dispose all models in specific group
720 this.disposeModel(removed);
721 this.explorerService.forceUpdate();
722 }
723 );
724 // reset editor group
725 this.layoutService.setGroupSplitSize(
726 nextGroups.length
727 ? new Array(nextGroups.length + 1).fill('auto')
728 : []
729 );
730 }
731 }
732
733 public cloneGroup(groupId?: UniqueId): IEditorGroup {
734 const { current, groups = [] } = this.state;

Callers

nothing calls this directly

Calls 6

getGroupIndexByIdMethod · 0.95
isOpenedMethod · 0.95
disposeModelMethod · 0.95
setStateMethod · 0.80
forceUpdateMethod · 0.80
setGroupSplitSizeMethod · 0.65

Tested by

no test coverage detected