Przeglądaj źródła

minor refactoring and markup fix

Torkel Ödegaard 10 lat temu
rodzic
commit
8149381f01
2 zmienionych plików z 12 dodań i 10 usunięć
  1. 4 4
      public/app/partials/login.html
  2. 8 6
      public/app/services/contextSrv.js

+ 4 - 4
public/app/partials/login.html

@@ -23,7 +23,7 @@
 							<strong>User</strong>
             </li>
             <li>
-              <input type="text" name="username" class="tight-form-input last" required ng-model='formModel.user' placeholder="email or username" style="width: 255px">
+              <input type="text" name="username" class="tight-form-input last" required ng-model='formModel.user' placeholder="email or username" style="width: 253px">
             </li>
           </ul>
           <div class="clearfix"></div>
@@ -34,7 +34,7 @@
 							<strong>Password</strong>
             </li>
             <li>
-							<input type="password" name="password" class="tight-form-input last" required ng-model="formModel.password" id="inputPassword" style="width: 255px" placeholder="password">
+							<input type="password" name="password" class="tight-form-input last" required ng-model="formModel.password" id="inputPassword" style="width: 253px" placeholder="password">
             </li>
           </ul>
           <div class="clearfix"></div>
@@ -46,7 +46,7 @@
 							<strong>Email</strong>
             </li>
             <li>
-              <input type="email" class="tight-form-input last" required ng-model='formModel.email' placeholder="email" style="width: 255px">
+              <input type="email" class="tight-form-input last" required ng-model='formModel.email' placeholder="email" style="width: 253px">
             </li>
           </ul>
           <div class="clearfix"></div>
@@ -58,7 +58,7 @@
 							<strong>Password</strong>
             </li>
             <li>
-							<input type="password" class="tight-form-input last" watch-change="passwordChanged(inputValue)" ng-minlength="4" required ng-model='formModel.password' placeholder="password" style="width: 255px">
+							<input type="password" class="tight-form-input last" watch-change="passwordChanged(inputValue)" ng-minlength="4" required ng-model='formModel.password' placeholder="password" style="width: 253px">
             </li>
           </ul>
           <div class="clearfix"></div>

+ 8 - 6
public/app/services/contextSrv.js

@@ -40,24 +40,26 @@ function (angular, _, store, config) {
       }, 50);
     };
 
+    this.getSidemenuDefault = function() {
+      return this.hasRole('Admin');
+    };
+
     this.version = config.buildInfo.version;
     this.lightTheme = false;
     this.user = new User();
     this.isSignedIn = this.user.isSignedIn;
     this.isGrafanaAdmin = this.user.isGrafanaAdmin;
-    var sidemenuDefault = false;
-    if (this.hasRole('Admin')) {
-      sidemenuDefault = true;
-    }
-    this.sidemenu = store.getBool('grafana.sidemenu', sidemenuDefault);
+    this.sidemenu = store.getBool('grafana.sidemenu', this.getSidemenuDefault());
+
     if (this.isSignedIn && !store.exists('grafana.sidemenu')) {
-      // If the sidemnu has never been set before, set it to false.
+      // If the sidemenu has never been set before, set it to false.
       // This will result in this.sidemenu and the localStorage grafana.sidemenu
       // to be out of sync if the user has an admin role.  But this is
       // intentional and results in the user seeing the sidemenu only on
       // their first login.
       store.set('grafana.sidemenu', false);
     }
+
     this.isEditor = this.hasRole('Editor') || this.hasRole('Admin');
   });
 });