Refactored action.run method
This commit is contained in:
parent
632f9872a4
commit
a9280b1256
2 changed files with 9 additions and 9 deletions
|
@ -159,7 +159,7 @@ export default {
|
||||||
type: String,
|
type: String,
|
||||||
default: `async (app, args) => {
|
default: `async (app, args) => {
|
||||||
// Run some action on the host
|
// Run some action on the host
|
||||||
const status = await app.run({ name: 'music.mpd.pause' }, args.host);
|
const status = await app.run({ action: 'music.mpd.pause' }, args.host);
|
||||||
|
|
||||||
// Send notifications to the browser
|
// Send notifications to the browser
|
||||||
app.notify(status.state, 'Music status changed');
|
app.notify(status.state, 'Music status changed');
|
||||||
|
@ -291,7 +291,7 @@ export default {
|
||||||
if (this.actionMode === 'request') {
|
if (this.actionMode === 'request') {
|
||||||
this.actionResponse = await this.run(
|
this.actionResponse = await this.run(
|
||||||
{
|
{
|
||||||
name: this.action.name,
|
action: this.action.name,
|
||||||
args: this.getActionArgs(),
|
args: this.getActionArgs(),
|
||||||
},
|
},
|
||||||
this.host
|
this.host
|
||||||
|
@ -338,7 +338,7 @@ export default {
|
||||||
try {
|
try {
|
||||||
this.plugins = await this.run(
|
this.plugins = await this.run(
|
||||||
{
|
{
|
||||||
name: 'inspect.get_all_plugins',
|
action: 'inspect.get_all_plugins',
|
||||||
args: {
|
args: {
|
||||||
html_doc: false,
|
html_doc: false,
|
||||||
},
|
},
|
||||||
|
@ -346,7 +346,7 @@ export default {
|
||||||
this.host
|
this.host
|
||||||
);
|
);
|
||||||
|
|
||||||
this.procedures = await this.run({ name: 'inspect.get_procedures' }, this.host);
|
this.procedures = await this.run({ action: 'inspect.get_procedures' }, this.host);
|
||||||
} finally {
|
} finally {
|
||||||
this.pluginsLoading = false;
|
this.pluginsLoading = false;
|
||||||
}
|
}
|
||||||
|
@ -413,7 +413,7 @@ export default {
|
||||||
iconClass: iconClass,
|
iconClass: iconClass,
|
||||||
color: color.length ? color : null,
|
color: color.length ? color : null,
|
||||||
hosts: hosts,
|
hosts: hosts,
|
||||||
name: this.action.name,
|
action: this.action.name,
|
||||||
args: this.getActionArgs(),
|
args: this.getActionArgs(),
|
||||||
categories: this.selectedCategories.map(obj => obj.text),
|
categories: this.selectedCategories.map(obj => obj.text),
|
||||||
};
|
};
|
||||||
|
|
|
@ -127,7 +127,7 @@ export default {
|
||||||
execURL,
|
execURL,
|
||||||
{
|
{
|
||||||
type: 'request',
|
type: 'request',
|
||||||
action: action.name,
|
action: action.action,
|
||||||
args: args,
|
args: args,
|
||||||
},
|
},
|
||||||
config
|
config
|
||||||
|
@ -342,7 +342,7 @@ export default {
|
||||||
try {
|
try {
|
||||||
await this.run(
|
await this.run(
|
||||||
{
|
{
|
||||||
name: 'file.mkdir',
|
action: 'file.mkdir',
|
||||||
args: { directory: basedir },
|
args: { directory: basedir },
|
||||||
},
|
},
|
||||||
host
|
host
|
||||||
|
@ -350,7 +350,7 @@ export default {
|
||||||
|
|
||||||
await this.run(
|
await this.run(
|
||||||
{
|
{
|
||||||
name: 'file.write',
|
action: 'file.write',
|
||||||
args: {
|
args: {
|
||||||
file: filename,
|
file: filename,
|
||||||
content: config,
|
content: config,
|
||||||
|
@ -383,7 +383,7 @@ export default {
|
||||||
try {
|
try {
|
||||||
return await this.run(
|
return await this.run(
|
||||||
{
|
{
|
||||||
name: 'file.read',
|
action: 'file.read',
|
||||||
args: { file: filename },
|
args: { file: filename },
|
||||||
},
|
},
|
||||||
host
|
host
|
||||||
|
|
Loading…
Reference in a new issue