Fix issue where the client crashes when goto app action is selected

This commit supplies the missing prop 'apps' to Table component
and EventSelector component so that they can properly display the
apps.

This commit also modifies the get-all-apps query logic such that
if the queried page is 0, it fetches all the apps.

It adds a filtering logic such that presently only the apps with
slugs are listed as targets for goto app action.
This commit is contained in:
Sherfin Shamsudeen 2021-08-24 15:57:48 +05:30
parent 900e0e06fb
commit b76f18bbba
4 changed files with 7 additions and 2 deletions

View file

@ -230,6 +230,7 @@ class Table extends React.Component {
eventOptionUpdated={this.actionButtonEventOptionUpdated}
currentState={this.state.currentState}
extraData={{ actionButton: action, index: index }} // This data is returned in the callbacks
apps={this.props.apps}
/>
<button className="btn btn-sm btn-outline-danger col" onClick={() => this.removeAction(index)}>
Remove

View file

@ -51,7 +51,7 @@ export const EventSelector = ({
function getAllApps() {
let appsOptionsList = [];
apps.map((item) => {
apps.filter(item => item.slug != undefined).map((item) => {
appsOptionsList.push({
name: item.name,
value: item.slug

View file

@ -191,6 +191,7 @@ export const Inspector = ({
components={components}
currentState={currentState}
darkMode={darkMode}
apps={apps}
/>
}

View file

@ -16,7 +16,10 @@ export const appService = {
function getAll(page, folder) {
const requestOptions = { method: 'GET', headers: authHeader() };
return fetch(`${config.apiUrl}/apps?page=${page}&folder=${folder || ''}`, requestOptions).then(handleResponse);
if (page === 0)
return fetch(`${config.apiUrl}/apps`, requestOptions).then(handleResponse);
else
return fetch(`${config.apiUrl}/apps?page=${page}&folder=${folder || ''}`, requestOptions).then(handleResponse);
}
function createApp() {