Skip to content

Commit

Permalink
Enable r studio button (#1560)
Browse files Browse the repository at this point in the history
* add reload after survey import

* enable rstudio button and change error label

* fix labels

* remove repeated name

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
ramirobg94 and mergify[bot] authored Jul 5, 2021
1 parent d708ec1 commit 5a14da3
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 9 deletions.
2 changes: 2 additions & 0 deletions core/i18n/resources/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,8 @@ $t(common.cantUndoWarning)`,
chain: {
quantitative: 'Quantitative',
categorical: 'Categorical',
emptyNodeDefs:
'$t(validationErrors.analysis.analysisNodeDefsRequired), click the entity in the left side panel which contains a new result variable',
},

itemsTable: {
Expand Down
4 changes: 1 addition & 3 deletions webapp/components/ButtonRStudio/ButtonRStudio.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ import './ButtonRStudio.scss'
import React from 'react'
import PropTypes from 'prop-types'

const ButtonRStudio = (props) => {
const { disabled, onClick } = props

const ButtonRStudio = ({ disabled, onClick }) => {
return (
<button type="button" className="btn btn-s btn-rstudio" onClick={onClick} aria-disabled={disabled}>
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" viewBox="0 0 1784.1 625.9">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const AnalysisNodeDefs = () => {
const prevAnalysisNodeDefs = usePrevious(_analysisNodeDefsToShow)

useEffect(() => {
if (A.isNull(prevAnalysisNodeDefs)) {
if (A.isNull(prevAnalysisNodeDefs) && !chain.isDeleted) {
dispatch(ChainActions.updateChain({ chain }))
}
}, [_analysisNodeDefsToShow, chain])
Expand All @@ -55,9 +55,10 @@ const AnalysisNodeDefs = () => {
<EntitySelectorTree getLabelSuffix={getLabelSuffix} nodeDefUuidActive={entityDefUuid} onSelect={selectEntity} />

<div className="analysis-node-defs" ref={analysisNodeDefsRef}>
{Survey.getAnalysisNodeDefs({ chain })(survey).length <= 0 && (
{!entityDefUuid && Survey.getAnalysisNodeDefs({ chain })(survey).length <= 0 && (
<div className="analysis-node-defs-error">
<ErrorBadge validation={validation} showLabel={false} showIcon />
<p>{i18n.t('chain.emptyNodeDefs')}</p>
</div>
)}
{entityDefUuid && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,11 @@

.analysis-node-defs-error {
height: 2rem;
display: flex;
flex-direction: row;

.tooltip-error{
position: inherit;
margin-right: 16px;
}
}
6 changes: 2 additions & 4 deletions webapp/views/App/views/Analysis/Chain/Chain.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@ import classNames from 'classnames'
import * as A from '@core/arena'

import * as Validation from '@core/validation/validation'
import * as Survey from '@core/survey/survey'
import * as Chain from '@common/analysis/chain'

import { analysisModules, appModuleUri } from '@webapp/app/appModules'
import { ChainActions, useChain } from '@webapp/store/ui/chain'
import { useSurveyCycleKeys, useSurveyInfo } from '@webapp/store/survey'
import { useSurveyCycleKeys } from '@webapp/store/survey'

import { useI18n } from '@webapp/store/system'

Expand All @@ -28,7 +27,6 @@ const ChainComponent = () => {
const i18n = useI18n()
const dispatch = useDispatch()
const { chainUuid } = useParams()
const surveyInfo = useSurveyInfo()
const cycleKeys = useSurveyCycleKeys()
const chain = useChain()
const validation = Chain.getValidation(chain)
Expand Down Expand Up @@ -60,7 +58,7 @@ const ChainComponent = () => {
message={i18n.t('chainView.errorNoLabel')}
/>

<ButtonRStudio onClick={_openRStudio} disabled={Survey.isDraft(surveyInfo)} />
<ButtonRStudio onClick={_openRStudio} />

<div className="form">
<LabelsEditor
Expand Down

0 comments on commit 5a14da3

Please sign in to comment.