]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: Add html linter and fix lint errors
authorTiago Melo <tspmelo@gmail.com>
Tue, 25 Sep 2018 14:43:35 +0000 (15:43 +0100)
committerTiago Melo <tspmelo@gmail.com>
Wed, 26 Sep 2018 11:01:24 +0000 (12:01 +0100)
Signed-off-by: Tiago Melo <tmelo@suse.com>
13 files changed:
src/pybind/mgr/dashboard/frontend/html-linter.config.json [new file with mode: 0644]
src/pybind/mgr/dashboard/frontend/package-lock.json
src/pybind/mgr/dashboard/frontend/package.json
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-form/rbd-form.component.html
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-list/rbd-list.component.html
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-form/rbd-snapshot-form.component.html
src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-list/cephfs-list.component.html
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.html
src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/health/health.component.html
src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/info-card/info-card.component.html
src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-form/user-form.component.html
src/pybind/mgr/dashboard/frontend/src/app/core/navigation/navigation/navigation.component.html
src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.html

diff --git a/src/pybind/mgr/dashboard/frontend/html-linter.config.json b/src/pybind/mgr/dashboard/frontend/html-linter.config.json
new file mode 100644 (file)
index 0000000..bf91475
--- /dev/null
@@ -0,0 +1,12 @@
+{
+  "files": ["src/**/*.html"],
+  "indentation": {
+    "char": "space",
+    "number": 2
+  },
+  "attributes": {
+    "quotes": "double",
+    "whitespace": 0,
+    "vertical-align": true
+  }
+}
index 92f0325e761a850e7691407ddac15cff48505bb4..a7e597617e18a2d9df02a1eb8b3986f5b2a6a7d6 100644 (file)
       "integrity": "sha1-DfKTUfByEWNRXfueVUPl9u7VFi8=",
       "dev": true
     },
