Skip to content
This repository was archived by the owner on Mar 8, 2024. It is now read-only.

Commit db2d947

Browse files
JWittmeyerFelixKirschKernFelixKirschlumburovskalina
authored
Demo changes (#42)
* Checks for demo flag for local org creation * Adds timeout for databrowser alert * Adds chrome check * Adds star button with call to action * Fixes no label AND filter bug * increases version to v1.1.1 * Fix typo in browser check * Removed console log Co-authored-by: felix0496 <felix.kirsch@kern.ai> Co-authored-by: Felix Kirsch <40427105+FelixKirsch@users.noreply.github.com> Co-authored-by: Lina <lina.lumburovska@kern.ai>
1 parent 6a0aed4 commit db2d947

File tree

7 files changed

+89
-25
lines changed

7 files changed

+89
-25
lines changed

src/app/app.component.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ export class AppComponent implements OnDestroy, OnInit {
4545
});
4646
this.initializeNotificationService();
4747
this.initWithConfigManager();
48+
this.checkBrowser();
4849
}
4950

5051
initalRequests() {
@@ -175,4 +176,18 @@ export class AppComponent implements OnDestroy, OnInit {
175176
ConfigManager.refreshConfig();
176177
}
177178
}
179+
180+
checkBrowser() {
181+
const wasChecked = localStorage.getItem("browser_info_checked");
182+
if (!wasChecked) {
183+
const agent = window.navigator.userAgent;
184+
if (!(agent.indexOf("Chrome/") != -1 && agent.indexOf("Chromium/") == -1) || agent.indexOf("Edg/") != -1) {
185+
const t = "This application was built with chrome. Some things might look different than expected.\n\nFor the best experience we recommend using chrome."
186+
alert(t);
187+
}
188+
localStorage.setItem("browser_info_checked", "1");
189+
}
190+
}
191+
192+
178193
}

