Skip to content

Commit

Permalink
bug/4184-app-created-by-bug (#4349)
Browse files Browse the repository at this point in the history
  • Loading branch information
lorang92 authored Jun 9, 2020
1 parent b485ec8 commit cac8308
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ public Altinn.Studio.Designer.Models.Commit GetInitialCommit(string org, string
string localServiceRepoFolder = _settings.GetServicePath(org, repository, AuthenticationHelper.GetDeveloperUserName(_httpContextAccessor.HttpContext));
using (var repo = new LibGit2Sharp.Repository(localServiceRepoFolder))
{
LibGit2Sharp.Commit firstCommit = repo.Commits.First();
LibGit2Sharp.Commit firstCommit = repo.Commits.Last();
Designer.Models.Commit commit = new Designer.Models.Commit();
commit.Message = firstCommit.Message;
commit.MessageShort = firstCommit.MessageShort;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable max-len */

import { createMuiTheme, createStyles, Grid, Typography, withStyles } from '@material-ui/core';
import classNames = require('classnames');
import * as React from 'react';
import { connect } from 'react-redux';
import AltinnColumnLayout from 'app-shared/components/AltinnColumnLayout';
Expand All @@ -13,6 +13,8 @@ import { getLanguageFromKey } from 'app-shared/utils/language';
import VersionControlHeader from 'app-shared/version-control/versionControlHeader';
import { ICommit, IRepository } from '../../../types/global';
import handleServiceInformationActionDispatchers from '../handleServiceInformationDispatcher';

import classNames = require('classnames');
export interface IAdministrationComponentProvidedProps {
classes: any;
}
Expand Down Expand Up @@ -111,6 +113,7 @@ export class AdministrationComponent extends
};
}

// eslint-disable-next-line react/state-in-constructor
public state: IAdministrationComponentState = {
editServiceDescription: false,
editServiceId: false,
Expand All @@ -126,11 +129,14 @@ export class AdministrationComponent extends
const { org, app } = altinnWindow;

handleServiceInformationActionDispatchers.fetchService(
`${altinnWindow.location.origin}/designerapi/Repository/GetRepository?org=${org}&repository=${app}`);
`${altinnWindow.location.origin}/designerapi/Repository/GetRepository?org=${org}&repository=${app}`,
);
handleServiceInformationActionDispatchers.fetchInitialCommit(
`${altinnWindow.location.origin}/designerapi/Repository/GetInitialCommit?org=${org}&repository=${app}`);
`${altinnWindow.location.origin}/designerapi/Repository/GetInitialCommit?org=${org}&repository=${app}`,
);
handleServiceInformationActionDispatchers.fetchServiceConfig(
`${altinnWindow.location.origin}/designer/${org}/${app}/Config/GetServiceConfig`);
`${altinnWindow.location.origin}/designer/${org}/${app}/Config/GetServiceConfig`,
);
}

public onServiceNameChanged = (event: any) => {
Expand All @@ -152,7 +158,8 @@ export class AdministrationComponent extends
handleServiceInformationActionDispatchers.saveServiceName(`${window.location.origin}/designer/${org}/${app}/Text/SetServiceName`, this.state.serviceName);
handleServiceInformationActionDispatchers.saveServiceConfig(
`${window.location.origin}/designer/${org}/${app}/Config/SetServiceConfig`,
this.state.serviceDescription, this.state.serviceId, this.state.serviceName);
this.state.serviceDescription, this.state.serviceId, this.state.serviceName,
);
this.setState({ editServiceName: false });
}
}
Expand All @@ -167,7 +174,8 @@ export class AdministrationComponent extends
// tslint:disable-next-line:max-line-length
handleServiceInformationActionDispatchers.saveServiceConfig(
`${window.location.origin}/designer/${org}/${app}/Config/SetServiceConfig`,
this.state.serviceDescription, this.state.serviceId, this.state.serviceName);
this.state.serviceDescription, this.state.serviceId, this.state.serviceName,
);
this.setState({ editServiceDescription: false });
}
}
Expand All @@ -182,17 +190,18 @@ export class AdministrationComponent extends
// tslint:disable-next-line:max-line-length
handleServiceInformationActionDispatchers.saveServiceConfig(
`${window.location.origin}/designer/${org}/${app}/Config/SetServiceConfig`,
this.state.serviceDescription, this.state.serviceId, this.state.serviceName);
this.state.serviceDescription, this.state.serviceId, this.state.serviceName,
);
this.setState({ editServiceId: false });
}
}

public renderSideMenuContent = (): JSX.Element => {
const {classes} = this.props;
const { classes } = this.props;
return (
<>
<Typography className={classes.sidebarHeader}>
{getLanguageFromKey('general.service_owner', this.props.language)}
{getLanguageFromKey('general.service_owner', this.props.language)}
</Typography>
<Typography className={classes.sidebarInfoText}>
{getLanguageFromKey('administration.service_owner_is', this.props.language)}
Expand All @@ -210,7 +219,7 @@ export class AdministrationComponent extends
{getLanguageFromKey('administration.created_by', this.props.language)} {formatNameAndDate(this.props.initialCommit.author.name, this.props.service.created_at)}
</Typography>
}
</>
</>
);
}

Expand Down Expand Up @@ -294,10 +303,11 @@ export class AdministrationComponent extends
<div className={this.props.classes.versionControlHeaderMargin}>
<VersionControlHeader language={this.props.language} />
</div>}
children={this.renderMainContent()}
sideMenuChildren={this.renderSideMenuContent()}
header={getLanguageFromKey('administration.administration', this.props.language)}
/>
>
{this.renderMainContent()}
</AltinnColumnLayout>
:
<Grid container={true}>
<AltinnSpinner spinnerText='Laster siden' styleObj={classes.spinnerLocation} />
Expand All @@ -316,14 +326,11 @@ const mapStateToProps = (
initialCommit: state.serviceInformation.initialCommit,
language: state.language,
service: state.serviceInformation.repositoryInfo,
// tslint:disable-next-line:max-line-length
serviceDescription: state.serviceInformation.serviceDescriptionObj ? state.serviceInformation.serviceDescriptionObj.description : '',
// tslint:disable-next-line:max-line-length
serviceDescriptionIsSaving: state.serviceInformation.serviceDescriptionObj ? state.serviceInformation.serviceDescriptionObj.saving : false,
serviceId: state.serviceInformation.serviceIdObj ? state.serviceInformation.serviceIdObj.serviceId : '',
serviceIdIsSaving: state.serviceInformation.serviceIdObj ? state.serviceInformation.serviceIdObj.saving : false,
serviceName: state.serviceInformation.serviceNameObj ? state.serviceInformation.serviceNameObj.name : '',
// tslint:disable-next-line:max-line-length
serviceNameIsSaving: state.serviceInformation.serviceNameObj ? state.serviceInformation.serviceNameObj.saving : false,
};
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "app-development",
"version": "0.1.0",
"version": "0.1.1",
"private": true,
"scripts": {
"start": "cross-env NODE_ENV=development webpack-dev-server --config webpack.config.development.js --mode development --hot",
Expand Down

0 comments on commit cac8308

Please sign in to comment.