Skip to content

Commit

Permalink
fix(web.hosting): change 2api call by iceberg on domain configuration
Browse files Browse the repository at this point in the history
ref: MANAGER-16782

Signed-off-by: Guillaume Hyenne <guillaume.hyenne@ovhcloud.com>
  • Loading branch information
ghyenne committed Jan 30, 2025
1 parent 1b893d0 commit 1a0e9d0
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -191,13 +191,13 @@ angular
.then((options) => {
$scope.model.options = options;
})
.catch((err) => {
.catch(({ data }) => {
$scope.resetAction();
Alerter.alertFromSWS(
$translate.instant(
'hosting_tab_DOMAINS_configuration_add_loading_error',
),
get(err, 'data', err),
data?.message,
$scope.alerts.main,
);
});
Expand All @@ -207,13 +207,13 @@ angular
$scope.model.hosting = hosting;
$scope.hosting = hosting;
})
.catch((err) => {
.catch(({ data }) => {
$scope.resetAction();
Alerter.alertFromSWS(
$translate.instant(
'hosting_tab_DOMAINS_configuration_add_loading_error',
),
get(err, 'data', err),
data?.message,
$scope.alerts.main,
);
});
Expand All @@ -222,13 +222,13 @@ angular
.then((options) => {
$scope.model.options = options;
})
.catch((err) => {
.catch(({ data }) => {
$scope.resetAction();
Alerter.alertFromSWS(
$translate.instant(
'hosting_tab_DOMAINS_configuration_add_loading_error',
),
get(err, 'data', err),
data?.message,
$scope.alerts.main,
);
});
Expand All @@ -237,13 +237,13 @@ angular
.then((hosting) => {
$scope.model.hosting = hosting;
})
.catch((err) => {
.catch(({ data }) => {
$scope.resetAction();
Alerter.alertFromSWS(
$translate.instant(
'hosting_tab_DOMAINS_configuration_add_loading_error',
),
get(err, 'data', err),
data?.message,
$scope.alerts.main,
);
});
Expand Down Expand Up @@ -302,13 +302,13 @@ angular
);
}
})
.catch((err) => {
.catch(({ data }) => {
$scope.resetAction();
Alerter.alertFromSWS(
$translate.instant(
'hosting_tab_DOMAINS_configuration_add_loading_error',
),
err,
data?.message,
$scope.alerts.main,
);
});
Expand Down Expand Up @@ -362,12 +362,12 @@ angular
$scope.alerts.main,
);
})
.catch((err) => {
.catch(({ data }) => {
Alerter.alertFromSWS(
$translate.instant(
'hosting_tab_DOMAINS_configuration_add_failure',
),
{ message: get(err, 'data', err), type: 'ERROR' },
{ message: data?.message, type: 'ERROR' },
$scope.alerts.main,
);
})
Expand Down Expand Up @@ -396,13 +396,13 @@ angular
$scope.model.token = data.token;
$scope.model.tokenSubdomain = data.tokenSubdomain;
})
.catch((err) => {
.catch(({ data }) => {
$scope.resetAction();
Alerter.alertFromSWS(
$translate.instant(
'hosting_tab_DOMAINS_configuration_add_loading_error',
),
get(err, 'data', err),
data?.message,
$scope.alerts.main,
);
});
Expand Down Expand Up @@ -438,25 +438,25 @@ angular
$scope.loaders.runtimes = false;
});
})
.catch((err) => {
.catch(({ data }) => {
Alerter.alertFromSWS(
$translate.instant(
'hosting_tab_DOMAINS_configuration_add_loading_error',
),
get(err, 'data', err),
data?.message,
$scope.alerts.main,
);

$scope.resetAction();
});
}
})
.catch((err) => {
.catch(({ data }) => {
Alerter.alertFromSWS(
$translate.instant(
'hosting_tab_DOMAINS_configuration_add_loading_error',
),
get(err, 'data', err),
data?.message,
$scope.alerts.main,
);

Expand Down Expand Up @@ -516,7 +516,6 @@ angular
if ($scope.selected.mode === $scope.model.mode.OVH) {
$scope.loadingConflicts = true;
HostingDomain.getExistingConfiguration(
$stateParams.productId,
$scope.selected.baseDomain.name,
$scope.selected.domain,
$scope.needWwwDomain(),
Expand All @@ -526,13 +525,13 @@ angular
$scope.model.conflicts = data;
}
})
.catch((err) => {
.catch(({ data }) => {
$scope.resetAction();
Alerter.alertFromSWS(
$translate.instant(
'hosting_tab_DOMAINS_configuration_add_loading_error',
),
get(err, 'data', err),
data?.message,
$scope.alerts.main,
);
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -337,24 +337,25 @@ angular.module('services').service(
}

/**
*
* @param {string} serviceName
* @param {string} domain
* @param {string} subDomain
* @param {boolean} wwwNeeded
*/
getExistingConfiguration(serviceName, domain, subDomain, wwwNeeded) {
return this.$http
.get(
`${this.aapiHostingPath}/${serviceName}/domains/${domain}/configuration`,
{
params: {
domainName: subDomain,
wwwNeeded,
},
},
)
.then((response) => response.data);
getExistingConfiguration(domain, subDomain, wwwNeeded) {
return this.iceberg(`/domain/zone/${domain}/record`)
.query()
.expand('CachedObjectList-Pages')
.addFilter('fieldType', 'eq', 'A')
.execute()
.$promise.then(({ data }) =>
data.filter(
(record) =>
record.subDomain === subDomain ||
(wwwNeeded &&
record.subDomain ===
['www', subDomain].filter(Boolean).join('.')),
),
);
}

/**
Expand Down

0 comments on commit 1a0e9d0

Please sign in to comment.