Skip to content

Commit

Permalink
handle not configured use cases (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
Philippe Birbaum committed May 5, 2021
1 parent 9487a39 commit f932993
Show file tree
Hide file tree
Showing 14 changed files with 98 additions and 19 deletions.
1 change: 1 addition & 0 deletions src/Tool/src/Boost.Core/GraphQL/BoostQueries.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public static class GraphQLServiceCollectionExtensions
Action<IRequestExecutorBuilder>? configure = null)
{
IRequestExecutorBuilder builder = services.AddGraphQLServer()
.ModifyRequestOptions(m => m.IncludeExceptionDetails = true)
.AddQueryType(d => d.Name(RootTypes.Query))
.AddMutationType(d => d.Name(RootTypes.Mutation))
.AddBoostTypes();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ public class BoostApplicationContext : IBoostApplicationContext
public DirectoryInfo WorkingDirectory
=> GetWorkingDirectory();

public string? Version => typeof(BoostApplicationContext)
.Assembly?
public string? Version =>
Assembly.GetExecutingAssembly()
.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?
.InformationalVersion;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public void Setup(EncryptionKeySetting settings)
EncryptionKeySetting settings)
{
var thumb = settings.Parameters[ThumbprintParameterName];
X509Certificate2? cert = null;
X509Certificate2? cert;

if (settings.Parameters.ContainsKey("Pass"))
{
Expand Down
17 changes: 10 additions & 7 deletions src/Tool/src/Boost.Core/Infrastructure/LogConfiguration.cs
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
using System.Diagnostics;
using Boost.Core.Settings;
using Serilog;
using Serilog.Events;

namespace Boost.Infrastructure
{
public class LogConfiguration
{
public static void CreateLogger()
{
LoggerConfiguration logBuilder = new LoggerConfiguration()
.WriteTo.Console();
var logPath = SettingsStore.GetUserDirectory("logs");
LogEventLevel minLevel = LogEventLevel.Information;

if (Debugger.IsAttached)
{
logBuilder.MinimumLevel.Debug();
}
else
{
logBuilder.MinimumLevel.Warning();
minLevel = LogEventLevel.Debug;
}

LoggerConfiguration logBuilder = new LoggerConfiguration()
.WriteTo.File($"{logPath}/boost.txt", rollingInterval: RollingInterval.Day)
.WriteTo.Console(restrictedToMinimumLevel: minLevel);

logBuilder.MinimumLevel.Debug();
Log.Logger = logBuilder.CreateLogger();
}
}
Expand Down
1 change: 0 additions & 1 deletion src/Tool/src/Boost.Core/Web/WebApp/WebServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using System.Diagnostics;
using System.Threading.Tasks;
using Boost.AuthApp;
using Boost.Core.GraphQL;
using Boost.Data;
using Boost.Infrastructure;
using Boost.Security;
Expand Down
5 changes: 5 additions & 0 deletions src/Tool/src/Boost.Snapshooter/Services/SnapshooterService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ public IEnumerable<SnapshotInfo> GetSnapshots(bool withMismatchOnly)
foreach (FileInfo? ss in _boostApplicationContext.WorkingDirectory
.GetFiles("*.snap", SearchOption.AllDirectories))
{
if (ss.FullName.Contains("node_modules"))
{
continue;
}

if (ss.Directory.Name.Contains("__snapshots__"))
{
snapshots.Add(new SnapshotInfo
Expand Down
2 changes: 1 addition & 1 deletion src/UI/boost-ui/src/core/components/Git/GitPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default {
components: { SubNavigationBar },
created() {
if (this.$route.name === "Git") {
this.$router.push({ name: this.tabs[0].route });
this.$router.replace({ name: this.tabs[0].route });
}
},
data() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,21 @@
</v-list-item-group>
</v-list>
</v-col>
<v-col md="10"> <router-view></router-view> </v-col>
<v-col md="10">
<v-alert
v-if="indexEmptyWarning && repos.length === 0"
type="warning"
outlined
>
Looks like you have not indexed you local repositories. Make sure you
have configured at least 1 work root and you did execute indexing.
<br />
<br />
<router-link :to="{ name: 'Git.Index' }">Index now</router-link>
</v-alert>

<router-view></router-view>
</v-col>
</v-row>
</template>

Expand All @@ -55,6 +69,7 @@ export default {
...mapState("git", {
repos: (state) => state.local.items,
listLoading: (state) => state.local.loading,
indexEmptyWarning: (state) => state.local.indexEmptyWarning,
}),
},
methods: {
Expand Down
34 changes: 32 additions & 2 deletions src/UI/boost-ui/src/core/components/Git/RepositoriesPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,35 +36,65 @@
</v-list-item-group>
</v-list>
</v-col>
<v-col md="10"> <router-view></router-view> </v-col>

<v-col md="10">
<div v-if="repos.length === 0 && firstLoad">
<h4>Remote git repositories</h4>
<p>
You can search and view your configured remote git repositories here.
</p>

<div v-for="cs in connectedServices" :key="cs.id"></div>

<p v-if="connectedServices.length === 0">
<v-alert type="warning" outlined>
Look like you don't have any connected services setup. :-(
<br /><br />
<router-link :to="{ name: 'Settings' }">Setup now</router-link>
</v-alert>
</p>
</div>

<router-view></router-view>
</v-col>
</v-row>
</template>

<script>
import { mapActions, mapState } from "vuex";
export default {
created() {},
created() {
if (this.connectedServices.length === 0) {
this.loadConnectedServices();
}
},
data() {
return {
searchText: "",
firstLoad: true,
};
},
computed: {
...mapState("git", {
repos: (state) => state.list.items,
listLoading: (state) => state.list.loading,
}),
...mapState("app", {
connectedServices: (state) => state.connectedServices,
}),
},
methods: {
...mapActions("git", ["searchRepos"]),
...mapActions("app", ["loadConnectedServices"]),
onSelectRepo: function (repo) {
this.$router.push({
name: "Git.Repo.Details",
params: { id: repo.id, serviceId: repo.service.id },
});
},
onSearch: function () {
this.firstLoad = false;
this.searchRepos({ term: this.searchText });
},
serviceImage: function (repo) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default {
components: { SubNavigationBar },
created() {
if (this.$route.name === "Security") {
this.$router.push({ name: this.tabs[0].route });
this.$router.replace({ name: this.tabs[0].route });
}
},
data() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default {
components: { SubNavigationBar },
created() {
if (this.$route.name === "Settings") {
this.$router.push({ name: this.tabs[0].route });
this.$router.replace({ name: this.tabs[0].route });
}
},
data() {
Expand Down
2 changes: 1 addition & 1 deletion src/UI/boost-ui/src/core/components/Utils/UtilsPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default {
components: { SubNavigationBar },
created() {
if (this.$route.name === "Utils") {
this.$router.push({ name: this.tabs[0].route });
this.$router.replace({ name: this.tabs[0].route });
}
},
data() {
Expand Down
11 changes: 11 additions & 0 deletions src/UI/boost-ui/src/core/gitStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const workspaceStore = {
},
local: {
loading: false,
indexEmptyWarning: false,
items: []
},
details: {
Expand All @@ -29,6 +30,12 @@ const workspaceStore = {
REPOS_LOCAL_LOADED(state, repos) {
state.local.items = repos;
state.local.loading = false;
if (repos.length > 0) {
state.local.indexEmptyWarning = false;
}
},
REPO_LOCAL_INDEX_EMPTY_SET(state, value) {
state.local.indexEmptyWarning = value;
},
REPOS_LIST_LOADING(state, loading) {
state.list.loading = loading;
Expand Down Expand Up @@ -68,6 +75,10 @@ const workspaceStore = {
const result = await excuteGraphQL(() => searchLocalRepos(input), dispatch);
if (result.success) {
commit("REPOS_LOCAL_LOADED", result.data.searchLocalRepositories);

if (result.data.searchLocalRepositories.length === 0 && input.term.length == 0) {
commit("REPO_LOCAL_INDEX_EMPTY_SET", true);
}
}

return null;
Expand Down
17 changes: 16 additions & 1 deletion src/UI/boost-ui/src/store/appStore.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

import { getInitialData } from "../core/appService";
import { saveConnectedService, saveTokenRequestor, saveWorkRoots } from "../core/settingsService";
import { saveConnectedService, saveTokenRequestor, saveWorkRoots, getConnectedServices } from "../core/settingsService";
import { excuteGraphQL } from "./graphqlClient";

const appStore = {
Expand All @@ -10,6 +10,7 @@ const appStore = {
console: [],
userSettings: null,
app: null,
connectedServices: []
}),
mutations: {
MESSAGE_ADDED(state, message) {
Expand All @@ -34,6 +35,9 @@ const appStore = {
},
CONNECTED_SERVICE_SAVED(state, service) {
console.log(state, service);
},
CONNECTED_SERVICES_LOADED(state, services) {
state.connectedServices = services;
}
},
actions: {
Expand Down Expand Up @@ -68,6 +72,17 @@ const appStore = {
);
}
},
async loadConnectedServices({ commit, dispatch }) {
const result = await excuteGraphQL(() => getConnectedServices(), dispatch);
if (result.success) {
const { connectedServices } = result.data;
commit("CONNECTED_SERVICES_LOADED", connectedServices);

return connectedServices;
}

return null;
},
async saveConnectedService({ commit, dispatch }, service) {
const result = await excuteGraphQL(() => saveConnectedService(service), dispatch);
if (result.success) {
Expand Down

0 comments on commit f932993

Please sign in to comment.