Browse Source

feat(apps): pages work

Torkel Ödegaard 10 years ago
parent
commit
a15984b663

+ 8 - 6
pkg/api/dtos/apps.go

@@ -6,12 +6,13 @@ import (
 )
 
 type AppSettings struct {
-	Name     string                 `json:"name"`
-	AppId    string                 `json:"appId"`
-	Enabled  bool                   `json:"enabled"`
-	Pinned   bool                   `json:"pinned"`
-	Info     *plugins.PluginInfo    `json:"info"`
-	JsonData map[string]interface{} `json:"jsonData"`
+	Name     string                   `json:"name"`
+	AppId    string                   `json:"appId"`
+	Enabled  bool                     `json:"enabled"`
+	Pinned   bool                     `json:"pinned"`
+	Info     *plugins.PluginInfo      `json:"info"`
+	Pages    []*plugins.AppPluginPage `json:"pages"`
+	JsonData map[string]interface{}   `json:"jsonData"`
 }
 
 func NewAppSettingsDto(def *plugins.AppPlugin, data *models.AppSettings) *AppSettings {
@@ -19,6 +20,7 @@ func NewAppSettingsDto(def *plugins.AppPlugin, data *models.AppSettings) *AppSet
 		AppId: def.Id,
 		Name:  def.Name,
 		Info:  &def.Info,
+		Pages: def.Pages,
 	}
 
 	if data != nil {

+ 3 - 3
pkg/plugins/app_plugin.go

@@ -7,7 +7,7 @@ import (
 )
 
 type AppPluginPage struct {
-	Text    string          `json:"text"`
+	Name    string          `json:"name"`
 	Url     string          `json:"url"`
 	ReqRole models.RoleType `json:"reqRole"`
 }
@@ -19,8 +19,8 @@ type AppPluginCss struct {
 
 type AppPlugin struct {
 	FrontendPluginBase
-	Css  *AppPluginCss    `json:"css"`
-	Page []*AppPluginPage `json:"page"`
+	Css   *AppPluginCss    `json:"css"`
+	Pages []*AppPluginPage `json:"pages"`
 
 	Pinned  bool `json:"-"`
 	Enabled bool `json:"-"`

+ 2 - 0
pkg/plugins/models.go

@@ -24,6 +24,8 @@ type PluginInfo struct {
 	Description string           `json:"description"`
 	Links       []PluginInfoLink `json:"links"`
 	Logos       PluginLogos      `json:"logos"`
+	Version     string           `json:"version"`
+	Updated     string           `json:"updated"`
 }
 
 type PluginInfoLink struct {

+ 14 - 10
public/app/features/apps/partials/edit.html

@@ -21,9 +21,15 @@
 	</div>
 
   <div class="page-wide-margined" ng-init="ctrl.init()">
-		<h1>{{ctrl.appModel.name}}</h1>
+		<h1>
+			{{ctrl.appModel.name}}
+		</h1>
 		<em>
-			{{ctrl.appModel.info.description}}
+			{{ctrl.appModel.info.description}}<br>
+			<span style="small">
+			Version: {{ctrl.appModel.info.version}} &nbsp; &nbsp; Updated: {{ctrl.appModel.info.updated}}
+		</span>
+
 		</em>
 		<br><br>
 
@@ -42,8 +48,7 @@
 						Dashboards
 					</div>
 					<ul>
-						<li>Test</li>
-						<li>Test2</li>
+						<li><em class="small">None</em></li>
 					</ul>
 				</div>
 				<div class="simple-box-body simple-box-column">
@@ -52,8 +57,7 @@
 						Panels
 					</div>
 					<ul>
-						<li>Test</li>
-						<li>Test2</li>
+						<li><em class="small">None</em></li>
 					</ul>
 				</div>
 				<div class="simple-box-body simple-box-column">
@@ -62,8 +66,7 @@
 						Datasources
 					</div>
 					<ul>
-						<li>Test</li>
-						<li>Test2</li>
+						<li><em class="small">None</em></li>
 					</ul>
 				</div>
 				<div class="simple-box-body simple-box-column">
@@ -72,8 +75,9 @@
 						Pages
 					</div>
 					<ul>
-						<li>Test</li>
-						<li>Test2</li>
+						<li ng-repeat="page in ctrl.appModel.pages">
+							<a href="{{page.url}}" class="external-link">{{page.name}}</a>
+						</li>
 					</ul>
 				</div>