Skip to content

Commit

Permalink
fixed testing bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
mariana-furyk committed Oct 29, 2024
1 parent e25076f commit 339525d
Show file tree
Hide file tree
Showing 21 changed files with 244 additions and 133 deletions.
1 change: 1 addition & 0 deletions src/components/ActionBar/ActionBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@ const ActionBar = ({
!actionButton.hidden &&
(actionButton.template || (
<Button
disabled={actionButton.disabled}
key={index}
variant={actionButton.variant}
label={actionButton.label}
Expand Down
17 changes: 16 additions & 1 deletion src/components/Jobs/Jobs.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ const Jobs = ({ fetchAllJobRuns, fetchJobFunction, fetchJobs }) => {
const jobsStore = useSelector(store => store.jobsStore)
const workflowsStore = useSelector(store => store.workflowsStore)
const artifactsStore = useSelector(store => store.artifactsStore)
const appStore = useSelector(store => store.appStore)

const {
abortControllerRef,
Expand All @@ -76,6 +77,7 @@ const Jobs = ({ fetchAllJobRuns, fetchJobFunction, fetchJobs }) => {
jobs,
jobWizardIsOpened,
jobWizardMode,
handleMonitoring,
handleRerunJob,
refreshJobs,
refreshScheduled,
Expand Down Expand Up @@ -181,6 +183,17 @@ const Jobs = ({ fetchAllJobRuns, fetchJobFunction, fetchJobs }) => {
label: actionButtonHeader,
onClick: handleActionsMenuClick,
variant: PRIMARY_BUTTON
},
{
className: 'action-button',
label: 'Resource monitoring',
hidden: selectedTab !== MONITOR_JOBS_TAB,
tooltip: !appStore.frontendSpec.jobs_dashboard_url
? 'Grafana service unavailable'
: '',
variant: TERTIARY_BUTTON,
disabled: !appStore.frontendSpec.jobs_dashboard_url,
onClick: () => handleMonitoring()
}
]}
autoRefreshIsEnabled={selectedTab === MONITOR_JOBS_TAB}
Expand Down Expand Up @@ -215,6 +228,7 @@ const Jobs = ({ fetchAllJobRuns, fetchJobFunction, fetchJobs }) => {
refreshScheduled,
requestErrorMessage,
scheduledJobs,
scheduledFiltersConfig: tabData[SCHEDULE_TAB].filtersConfig,
setAbortingJobs,
setConfirmData,
setEditableItem,
Expand All @@ -224,7 +238,8 @@ const Jobs = ({ fetchAllJobRuns, fetchJobFunction, fetchJobs }) => {
setJobs,
setScheduledJobs,
setSelectedRunProject,
terminateAbortTasksPolling
terminateAbortTasksPolling,
workflowsFiltersConfig: tabData[MONITOR_WORKFLOWS_TAB].filtersConfig
}}
>
<Outlet />
Expand Down
7 changes: 6 additions & 1 deletion src/components/Jobs/MonitorJobs/JobsFilters.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,12 @@ const JobsFilters = () => {
<FormSelect label="Type" name="type" options={generateTypeFilter()} />
</div>
<div className="form-row">
<FormInput label="Labels" name={LABELS_FILTER} placeholder="key1,key2=value,..." />
<FormInput
label="Labels"
name={LABELS_FILTER}
placeholder="key1,key2=value,..."
tip="Add ~ before the filter value to return substring and case insensitive value."
/>
<FormOnChange
handler={value => handleInputChange(value, LABELS_FILTER)}
name={LABELS_FILTER}
Expand Down
1 change: 1 addition & 0 deletions src/components/Jobs/MonitorJobs/MonitorJobs.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ const MonitorJobs = () => {
abortingJobs={abortingJobs}
ref={{ abortJobRef }}
context={JobsContext}
filterMenuName={MONITOR_JOBS_TAB}
filters={filters}
jobRuns={jobRuns}
jobs={jobs}
Expand Down
1 change: 1 addition & 0 deletions src/components/Jobs/MonitorWorkflows/MonitorWorkflows.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ const MonitorWorkflows = ({ deleteWorkflows, fetchFunctionLogs }) => {
backLink={`/projects/${params.projectName}/jobs/${MONITOR_WORKFLOWS_TAB}`}
context={JobsContext}
fetchFunctionLogs={fetchFunctionLogs}
filterMenuName={MONITOR_WORKFLOWS_TAB}
filtersConfig={workflowsFiltersConfig}
getWorkflows={getWorkflows}
itemIsSelected={itemIsSelected}
Expand Down
7 changes: 6 additions & 1 deletion src/components/Jobs/MonitorWorkflows/WorkflowsFilters.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,12 @@ const WorkflowsFilters = () => {
</div>
{isDemoMode && (
<div className="form-row">
<FormInput label="Labels" name={LABELS_FILTER} placeholder="key1,key2=value,..." />
<FormInput
label="Labels"
name={LABELS_FILTER}
placeholder="key1,key2=value,..."
tip="Add ~ before the filter value to return substring and case insensitive value."
/>
<FormOnChange
handler={value => handleInputChange(value, LABELS_FILTER)}
name={LABELS_FILTER}
Expand Down
12 changes: 6 additions & 6 deletions src/components/Jobs/MonitorWorkflows/monitorWorkflows.util.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import {
detailsMenu as functionsDetailsMenu,
infoHeaders as functionsInfoHeaders
} from '../../FunctionsPage/functions.util'
import { datePickerPastOptions, PAST_WEEK_DATE_OPTION } from '../../../utils/datePicker.util'
import { datePickerPastOptions, PAST_24_HOUR_DATE_OPTION } from '../../../utils/datePicker.util'
import { isEveryObjectValueEmpty } from '../../../utils/isEveryObjectValueEmpty'

import { ReactComponent as MonitorIcon } from 'igz-controls/images/monitor-icon.svg'
Expand Down Expand Up @@ -176,19 +176,19 @@ export const fetchInitialWorkflows = debounce(
getWorkflows(filters)
dispatch(setFilters(filters))
} else if (workflowsLength === 0) {
const pastWeekOption = datePickerPastOptions.find(
option => option.id === PAST_WEEK_DATE_OPTION
const past24HourOption = datePickerPastOptions.find(
option => option.id === PAST_24_HOUR_DATE_OPTION
)
const generatedDates = [...pastWeekOption.handler()]
const generatedDates = [...past24HourOption.handler()]

if (generatedDates.length === 1) {
generatedDates.push(new Date())
}
const filters = {
dates: {
value: generatedDates,
isPredefined: pastWeekOption.isPredefined,
initialSelectedOptionId: pastWeekOption.id
isPredefined: past24HourOption.isPredefined,
initialSelectedOptionId: past24HourOption.id
},
state: FILTER_ALL_ITEMS,
groupBy: GROUP_BY_WORKFLOW
Expand Down
3 changes: 2 additions & 1 deletion src/components/Jobs/ScheduledJobs/ScheduledJobs.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const ScheduledJobs = () => {
useEffect(() => {
if (!dataIsLoaded) {
refreshJobs({
...schedulesFilterMenu,
...schedulesFilterMenu.values,
...schedulesFilterMenuModal.values
})
setDataIsLoaded(true)
Expand All @@ -74,6 +74,7 @@ const ScheduledJobs = () => {
return (
<ScheduledJobsTable
context={JobsContext}
filterMenuName={SCHEDULE_TAB}
filtersConfig={scheduledFiltersConfig}
jobs={scheduledJobs}
requestErrorMessage={requestErrorMessage}
Expand Down
7 changes: 6 additions & 1 deletion src/components/Jobs/ScheduledJobs/ScheduledJobsFilters.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,12 @@ const ScheduledJobsFilters = () => {
<FormSelect label="Type" name="type" options={filterScheduledTypeOptions} />
</div>
<div className="form-row">
<FormInput label="Labels" name={LABELS_FILTER} placeholder="key1,key2=value,..." />
<FormInput
label="Labels"
name={LABELS_FILTER}
placeholder="key1,key2=value,..."
tip="Add ~ before the filter value to return substring and case insensitive value."
/>
<FormOnChange
handler={value => handleInputChange(value, LABELS_FILTER)}
name={LABELS_FILTER}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Jobs/jobs.util.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export const getInfoHeaders = (isSpark, selectedJob) => {

return infoHeaders
}
export const actionButtonHeader = 'Batch run'
export const actionButtonHeader = 'Batch Run'

export const JOB_STEADY_STATES = ['completed', 'error', 'aborted', 'failed']
export const JOB_RUNNING_STATES = ['running', 'pending']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,12 @@ const JobsMonitoringFilters = () => {
<FormSelect label="Type" name="type" options={generateTypeFilter()} />
</div>
<div className="form-row">
<FormInput label="Labels" name={LABELS_FILTER} placeholder="key1,key2=value,..." />
<FormInput
label="Labels"
name={LABELS_FILTER}
placeholder="key1,key2=value,..."
tip="Add ~ before the filter value to return substring and case insensitive value."
/>
<FormOnChange
handler={value => handleInputChange(value, LABELS_FILTER)}
name={LABELS_FILTER}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ const ScheduledMonitoring = () => {
<ScheduledJobsTable
context={ProjectJobsMonitoringContext}
filtersConfig={scheduledFiltersConfig}
filtersMenuName={JOBS_MONITORING_SCHEDULED_TAB}
filterMenuName={JOBS_MONITORING_SCHEDULED_TAB}
jobs={scheduledJobs}
requestErrorMessage={requestErrorMessage}
refreshJobs={() =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,12 @@ const ScheduledMonitoringFilters = () => {
<FormSelect label="Type" name="type" options={filterScheduledTypeOptions} />
</div>
<div className="form-row">
<FormInput label="Labels" name={LABELS_FILTER} placeholder="key1,key2=value,..." />
<FormInput
label="Labels"
name={LABELS_FILTER}
placeholder="key1,key2=value,..."
tip="Add ~ before the filter value to return substring and case insensitive value."
/>
<FormOnChange
handler={value => handleInputChange(value, LABELS_FILTER)}
name={LABELS_FILTER}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,12 @@ const WorkflowsMonitoringFilters = () => {
</div>
{isDemoMode && (
<div className="form-row">
<FormInput label="Labels" name={LABELS_FILTER} placeholder="key1,key2=value,..." />
<FormInput
label="Labels"
name={LABELS_FILTER}
placeholder="key1,key2=value,..."
tip="Add ~ before the filter value to return substring and case insensitive value."
/>
<FormOnChange
handler={value => handleInputChange(value, LABELS_FILTER)}
name={LABELS_FILTER}
Expand Down
9 changes: 6 additions & 3 deletions src/elements/JobsTable/JobsTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,12 @@ const JobsTable = React.forwardRef(
[dispatch, modifyAndSelectRun, navigate, navigateLink, params.jobId]
)

const refreshRun = useCallback((selectedItem) => {
fetchRun(selectedItem.project)
}, [fetchRun])
const refreshRun = useCallback(
selectedItem => {
fetchRun(selectedItem.project)
},
[fetchRun]
)

const onAbortJob = useCallback(
job => {
Expand Down
6 changes: 3 additions & 3 deletions src/elements/ScheduledJobsTable/ScheduledJobsTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const ScheduledJobsTable = ({
context,
filters = null,
filtersConfig = null,
filtersMenuName = '',
filterMenuName = '',
jobs,
refreshJobs,
requestErrorMessage,
Expand Down Expand Up @@ -263,7 +263,7 @@ const ScheduledJobsTable = ({
requestErrorMessage,
JOBS_PAGE,
SCHEDULE_TAB,
filtersMenuName
filterMenuName
)}
/>
) : (
Expand Down Expand Up @@ -297,7 +297,7 @@ ScheduledJobsTable.propTypes = {
context: PropTypes.object.isRequired,
filters: PropTypes.array,
filtersConfig: FILTERS_CONFIG,
filtersMenuName: PropTypes.string,
filterMenuName: PropTypes.string,
jobs: PropTypes.array.isRequired,
refreshJobs: PropTypes.func.isRequired,
requestErrorMessage: PropTypes.string.isRequired,
Expand Down
Loading

0 comments on commit 339525d

Please sign in to comment.