Skip to content

Commit

Permalink
fix(ui): lint + websocketV3 (#5989)
Browse files Browse the repository at this point in the history
  • Loading branch information
sguiheux authored Oct 28, 2021
1 parent 15fc46d commit 96f5e87
Show file tree
Hide file tree
Showing 96 changed files with 269 additions and 204 deletions.
4 changes: 2 additions & 2 deletions ui/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export class AppComponent implements OnInit, OnDestroy {

this.eventsRouteSubscription = this._router.events.subscribe(e => {
if (e instanceof NavigationStart) {
this.hideNavBar = e.url.startsWith('/auth')
this.hideNavBar = e.url.startsWith('/auth');
}
});
}
Expand All @@ -108,7 +108,7 @@ export class AppComponent implements OnInit, OnDestroy {
this.isAPIAvailable = false;
this.loading = false;
setTimeout(() => {
window.location.reload()
window.location.reload();
}, 30000);
}
);
Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export let errorFactory = () => {
} else {
return new ErrorHandler();
}
}
};


@NgModule({
Expand Down
10 changes: 5 additions & 5 deletions ui/src/app/app.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export class AppService {

manageEventForTimeline(event: Event) {
if (!event || !event.type_event) {
return
return;
}
if (event.type_event === EventType.RUN_WORKFLOW_PREFIX) {
let mustAdd = true;
Expand Down Expand Up @@ -304,9 +304,9 @@ export class AppService {

async updateWorkflowCache(event: Event): Promise<void> {
if (!event || !event.type_event) {
return
return;
}
let wf = this._store.selectSnapshot(WorkflowState)
let wf = this._store.selectSnapshot(WorkflowState);
if (wf != null && wf.workflow && (wf.projectKey !== event.project_key || wf.workflow.name !== event.workflow_name)) {
if (event.type_event === EventType.WORKFLOW_DELETE) {
await this._store.dispatch(new projectActions.DeleteWorkflowInProject({ workflowName: event.workflow_name })).toPromise();
Expand Down Expand Up @@ -352,7 +352,7 @@ export class AppService {
})).toPromise();

if (this.routeParams['number'] === event.workflow_run_num.toString()) {
this._toast.info('', 'This run has just been deleted')
this._toast.info('', 'This run has just been deleted');
this._router.navigate(['/project', this.routeParams['key'], 'workflow', event.workflow_name]);
}
return;
Expand Down Expand Up @@ -401,7 +401,7 @@ export class AppService {

updateBroadcastCache(event: Event): void {
if (!event || !event.type_event) {
return
return;
}
switch (event.type_event) {
case EventType.BROADCAST_ADD:
Expand Down
4 changes: 2 additions & 2 deletions ui/src/app/event.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export class EventService {
concatMap((message: WebsocketEvent) => from(this._appService.manageEvent(message.event)))
)
.subscribe(() => {}, (err) => {
console.error('Error: ', err)
console.error('Error: ', err);
}, () => {
console.warn('Websocket Completed');
});
Expand Down Expand Up @@ -127,7 +127,7 @@ export class EventService {
break;
}
if (urlSplitted.length === 3) { // Ignore application/pipeline/environment/workflow creation pages
break
break;
}
let entityType = urlSplitted[2];
let entityName = urlSplitted[3].split('?')[0];
Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/model/schema.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class JSONSchema implements Schema {
let pp = properties[k].patternProperties;
if (pp['.*'] && pp['.*'].$ref) {
let newElt = pp['.*'].$ref.replace(JSONSchema.defPrefix, '');
JSONSchema.browse(schema, flatSchema, newElt, [...tree, k, '.*'])
JSONSchema.browse(schema, flatSchema, newElt, [...tree, k, '.*']);
}
} else if (properties[k].type) {
let currentOneOf = new Array<Schema>();
Expand Down
4 changes: 2 additions & 2 deletions ui/src/app/model/workflow.model.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ describe('CDS: Workflow Model', () => {
let ok = Workflow.removeNodeOnly(workflow, childjt1.id);

expect(ok).toBeTruthy();
expect(workflow.workflow_data.joins[0].triggers.length).toBe(2)
expect(workflow.workflow_data.joins[0].triggers.length).toBe(2);
}));

/**
Expand Down Expand Up @@ -279,6 +279,6 @@ describe('CDS: Workflow Model', () => {

expect(ok).toBeTruthy();
expect(workflow.workflow_data.joins[0].parents.length).toBe(1);
expect(workflow.workflow_data.joins[0].parents[0].parent_id).toBe(3)
expect(workflow.workflow_data.joins[0].parents[0].parent_id).toBe(3);
}));
});
6 changes: 3 additions & 3 deletions ui/src/app/model/workflow.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -317,11 +317,11 @@ export class Workflow {
j.triggers.forEach(t => {
let hooks = WNode.getAllHooks(t.child_node);
if (hooks) {
res = res.concat(hooks)
res = res.concat(hooks);
}
})
});
}
})
});
}
return res;
}
Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/model/workflow.run.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export class WorkflowRun {
wrs.version = workflowRun.version;
wrs.start = workflowRun.start;
wrs.status = workflowRun.status;
wrs.duration = workflowRun.duration
wrs.duration = workflowRun.duration;
wrs.tags = workflowRun.tags;
return wrs;
}
Expand Down
4 changes: 2 additions & 2 deletions ui/src/app/service/application/application.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class ApplicationService {
return this._http.get<Application>(
`/project/${key}/application/${appName}`,
{ params }
)
);
}

/**
Expand Down Expand Up @@ -71,7 +71,7 @@ export class ApplicationService {
updateAsCode(key: string, oldAppName, application: Application, branch, message: string): Observable<Operation> {
let params = new HttpParams();
params = params.append('branch', branch);
params = params.append('message', message)
params = params.append('message', message);
return this._http.put<Operation>(`/project/${key}/application/${oldAppName}/ascode`, application, { params });
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class AuthenticationService {
askSignin(consumerType: string, origin: string, redirectURI: string, requireMFA: boolean): Observable<AuthDriverSigningRedirect> {
let params = new HttpParams();
if (origin) {
params = params.append('origin', origin)
params = params.append('origin', origin);
}
if (redirectURI) {
params = params.append('redirect_uri', redirectURI);
Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/service/authentication/xsrf.interceptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class XSRFInterceptor implements HttpInterceptor {
if (xsrfCookie) {
headers['X-XSRF-TOKEN'] = xsrfCookie;
}
return headers
return headers;
}

getCookie(name: string): string {
Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/service/broadcast/broadcast.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export class BroadcastStore {
}
this.addBroadcastInCache(bc);
return b;
}))
}));
}


Expand Down
4 changes: 2 additions & 2 deletions ui/src/app/service/environment/environment.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class EnvironmentService {
params = params.append('withUsage', 'true');

return this._http
.get<Environment>(`/project/${key}/environment/${envName}`, { params })
.get<Environment>(`/project/${key}/environment/${envName}`, { params });
}

get(key: string): Observable<Array<Environment>> {
Expand All @@ -44,7 +44,7 @@ export class EnvironmentService {
updateAsCode(key: string, oldEnvName: string, environment: Environment, branch, message: string): Observable<Operation> {
let params = new HttpParams();
params = params.append('branch', branch);
params = params.append('message', message)
params = params.append('message', message);
return this._http.put<Operation>(`/project/${key}/environment/${oldEnvName}/ascode`, environment, { params });
}
}
2 changes: 1 addition & 1 deletion ui/src/app/service/group/group.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@ export class GroupService {
}

getProjectsInGroup(name: string): Observable<Array<Project>> {
return this._http.get<Array<Project>>(`/group/${name}/project`)
return this._http.get<Array<Project>>(`/group/${name}/project`);
}
}
2 changes: 1 addition & 1 deletion ui/src/app/service/pipeline/pipeline.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export class PipelineService {
updateAsCode(key: string, pipeline: Pipeline, branch, message: string): Observable<Operation> {
let params = new HttpParams();
params = params.append('branch', branch);
params = params.append('message', message)
params = params.append('message', message);
return this._http.put<Operation>(`/project/${key}/pipeline/${pipeline.name}/ascode`, pipeline, { params });
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export class WorkflowTemplateService {
let params = new HttpParams();
params = params.append('import', 'true');
params = params.append('branch', branch);
params = params.append('message', message)
params = params.append('message', message);
return this._http.post<Operation>(`/template/${groupName}/${templateSlug}/apply`,
req, { params });
}
Expand Down Expand Up @@ -88,7 +88,7 @@ export class WorkflowTemplateService {
branch: string, message: string): Observable<WorkflowTemplateBulk> {
let params = new HttpParams();
params = params.append('branch', branch);
params = params.append('message', message)
params = params.append('message', message);
return this._http.post<WorkflowTemplateBulk>(`/template/${groupName}/${templateSlug}/bulk`,
req, { params });
}
Expand Down
8 changes: 4 additions & 4 deletions ui/src/app/shared/action/action.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ describe('CDS: Action Component', () => {
action.requirements = new Array<Requirement>();
fixture.componentInstance.editableAction = action;
fixture.componentInstance.edit = true;
fixture.componentInstance.project = <Project>{ key: 'key' }
fixture.componentInstance.project = <Project>{ key: 'key' };

fixture.detectChanges();
tick(50);
Expand Down Expand Up @@ -136,7 +136,7 @@ describe('CDS: Action Component', () => {
action.requirements = new Array<Requirement>();
action.id = 1;
fixture.componentInstance.editableAction = action;
fixture.componentInstance.project = <Project>{ key: 'key' }
fixture.componentInstance.project = <Project>{ key: 'key' };

fixture.componentInstance._cd.detectChanges();
tick(50);
Expand Down Expand Up @@ -173,7 +173,7 @@ describe('CDS: Action Component', () => {
action.requirements = new Array<Requirement>();
fixture.componentInstance.editableAction = action;
fixture.componentInstance.edit = true;
fixture.componentInstance.project = <Project>{ key: 'key' }
fixture.componentInstance.project = <Project>{ key: 'key' };

fixture.detectChanges();
tick(50);
Expand Down Expand Up @@ -205,7 +205,7 @@ describe('CDS: Action Component', () => {

// Create component
let fixture = TestBed.createComponent(ActionComponent);
fixture.componentInstance.project = <Project>{ key: 'key' }
fixture.componentInstance.project = <Project>{ key: 'key' };

let component = fixture.debugElement.componentInstance;
expect(component).toBeTruthy();
Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/shared/action/action.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ export class ActionComponent implements OnDestroy, OnInit {
req.value = (newValue + ' ' + newOpts).trim();
req.opts = '';
}
})
});
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export class AsCodeSaveModalComponent implements OnDestroy {
});
break;
default:
this._toast.error('', this._translate.instant('ascode_error_unknown_type'))
this._toast.error('', this._translate.instant('ascode_error_unknown_type'));
}
}

Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/shared/audit/list/audit.list.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,6 @@ export class AuditListComponent implements OnInit {
before: this.selectedAudit.data_before,
after: this.selectedAudit.data_after,
type: diffType,
}]
}];
}
}
10 changes: 5 additions & 5 deletions ui/src/app/shared/diff/diff.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export function calculateWorkflowTemplateDiff(before: WorkflowTemplate, after: W
group_id: before.group_id,
description: before.description,
parameters: before.parameters
}
};
}

let afterTemplate: any;
Expand All @@ -23,7 +23,7 @@ export function calculateWorkflowTemplateDiff(before: WorkflowTemplate, after: W
group_id: after.group_id,
description: after.description,
parameters: after.parameters
}
};
}

let diffItems = [
Expand Down Expand Up @@ -51,7 +51,7 @@ export function calculateWorkflowTemplateDiff(before: WorkflowTemplate, after: W
before: before && before.pipelines && before.pipelines[i] ? Base64.b64DecodeUnicode(before.pipelines[i].value) : null,
after: after && after.pipelines && after.pipelines[i] ? Base64.b64DecodeUnicode(after.pipelines[i].value) : null,
type: 'text/x-yaml'
})
});
}

let applicationsLength = Math.max(
Expand All @@ -68,7 +68,7 @@ export function calculateWorkflowTemplateDiff(before: WorkflowTemplate, after: W
after: after && after.applications && after.applications[i] ?
Base64.b64DecodeUnicode(after.applications[i].value) : null,
type: 'text/x-yaml'
})
});
}

let environmentsLength = Math.max(
Expand All @@ -85,7 +85,7 @@ export function calculateWorkflowTemplateDiff(before: WorkflowTemplate, after: W
after: after && after.environments && after.environments[i] ?
Base64.b64DecodeUnicode(after.environments[i].value) : null,
type: 'text/x-yaml'
})
});
}

return diffItems;
Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/shared/parameter/form/parameter.form.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,6 @@ class MockParameterService {
}

getTypesFromAPI(): Observable<string[]> {
return of(['string', 'password'])
return of(['string', 'password']);
}
}
2 changes: 1 addition & 1 deletion ui/src/app/shared/parameter/list/parameter.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export class ParameterListComponent extends Table<Parameter> implements OnInit {
if (!this.parameterTypes) {
this._paramService.getTypesFromAPI().pipe(finalize(() => {
this.ready = true;
this._cd.markForCheck()
this._cd.markForCheck();
})).subscribe(types => {
this.parameterTypes = types;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@ export class RequirementsListComponent extends Table<Requirement> implements OnI
case 'memory':
// memory: memory_4096
req.name = 'memory_' + req.value;
break
break;
case 'model':
req.name = req.value;
break
break;
case OSArchitecture:
req.name = OSArchitecture;
break;
Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/shared/variable/form/variable.form.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,6 @@ class MockApplicationService {
}

getTypesFromAPI(): Observable<string[]> {
return of(['string', 'password'])
return of(['string', 'password']);
}
}
2 changes: 1 addition & 1 deletion ui/src/app/shared/vcs/vcs.strategy.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,6 @@ export class VCSStrategyComponent implements OnInit {
}

clickCopyKey() {
this._toast.success('', this._translate.instant('key_copied'))
this._toast.success('', this._translate.instant('key_copied'));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export class VulnerabilitiesListComponent {
this.filteredVulnerabilities = this.allVulnerabilities;
} else {
this.filteredVulnerabilities = this.allVulnerabilities
.filter(v => (v.component + ' ' + v.version).indexOf(this.filter) >= 0)
.filter(v => (v.component + ' ' + v.version).indexOf(this.filter) >= 0);
}
}
}
Expand Down
Loading

0 comments on commit 96f5e87

Please sign in to comment.