Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
5fafa08
refactor: remove unused and legacy code
cpvalente Mar 7, 2025
440a9b8
chore: remove IDE files
cpvalente Mar 17, 2025
6d17f18
refactor: restructure model to contain an object of rundowns
cpvalente Mar 15, 2025
7287cf8
refactor: remove stop as a possible end action
cpvalente Mar 23, 2025
6b01338
refactor: use strict typing
cpvalente Mar 21, 2025
0ae7178
refactor: clearer relationship on rundown elements
cpvalente Mar 25, 2025
58023dc
refactor: restructure model to contain an object of rundowns
cpvalente Mar 15, 2025
de0ac92
chore: rename files
cpvalente Mar 27, 2025
7a78ed4
refactor: swap maintains schedule
cpvalente Mar 28, 2025
8f5a4f4
refactor: gather group metadata
cpvalente Mar 28, 2025
402d100
refactor: improve project loading
cpvalente Mar 29, 2025
3f3ecce
refactor(e2e): skip flaky test
cpvalente Apr 12, 2025
6c8ddee
refactor: fix delay positioning in gaps
cpvalente Apr 13, 2025
0cae37d
chore: rename currentBlock > parent
cpvalente Apr 13, 2025
57bd317
chore: improve convention entry <> event
cpvalente Apr 13, 2025
ba12921
refactor: process events in rundown
cpvalente Apr 15, 2025
ed7f8a0
refactor: implement operations on nested events
cpvalente Apr 17, 2025
a55dfba
refactor: maintain flat orders
cpvalente Apr 17, 2025
52358d7
chore: improve convention entry <> event
cpvalente Apr 17, 2025
e30b4fa
refactor: extract rundown parsing
cpvalente Apr 17, 2025
10c2f0c
chore: correct test path
cpvalente Apr 25, 2025
92fbef3
fix: rebase master
cpvalente Apr 28, 2025
94b80d3
fix test (#1601)
alex-Arc May 2, 2025
0a59662
Refactor: ms for api calls (#1593)
alex-Arc May 2, 2025
bdcec7a
Refactor: WebSocket from flush queue to one patch (#1595)
alex-Arc May 7, 2025
75c6016
Fix project renumber (#1597)
alex-Arc May 7, 2025
abd4369
assert non null and update test (#1604)
alex-Arc May 11, 2025
deffbda
refactor: make finder available in exported rundown
cpvalente May 19, 2025
d351778
fix: add event at end of block
cpvalente May 1, 2025
21353b5
fix: delete nested events
cpvalente May 1, 2025
df55b0b
refactor: change network mode defaults
cpvalente May 16, 2025
9181400
refactor: extract utility to merge two arrays
cpvalente May 16, 2025
88a0bd6
chore: upgrade dependencies
cpvalente May 16, 2025
1ee773a
refactor: mutations on batch elements must have IDs
cpvalente May 16, 2025
8232e64
refactor: improve return of reorder
cpvalente May 16, 2025
a6cb7e5
fix: uncontrolled prop on controlled component
cpvalente May 16, 2025
817f0dd
feat: allow dissolving a block
cpvalente May 16, 2025
4a83983
refactor: type cleanup and test improvements
cpvalente May 16, 2025
0a44bfe
fix: collapsed blocks dont render children
cpvalente May 16, 2025
67f914b
feat: create block from rundown empty
cpvalente May 17, 2025
7d5291e
feat: create group from entry selection
cpvalente May 17, 2025
f68b3bf
feat: duplicate groups
cpvalente May 19, 2025
b0e4281
refactor: remove trivially inferred numEvents
cpvalente May 19, 2025
256755b
refactor: small ux improvements
cpvalente May 23, 2025
9f27832
refactor: refetch targets is enum
cpvalente May 26, 2025
8b37f6c
refactor: order is single source of truth
cpvalente May 26, 2025
b919f00
chore: simplify URLs
cpvalente May 27, 2025
a89f5b9
refactor: improve reorder logic
cpvalente May 27, 2025
6348def
test level db
alex-Arc Apr 23, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .idea/.gitignore

This file was deleted.

51 changes: 0 additions & 51 deletions .idea/inspectionProfiles/Project_Default.xml

This file was deleted.

8 changes: 4 additions & 4 deletions apps/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@
"type": "module",
"dependencies": {
"@chakra-ui/react": "^2.7.0",
"@dnd-kit/core": "^6.1.0",
"@dnd-kit/sortable": "^8.0.0",
"@dnd-kit/core": "^6.3.1",
"@dnd-kit/sortable": "^10.0.0",
"@dnd-kit/utilities": "^3.2.2",
"@emotion/is-prop-valid": "^1.3.1",
"@emotion/react": "^11.10.6",
"@emotion/styled": "^11.10.6",
"@fontsource/open-sans": "^5.0.28",
"@mantine/hooks": "^7.13.3",
"@mantine/hooks": "^7.17.2",
"@sentry/react": "^8.43.0",
"@table-nav/react": "^0.0.7",
"@tanstack/react-query": "^5.62.7",
"@tanstack/react-query-devtools": "^5.62.7",
"@tanstack/react-table": "^8.21.3",
"autosize": "^6.0.1",
"axios": "^1.2.0",
"axios": "^1.9.0",
"color": "^4.2.3",
"csv-stringify": "^6.4.5",
"framer-motion": "^10.10.0",
Expand Down
8 changes: 2 additions & 6 deletions apps/client/src/common/api/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export const PROJECT_DATA = ['project'];
export const PROJECT_LIST = ['projectList'];
export const RUNDOWN = ['rundown'];
export const RUNTIME = ['runtimeStore'];
export const SHEET_STATE = ['sheetState'];
export const URL_PRESETS = ['urlpresets'];
export const VIEW_SETTINGS = ['viewSettings'];
export const CLIENT_LIST = ['clientList'];
Expand All @@ -19,11 +18,8 @@ export const REPORT = ['report'];
// API URLs
export const apiEntryUrl = `${serverURL}/data`;

export const projectDataURL = `${serverURL}/project`;
export const rundownURL = `${serverURL}/events`;
export const ontimeURL = `${serverURL}/ontime`;
const userAssetsPath = 'user';
const cssOverridePath = 'styles/override.css';

export const userAssetsPath = 'user';
export const cssOverridePath = 'styles/override.css';
export const overrideStylesURL = `${serverURL}/${userAssetsPath}/${cssOverridePath}`;
export const projectLogoPath = `${serverURL}/${userAssetsPath}/logo`;
8 changes: 5 additions & 3 deletions apps/client/src/common/api/db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import axios, { AxiosResponse } from 'axios';
import { DatabaseModel, MessageResponse, ProjectData, ProjectFileListResponse, QuickStartData } from 'ontime-types';

import { makeTable } from '../../views/cuesheet/cuesheet.utils';
import { makeCSVFromArrayOfArrays } from '../utils/csv';
import { aggregateRundowns, makeCSVFromArrayOfArrays } from '../utils/csv';

import { apiEntryUrl } from './constants';
import { createBlob, downloadBlob } from './utils';
Expand Down Expand Up @@ -40,9 +40,11 @@ export async function downloadProject(fileName: string) {
export async function downloadCSV(fileName: string = 'rundown') {
try {
const { data, name } = await fileDownload(fileName);
const { project, rundown, customFields } = data;
const { project, rundowns, customFields } = data;

const flatRundowns = aggregateRundowns(rundowns);
const sheetData = makeTable(project, flatRundowns, customFields);

const sheetData = makeTable(project, rundown, customFields);
const fileContent = makeCSVFromArrayOfArrays(sheetData);

const blob = createBlob(fileContent, 'text/csv;charset=utf-8;');
Expand Down
11 changes: 5 additions & 6 deletions apps/client/src/common/api/excel.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
import axios, { AxiosResponse } from 'axios';
import { CustomFields, OntimeRundown } from 'ontime-types';
import { CustomFields, Rundown } from 'ontime-types';
import { ImportMap } from 'ontime-utils';

import { apiEntryUrl } from './constants';

const excelPath = `${apiEntryUrl}/excel`;

type PreviewSpreadsheetResponse = {
rundown: OntimeRundown;
customFields: CustomFields;
};

/**
* upload Excel file to server
* @return string - file ID op the uploaded file
Expand All @@ -34,6 +29,10 @@ export async function getWorksheetNames(): Promise<string[]> {
return response.data;
}

type PreviewSpreadsheetResponse = {
rundown: Rundown;
customFields: CustomFields;
};
export async function importRundownPreview(options: ImportMap): Promise<PreviewSpreadsheetResponse> {
const response: AxiosResponse<PreviewSpreadsheetResponse> = await axios.post(`${excelPath}/preview`, {
options,
Expand Down
2 changes: 1 addition & 1 deletion apps/client/src/common/api/external.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export type HasUpdate = {
* HTTP request to get the latest version and url from github
*/
export async function getLatestVersion(): Promise<HasUpdate> {
const res = await axios.get(`${apiRepoLatest}`);
const res = await axios.get(apiRepoLatest);
return {
url: res.data.html_url as string,
version: res.data.tag_name as string,
Expand Down
2 changes: 1 addition & 1 deletion apps/client/src/common/api/report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const reportUrl = `${apiEntryUrl}/report`;
* HTTP request to fetch all reports
*/
export async function fetchReport(): Promise<OntimeReport> {
const res = await axios.get(`${reportUrl}/`);
const res = await axios.get(reportUrl);
return res.data;
}

Expand Down
75 changes: 56 additions & 19 deletions apps/client/src/common/api/rundown.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,45 @@
import axios, { AxiosResponse } from 'axios';
import { MessageResponse, OntimeEvent, OntimeRundownEntry, RundownCached, TransientEventPayload } from 'ontime-types';
import {
EntryId,
MessageResponse,
OntimeEntry,
OntimeEvent,
ProjectRundownsList,
Rundown,
TransientEventPayload,
} from 'ontime-types';

import { apiEntryUrl } from './constants';

const rundownPath = `${apiEntryUrl}/rundown`;

/**
* HTTP request to fetch a list of existing rundowns
*/
export async function fetchProjectRundownList(): Promise<ProjectRundownsList> {
const res = await axios.get(rundownPath);
return res.data;
}

/**
* HTTP request to fetch all events
*/
export async function fetchNormalisedRundown(): Promise<RundownCached> {
const res = await axios.get(`${rundownPath}/normalised`);
export async function fetchCurrentRundown(): Promise<Rundown> {
const res = await axios.get(`${rundownPath}/current`);
return res.data;
}

/**
* HTTP request to post new event
* HTTP request to post new entry
*/
export async function requestPostEvent(data: TransientEventPayload): Promise<AxiosResponse<OntimeRundownEntry>> {
export async function postAddEntry(data: TransientEventPayload): Promise<AxiosResponse<OntimeEntry>> {
return axios.post(rundownPath, data);
}

/**
* HTTP request to put new event
* HTTP request to edit an entry
*/
export async function requestPutEvent(data: Partial<OntimeRundownEntry>): Promise<AxiosResponse<OntimeRundownEntry>> {
export async function putEditEntry(data: Partial<OntimeEntry>): Promise<AxiosResponse<OntimeEntry>> {
return axios.put(rundownPath, data);
}

Expand All @@ -33,22 +49,22 @@ type BatchEditEntry = {
};

/**
* HTTP request to put multiple events
* HTTP request to edit multiple events
*/
export async function requestBatchPutEvents(data: BatchEditEntry): Promise<AxiosResponse<MessageResponse>> {
export async function putBatchEditEvents(data: BatchEditEntry): Promise<AxiosResponse<MessageResponse>> {
return axios.put(`${rundownPath}/batch`, data);
}

export type ReorderEntry = {
eventId: string;
from: number;
to: number;
entryId: EntryId;
destinationId: EntryId;
order: 'before' | 'after' | 'insert';
};

/**
* HTTP request to reorder events
* HTTP request to reorder an entry
*/
export async function requestReorderEvent(data: ReorderEntry): Promise<AxiosResponse<OntimeRundownEntry>> {
export async function patchReorderEntry(data: ReorderEntry): Promise<AxiosResponse<Rundown>> {
return axios.patch(`${rundownPath}/reorder`, data);
}

Expand All @@ -67,15 +83,36 @@ export async function requestEventSwap(data: SwapEntry): Promise<AxiosResponse<M
/**
* HTTP request to request application of delay
*/
export async function requestApplyDelay(eventId: string): Promise<AxiosResponse<MessageResponse>> {
return axios.patch(`${rundownPath}/applydelay/${eventId}`);
export async function requestApplyDelay(delayId: EntryId): Promise<AxiosResponse<MessageResponse>> {
return axios.patch(`${rundownPath}/applydelay/${delayId}`);
}

/**
* HTTP request for cloning an entry
*/
export async function postCloneEntry(entryId: EntryId): Promise<AxiosResponse<Rundown>> {
return axios.post(`${rundownPath}/clone/${entryId}`);
}

/**
* HTTP request for dissolving of a block
*/
export async function requestUngroup(blockId: EntryId): Promise<AxiosResponse<Rundown>> {
return axios.post(`${rundownPath}/ungroup/${blockId}`);
}

/**
* HTTP request for grouping a list of entries into a block
*/
export async function requestGroupEntries(entryIds: EntryId[]): Promise<AxiosResponse<Rundown>> {
return axios.post(`${rundownPath}/group`, { ids: entryIds });
}

/**
* HTTP request to delete given event
* HTTP request to delete entries
*/
export async function requestDelete(eventIds: string[]): Promise<AxiosResponse<MessageResponse>> {
return axios.delete(rundownPath, { data: { ids: eventIds } });
export async function deleteEntries(entryIds: EntryId[]): Promise<AxiosResponse<MessageResponse>> {
return axios.delete(rundownPath, { data: { ids: entryIds } });
}

/**
Expand Down
4 changes: 2 additions & 2 deletions apps/client/src/common/api/sheets.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import axios, { AxiosResponse } from 'axios';
import { AuthenticationStatus, CustomFields, OntimeRundown } from 'ontime-types';
import { AuthenticationStatus, CustomFields, Rundown } from 'ontime-types';
import { ImportMap } from 'ontime-utils';

import { apiEntryUrl } from './constants';
Expand Down Expand Up @@ -54,7 +54,7 @@ export const previewRundown = async (
sheetId: string,
options: ImportMap,
): Promise<{
rundown: OntimeRundown;
rundown: Rundown;
customFields: CustomFields;
}> => {
const response = await axios.post(`${sheetsPath}/${sheetId}/read`, { options });
Expand Down
4 changes: 2 additions & 2 deletions apps/client/src/common/api/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { addLog } from '../stores/logger';
import { nowInMillis } from '../utils/time';

/**
* Utility unrwap a potential axios error
* Utility unwrap a potential axios error
* @param error
* @returns
*/
Expand All @@ -34,7 +34,7 @@ export function maybeAxiosError(error: unknown) {
}

/**
* Utility unrwaps a potential axios error and sends to logger
* Utility unwraps a potential axios error and sends to logger
* @param prepend
* @param error
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export type OptionWithoutGroup = {
withDivider?: boolean;
};

export type OptionWithGroup = {
type OptionWithGroup = {
label: string;
group: Omit<OptionWithoutGroup, 'isGroup'>[];
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import React from 'react';
// skipcq: JS-C1003 - sentry does not expose itself as an ES Module.
import * as Sentry from '@sentry/react';

import { runtimeStore } from '@/common/stores/runtime';
import { hasConnected, reconnectAttempts, shouldReconnect } from '@/common/utils/socket';
import { hasConnected, reconnectAttempts } from '../../../common/utils/socket';
import { runtimeStore } from '../../stores/runtime';

import style from './ErrorBoundary.module.scss';

Expand Down Expand Up @@ -37,7 +37,7 @@ class ErrorBoundary extends React.Component {
scope.setExtras({
error,
store: appState,
hasSocket: { hasConnected, shouldReconnect, reconnectAttempts },
hasSocket: { hasConnected, reconnectAttempts },
});
const eventId = Sentry.captureException(error);
this.setState({ eventId, info });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { KeyboardEvent, useEffect, useRef, useState } from 'react';
import { Input, Radio, RadioGroup } from '@chakra-ui/react';
import { millisToString, parseUserTime } from 'ontime-utils';

import { useEventAction } from '../../../hooks/useEventAction';
import { useEntryActions } from '../../../hooks/useEntryAction';

import style from './DelayInput.module.scss';

Expand All @@ -13,7 +13,7 @@ interface DelayInputProps {

export default function DelayInput(props: DelayInputProps) {
const { eventId, duration } = props;
const { updateEvent } = useEventAction();
const { updateEntry } = useEntryActions();

const [value, setValue] = useState<string>('');
const inputRef = useRef<HTMLInputElement | null>(null);
Expand Down Expand Up @@ -54,7 +54,7 @@ export default function DelayInput(props: DelayInputProps) {
};

const submitChange = (value: number) => {
updateEvent({
updateEntry({
id: eventId,
duration: value,
});
Expand Down
Loading
Loading