Skip to content

Commit 104e3b4

Browse files
committed
Merge branch 'vnext' of https://github.com/IgniteUI/grid-demos into mtihova/grid-demos-restructuing
2 parents ec7879b + 67bb2de commit 104e3b4

2 files changed

Lines changed: 59 additions & 51 deletions

File tree

azure-pipelines/igniteui-angular-grid-examples.yml

Lines changed: 40 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -43,41 +43,46 @@ stages:
4343
inputs:
4444
targetType: 'inline'
4545
script: |
46-
# Define the root path where projects are located
47-
rootPath="$(Build.SourcesDirectory)/projects"
48-
49-
# Get all first-level subdirectories in the specified root path
50-
subdirectories=$(find "$rootPath" -mindepth 1 -maxdepth 1 -type d)
51-
52-
for subdirectory in $subdirectories; do
53-
# Extract the directory name from the path
54-
dirName=$(basename "$subdirectory")
55-
56-
# Give each sample a version in its package.json file - for traceability
57-
cd "$subdirectory"
58-
echo "Calling npm version command"
59-
npm version $(Build.BuildNumber) --no-git-tag-version
60-
61-
# Check if the directory name is already camel-case
62-
if [[ "$dirName" =~ ^[A-Z]+[a-z]+([A-Z][a-z]*)*$ ]]; then
63-
# If already camel-case, print it as is
64-
echo "$dirName"
65-
else
66-
# Convert to camel-case (capitalize first letters and remove hyphens)
67-
dirName=$(echo "$dirName" | sed -E 's/(^|-)([a-z])/\U\2/g')
68-
69-
fi
70-
71-
echo "Processing directory: $dirName"
72-
73-
# Define the name for the zip file
74-
zipName="$(Build.ArtifactStagingDirectory)/IgniteUI_Angular_ApplicationSample_${dirName}_Source.zip"
75-
echo "Creating ZIP: $zipName"
76-
77-
# Compress the directory into a ZIP file
78-
(cd "$subdirectory" && zip -r "$zipName" .)
79-
done
80-
46+
create_zips() {
47+
local rootPath="$1"
48+
if [ -d "$rootPath" ]; then
49+
# Get all first-level subdirectories in the specified root path
50+
subdirectories=$(find "$rootPath" -mindepth 1 -maxdepth 1 -type d)
51+
for subdirectory in $subdirectories; do
52+
# Extract the directory name from the path
53+
dirName=$(basename "$subdirectory")
54+
55+
# Give each sample a version in its package.json file - for traceability
56+
cd "$subdirectory"
57+
echo "Setting project version in package.json to $(Build.BuildNumber) for $dirName"
58+
npm version $(Build.BuildNumber) --no-git-tag-version
59+
60+
# Check if the directory name is already camel-case
61+
if [[ "$dirName" =~ ^[A-Z]+[a-z]+([A-Z][a-z]*)*$ ]]; then
62+
# If already camel-case, print it as is
63+
echo "$dirName"
64+
else
65+
# Convert to camel-case (capitalize first letters and remove hyphens)
66+
dirName=$(echo "$dirName" | sed -E 's/(^|-)([a-z])/\U\2/g')
67+
fi
68+
69+
echo "Processing directory: $dirName"
70+
# Define the name for the zip file
71+
zipName="$(Build.ArtifactStagingDirectory)/IgniteUI_Angular_ApplicationSample_${dirName}_Source.zip"
72+
echo "Creating ZIP: $zipName"
73+
74+
# Compress the directory into a ZIP file
75+
(cd "$subdirectory" && zip -r "$zipName" .)
76+
done
77+
fi
78+
}
79+
80+
# Pass 1: All first-level directories in projects/
81+
create_zips "$(Build.SourcesDirectory)/projects"
82+
83+
# Pass 2: All first-level directories in projects/charts/
84+
create_zips "$(Build.SourcesDirectory)/projects/charts"
85+
8186
echo "All sample projects have been compressed and saved to the artifacts directory."
8287
8388
- task: PublishPipelineArtifact@1

