diff --git a/src/app/app.module.ts b/src/app/app.module.ts
index ebb6ebd..a31a85e 100644
--- a/src/app/app.module.ts
+++ b/src/app/app.module.ts
@@ -33,6 +33,7 @@ import { ServicesGroupComponent } from './gui/components/services-group/services
import { ModalComponent } from './gui/modal/modal.component';
import { SafeHtmlPipe } from './gui/safe-html.pipe';
import { AboutComponent } from './pages/about/about.component';
+import { DownloadsComponent } from './pages/downloads/downloads.component';
@NgModule({
@@ -50,6 +51,7 @@ import { AboutComponent } from './pages/about/about.component';
FooterComponent,
ErrorComponent,
AboutComponent,
+ DownloadsComponent,
],
imports: [
BrowserModule,
diff --git a/src/app/gui/components/service/service.component.html b/src/app/gui/components/service/service.component.html
index abba6ed..26a6e12 100644
--- a/src/app/gui/components/service/service.component.html
+++ b/src/app/gui/components/service/service.component.html
@@ -9,7 +9,7 @@
-
-
+
Transports
diff --git a/src/app/gui/components/service/service.component.ts b/src/app/gui/components/service/service.component.ts
index 87b52fc..c7d2867 100644
--- a/src/app/gui/components/service/service.component.ts
+++ b/src/app/gui/components/service/service.component.ts
@@ -49,6 +49,8 @@ export class ServiceComponent implements OnInit {
klass.push('maintenance');
} else if (this.service.not_accesible) {
klass.push('forbidden');
+ } else if (this.service.in_use) {
+ klass.push('inuse');
}
if (klass.length > 1) {
klass.push('alert');
@@ -65,14 +67,14 @@ export class ServiceComponent implements OnInit {
return this.service.allow_users_remove || this.service.allow_users_reset;
}
- hasManyTransports() {
- return this.service.transports.length > 1;
+ showTransportsMenu() {
+ return this.service.transports.length > 1 && this.service.show_transports;
}
hasMenu() {
return this.service.maintenance === false &&
this.service.not_accesible === false &&
- (this.hasActions() || this.hasManyTransports())
+ (this.hasActions() || this.showTransportsMenu())
;
}
@@ -91,7 +93,7 @@ export class ServiceComponent implements OnInit {
'
'
);
} else {
- if (transport === null) {
+ if (transport === null || this.service.show_transports === false) {
transport = this.service.transports[0];
}
this.api.launchURL(transport.link);
@@ -99,38 +101,23 @@ export class ServiceComponent implements OnInit {
}
action(type: string) {
- if (type === 'remove') {
- this.api.gui.yesno(
- django.gettext('Release service: ') + this.serviceName,
- django.gettext('Are you sure?'
- )).subscribe((val: boolean) => {
- if (val) {
- console.log('Releasing service');
- this.api.releaser(this.service.id).subscribe((service) => {
- this.api.gui.alert(
- django.gettext('Release service: ') + this.serviceName,
- django.gettext('Service released')
- );
- console.log(service);
- });
+ const title = type === 'release' ? django.gettext('Release service: ') : django.gettext('Reset service: ') + this.serviceName;
+ const action = type === 'release' ? django.gettext('Service released') : django.gettext('Service reseted');
+ this.api.gui.yesno(
+ title,
+ django.gettext('Are you sure?')
+ ).subscribe((val) => {
+ if (val) {
+ this.api.action(type, this.service.id).subscribe((service) => {
+ if (service) {
+ this.api.gui.alert(
+ title,
+ action
+ );
}
});
- } else { // 'reset'
- this.api.gui.yesno(
- django.gettext('Reset service: ') + this.serviceName,
- django.gettext('Are you sure?')
- ).subscribe((val: boolean) => {
- if (val) {
- console.log('Reseting service');
- this.api.resetter(this.service.id).subscribe((service) => {
- this.api.gui.alert(
- django.gettext('Reset service: ') + this.serviceName,
- django.gettext('Service Reset')
- );
- console.log(service);
- });
}
- });
- }
+ });
+
}
}
diff --git a/src/app/modules/app-routing.module.ts b/src/app/modules/app-routing.module.ts
index a0a2138..aecbff1 100644
--- a/src/app/modules/app-routing.module.ts
+++ b/src/app/modules/app-routing.module.ts
@@ -3,6 +3,7 @@ import { Routes, RouterModule } from '@angular/router';
import { LoginComponent } from '../pages/login/login.component';
import { ClientDownloadComponent } from '../pages/client-download/client-download.component';
+import { DownloadsComponent } from '../pages/downloads/downloads.component';
import { ServicesComponent } from '../pages/services/services.component';
import { ErrorComponent } from '../pages/error/error.component';
import { AboutComponent } from '../pages/about/about.component';
@@ -15,6 +16,8 @@ const routes: Routes = [
{ path: 'login/:id', component: LoginComponent },
{ path: 'client-download', component: ClientDownloadComponent },
+ { path: 'downloads', component: DownloadsComponent },
+
{ path: 'error/:id', component: ErrorComponent },
{ path: 'about', component: AboutComponent },
diff --git a/src/app/pages/downloads/downloads.component.css b/src/app/pages/downloads/downloads.component.css
new file mode 100644
index 0000000..76b293c
--- /dev/null
+++ b/src/app/pages/downloads/downloads.component.css
@@ -0,0 +1,48 @@
+.actors-container {
+ display: flex;
+ flex-flow: column;
+ margin: 0 2%;
+}
+
+.banner {
+ display: flex;
+ justify-content: center;
+}
+
+.banner-text h1 {
+ font-size: 2em;
+ text-align: center;
+}
+
+.actors {
+ display: flex;
+ flex-flow: row wrap;
+ justify-content: space-around;
+ align-content: center;
+ margin: auto;
+}
+
+.actor {
+ border: 1px solid;
+ margin-top: 1rem;
+ padding: 1em;
+ border-radius: 1rem;
+ box-shadow: 0 1rem 2rem rgba(0,0,0,0.25), 0 10px 10px rgba(0,0,0,0.22);
+ transition: all 0.3s cubic-bezier(.25,.8,.25,1);
+ flex: 1 0 34%;
+ margin-right: 1em;
+}
+
+.actor:hover {
+ cursor: pointer;
+ box-shadow: 0 0.1rem 0.2rem rgba(0,0,0,0.25), 0 10px 10px rgba(0,0,0,0.22);
+}
+
+.name {
+ font-size: 1.5em;
+ margin-bottom: 1em;
+ font-weight: bold;
+}
+
+.description {
+}
\ No newline at end of file
diff --git a/src/app/pages/downloads/downloads.component.html b/src/app/pages/downloads/downloads.component.html
new file mode 100644
index 0000000..dc5846e
--- /dev/null
+++ b/src/app/pages/downloads/downloads.component.html
@@ -0,0 +1,20 @@
+
diff --git a/src/app/pages/downloads/downloads.component.ts b/src/app/pages/downloads/downloads.component.ts
new file mode 100644
index 0000000..636c89e
--- /dev/null
+++ b/src/app/pages/downloads/downloads.component.ts
@@ -0,0 +1,24 @@
+import { Component, OnInit } from '@angular/core';
+import { UDSApiService } from '../../uds-api.service';
+
+@Component({
+ selector: 'uds-downloads',
+ templateUrl: './downloads.component.html',
+ styleUrls: ['./downloads.component.css']
+})
+export class DownloadsComponent implements OnInit {
+
+ constructor(public api: UDSApiService) { }
+
+ ngOnInit() {
+ }
+
+ download(url: string) {
+ window.location.href = url;
+ }
+
+ img(image: string) {
+ return this.api.staticURL( 'modern/img/' + image + '.png');
+ }
+
+}
diff --git a/src/app/types/config.ts b/src/app/types/config.ts
index 410c15a..d1e0867 100644
--- a/src/app/types/config.ts
+++ b/src/app/types/config.ts
@@ -23,8 +23,7 @@ export interface UDSUrls {
readonly services: string;
readonly admin: string;
readonly enabler: string;
- readonly resetter: string;
- readonly releaser: string;
+ readonly action: string;
readonly galleryImage: string;
readonly transportIcon: string;
}
@@ -39,7 +38,6 @@ export interface UDSConfig {
readonly csrf_field: string;
readonly csrf: string;
readonly urls: UDSUrls;
- readonly bypassPluginDetection: boolean;
}
export interface Downloadable {
diff --git a/src/app/types/services.ts b/src/app/types/services.ts
index d73bb68..ec468a3 100644
--- a/src/app/types/services.ts
+++ b/src/app/types/services.ts
@@ -16,22 +16,22 @@ export interface JSONTransport {
}
export interface JSONService {
- allow_users_remove: boolean;
- allow_users_reset: boolean;
+ id: string;
comments: string;
description: string;
group: JSONGroup;
- id: string;
imageId: string;
- is_use: boolean;
maintenance: boolean;
name: string;
+ visual_name: string;
not_accesible: boolean;
show_transports: boolean;
+ allow_users_remove: boolean;
+ allow_users_reset: boolean;
to_be_replaced: boolean;
to_be_replaced_text: string;
+ in_use: boolean;
transports: JSONTransport[];
- visual_name: string;
}
export interface JSONServicesInformation {
diff --git a/src/app/uds-api.service.ts b/src/app/uds-api.service.ts
index 34ab0b0..86524a5 100644
--- a/src/app/uds-api.service.ts
+++ b/src/app/uds-api.service.ts
@@ -35,6 +35,13 @@ export class UDSApiService {
return udsData.plugins;
}
+ /**
+ * Gets actors list
+ */
+ get actors(): Downloadable[] {
+ return udsData.actors;
+ }
+
/* Client enabler */
enabler(serviceId: string, transportId: string) {
const enabler = this.config.urls.enabler.replace('param1', serviceId).replace('param2', transportId);
@@ -42,15 +49,9 @@ export class UDSApiService {
}
/* Services resetter */
- resetter(serviceId: string) {
- const resetter = this.config.urls.resetter.replace('param1', serviceId);
- return this.http.get(resetter);
- }
-
- /* Services resetter */
- releaser(serviceId: string) {
- const releaser = this.config.urls.resetter.replace('param1', serviceId);
- return this.http.get(releaser);
+ action(action: string, serviceId: string) {
+ const actionURL = this.config.urls.action.replace('param1', serviceId).replace('param2', action);
+ return this.http.get(actionURL);
}
/* Images & static related */