Skip to content

Commit 54e72e5

Browse files
committed
Merge branch 'release/2.4.0'
2 parents dca80ed + f67508b commit 54e72e5

File tree

19 files changed

+16682
-16096
lines changed

19 files changed

+16682
-16096
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@ All notable changes to this project will be documented in this file.
55

66
## [Unreleased]
77

8+
## [2.4.0] - 2025-03-31
9+
10+
- [#281](https://github.com/os2display/display-admin-client/pull/281)
11+
- Fixed screen status bugs.
12+
- [#274](https://github.com/os2display/display-admin-client/pull/274)
13+
- Added screen status to screen list.
14+
- Refactored screen status on screen edit.
15+
- Change campaign icon in screen list to boolean text.
16+
817
## [2.3.0] - 2025-03-24
918

1019
- [#279](https://github.com/os2display/display-admin-client/pull/279)

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

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

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

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

public/example_config.json

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

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/screen/screen-form.jsx

Lines changed: 6 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import { React, useEffect, useState } from "react";
2-
import { Button, Form, Spinner, Alert } from "react-bootstrap";
2+
import { Button, Form, Spinner } 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 ContentBody from "../util/content-body/content-body";
87
import ContentFooter from "../util/content-footer/content-footer";
98
import FormInput from "../util/forms/form-input";
@@ -13,13 +12,13 @@ import GridGenerationAndSelect from "./util/grid-generation-and-select";
1312
import MultiSelectComponent from "../util/forms/multiselect-dropdown/multi-dropdown";
1413
import idFromUrl from "../util/helpers/id-from-url";
1514
import {
16-
api,
1715
useGetV2LayoutsQuery,
1816
useGetV2ScreensByIdScreenGroupsQuery,
1917
} from "../../redux/api/api.generated.ts";
20-
import { displayError } from "../util/list/toast-component/display-toast";
2118
import FormCheckbox from "../util/forms/form-checkbox";
2219
import "./screen-form.scss";
20+
import ScreenStatus from "./screen-status";
21+
import { displayError } from "../util/list/toast-component/display-toast";
2322

2423
/**
2524
* The screen form component.
@@ -49,11 +48,10 @@ function ScreenForm({
4948
}) {
5049
const { t } = useTranslation("common", { keyPrefix: "screen-form" });
5150
const navigate = useNavigate();
52-
const dispatch = useDispatch();
51+
5352
const [layoutError, setLayoutError] = useState(false);
5453
const [selectedLayout, setSelectedLayout] = useState();
5554
const [layoutOptions, setLayoutOptions] = useState();
56-
const [bindKey, setBindKey] = useState("");
5755
const { data: layouts } = useGetV2LayoutsQuery({
5856
page: 1,
5957
itemsPerPage: 20,
@@ -112,57 +110,6 @@ function ScreenForm({
112110
});
113111
};
114112

115-
const handleBindScreen = () => {
116-
if (bindKey) {
117-
dispatch(
118-
api.endpoints.postScreenBindKey.initiate({
119-
id: idFromUrl(screen["@id"]),
120-
screenBindObject: JSON.stringify({
121-
bindKey,
122-
}),
123-
})
124-
).then((response) => {
125-
if (response.error) {
126-
const err = response.error;
127-
displayError(
128-
t("error-messages.error-binding", {
129-
status: err.status,
130-
}),
131-
err
132-
);
133-
} else {
134-
// Set screenUser to true, to indicate it has been set.
135-
handleInput({ target: { id: "screenUser", value: true } });
136-
}
137-
});
138-
}
139-
};
140-
141-
const handleUnbindScreen = () => {
142-
if (screen?.screenUser) {
143-
setBindKey("");
144-
145-
dispatch(
146-
api.endpoints.postScreenUnbind.initiate({
147-
id: idFromUrl(screen["@id"]),
148-
})
149-
).then((response) => {
150-
if (response.error) {
151-
const err = response.error;
152-
displayError(
153-
t("error-messages.error-unbinding", {
154-
status: err.status,
155-
}),
156-
err
157-
);
158-
} else {
159-
// Set screenUser to null, to indicate it has been removed.
160-
handleInput({ target: { id: "screenUser", value: null } });
161-
}
162-
});
163-
}
164-
};
165-
166113
const isVertical = () => {
167114
if (screen?.orientation?.length > 0) {
168115
return screen.orientation[0].id === "vertical";
@@ -203,35 +150,7 @@ function ScreenForm({
203150
{Object.prototype.hasOwnProperty.call(screen, "@id") && (
204151
<ContentBody>
205152
<h2 className="h4 mb-3">{t("bind-header")}</h2>
206-
{screen?.screenUser && (
207-
<>
208-
<div className="mb-3">
209-
<Alert key="screen-bound" variant="success">
210-
{t("already-bound")}
211-
</Alert>
212-
</div>
213-
<Button onClick={handleUnbindScreen}>{t("unbind")}</Button>
214-
</>
215-
)}
216-
{!screen?.screenUser && (
217-
<>
218-
<div className="mb-3">
219-
<Alert key="screen-not-bound" variant="danger">
220-
{t("not-bound")}
221-
</Alert>
222-
</div>
223-
<FormInput
224-
onChange={({ target }) => {
225-
setBindKey(target?.value);
226-
}}
227-
name="bindKey"
228-
value={bindKey}
229-
label={t("bindkey-label")}
230-
className="mb-3"
231-
/>
232-
<Button onClick={handleBindScreen}>{t("bind")}</Button>
233-
</>
234-
)}
153+
<ScreenStatus screen={screen} handleInput={handleInput} />
235154
</ContentBody>
236155
)}
237156
<ContentBody>
@@ -371,6 +290,7 @@ ScreenForm.propTypes = {
371290
screenUser: PropTypes.string,
372291
size: PropTypes.string,
373292
title: PropTypes.string,
293+
status: PropTypes.shape({}),
374294
playlists: PropTypes.arrayOf(
375295
PropTypes.shape({ name: PropTypes.string, id: PropTypes.number })
376296
),

src/components/screen/screen-list.jsx

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import {
1818
displayError,
1919
} from "../util/list/toast-component/display-toast";
2020
import "./screen-list.scss";
21+
import ConfigLoader from "../../config-loader";
2122

2223
/**
2324
* The screen list component.
@@ -31,6 +32,8 @@ function ScreenList() {
3132
searchText: { get: searchText },
3233
page: { get: page },
3334
createdBy: { get: createdBy },
35+
exists: { get: exists },
36+
screenUserLatestRequest: { get: screenUserLatestRequest },
3437
} = useContext(ListContext);
3538
const { selected, setSelected } = useModal();
3639

@@ -40,6 +43,7 @@ function ScreenList() {
4043
const [loadingMessage, setLoadingMessage] = useState(
4144
t("loading-messages.loading-screens")
4245
);
46+
const [showScreenStatus, setShowScreenStatus] = useState(false);
4347

4448
// Delete call
4549
const [
@@ -51,25 +55,30 @@ function ScreenList() {
5155
const {
5256
data,
5357
error: screensGetError,
58+
isFetching,
5459
isLoading,
5560
refetch,
5661
} = useGetV2ScreensQuery({
5762
page,
5863
order: { title: "asc" },
5964
search: searchText,
6065
createdBy,
66+
exists,
67+
"screenUser.latestRequest": screenUserLatestRequest,
6168
});
6269

70+
useEffect(() => {
71+
ConfigLoader.loadConfig().then((config) => {
72+
setShowScreenStatus(config.showScreenStatus);
73+
});
74+
}, []);
75+
6376
useEffect(() => {
6477
if (data) {
6578
setListData(data);
6679
}
6780
}, [data]);
6881

69-
useEffect(() => {
70-
refetch();
71-
}, [searchText, page, createdBy]);
72-
7382
// If the tenant is changed, data should be refetched
7483
useEffect(() => {
7584
if (context.selectedTenant.get) {
@@ -110,21 +119,22 @@ function ScreenList() {
110119
setLoadingMessage(t("loading-messages.deleting-screen"));
111120
};
112121

122+
// Error with retrieving list of screen
123+
useEffect(() => {
124+
if (screensGetError) {
125+
displayError(t("error-messages.screens-load-error"), screensGetError);
126+
}
127+
}, [screensGetError]);
128+
113129
// The columns for the table.
114130
const columns = ScreenColumns({
115131
handleDelete,
116132
apiCall: useGetV2ScreensByIdScreenGroupsQuery,
117133
infoModalRedirect: "/group/edit",
118134
infoModalTitle: t("info-modal.screen-in-groups"),
135+
displayStatus: showScreenStatus,
119136
});
120137

121-
// Error with retrieving list of screen
122-
useEffect(() => {
123-
if (screensGetError) {
124-
displayError(t("error-messages.screens-load-error"), screensGetError);
125-
}
126-
}, [screensGetError]);
127-
128138
return (
129139
<>
130140
<ContentHeader
@@ -142,7 +152,9 @@ function ScreenList() {
142152
calendarViewPossible
143153
handleDelete={handleDelete}
144154
isLoading={isLoading || isDeleting}
155+
isFetching={isFetching}
145156
loadingMessage={loadingMessage}
157+
enableScreenStatus={showScreenStatus}
146158
/>
147159
)}
148160
</>

0 commit comments

Comments
 (0)