src/app/base/components/header/header.component.html

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -83,27 +83,24 @@
8383
<a [routerLink]="['/notification-center']" class="flex mr-6 tooltip tooltip-left"
8484
data-tip="Notification center">
8585
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-bell" width="24"
86-
height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none"
87-
stroke-linecap="round" stroke-linejoin="round">
88-
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
89-
<path d="M10 5a2 2 0 0 1 4 0a7 7 0 0 1 4 6v3a4 4 0 0 0 2 3h-16a4 4 0 0 0 2 -3v-3a7 7 0 0 1 4 -6"></path>
90-
<path d="M9 17v1a3 3 0 0 0 6 0v-1"></path>
91-
</svg>
92-
</a>
93-
</div>
94-
<div class="flex items-center justify-center">
95-
<a href="https://github.com/code-kern-ai/refinery" target="_blank" data-tip="Star us on GitHub"
96-
rel="noopener noreferrer" class="flex mr-6 tooltip tooltip-left">
97-
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-star" width="24"
9886
height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none"
9987
stroke-linecap="round" stroke-linejoin="round">
10088
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
10189
<path
102-
d="M12 17.75l-6.172 3.245l1.179 -6.873l-5 -4.867l6.9 -1l3.086 -6.253l3.086 6.253l6.9 1l-5 4.867l1.179 6.873z">
90+
d="M10 5a2 2 0 0 1 4 0a7 7 0 0 1 4 6v3a4 4 0 0 0 2 3h-16a4 4 0 0 0 2 -3v-3a7 7 0 0 1 4 -6">
10391
</path>
92+
<path d="M9 17v1a3 3 0 0 0 6 0v-1"></path>
10493
</svg>
10594
</a>
106-
95+
</div>
96+
<div class="flex items-center justify-center">
97+
<div class="widget widget-lg"><a class="btnx" href="https://github.com/code-kern-ai/refinery"
98+
rel="noopener" target="_blank" aria-label="Star code-kern-ai/refinery on GitHub"><svg
99+
viewBox="0 0 16 16" width="16" height="16" class="octicon octicon-star" aria-hidden="true">
100+
<path fill-rule="evenodd"
101+
d="M8 .25a.75.75 0 01.673.418l1.882 3.815 4.21.612a.75.75 0 01.416 1.279l-3.046 2.97.719 4.192a.75.75 0 01-1.088.791L8 12.347l-3.766 1.98a.75.75 0 01-1.088-.79l.72-4.194L.818 6.374a.75.75 0 01.416-1.28l4.21-.611L7.327.668A.75.75 0 018 .25zm0 2.445L6.615 5.5a.75.75 0 01-.564.41l-3.097.45 2.24 2.184a.75.75 0 01.216.664l-.528 3.084 2.769-1.456a.75.75 0 01.698 0l2.77 1.456-.53-3.084a.75.75 0 01.216-.664l2.24-2.183-3.096-.45a.75.75 0 01-.564-.41L8 2.694v.001z">
102+
</path>
103+
</svg>&nbsp;<span>Star on GitHub</span></a></div>
107104
</div>
108105
<div class="flex justify-center overflow-visible" *ngIf="!hideLogout">
109106
<div *ngIf="user" class=" mr-4">
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
.widget-lg .btnx,
2+
.widget-lg .social-count {
3+
padding: 5px 10px;
4+
font-size: 12px;
5+
line-height: 16px;
6+
}
7+
8+
.btnx:not(:last-child) {
9+
border-radius: 0.25em 0 0 0.25em;
10+
}
11+
12+
.btnx {
13+
color: #24292f;
14+
background-color: #ebf0f4;
15+
border-color: #ccd1d5;
16+
border-color: rgba(27, 31, 36, .15);
17+
background-image: -moz-linear-gradient(top, #f6f8fa, #ebf0f4 90%);
18+
background-image: linear-gradient(180deg, #f6f8fa, #ebf0f4 90%);
19+
filter: progid:DXImageTransform.Microsoft.Gradient(startColorstr='#FFF6F8FA', endColorstr='#FFEAEFF3');
20+
}
21+
22+
.btnx {
23+
border-radius: 0.25em;
24+
}
25+
26+
.btnx,
27+
.social-count {
28+
position: relative;
29+
display: inline-flex;
30+
padding: 2px 5px;
31+
font-size: 11px;
32+
font-weight: 600;
33+
line-height: 14px;
34+
vertical-align: bottom;
35+
cursor: pointer;
36+
-webkit-user-select: none;
37+
-moz-user-select: none;
38+
-ms-user-select: none;
39+
user-select: none;
40+
background-repeat: repeat-x;
41+
background-position: -1px -1px;
42+
background-size: 110% 110%;
43+
border: 1px solid;
44+
margin-right: 1rem;
45+
}

src/app/base/components/sidebar-pm/sidebar-pm.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@
194194
<div class="flex-shrink-0 flex py-6 justify-center">
195195
<a data-tip="Changelog" target="_blank" rel="noopener noreferrer"
196196
class="z-50 tooltip tooltip-right cursor-pointer select-none text-white"
197-
href="https://docs.kern.ai/changelog">v1.1</a>
197+
href="https://docs.kern.ai/changelog">v1.1.1</a>
198198
</div>
199199
</div>
200200
</div>

src/app/data/components/data-browser/data-browser.component.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,8 @@ export class DataBrowserComponent implements OnInit, OnDestroy {
182182

183183
currentSearchRequest: CurrentSearchRequest;
184184

185+
alertLastVisible: number;
186+
185187
getSearchFormArray(groupKey: string): FormArray {
186188
return this.fullSearch.get(groupKey).get('groupElements') as FormArray;
187189
}
@@ -1440,7 +1442,7 @@ export class DataBrowserComponent implements OnInit, OnDestroy {
14401442
}
14411443
else return;
14421444
if (this.filteredSliceIds.has(idToDelete)) this.filteredSliceIds.delete(idToDelete);
1443-
this.projectApolloService.deleteDataSlice(this.projectId, idToDelete).pipe(first()).subscribe(() => this.clearFilters());
1445+
this.projectApolloService.deleteDataSlice(this.projectId, idToDelete).pipe(first()).subscribe(() => this.clearFilters());
14441446
}
14451447

14461448
filterAvailableSlices() {
@@ -1909,7 +1911,9 @@ export class DataBrowserComponent implements OnInit, OnDestroy {
19091911
}
19101912

19111913
alterUser(msgId) {
1914+
if (this.alertLastVisible && Date.now() - this.alertLastVisible < 1000) return;
19121915
alert("Settings were changed (msgId: " + msgId + ")\nFilter will be reloaded.");
1916+
this.alertLastVisible = Date.now();
19131917
}
19141918

19151919
websocketFilterRefresh(currentFilterData: string) {

src/app/data/components/data-browser/helper-classes/filter-parser.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ export class DataBrowserFilterParser {
8989
array: any[],
9090
drillDown: boolean = false
9191
): any {
92-
9392
if (drillDown) {
9493
for (const l of array) {
9594
this.appendBlackAndWhiteListUserForArray(appendTo, [l], false);
@@ -208,12 +207,16 @@ export class DataBrowserFilterParser {
208207
appendTo: string[],
209208
array: any[],
210209
labelSource: LabelSource,
211-
drillDown: boolean = false
210+
drillDown: boolean = false,
211+
onlyNoLabel: boolean = false //for recursion of NO_LABEL only
212212
): any {
213-
214213
if (drillDown) {
215214
for (const l of array) {
216-
this.appendBlackAndWhiteListLabelingTaskForArray(appendTo, [l], labelSource, false);
215+
if (l.id == 'NO_LABEL') {
216+
this.appendBlackAndWhiteListLabelingTaskForArray(appendTo, array, labelSource, false, true);
217+
} else {
218+
this.appendBlackAndWhiteListLabelingTaskForArray(appendTo, [l], labelSource, false);
219+
}
217220
}
218221
return;
219222
}
@@ -233,7 +236,7 @@ export class DataBrowserFilterParser {
233236
for (let c of array) {
234237
if (c.active) {
235238
if (c.id == 'NO_LABEL') addNoLabel = true;
236-
else {
239+
else if (!onlyNoLabel) {
237240
if (c.negate) notInValues.push(c.id);
238241
else inValues.push(c.id);
239242
}

src/app/projects/components/projects/projects.component.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ export class ProjectsComponent implements OnInit, OnDestroy {
128128
this.isManaged = ConfigManager.getIsManaged();
129129
}
130130
});
131-
this.checkIfDemoUser();
131+
this.checkIfDemoUser();
132132
}
133133

134134
checkIfDemoUser() {
@@ -145,7 +145,7 @@ export class ProjectsComponent implements OnInit, OnDestroy {
145145
return;
146146
}
147147
this.isManaged = ConfigManager.getIsManaged();
148-
if (!this.isManaged) {
148+
if (!this.isManaged && !ConfigManager.getIsDemo()) {
149149
this.subscriptions$.push(this.organizationApolloService.canCreateLocalOrg().pipe(first()).subscribe((canCreateOrg) => {
150150
this.canCreateOrg = canCreateOrg;
151151

@@ -342,10 +342,10 @@ export class ProjectsComponent implements OnInit, OnDestroy {
342342
}
343343

344344
executeOption(value: string) {
345-
if(value=='Further sample projects') {
345+
if (value == 'Further sample projects') {
346346
window.open("https://github.com/code-kern-ai/refinery-sample-projects", "_blank");
347347
} else {
348-
this.importSampleProject(this.isProjectInitial ? this.previousValue+' - initial' : value)
348+
this.importSampleProject(this.isProjectInitial ? this.previousValue + ' - initial' : value)
349349
}
350350
}
351351

0 commit comments

Comments
 (0)