mirror of https://github.com/portainer/portainer
fix(docker): remove prepended slash by default on container names [EE-3592] (#8195)
* remove prepended slash by default if present * trimcontainername still neededpull/8477/head
parent
bfc610c192
commit
f9bbe000fb
|
@ -114,7 +114,7 @@ angular
|
|||
'use strict';
|
||||
return function (name) {
|
||||
if (name) {
|
||||
return name.indexOf('/') === 0 ? name.replace('/', '') : name;
|
||||
return name.indexOf('/') === 0 ? name.slice(1) : name;
|
||||
}
|
||||
return '';
|
||||
};
|
||||
|
@ -161,8 +161,7 @@ angular
|
|||
.filter('containername', function () {
|
||||
'use strict';
|
||||
return function (container) {
|
||||
var name = container.Names[0];
|
||||
return name.substring(1, name.length);
|
||||
return container.Names[0];
|
||||
};
|
||||
})
|
||||
.filter('swarmversion', function () {
|
||||
|
@ -174,7 +173,7 @@ angular
|
|||
.filter('swarmhostname', function () {
|
||||
'use strict';
|
||||
return function (container) {
|
||||
return _.split(container.Names[0], '/')[1];
|
||||
return container.Names[0];
|
||||
};
|
||||
})
|
||||
.filter('repotags', function () {
|
||||
|
|
|
@ -338,7 +338,7 @@ angular.module('portainer.docker').controller('CreateContainerController', [
|
|||
var container = $scope.formValues.NetworkContainer;
|
||||
var containerName = container;
|
||||
if (container && typeof container === 'object') {
|
||||
containerName = $filter('trimcontainername')(container.Names[0]);
|
||||
containerName = container.Names[0];
|
||||
}
|
||||
var networkMode = mode;
|
||||
if (containerName) {
|
||||
|
@ -987,7 +987,7 @@ angular.module('portainer.docker').controller('CreateContainerController', [
|
|||
if (!oldContainer) {
|
||||
return;
|
||||
}
|
||||
return ContainerService.renameContainer(oldContainer.Id, oldContainer.Names[0].substring(1));
|
||||
return ContainerService.renameContainer(oldContainer.Id, oldContainer.Names[0]);
|
||||
}
|
||||
|
||||
function confirmCreateContainer(container) {
|
||||
|
@ -1033,7 +1033,7 @@ angular.module('portainer.docker').controller('CreateContainerController', [
|
|||
}
|
||||
|
||||
function renameContainer() {
|
||||
return ContainerService.renameContainer(oldContainer.Id, oldContainer.Names[0].substring(1) + '-old');
|
||||
return ContainerService.renameContainer(oldContainer.Id, oldContainer.Names[0] + '-old');
|
||||
}
|
||||
|
||||
function pullImageIfNeeded() {
|
||||
|
|
|
@ -10,10 +10,7 @@ import { TableSettings } from '../types';
|
|||
|
||||
export const name: Column<DockerContainer> = {
|
||||
Header: 'Name',
|
||||
accessor: (row) => {
|
||||
const name = row.Names[0];
|
||||
return name.substring(1, name.length);
|
||||
},
|
||||
accessor: (row) => row.Names[0],
|
||||
id: 'name',
|
||||
Cell: NameCell,
|
||||
disableFilters: true,
|
||||
|
|
|
@ -37,9 +37,15 @@ export function parseViewModel(
|
|||
)
|
||||
);
|
||||
|
||||
const names = response.Names.map((n) => {
|
||||
const nameWithoutSlash = n[0] === '/' ? response.Names[0].slice(1) : n;
|
||||
return nameWithoutSlash;
|
||||
});
|
||||
|
||||
return {
|
||||
...response,
|
||||
ResourceControl: resourceControl,
|
||||
Names: names,
|
||||
NodeName: nodeName,
|
||||
IP: ip,
|
||||
StackName: stackName,
|
||||
|
|
Loading…
Reference in New Issue