fix(fdo): generate an edgeID when the 'Enforce environment ID' setting is disabled EE-2446 (#6465)

pull/6476/head
andres-portainer 2022-01-25 15:25:27 -03:00 committed by GitHub
parent 48f2e7316a
commit 8b4a74f06e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 5 deletions

View File

@ -70,13 +70,11 @@ export function FDOProfilesDatatableActions({
try { try {
const profile = selectedItems[0]; const profile = selectedItems[0];
const newProfile = await duplicateProfile(profile.id); const newProfile = await duplicateProfile(profile.id);
console.log({ newProfile });
notifications.success('Profile successfully duplicated', profile.name); notifications.success('Profile successfully duplicated', profile.name);
router.stateService.go('portainer.endpoints.profile.edit', { router.stateService.go('portainer.endpoints.profile.edit', {
id: newProfile.id, id: newProfile.id,
}); });
} catch (err) { } catch (err) {
console.log(err);
notifications.error( notifications.error(
'Failure', 'Failure',
err as Error, err as Error,

View File

@ -1,3 +1,5 @@
import uuidv4 from 'uuid/v4';
import { PortainerEndpointCreationTypes } from 'Portainer/models/endpoint/models'; import { PortainerEndpointCreationTypes } from 'Portainer/models/endpoint/models';
import { configureDevice, getProfiles } from 'Portainer/hostmanagement/fdo/fdo.service'; import { configureDevice, getProfiles } from 'Portainer/hostmanagement/fdo/fdo.service';
@ -98,7 +100,7 @@ angular
suffix++; suffix++;
const config = { const config = {
edgeID: endpoint.EdgeID, edgeID: endpoint.EdgeID || uuidv4(),
edgeKey: endpoint.EdgeKey, edgeKey: endpoint.EdgeKey,
name: $scope.formValues.DeviceName, name: $scope.formValues.DeviceName,
profile: $scope.formValues.DeviceProfile, profile: $scope.formValues.DeviceProfile,

View File

@ -297,11 +297,9 @@ function EndpointController(
try { try {
$scope.endpoint.ManagementInfo = JSON.parse(amtInfo.RawOutput); $scope.endpoint.ManagementInfo = JSON.parse(amtInfo.RawOutput);
} catch (err) { } catch (err) {
console.log('Failure', err, 'Unable to JSON parse AMT info: ' + amtInfo.RawOutput);
clearAMTManagementInfo(amtInfo.RawOutput); clearAMTManagementInfo(amtInfo.RawOutput);
} }
} catch (err) { } catch (err) {
console.log('Failure', err);
clearAMTManagementInfo('Unable to retrieve AMT environment details'); clearAMTManagementInfo('Unable to retrieve AMT environment details');
} }
} }