projects/grids/hr-portal/src/app/hr-portal/hr-portal.component.ts

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component, OnInit, ViewChild } from '@angular/core';
1+
import { Component, inject, OnInit, PLATFORM_ID, ViewChild } from '@angular/core';
22
import {
33
IgxTreeGridComponent,
44
IgxColumnComponent,
@@ -20,7 +20,7 @@ import {
2020
THEME_TOKEN,
2121
ThemeToken,
2222
} from 'igniteui-angular';
23-
import { CommonModule } from '@angular/common';
23+
import { CommonModule, isPlatformBrowser } from '@angular/common';
2424
import { BehaviorSubject } from 'rxjs';
2525
import { DataService } from '../services/data.service';
2626
@Component({
@@ -61,6 +61,7 @@ export class HrPortalComponent implements OnInit {
6161
public isLoading = true;
6262
@ViewChild('treeGrid', { read: IgxTreeGridComponent, static: true })
6363
public treeGrid!: IgxTreeGridComponent;
64+
private platformId = inject(PLATFORM_ID);
6465

6566
constructor(private iconService: IgxIconService, private dataService: DataService) {}
6667

@@ -75,63 +76,65 @@ export class HrPortalComponent implements OnInit {
7576
const icons = [
7677
{
7778
name: 'linkedIn',
78-
path: '/images/others/linkedin.svg',
79+
path: 'images/others/linkedin.svg',
7980
category: 'hr-icons',
8081
},
8182
{
8283
name: 'USA',
83-
path: '/images/countries/United States.svg',
84+
path: 'images/countries/United States.svg',
8485
category: 'country-icons',
8586
},
8687
{
8788
name: 'CAN',
88-
path: '/images/countries/Canada.svg',
89+
path: 'images/countries/Canada.svg',
8990
category: 'country-icons',
9091
},
9192
{
9293
name: 'GBR',
93-
path: '/images/countries/United Kingdom.svg',
94+
path: 'images/countries/United Kingdom.svg',
9495
category: 'country-icons',
9596
},
9697
{
9798
name: 'DEU',
98-
path: '/images/countries/Germany.svg',
99+
path: 'images/countries/Germany.svg',
99100
category: 'country-icons',
100101
},
101102
{
102103
name: 'FRA',
103-
path: '/images/countries/France.svg',
104+
path: 'images/countries/France.svg',
104105
category: 'country-icons',
105106
},
106107
{
107108
name: 'ESP',
108-
path: '/images/countries/Spain.svg',
109+
path: 'images/countries/Spain.svg',
109110
category: 'country-icons',
110111
},
111112
{
112113
name: 'ITA',
113-
path: '/images/countries/Italy.svg',
114+
path: 'images/countries/Italy.svg',
114115
category: 'country-icons',
115116
},
116117
{
117118
name: 'AUS',
118-
path: '/images/countries/Australia.svg',
119+
path: 'images/countries/Australia.svg',
119120
category: 'country-icons',
120121
},
121122
{
122123
name: 'JPN',
123-
path: '/images/countries/Japan.svg',
124+
path: 'images/countries/Japan.svg',
124125
category: 'country-icons',
125126
},
126127
{
127128
name: 'ARE',
128-
path: '/images/countries/uae.svg',
129+
path: 'images/countries/uae.svg',
129130
category: 'country-icons',
130131
},
131132
];
132133

133-
icons.forEach((icon) => {
134-
this.iconService.addSvgIcon(icon.name, icon.path, icon.category);
135-
});
134+
if (isPlatformBrowser(this.platformId)) {
135+
icons.forEach((icon) => {
136+
this.iconService.addSvgIcon(icon.name, icon.path, icon.category);
137+
});
138+
}
136139
}
137140
}

0 commit comments

Comments
 (0)