Skip to content

Commit

Permalink
Hotfix: VC visible after deletion (#77)
Browse files Browse the repository at this point in the history
* update version and changelog, fix refresh after delete vc

* update no credential message and view

* update no credential msg and settings styles

* Delete .vscode directory

* Delete .github/workflows/security.yml

* Update build.yml

* Update release.yml

* Update CHANGELOG.md

* Update credentials.page.ts

---------

Co-authored-by: Oriol Canadés <oriol.canades@in2.es>
  • Loading branch information
dmitriin2 and oriolcanades authored Nov 11, 2024
1 parent 7352c19 commit 9687558
Show file tree
Hide file tree
Showing 14 changed files with 110 additions and 95 deletions.
18 changes: 2 additions & 16 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ on:
push:
branches:
- main
- hotfix/*
pull_request:
branches:
- main
types: [opened, synchronize, reopened]

jobs:
build:
name: Build and analyze
name: Build and Analyze
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -25,20 +25,6 @@ jobs:
- name: Install Dependencies
run: npm install

- name: Check for existing release tag (only on PR)
if: github.event_name == 'pull_request'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
VERSION=$(jq -r '.version' package.json)
TAG_EXISTS=$(curl -H "Authorization: token $GITHUB_TOKEN" -s https://api.github.com/repos/${{ github.repository }}/releases | jq -r ".[] | select(.tag_name == \"v$VERSION\") | .tag_name")
if [ "$TAG_EXISTS" == "v$VERSION" ]; then
echo "Release tag v$VERSION already exists. Rejecting PR."
exit 1
else
echo "No existing release with tag v$VERSION found. Proceeding with build."
fi
- name: Build Angular Project
run: npm run build -- --configuration=development

Expand Down
32 changes: 29 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ permissions:
jobs:
release-snapshot:
if: github.event_name == 'pull_request'
name: release-snapshot
name: Release Snapshot
runs-on: ubuntu-latest
environment: local
steps:
Expand All @@ -25,6 +25,19 @@ jobs:
id: get_version
run: echo "VERSION=$(jq -r '.version' package.json)" >> $GITHUB_ENV

- name: Check for existing release tag (only on PR)
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ env.VERSION }}
run: |
TAG_EXISTS=$(curl -H "Authorization: token $GITHUB_TOKEN" -s https://api.github.com/repos/${{ github.repository }}/releases | jq -r ".[] | select(.tag_name == \"v$VERSION\") | .tag_name")
if [ "$TAG_EXISTS" == "v$VERSION" ]; then
echo "Release tag v$VERSION already exists. Rejecting PR."
exit 1
else
echo "No existing release with tag v$VERSION found. Proceeding with build."
fi
- name: Build and Push docker image
run: |
PROJECT_NAME=$(jq -r '.name' package.json)
Expand All @@ -41,7 +54,7 @@ jobs:

release:
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
name: release
name: Release
runs-on: ubuntu-latest
environment: local
steps:
Expand All @@ -52,6 +65,19 @@ jobs:
id: get_version
run: echo "VERSION=$(jq -r '.version' package.json)" >> $GITHUB_ENV

- name: Check for existing release tag (only on PR)
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ env.VERSION }}
run: |
TAG_EXISTS=$(curl -H "Authorization: token $GITHUB_TOKEN" -s https://api.github.com/repos/${{ github.repository }}/releases | jq -r ".[] | select(.tag_name == \"v$VERSION\") | .tag_name")
if [ "$TAG_EXISTS" == "v$VERSION" ]; then
echo "Release tag v$VERSION already exists. Rejecting PR."
exit 1
else
echo "No existing release with tag v$VERSION found. Proceeding with build."
fi
- name: Build and Push docker image
run: |
PROJECT_NAME=$(jq -r '.name' package.json)
Expand All @@ -74,4 +100,4 @@ jobs:
release_name: "v${{ env.VERSION }}"
body: "Release of version v${{ env.VERSION }}"
draft: false
prerelease: true
prerelease: false
28 changes: 0 additions & 28 deletions .github/workflows/security.yml

This file was deleted.

5 changes: 0 additions & 5 deletions .vscode/extensions.json

This file was deleted.

17 changes: 0 additions & 17 deletions .vscode/launch.json

This file was deleted.

10 changes: 0 additions & 10 deletions .vscode/settings.json

This file was deleted.

6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [v1.3.4](https://github.com/in2workspace/in2-wallet-ui/releases/tag/v1.3.4)
### Fixed
- Refresh credentials list after deleting credential.
### Updated
- No credentials and Settings views slyle.

## [v1.3.3]
### Fixed
- The Error popup is shown when the user has no credentials.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "in2-wallet-ui",
"version": "1.3.3",
"version": "1.3.4",
"author": "Ionic Framework",
"homepage": "https://ionicframework.com/",
"scripts": {
Expand Down
7 changes: 6 additions & 1 deletion src/app/pages/credentials/credentials.page.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
<ion-content [fullscreen]="true" class="background-content" *ngIf="!toggleScan && !isAlertOpen">
<ion-grid>
<ion-text *ngIf="credList.length===0"> {{"credentials.nocred"|translate}}</ion-text>
<ion-row class="ion-justify-content-center"
*ngIf="credList.length===0">
<div class="no-cred-box">
<ion-text *ngIf="credList.length===0"> {{"credentials.nocred"|translate}}</ion-text>
</div>
</ion-row>
<ion-row class="ion-justify-content-center"
*ngFor="let cred of credList">
<app-vc-view (vcEmit)="vcDelete($event)" [credentialInput]="cred"></app-vc-view>
Expand Down
18 changes: 18 additions & 0 deletions src/app/pages/credentials/credentials.page.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,24 @@
.credential-content {
--ion-background-color: #DDE6F6 !important;
}

.no-cred-box {
white-space: pre-line;
color: grey;
padding: 45px;
width: 70%;
margin: 60px 15%;
border-radius: 5px;
background-color: #f2f4f8;
position: relative;
font-family:'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
flex-grow: 1;
display: flex;
text-align: center;
justify-content:center;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

ion-button {
text-transform: none !important;
}
Expand Down
17 changes: 14 additions & 3 deletions src/app/pages/credentials/credentials.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ export class CredentialsPage implements OnInit {
private route = inject(ActivatedRoute);
private destroyRef = inject(DestroyRef);


public constructor(
private alertController: AlertController,
public translate: TranslateService,
Expand Down Expand Up @@ -146,8 +145,20 @@ export class CredentialsPage implements OnInit {
public refresh() {
this.walletService
.getAllVCs()
.subscribe((credentialListResponse: VerifiableCredential[]) => {
this.credList = credentialListResponse.slice().reverse();
.subscribe({
next: (credentialListResponse: VerifiableCredential[]) => {
this.credList = [...credentialListResponse.slice().reverse()];
this.cdr.detectChanges(); // Ensure Angular updates the view
},
// TODO: migrate to unified errorHandler interceptor
error: (error) => {
if (error.status === 404) {
this.credList = []; // Set the list to empty if no credentials are found
this.cdr.detectChanges(); // Ensure view updates with empty list
} else {
console.error("Error fetching credentials:", error);
}
}
});
}

Expand Down
10 changes: 4 additions & 6 deletions src/app/pages/settings/settings.page.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<ion-content [fullscreen]="true" class="background-content">
<b class="pages_titles">
{{"settings.title"|translate}}
</b>
<ion-list class="settings-list">
<div class="settings-box">
<ion-list class="settings-list">
<ion-item [routerLink]="['/tabs/camera-selector']">
<ion-icon color="grey" name="camera" class="settings-icon"></ion-icon><ion-text>{{"camera-selector.title"|translate}}</ion-text>
</ion-item>
Expand All @@ -15,8 +13,8 @@
</ion-item>
<ion-button (keydown.enter)="sendCameraLogs()" (keydown.space)="sendCameraLogs()" (click)="sendCameraLogs()">{{"logs-selector.send"|translate}}</ion-button>
}
</ion-list>

</ion-list>
</div>

<ion-alert [isOpen]="isAlertOpen" class="custom-alert" (didDismiss)="toggleAlert()" [header]="'home.unsucces' | translate" [message]="'home.error-ebsi' | translate"></ion-alert>

Expand Down
33 changes: 29 additions & 4 deletions src/app/pages/settings/settings.page.scss
Original file line number Diff line number Diff line change
@@ -1,13 +1,38 @@
.settings-list {
margin: 20px;
--ion-item-background: white;
.settings-box {
white-space: pre-line;
color: grey;
width: 70%;
margin: 60px 15%;
border-radius: 5px;
background-color: #f2f4f8;
position: relative;
font-family:'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
flex-grow: 1;
display: flex;
text-align: center;
justify-content:center;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.settings-list {
width: 97%;
--ion-item-background: #f2f4f8;
--ion-item-color: grey;
--ion-item-border-width: 0px;
}

.settings-icon {
margin-right: 1rem;
}

ion-item {
--border-width: 0px;
--inner-border-width: 0px;
--border-color: transparent;
border: none;
box-shadow: none;
}

ion-button{
margin-left:16px;
}
}
2 changes: 1 addition & 1 deletion src/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"credentials":{
"title":"Credentials",
"add":"Add",
"nocred":"No credential loaded",
"nocred":"You have no saved credentials.\nAdd one to start using the Wallet.",
"expiration":"Expired",
"expiredCredential":"Credential expired",
"expiredText":"This credential has expired and you can no longer use it.",
Expand Down

0 comments on commit 9687558

Please sign in to comment.