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

Method cloneGroup

src/services/workbench/editorService.ts:733–756  ·  view source on GitHub ↗
(groupId?: UniqueId)

Source from the content-addressed store, hash-verified

731 }
732
733 public cloneGroup(groupId?: UniqueId): IEditorGroup {
734 const { current, groups = [] } = this.state;
735
736 const cloneGroup: IEditorGroup = Object.assign(
737 {},
738 groupId ? this.getGroupById(groupId) : current
739 );
740
741 // get an random id for new group
742 const id = randomId();
743
744 const initialTab = Object.assign({}, cloneGroup.tab);
745 cloneGroup.data = [initialTab];
746 cloneGroup.tab = initialTab;
747 cloneGroup.activeTab = initialTab.id;
748 cloneGroup.id = id;
749
750 this.setState({
751 current: cloneGroup,
752 groups: [...groups, cloneGroup],
753 });
754
755 return cloneGroup;
756 }
757
758 public onUpdateTab(callback: (tab: IEditorTab) => void) {
759 this.subscribe(EditorEvent.OnUpdateTab, callback);

Callers

nothing calls this directly

Calls 3

getGroupByIdMethod · 0.95
randomIdFunction · 0.90
setStateMethod · 0.80

Tested by

no test coverage detected