From 8256e82eceb917bff194f9e9c610afbb53d76428 Mon Sep 17 00:00:00 2001 From: Tiago Melo Date: Tue, 25 Sep 2018 15:43:35 +0100 Subject: [PATCH] mgr/dashboard: Add html linter and fix lint errors Signed-off-by: Tiago Melo --- .../frontend/html-linter.config.json | 12 ++++ .../mgr/dashboard/frontend/package-lock.json | 11 ++++ .../mgr/dashboard/frontend/package.json | 4 +- .../block/rbd-form/rbd-form.component.html | 35 ++++++----- .../block/rbd-list/rbd-list.component.html | 6 +- .../rbd-snapshot-form.component.html | 14 +++-- .../cephfs-list/cephfs-list.component.html | 2 +- .../osd/osd-list/osd-list.component.html | 7 ++- .../dashboard/health/health.component.html | 56 ++++++++++-------- .../info-card/info-card.component.html | 11 ++-- .../auth/user-form/user-form.component.html | 59 +++++++++---------- .../navigation/navigation.component.html | 23 -------- .../datatable/table/table.component.html | 5 +- 13 files changed, 133 insertions(+), 112 deletions(-) create mode 100644 src/pybind/mgr/dashboard/frontend/html-linter.config.json 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 index 0000000000000..bf91475d80ff8 --- /dev/null +++ b/src/pybind/mgr/dashboard/frontend/html-linter.config.json @@ -0,0 +1,12 @@ +{ + "files": ["src/**/*.html"], + "indentation": { + "char": "space", + "number": 2 + }, + "attributes": { + "quotes": "double", + "whitespace": 0, + "vertical-align": true + } +} diff --git a/src/pybind/mgr/dashboard/frontend/package-lock.json b/src/pybind/mgr/dashboard/frontend/package-lock.json index 92f0325e761a8..a7e597617e18a 100644 --- a/src/pybind/mgr/dashboard/frontend/package-lock.json +++ b/src/pybind/mgr/dashboard/frontend/package-lock.json @@ -5072,6 +5072,17 @@ "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", diff --git a/src/pybind/mgr/dashboard/frontend/package.json b/src/pybind/mgr/dashboard/frontend/package.json index 15b2709610af1..7678416a5991b 100644 --- a/src/pybind/mgr/dashboard/frontend/package.json +++ b/src/pybind/mgr/dashboard/frontend/package.json @@ -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", diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-form/rbd-form.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-form/rbd-form.component.html index d03f3edfeff43..aeacc06f161e3 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-form/rbd-form.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-form/rbd-form.component.html @@ -238,9 +238,9 @@
@@ -252,15 +252,18 @@ [ngClass]="{'has-error': rbdForm.showError('stripingUnit', formDir)}">
@@ -270,10 +273,10 @@ This field is required because stripe count is defined! - Stripe unit is greater than object size. - + class="help-block" + *ngIf="rbdForm.showError('stripingUnit', formDir, 'invalidStripingUnit')"> + Stripe unit is greater than object size. +
@@ -282,8 +285,10 @@ [ngClass]="{'has-error': rbdForm.showError('stripingCount', formDir)}">
+ [permission]="permission" + [selection]="selection" + [tableActions]="tableActions"> diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-form/rbd-snapshot-form.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-form/rbd-snapshot-form.component.html index 38ca9d07f688c..61fbf0237f583 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-form/rbd-snapshot-form.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-form/rbd-snapshot-form.component.html @@ -1,6 +1,9 @@ @@ -30,8 +33,8 @@ - This field is required. - + This field is required. +
@@ -43,8 +46,9 @@ (submitAction)="submit()"> {{ editing ? 'Rename' : 'Create' }} Snapshot - + - diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-list/cephfs-list.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-list/cephfs-list.component.html index b3fecb3eca39b..5f1b3a3f6c6c7 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-list/cephfs-list.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-list/cephfs-list.component.html @@ -7,6 +7,6 @@ selectionType="single" (updateSelection)="updateSelection($event)"> + [selection]="selection"> diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.html index b0148ccb796ea..71d6fec3e3858 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.html @@ -27,10 +27,13 @@ - + {{ state }} + [ngClass]="{'label-success': ['in', 'up'].includes(state), 'label-danger': ['down', 'out'].includes(state)}"> + {{ state }} +   diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/health/health.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/health/health.component.html index f579e3873858a..4d93b698e9ee9 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/health/health.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/health/health.component.html @@ -1,4 +1,5 @@ -
+
@@ -10,7 +11,8 @@ contentClass="content-highlight" (click)="contentData.health.checks.length > 0 ? healthChecksTarget.toggle() : ''"> -
    @@ -21,10 +23,10 @@
    + [popover]="contentData.health.checks.length > 0 ? healthChecks : ''" + triggers="" + #healthChecksTarget="bs-popover" + placement="bottom"> {{ contentData.health.status }}
    @@ -45,7 +47,8 @@ class="col-sm-6 col-md-4 col-lg-3" contentClass="content-highlight" *ngIf="contentData.osd_map"> - + {{ result.content }} @@ -201,7 +204,8 @@ contentClass="card-chart" (click)="pgStatusTarget.toggle()"> -
      @@ -212,9 +216,9 @@
      + triggers="" + #pgStatusTarget="bs-popover" + placement="bottom"> -

      - {{ line.stamp }} {{ line.priority }}  - - {{ line.message }} -
      -
      -

      +

      + {{ line.stamp }} {{ line.priority }}  + + {{ line.message }} +
      +
      +

      -

      - {{ line.stamp }} {{ line.priority }}  - - - {{ line.message }} - -
      +

      + {{ line.stamp }} {{ line.priority }}  + + + {{ line.message }} -

      +
      + +

      diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/info-card/info-card.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/info-card/info-card.component.html index 74324485b6413..ae672510a8ccc 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/info-card/info-card.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/info-card/info-card.component.html @@ -1,11 +1,14 @@ -
      +
      - {{ cardTitle }} + {{ cardTitle }} {{ cardTitle }}
      -
      - +
      +
      diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-form/user-form.component.html b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-form/user-form.component.html index f42d8e7c6e006..8639cd6e64865 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-form/user-form.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-form/user-form.component.html @@ -46,19 +46,19 @@
      - - - - -
      + + + + +
      @@ -76,19 +76,19 @@
      - - - - -
      + + + + +
      @@ -147,10 +147,9 @@
      - +
      diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/navigation/navigation/navigation.component.html b/src/pybind/mgr/dashboard/frontend/src/app/core/navigation/navigation/navigation.component.html index beae9ebf90622..910e759212aaa 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/core/navigation/navigation/navigation.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/core/navigation/navigation/navigation.component.html @@ -146,20 +146,6 @@ routerLink="/cephfs">Filesystems -
    - -
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.html b/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.html index 7054312f83ae0..d9b68758d0603 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.html @@ -19,7 +19,7 @@ + (keyup)="updateFilter($event)">