respondWorkflow = (view, wf, wfres, req, res, table) => {
  const wrap = (contents, noCard, previewURL) => ({
    above: [
      {
        type: "breadcrumbs",
        crumbs: [
          { text: req.__("Views"), href: "/viewedit" },
          {
            href: `/view/${view.name}`,
            text: view.name,
            postLinkText: `[${view.viewtemplate}${
              table
                ? ` on ${a(
                    { href: `/table/` + encodeURIComponent(table.name) },
                    table.name
                  )}`
                : ""
            }]`,
          },
          { workflow: wf, step: wfres },
        ],
      },
      {
        type: noCard ? "container" : "card",
        class: !noCard && "mt-0",
        title: wfres.title,
        titleAjaxIndicator: true,
        contents,
      },
      ...(previewURL
        ? [
            {
              type: "card",
              title: req.__("Preview"),
              contents: div(
                div(pre({ id: "viewcfg-preview-error", class: "text-danger" })),
                div(
                  { id: "viewcfg-preview", "data-preview-url": previewURL },
                  script(domReady(`updateViewPreview()`))
                )
              ),
            },
          ]
        : []),
    ],
  });
  if (wfres.flash) req.flash(wfres.flash[0], wfres.flash[1]);
  if (wfres.renderForm)
    res.sendWrap(
      {
        title: req.__(`%s configuration`, view.name),
        headers: [
          {
            script: `/static_assets/${db.connectObj.version_tag}/jquery-menu-editor.min.js`,
          },
          {
            script: `/static_assets/${db.connectObj.version_tag}/iconset-fontawesome5-3-1.min.js`,
          },
          {
            script: `/static_assets/${db.connectObj.version_tag}/bootstrap-iconpicker.js`,
          },
          {
            css: `/static_assets/${db.connectObj.version_tag}/bootstrap-iconpicker.min.css`,
          },
        ],
      },
      wrap(
        renderForm(wfres.renderForm, req.csrfToken()),
        false,
        wfres.previewURL
      )
    );
  else if (wfres.renderBuilder) {
    wfres.renderBuilder.options.view_id = view.id;
    res.sendWrap(
      {
        title: req.__(`%s configuration`, view.name),
        requestFluidLayout: true,
      },
      wrap(renderBuilder(wfres.renderBuilder, req.csrfToken()), true)
    );
  } else {
    getState()
      .refresh_views()
      .then(() => {
        res.redirect(wfres.redirect);
      });
  }
}
@param {object} view
@param {Workflow} wf
@param {object} wfres
@param {object} req
@param {object} res
@returns {void}