Skip to content

Commit

Permalink
fix(ui): load jsonschema && remove some semantic style (#6285)
Browse files Browse the repository at this point in the history
  • Loading branch information
sguiheux committed Sep 19, 2022
1 parent 77c2f0e commit 404eea5
Show file tree
Hide file tree
Showing 22 changed files with 80 additions and 373 deletions.
5 changes: 4 additions & 1 deletion ui/src/app/model/schema.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Schema } from 'jsonschema';
export class JSONSchema implements Schema {

static defPrefix = '#/definitions/';
static refPrefix = '#/$defs/';
static flat(schema: Schema): FlatSchema {
let root = schema.$ref.replace(JSONSchema.defPrefix, '');
let flatElts = new Array<FlatElement>();
Expand All @@ -15,7 +16,9 @@ export class JSONSchema implements Schema {
}

static browse(schema: Schema, flatSchema: Array<FlatElement>, elt: string, tree: Array<string>): Schema[] {
let defElt = schema.definitions[elt];
let currentType = elt.replace(JSONSchema.refPrefix, '');
let defs = schema['$defs']
let defElt = defs[currentType];
let properties = defElt.properties;
let oneOf = defElt.oneOf;
if (properties) {
Expand Down
6 changes: 3 additions & 3 deletions ui/src/app/shared/ascode/events/ascode.event.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@
<ul>
<ng-container *ngIf="e.data && e.data.workflows">
<li *ngFor="let k of e?.data?.workflows | keys">
<div class="ui blue horizontal mini label">Workflow</div>{{' ' + e.data.workflows[k]}}
<nz-tag class="blue">Workflow</nz-tag>{{' ' + e.data.workflows[k]}}
</li>
</ng-container>
<ng-container *ngIf="e.data && e.data.pipelines">
<li *ngFor="let k of e?.data?.pipelines | keys">
<div class="ui green horizontal mini label">Pipeline</div>{{' ' + e.data.pipelines[k]}}
<nz-tag class="green">Pipeline</nz-tag>{{' ' + e.data.pipelines[k]}}
</li>
</ng-container>
</ul>
</li>
</ul>
<div class="footer">
<button nz-button nzType="primary" nzSize="small" [disabled]="loadingPopupButton"
[nzLoading]="loadingPopupButton" (click)="resyncEvents()">{{'btn_resync_ascode_event' | translate }}</button>
[nzLoading]="loadingPopupButton" (click)="resyncEvents()">Resynchronize repository modifications</button>
</div>

</div>
18 changes: 7 additions & 11 deletions ui/src/app/shared/ascode/events/ascode.event.scss
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
.asCodeEvents {
ul {
li {
ul {
list-style: none;
}
}
}
.footer {
text-align: right;
}
@import "../../../../common";

.green {
color: $cds_color_green
}

.blue {
color: $cds_color_teal
}

49 changes: 24 additions & 25 deletions ui/src/app/shared/ascode/save-form/ascode.save-form.html
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
<form class="ui form">
<div class="ui grid">
<div class="sixteen wide column">
<div class="field">
<label>{{ 'ascode_modal_label_branch' | translate }}</label>
<input type="text" [(ngModel)]="selectedBranch" (keyup)="changeParam()" auto-complete [source]="branches" [min-chars]="1" name="branch" />
</div>
<div class="field">
<label>{{ 'ascode_modal_label_message' | translate }}</label>
<textarea rows="2" [(ngModel)]="commitMessage" (keyup)="changeParam()" name="commitMessage"></textarea>
</div>
</div>
<div class="sixteen wide column">
<div class="wide field">
<div class="ui message red" *ngIf="operation?.status > 2">
{{operation.error_details.message}} -
{{operation.error_details.from}}
</div>
<div class="ui message green" *ngIf="operation?.status === 2">
{{ 'workflow_as_code_pr_success' | translate }}
<a href="{{operation.setup.push.pr_link}}" target="_blank">{{ operation.setup.push.pr_link }}</a>
</div>
</div>
</div>
</div>
<form nz-form nzLayout="vertical">
<nz-row>
<nz-col [nzSpan]="24">
<nz-form-item>
<nz-form-label>{{ 'ascode_modal_label_branch' | translate }}</nz-form-label>
<nz-form-control>
<input nz-input type="text" [(ngModel)]="selectedBranch" (keyup)="changeParam()" auto-complete [source]="branches" [min-chars]="1" name="branch" />
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label>{{ 'ascode_modal_label_message' | translate }}</nz-form-label>
<textarea nz-input rows="2" [(ngModel)]="commitMessage" (keyup)="changeParam()" name="commitMessage"></textarea>
</nz-form-item>
</nz-col>
<nz-col [nzSpan]="24">
<nz-alert nzType="error" *ngIf="operation?.status > 2"
nzMessage="{{operation.error_details.message}} - {{operation.error_details.from}}"></nz-alert>
<nz-alert nzType="success" *ngIf="operation?.status === 2" [nzMessage]="sucessTmpl"></nz-alert>
<ng-template #sucessTmpl>
{{ 'workflow_as_code_pr_success' | translate }}
<a href="{{operation.setup.push.pr_link}}" target="_blank">{{ operation.setup.push.pr_link }}</a>
</ng-template>
</nz-col>
</nz-row>
</form>
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { NzModalRef } from 'ng-zorro-antd/modal';
@Component({
selector: 'app-ascode-save-modal',
templateUrl: './ascode.save-modal.html',
styleUrls: ['./ascode.save-modal.scss'],
changeDetection: ChangeDetectionStrategy.OnPush
})
@AutoUnsubscribe()
Expand Down
3 changes: 3 additions & 0 deletions ui/src/app/shared/ascode/save-modal/ascode.save-modal.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
nz-alert {
margin-bottom: 15px;
}
50 changes: 0 additions & 50 deletions ui/src/app/shared/button/delete/delete.button.spec.ts

This file was deleted.

31 changes: 0 additions & 31 deletions ui/src/app/shared/button/delete/delete.button.ts

This file was deleted.

17 changes: 0 additions & 17 deletions ui/src/app/shared/button/delete/delete.html

This file was deleted.

Empty file.
1 change: 0 additions & 1 deletion ui/src/app/shared/parameter/list/parameter.html
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@
nzPopconfirmTitle="Are you sure you want to remove this parameter ?"
(nzOnConfirm)="sendEvent('delete', p)"
nzPopconfirmPlacement="topLeft">Delete</button>
<app-delete-button (event)="sendEvent('delete', p)" [loading]="p.updating"></app-delete-button>
</ng-container>
</td>
</tr>
Expand Down
11 changes: 1 addition & 10 deletions ui/src/app/shared/shared.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import { ActionStepFormComponent } from './action/step/form/step.form.component'
import { ActionStepComponent } from './action/step/step.component';
import { AuditListComponent } from './audit/list/audit.list.component';
import { BreadcrumbComponent } from './breadcrumb/breadcrumb.component';
import { DeleteButtonComponent } from './button/delete/delete.button';
import { UploadButtonComponent } from './button/upload/upload.button.component';
import { ChartComponentComponent } from './chart/chart.component';
import { CommitListComponent } from './commit/commit.list.component';
Expand Down Expand Up @@ -102,8 +101,6 @@ import { WorkflowWNodeJoinComponent } from './workflow/wnode/join/node.join.comp
import { WorkflowWNodeOutGoingHookComponent } from './workflow/wnode/outgoinghook/node.outgoinghook.component';
import { WorkflowWNodePipelineComponent } from './workflow/wnode/pipeline/wnode.pipeline.component';
import { WorkflowWNodeComponent } from './workflow/wnode/wnode.component';
import { ZoneContentComponent } from './zone/zone-content/content.component';
import { ZoneComponent } from './zone/zone.component';
import { NgxAutoScrollDirective } from 'app/shared/directives/auto-scroll.directive';
import { NZ_CONFIG, NzConfig } from 'ng-zorro-antd/core/config';
import { NzNotificationModule } from 'ng-zorro-antd/notification';
Expand Down Expand Up @@ -219,7 +216,6 @@ const icons: IconDefinition[] = [ AimOutline, ArrowDownOutline, ArrowRightOutlin
ConditionsComponent,
CutPipe,
DataTableComponent,
DeleteButtonComponent,
DiffItemComponent,
DiffListComponent,
DurationMsPipe,
Expand Down Expand Up @@ -292,8 +288,6 @@ const icons: IconDefinition[] = [ AimOutline, ArrowDownOutline, ArrowRightOutlin
WorkflowWNodeMenuEditComponent,
WorkflowWNodeOutGoingHookComponent,
WorkflowWNodePipelineComponent,
ZoneComponent,
ZoneContentComponent
],
providers: [
PermissionService,
Expand Down Expand Up @@ -329,7 +323,6 @@ const icons: IconDefinition[] = [ AimOutline, ArrowDownOutline, ArrowRightOutlin
ConditionsComponent,
CutPipe,
DataTableComponent,
DeleteButtonComponent,
DiffItemComponent,
DiffListComponent,
DragulaModule,
Expand Down Expand Up @@ -426,9 +419,7 @@ const icons: IconDefinition[] = [ AimOutline, ArrowDownOutline, ArrowRightOutlin
WorkflowTemplateParamFormComponent,
WorkflowTriggerComponent,
WorkflowWNodeComponent,
WorkflowWNodeMenuEditComponent,
ZoneComponent,
ZoneContentComponent
WorkflowWNodeMenuEditComponent
]
})
export class SharedModule {
Expand Down
14 changes: 0 additions & 14 deletions ui/src/app/shared/zone/zone-content/content.component.ts

This file was deleted.

3 changes: 0 additions & 3 deletions ui/src/app/shared/zone/zone-content/content.html

This file was deleted.

3 changes: 0 additions & 3 deletions ui/src/app/shared/zone/zone-content/content.scss

This file was deleted.

15 changes: 0 additions & 15 deletions ui/src/app/shared/zone/zone.component.ts

This file was deleted.

6 changes: 0 additions & 6 deletions ui/src/app/shared/zone/zone.html

This file was deleted.

6 changes: 0 additions & 6 deletions ui/src/app/shared/zone/zone.scss

This file was deleted.

Loading

0 comments on commit 404eea5

Please sign in to comment.