From 3f4e7465a7595dccf4a214515b6b0cf8b0f6781a Mon Sep 17 00:00:00 2001 From: Keith Grant Date: Tue, 17 Mar 2020 10:19:48 -0700 Subject: [PATCH] move template survey files to Survey subdirectory --- awx/ui_next/src/components/RoutedTabs/RoutedTabs.jsx | 6 ++++++ .../src/screens/Template/{shared => Survey}/SurveyList.jsx | 0 .../screens/Template/{shared => Survey}/SurveyList.test.jsx | 0 .../screens/Template/{shared => Survey}/SurveyListItem.jsx | 0 .../Template/{shared => Survey}/SurveyListItem.test.jsx | 0 .../Template/{shared => Survey}/SurveyQuestionAdd.jsx | 0 .../Template/{shared => Survey}/SurveyQuestionEdit.jsx | 0 .../Template/{shared => Survey}/SurveyQuestionForm.jsx | 0 .../screens/Template/{shared => Survey}/SurveyToolbar.jsx | 0 .../Template/{shared => Survey}/SurveyToolbar.test.jsx | 0 awx/ui_next/src/screens/Template/Survey/index.js | 3 +++ awx/ui_next/src/screens/Template/TemplateSurvey.jsx | 4 +--- 12 files changed, 10 insertions(+), 3 deletions(-) rename awx/ui_next/src/screens/Template/{shared => Survey}/SurveyList.jsx (100%) rename awx/ui_next/src/screens/Template/{shared => Survey}/SurveyList.test.jsx (100%) rename awx/ui_next/src/screens/Template/{shared => Survey}/SurveyListItem.jsx (100%) rename awx/ui_next/src/screens/Template/{shared => Survey}/SurveyListItem.test.jsx (100%) rename awx/ui_next/src/screens/Template/{shared => Survey}/SurveyQuestionAdd.jsx (100%) rename awx/ui_next/src/screens/Template/{shared => Survey}/SurveyQuestionEdit.jsx (100%) rename awx/ui_next/src/screens/Template/{shared => Survey}/SurveyQuestionForm.jsx (100%) rename awx/ui_next/src/screens/Template/{shared => Survey}/SurveyToolbar.jsx (100%) rename awx/ui_next/src/screens/Template/{shared => Survey}/SurveyToolbar.test.jsx (100%) create mode 100644 awx/ui_next/src/screens/Template/Survey/index.js diff --git a/awx/ui_next/src/components/RoutedTabs/RoutedTabs.jsx b/awx/ui_next/src/components/RoutedTabs/RoutedTabs.jsx index 27a0bf2940..a41ac3ea0a 100644 --- a/awx/ui_next/src/components/RoutedTabs/RoutedTabs.jsx +++ b/awx/ui_next/src/components/RoutedTabs/RoutedTabs.jsx @@ -12,6 +12,12 @@ function RoutedTabs(props) { if (match) { return match.id; } + const subpathMatch = tabsArray.find(tab => + history.location.pathname.startsWith(tab.link) + ); + if (subpathMatch) { + return subpathMatch.id; + } return 0; }; diff --git a/awx/ui_next/src/screens/Template/shared/SurveyList.jsx b/awx/ui_next/src/screens/Template/Survey/SurveyList.jsx similarity index 100% rename from awx/ui_next/src/screens/Template/shared/SurveyList.jsx rename to awx/ui_next/src/screens/Template/Survey/SurveyList.jsx diff --git a/awx/ui_next/src/screens/Template/shared/SurveyList.test.jsx b/awx/ui_next/src/screens/Template/Survey/SurveyList.test.jsx similarity index 100% rename from awx/ui_next/src/screens/Template/shared/SurveyList.test.jsx rename to awx/ui_next/src/screens/Template/Survey/SurveyList.test.jsx diff --git a/awx/ui_next/src/screens/Template/shared/SurveyListItem.jsx b/awx/ui_next/src/screens/Template/Survey/SurveyListItem.jsx similarity index 100% rename from awx/ui_next/src/screens/Template/shared/SurveyListItem.jsx rename to awx/ui_next/src/screens/Template/Survey/SurveyListItem.jsx diff --git a/awx/ui_next/src/screens/Template/shared/SurveyListItem.test.jsx b/awx/ui_next/src/screens/Template/Survey/SurveyListItem.test.jsx similarity index 100% rename from awx/ui_next/src/screens/Template/shared/SurveyListItem.test.jsx rename to awx/ui_next/src/screens/Template/Survey/SurveyListItem.test.jsx diff --git a/awx/ui_next/src/screens/Template/shared/SurveyQuestionAdd.jsx b/awx/ui_next/src/screens/Template/Survey/SurveyQuestionAdd.jsx similarity index 100% rename from awx/ui_next/src/screens/Template/shared/SurveyQuestionAdd.jsx rename to awx/ui_next/src/screens/Template/Survey/SurveyQuestionAdd.jsx diff --git a/awx/ui_next/src/screens/Template/shared/SurveyQuestionEdit.jsx b/awx/ui_next/src/screens/Template/Survey/SurveyQuestionEdit.jsx similarity index 100% rename from awx/ui_next/src/screens/Template/shared/SurveyQuestionEdit.jsx rename to awx/ui_next/src/screens/Template/Survey/SurveyQuestionEdit.jsx diff --git a/awx/ui_next/src/screens/Template/shared/SurveyQuestionForm.jsx b/awx/ui_next/src/screens/Template/Survey/SurveyQuestionForm.jsx similarity index 100% rename from awx/ui_next/src/screens/Template/shared/SurveyQuestionForm.jsx rename to awx/ui_next/src/screens/Template/Survey/SurveyQuestionForm.jsx diff --git a/awx/ui_next/src/screens/Template/shared/SurveyToolbar.jsx b/awx/ui_next/src/screens/Template/Survey/SurveyToolbar.jsx similarity index 100% rename from awx/ui_next/src/screens/Template/shared/SurveyToolbar.jsx rename to awx/ui_next/src/screens/Template/Survey/SurveyToolbar.jsx diff --git a/awx/ui_next/src/screens/Template/shared/SurveyToolbar.test.jsx b/awx/ui_next/src/screens/Template/Survey/SurveyToolbar.test.jsx similarity index 100% rename from awx/ui_next/src/screens/Template/shared/SurveyToolbar.test.jsx rename to awx/ui_next/src/screens/Template/Survey/SurveyToolbar.test.jsx diff --git a/awx/ui_next/src/screens/Template/Survey/index.js b/awx/ui_next/src/screens/Template/Survey/index.js new file mode 100644 index 0000000000..eaa4f40fae --- /dev/null +++ b/awx/ui_next/src/screens/Template/Survey/index.js @@ -0,0 +1,3 @@ +export { default as SurveyList } from './SurveyList'; +export { default as SurveyQuestionAdd } from './SurveyQuestionAdd'; +export { default as SurveyQuestionEdit } from './SurveyQuestionEdit'; diff --git a/awx/ui_next/src/screens/Template/TemplateSurvey.jsx b/awx/ui_next/src/screens/Template/TemplateSurvey.jsx index ae735bd3fb..daa672fe0f 100644 --- a/awx/ui_next/src/screens/Template/TemplateSurvey.jsx +++ b/awx/ui_next/src/screens/Template/TemplateSurvey.jsx @@ -7,9 +7,7 @@ import ContentError from '@components/ContentError'; import AlertModal from '@components/AlertModal'; import ErrorDetail from '@components/ErrorDetail'; import useRequest, { useDismissableError } from '@util/useRequest'; -import SurveyList from './shared/SurveyList'; -import SurveyQuestionAdd from './shared/SurveyQuestionAdd'; -import SurveyQuestionEdit from './shared/SurveyQuestionEdit'; +import { SurveyList, SurveyQuestionAdd, SurveyQuestionEdit } from './Survey'; function TemplateSurvey({ template, i18n }) { const [surveyEnabled, setSurveyEnabled] = useState(template.survey_enabled);