Skip to content
Merged
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
4,392 changes: 860 additions & 3,532 deletions ui/package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
"chromedriver": "131",
"dotenv": "16.0.2",
"expect": "29.0.3",
"expect-webdriverio": "5.0.5",
"expect-webdriverio": "^5.3.4",
"follow-redirects": "1.15.6",
"identity-obj-proxy": "3.0.0",
"jest": "29.7.0",
Expand Down
19 changes: 17 additions & 2 deletions ui/src/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -1923,11 +1923,26 @@ const Api = (req) => {
});
},

getInstances(domainName, serviceName, category) {
getInstances(domainName, serviceName, category, _csrf) {
const body = {
domainServices: [
{
domainName: domainName,
serviceNames: [serviceName],
},
],
resolveStaticWorkloads: category === 'static',
fetchDynamicTypeWorkloads: category === 'dynamic',
};
return new Promise((resolve, reject) => {
fetchr
.read('instances')
.params({ domainName, serviceName, category })
.params({ category, body })
.clientConfig({
headers: {
'x-csrf-token': _csrf,
},
})
.end((err, workloadList) => {
if (err) {
reject(err);
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/service/InstanceTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export default class InstanceTable extends React.Component {
service={this.props.service}
onUpdateSuccess={this.props.onSubmit}
color={color}
key={item.uuid}
key={i}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uuid property doesn't exist under item, this gets rid of a react warning

timeZone={this.props.timeZone}
_csrf={this.props._csrf}
category={this.props.category}
Expand Down
14 changes: 10 additions & 4 deletions ui/src/pages/domain/[domain]/service/[service]/instance/dynamic.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,13 @@ class DynamicInstancePage extends React.Component {
}

componentDidMount() {
const { domainName, serviceName } = this.props;
const { domainName, serviceName, _csrf } = this.props;
Promise.all([
this.props.getServiceHeaderAndInstances(
domainName,
serviceName,
SERVICE_TYPE_DYNAMIC
SERVICE_TYPE_DYNAMIC,
_csrf
),
]).catch((err) => {
let response = RequestUtils.errorCheckHelper(err);
Expand Down Expand Up @@ -256,9 +257,14 @@ const mapStateToProps = (state, props) => {
};

const mapDispatchToProps = (dispatch) => ({
getServiceHeaderAndInstances: (domainName, serviceName, category) =>
getServiceHeaderAndInstances: (domainName, serviceName, category, _csrf) =>
dispatch(
getServiceHeaderAndInstances(domainName, serviceName, category)
getServiceHeaderAndInstances(
domainName,
serviceName,
category,
_csrf
)
),
});

Expand Down
14 changes: 10 additions & 4 deletions ui/src/pages/domain/[domain]/service/[service]/instance/static.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,13 @@ class StaticInstancePage extends React.Component {
}

componentDidMount() {
const { domainName, serviceName } = this.props;
const { domainName, serviceName, _csrf } = this.props;
Promise.all([
this.props.getServiceHeaderAndInstances(
domainName,
serviceName,
SERVICE_TYPE_STATIC
SERVICE_TYPE_STATIC,
_csrf
),
]).catch((err) => {
let response = RequestUtils.errorCheckHelper(err);
Expand Down Expand Up @@ -256,9 +257,14 @@ const mapStateToProps = (state, props) => {
};

const mapDispatchToProps = (dispatch) => ({
getServiceHeaderAndInstances: (domainName, serviceName, category) =>
getServiceHeaderAndInstances: (domainName, serviceName, category, _csrf) =>
dispatch(
getServiceHeaderAndInstances(domainName, serviceName, category)
getServiceHeaderAndInstances(
domainName,
serviceName,
category,
_csrf
)
),
});

Expand Down
18 changes: 12 additions & 6 deletions ui/src/redux/thunks/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,16 +270,20 @@ export const allowProviderTemplate =
};

export const getServiceHeaderAndInstances =
(domainName, serviceName, category) => async (dispatch, getState) => {
(domainName, serviceName, category, _csrf) =>
async (dispatch, getState) => {
serviceName = serviceName.toLowerCase();
await dispatch(getServices(domainName));
await dispatch(getServiceInstances(domainName, serviceName, category));
await dispatch(
getServiceInstances(domainName, serviceName, category, _csrf)
);
await dispatch(getServiceHeaderDetails(domainName, serviceName));
await dispatch(getFeatureFlag());
};

export const getServiceInstances =
(domainName, serviceName, category) => async (dispatch, getState) => {
(domainName, serviceName, category, _csrf) =>
async (dispatch, getState) => {
serviceName = serviceName.toLowerCase();
let currService = thunkSelectService(
getState(),
Expand All @@ -295,7 +299,8 @@ export const getServiceInstances =
let instances = await API().getInstances(
domainName,
serviceName,
category
category,
_csrf
);
dispatch(
loadInstancesToStore(
Expand Down Expand Up @@ -347,7 +352,8 @@ export const addServiceHost =
const staticInstances = await API().getInstances(
domainName,
serviceName,
'static'
'static',
_csrf
);
dispatch(
loadInstancesToStore(
Expand All @@ -373,7 +379,7 @@ export const deleteInstance =
_csrf
) =>
async (dispatch, getState) => {
await dispatch(getServiceInstances(domain, service, category));
await dispatch(getServiceInstances(domain, service, category, _csrf));
let instancesData = selectInstancesWorkLoadData(
getState(),
domain,
Expand Down
19 changes: 13 additions & 6 deletions ui/src/server/handlers/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -3044,21 +3044,28 @@ Fetchr.registerService({

Fetchr.registerService({
name: 'instances',
post_for_read: true,
read(req, resource, params, config, callback) {
req.clients.msd.getWorkloadsByService(
{ domainName: params.domainName, serviceName: params.serviceName },
req.clients.msd.getWorkloadsByDomainAndService(
{ request: params.body },
(err, data) => {
if (data) {
if (
data.dynamicWorkloadList &&
data.workloads.dynamicWorkloadList &&
params.category !== 'static'
) {
return callback(null, data.dynamicWorkloadList);
return callback(
null,
data.workloads.dynamicWorkloadList
);
} else if (
data.staticWorkloadList &&
data.workloads.staticWorkloadList &&
params.category === 'static'
) {
return callback(null, data.staticWorkloadList);
return callback(
null,
data.workloads.staticWorkloadList
);
} else {
return callback(null, []);
}
Expand Down
Loading