+    "html-linter": {
+      "version": "1.0.8",
+      "resolved": "https://registry.npmjs.org/html-linter/-/html-linter-1.0.8.tgz",
+      "integrity": "sha1-pAnzgLFh0mlhqQyO1m+aWzpdRtI=",
+      "dev": true,
+      "requires": {
+        "colors": "^1.1.2",
+        "commander": "^2.12.2",
+        "glob": "^7.1.2"
+      }
+    },
     "html-minifier": {
       "version": "3.5.20",
       "resolved": "https://registry.npmjs.org/html-minifier/-/html-minifier-3.5.20.tgz",
index 15b2709610af1d69f5d9270ba6f01a6736db33ff..7678416a5991b095adb1bd950c1c1eb32ec1a279 100644 (file)
@@ -11,7 +11,8 @@
     "lint": "ng lint",
     "e2e": "ng e2e",
     "prettier": "prettier --write \"{src,e2e}/**/*.{ts,scss}\"",
-    "prettier:lint": "prettier --list-different \"{src,e2e}/**/*.{ts,scss}\""
+    "prettier:lint": "prettier --list-different \"{src,e2e}/**/*.{ts,scss}\"",
+    "lint:html": "html-linter --config html-linter.config.json"
   },
   "private": true,
   "jest": {
@@ -74,6 +75,7 @@
     "@types/node": "8.10.23",
     "babel-preset-env": "1.7.0",
     "codelyzer": "4.4.3",
+    "html-linter": "1.0.8",
     "jasmine-core": "3.1.0",
     "jasmine-spec-reporter": "4.2.1",
     "jest": "23.4.2",
index d03f3edfeff438378b731af2cb9f12a6781af843..aeacc06f161e326b445ad33dd9661570dc7f10a0 100644 (file)
             </label>
             <div class="col-sm-9">
               <select id="obj_size"
-                    name="obj_size"
-                    class="form-control"
-                    formControlName="obj_size">
+                      name="obj_size"
+                      class="form-control"
+                      formControlName="obj_size">
                 <option *ngFor="let objectSize of objectSizes"
                         [value]="objectSize">{{ objectSize }}</option>
               </select>
                [ngClass]="{'has-error': rbdForm.showError('stripingUnit', formDir)}">
             <label class="control-label col-sm-3"
                    for="stripingUnit">
-              <span i18n>Stripe unit</span><span class="required"
-                                 *ngIf="rbdForm.getValue('stripingCount')"></span>
+              <span i18n>Stripe unit</span>
+              <span class="required"
+                    *ngIf="rbdForm.getValue('stripingCount')">
+              </span>
             </label>
             <div class="col-sm-9">
               <select id="stripingUnit"
-                    name="stripingUnit"
-                    class="form-control"
-                    formControlName="stripingUnit">
-                <option i18n [ngValue]="null">-- Select stripe unit --</option>
+                      name="stripingUnit"
+                      class="form-control"
+                      formControlName="stripingUnit">
+                <option i18n
+                        [ngValue]="null">-- Select stripe unit --</option>
                 <option *ngFor="let objectSize of objectSizes"
                         [value]="objectSize">{{ objectSize }}</option>
               </select>
                 This field is required because stripe count is defined!
               </span>
               <span i18n
-                  class="help-block"
-                  *ngIf="rbdForm.showError('stripingUnit', formDir, 'invalidStripingUnit')">
-              Stripe unit is greater than object size.
-            </span>
+                    class="help-block"
+                    *ngIf="rbdForm.showError('stripingUnit', formDir, 'invalidStripingUnit')">
+                Stripe unit is greater than object size.
+              </span>
             </div>
           </div>
 
                [ngClass]="{'has-error': rbdForm.showError('stripingCount', formDir)}">
             <label class="control-label col-sm-3"
                    for="stripingCount">
-              <span i18n>Stripe count</span><span class="required"
-                                  *ngIf="rbdForm.getValue('stripingUnit')"></span>
+              <span i18n>Stripe count</span>
+              <span class="required"
+                    *ngIf="rbdForm.getValue('stripingUnit')">
+              </span>
             </label>
             <div class="col-sm-9">
               <input id="stripingCount"
index 686c749fa9a84449f009977dde5e74007564fbfc..af73500de78872cb45cfa800d656743fb2f3c2e9 100644 (file)
@@ -11,9 +11,9 @@
           selectionType="single"
           (updateSelection)="updateSelection($event)">
   <cd-table-actions class="table-actions"
-    [permission]="permission"
-    [selection]="selection"
-    [tableActions]="tableActions">
+                    [permission]="permission"
+                    [selection]="selection"
+                    [tableActions]="tableActions">
   </cd-table-actions>
   <cd-rbd-details cdTableDetail
                   [selection]="selection">
index 38ca9d07f688c56fc4392ff687c8982c9cfddf09..61fbf0237f58397ba618bfaa480386105f49dfdf 100644 (file)
@@ -1,6 +1,9 @@
 <div class="modal-header">
   <h4 class="modal-title pull-left">{{ editing ? 'Rename' : 'Create' }} RBD Snapshot</h4>
-  <button type="button" class="close pull-right" aria-label="Close" (click)="modalRef.hide()">
+  <button type="button"
+          class="close pull-right"
+          aria-label="Close"
+          (click)="modalRef.hide()">
     <span aria-hidden="true">&times;</span>
   </button>
 </div>
@@ -30,8 +33,8 @@
         <span i18n
               class="help-block"
               *ngIf="snapshotForm.showError('snapshotName', formDir, 'required')">
-              This field is required.
-            </span>
+          This field is required.
+        </span>
       </div>
     </div>
 
@@ -43,8 +46,9 @@
                         (submitAction)="submit()">
         {{ editing ? 'Rename' : 'Create' }} Snapshot
       </cd-submit-button>
-      <button type="button" class="btn btn-sm btn-default" (click)="modalRef.hide()">Close</button>
+      <button type="button"
+              class="btn btn-sm btn-default"
+              (click)="modalRef.hide()">Close</button>
     </div>
   </div>
 </form>
-
index b3fecb3eca39b56621a78c390024f22b9461538e..5f1b3a3f6c6c77112bcfea378ce15d5ae578c86b 100644 (file)
@@ -7,6 +7,6 @@
           selectionType="single"
           (updateSelection)="updateSelection($event)">
   <cd-cephfs-detail cdTableDetail
-             [selection]="selection">
+                    [selection]="selection">
   </cd-cephfs-detail>
 </cd-table>
index b0148ccb796eaaa86ec900f1b47ba35e97f9434e..71d6fec3e3858a8cf4eeb3baec164f5019dc07ca 100644 (file)
   </cd-osd-details>
 </cd-table>
 
-<ng-template #statusColor let-value="value">
+<ng-template #statusColor
+             let-value="value">
   <span *ngFor="let state of value; last as last">
     <span class="label"
-           [ngClass]="{'label-success': ['in', 'up'].includes(state), 'label-danger': ['down', 'out'].includes(state)}">{{ state }}</span>
+          [ngClass]="{'label-success': ['in', 'up'].includes(state), 'label-danger': ['down', 'out'].includes(state)}">
+      {{ state }}
+    </span>
     <span *ngIf="!last">&nbsp;</span>
   </span>
 </ng-template>
index f579e3873858a541ca8020c2dadd3be112e3c521..4d93b698e9ee935d97fb012dd375b8d040c04f12 100644 (file)
@@ -1,4 +1,5 @@
-<div *ngIf="contentData" class="container-fluid">
+<div *ngIf="contentData"
+     class="container-fluid">
   <cd-info-group groupTitle="Status"
                  i18n-groupTitle
                  class="row info-group">
@@ -10,7 +11,8 @@
                   contentClass="content-highlight"
                   (click)="contentData.health.checks.length > 0 ? healthChecksTarget.toggle() : ''">
       <ng-template #healthChecks>
-        <p class="logs-link" i18n>
+        <p class="logs-link"
+           i18n>
           &rarr; See <a (click)="viewportScroller.scrollToAnchor('logs')">Logs</a> for more details.
         </p>
         <ul>
       </ng-template>
       <div class="health-popover-wrapper">
         <div [ngStyle]="contentData.health.status | healthColor"
-              [popover]="contentData.health.checks.length > 0 ? healthChecks : ''"
-              triggers=""
-              #healthChecksTarget="bs-popover"
-              placement="bottom">
+             [popover]="contentData.health.checks.length > 0 ? healthChecks : ''"
+             triggers=""
+             #healthChecksTarget="bs-popover"
+             placement="bottom">
           {{ contentData.health.status }}
         </div>
       </div>
@@ -45,7 +47,8 @@
                   class="col-sm-6 col-md-4 col-lg-3"
                   contentClass="content-highlight"
                   *ngIf="contentData.osd_map">
-      <span *ngFor="let result of (contentData.osd_map | osdSummary)" [ngStyle]="result.style">
+      <span *ngFor="let result of (contentData.osd_map | osdSummary)"
+            [ngStyle]="result.style">
         {{ result.content }}
       </span>
     </cd-info-card>
                   contentClass="card-chart"
                   (click)="pgStatusTarget.toggle()">
       <ng-template #pgStatus>
-        <p class="logs-link" i18n>
+        <p class="logs-link"
+           i18n>
           &rarr; See <a (click)="viewportScroller.scrollToAnchor('logs')">Logs</a> for more details.
         </p>
         <ul>
       </ng-template>
       <div class="pg-status-popover-wrapper">
         <div [popover]="pgStatus"
-              triggers=""
-              #pgStatusTarget="bs-popover"
-              placement="bottom">
+             triggers=""
+             #pgStatusTarget="bs-popover"
+             placement="bottom">
           <cd-health-pie [data]="contentData"
                          chartType="pie"
                          [displayLegend]="true"
                   cardClass="card-medium"
                   contentClass="no-center scroll text-monospace"
                   *ngIf="contentData.clog">
-        <p *ngFor="let line of contentData.clog">
-          {{ line.stamp }}&nbsp;{{ line.priority }}&nbsp;
-          <span [ngStyle]="line | logColor">
-            {{ line.message }}
-            <br>
-          </span>
-        </p>
+      <p *ngFor="let line of contentData.clog">
+        {{ line.stamp }}&nbsp;{{ line.priority }}&nbsp;
+        <span [ngStyle]="line | logColor">
+          {{ line.message }}
+          <br>
+        </span>
+      </p>
     </cd-info-card>
     <cd-info-card cardTitle="Audit"
                   i18n-cardTitle
                   cardClass="card-medium"
                   contentClass="no-center scroll text-monospace"
                   *ngIf="contentData.audit_log">
-        <p *ngFor="let line of contentData.audit_log">
-          {{ line.stamp }}&nbsp;{{ line.priority }}&nbsp;
-          <span [ngStyle]="line | logColor">
-            <span style="font-weight: bold;">
-              {{ line.message }}
-            </span>
-            <br>
+      <p *ngFor="let line of contentData.audit_log">
+        {{ line.stamp }}&nbsp;{{ line.priority }}&nbsp;
+        <span [ngStyle]="line | logColor">
+          <span style="font-weight: bold;">
+            {{ line.message }}
           </span>
-        </p>
+          <br>
+        </span>
+      </p>
     </cd-info-card>
   </cd-info-group>
 </div>
index 74324485b641359ecc59085bf4acd0a9ca7a677a..ae672510a8cccb83cc5286c58dfb08a333aaab08 100644 (file)
@@ -1,11 +1,14 @@
-<div class="card" [ngClass]="cardClass">
+<div class="card"
+     [ngClass]="cardClass">
   <div class="card-title">
-    <a *ngIf="link; else noLinkTitle" [routerLink]="link">{{ cardTitle }}</a>
+    <a *ngIf="link; else noLinkTitle"
+       [routerLink]="link">{{ cardTitle }}</a>
     <ng-template #noLinkTitle>
       {{ cardTitle }}
     </ng-template>
   </div>
-  <div class="card-body" [ngClass]="contentClass">
-      <ng-content></ng-content>
+  <div class="card-body"
+       [ngClass]="contentClass">
+    <ng-content></ng-content>
   </div>
 </div>
index f42d8e7c6e006e2ea5311ae87363453ef46b6317..8639cd6e64865b338a8cc3f88dbad5475bbc3853 100644 (file)
           </label>
           <div class="col-sm-9">
             <div class="input-group">
-                <input class="form-control"
-                       type="password"
-                       placeholder="Password..."
-                       id="password"
-                       name="password"
-                       formControlName="password">
-                <span class="input-group-btn">
-                  <button type="button"
-                          class="btn btn-default"
-                          cdPasswordButton="password">
-                  </button>
-                </span>
-              </div>
+              <input class="form-control"
+                     type="password"
+                     placeholder="Password..."
+                     id="password"
+                     name="password"
+                     formControlName="password">
+              <span class="input-group-btn">
+                <button type="button"
+                        class="btn btn-default"
+                        cdPasswordButton="password">
+                </button>
+              </span>
+            </div>
             <span i18n
                   class="help-block"
                   *ngIf="userForm.showError('password', formDir, 'required')">
           </label>
           <div class="col-sm-9">
             <div class="input-group">
-                <input class="form-control"
-                       type="password"
-                       placeholder="Confirm password..."
-                       id="confirmpassword"
-                       name="confirmpassword"
-                       formControlName="confirmpassword">
-                <span class="input-group-btn">
-                  <button type="button"
-                          class="btn btn-default"
-                          cdPasswordButton="confirmpassword">
-                  </button>
-                </span>
-              </div>
+              <input class="form-control"
+                     type="password"
+                     placeholder="Confirm password..."
+                     id="confirmpassword"
+                     name="confirmpassword"
+                     formControlName="confirmpassword">
+              <span class="input-group-btn">
+                <button type="button"
+                        class="btn btn-default"
+                        cdPasswordButton="confirmpassword">
+                </button>
+              </span>
+            </div>
             <span i18n
                   class="help-block"
                   *ngIf="userForm.showError('confirmpassword', formDir, 'required')">
         </label>
         <div class="col-sm-9">
           <span class="form-control no-border full-height">
-            <cd-select-badges
-                [data]="userForm.controls.roles.value"
-                [options]="allRoles"
-                emptyMessage="There are no roles."></cd-select-badges>
+            <cd-select-badges [data]="userForm.controls.roles.value"
+                              [options]="allRoles"
+                              emptyMessage="There are no roles."></cd-select-badges>
           </span>
         </div>
 
index beae9ebf906222517d1cb66de34c967990bf5687..910e759212aaaf1c6426078d1be4c2af3506d345 100644 (file)
            routerLink="/cephfs">Filesystems
         </a>
       </li>
-      <!--
-  <li routerLinkActive="active"
-          class="tc_menuitem tc_menuitem_ceph_osds">
-        <a i18n
-           routerLink="/cephOsds">OSDs
-        </a>
-      </li>
-      <li routerLinkActive="active"
-          class="tc_menuitem tc_menuitem_ceph_pools">
-        <a i18n
-           routerLink="/cephPools">Pools
-        </a>
-      </li>
-      -->
 
       <!-- Object Gateway -->
       <li dropdown
           </li>
         </ul>
       </li>
-
-      <!--
-      <li routerLinkActive="active"
-          class="tc_menuitem tc_submenuitem_settings">
-        <a i18n
-           routerLink="/settings">Settings
-        </a>
-      </li>
-      -->
     </ul>
     <!-- /.navbar-primary -->
 
index 7054312f83ae04a3cad032dfabacf413d093e088..d9b68758d060332a2781054715dcb93fcac62567 100644 (file)
@@ -19,7 +19,7 @@
       <input class="form-control"
              type="text"
              [(ngModel)]="search"
-             (keyup)='updateFilter($event)'>
+             (keyup)="updateFilter($event)">
       <span class="input-group-btn">
         <button type="button"
                 class="btn btn-default clear-input tc_clearInputBtn"
 <ng-template #sparklineTpl
              let-row="row"
              let-value="value">
-  <cd-sparkline [data]="value" [isBinary]="row.cdIsBinary"></cd-sparkline>
+  <cd-sparkline [data]="value"
+                [isBinary]="row.cdIsBinary"></cd-sparkline>
 </ng-template>
 
 <ng-template #routerLinkTpl