diff --git a/src/app/app.module.ts b/src/app/app.module.ts
index 6ddaff02..306c4244 100644
--- a/src/app/app.module.ts
+++ b/src/app/app.module.ts
@@ -286,6 +286,7 @@ import { MarkedDirective } from './directives/marked.directive';
import { InformationDialogComponent } from './components/dialogs/information-dialog.component';
import { TemplateNameDialogComponent } from './components/project-map/new-template-dialog/template-name-dialog/template-name-dialog.component';
import { UpdatesService } from './services/updates.service';
+import { ProjectReadmeComponent } from './components/project-map/project-readme/project-readme.component';
@NgModule({
@@ -621,7 +622,8 @@ import { UpdatesService } from './services/updates.service';
ChangeHostnameDialogComponent,
ApplianceInfoDialogComponent,
ConfigureCustomAdaptersDialogComponent,
- EditNetworkConfigurationDialogComponent
+ EditNetworkConfigurationDialogComponent,
+ ProjectReadmeComponent
],
bootstrap: [AppComponent]
})
diff --git a/src/app/components/project-map/project-map.component.ts b/src/app/components/project-map/project-map.component.ts
index f1374782..ca3a2f0c 100644
--- a/src/app/components/project-map/project-map.component.ts
+++ b/src/app/components/project-map/project-map.component.ts
@@ -72,6 +72,7 @@ import { ThemeService } from '../../services/theme.service';
import { Title } from '@angular/platform-browser';
import { NewTemplateDialogComponent } from './new-template-dialog/new-template-dialog.component';
import { NodeConsoleService } from '../../services/nodeConsole.service';
+import { ProjectReadmeComponent } from './project-readme/project-readme.component';
@Component({
@@ -258,8 +259,7 @@ export class ProjectMapComponent implements OnInit, OnDestroy {
if (!project ) this.router.navigate(['/servers']);
this.projectService.open(this.server, this.project.project_id);
- this.title.setTitle(this.project.name);
-
+ this.title.setTitle(this.project.name);
this.isInterfaceLabelVisible = this.mapSettingsService.showInterfaceLabels;
this.recentlyOpenedProjectService.setServerId(this.server.id.toString());
@@ -277,6 +277,7 @@ export class ProjectMapComponent implements OnInit, OnDestroy {
.subscribe(
(project: Project) => {
this.onProjectLoad(project);
+ if (this.mapSettingsService.openReadme) this.showReadme();
},
error => {
this.progressService.setError(error);
@@ -897,6 +898,18 @@ export class ProjectMapComponent implements OnInit, OnDestroy {
instance.project = this.project;
}
+ public showReadme() {
+ const dialogRef = this.dialog.open(ProjectReadmeComponent, {
+ width: '600px',
+ height: '650px',
+ autoFocus: false,
+ disableClose: true
+ });
+ let instance = dialogRef.componentInstance;
+ instance.server = this.server;
+ instance.project = this.project;
+ }
+
public ngOnDestroy() {
this.nodeConsoleService.openConsoles = 0;
this.title.setTitle('GNS3 Web UI');
diff --git a/src/app/components/project-map/project-readme/project-readme.component.html b/src/app/components/project-map/project-readme/project-readme.component.html
new file mode 100644
index 00000000..263e05cf
--- /dev/null
+++ b/src/app/components/project-map/project-readme/project-readme.component.html
@@ -0,0 +1,7 @@
+
Project README
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/app/components/project-map/project-readme/project-readme.component.scss b/src/app/components/project-map/project-readme/project-readme.component.scss
new file mode 100644
index 00000000..605a3657
--- /dev/null
+++ b/src/app/components/project-map/project-readme/project-readme.component.scss
@@ -0,0 +1,4 @@
+.textWrapper {
+ height: 500px!important;
+ overflow-y: scroll;
+}
diff --git a/src/app/components/project-map/project-readme/project-readme.component.ts b/src/app/components/project-map/project-readme/project-readme.component.ts
new file mode 100644
index 00000000..ba3bdb5e
--- /dev/null
+++ b/src/app/components/project-map/project-readme/project-readme.component.ts
@@ -0,0 +1,45 @@
+import { Component, AfterViewInit } from '@angular/core';
+import { MatDialogRef } from '@angular/material/dialog';
+import { Server } from '../../../models/server';
+import { Project } from '../../../models/project';
+import { ProjectService } from '../../../services/project.service';
+import * as marked from 'marked';
+import { ElementRef } from '@angular/core';
+import { Renderer2 } from '@angular/core';
+import { ViewChild } from '@angular/core';
+
+@Component({
+ selector: 'app-project-readme',
+ templateUrl: './project-readme.component.html',
+ styleUrls: ['./project-readme.component.scss']
+})
+export class ProjectReadmeComponent implements AfterViewInit {
+ server: Server;
+ project: Project;
+ @ViewChild('text', {static: false}) text: ElementRef;
+
+ constructor(
+ public dialogRef: MatDialogRef,
+ private projectService: ProjectService,
+ private elementRef: ElementRef,
+ private renderer: Renderer2
+ ) {}
+
+ ngAfterViewInit() {
+ let markdown = ``;
+
+ this.projectService.getReadmeFile(this.server, this.project.project_id).subscribe(file => {
+ if (file) {
+ markdown = file;
+ setTimeout(function(){
+ const markdownHtml = marked(markdown);
+ document.getElementById('text').innerHTML = markdownHtml;
+ }, 1000);
+ }
+ });
+ }
+
+ onNoClick() {
+ this.dialogRef.close();
+ }
+}
diff --git a/src/app/components/projects/edit-project-dialog/readme-editor/readme-editor.component.html b/src/app/components/projects/edit-project-dialog/readme-editor/readme-editor.component.html
index 8bf212d4..ee508436 100644
--- a/src/app/components/projects/edit-project-dialog/readme-editor/readme-editor.component.html
+++ b/src/app/components/projects/edit-project-dialog/readme-editor/readme-editor.component.html
@@ -1,5 +1,5 @@
-
+
diff --git a/src/app/components/projects/edit-project-dialog/readme-editor/readme-editor.component.scss b/src/app/components/projects/edit-project-dialog/readme-editor/readme-editor.component.scss
index 84588ba6..ea88fb98 100644
--- a/src/app/components/projects/edit-project-dialog/readme-editor/readme-editor.component.scss
+++ b/src/app/components/projects/edit-project-dialog/readme-editor/readme-editor.component.scss
@@ -1,5 +1,4 @@
.textWrapper {
- background-color: white;
height: 500px!important;
overflow-y: scroll;
}
diff --git a/src/app/components/settings/settings.component.html b/src/app/components/settings/settings.component.html
index 1c3c0b6c..ea5a4aa2 100644
--- a/src/app/components/settings/settings.component.html
+++ b/src/app/components/settings/settings.component.html
@@ -11,7 +11,8 @@
Send anonymous crash reports
- Integrate link labels to links
+ Integrate link labels to links
+ Automatically open project README files