Skip to content

Commit 750891c

Browse files
authored
Merge pull request #288 from pawelmalak/feature
Version 2.2.1
2 parents 6d8ce53 + fac8ef4 commit 750891c

File tree

8 files changed

+83
-56
lines changed

8 files changed

+83
-56
lines changed

.env

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
PORT=5005
22
NODE_ENV=development
3-
VERSION=2.2.0
3+
VERSION=2.2.1
44
PASSWORD=flame_password
55
SECRET=e02eb43d69953658c6d07311d6313f2d4467672cb881f96b29368ba1f3f4da4b

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
### v2.2.1 (2022-01-08)
2+
- Local search will now include app descriptions ([#266](https://github.com/pawelmalak/flame/issues/266))
3+
- Fixed bug with unsupported characters in local search [#279](https://github.com/pawelmalak/flame/issues/279))
4+
- Background tasks optimization ([#283](https://github.com/pawelmalak/flame/issues/283))
5+
16
### v2.2.0 (2021-12-17)
27
- Added option to set custom description for apps ([#201](https://github.com/pawelmalak/flame/issues/201))
38
- Fixed fatal error while deploying Flame to cluster ([#242](https://github.com/pawelmalak/flame/issues/242))

client/.env

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
REACT_APP_VERSION=2.2.0
1+
REACT_APP_VERSION=2.2.1

client/src/components/Home/Home.tsx

+4-2
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,10 @@ export const Home = (): JSX.Element => {
6464
if (localSearch) {
6565
// Search through apps
6666
setAppSearchResult([
67-
...apps.filter(({ name }) =>
68-
new RegExp(escapeRegex(localSearch), 'i').test(name)
67+
...apps.filter(({ name, description }) =>
68+
new RegExp(escapeRegex(localSearch), 'i').test(
69+
`${name} ${description}`
70+
)
6971
),
7072
]);
7173

client/src/components/SearchBar/SearchBar.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ export const SearchBar = (props: Props): JSX.Element => {
6969
);
7070

7171
if (isLocal) {
72-
setLocalSearch(search);
72+
// no additional encoding required for local search
73+
setLocalSearch(inputRef.current.value);
7374
}
7475

7576
if (e.code === 'Enter' || e.code === 'NumpadEnter') {
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,57 @@
11
import { Fragment } from 'react';
2+
3+
// UI
24
import { Button, SettingsHeadline } from '../../UI';
5+
import { AuthForm } from './AuthForm/AuthForm';
36
import classes from './AppDetails.module.css';
7+
8+
// Store
9+
import { useSelector } from 'react-redux';
10+
import { State } from '../../../store/reducers';
11+
12+
// Other
413
import { checkVersion } from '../../../utility';
5-
import { AuthForm } from './AuthForm/AuthForm';
614

715
export const AppDetails = (): JSX.Element => {
16+
const { isAuthenticated } = useSelector((state: State) => state.auth);
17+
818
return (
919
<Fragment>
1020
<SettingsHeadline text="Authentication" />
1121
<AuthForm />
1222

13-
<hr className={classes.separator} />
14-
15-
<div>
16-
<SettingsHeadline text="App version" />
17-
<p className={classes.text}>
18-
<a
19-
href="https://github.com/pawelmalak/flame"
20-
target="_blank"
21-
rel="noreferrer"
22-
>
23-
Flame
24-
</a>{' '}
25-
version {process.env.REACT_APP_VERSION}
26-
</p>
27-
28-
<p className={classes.text}>
29-
See changelog{' '}
30-
<a
31-
href="https://github.com/pawelmalak/flame/blob/master/CHANGELOG.md"
32-
target="_blank"
33-
rel="noreferrer"
34-
>
35-
here
36-
</a>
37-
</p>
38-
39-
<Button click={() => checkVersion(true)}>Check for updates</Button>
40-
</div>
23+
{isAuthenticated && (
24+
<Fragment>
25+
<hr className={classes.separator} />
26+
27+
<div>
28+
<SettingsHeadline text="App version" />
29+
<p className={classes.text}>
30+
<a
31+
href="https://github.com/pawelmalak/flame"
32+
target="_blank"
33+
rel="noreferrer"
34+
>
35+
Flame
36+
</a>{' '}
37+
version {process.env.REACT_APP_VERSION}
38+
</p>
39+
40+
<p className={classes.text}>
41+
See changelog{' '}
42+
<a
43+
href="https://github.com/pawelmalak/flame/blob/master/CHANGELOG.md"
44+
target="_blank"
45+
rel="noreferrer"
46+
>
47+
here
48+
</a>
49+
</p>
50+
51+
<Button click={() => checkVersion(true)}>Check for updates</Button>
52+
</div>
53+
</Fragment>
54+
)}
4155
</Fragment>
4256
);
4357
};

server.js

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ const logger = new Logger();
2323
await initApp();
2424
await connectDB();
2525
await associateModels();
26+
await jobs();
2627

2728
// Create server for Express API and WebSockets
2829
const server = http.createServer();

utils/jobs.js

+26-22
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,34 @@ const Logger = require('./Logger');
66
const loadConfig = require('./loadConfig');
77
const logger = new Logger();
88

9-
// Update weather data every 15 minutes
10-
const weatherJob = schedule.scheduleJob(
11-
'updateWeather',
12-
'0 */15 * * * *',
13-
async () => {
14-
const { WEATHER_API_KEY: secret } = await loadConfig();
9+
module.exports = async function () {
10+
const { WEATHER_API_KEY } = await loadConfig();
1511

16-
try {
17-
const weatherData = await getExternalWeather();
12+
if (WEATHER_API_KEY != '') {
13+
// Update weather data every 15 minutes
14+
const weatherJob = schedule.scheduleJob(
15+
'updateWeather',
16+
'0 */15 * * * *',
17+
async () => {
18+
try {
19+
const weatherData = await getExternalWeather();
1820

19-
Sockets.getSocket('weather').socket.send(JSON.stringify(weatherData));
20-
} catch (err) {
21-
if (secret) {
22-
logger.log(err.message, 'ERROR');
21+
Sockets.getSocket('weather').socket.send(JSON.stringify(weatherData));
22+
} catch (err) {
23+
if (WEATHER_API_KEY) {
24+
logger.log(err.message, 'ERROR');
25+
}
26+
}
2327
}
24-
}
25-
}
26-
);
28+
);
2729

28-
// Clear old weather data every 4 hours
29-
const weatherCleanerJob = schedule.scheduleJob(
30-
'clearWeather',
31-
'0 5 */4 * * *',
32-
async () => {
33-
clearWeatherData();
30+
// Clear old weather data every 4 hours
31+
const weatherCleanerJob = schedule.scheduleJob(
32+
'clearWeather',
33+
'0 5 */4 * * *',
34+
async () => {
35+
clearWeatherData();
36+
}
37+
);
3438
}
35-
);
39+
};

0 commit comments

Comments
 (0)