This repository has been archived by the owner on Jun 11, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
plugin list start/stop, still not working, missing uuid for api calls
- Loading branch information
Showing
8 changed files
with
333 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<link rel="import" href="../bower_components/polymer/polymer.html"> | ||
|
||
<polymer-element name="nautes-plugin-add" attributes=""> | ||
<template> | ||
<style> | ||
:host { | ||
display: block; | ||
} | ||
</style> | ||
</template> | ||
<script> | ||
Polymer({ | ||
|
||
}); | ||
</script> | ||
</polymer-element> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<link rel="import" href="../bower_components/polymer/polymer.html"> | ||
|
||
<polymer-element name="nautes-plugin-list" attributes="toast bgColor"> | ||
<template> | ||
<style> | ||
:host { | ||
display: block; | ||
background-color: {{bgColor}}; | ||
width: 100%; | ||
} | ||
</style> | ||
|
||
<fd-rest-element-service id="getPluginsService" | ||
fdtype="plugins" | ||
fditems="{{plugins}}" | ||
toast="{{toast}}"> | ||
</fd-rest-element-service> | ||
|
||
<div layout vertical center> | ||
<template repeat="{{plugin in plugins}}"> | ||
<nautes-plugin-row | ||
toast="{{toast}}" | ||
bgColor="{{bgColor}}" | ||
plugin="{{plugin}}" | ||
on-remove="{{reloadList}}" | ||
on-start="{{reloadList}}" | ||
on-stop="{{reloadList}}"> | ||
</nautes-plugin-row> | ||
</template> | ||
</div> | ||
</template> | ||
<script> | ||
|
||
Polymer("nautes-plugin-list",{ | ||
|
||
reloadList: function(){ | ||
this.$.getPluginsService.go(); | ||
} | ||
|
||
}); | ||
|
||
</script> | ||
</polymer-element> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,154 @@ | ||
<link rel="import" href="../bower_components/polymer/polymer.html"> | ||
<link rel="import" href="../bower_components/core-icon/core-icon.html"> | ||
<link rel="import" href="../bower_components/core-icons/core-icons.html"> | ||
<link rel="import" href="../bower_components/core-icons/image-icons.html"> | ||
<link rel="import" href="../bower_components/core-icons/hardware-icons.html"> | ||
<link rel="import" href="../bower_components/paper-shadow/paper-shadow.html"> | ||
<link rel="import" href="../bower_components/paper-ripple/paper-ripple.html"> | ||
|
||
<link rel="import" href="../elements/nautes-open-sans.html"> | ||
<link rel="import" href="../elements/fd-rest-element-service.html"> | ||
|
||
|
||
<polymer-element name="nautes-plugin-row" attributes="plugin bgColor"> | ||
<template> | ||
<style> | ||
|
||
:host { | ||
display: block; | ||
position: relative; | ||
background-color: {{bgColor}}; | ||
width: 100%; | ||
font-size: 1.2rem; | ||
font-weight: 300; | ||
font-family: Open Sans; | ||
} | ||
|
||
.plugin-row { | ||
margin-bottom: 10px; | ||
padding: 20px; | ||
color: #444; | ||
min-height: 70px; | ||
font-size: 1.5em; | ||
} | ||
|
||
.icon{ | ||
margin-left: 30px; | ||
color: #444; | ||
width: 80px; | ||
height: 80px; | ||
} | ||
|
||
.icon-remove{ | ||
color: #444; | ||
position: absolute; | ||
right: 10px; | ||
top: 10px; | ||
border-radius: 50%; | ||
border: 2px solid #444; | ||
} | ||
|
||
.receiver{ | ||
font-size: 0.5em; | ||
} | ||
|
||
paper-ripple { | ||
z-index: 1; | ||
color: #aaaaff; | ||
} | ||
|
||
</style> | ||
|
||
<fd-rest-element-service id="deletePluginService" | ||
auto="false" | ||
method="DELETE" | ||
fdtype="plugins/{{plugin.uuid}}" | ||
on-rest-response="{{removed}}" | ||
on-rest-error="{{notRemoved}}" | ||
toast="{{toast}}"> | ||
</fd-rest-element-service> | ||
|
||
<fd-rest-element-service id="startPluginService" | ||
auto="false" | ||
method="POST" | ||
fdtype="plugins/{{plugin.uuid}}/start" | ||
on-rest-response="{{started}}" | ||
toast="{{toast}}"> | ||
</fd-rest-element-service> | ||
|
||
<fd-rest-element-service id="stopPluginService" | ||
auto="false" | ||
method="POST" | ||
fdtype="plugins/{{plugin.uuid}}/stop" | ||
on-rest-response="{{stopped}}" | ||
toast="{{toast}}"> | ||
</fd-rest-element-service> | ||
|
||
<div layout horizontal center start> | ||
|
||
<core-icon class="icon-remove" icon="clear" on-tap="{{removePlugin}}"> | ||
</core-icon> | ||
|
||
<template if="{{plugin.status === 'STOPPED'}}"> | ||
<core-icon class="icon" icon="av:play-circle-fill" on-tap="{{startPlugin}}"> | ||
<paper-ripple class="circle" fit></paper-ripple> | ||
</core-icon> | ||
</template> | ||
<template if="{{plugin.status === 'RUNNING'}}"> | ||
<core-icon class="icon" icon="av:pause-circle-fill" on-tap="{{stopPlugin}}"> | ||
<paper-ripple class="circle" fit></paper-ripple> | ||
</core-icon> | ||
</template> | ||
|
||
<div class="plugin-row" flex> | ||
<div>{{plugin.pluginName}}</div> | ||
</div> | ||
|
||
<paper-shadow z="1"></paper-shadow> | ||
</div> | ||
|
||
</template> | ||
<script> | ||
Polymer("nautes-plugin-row",{ | ||
|
||
removePlugin: function(){ | ||
this.$.deleteCommandService.go(); | ||
this.style.display = "none"; | ||
}, | ||
|
||
removed: function(){ | ||
this.fire("remove"); | ||
}, | ||
|
||
notRemoved: function(){ | ||
this.style.display = "block"; | ||
}, | ||
|
||
startPlugin: function(){ | ||
this.$.startPluginService.go(); | ||
}, | ||
|
||
stopPlugin: function(){ | ||
this.$.stopPluginService.go(); | ||
}, | ||
|
||
started: function(event){ | ||
if(this.toast){ | ||
this.toast.text= this.command.name + " started with success! "; | ||
this.toast.show(); | ||
} | ||
this.fire("start"); | ||
}, | ||
|
||
stopped: function(event){ | ||
if(this.toast){ | ||
this.toast.text= this.command.name + " stopped with success! "; | ||
this.toast.show(); | ||
} | ||
this.fire("stop"); | ||
} | ||
|
||
}); | ||
</script> | ||
</polymer-element> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
<link rel="import" href="../bower_components/polymer/polymer.html"> | ||
<link rel="import" href="../bower_components/core-icons/core-icons.html"> | ||
<link rel="import" href="../bower_components/core-icons/hardware-icons.html"> | ||
<link rel="import" href="../bower_components/core-icon-button/core-icon-button.html"> | ||
|
||
<link rel="import" href="../elements/nautes-plugin-list.html"> | ||
<link rel="import" href="../elements/nautes-plugin-add.html"> | ||
<link rel="import" href="../elements/nautes-open-sans.html"> | ||
|
||
<polymer-element name="nautes-plugins" attributes=""> | ||
<template> | ||
<style> | ||
|
||
:host { | ||
display: block; | ||
width: 100%; | ||
font-family: Open Sans; | ||
} | ||
|
||
.header{ | ||
background-color: rgba(255,50,50,0.1); | ||
padding-top: 10px; | ||
padding-bottom: 10px; | ||
color: #444; | ||
width: 100%; | ||
} | ||
|
||
core-icon-button{ | ||
border: 1px solid rgba(64,64,64,0.3); | ||
min-width: 110px; | ||
text-align: center; | ||
} | ||
|
||
.pluginbtn { | ||
margin: 5px; | ||
background-color: #f88; | ||
} | ||
|
||
</style> | ||
|
||
<div layout vertical center> | ||
|
||
<div class="header" layout vertical center> | ||
<div layout horizontal center> | ||
|
||
<template if="{{!showAddPlugin}}"> | ||
<core-icon-button | ||
class="pluginbtn" | ||
icon="add-box" | ||
on-tap="{{addPlugin}}"> | ||
PLUGIN | ||
</core-icon-button> | ||
</template> | ||
|
||
<template if="{{!showList}}"> | ||
<core-icon-button | ||
class="pluginbtn" | ||
icon="extension" | ||
on-tap="{{showPluginList}}"> | ||
LIST | ||
</core-icon-button> | ||
</template> | ||
|
||
</div> | ||
</div> | ||
|
||
<template if="{{showList}}"> | ||
<nautes-plugin-list | ||
bgColor="{{bgColor}}" | ||
toast="{{toast}}"> | ||
</nautes-plugin-list> | ||
</template> | ||
|
||
<template if="{{showAddPlugin}}"> | ||
<nautes-plugin-add | ||
smallQuery="max-width: 640px" | ||
bgColor="{{bgColor}}" | ||
toast="{{toast}}"> | ||
</nautes-plugin-add> | ||
</template> | ||
|
||
</div> | ||
|
||
</template> | ||
<script> | ||
Polymer("nautes-plugins",{ | ||
|
||
showList: true, | ||
|
||
showAddPlugin: false, | ||
|
||
addPlugin: function(){ | ||
this.showList = false; | ||
this.showAddPlugin = !this.showAddPlugin; | ||
}, | ||
|
||
showPluginList: function(){ | ||
this.showList = !this.showList; | ||
this.showAddPlugin = false; | ||
} | ||
|
||
}); | ||
</script> | ||
</polymer-element> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters