Skip to content

Commit

Permalink
Merge pull request #288 from pawelmalak/feature
Browse files Browse the repository at this point in the history
Version 2.2.1
  • Loading branch information
pawelmalak authored Jan 8, 2022
2 parents 6d8ce53 + fac8ef4 commit 750891c
Show file tree
Hide file tree
Showing 8 changed files with 83 additions and 56 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PORT=5005
NODE_ENV=development
VERSION=2.2.0
VERSION=2.2.1
PASSWORD=flame_password
SECRET=e02eb43d69953658c6d07311d6313f2d4467672cb881f96b29368ba1f3f4da4b
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
### v2.2.1 (2022-01-08)
- Local search will now include app descriptions ([#266](https://github.com/pawelmalak/flame/issues/266))
- Fixed bug with unsupported characters in local search [#279](https://github.com/pawelmalak/flame/issues/279))
- Background tasks optimization ([#283](https://github.com/pawelmalak/flame/issues/283))

### v2.2.0 (2021-12-17)
- Added option to set custom description for apps ([#201](https://github.com/pawelmalak/flame/issues/201))
- Fixed fatal error while deploying Flame to cluster ([#242](https://github.com/pawelmalak/flame/issues/242))
Expand Down
2 changes: 1 addition & 1 deletion client/.env
Original file line number Diff line number Diff line change
@@ -1 +1 @@
REACT_APP_VERSION=2.2.0
REACT_APP_VERSION=2.2.1
6 changes: 4 additions & 2 deletions client/src/components/Home/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,10 @@ export const Home = (): JSX.Element => {
if (localSearch) {
// Search through apps
setAppSearchResult([
...apps.filter(({ name }) =>
new RegExp(escapeRegex(localSearch), 'i').test(name)
...apps.filter(({ name, description }) =>
new RegExp(escapeRegex(localSearch), 'i').test(
`${name} ${description}`
)
),
]);

Expand Down
3 changes: 2 additions & 1 deletion client/src/components/SearchBar/SearchBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ export const SearchBar = (props: Props): JSX.Element => {
);

if (isLocal) {
setLocalSearch(search);
// no additional encoding required for local search
setLocalSearch(inputRef.current.value);
}

if (e.code === 'Enter' || e.code === 'NumpadEnter') {
Expand Down
72 changes: 43 additions & 29 deletions client/src/components/Settings/AppDetails/AppDetails.tsx
Original file line number Diff line number Diff line change
@@ -1,43 +1,57 @@
import { Fragment } from 'react';

// UI
import { Button, SettingsHeadline } from '../../UI';
import { AuthForm } from './AuthForm/AuthForm';
import classes from './AppDetails.module.css';

// Store
import { useSelector } from 'react-redux';
import { State } from '../../../store/reducers';

// Other
import { checkVersion } from '../../../utility';
import { AuthForm } from './AuthForm/AuthForm';

export const AppDetails = (): JSX.Element => {
const { isAuthenticated } = useSelector((state: State) => state.auth);

return (
<Fragment>
<SettingsHeadline text="Authentication" />
<AuthForm />

<hr className={classes.separator} />

<div>
<SettingsHeadline text="App version" />
<p className={classes.text}>
<a
href="https://github.com/pawelmalak/flame"
target="_blank"
rel="noreferrer"
>
Flame
</a>{' '}
version {process.env.REACT_APP_VERSION}
</p>

<p className={classes.text}>
See changelog{' '}
<a
href="https://github.com/pawelmalak/flame/blob/master/CHANGELOG.md"
target="_blank"
rel="noreferrer"
>
here
</a>
</p>

<Button click={() => checkVersion(true)}>Check for updates</Button>
</div>
{isAuthenticated && (
<Fragment>
<hr className={classes.separator} />

<div>
<SettingsHeadline text="App version" />
<p className={classes.text}>
<a
href="https://github.com/pawelmalak/flame"
target="_blank"
rel="noreferrer"
>
Flame
</a>{' '}
version {process.env.REACT_APP_VERSION}
</p>

<p className={classes.text}>
See changelog{' '}
<a
href="https://github.com/pawelmalak/flame/blob/master/CHANGELOG.md"
target="_blank"
rel="noreferrer"
>
here
</a>
</p>

<Button click={() => checkVersion(true)}>Check for updates</Button>
</div>
</Fragment>
)}
</Fragment>
);
};
1 change: 1 addition & 0 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const logger = new Logger();
await initApp();
await connectDB();
await associateModels();
await jobs();

// Create server for Express API and WebSockets
const server = http.createServer();
Expand Down
48 changes: 26 additions & 22 deletions utils/jobs.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,34 @@ const Logger = require('./Logger');
const loadConfig = require('./loadConfig');
const logger = new Logger();

// Update weather data every 15 minutes
const weatherJob = schedule.scheduleJob(
'updateWeather',
'0 */15 * * * *',
async () => {
const { WEATHER_API_KEY: secret } = await loadConfig();
module.exports = async function () {
const { WEATHER_API_KEY } = await loadConfig();

try {
const weatherData = await getExternalWeather();
if (WEATHER_API_KEY != '') {
// Update weather data every 15 minutes
const weatherJob = schedule.scheduleJob(
'updateWeather',
'0 */15 * * * *',
async () => {
try {
const weatherData = await getExternalWeather();

Sockets.getSocket('weather').socket.send(JSON.stringify(weatherData));
} catch (err) {
if (secret) {
logger.log(err.message, 'ERROR');
Sockets.getSocket('weather').socket.send(JSON.stringify(weatherData));
} catch (err) {
if (WEATHER_API_KEY) {
logger.log(err.message, 'ERROR');
}
}
}
}
}
);
);

// Clear old weather data every 4 hours
const weatherCleanerJob = schedule.scheduleJob(
'clearWeather',
'0 5 */4 * * *',
async () => {
clearWeatherData();
// Clear old weather data every 4 hours
const weatherCleanerJob = schedule.scheduleJob(
'clearWeather',
'0 5 */4 * * *',
async () => {
clearWeatherData();
}
);
}
);
};

0 comments on commit 750891c

Please sign in to comment.