feat(apps): more progress on app pages

This commit is contained in:
Torkel Ödegaard 2016-02-09 12:10:59 +01:00
parent 18eb9d6076
commit 0def04ad34
9 changed files with 30 additions and 25 deletions

View File

@ -1,4 +1,2 @@
<h1>Nginx logs view</h1>
Logs! Logs!

View File

@ -1,4 +1,2 @@
<h1>Nginx stream view</h1> streams!
testing!

View File

@ -1,5 +1,7 @@
///<reference path="../../headers/common.d.ts" /> ///<reference path="../../headers/common.d.ts" />
import './dashboard_loaders';
import angular from 'angular'; import angular from 'angular';
import coreModule from 'app/core/core_module'; import coreModule from 'app/core/core_module';
import {BundleLoader} from './bundle_loader'; import {BundleLoader} from './bundle_loader';

View File

@ -5,19 +5,21 @@ import _ from 'lodash';
export class AppEditCtrl { export class AppEditCtrl {
appModel: any; appModel: any;
appId: any;
includedPanels: any; includedPanels: any;
/** @ngInject */ /** @ngInject */
constructor(private backendSrv: any, private $routeParams: any) { constructor(private backendSrv: any, private $routeParams: any) {
this.appModel = {}; this.appModel = {};
this.appId = $routeParams.appId;
this.backendSrv.get(`/api/org/apps/${this.$routeParams.appId}/settings`).then(result => { this.backendSrv.get(`/api/org/apps/${this.appId}/settings`).then(result => {
this.appModel = result; this.appModel = result;
this.includedPanels = _.where(result.includes, {type: 'panel'}); this.includedPanels = _.where(result.includes, {type: 'panel'});
}); });
} }
update(options) { update() {
var updateCmd = _.extend({ var updateCmd = _.extend({
appId: this.appModel.appId, appId: this.appModel.appId,
orgId: this.appModel.orgId, orgId: this.appModel.orgId,
@ -25,19 +27,19 @@ export class AppEditCtrl {
pinned: this.appModel.pinned, pinned: this.appModel.pinned,
jsonData: this.appModel.jsonData, jsonData: this.appModel.jsonData,
secureJsonData: this.appModel.secureJsonData, secureJsonData: this.appModel.secureJsonData,
}, options); }, {});
this.backendSrv.post(`/api/org/apps/${this.$routeParams.appId}/settings`, updateCmd).then(function() { this.backendSrv.post(`/api/org/apps/${this.appId}/settings`, updateCmd).then(function() {
window.location.href = window.location.href; window.location.href = window.location.href;
}); });
} }
toggleEnabled() { toggleEnabled() {
this.update({enabled: this.appModel.enabled}); this.update();
} }
togglePinned() { togglePinned() {
this.update({pinned: this.appModel.pinned}); this.update();
} }
} }

View File

@ -6,9 +6,8 @@ export class AppListCtrl {
apps: any[]; apps: any[];
/** @ngInject */ /** @ngInject */
constructor(private backendSrv: any) {} constructor(private backendSrv: any) {
init() {
this.backendSrv.get('api/org/apps').then(apps => { this.backendSrv.get('api/org/apps').then(apps => {
this.apps = apps; this.apps = apps;
}); });

View File

@ -5,11 +5,14 @@ import _ from 'lodash';
export class AppPageCtrl { export class AppPageCtrl {
page: any; page: any;
appId: any;
appModel: any; appModel: any;
/** @ngInject */ /** @ngInject */
constructor(private backendSrv, private $routeParams: any, private $rootScope) { constructor(private backendSrv, private $routeParams: any, private $rootScope) {
this.backendSrv.get(`/api/org/apps/${this.$routeParams.appId}/settings`).then(app => { this.appId = $routeParams.appId;
this.backendSrv.get(`/api/org/apps/${this.appId}/settings`).then(app => {
this.appModel = app; this.appModel = app;
this.page = _.findWhere(app.pages, {slug: this.$routeParams.slug}); this.page = _.findWhere(app.pages, {slug: this.$routeParams.slug});
if (!this.page) { if (!this.page) {

View File

@ -78,7 +78,7 @@
</div> </div>
<ul> <ul>
<li ng-repeat="page in ctrl.appModel.pages"> <li ng-repeat="page in ctrl.appModel.pages">
<a href="{{page.url}}" class="external-link">{{page.name}}</a> <a href="apps/{{ctrl.appId}}/page/{{page.slug}}" class="external-link">{{page.name}}</a>
</li> </li>
</ul> </ul>
</div> </div>

View File

@ -2,7 +2,7 @@
</navbar> </navbar>
<div class="page-container"> <div class="page-container">
<div class="page-wide" ng-init="ctrl.init()"> <div class="page-wide">
<h1>Apps</h1> <h1>Apps</h1>
<div ng-if="!ctrl.apps"> <div ng-if="!ctrl.apps">
@ -18,7 +18,7 @@
<li> <li>
<div class="filter-list-card-controls"> <div class="filter-list-card-controls">
<div class="filter-list-card-config"> <div class="filter-list-card-config">
<a href="apps/edit/{{app.appId}}"> <a href="apps/{{app.appId}}/edit">
<i class="fa fa-cog"></i> <i class="fa fa-cog"></i>
</a> </a>
</div> </div>

View File

@ -1,14 +1,17 @@
<navbar icon="fa fa-fw fa-cubes" title="{{ctrl.appModel.name}}" subnav="true"> <navbar icon="fa fa-fw fa-cubes" title="{{ctrl.appModel.name}}" title-url="apps/{{ctrl.appId}}/edit" subnav="true">
<ul class="nav"> <ul class="nav">
<li class="active"><a href="apps/nginx">{{ctrl.page.name}}</a></li> <li class="active"><a href="apps/{{ctrl.appId}}/ctrl.page.slug">{{ctrl.page.name}}</a></li>
</ul> </ul>
</navbar> </navbar>
<h2> <div class="page-container">
App page <div class="page-wide">
</h2> <h1>{{ctrl.page.name}}</h1>
<div ng-if="ctrl.page"> <div ng-if="ctrl.page">
<plugin-component type="app-page" page="ctrl.page"> <plugin-component type="app-page">
</plugin-component> </plugin-component>
</div>
</div>
</div> </div>