Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -211,10 +211,9 @@ <h3 class="modal-title">{{ 'PROJECT.NEW_PROJECT' | translate }}</h3>
<div class="clr-control-container">
<div class="clr-input-wrapper">
<div class="clr-input-group">
<label
class="clr-control-label endpoint required"
>{{ 'PROJECT.ENDPOINT' | translate }}</label
>
<label class="clr-control-label endpoint required">{{
'PROJECT.ENDPOINT' | translate
}}</label>
<input
placeholder="http(s)://192.168.1.1"
[value]="getEndpoint()"
Expand Down Expand Up @@ -338,6 +337,60 @@ <h3 class="modal-title">{{ 'PROJECT.NEW_PROJECT' | translate }}</h3>
}
</div>
</div>
<div
class="clr-form-control mt-05"
[style.visibility]="
isSystemAdmin && enableProxyCache ? 'visible' : 'hidden'
">
<label for="repositoryFilter" class="clr-control-label">
{{ 'PROJECT.REPOSITORY_FILTER' | translate }}
<clr-tooltip>
<clr-icon
clrTooltipTrigger
shape="info-circle"
size="24"></clr-icon>
<clr-tooltip-content
clrPosition="bottom-left"
clrSize="lg"
*clrIfOpen>
<span>{{
'PROJECT.REPOSITORY_FILTER_TOOLTIP' | translate
}}</span>
</clr-tooltip-content>
</clr-tooltip>
</label>
<div class="clr-control-container">
<input
type="text"
id="repositoryFilter"
[(ngModel)]="
project.metadata.proxy_cache_filter_pattern
"
name="repositoryFilter"
class="clr-input width-164 mr-10"
placeholder="{{
'PROJECT.REPOSITORY_FILTER_PLACEHOLDER' | translate
}}"
autocomplete="off" />
<div class="clr-select-wrapper">
<select
id="repositoryFilterKind"
name="repositoryFilterKind"
[(ngModel)]="
project.metadata.proxy_cache_filter_kind
">
<option value="doublestar">
{{
'PROJECT.FILTER_KIND_DOUBLESTAR' | translate
}}
</option>
<option value="regex">
{{ 'PROJECT.FILTER_KIND_REGEX' | translate }}
</option>
</select>
</div>
</div>
</div>
<clr-checkbox-container
[style.visibility]="
isSystemAdmin && enableProxyCache ? 'visible' : 'hidden'
Expand Down Expand Up @@ -371,37 +424,37 @@ <h3 class="modal-title">{{ 'PROJECT.NEW_PROJECT' | translate }}</h3>
name="proxy_cache_local_on_not_found" />
</clr-checkbox-wrapper>
</clr-checkbox-container>
<div
class="clr-checkbox-container mt-05"
<clr-checkbox-container
class="mt-05"
[style.visibility]="
isSystemAdmin && enableProxyCache ? 'visible' : 'hidden'
">
<label class="clr-control-label" for="proxy-referrer-api">
{{ 'PROJECT.PROXY_REFERRER_API_LABEL' | translate }}
<clr-tooltip>
<clr-icon
clrTooltipTrigger
shape="info-circle"
size="24"></clr-icon>
<clr-tooltip-content
clrPosition="top-right"
clrSize="lg"
*clrIfOpen>
<span>{{
'PROJECT.PROXY_REFERRER_API_TIP' | translate
}}</span>
</clr-tooltip-content>
</clr-tooltip>
</label>
<clr-checkbox-wrapper>
<input
id="proxy-referrer-api"
type="checkbox"
clrCheckbox
[(ngModel)]="project.metadata.proxy_referrer_api"
name="proxy-referrer-api" />
<label for="proxy-referrer-api">
{{ 'PROJECT.PROXY_REFERRER_API_LABEL' | translate }}
<clr-tooltip>
<clr-icon
clrTooltipTrigger
shape="info-circle"
size="24"></clr-icon>
<clr-tooltip-content
clrPosition="top-right"
clrSize="lg"
*clrIfOpen>
<span>{{
'PROJECT.PROXY_REFERRER_API_TIP' | translate
}}</span>
</clr-tooltip-content>
</clr-tooltip>
</label>
</clr-checkbox-wrapper>
</div>
</clr-checkbox-container>
</form>
</div>
<div class="modal-footer">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ import { NgForm, Validators } from '@angular/forms';
import { forkJoin, fromEvent, Observable, Subscription } from 'rxjs';
import { TranslateService } from '@ngx-translate/core';
import { MessageHandlerService } from '../../../../shared/services/message-handler.service';
import { Project } from '../../../project/project';
import {
Project,
REPOSITORY_FILTER_KIND_DOUBLESTAR,
} from '../../../project/project';
import {
QuotaUnits,
QuotaUnlimited,
Expand Down Expand Up @@ -386,25 +389,35 @@ export class CreateProjectComponent
const registryId: number = this.enableProxyCache
? +this.project.registry_id
: null;
const metadata: Record<string, string> = {
public: this.project.metadata.public ? 'true' : 'false',
proxy_speed_kb: this.project.metadata.bandwidth.toString(),
max_upstream_conn:
this.project.metadata.max_upstream_conn.toString(),
proxy_cache_local_on_not_found: this.project.metadata
.proxy_cache_local_on_not_found
? 'true'
: 'false',
proxy_referrer_api: this.project.metadata
.proxy_referrer_api
? 'true'
: 'false',
};
if (
this.enableProxyCache &&
this.project.metadata.proxy_cache_filter_pattern
) {
metadata.proxy_cache_filter_pattern =
this.project.metadata.proxy_cache_filter_pattern;
metadata.proxy_cache_filter_kind =
this.project.metadata.proxy_cache_filter_kind ||
REPOSITORY_FILTER_KIND_DOUBLESTAR;
Comment on lines +410 to +414
}
this.projectService
.createProject({
project: {
project_name: this.project.name,
metadata: {
public: this.project.metadata.public ? 'true' : 'false',
proxy_speed_kb:
this.project.metadata.bandwidth.toString(),
max_upstream_conn:
this.project.metadata.max_upstream_conn.toString(),
proxy_cache_local_on_not_found: this.project.metadata
.proxy_cache_local_on_not_found
? 'true'
: 'false',
proxy_referrer_api: this.project.metadata
.proxy_referrer_api
? 'true'
: 'false',
},
metadata,
storage_limit: +storageByte,
registry_id: registryId,
},
Expand Down Expand Up @@ -451,6 +464,9 @@ export class CreateProjectComponent
this.project.metadata.max_upstream_conn = -1;
this.project.metadata.proxy_cache_local_on_not_found = false;
this.project.metadata.proxy_referrer_api = false;
this.project.metadata.proxy_cache_filter_pattern = '';
this.project.metadata.proxy_cache_filter_kind =
REPOSITORY_FILTER_KIND_DOUBLESTAR;
}

public get isValid(): boolean {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
{{ 'PROJECT_CONFIG.PUBLIC_POLICY' | translate }}
</clr-control-helper>
</clr-checkbox-container>
@if (hasChangeConfigRole) {
@if (isSystemAdmin) {
<clr-checkbox-container clrInline>
<label class="label-color-input">
{{ 'PROJECT.PROXY_CACHE' | translate }}
Expand All @@ -25,16 +25,16 @@
<input
type="checkbox"
clrCheckbox
disabled
[disabled]="!allowUpdateProxyCacheConfiguration"
[(ngModel)]="projectPolicy.ProxyCacheEnabled"
name="project-proxy-cache-enabled" />
</clr-checkbox-wrapper>
<clr-control-helper class="config-subtext">
{{ 'PROJECT.PROXY_CACHE_TOOLTIP' | translate }}
</clr-control-helper>
</clr-checkbox-container>
} @if (hasChangeConfigRole && projectPolicy.ProxyCacheEnabled) {
<div class="clr-form-control mt-0 mb-2">
} @if (isSystemAdmin && projectPolicy.ProxyCacheEnabled) {
<div class="clr-form-control mt-0">
<label class="clr-control-label"></label>
<div class="clr-select-wrapper row-inline">
<label class="clr-control-label">
Expand Down Expand Up @@ -122,33 +122,77 @@
}
</div>
</div>
<div class="row-inline ml-2" clrInline>
<clr-checkbox-wrapper class="ml-1">
</div>
} @if (isSystemAdmin && projectPolicy.ProxyCacheEnabled) {
<div class="clr-form-control">
<label class="clr-control-label"></label>
<div class="row-inline">
<label class="clr-control-label">
{{ 'PROJECT.REPOSITORY_FILTER' | translate }}
<clr-tooltip>
<clr-icon
clrTooltipTrigger
shape="info-circle"
size="24"></clr-icon>
<clr-tooltip-content
clrPosition="bottom-left"
clrSize="lg"
*clrIfOpen>
<span>{{
'PROJECT.REPOSITORY_FILTER_TOOLTIP' | translate
}}</span>
</clr-tooltip-content>
</clr-tooltip>
</label>
<div class="clr-control-container ml-1">
<input
id="proxy_referrer_api"
type="checkbox"
clrCheckbox
[(ngModel)]="projectPolicy.ProxyReferrerAPI"
name="proxy_referrer_api"
[disabled]="!allowUpdateProxyCacheConfiguration" />
<label for="proxy_referrer_api">
{{ 'PROJECT.PROXY_REFERRER_API_LABEL' | translate }}
<clr-tooltip>
<clr-icon
clrTooltipTrigger
shape="info-circle"
size="24"></clr-icon>
<clr-tooltip-content
clrPosition="top-left"
clrSize="lg"
*clrIfOpen>
<span>{{
'PROJECT.PROXY_REFERRER_API_TIP' | translate
}}</span>
</clr-tooltip-content>
</clr-tooltip>
</label>
</clr-checkbox-wrapper>
type="text"
id="repositoryFilter"
[(ngModel)]="projectPolicy.ProxyCacheFilterPattern"
name="repositoryFilter"
[disabled]="!hasChangeConfigRole"
class="clr-input width-164 mr-10 clr-input-underline"
placeholder="{{
'PROJECT.REPOSITORY_FILTER_PLACEHOLDER' | translate
}}"
autocomplete="off" />
<div class="clr-select-wrapper mr-10">
<select
id="repositoryFilterKind"
name="repositoryFilterKind"
[disabled]="!hasChangeConfigRole"
[(ngModel)]="projectPolicy.ProxyCacheFilterKind">
<option value="doublestar">
{{
'PROJECT.FILTER_KIND_DOUBLESTAR' | translate
}}
</option>
<option value="regex">
{{ 'PROJECT.FILTER_KIND_REGEX' | translate }}
</option>
</select>
</div>
</div>
</div>
</div>
} @else if (!isSystemAdmin && isProxyCacheProject &&
projectPolicy.ProxyCacheFilterPattern) {
<div class="clr-form-control">
<label class="clr-control-label"></label>
<div class="row-inline">
<label class="clr-control-label">
{{ 'PROJECT.REPOSITORY_FILTER' | translate }}
</label>
<div class="clr-control-container ml-1">
<input
type="text"
disabled
[value]="projectPolicy.ProxyCacheFilterPattern"
class="clr-input width-492 mr-10 clr-input-underline" />
<span class="label label-info ml-05">{{
projectPolicy.ProxyCacheFilterKind || 'doublestar'
}}</span>
</div>
</div>
</div>
} @if (isSystemAdmin && projectPolicy.ProxyCacheEnabled) {
Expand All @@ -172,6 +216,24 @@
}}
</clr-control-helper>
</clr-checkbox-container>
<clr-checkbox-container>
<label class="clr-control-label"></label>
<clr-checkbox-wrapper id="proxy-referrer-api">
<input
type="checkbox"
id="proxy-referrer-api-input"
clrCheckbox
[(ngModel)]="projectPolicy.ProxyReferrerAPI"
name="proxy-referrer-api"
[disabled]="!hasChangeConfigRole" />
<label for="proxy-referrer-api-input">
{{ 'PROJECT.PROXY_REFERRER_API_LABEL' | translate }}
</label>
</clr-checkbox-wrapper>
<clr-control-helper class="config-subtext">
{{ 'PROJECT.PROXY_REFERRER_API_TIP' | translate }}
</clr-control-helper>
</clr-checkbox-container>
} @if (!isProxyCacheProject) {
<clr-checkbox-container clrInline>
<label
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,11 @@
.row-inline label {
align-self: end;
}

.ml-05 {
margin-left: 0.5rem;
}

.width-492 {
width: 492px;
}
Loading
Loading