]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: Back button component
authorStephan Müller <smueller@suse.com>
Fri, 8 Mar 2019 15:32:13 +0000 (16:32 +0100)
committerStephan Müller <smueller@suse.com>
Fri, 5 Apr 2019 14:14:04 +0000 (16:14 +0200)
Fixes: https://tracker.ceph.com/issues/38937
Signed-off-by: Stephan Müller <smueller@suse.com>
(cherry picked from commit ad960f1aa7c08b56b691fc1c8ad0348f7ede1f1b)

46 files changed:
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-discovery-modal/iscsi-target-discovery-modal.component.html
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-discovery-modal/iscsi-target-discovery-modal.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-form/iscsi-target-form.component.html
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-image-settings-modal/iscsi-target-image-settings-modal.component.html
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-image-settings-modal/iscsi-target-image-settings-modal.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-iqn-settings-modal/iscsi-target-iqn-settings-modal.component.html
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-iqn-settings-modal/iscsi-target-iqn-settings-modal.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-edit-mode-modal/pool-edit-mode-modal.component.html
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-edit-peer-modal/pool-edit-peer-modal.component.html
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-snapshot-form/rbd-snapshot-form.component.html
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-move-modal/rbd-trash-move-modal.component.html
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-purge-modal/rbd-trash-purge-modal.component.html
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-restore-modal/rbd-trash-restore-modal.component.html
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration-form/configuration-form.component.html
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-flags-modal/osd-flags-modal.component.html
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-flags-modal/osd-flags-modal.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-recv-speed-modal/osd-recv-speed-modal.component.html
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-recv-speed-modal/osd-recv-speed-modal.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-reweight-modal/osd-reweight-modal.component.html
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-reweight-modal/osd-reweight-modal.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-scrub-modal/osd-scrub-modal.component.html
src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-form/nfs-form.component.html
src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-form/nfs-form.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/erasure-code-profile-form/erasure-code-profile-form.component.html
src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-form/pool-form.component.html
src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-form/rgw-bucket-form.component.html
src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-capability-modal/rgw-user-capability-modal.component.html
src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-capability-modal/rgw-user-capability-modal.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-form/rgw-user-form.component.html
src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-s3-key-modal/rgw-user-s3-key-modal.component.html
src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-s3-key-modal/rgw-user-s3-key-modal.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-subuser-modal/rgw-user-subuser-modal.component.html
src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-subuser-modal/rgw-user-subuser-modal.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/core/auth/role-form/role-form.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/mgr-modules/telemetry/telemetry.component.html [new file with mode: 0644]
src/pybind/mgr/dashboard/frontend/src/app/shared/components/back-button/back-button.component.html [new file with mode: 0644]
src/pybind/mgr/dashboard/frontend/src/app/shared/components/back-button/back-button.component.scss [new file with mode: 0644]
src/pybind/mgr/dashboard/frontend/src/app/shared/components/back-button/back-button.component.spec.ts [new file with mode: 0644]
src/pybind/mgr/dashboard/frontend/src/app/shared/components/back-button/back-button.component.ts [new file with mode: 0644]
src/pybind/mgr/dashboard/frontend/src/app/shared/components/components.module.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/components/confirmation-modal/confirmation-modal.component.html
src/pybind/mgr/dashboard/frontend/src/app/shared/components/confirmation-modal/confirmation-modal.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/components/confirmation-modal/confirmation-modal.component.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component.html

index a5253fb88a6a96b00471f620b986e00ae8e7013c..fbd603f4754c05b7331f4531f3a9c78d2dc2deac 100644 (file)
           <cd-submit-button (submitAction)="submitAction()"
                             [form]="discoveryForm"
                             i18n>Submit</cd-submit-button>
-
-          <button class="btn btn-link btn-sm"
-                  (click)="bsModalRef.hide()"
-                  i18n>Cancel</button>
+          <cd-back-button [back]="bsModalRef.hide"
+                          name="Cancel"
+                          i18n-name>
+          </cd-back-button>
         </div>
       </div>
     </form>
index 5b8b5602e8e730b4a55b292db4a0b7348181fbda..21005c80c524a8d4763b4cd93adb0f7dc132aa88 100644 (file)
@@ -5,6 +5,7 @@ import {
 } from '@angular/common/http/testing';
 import { ComponentFixture, TestBed } from '@angular/core/testing';
 import { ReactiveFormsModule } from '@angular/forms';
