Skip to content

Commit c6ba095

Browse files
committed
notifications_settings --> notifications_config
1 parent 0bd5596 commit c6ba095

File tree

8 files changed

+39
-39
lines changed

8 files changed

+39
-39
lines changed

jupyter_scheduler/orm.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ class Job(CommonColumns, Base):
9898
url = Column(String(256), default=generate_jobs_url)
9999
pid = Column(Integer)
100100
idempotency_token = Column(String(256))
101-
notifications_settings = Column(JsonType(1024), nullable=True)
101+
notifications_config = Column(JsonType(1024), nullable=True)
102102

103103

104104
class JobDefinition(CommonColumns, Base):
@@ -109,7 +109,7 @@ class JobDefinition(CommonColumns, Base):
109109
url = Column(String(256), default=generate_job_definitions_url)
110110
create_time = Column(Integer, default=get_utc_timestamp)
111111
active = Column(Boolean, default=True)
112-
notifications_settings = Column(JsonType(1024), nullable=True)
112+
notifications_config = Column(JsonType(1024), nullable=True)
113113

114114

115115
def create_tables(db_url, drop_tables=False):

src/components/notification-detail.tsx renamed to src/components/notifications-config-detail.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import React from 'react';
33
import { Card, CardContent, Stack, FormLabel } from '@mui/material';
44
import { useTranslator } from '../hooks';
55
import { Scheduler } from '../handler';
6-
import { LabeledValue } from '../components/labeled-value';
6+
import { LabeledValue } from './labeled-value';
77

88
type INotificationsConfigItemProps = {
99
label: string;
@@ -31,7 +31,7 @@ function NotificationsConfigItem(props: INotificationsConfigItemProps) {
3131
);
3232
}
3333

