Pipline test

This commit is contained in:
Igor 2019-11-23 17:02:43 +01:00
parent f671ac5ba0
commit 7fb8420fb6
5 changed files with 105 additions and 25 deletions

3
Jenkinsfile vendored
View File

@ -1,3 +1,4 @@
// This shows a simple example of how to archive the build output artifacts.
node {
stage('Checkout SCM'){
git branch: 'SP2', url: 'git@github.com:kalyan11021980/angular-ssr-starter.git'
@ -12,4 +13,4 @@ node {
stage('Deploy'){
sh "pm2 restart all"
}
}
}

View File

@ -1,6 +1,6 @@
{
"name": "demo",
"version": "0.0.2",
"version": "0.0.4",
"scripts": {
"ng": "ng",
"start": "ng serve",

File diff suppressed because one or more lines are too long

View File

@ -1,20 +1,12 @@
<!--The content below is only a placeholder and can be replaced.-->
<div style="text-align:center">
<h1>
Welcome to {{ title }}!
{{ title }}!
</h1>
<img width="300" alt="Angular Logo" src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNTAgMjUwIj4KICAgIDxwYXRoIGZpbGw9IiNERDAwMzEiIGQ9Ik0xMjUgMzBMMzEuOSA2My4ybDE0LjIgMTIzLjFMMTI1IDIzMGw3OC45LTQzLjcgMTQuMi0xMjMuMXoiIC8+CiAgICA8cGF0aCBmaWxsPSIjQzMwMDJGIiBkPSJNMTI1IDMwdjIyLjItLjFWMjMwbDc4LjktNDMuNyAxNC4yLTEyMy4xTDEyNSAzMHoiIC8+CiAgICA8cGF0aCAgZmlsbD0iI0ZGRkZGRiIgZD0iTTEyNSA1Mi4xTDY2LjggMTgyLjZoMjEuN2wxMS43LTI5LjJoNDkuNGwxMS43IDI5LjJIMTgzTDEyNSA1Mi4xem0xNyA4My4zaC0zNGwxNy00MC45IDE3IDQwLjl6IiAvPgogIDwvc3ZnPg==">
</div>
<h2>Here are some links to help you start: </h2>
<ul>
<li>
<h2><a target="_blank" rel="noopener" href="https://angular.io/tutorial">Tour of Heroes</a></h2>
</li>
<li>
<h2><a target="_blank" rel="noopener" href="https://github.com/angular/angular-cli/wiki">CLI Documentation</a></h2>
</li>
<li>
<h2><a target="_blank" rel="noopener" href="https://blog.angular.io/">Angular blog</a></h2>
</li>
</ul>
<form #gSearch method="GET" id="gSearch" action="https://www.google.com/search">
<div id="voicesearch">
<input #searchKey name="q" id="searchKey" type="hidden">
<div (click)="voiceSearc" id="icon-mic"></div>
</div>
</form>

View File

@ -1,7 +1,8 @@
import { Component, Injector, Inject, PLATFORM_ID } from '@angular/core';
import { Component, Injector, Inject, PLATFORM_ID, Renderer2, ViewChild } from '@angular/core';
import { isPlatformServer } from '@angular/common';
import { TransferState, makeStateKey } from '@angular/platform-browser';
const configKey = makeStateKey('CONFIG');
declare var webkitSpeechRecognition: any;
@Component({
selector: 'app-root',
@ -10,18 +11,47 @@ const configKey = makeStateKey('CONFIG');
})
export class AppComponent {
public title : string;
@ViewChild('gSearch') formSearch;
@ViewChild('searchKey') hiddenSearchHandler;
constructor(
private injector: Injector,
private state : TransferState,
@Inject(PLATFORM_ID) private platformid: Object
@Inject(PLATFORM_ID) private platformid: Object,
private renderer: Renderer2
){
this.title = 'demo';
this.title = 'Voice Search Demo';
if(isPlatformServer(this.platformid)){
const envJson = this.injector.get('CONFIG')? this.injector.get('CONFIG'): {};
this.state.set(configKey, envJson as any);
} else {
console.log(this.state.get(configKey, undefined as any));
}
}
}
public voiceSearch(){
if('webkitSpeechRecognition' in window){
const vSearch = new webkitSpeechRecognition();
vSearch.continuous = false;
vSearch.interimresults = false;
vSearch.lang = 'en-US';
vSearch.start();
const voiceSearchForm = this.formSearch.nativeElement;
const voiceHandler = this.hiddenSearchHandler.nativeElement;
console.log(voiceSearchForm);
vSearch.onresult = function(e){
console.log(voiceSearchForm);
voiceHandler.value = e.results[0][0].transcript;
vSearch.stop();
console.log(voiceHandler);
voiceSearchForm.submit();
}
vSearch.onerror = function(e){
console.log(e);
vSearch.stop();
}
} else {
console.log(this.state.get(configKey, undefined as any));
}
}
}