Skip to content

Commit

Permalink
API updates for table without pagination
Browse files Browse the repository at this point in the history
  • Loading branch information
cheton committed Mar 4, 2017
1 parent 9c35004 commit 8a27aaf
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 18 deletions.
15 changes: 7 additions & 8 deletions src/web/containers/Header/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,19 +72,18 @@ class Header extends Component {
// Ignore error
}
},
getCommands: async () => {
fetchCommands: async () => {
try {
const res = await api.commands.getCommands();
const { commands = [] } = res.body;

const res = await api.commands.fetch({ paging: false });
const { records: commands } = res.body;
this.setState({ commands: commands });
} catch (res) {
// Ignore error
}
},
runCommand: async (cmd) => {
try {
const res = await api.commands.runCommand({ id: cmd.id });
const res = await api.commands.run(cmd.id);
const { taskId } = res.body;

this.setState({
Expand Down Expand Up @@ -167,7 +166,7 @@ class Header extends Component {
}
},
'config:change': () => {
this.actions.getCommands();
this.actions.fetchCommands();
}
};

Expand All @@ -176,7 +175,7 @@ class Header extends Component {

// Initial actions
this.actions.checkForUpdates();
this.actions.getCommands();
this.actions.fetchCommands();
}
componentWillUnmount() {
this.removeControllerEvents();
Expand Down Expand Up @@ -281,7 +280,7 @@ class Header extends Component {
)}
id="nav-dropdown-user"
title={
<div title={i18n._('Account')}>
<div title={i18n._('My Account')}>
<i className="fa fa-fw fa-user" />
</div>
}
Expand Down
4 changes: 2 additions & 2 deletions src/web/widgets/Macro/Macro.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class Macro extends Component {
handleEditMacro(id) {
const { actions } = this.props;

api.macros.get(id)
api.macros.read(id)
.then((res) => {
const { id, name, content } = res.body;
actions.openModal(MODAL_STATE_EDIT_MACRO, { id, name, content });
Expand Down Expand Up @@ -118,7 +118,7 @@ class Macro extends Component {
onClick={() => {
this.confirmLoadMacro({ name: macro.name })
.then(() => {
return api.macros.get(macro.id);
return api.macros.read(macro.id);
})
.then((res) => {
const { id, name, content } = res.body;
Expand Down
16 changes: 8 additions & 8 deletions src/web/widgets/Macro/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ class MacroWidget extends Component {
fetchMacros: async () => {
try {
let res;
res = await api.macros.fetch();
const macros = res.body;
res = await api.macros.fetch({ paging: false });
const { records: macros } = res.body;
this.setState({ macros: macros });
} catch (err) {
// Ignore error
Expand All @@ -49,8 +49,8 @@ class MacroWidget extends Component {
try {
let res;
res = await api.macros.create({ name, content });
res = await api.macros.fetch();
const macros = res.body;
res = await api.macros.fetch({ paging: false });
const { records: macros } = res.body;
this.setState({ macros: macros });
} catch (err) {
// Ignore error
Expand All @@ -60,8 +60,8 @@ class MacroWidget extends Component {
try {
let res;
res = await api.macros.delete(id);
res = await api.macros.fetch();
const macros = res.body;
res = await api.macros.fetch({ paging: false });
const { records: macros } = res.body;
this.setState({ macros: macros });
} catch (err) {
// Ignore error
Expand All @@ -71,8 +71,8 @@ class MacroWidget extends Component {
try {
let res;
res = await api.macros.update(id, { name, content });
res = await api.macros.fetch();
const macros = res.body;
res = await api.macros.fetch({ paging: false });
const { records: macros } = res.body;
this.setState({ macros: macros });
} catch (err) {
// Ignore error
Expand Down

0 comments on commit 8a27aaf

Please sign in to comment.