From 6f5a9bf76841d762c6381f1f97747efb9241d390 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Thu, 30 Nov 2017 17:28:24 +0100 Subject: [PATCH] ux: new page header progress --- pkg/api/index.go | 11 +-- .../app/features/org/partials/orgDetails.html | 3 +- public/app/features/org/partials/profile.html | 13 +-- public/app/features/org/prefs_control.ts | 2 +- public/app/features/org/profile_ctrl.ts | 2 +- .../plugins/partials/plugin_list.html | 85 +++++++++++-------- .../app/features/plugins/plugin_list_ctrl.ts | 32 +++---- public/sass/components/_page_header.scss | 3 - 8 files changed, 75 insertions(+), 76 deletions(-) diff --git a/pkg/api/index.go b/pkg/api/index.go index 36f20c82083..a1939eab8f6 100644 --- a/pkg/api/index.go +++ b/pkg/api/index.go @@ -117,22 +117,23 @@ func setIndexViewData(c *middleware.Context) (*dtos.IndexViewData, error) { if c.IsSignedIn { profileNode := &dtos.NavLink{ - Text: c.SignedInUser.Login, + Text: c.SignedInUser.Name, + SubTitle: c.SignedInUser.Login, Id: "profile", Img: data.User.GravatarUrl, Url: setting.AppSubUrl + "/profile", HideFromMenu: true, Children: []*dtos.NavLink{ - {Text: "Your profile", Url: setting.AppSubUrl + "/profile", Icon: "fa fa-fw fa-sliders"}, + {Text: "Preferences", Id: "profile-settings", Url: setting.AppSubUrl + "/profile", Icon: "fa fa-fw fa-sliders"}, {Text: "Change Password", Id: "change-password", Url: setting.AppSubUrl + "/profile/password", Icon: "fa fa-fw fa-lock", HideFromMenu: true}, }, } if !setting.DisableSignoutMenu { // add sign out first - profileNode.Children = append([]*dtos.NavLink{ - {Text: "Sign out", Url: setting.AppSubUrl + "/logout", Icon: "fa fa-fw fa-sign-out", Target: "_self"}, - }, profileNode.Children...) + profileNode.Children = append(profileNode.Children, &dtos.NavLink{ + Text: "Sign out", Id: "sign-out", Url: setting.AppSubUrl + "/logout", Icon: "fa fa-fw fa-sign-out", Target: "_self", + }) } data.NavTree = append(data.NavTree, profileNode) diff --git a/public/app/features/org/partials/orgDetails.html b/public/app/features/org/partials/orgDetails.html index 8d000a7b8d1..da99436a93d 100644 --- a/public/app/features/org/partials/orgDetails.html +++ b/public/app/features/org/partials/orgDetails.html @@ -32,7 +32,8 @@
-

General

+

Organization profile

+
diff --git a/public/app/features/org/partials/profile.html b/public/app/features/org/partials/profile.html index 851ebe9f9c6..02b0d27b84f 100644 --- a/public/app/features/org/partials/profile.html +++ b/public/app/features/org/partials/profile.html @@ -1,16 +1,9 @@ -
-
- - - -
-
+
+

User Profile

+ -

Information

Name diff --git a/public/app/features/org/prefs_control.ts b/public/app/features/org/prefs_control.ts index 1bc758bf2cc..7843b5229d1 100644 --- a/public/app/features/org/prefs_control.ts +++ b/public/app/features/org/prefs_control.ts @@ -49,7 +49,7 @@ export class PrefsControlCtrl { var template = ` -

Preferences

+

Preferences

UI Theme diff --git a/public/app/features/org/profile_ctrl.ts b/public/app/features/org/profile_ctrl.ts index e82df591382..6b007203d89 100644 --- a/public/app/features/org/profile_ctrl.ts +++ b/public/app/features/org/profile_ctrl.ts @@ -14,7 +14,7 @@ export class ProfileCtrl { constructor(private backendSrv, private contextSrv, private $location, navModelSrv) { this.getUser(); this.getUserOrgs(); - this.navModel = navModelSrv.getNav('profile'); + this.navModel = navModelSrv.getNav('profile', 'profile-settings', 0); } getUser() { diff --git a/public/app/features/plugins/partials/plugin_list.html b/public/app/features/plugins/partials/plugin_list.html index 225caf97017..efe036ec14f 100644 --- a/public/app/features/plugins/partials/plugin_list.html +++ b/public/app/features/plugins/partials/plugin_list.html @@ -1,42 +1,55 @@ + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
diff --git a/public/app/features/plugins/plugin_list_ctrl.ts b/public/app/features/plugins/plugin_list_ctrl.ts index ada1fc6a1ff..e8a501ff39e 100644 --- a/public/app/features/plugins/plugin_list_ctrl.ts +++ b/public/app/features/plugins/plugin_list_ctrl.ts @@ -1,34 +1,28 @@ -/// - import angular from 'angular'; +import _ from 'lodash'; export class PluginListCtrl { plugins: any[]; tabIndex: number; navModel: any; + searchQuery: string; + allPlugins: any[]; /** @ngInject */ constructor(private backendSrv: any, $location, navModelSrv) { this.tabIndex = 0; - this.navModel = navModelSrv.getNav('cfg', 'plugins'); + this.navModel = navModelSrv.getNav('cfg', 'plugins', 0); - var pluginType = $location.search().type || 'panel'; - switch (pluginType) { - case "datasource": { - this.tabIndex = 1; - break; - } - case "app": { - this.tabIndex = 2; - break; - } - case "panel": - default: - this.tabIndex = 0; - } - - this.backendSrv.get('api/plugins', {embedded: 0, type: pluginType}).then(plugins => { + this.backendSrv.get('api/plugins', {embedded: 0}).then(plugins => { this.plugins = plugins; + this.allPlugins = plugins; + }); + } + + onQueryUpdated() { + let regex = new RegExp(this.searchQuery, 'ig'); + this.plugins = _.filter(this.allPlugins, item => { + return regex.test(item.name) || regex.test(item.type); }); } } diff --git a/public/sass/components/_page_header.scss b/public/sass/components/_page_header.scss index 6544e15b935..2183ac23256 100644 --- a/public/sass/components/_page_header.scss +++ b/public/sass/components/_page_header.scss @@ -59,9 +59,6 @@ margin-right: $spacer/2; } -.page-header-info-block { -} - .page-header__sub-title { color: $text-muted; }