Skip to content
This repository has been archived by the owner on Oct 28, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1092 from equilobe/311-fix-the-ui-in-hippo
Browse files Browse the repository at this point in the history
Fix the UI in hippo
  • Loading branch information
bacongobbler authored Aug 12, 2022
2 parents 53757db + ca55552 commit c0de14b
Show file tree
Hide file tree
Showing 24 changed files with 2,654 additions and 94 deletions.
8 changes: 4 additions & 4 deletions src/Web/ClientApp/src/app/_services/session.service.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AccountService, TokenInfo } from 'src/app/core/api/v1';
import { AuthTokensService, TokenInfo } from 'src/app/core/api/v1';
import { BehaviorSubject, Observable, map } from 'rxjs';
import { Injectable } from '@angular/core';

Expand All @@ -9,7 +9,7 @@ export class SessionService {
tokenSubject$: BehaviorSubject<TokenInfo>;
token$: Observable<TokenInfo>;

constructor(private readonly accountService: AccountService) {
constructor(private readonly authTokensService: AuthTokensService) {
this.tokenSubject$ = new BehaviorSubject<TokenInfo>(
JSON.parse(localStorage.getItem('token') || '{}')
);
Expand All @@ -18,8 +18,8 @@ export class SessionService {

// log into the system with the provided credentials
login(username: string, password: string) {
return this.accountService
.apiAccountCreatetokenPost({ userName: username, password })
return this.authTokensService
.apiAuthTokensPost({ userName: username, password })
.pipe(
map((tokenInfo) => {
localStorage.setItem('token', JSON.stringify(tokenInfo));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Component, OnInit } from '@angular/core';
import { FormControl, FormGroup, Validators } from '@angular/forms';
import { faLock, faUser } from '@fortawesome/free-solid-svg-icons';

import { AccountService } from 'src/app/core/api/v1';
import { AccountsService } from 'src/app/core/api/v1';
import { MustMatch } from 'src/app/_helpers/must-match.validator';
import { Router } from '@angular/router';

Expand All @@ -20,7 +20,7 @@ export class RegisterComponent implements OnInit {
faLock = faLock;

constructor(
private readonly accountService: AccountService,
private readonly accountsService: AccountsService,
private readonly router: Router
) {}

Expand Down Expand Up @@ -53,8 +53,8 @@ export class RegisterComponent implements OnInit {
}

this.loading = true;
this.accountService
.apiAccountPost({
this.accountsService
.apiAccountsPost({
userName: this.f['username'].value,
password: this.f['password'].value,
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import {
AppChannelListItem,
AppItem,
AppService,
AppsService,
ChannelJobStatusItem,
ChannelStatusesService,
JobStatus,
JobStatusService,
} from 'src/app/core/api/v1';
import { Component, OnDestroy, OnInit } from '@angular/core';
import { faCircle, faPlus } from '@fortawesome/free-solid-svg-icons';
Expand All @@ -27,8 +27,8 @@ export class ListComponent implements OnInit, OnDestroy {
timeInterval = 5000;

constructor(
private readonly appService: AppService,
private readonly jobStatusService: JobStatusService
private readonly appsService: AppsService,
private readonly channelStatusesService: ChannelStatusesService
) {}

ngOnInit(): void {
Expand All @@ -41,8 +41,8 @@ export class ListComponent implements OnInit, OnDestroy {
}

getJobStatus(): void {
this.jobStatusService
.apiJobstatusGet()
this.channelStatusesService
.apiChannelStatusesGet()
.subscribe((res) => (this.statuses = res.items));
}

Expand Down Expand Up @@ -84,7 +84,7 @@ export class ListComponent implements OnInit, OnDestroy {
}

refreshData() {
this.appService.apiAppGet().subscribe({
this.appsService.apiAppsGet().subscribe({
next: (vm) => (this.apps = vm.items),
error: (error) => {
console.log(error);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { ActivatedRoute, Router } from '@angular/router';
import {
AppService,
AppsService,
ChannelRevisionSelectionStrategy,
ChannelService,
StorageService,
ChannelsService,
StoragesService,
} from 'src/app/core/api/v1';
import { Component, OnInit } from '@angular/core';
import { FormControl, FormGroup, Validators } from '@angular/forms';
Expand Down Expand Up @@ -38,9 +38,9 @@ export class NewComponent implements OnInit {
storageQueryChanged = new Subject<string>();

constructor(
private readonly appService: AppService,
private readonly channelService: ChannelService,
private readonly storageService: StorageService,
private readonly appsService: AppsService,
private readonly channelsService: ChannelsService,
private readonly storagesService: StoragesService,
private route: ActivatedRoute,
private readonly router: Router
) {}
Expand Down Expand Up @@ -84,7 +84,7 @@ export class NewComponent implements OnInit {
}

queryStorages(newQuery: string) {
return this.storageService.apiStorageGet(newQuery, 0, 5);
return this.storagesService.apiStoragesGet(newQuery, 0, 5);
}

selectStorage(storage: string) {
Expand All @@ -106,15 +106,15 @@ export class NewComponent implements OnInit {
}

this.loading = true;
this.appService
.apiAppPost({
this.appsService
.apiAppsPost({
name: this.f['name'].value,
storageId: this.f['storageId'].value,
})
.subscribe({
next: (appId) => {
this.channelService
.apiChannelPost({
this.channelsService
.apiChannelsPost({
appId: appId,
name: 'Production',
revisionSelectionStrategy:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AppService, ChannelService } from 'src/app/core/api/v1';
import { AppsService, ChannelsService } from 'src/app/core/api/v1';
import { Component, Input, OnInit } from '@angular/core';
import { faEdit, faPlus, faTrash } from '@fortawesome/free-solid-svg-icons';

Expand Down Expand Up @@ -28,16 +28,16 @@ export class SettingsComponent implements OnInit {

constructor(
private router: Router,
private readonly appService: AppService,
private readonly channelService: ChannelService
private readonly appsService: AppsService,
private readonly channelsService: ChannelsService
) {}

ngOnInit(): void {
this.editAppName = this.channel.appSummary.name;
}

deleteApp(id: string) {
this.appService.apiAppIdDelete(id).subscribe({
this.appsService.apiAppsIdDelete(id).subscribe({
next: () => this.router.navigate(['/']),
error: (error) => {
console.log(error);
Expand All @@ -47,8 +47,8 @@ export class SettingsComponent implements OnInit {

editAppInfo() {
if (this.editAppName !== this.channel.appSummary.name) {
this.appService
.apiAppIdPut(this.channel.appSummary.id, {
this.appsService
.apiAppsIdPut(this.channel.appSummary.id, {
id: this.channel.appSummary.id,
name: this.editAppName,
})
Expand Down Expand Up @@ -81,7 +81,7 @@ export class SettingsComponent implements OnInit {

deleteChannel(channelId: string) {
if (this.channel.appSummary.channels.length > 1) {
this.channelService.apiChannelIdDelete(channelId).subscribe({
this.channelsService.apiChannelsIdDelete(channelId).subscribe({
next: () => {
this.channel.appSummary.channels =
this.channel.appSummary.channels.filter(
Expand Down Expand Up @@ -112,17 +112,18 @@ export class SettingsComponent implements OnInit {

editChannelInfo(channel: any) {
if (this.editChannelName !== this.channel.name) {
this.channelService.apiChannelIdGet(channel.id).subscribe({
next: (channelDetails) => {
this.channelService
.apiChannelIdPut(channel.id, {
id: channelDetails.id,
this.channelsService.apiChannelsIdGet(channel.id).subscribe({
next: (channelsDetails) => {
this.channelsService
.apiChannelsIdPut(channel.id, {
id: channelsDetails.id,
name: this.editChannelName,
revisionSelectionStrategy:
channelDetails.revisionSelectionStrategy,
rangeRule: channelDetails.rangeRule,
domain: channelDetails.domain,
activeRevisionId: channelDetails.activeRevision?.id,
channelsDetails.revisionSelectionStrategy,
rangeRule: channelsDetails.rangeRule,
domain: channelsDetails.domain,
activeRevisionId:
channelsDetails.activeRevision?.id,
})
.subscribe({
next: () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ActivatedRoute, Router } from '@angular/router';
import {
AppChannelListItem,
ChannelItem,
ChannelService,
ChannelsService,
} from 'src/app/core/api/v1';
import { ApplicationTabs, ComponentTypes } from 'src/app/_helpers/constants';
import { Component, OnInit } from '@angular/core';
Expand Down Expand Up @@ -33,7 +33,7 @@ export class ChannelComponent implements OnInit {
constructor(
private route: ActivatedRoute,
private router: Router,
private readonly channelService: ChannelService
private readonly channelsService: ChannelsService
) {}

ngOnInit(): void {
Expand All @@ -52,8 +52,8 @@ export class ChannelComponent implements OnInit {
}

refreshData() {
this.channelService
.apiChannelIdGet(this.channelId)
this.channelsService
.apiChannelsIdGet(this.channelId)
.subscribe((channel) => {
!channel
? this.router.navigate(['/404'])
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component, Input, OnChanges } from '@angular/core';
import { ChannelService } from 'src/app/core/api/v1';
import { ChannelsService } from 'src/app/core/api/v1';

@Component({
selector: 'app-logs',
Expand All @@ -13,7 +13,7 @@ export class LogsComponent implements OnChanges {
logs: Array<string> = [];
loading = false;

constructor(private readonly channelService: ChannelService) {}
constructor(private readonly channelsService: ChannelsService) {}

ngOnChanges(): void {
this.refreshData();
Expand All @@ -22,7 +22,7 @@ export class LogsComponent implements OnChanges {
refreshData(): void {
this.loading = true;

this.channelService.apiChannelLogsIdGet(this.channelId).subscribe({
this.channelsService.apiChannelsIdLogsGet(this.channelId).subscribe({
next: (vm) => {
this.logs = vm.logs;
this.loading = false;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ActivatedRoute, Router } from '@angular/router';
import {
ChannelRevisionSelectionStrategy,
ChannelService,
ChannelsService,
} from 'src/app/core/api/v1';
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { FormControl, FormGroup, Validators } from '@angular/forms';
Expand All @@ -26,7 +26,7 @@ export class NewComponent implements OnInit {
created: EventEmitter<object> = new EventEmitter<object>();

constructor(
private readonly channelService: ChannelService,
private readonly channelsService: ChannelsService,
private route: ActivatedRoute,
private readonly router: Router
) {}
Expand Down Expand Up @@ -60,8 +60,8 @@ export class NewComponent implements OnInit {
}

this.loading = true;
this.channelService
.apiChannelPost({
this.channelsService
.apiChannelsPost({
appId: this.appId,
name: this.f['name'].value,
revisionSelectionStrategy:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {
ChannelItem,
ChannelService,
ChannelStatusesService,
ChannelsService,
JobStatus,
JobStatusService,
RevisionItem,
} from 'src/app/core/api/v1';
import { Component, Input, OnChanges, OnDestroy, OnInit } from '@angular/core';
Expand Down Expand Up @@ -38,8 +38,8 @@ export class OverviewComponent implements OnChanges, OnInit, OnDestroy {
timeInterval = 5000;

constructor(
private readonly channelService: ChannelService,
private readonly jobStatusService: JobStatusService,
private readonly channelsService: ChannelsService,
private readonly channelStatusesService: ChannelStatusesService,
private router: Router
) {
TimeAgo.addDefaultLocale(en);
Expand All @@ -63,9 +63,9 @@ export class OverviewComponent implements OnChanges, OnInit, OnDestroy {
}

getJobStatus(): void {
this.jobStatusService
.apiJobstatusChannelIdGet(this.channelId)
.subscribe((res) => (this.channelStatus = res.status));
this.channelStatusesService
.apiChannelStatusesGet(undefined, undefined, this.channelId)
.subscribe((res) => (this.channelStatus = res.items[0].status));
}

getStatusColor(status: JobStatus | undefined) {
Expand All @@ -85,7 +85,7 @@ export class OverviewComponent implements OnChanges, OnInit, OnDestroy {

refreshData() {
this.loading = true;
this.channelService.apiChannelIdGet(this.channelId).subscribe({
this.channelsService.apiChannelsIdGet(this.channelId).subscribe({
next: (channel) => {
!channel
? this.router.navigate(['/404'])
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChannelService, EnvironmentVariableItem } from 'src/app/core/api/v1';
import { ChannelsService, EnvironmentVariableItem } from 'src/app/core/api/v1';
import {
Component,
EventEmitter,
Expand Down Expand Up @@ -35,7 +35,7 @@ export class ListComponent implements OnChanges {
faTrash = faTrash;
faSave = faSave;

constructor(private readonly channelService: ChannelService) {}
constructor(private readonly channelsService: ChannelsService) {}

ngOnChanges(changes: { [propName: string]: SimpleChange }): void {
if (
Expand Down Expand Up @@ -90,8 +90,8 @@ export class ListComponent implements OnChanges {
return;
}
console.log(this.envvars);
this.channelService
.apiChannelIdPatch(this.channelId, {
this.channelsService
.apiChannelsIdPatch(this.channelId, {
environmentVariables: this.envvars,
})
.subscribe({
Expand Down
Loading

0 comments on commit c0de14b

Please sign in to comment.