+import { RouterTestingModule } from '@angular/router/testing';
 
 import { ToastModule } from 'ng2-toastr';
 import { BsModalRef } from 'ngx-bootstrap/modal';
@@ -21,7 +22,13 @@ describe('IscsiTargetDiscoveryModalComponent', () => {
 
   configureTestBed({
     declarations: [IscsiTargetDiscoveryModalComponent],
-    imports: [HttpClientTestingModule, ReactiveFormsModule, SharedModule, ToastModule.forRoot()],
+    imports: [
+      HttpClientTestingModule,
+      ReactiveFormsModule,
+      SharedModule,
+      ToastModule.forRoot(),
+      RouterTestingModule
+    ],
     providers: [i18nProviders, BsModalRef]
   });
 
index e5010ebc925f90fa8756395eb195910d2a87bafe..ef0696a6ab104e6d7e9d4e9c6bd2fafcc806cb84 100644 (file)
                             type="button"
                             (submitAction)="submit()"
                             i18n>Submit</cd-submit-button>
-
-          <button type="button"
-                  class="btn btn-sm btn-default"
-                  routerLink="/block/iscsi/targets"
-                  i18n>Back</button>
+          <cd-back-button></cd-back-button>
         </div>
       </div>
     </div>
index ff1e54d5e09f3d4ed90f15df33fd5fa256c32de3..791f80b8a2fc6a550a5780f6d73c6071f77bb361 100644 (file)
         <button class="btn btn-sm btn-primary"
                 (click)="save()"
                 i18n>Confirm</button>
-
-        <button i18n
-                type="button"
-                class="btn btn-sm btn-default"
-                (click)="modalRef.hide()">Cancel</button>
+        <cd-back-button [back]="modalRef.hide"
+                        name="Cancel"
+                        i18n-name>
+        </cd-back-button>
       </div>
     </div>
   </ng-container>
index 1f8d8c7c03b9b80eace7d7e47602ce958fe360c1..00f4da5fa07dc138e1830d71755cfc775f8e3ef0 100644 (file)
@@ -1,6 +1,7 @@
 import { HttpClientTestingModule } from '@angular/common/http/testing';
 import { ComponentFixture, TestBed } from '@angular/core/testing';
 import { FormsModule } from '@angular/forms';
+import { RouterTestingModule } from '@angular/router/testing';
 
 import { BsModalRef } from 'ngx-bootstrap/modal';
 
@@ -14,7 +15,7 @@ describe('IscsiTargetImageSettingsModalComponent', () => {
 
   configureTestBed({
     declarations: [IscsiTargetImageSettingsModalComponent],
-    imports: [SharedModule, FormsModule, HttpClientTestingModule],
+    imports: [SharedModule, FormsModule, HttpClientTestingModule, RouterTestingModule],
     providers: [BsModalRef, i18nProviders]
   });
 
index 23a56976f900a2bf74fdf580e3103012a1e4a992..4707dafe8d2b1761b1bcbe3657cb1d7a5fcccb28 100644 (file)
           <cd-submit-button i18n
                             [form]="settingsForm"
                             (submitAction)="save()">Confirm</cd-submit-button>
-          <button i18n
-                  type="button"
-                  class="btn btn-sm btn-default"
-                  (click)="modalRef.hide()">Cancel</button>
+          <cd-back-button [back]="modalRef.hide"
+                          name="Cancel"
+                          i18n-name>
+          </cd-back-button>
         </div>
       </div>
     </form>
index 1862d6b9ebf68d7d40187e3794675e1b454e4d9f..6666731d359613192e225741b5b7876d5a8a6ba6 100644 (file)
@@ -1,6 +1,7 @@
 import { HttpClientTestingModule } from '@angular/common/http/testing';
 import { ComponentFixture, TestBed } from '@angular/core/testing';
 import { FormControl, ReactiveFormsModule } from '@angular/forms';
+import { RouterTestingModule } from '@angular/router/testing';
 
 import { BsModalRef } from 'ngx-bootstrap/modal';
 
@@ -14,7 +15,7 @@ describe('IscsiTargetIqnSettingsModalComponent', () => {
 
   configureTestBed({
     declarations: [IscsiTargetIqnSettingsModalComponent],
-    imports: [SharedModule, ReactiveFormsModule, HttpClientTestingModule],
+    imports: [SharedModule, ReactiveFormsModule, HttpClientTestingModule, RouterTestingModule],
     providers: [BsModalRef, i18nProviders]
   });
 
index 1b0efcf459cc1fb66d66d586952903f74e933852..bc5bb0f6a44ebe26ed388884813ee4e2cca7bd2e 100644 (file)
           <cd-submit-button i18n
                             [form]="editModeForm"
                             (submitAction)="update()">Update</cd-submit-button>
-          <button i18n
-                  type="button"
-                  class="btn btn-sm btn-default"
-                  (click)="modalRef.hide()">Cancel</button>
+          <cd-back-button [back]="modalRef.hide"
+                          name="Cancel"
+                          i18n-name>
+          </cd-back-button>
         </div>
       </div>
     </form>
index cfbf79d26dbf4d10a9beee048913b40661b383d9..66291d9418664054a7238cfc233601e7f38e1e1f 100644 (file)
           <cd-submit-button i18n
                             [form]="editPeerForm"
                             (submitAction)="update()">Submit</cd-submit-button>
-          <button i18n
-                  type="button"
-                  class="btn btn-sm btn-default"
-                  (click)="modalRef.hide()">Cancel</button>
+          <cd-back-button [back]="modalRef.hide"
+                          name="Cancel"
+                          i18n-name>
+          </cd-back-button>
         </div>
       </div>
     </form>
index 63df157673ea06d99ce6ac16d2cd1e1823a3d269..7caad726a4c25f6ae28661dc861fbba18a42edaa 100644 (file)
                             (submitAction)="submit()">
             <span i18n>{mode, select, editing {Update} cloning {Clone} copying {Copy} other {Create}} RBD</span>
           </cd-submit-button>
-          <button type="button"
-                  class="btn btn-sm btn-default"
-                  routerLink="/block/rbd"
-                  i18n>Back</button>
+          <cd-back-button></cd-back-button>
         </div>
       </div>
     </div>
   </form>
-</div>
\ No newline at end of file
+</div>
index ac455e5174d8e8ff0391f5ee07039e04a809791b..f11da878598aa233e4e5ff7a237cc28cfc278612 100644 (file)
       <cd-submit-button [form]="snapshotForm"
                         (submitAction)="submit()"
                         i18n>{ editing, select, true {Rename} other {Create}} Snapshot</cd-submit-button>
-      <button type="button"
-              class="btn btn-sm btn-default"
-              (click)="modalRef.hide()"
-              i18n>Close</button>
+      <cd-back-button [back]="modalRef.hide"
+                      name="Close"
+                      i18n-name>
+      </cd-back-button>
     </div>
   </div>
 </form>
index d19a2adfa5c4c01df0b398c06d83f8236ae50a7a..e0bb6f0f96e58ac00d002f70ddf7f4122ce52ae3 100644 (file)
           <cd-submit-button i18n
                             [form]="moveForm"
                             (submitAction)="moveImage()">Move Image</cd-submit-button>
-          <button i18n
-                  type="button"
-                  class="btn btn-sm btn-default"
-                  (click)="modalRef.hide()">Cancel</button>
+          <cd-back-button [back]="modalRef.hide"
+                          name="Cancel"
+                          i18n-name>
+          </cd-back-button>
         </div>
       </div>
     </form>
index dc81cf1c4a799188a04e92b325d60b6224d757f8..b8b27911cf09795cc69125056f34888ec219e73e 100644 (file)
           <cd-submit-button [form]="purgeForm"
                             (submitAction)="purge()"
                             i18n>Purge Trash</cd-submit-button>
-          <button i18n
-                  type="button"
-                  class="btn btn-sm btn-default"
-                  (click)="modalRef.hide()">Cancel</button>
+          <cd-back-button [back]="modalRef.hide"
+                          name="Cancel"
+                          i18n-name>
+          </cd-back-button>
         </div>
       </div>
     </form>
index dc862aa6194ff6d1c9a01e9bb08289ebb63c34d3..3f83e64fd8caff21d2d6ce8c48916fef359c86f8 100644 (file)
           <cd-submit-button [form]="restoreForm"
                             (submitAction)="restore()"
                             i18n>Restore Image</cd-submit-button>
-          <button i18n
-                  type="button"
-                  class="btn btn-sm btn-default"
-                  (click)="modalRef.hide()">Cancel</button>
+          <cd-back-button [back]="modalRef.hide"
+                          name="Cancel"
+                          i18n-name>
+          </cd-back-button>
         </div>
       </div>
     </form>
index faa90d381a5102209d9eb09e3b2bc76f1793163d..a32fb35151e1b609775704ff80bd21e7a33328ee 100644 (file)
                             (submitAction)="submit()">
             <span i18n>Save</span>
           </cd-submit-button>
-          <button type="button"
-                  class="btn btn-sm btn-default"
-                  routerLink="/configuration"
-                  i18n>Back</button>
+          <cd-back-button></cd-back-button>
         </div>
       </div>
     </div>
index b0bedb1b6dfaa15820089f685814e62024ff0202..59e2388593fa7e50e3b8b30ecb387bc85c1bdc18 100644 (file)
           <cd-submit-button (submitAction)="submitAction()"
                             [form]="osdFlagsForm"
                             i18n>Submit</cd-submit-button>
-
-          <button class="btn btn-link btn-sm"
-                  (click)="bsModalRef.hide()"
-                  i18n>Cancel</button>
+          <cd-back-button [back]="bsModalRef.hide"
+                          name="Cancel"
+                          i18n-name>
+          </cd-back-button>
         </div>
       </div>
     </form>
index b74f80f1853c2e3699b5da86c784f2049b9035bd..00583a014e87796f1eafb72c2f5ab747bb6f890f 100644 (file)
@@ -1,6 +1,7 @@
 import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
 import { ComponentFixture, TestBed } from '@angular/core/testing';
 import { ReactiveFormsModule } from '@angular/forms';
+import { RouterTestingModule } from '@angular/router/testing';
 
 import * as _ from 'lodash';
 import { ToastModule } from 'ng2-toastr';
@@ -30,6 +31,7 @@ describe('OsdFlagsModalComponent', () => {
       ModalModule.forRoot(),
       SharedModule,
       HttpClientTestingModule,
+      RouterTestingModule,
       ToastModule.forRoot()
     ],
     declarations: [OsdFlagsModalComponent],
index 4429882b78cc71911e42eb292ab21988471099d8..fb18166890ff186b16311c46304c4a9c514dbd91 100755 (executable)
           <cd-submit-button (submitAction)="submitAction()"
                             [form]="osdRecvSpeedForm"
                             i18n>Submit</cd-submit-button>
-
-          <button class="btn btn-link btn-sm"
-                  (click)="bsModalRef.hide()"
-                  i18n>Cancel</button>
+          <cd-back-button [back]="bsModalRef.hide"
+                          name="Cancel"
+                          i18n-name>
+          </cd-back-button>
         </div>
       </div>
     </form>
index efee6abe23d136a319fed0d8dd37c8731d9bc7d7..ee3ba222979af7c91a713a0e9b489bb05b9d2abc 100755 (executable)
@@ -1,6 +1,7 @@
 import { HttpClientTestingModule } from '@angular/common/http/testing';
 import { ComponentFixture, TestBed } from '@angular/core/testing';
 import { ReactiveFormsModule } from '@angular/forms';
+import { RouterTestingModule } from '@angular/router/testing';
 
 import * as _ from 'lodash';
 import { ToastModule } from 'ng2-toastr';
@@ -19,6 +20,7 @@ describe('OsdRecvSpeedModalComponent', () => {
       HttpClientTestingModule,
       ModalModule.forRoot(),
       ReactiveFormsModule,
+      RouterTestingModule,
       SharedModule,
       ToastModule.forRoot()
     ],
index 5e6d9851d8c191ce734494fefeb4cbf9ef9af15f..7d9e28eb428b6a9be1be973dec3a72b8f0c620c9 100644 (file)
                           [form]="reweightForm"
                           [disabled]="reweightForm.invalid"
                           i18n>Reweight</cd-submit-button>
-
-        <button class="btn btn-link btn-sm"
-                (click)="bsModalRef.hide()"
-                i18n>Cancel</button>
+        <cd-back-button [back]="bsModalRef.hide"
+                        name="Cancel"
+                        i18n-name>
+        </cd-back-button>
       </div>
     </form>
   </ng-container>
index 9ffc34ead129549016ba18f56654d30620895593..78c3860c5e39bd2b3d53fe1823abb778c64e7292 100644 (file)
@@ -1,12 +1,14 @@
 import { HttpClientTestingModule } from '@angular/common/http/testing';
 import { ComponentFixture, TestBed } from '@angular/core/testing';
 import { ReactiveFormsModule } from '@angular/forms';
+import { RouterTestingModule } from '@angular/router/testing';
 
 import { BsModalRef } from 'ngx-bootstrap/modal';
 import { of } from 'rxjs';
 
 import { configureTestBed, i18nProviders } from '../../../../../testing/unit-test-helper';
 import { OsdService } from '../../../../shared/api/osd.service';
+import { BackButtonComponent } from '../../../../shared/components/back-button/back-button.component';
 import { ModalComponent } from '../../../../shared/components/modal/modal.component';
 import { SubmitButtonComponent } from '../../../../shared/components/submit-button/submit-button.component';
 import { CdFormBuilder } from '../../../../shared/forms/cd-form-builder';
@@ -17,8 +19,13 @@ describe('OsdReweightModalComponent', () => {
   let fixture: ComponentFixture<OsdReweightModalComponent>;
 
   configureTestBed({
-    imports: [ReactiveFormsModule, HttpClientTestingModule],
-    declarations: [OsdReweightModalComponent, ModalComponent, SubmitButtonComponent],
+    imports: [ReactiveFormsModule, HttpClientTestingModule, RouterTestingModule],
+    declarations: [
+      OsdReweightModalComponent,
+      ModalComponent,
+      SubmitButtonComponent,
+      BackButtonComponent
+    ],
     providers: [OsdService, BsModalRef, CdFormBuilder, i18nProviders]
   });
 
index 0ac55c1919129cbae2f9eaf4b736decf60ed0d3f..ba05c97515bd50bd7fa677353c4ec10906bf3004 100644 (file)
         <cd-submit-button (submitAction)="scrub()"
                           [form]="scrubForm"
                           i18n>Submit</cd-submit-button>
-
-        <button class="btn btn-link btn-sm"
-                (click)="bsModalRef.hide()"
-                i18n>Cancel</button>
+        <cd-back-button [back]="bsModalRef.hide"
+                        name="Cancel"
+                        i18n-name>
+        </cd-back-button>
       </div>
     </form>
   </ng-container>
index d67ddd7cf62921a04722100fd05e07b635a0bea0..b93de70af50a003686073aa22872f31694b8a9b8 100644 (file)
                             (submitAction)="submitAction()">
             <ng-container i18n>Submit</ng-container>
           </cd-submit-button>
-          <button type="button"
-                  class="btn btn-sm btn-default"
-                  (click)="cancelAction()"
-                  i18n>Back</button>
+          <cd-back-button></cd-back-button>
         </div>
       </div>
     </div>
index 128782fc961100c7b043cb3f4f98b1914296dd18..1e3715c733b54c56997da8e3f13be11dd22321ad 100644 (file)
@@ -546,8 +546,4 @@ export class NfsFormComponent implements OnInit {
 
     return requestModel;
   }
-
-  cancelAction() {
-    this.router.navigate(['/nfs']);
-  }
 }
index 1fd5879aab42c549b3b627eee4e4df63768e84c8..31f2eb94df014ec3cf9eed51c1523343c18fb54f 100644 (file)
     <cd-submit-button (submitAction)="onSubmit()"
                       [form]="frm"
                       i18n>Add</cd-submit-button>
-    <button class="btn btn-sm btn-default"
-            type="button"
-            (click)="bsModalRef.hide()"
-            i18n>Close</button>
+    <cd-back-button [back]="bsModalRef.hide"
+                    name="Close"
+                    i18n-name>
+    </cd-back-button>
   </div>
 </form>
index b54d287aaf4d117d7bf835cec254f4b58fbdabd9..b958e66fa6e1b61301dab5efc20e724d6fec7f18 100644 (file)
                             (submitAction)="submit()">
             <span i18n>{editing, select, 1 {Edit} other {Create}} pool</span>
           </cd-submit-button>
-          <button i18n
-                  type="button"
-                  class="btn btn-sm btn-default"
-                  routerLink="/pool">Back</button>
+          <cd-back-button></cd-back-button>
         </div>
       </div>
 
index 2d2ddf4967f123453836a274d1e15ba02b1e4e9d..5d172238e05ad0373fdf339cb3f9b7687f94b96c 100644 (file)
                             [form]="bucketForm">
             <ng-container i18n>{editing, select, 1 {Update} other {Add}}</ng-container>
           </cd-submit-button>
-          <button i18n
-                  type="button"
-                  class="btn btn-sm btn-default"
-                  routerLink="/rgw/bucket">Back</button>
+          <cd-back-button></cd-back-button>
         </div>
       </div>
     </div>
index 0fd9a22bf554a84df6f874a5ffc1b171a13c1d5b..2a15f3f7f3253b38bb46738cc12a87b7fc8d5d2a 100644 (file)
@@ -79,9 +79,9 @@
                       [form]="formGroup">
       <ng-container i18n>{editing, select, 1 {Update} other {Add}}</ng-container>
     </cd-submit-button>
-    <button class="btn btn-sm btn-default"
-            type="button"
-            (click)="bsModalRef.hide()"
-            i18n>Close</button>
+    <cd-back-button [back]="bsModalRef.hide"
+                    name="Close"
+                    i18n-name>
+    </cd-back-button>
   </div>
 </form>
index 318c8a1affc0cd325d58fd87f67263f8a1a0b613..c2b53d2620b1385df4f7e0b377c6476994fb0a61 100644 (file)
@@ -1,9 +1,10 @@
 import { ComponentFixture, TestBed } from '@angular/core/testing';
 import { ReactiveFormsModule } from '@angular/forms';
+import { RouterTestingModule } from '@angular/router/testing';
 
 import { BsModalRef } from 'ngx-bootstrap/modal';
 
-import { configureTestBed } from '../../../../testing/unit-test-helper';
+import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
 import { SharedModule } from '../../../shared/shared.module';
 import { RgwUserCapabilityModalComponent } from './rgw-user-capability-modal.component';
 
@@ -13,8 +14,8 @@ describe('RgwUserCapabilityModalComponent', () => {
 
   configureTestBed({
     declarations: [RgwUserCapabilityModalComponent],
-    imports: [ReactiveFormsModule, SharedModule],
-    providers: [BsModalRef]
+    imports: [ReactiveFormsModule, SharedModule, RouterTestingModule],
+    providers: [BsModalRef, i18nProviders]
   });
 
   beforeEach(() => {
index 2ed89951341ea806ad87111e949bb85ba12a4ee3..85aabaa078371971f1b437fdbaee7a5b014a0c0e 100644 (file)
                             [form]="userForm">
             <ng-container i18n>{editing, select, 1 {Update} other {Add}}</ng-container>
           </cd-submit-button>
-          <button class="btn btn-sm btn-default"
-                  type="button"
-                  routerLink="/rgw/user"
-                  i18n>Back</button>
+          <cd-back-button></cd-back-button>
         </div>
       </div>
     </div>
index 858b21b4853a792445940d4e620bb915cdefa828..c2b198d06ffc2eb91fb7d75ce59ec318fc9b8244 100644 (file)
                       (submitAction)="onSubmit()"
                       [form]="formGroup"
                       i18n>Add</cd-submit-button>
-    <button class="btn btn-sm btn-default"
-            type="button"
-            (click)="bsModalRef.hide()"
-            i18n>Close</button>
+    <cd-back-button [back]="bsModalRef.hide"
+                    name="Close"
+                    i18n-name>
+    </cd-back-button>
   </div>
 </form>
index 7dd53a040466575bfca95dc59a52d275ebb33f99..bf8dcdce7510927e94006cd4f00ce2e8cc6e1852 100644 (file)
@@ -1,9 +1,10 @@
 import { ComponentFixture, TestBed } from '@angular/core/testing';
 import { ReactiveFormsModule } from '@angular/forms';
+import { RouterTestingModule } from '@angular/router/testing';
 
 import { BsModalRef } from 'ngx-bootstrap/modal';
 
-import { configureTestBed } from '../../../../testing/unit-test-helper';
+import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
 import { SharedModule } from '../../../shared/shared.module';
 import { RgwUserS3KeyModalComponent } from './rgw-user-s3-key-modal.component';
 
@@ -13,8 +14,8 @@ describe('RgwUserS3KeyModalComponent', () => {
 
   configureTestBed({
     declarations: [RgwUserS3KeyModalComponent],
-    imports: [ReactiveFormsModule, SharedModule],
-    providers: [BsModalRef]
+    imports: [ReactiveFormsModule, SharedModule, RouterTestingModule],
+    providers: [BsModalRef, i18nProviders]
   });
 
   beforeEach(() => {
index c83bd94cce1e588f3d9507606094e168bb6f44d7..7f9c1409256b7c28ef3b0bbfb5c68abdd064589a 100644 (file)
                       [form]="formGroup">
       <ng-container i18n>{editing, select, 1 {Update} other {Add}}</ng-container>
     </cd-submit-button>
-    <button class="btn btn-sm btn-default"
-            type="button"
-            (click)="bsModalRef.hide()"
-            i18n>Close</button>
+    <cd-back-button [back]="bsModalRef.hide"
+                    name="Close"
+                    i18n-name>
+    </cd-back-button>
   </div>
 </form>
index 4c11f6a8f973dc6a574012997e1af854af78687e..a828c3d5df028708646f224a9974abc1383f1f8a 100644 (file)
@@ -1,9 +1,10 @@
 import { ComponentFixture, TestBed } from '@angular/core/testing';
 import { FormControl, ReactiveFormsModule } from '@angular/forms';
+import { RouterTestingModule } from '@angular/router/testing';
 
 import { BsModalRef } from 'ngx-bootstrap/modal';
 
-import { configureTestBed } from '../../../../testing/unit-test-helper';
+import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
 import { SharedModule } from '../../../shared/shared.module';
 import { RgwUserSubuserModalComponent } from './rgw-user-subuser-modal.component';
 
@@ -13,8 +14,8 @@ describe('RgwUserSubuserModalComponent', () => {
 
   configureTestBed({
     declarations: [RgwUserSubuserModalComponent],
-    imports: [ReactiveFormsModule, SharedModule],
-    providers: [BsModalRef]
+    imports: [ReactiveFormsModule, SharedModule, RouterTestingModule],
+    providers: [BsModalRef, i18nProviders]
   });
 
   beforeEach(() => {
index 957a1df0cb66e618b93090d1d80a0def69433745..236670cb76a6a8153c4ae01d3d385fb0309607c5 100644 (file)
                             type="button"
                             (submitAction)="submit()"
                             i18n>{mode, select, editing {Update} other {Create}} Role</cd-submit-button>
-          <button i18n
-                  type="button"
-                  class="btn btn-sm btn-default"
-                  routerLink="/user-management/roles">Back</button>
+          <cd-back-button></cd-back-button>
         </div>
       </div>
     </div>
index 2b9a07e67d8a246ad95476ea011822b9f8f1b82f..f35c2324122d7342973e7874d08c996e18ec053d 100644 (file)
                             type="button"
                             (submitAction)="submit()"
                             i18n>{mode, select, editing {Update} other {Create}} User</cd-submit-button>
-          <button i18n
-                  type="button"
-                  class="btn btn-sm btn-default"
-                  routerLink="/user-management/users">Back</button>
+          <cd-back-button></cd-back-button>
         </div>
       </div>
     </div>
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/mgr-modules/telemetry/telemetry.component.html b/src/pybind/mgr/dashboard/frontend/src/app/core/mgr-modules/telemetry/telemetry.component.html
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/back-button/back-button.component.html b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/back-button/back-button.component.html
new file mode 100644 (file)
index 0000000..0d5e50f
--- /dev/null
@@ -0,0 +1,6 @@
+&nbsp;
+<button class="btn btn-sm btn-default tc_backButton"
+        (click)="back()"
+        type="button">
+  {{ name }}
+</button>
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/back-button/back-button.component.scss b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/back-button/back-button.component.scss
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/back-button/back-button.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/back-button/back-button.component.spec.ts
new file mode 100644 (file)
index 0000000..150e056
--- /dev/null
@@ -0,0 +1,26 @@
+import { ComponentFixture, TestBed } from '@angular/core/testing';
+import { RouterTestingModule } from '@angular/router/testing';
+
+import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
+import { BackButtonComponent } from './back-button.component';
+
+describe('BackButtonComponent', () => {
+  let component: BackButtonComponent;
+  let fixture: ComponentFixture<BackButtonComponent>;
+
+  configureTestBed({
+    imports: [RouterTestingModule],
+    declarations: [BackButtonComponent],
+    providers: [i18nProviders]
+  });
+
+  beforeEach(() => {
+    fixture = TestBed.createComponent(BackButtonComponent);
+    component = fixture.componentInstance;
+    fixture.detectChanges();
+  });
+
+  it('should create', () => {
+    expect(component).toBeTruthy();
+  });
+});
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/back-button/back-button.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/back-button/back-button.component.ts
new file mode 100644 (file)
index 0000000..b052ac1
--- /dev/null
@@ -0,0 +1,16 @@
+import { Location } from '@angular/common';
+import { Component, Input } from '@angular/core';
+
+import { I18n } from '@ngx-translate/i18n-polyfill';
+
+@Component({
+  selector: 'cd-back-button',
+  templateUrl: './back-button.component.html',
+  styleUrls: ['./back-button.component.scss']
+})
+export class BackButtonComponent {
+  constructor(private location: Location, private i18n: I18n) {}
+
+  @Input() name: string = this.i18n('Back');
+  @Input() back: Function = () => this.location.back();
+}
index 517c5282331703962f41c388a809238ee740ca07..efc94139b23027c1f52a32d78f42ab593a12fc32 100644 (file)
@@ -11,6 +11,7 @@ import { TooltipModule } from 'ngx-bootstrap/tooltip';
 
 import { DirectivesModule } from '../directives/directives.module';
 import { PipesModule } from '../pipes/pipes.module';
+import { BackButtonComponent } from './back-button/back-button.component';
 import { ConfirmationModalComponent } from './confirmation-modal/confirmation-modal.component';
 import { CriticalConfirmationModalComponent } from './critical-confirmation-modal/critical-confirmation-modal.component';
 import { ErrorPanelComponent } from './error-panel/error-panel.component';
@@ -61,6 +62,7 @@ import { WarningPanelComponent } from './warning-panel/warning-panel.component';
     LanguageSelectorComponent,
     GrafanaComponent,
     SelectComponent,
+    BackButtonComponent,
     RefreshSelectorComponent
   ],
   providers: [],
@@ -70,6 +72,7 @@ import { WarningPanelComponent } from './warning-panel/warning-panel.component';
     HelperComponent,
     SelectBadgesComponent,
     SubmitButtonComponent,
+    BackButtonComponent,
     ErrorPanelComponent,
     LoadingPanelComponent,
     InfoPanelComponent,
index 271235faed89dcbc46579316a452ff3cdcf6e4c4..707e24e84d5c84eba464dec2ee0a73c21d02cb73 100644 (file)
                             (submitAction)="onSubmit(confirmationForm.value)">
             {{ buttonText }}
           </cd-submit-button>
-          <button i18n
-                  type="button"
-                  class="btn btn-sm btn-default"
-                  (click)="cancel()">Cancel</button>
+          <cd-back-button [back]="boundCancel"
+                          name="Cancel"
+                          i18n-name>
+          </cd-back-button>
         </div>
       </div>
     </form>
index 3af57bbe80ae76044c4a1c11e6813b645a895069..2c1f76a1d365d2646f01d727d959125c6184a0a1 100644 (file)
@@ -1,9 +1,11 @@
 import { ComponentFixture, TestBed } from '@angular/core/testing';
 import { ReactiveFormsModule } from '@angular/forms';
+import { RouterTestingModule } from '@angular/router/testing';
 
 import { BsModalRef } from 'ngx-bootstrap/modal';
 
-import { configureTestBed } from '../../../../testing/unit-test-helper';
+import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
+import { BackButtonComponent } from '../back-button/back-button.component';
 import { ModalComponent } from '../modal/modal.component';
 import { SubmitButtonComponent } from '../submit-button/submit-button.component';
 import { ConfirmationModalComponent } from './confirmation-modal.component';
@@ -13,9 +15,14 @@ describe('ConfirmationModalComponent', () => {
   let fixture: ComponentFixture<ConfirmationModalComponent>;
 
   configureTestBed({
-    declarations: [ConfirmationModalComponent, SubmitButtonComponent, ModalComponent],
-    imports: [ReactiveFormsModule],
-    providers: [BsModalRef]
+    declarations: [
+      ConfirmationModalComponent,
+      BackButtonComponent,
+      SubmitButtonComponent,
+      ModalComponent
+    ],
+    imports: [ReactiveFormsModule, RouterTestingModule],
+    providers: [BsModalRef, i18nProviders]
   });
 
   beforeEach(() => {
index c108cb40f912150d03a90751e75fea14107816e6..9765fed85e483b7266aa52080ee5112a00418826 100644 (file)
@@ -19,6 +19,8 @@ export class ConfirmationModalComponent implements OnInit {
   bodyContext: object;
   confirmationForm: FormGroup;
 
+  boundCancel = this.cancel.bind(this);
+
   constructor(public modalRef: BsModalRef) {
     this.confirmationForm = new FormGroup({});
   }
index 716defde2b1164160eab6fc75115e34bebd5687c..7f0d3d786ea3c5890105cd47e5b81e5643b34df8 100644 (file)
                           (submitAction)="callSubmitAction()">
           <ng-container *ngTemplateOutlet="deletionHeading"></ng-container>
         </cd-submit-button>
-        <button class="btn btn-link btn-sm"
-                (click)="hideModal()"
-                i18n>Cancel</button>
+        <cd-back-button [back]="modalRef.hide"
+                        name="Cancel"
+                        i18n-name>
+        </cd-back-button>
       </div>
     </form>
   </ng-container>