Skip to content

Commit 82a7b4a

Browse files
committed
2533: Fixed merge
2 parents 62de69d + 04133f3 commit 82a7b4a

34 files changed

+18062
-16104
lines changed

.github/workflows/pr.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ jobs:
5454
docker compose run --rm playwright npx playwright install --with-deps
5555
docker compose run --rm playwright npx playwright test --retries 3
5656
57-
58-
- uses: actions/upload-artifact@v3
57+
- uses: actions/upload-artifact@v4
5958
if: always()
6059
with:
6160
name: playwright-report

CHANGELOG.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,25 @@ All notable changes to this project will be documented in this file.
44

55
## [Unreleased]
66

7+
## [2.4.0] - 2025-03-31
8+
9+
- [#281](https://github.com/os2display/display-admin-client/pull/281)
10+
- Fixed screen status bugs.
11+
- [#274](https://github.com/os2display/display-admin-client/pull/274)
12+
- Added screen status to screen list.
13+
- Refactored screen status on screen edit.
14+
- Change campaign icon in screen list to boolean text.
15+
16+
## [2.3.0] - 2025-03-24
17+
18+
- [#279](https://github.com/os2display/display-admin-client/pull/279)
19+
- Eventdatabase v2 feed source - Change subscription endpoint.
20+
- Eventdatabase v2 feed source - Fixed options load.
21+
- [#271](https://github.com/os2display/display-admin-client/pull/271)
22+
- Added new feed source: Eventdatabasen v2.
23+
24+
## [2.2.0] - 2025-03-17
25+
726
- [#273](https://github.com/os2display/display-admin-client/pull/273)
827
- Fixed calendar api feed source config endpoint.
928
- [#272](https://github.com/os2display/display-admin-client/pull/272)

infrastructure/itkdev/etc/confd/templates/config.tmpl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"api": "{{ getenv "API_PATH" "/" }}",
33
"touchButtonRegions": "{{ getenv "APP_TOUCH_BUTTON_REGIONS" "false"}}",
44
"previewClient": "{{ getenv "APP_PREVIEW_CLIENT" "null"}}",
5+
"showScreenStatus": "{{ getenv "APP_SHOW_SCREEN_STATUS" "true"}}",
56
"rejseplanenApiKey": "{{ getenv "APP_REJSEPLANEN_API_KEY" "null"}}",
67
"loginMethods": [
78
{

infrastructure/os2display/etc/confd/templates/config.tmpl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"api": "{{ getenv "API_PATH" "/" }}",
33
"touchButtonRegions": "{{ getenv "APP_TOUCH_BUTTON_REGIONS" "false"}}",
44
"previewClient": "{{ getenv "APP_PREVIEW_CLIENT" "null"}}",
5+
"showScreenStatus": "{{ getenv "APP_SHOW_SCREEN_STATUS" "false"}}",
56
"rejseplanenApiKey": "{{ getenv "APP_REJSEPLANEN_API_KEY" "null"}}",
67
"loginMethods": [
78
{

public/example_config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"api": "/",
33
"touchButtonRegions": false,
44
"previewClient": null,
5+
"showScreenStatus": false,
56
"rejseplanenApiKey": null,
67
"loginMethods": [
78
{

src/app.jsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ function App() {
6464
const [page, setPage] = useState(1);
6565
const [createdBy, setCreatedBy] = useState("all");
6666
const [isPublished, setIsPublished] = useState("all");
67+
const [exists, setExists] = useState(null);
68+
const [screenUserLatestRequest, setScreenUserLatestRequest] = useState(null);
6769

6870
const userStore = {
6971
authenticated: { get: authenticated, set: setAuthenticated },
@@ -80,6 +82,11 @@ function App() {
8082
page: { get: page, set: setPage },
8183
createdBy: { get: createdBy, set: setCreatedBy },
8284
isPublished: { get: isPublished, set: setIsPublished },
85+
exists: { get: exists, set: setExists },
86+
screenUserLatestRequest: {
87+
get: screenUserLatestRequest,
88+
set: setScreenUserLatestRequest,
89+
},
8390
};
8491

8592
useEffect(() => {

src/components/feed-sources/feed-source-form.jsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import CalendarApiFeedType from "./templates/calendar-api-feed-type";
1313
import NotifiedFeedType from "./templates/notified-feed-type";
1414
import EventDatabaseApiFeedType from "./templates/event-database-feed-type";
1515
import StickyFooter from "../util/sticky-footer";
16+
import EventDatabaseApiV2FeedType from "./templates/event-database-v2-feed-type";
1617

1718
/**
1819
* The feed-source form component.
@@ -102,6 +103,14 @@ function FeedSourceForm({
102103
mode={mode}
103104
/>
104105
)}
106+
{feedSource?.feedType ===
107+
"App\\Feed\\EventDatabaseApiV2FeedType" && (
108+
<EventDatabaseApiV2FeedType
109+
handleInput={handleSecretInput}
110+
formStateObject={feedSource.secrets}
111+
mode={mode}
112+
/>
113+
)}
105114
{feedSource?.feedType === "App\\Feed\\NotifiedFeedType" && (
106115
<NotifiedFeedType
107116
handleInput={handleSecretInput}

src/components/feed-sources/feed-source-manager.jsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,15 @@ function FeedSourceManager({
6969
host: "",
7070
},
7171
},
72+
{
73+
value: "App\\Feed\\EventDatabaseApiV2FeedType",
74+
title: t("event-database-api-v2-feed-type.title"),
75+
key: "7",
76+
secretsDefault: {
77+
host: "",
78+
apikey: "",
79+
},
80+
},
7281
{
7382
value: "App\\Feed\\NotifiedFeedType",
7483
title: t("dynamic-fields.notified-feed-type.title"),
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import { React } from "react";
2+
import PropTypes from "prop-types";
3+
import { useTranslation } from "react-i18next";
4+
import FormInput from "../../util/forms/form-input";
5+
6+
const EventDatabaseApiV2FeedType = ({ handleInput, formStateObject, mode }) => {
7+
const { t } = useTranslation("common", {
8+
keyPrefix: "event-database-api-v2-feed-type",
9+
});
10+
return (
11+
<>
12+
<FormInput
13+
name="host"
14+
type="text"
15+
className="mb-2"
16+
label={t("host")}
17+
onChange={handleInput}
18+
value={formStateObject?.host}
19+
/>
20+
<FormInput
21+
name="apikey"
22+
type="text"
23+
label={t("apikey")}
24+
onChange={handleInput}
25+
placeholder={
26+
mode === "PUT" ? t("redacted-value-input-placeholder") : ""
27+
}
28+
value={formStateObject?.apikey}
29+
/>
30+
</>
31+
);
32+
};
33+
34+
EventDatabaseApiV2FeedType.propTypes = {
35+
handleInput: PropTypes.func,
36+
formStateObject: PropTypes.shape({
37+
host: PropTypes.string.isRequired,
38+
apikey: PropTypes.string,
39+
}),
40+
mode: PropTypes.string,
41+
};
42+
43+
export default EventDatabaseApiV2FeedType;

src/components/screen/screen-form.jsx

Lines changed: 5 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { Button, Form, Spinner, Alert, Col, Row } from "react-bootstrap";
33
import { useTranslation } from "react-i18next";
44
import { useNavigate } from "react-router-dom";
55
import PropTypes from "prop-types";
6-
import { useDispatch } from "react-redux";
76
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
87
import { faExpand } from "@fortawesome/free-solid-svg-icons";
98
import ContentBody from "../util/content-body/content-body";
@@ -14,17 +13,17 @@ import GridGenerationAndSelect from "./util/grid-generation-and-select";
1413
import MultiSelectComponent from "../util/forms/multiselect-dropdown/multi-dropdown";
1514
import idFromUrl from "../util/helpers/id-from-url";
1615
import {
17-
api,
1816
useGetV2LayoutsQuery,
1917
useGetV2ScreensByIdScreenGroupsQuery,
2018
} from "../../redux/api/api.generated.ts";
21-
import { displayError } from "../util/list/toast-component/display-toast";
2219
import FormCheckbox from "../util/forms/form-checkbox";
2320
import "./screen-form.scss";
2421
import Preview from "../preview/preview";
2522
import StickyFooter from "../util/sticky-footer";
2623
import Select from "../util/forms/select";
2724
import userContext from "../../context/user-context";
25+
import ScreenStatus from "./screen-status";
26+
import { displayError } from "../util/list/toast-component/display-toast";
2827

2928
/**
3029
* The screen form component.
@@ -55,11 +54,10 @@ function ScreenForm({
5554
const { t } = useTranslation("common", { keyPrefix: "screen-form" });
5655
const { config } = useContext(userContext);
5756
const navigate = useNavigate();
58-
const dispatch = useDispatch();
57+
5958
const [layoutError, setLayoutError] = useState(false);
6059
const [selectedLayout, setSelectedLayout] = useState();
6160
const [layoutOptions, setLayoutOptions] = useState();
62-
const [bindKey, setBindKey] = useState("");
6361
const { data: layouts } = useGetV2LayoutsQuery({
6462
page: 1,
6563
itemsPerPage: 20,
@@ -136,57 +134,6 @@ function ScreenForm({
136134
});
137135
};
138136

139-
const handleBindScreen = () => {
140-
if (bindKey) {
141-
dispatch(
142-
api.endpoints.postScreenBindKey.initiate({
143-
id: idFromUrl(screen["@id"]),
144-
screenBindObject: JSON.stringify({
145-
bindKey,
146-
}),
147-
})
148-
).then((response) => {
149-
if (response.error) {
150-
const err = response.error;
151-
displayError(
152-
t("error-messages.error-binding", {
153-
status: err.status,
154-
}),
155-
err
156-
);
157-
} else {
158-
// Set screenUser to true, to indicate it has been set.
159-
handleInput({ target: { id: "screenUser", value: true } });
160-
}
161-
});
162-
}
163-
};
164-
165-
const handleUnbindScreen = () => {
166-
if (screen?.screenUser) {
167-
setBindKey("");
168-
169-
dispatch(
170-
api.endpoints.postScreenUnbind.initiate({
171-
id: idFromUrl(screen["@id"]),
172-
})
173-
).then((response) => {
174-
if (response.error) {
175-
const err = response.error;
176-
displayError(
177-
t("error-messages.error-unbinding", {
178-
status: err.status,
179-
}),
180-
err
181-
);
182-
} else {
183-
// Set screenUser to null, to indicate it has been removed.
184-
handleInput({ target: { id: "screenUser", value: null } });
185-
}
186-
});
187-
}
188-
};
189-
190137
const isVertical = () => {
191138
if (screen?.orientation?.length > 0) {
192139
return screen.orientation[0].id === "vertical";
@@ -230,35 +177,7 @@ function ScreenForm({
230177
{Object.prototype.hasOwnProperty.call(screen, "@id") && (
231178
<ContentBody>
232179
<h2 className="h4 mb-3">{t("bind-header")}</h2>
233-
{screen?.screenUser && (
234-
<>
235-
<div className="mb-3">
236-
<Alert key="screen-bound" variant="success">
237-
{t("already-bound")}
238-
</Alert>
239-
</div>
240-
<Button onClick={handleUnbindScreen}>{t("unbind")}</Button>
241-
</>
242-
)}
243-
{!screen?.screenUser && (
244-
<>
245-
<div className="mb-3">
246-
<Alert key="screen-not-bound" variant="danger">
247-
{t("not-bound")}
248-
</Alert>
249-
</div>
250-
<FormInput
251-
onChange={({ target }) => {
252-
setBindKey(target?.value);
253-
}}
254-
name="bindKey"
255-
value={bindKey}
256-
label={t("bindkey-label")}
257-
className="mb-3"
258-
/>
259-
<Button onClick={handleBindScreen}>{t("bind")}</Button>
260-
</>
261-
)}
180+
<ScreenStatus screen={screen} handleInput={handleInput} />
262181
</ContentBody>
263182
)}
264183
<ContentBody>
@@ -494,6 +413,7 @@ ScreenForm.propTypes = {
494413
screenUser: PropTypes.string,
495414
size: PropTypes.string,
496415
title: PropTypes.string,
416+
status: PropTypes.shape({}),
497417
playlists: PropTypes.arrayOf(
498418
PropTypes.shape({ name: PropTypes.string, id: PropTypes.number })
499419
),

0 commit comments

Comments
 (0)