34-
export function NotificationsConfigDetails(
34+
export function NotificationsConfigDetail(
3535
props: INotificationsConfigDetailsProps
3636
): JSX.Element {
3737
const trans = useTranslator('jupyterlab');

src/components/notification-config.tsx renamed to src/components/notifications-config.tsx

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,6 @@ type NotificationsConfigProps = {
2323
handleModelChange: (model: ICreateJobModel) => void;
2424
};
2525

26-
type NotificationEventsSelectProps = {
27-
id: string;
28-
availableEvents: string[];
29-
selectChange: (e: SelectChangeEvent<string>) => void;
30-
disabled: boolean;
31-
};
32-
33-
type SelectedEventsChipsProps = {
34-
selectedEvents: string[];
35-
deleteSelectedEvent: (eventToDelete: string) => () => void;
36-
disabled: boolean;
37-
};
38-
3926
export function NotificationsConfig(
4027
props: NotificationsConfigProps
4128
): JSX.Element | null {
@@ -169,15 +156,15 @@ export function NotificationsConfig(
169156
/>
170157
<NotificationEventsSelect
171158
id={props.id}
172-
availableEvents={props.notificationEvents.filter(
159+
value={props.notificationEvents.filter(
173160
e => !selectedEvents.includes(e)
174161
)}
175-
selectChange={selectChange}
162+
onChange={selectChange}
176163
disabled={!enableNotification}
177164
/>
178165
<SelectedEventsChips
179-
selectedEvents={selectedEvents}
180-
deleteSelectedEvent={deleteSelectedEvent}
166+
value={selectedEvents}
167+
onChange={deleteSelectedEvent}
181168
disabled={!enableNotification}
182169
/>
183170
<FormControlLabel
@@ -194,6 +181,13 @@ export function NotificationsConfig(
194181
);
195182
}
196183

184+
type NotificationEventsSelectProps = {
185+
id: string;
186+
value: string[];
187+
onChange: (e: SelectChangeEvent<string>) => void;
188+
disabled: boolean;
189+
};
190+
197191
function NotificationEventsSelect(props: NotificationEventsSelectProps) {
198192
const trans = useTranslator('jupyterlab');
199193
const label = trans.__('Notification Events');
@@ -208,10 +202,10 @@ function NotificationEventsSelect(props: NotificationEventsSelectProps) {
208202
labelId={labelId}
209203
id={props.id}
210204
label={label}
211-
onChange={props.selectChange}
205+
onChange={props.onChange}
212206
disabled={props.disabled}
213207
>
214-
{props.availableEvents.map(e => (
208+
{props.value.map(e => (
215209
<MenuItem key={e} value={e}>
216210
{e}
217211
</MenuItem>
@@ -221,15 +215,21 @@ function NotificationEventsSelect(props: NotificationEventsSelectProps) {
221215
);
222216
}
223217

218+
type SelectedEventsChipsProps = {
219+
value: string[];
220+
onChange: (eventToDelete: string) => () => void;
221+
disabled: boolean;
222+
};
223+
224224
function SelectedEventsChips(props: SelectedEventsChipsProps) {
225225
return (
226226
<Cluster gap={3} justifyContent="flex-start">
227-
{props.selectedEvents.map(e => (
227+
{props.value.map(e => (
228228
<Chip
229229
key={e}
230230
label={e}
231231
variant="outlined"
232-
onDelete={props.deleteSelectedEvent(e)}
232+
onDelete={props.onChange(e)}
233233
disabled={props.disabled}
234234
/>
235235
))}

src/handler.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ export namespace Scheduler {
363363
compute_type?: string;
364364
schedule?: string;
365365
timezone?: string;
366-
notifications_settings?: INotificationsConfig;
366+
notifications_config?: INotificationsConfig;
367367
}
368368

369369
export interface IUpdateJobDefinition {
@@ -372,7 +372,7 @@ export namespace Scheduler {
372372
timezone?: string;
373373
active?: boolean;
374374
input_uri?: string;
375-
notifications_settings?: INotificationsConfig;
375+
notifications_config?: INotificationsConfig;
376376
}
377377

378378
export interface IDescribeJobDefinition {
@@ -391,7 +391,7 @@ export namespace Scheduler {
391391
create_time: number;
392392
update_time: number;
393393
active: boolean;
394-
notifications_settings?: INotificationsConfig;
394+
notifications_config?: INotificationsConfig;
395395
}
396396

397397
export interface IEmailNotifications {
@@ -424,7 +424,7 @@ export namespace Scheduler {
424424
output_filename_template?: string;
425425
output_formats?: string[];
426426
compute_type?: string;
427-
notifications_settings?: INotificationsConfig;
427+
notifications_config?: INotificationsConfig;
428428
}
429429

430430
export interface ICreateJobFromDefinition {
@@ -473,7 +473,7 @@ export namespace Scheduler {
473473
start_time?: number;
474474
end_time?: number;
475475
downloaded: boolean;
476-
notifications_settings?: INotificationsConfig;
476+
notifications_config?: INotificationsConfig;
477477
}
478478

479479
export interface ICreateJobResponse {

src/mainviews/create-job.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { Cluster } from '../components/cluster';
1111
import { ComputeTypePicker } from '../components/compute-type-picker';
1212
import { CreateScheduleOptions } from '../components/create-schedule-options';
1313
import { EnvironmentPicker } from '../components/environment-picker';
14-
import { NotificationsConfig } from '../components/notification-config';
14+
import { NotificationsConfig } from '../components/notifications-config';
1515
import {
1616
OutputFormatPicker,
1717
outputFormatsForEnvironment
@@ -337,7 +337,7 @@ export function CreateJob(props: ICreateJobProps): JSX.Element {
337337
}
338338

339339
if (props.model.notificationsConfig?.enableNotification) {
340-
jobOptions.notifications_settings = {
340+
jobOptions.notifications_config = {
341341
send_to: props.model.notificationsConfig.sendTo ?? [],
342342
events: props.model.notificationsConfig.selectedEvents ?? [],
343343
include_output: props.model.notificationsConfig.includeOutput ?? false
@@ -392,7 +392,7 @@ export function CreateJob(props: ICreateJobProps): JSX.Element {
392392
}
393393

394394
if (props.model.notificationsConfig?.enableNotification) {
395-
jobDefinitionOptions.notifications_settings = {
395+
jobDefinitionOptions.notifications_config = {
396396
send_to: props.model.notificationsConfig.sendTo ?? [],
397397
events: props.model.notificationsConfig.selectedEvents ?? [],
398398
include_output: props.model.notificationsConfig.includeOutput ?? false

src/mainviews/detail-view/job-definition.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import {
2323
} from '../../components/labeled-value';
2424
import { JupyterFrontEnd } from '@jupyterlab/application';
2525
import { ListJobsTable } from '../list-jobs';
26-
import { NotificationsConfigDetails } from '../../components/notification-detail';
26+
import { NotificationsConfigDetail } from '../../components/notifications-config-detail';
2727
import { Scheduler as SchedulerTokens } from '../../tokens';
2828
import { SchedulerService } from '../../handler';
2929
import { timestampLocalize } from './job-detail';
@@ -290,7 +290,7 @@ export function JobDefinition(props: IJobDefinitionProps): JSX.Element {
290290
{JobDefinition}
291291
{JobsList}
292292
{props.model.notificationsConfig && (
293-
<NotificationsConfigDetails
293+
<NotificationsConfigDetail
294294
notificationsConfig={props.model.notificationsConfig}
295295
/>
296296
)}

src/mainviews/detail-view/job-detail.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import {
2323
} from '../../components/labeled-value';
2424
import { JobFileLink } from '../../components/job-file-link';
2525
import { JupyterFrontEnd } from '@jupyterlab/application';
26-
import { NotificationsConfigDetails } from '../../components/notification-detail';
26+
import { NotificationsConfigDetail } from '../../components/notifications-config-detail';
2727
import { Scheduler, SchedulerService } from '../../handler';
2828
import { Scheduler as SchedulerTokens } from '../../tokens';
2929
import { useEventLogger, useTranslator } from '../../hooks';
@@ -353,7 +353,7 @@ export function JobDetail(props: IJobDetailProps): JSX.Element {
353353
{CoreOptions}
354354
{Parameters}
355355
{props.model.notificationsConfig && (
356-
<NotificationsConfigDetails
356+
<NotificationsConfigDetail
357357
notificationsConfig={props.model.notificationsConfig}
358358
/>
359359
)}

src/model.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ export function convertDescribeJobtoJobDetail(
396396
startTime: describeJob.start_time,
397397
endTime: describeJob.end_time,
398398
downloaded: describeJob.downloaded,
399-
notificationsConfig: describeJob.notifications_settings
399+
notificationsConfig: describeJob.notifications_config
400400
};
401401
}
402402

@@ -425,7 +425,7 @@ export function convertDescribeDefinitiontoDefinition(
425425
updateTime: describeDefinition.update_time,
426426
schedule: describeDefinition.schedule,
427427
timezone: describeDefinition.timezone,
428-
notificationsConfig: describeDefinition.notifications_settings
428+
notificationsConfig: describeDefinition.notifications_config
429429
};
430430
}
431431

0 commit comments

Comments
 (0)