Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: #29 Add key
  • Loading branch information
jorgecod committed Apr 16, 2020
commit bcd8e866f041251e143967679e294e6d9616085a
2 changes: 2 additions & 0 deletions .github/workflows/CD-time-tracker-ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ jobs:
SCOPES: ${{ secrets.scopes }}
CLIENT_ID: ${{ secrets.client_id }}
AUTHORITY: ${{ secrets.authority }}
STACK_EXCHANGE_ID: ${{ secrets.stack_exchange_id }}
STACK_EXCHANGE_ACCESS_TOKEN: ${{ secrets.stack_exchange_access_token }}
run: |
chmod +x ./scripts/populate-keys.sh
sh ./scripts/populate-keys.sh
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/CI-mutation-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ jobs:
SCOPES: ${{ secrets.scopes }}
CLIENT_ID: ${{ secrets.client_id }}
AUTHORITY: ${{ secrets.authority }}
STACK_EXCHANGE_ID: ${{ secrets.stack_exchange_id }}
STACK_EXCHANGE_ACCESS_TOKEN: ${{ secrets.stack_exchange_access_token }}
run: sudo sh scripts/populate-keys.sh

- name: Run the test
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/CI-time-tracker-ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,14 @@ jobs:
SCOPES: ${{ secrets.scopes }}
CLIENT_ID: ${{ secrets.client_id }}
AUTHORITY: ${{ secrets.authority }}
STACK_EXCHANGE_ID: ${{ secrets.stack_exchange_id }}
STACK_EXCHANGE_ACCESS_TOKEN: ${{ secrets.stack_exchange_access_token }}
run: sudo sh scripts/populate-keys.sh

- name: Run the test
run: npm run ci-test --if-present

- name: Generate coverage report
env:
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
run: bash <(curl -s https://codecov.io/bash)
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ Create a file keys.ts with the content pinned in our slack channel:
export const AUTHORITY = 'XXX';
export const CLIENT_ID = 'XXX';
export const SCOPES = ['XXX'];
export const STACK_EXCHANGE_ID = 'XXX';
export const STACK_EXCHANGE_ACCESS_TOKEN = 'XXX';
```

### Prepare your environment for vscode
Expand Down
2 changes: 2 additions & 0 deletions scripts/populate-keys.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@
echo 'export const AUTHORITY = "'$AUTHORITY'";' >> src/environments/keys.ts
echo 'export const CLIENT_ID = "'$CLIENT_ID'";' >> src/environments/keys.ts
echo 'export const SCOPES = ["'$SCOPES'"];' >> src/environments/keys.ts
echo 'export const STACK_EXCHANGE_ID = ["'$STACK_EXCHANGE_ID'"];' >> src/environments/keys.ts
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you need to remove the brackets and only have his line as:

echo 'export const STACK_EXCHANGE_ID = "'$STACK_EXCHANGE_ID'";' >> src/environments/keys.ts

echo 'export const STACK_EXCHANGE_ACCESS_TOKEN = ["'$STACK_EXCHANGE_ACCESS_TOKEN'"];' >> src/environments/keys.ts
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

cat src/environments/keys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ describe('DetailsFieldsComponent', () => {
const name = 'ngrx';
component.selectedTechnology = ['java', 'javascript'];
component.selectedTechnology.indexOf(name);
component.selectedTechnology.length = 2;
component.setTechnology(name);
expect(component.selectedTechnology.length).toBe(3);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,8 @@ export class DetailsFieldsComponent implements OnChanges, OnInit {
const index = this.selectedTechnology.indexOf(name);
if (index > -1) {
this.removeTag(index);
} else {
if (this.selectedTechnology.length < 10) {
this.selectedTechnology = [...this.selectedTechnology, name];
}
} else if (this.selectedTechnology.length < 10) {
this.selectedTechnology = [...this.selectedTechnology, name];
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/app/modules/shared/services/technology.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs';
import { Technology } from '../models/technology.model';
import { KEY, environment } from '../../../../environments/environment';
import { STACK_EXCHANGE_ID, STACK_EXCHANGE_ACCESS_TOKEN, environment } from '../../../../environments/environment';

@Injectable({
providedIn: 'root',
Expand All @@ -12,7 +12,7 @@ export class TechnologyService {
constructor(private http: HttpClient) {}

getTechnologies(value: string): Observable<Technology> {
const url = `${this.baseUrl}&inname=${value}&site=stackoverflow&key=${KEY}`;
const url = `${this.baseUrl}&inname=${value}&site=stackoverflow&key=${STACK_EXCHANGE_ID}&access_token=${STACK_EXCHANGE_ACCESS_TOKEN}`;
return this.http.get<Technology>(url);
}
}
3 changes: 2 additions & 1 deletion src/environments/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ export const AUTHORITY = keys.AUTHORITY;
export const CLIENT_ID = keys.CLIENT_ID;
export const SCOPES = keys.SCOPES;
export const ITEMS_PER_PAGE = 5;
export const KEY = keys.KEY_TECHNOLOGY;
export const STACK_EXCHANGE_ID = keys.STACK_EXCHANGE_ID;
export const STACK_EXCHANGE_ACCESS_TOKEN = keys.STACK_EXCHANGE_ACCESS_TOKEN;

/*
* For easier debugging in development mode, you can import the following file
Expand Down
3 changes: 2 additions & 1 deletion src/environments/keys.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export const AUTHORITY = 'XXX';
export const CLIENT_ID = 'XXX';
export const SCOPES = ['XXX'];
export const KEY_TECHNOLOGY = 'XXX';
export const STACK_EXCHANGE_ID = 'XXX';
export const STACK_EXCHANGE_ACCESS_TOKEN = 'XXX';