attachSliceWidgets()

in src/overlay/revision-browser.ts [36:70]


  attachSliceWidgets(model: GatherModel) {
    let defSelections = model.selectedDefs;
    let outputSelections = model.selectedOutputs;
    let selectedCell;
    if (defSelections.length > 0) {
      selectedCell = defSelections[0].cell;
    } else if (outputSelections.length > 0) {
      selectedCell = outputSelections[0].cell;
    }
    let slices = model.executionLog.sliceAllExecutions(
      selectedCell.persistentId
    );
    log("Bringing up the revision browser for selection", {
      cellExecutionEventId: selectedCell.executionEventId,
      slices,
      selectedDefs: model.selectedDefs,
      selectedOutputs: model.selectedOutputs
    });
    if (slices) {
      /*
       * Only show output if the selection was output.
       */
      let includeOutput = model.selectedOutputs.length >= 1;
      let historyModel = buildHistoryModel(
        model,
        selectedCell.persistentId,
        slices,
        includeOutput
      );
      let historyViewer = new HistoryViewer({
        model: historyModel
      });
      (this.layout as PanelLayout).addWidget(historyViewer);
    }
  }