Git Product home page Git Product logo

Comments (2)

dosubot avatar dosubot commented on September 13, 2024 3

Hey @nemccarthy! I'm here to help you with any bugs or questions you have regarding Superset. Let's squash those bugs together!

I found a similar unsolved discussion that might be relevant to your issue: Embedded dashboard: hide edit chart title link, which was last updated on 2024-09-04 [1].

To hide the username and last modified timestamp in the dashboard header for the embedded use case in Superset version 4.1.0rc2, you need to modify the titlePanelAdditionalItems array in the render method of the Header component. Specifically, you should remove the MetadataBar component from this array.

Here is the relevant part of the code with the MetadataBar component removed:

return (
  <div
    css={headerContainerStyle}
    data-test="dashboard-header-container"
    data-test-id={dashboardInfo.id}
    className="dashboard-header-container"
  >
    <PageHeaderWithActions
      editableTitleProps={{
        title: dashboardTitle,
        canEdit: userCanEdit && editMode,
        onSave: this.handleChangeText,
        placeholder: t('Add the name of the dashboard'),
        label: t('Dashboard title'),
        showTooltip: false,
      }}
      certificatiedBadgeProps={{
        certifiedBy: dashboardInfo.certified_by,
        details: dashboardInfo.certification_details,
      }}
      faveStarProps={{
        itemId: dashboardInfo.id,
        fetchFaveStar: this.props.fetchFaveStar,
        saveFaveStar: this.props.saveFaveStar,
        isStarred: this.props.isStarred,
        showTooltip: true,
      }}
      titlePanelAdditionalItems={[
        !editMode && (
          <PublishedStatus
            dashboardId={dashboardInfo.id}
            isPublished={isPublished}
            savePublished={this.props.savePublished}
            canEdit={userCanEdit}
            canSave={userCanSaveAs}
            visible={!editMode}
          />
        ),
        // Remove the MetadataBar component to hide username and last modified timestamp
      ]}
      rightPanelAdditionalItems={
        <div className="button-container">
          {userCanSaveAs && (
            <div
              className="button-container"
              data-test="dashboard-edit-actions"
            >
              {editMode && (
                <div css={actionButtonsStyle}>
                  <div className="undoRedo">
                    <Tooltip
                      id="dashboard-undo-tooltip"
                      title={t('Undo the action')}
                    >
                      <StyledUndoRedoButton
                        type="text"
                        disabled={undoLength < 1}
                        onClick={undoLength && onUndo}
                      >
                        <Icons.Undo
                          css={[
                            undoRedoStyle,
                            this.state.emphasizeUndo && undoRedoEmphasized,
                            undoLength < 1 && undoRedoDisabled,
                          ]}
                          data-test="undo-action"
                          iconSize="xl"
                        />
                      </StyledUndoRedoButton>
                    </Tooltip>
                    <Tooltip
                      id="dashboard-redo-tooltip"
                      title={t('Redo the action')}
                    >
                      <StyledUndoRedoButton
                        type="text"
                        disabled={redoLength < 1}
                        onClick={redoLength && onRedo}
                      >
                        <Icons.Redo
                          css={[
                            undoRedoStyle,
                            this.state.emphasizeRedo && undoRedoEmphasized,
                            redoLength < 1 && undoRedoDisabled,
                          ]}
                          data-test="redo-action"
                          iconSize="xl"
                        />
                      </StyledUndoRedoButton>
                    </Tooltip>
                  </div>
                  <Button
                    css={discardBtnStyle}
                    buttonSize="small"
                    onClick={this.constructor.discardChanges}
                    buttonStyle="default"
                    data-test="discard-changes-button"
                    aria-label={t('Discard')}
                  >
                    {t('Discard')}
                  </Button>
                  <Button
                    css={saveBtnStyle}
                    buttonSize="small"
                    disabled={!hasUnsavedChanges}
                    buttonStyle="primary"
                    onClick={this.overwriteDashboard}
                    data-test="header-save-button"
                    aria-label={t('Save')}
                  >
                    {t('Save')}
                  </Button>
                </div>
              )}
            </div>
          )}
          {editMode ? (
            <UndoRedoKeyListeners
              onUndo={this.handleCtrlZ}
              onRedo={this.handleCtrlY}
            />
          ) : (
            <div css={actionButtonsStyle}>
              {NavExtension && <NavExtension />}
              {userCanEdit && (
                <Button
                  buttonStyle="secondary"
                  onClick={this.toggleEditMode}
                  data-test="edit-dashboard-button"
                  className="action-button"
                  css={editButtonStyle}
                  aria-label={t('Edit dashboard')}
                >
                  {t('Edit dashboard')}
                </Button>
              )}
            </div>
          )}
        </div>
      }
      menuDropdownProps={{
        getPopupContainer: triggerNode =>
          triggerNode.closest('.header-with-actions'),
        visible: this.state.isDropdownVisible,
        onVisibleChange: this.setIsDropdownVisible,
      }}
      additionalActionsMenu={
        <ConnectedHeaderActionsDropdown
          addSuccessToast={this.props.addSuccessToast}
          addDangerToast={this.props.addDangerToast}
          dashboardId={dashboardInfo.id}
          dashboardTitle={dashboardTitle}
          dashboardInfo={dashboardInfo}
          dataMask={dataMask}
          layout={layout}
          expandedSlices={expandedSlices}
          customCss={customCss}
          colorNamespace={colorNamespace}
          colorScheme={colorScheme}
          onSave={onSave}
          onChange={onChange}
          forceRefreshAllCharts={this.forceRefresh}
          startPeriodicRender={this.startPeriodicRender}
          refreshFrequency={refreshFrequency}
          shouldPersistRefreshFrequency={shouldPersistRefreshFrequency}
          setRefreshFrequency={setRefreshFrequency}
          updateCss={updateCss}
          editMode={editMode}
          hasUnsavedChanges={hasUnsavedChanges}
          userCanEdit={userCanEdit}
          userCanShare={userCanShare}
          userCanSave={userCanSaveAs}
          userCanCurate={userCanCurate}
          isLoading={isLoading}
          showPropertiesModal={this.showPropertiesModal}
          manageEmbedded={this.showEmbedModal}
          refreshLimit={refreshLimit}
          refreshWarning={refreshWarning}
          lastModifiedTime={lastModifiedTime}
          isDropdownVisible={this.state.isDropdownVisible}
          setIsDropdownVisible={this.setIsDropdownVisible}
          logEvent={logEvent}
        />
      }
      showFaveStar={user?.userId && dashboardInfo?.id}
      showTitlePanelItems
    />
    {this.state.showingPropertiesModal && (
      <PropertiesModal
        dashboardId={dashboardInfo.id}
        dashboardInfo={dashboardInfo}
        dashboardTitle={dashboardTitle}
        show={this.state.showingPropertiesModal}
        onHide={this.hidePropertiesModal}
        colorScheme={this.props.colorScheme}
        onSubmit={handleOnPropertiesChange}
        onlyApply
      />
    )}
    {userCanCurate && (
      <DashboardEmbedModal
        show={this.state.showingEmbedModal}
        onHide={this.hideEmbedModal}
        dashboardId={dashboardInfo.id}
      />
    )}
    <Global
      styles={css`
        .ant-menu-vertical {
          border-right: none;
        }
      `}
    />
  </div>
);

By removing the MetadataBar component, the username and last modified timestamp will no longer be displayed in the dashboard header [2].

To continue talking to Dosu, mention @dosu.

from superset.

rusackas avatar rusackas commented on September 13, 2024

Looks like npm run lint-fix might solve a lot of the CI problems :)

from superset.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.