mirror of
https://github.com/portainer/portainer.git
synced 2025-08-08 23:35:31 +02:00
fix(image): Add hide default registry teaser for CE version [EE-4038] (#7533)
* fix(image): Add hide default registry teaser for CE version [EE-4038]. * fix(image): Hide advanced mode only if there is no docker hub registries [EE-3734] * sync with EE
This commit is contained in:
parent
234627f278
commit
c6ab5d5717
12 changed files with 168 additions and 5 deletions
|
@ -77,10 +77,12 @@
|
|||
<input id="select_{{ $index }}" type="checkbox" disabled />
|
||||
<label for="select_{{ $index }}"></label>
|
||||
</span>
|
||||
<span>DockerHub (anonymous)</span>
|
||||
<span><default-registry-name></default-registry-name></span>
|
||||
</td>
|
||||
<td> <default-registry-domain></default-registry-domain> </td>
|
||||
<td>
|
||||
<default-registry-action ng-if="$ctrl.isAdmin && !$ctrl.endpointType"></default-registry-action>
|
||||
</td>
|
||||
<td> docker.io </td>
|
||||
<td> - </td>
|
||||
</tr>
|
||||
<tr
|
||||
dir-paginate="item in ($ctrl.state.filteredDataSet = ($ctrl.dataset | filter:$ctrl.state.textFilter | orderBy:$ctrl.state.orderBy:$ctrl.state.reverseOrder | itemsPerPage: $ctrl.state.paginatedItemLimit))"
|
||||
|
|
|
@ -30,4 +30,5 @@ export enum FeatureId {
|
|||
STACK_WEBHOOK = 'stack-webhook',
|
||||
CONTAINER_WEBHOOK = 'container-webhook',
|
||||
POD_SECURITY_POLICY_CONSTRAINT = 'pod-security-policy-constraint',
|
||||
HIDE_DOCKER_HUB_ANONYMOUS = 'hide-docker-hub-anonymous',
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@ export async function init(edition: Edition) {
|
|||
[FeatureId.STACK_WEBHOOK]: Edition.BE,
|
||||
[FeatureId.CONTAINER_WEBHOOK]: Edition.BE,
|
||||
[FeatureId.POD_SECURITY_POLICY_CONSTRAINT]: Edition.BE,
|
||||
[FeatureId.HIDE_DOCKER_HUB_ANONYMOUS]: Edition.BE,
|
||||
};
|
||||
|
||||
state.currentEdition = currentEdition;
|
||||
|
|
|
@ -36,6 +36,7 @@ export function PublicSettingsViewModel(settings) {
|
|||
this.KubeconfigExpiry = settings.KubeconfigExpiry;
|
||||
this.Features = settings.Features;
|
||||
this.Edge = new EdgeSettingsViewModel(settings.Edge);
|
||||
this.DefaultRegistry = settings.DefaultRegistry;
|
||||
}
|
||||
|
||||
export function InternalAuthSettingsViewModel(data) {
|
||||
|
|
|
@ -2,11 +2,19 @@ import angular from 'angular';
|
|||
|
||||
import { r2a } from '@/react-tools/react2angular';
|
||||
import { CreateAccessToken } from '@/react/portainer/account/CreateAccessTokenView';
|
||||
import {
|
||||
DefaultRegistryAction,
|
||||
DefaultRegistryDomain,
|
||||
DefaultRegistryName,
|
||||
} from '@/react/portainer/registries/ListView/DefaultRegistry';
|
||||
|
||||
import { wizardModule } from './wizard';
|
||||
|
||||
export const viewsModule = angular
|
||||
.module('portainer.app.react.views', [wizardModule])
|
||||
.component('defaultRegistryName', r2a(DefaultRegistryName, []))
|
||||
.component('defaultRegistryAction', r2a(DefaultRegistryAction, []))
|
||||
.component('defaultRegistryDomain', r2a(DefaultRegistryDomain, []))
|
||||
.component(
|
||||
'createAccessToken',
|
||||
r2a(CreateAccessToken, ['onSubmit', 'onError'])
|
||||
|
|
|
@ -12,8 +12,9 @@ import {
|
|||
getSettings,
|
||||
updateSettings,
|
||||
getPublicSettings,
|
||||
updateDefaultRegistry,
|
||||
} from './settings.service';
|
||||
import { Settings } from './types';
|
||||
import { DefaultRegistry, Settings } from './types';
|
||||
|
||||
export function usePublicSettings<T = PublicSettingsViewModel>({
|
||||
enabled,
|
||||
|
@ -51,3 +52,15 @@ export function useUpdateSettingsMutation() {
|
|||
)
|
||||
);
|
||||
}
|
||||
|
||||
export function useUpdateDefaultRegistrySettingsMutation() {
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
return useMutation(
|
||||
(payload: Partial<DefaultRegistry>) => updateDefaultRegistry(payload),
|
||||
mutationOptions(
|
||||
withInvalidate(queryClient, [['settings']]),
|
||||
withError('Unable to update default registry settings')
|
||||
)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ import { PublicSettingsViewModel } from '@/portainer/models/settings';
|
|||
|
||||
import axios, { parseAxiosError } from '../services/axios';
|
||||
|
||||
import { PublicSettingsResponse, Settings } from './types';
|
||||
import { DefaultRegistry, PublicSettingsResponse, Settings } from './types';
|
||||
|
||||
export async function getPublicSettings() {
|
||||
try {
|
||||
|
@ -38,6 +38,19 @@ export async function updateSettings(settings: Partial<Settings>) {
|
|||
}
|
||||
}
|
||||
|
||||
export async function updateDefaultRegistry(
|
||||
defaultRegistry: Partial<DefaultRegistry>
|
||||
) {
|
||||
try {
|
||||
await axios.put(buildUrl('default_registry'), defaultRegistry);
|
||||
} catch (e) {
|
||||
throw parseAxiosError(
|
||||
e as Error,
|
||||
'Unable to update default registry settings'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function buildUrl(subResource?: string, action?: string) {
|
||||
let url = 'settings';
|
||||
if (subResource) {
|
||||
|
|
|
@ -89,6 +89,10 @@ enum AuthenticationMethod {
|
|||
|
||||
type Feature = string;
|
||||
|
||||
export interface DefaultRegistry {
|
||||
Hide: boolean;
|
||||
}
|
||||
|
||||
export interface Settings {
|
||||
LogoURL: string;
|
||||
BlackListedLabels: Pair[];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue