*ngIf="editing && disableRename">
<p>The File System can only be renamed if it is shutdown and `refuse_client_session` is set to true.
Follow the steps below in the command line and refresh the page:</p>
- <pre class="d-flex">{{ fsFailCmd }}
- <cd-copy-2-clipboard-button [source]="fsFailCmd"
- [byId]="false"
- [showIconOnly]="true"></cd-copy-2-clipboard-button>
- </pre>
- <pre class="d-flex">{{ fsSetCmd }}
- <cd-copy-2-clipboard-button [source]="fsSetCmd"
- [byId]="false"
- [showIconOnly]="true"></cd-copy-2-clipboard-button>
- </pre>
+ <cd-code-block [codes]="[fsFailCmd]"></cd-code-block>
+ <cd-code-block [codes]="[fsSetCmd]"></cd-code-block>
</cd-alert-panel>
<div class="card-body">
--- /dev/null
+<ng-container *ngIf="codes.length > 1; else singleCodeBlock">
+ <pre id="bigCodeBlock">
+ <span *ngFor="let code of codes"
+ class="d-flex p-2 align-items-center justify-content-between text-dark">
+ <span>{{code}}</span>
+ <cd-copy-2-clipboard-button
+ [source]="code"
+ [byId]="false"></cd-copy-2-clipboard-button>
+ </span>
+ </pre>
+</ng-container>
+
+<ng-template #singleCodeBlock>
+ <pre class="d-flex p-2 align-items-center justify-content-between text-dark"
+ id="singleCodeBlock">
+ <span>{{codes}}</span>
+ <cd-copy-2-clipboard-button
+ [source]="codes"
+ [byId]="false"></cd-copy-2-clipboard-button>
+ </pre>
+</ng-template>
--- /dev/null
+@use './src/styles/vendor/variables' as vv;
+
+pre {
+ background-color: vv.$code-block-bg;
+ border-radius: 0.5rem;
+}
--- /dev/null
+import { ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { CodeBlockComponent } from './code-block.component';
+import { configureTestBed } from '~/testing/unit-test-helper';
+
+describe('CodeBlockComponent', () => {
+ let component: CodeBlockComponent;
+ let fixture: ComponentFixture<CodeBlockComponent>;
+
+ configureTestBed({
+ declarations: [CodeBlockComponent]
+ });
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(CodeBlockComponent);
+ component = fixture.componentInstance;
+ component.codes = [];
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+
+ it('should show single codeblock if there are only one code', () => {
+ component.codes = ['code'];
+ fixture.detectChanges();
+ expect(fixture.nativeElement.querySelector('#singleCodeBlock')).not.toBeNull();
+ expect(fixture.nativeElement.querySelector('#bigCodeBlock')).toBeNull();
+ });
+
+ it('should show single codeblock if there are only one code', () => {
+ component.codes = ['code1', 'code2'];
+ fixture.detectChanges();
+ expect(fixture.nativeElement.querySelector('#bigCodeBlock')).not.toBeNull();
+ expect(fixture.nativeElement.querySelector('#singleCodeBlock')).toBeNull();
+ });
+});
--- /dev/null
+import { Component, Input } from '@angular/core';
+
+@Component({
+ selector: 'cd-code-block',
+ templateUrl: './code-block.component.html',
+ styleUrls: ['./code-block.component.scss']
+})
+export class CodeBlockComponent {
+ @Input()
+ codes: string[];
+}
import { WizardComponent } from './wizard/wizard.component';
import { CardComponent } from './card/card.component';
import { CardRowComponent } from './card-row/card-row.component';
+import { CodeBlockComponent } from './code-block/code-block.component';
@NgModule({
imports: [
CdLabelComponent,
ColorClassFromTextPipe,
CardComponent,
- CardRowComponent
+ CardRowComponent,
+ CodeBlockComponent
],
providers: [],
exports: [
CustomLoginBannerComponent,
CdLabelComponent,
CardComponent,
- CardRowComponent
+ CardRowComponent,
+ CodeBlockComponent
]
})
export class ComponentsModule {}
$chart-color-border: #00000020 !default;
$chart-color-translucent-yellow: #ef923472 !default;
+$code-block-bg: #f7f7f9 !default;
+
// Typography
$font-family-sans-serif: 'Helvetica Neue', Helvetica, Arial, 'Noto Sans', sans-serif,